diff --git a/.github/workflows/npm-pub.yml b/.github/workflows/npm-pub.yml index 7d9576c2..cb224876 100755 --- a/.github/workflows/npm-pub.yml +++ b/.github/workflows/npm-pub.yml @@ -27,6 +27,11 @@ jobs: with: node-version: ${{ matrix.node-version }} + - name: config git + run: | + git config user.name ${{ secrets.GIT_USERNAME }} + git config user.email ${{ secrets.GIT_EMAIL }} + - name: install dependencies run: npm install diff --git a/README.md b/README.md index 9a4ea396..d66a0a5a 100755 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@

-@mlz/admin 是遵循编程猫后台管理系统设计规范的 React 组件库 +This is a React Components Library, packaged for codemao's management system design guideline

🌈 https://www.mlz-admin.com @@ -12,15 +12,15 @@ --- -## 使用方法 +## Usage -#### 1. 安装 +#### 1. Install ```shell $ npm install @mlz/admin -S ``` -#### 2. 使用 +#### 2. Import Code ```jsx import { Button } from '@mlz/admin'; @@ -28,12 +28,12 @@ import { Button } from '@mlz/admin'; const App = () => ; ``` -更多详细内容请访问本库的在线文档。 +_visit our [WEBSITE](https://www.mlz-admin.com) to learn more!_ -## 贡献指南 +## Contribution -非常期待你的 PR!本库的开发代码,基于 [《贡献指南》](https://github.com/juicecube/mlz-admin/blob/master/CONTRIBUTING.md) ,所以请先仔细阅读。 +we are expecting your great `Pull Request` which's based on <[our contribution doc](https://github.com/juicecube/mlz-admin/blob/master/CONTRIBUTING.md)>. so read it before your coding plz. -## 讨论组 +## Dingtalk Disscussion Group Dingtalk Qrcode diff --git a/ZH_CN.md b/ZH_CN.md new file mode 100755 index 00000000..9a4ea396 --- /dev/null +++ b/ZH_CN.md @@ -0,0 +1,39 @@ +

+@mlz/admin 是遵循编程猫后台管理系统设计规范的 React 组件库 +

+

+🌈 https://www.mlz-admin.com +

+
+ +[![npm version](https://img.shields.io/npm/v/@mlz/admin?color=lightblue&label=%40mlz%2Fadmin)](https://github.com/juicecube/mlz-admin) [![codecov](https://codecov.io/gh/juicecube/mlz-admin/branch/master/graph/badge.svg?token=ZNPL3AMQ7Z)](https://app.codecov.io/gh/juicecube/mlz-admin/) ![actions](https://github.com/juicecube/mlz-admin/workflows/checkers/badge.svg) [![license](https://img.shields.io/badge/license-MIT-green.svg?color=lightblue)](https://github.com/juicecube/mlz-admin/blob/master/CONTRIBUTING.md) [![static](https://img.shields.io/npm/dm/@mlz/admin?label=downloads&color=lightblue)](https://www.npmjs.com/package/@mlz/admin) + +
+ +--- + +## 使用方法 + +#### 1. 安装 + +```shell +$ npm install @mlz/admin -S +``` + +#### 2. 使用 + +```jsx +import { Button } from '@mlz/admin'; + +const App = () => ; +``` + +更多详细内容请访问本库的在线文档。 + +## 贡献指南 + +非常期待你的 PR!本库的开发代码,基于 [《贡献指南》](https://github.com/juicecube/mlz-admin/blob/master/CONTRIBUTING.md) ,所以请先仔细阅读。 + +## 讨论组 + +Dingtalk Qrcode diff --git a/docs/components/composit/use-auth-guard.md b/docs/components/composit/use-auth-guard.md new file mode 100755 index 00000000..97518490 --- /dev/null +++ b/docs/components/composit/use-auth-guard.md @@ -0,0 +1,17 @@ +# useAuthGuard 内部账号权限系统 + +> `📦 内部账号权限系统`通过请求接口的返回内容动态生成一个项目所需的权限列表和交互资源。 + +## 1. 基本使用 + +```tsx +/** + * title: 基本使用 + */ +import React from 'react'; +import { Button, Modal, message, useAuthGuard, AuthMenu } from '@mlz/adminer'; + +export default () => { + return ; +}; +``` diff --git a/docs/components/interactivity/dark-theme-toggler.md b/docs/components/interactivity/dark-theme-toggler.md index df08a6fc..d46ce0cd 100755 --- a/docs/components/interactivity/dark-theme-toggler.md +++ b/docs/components/interactivity/dark-theme-toggler.md @@ -12,11 +12,16 @@ import React, { useState, useEffect } from 'react'; import { DarkThemeToggler, message } from '@mlz/admin'; class App extends React.Component { + componentDidMount() { + window.addEventListener('themeChange', (e) => { + message.info(`window.addEventListener触发:切换成功。文档无法保证样式正常`); + }); + } render() { return ( { - e === 'dark' && message.info(`切换成功。文档无法保证样式正常`); + message.info(`组件onChange触发:切换成功。文档无法保证样式正常`); }} /> ); @@ -30,6 +35,7 @@ export default App; - Antd 自身的组件,并没有实现`动态主题切换`功能(不论 dark/default 切换,还是多彩切换),我们通过比较节能的方式添加了进来. - 我们在全局注入了 css 变量:`--theme-bg`、`--theme-sub-bg`以及`--theme-menu-bg`,会在主题发生变化时自动切换对应的值,方便`必须设置与主题配套的显性颜色`时使用。如果有过多需求请提 issue。 +- 当主题发生变化的时候,会在 window 上监听到 `themeChange` 事件的触发。 --- diff --git a/docs/components/interactivity/tabs.md b/docs/components/interactivity/tabs.md index 25027a78..a984f76b 100755 --- a/docs/components/interactivity/tabs.md +++ b/docs/components/interactivity/tabs.md @@ -70,8 +70,9 @@ const { ContextMenuTabs, TabPane } = Tabs; export default () => ( { @@ -95,15 +96,42 @@ export default () => ( Content of Tab Pane 1 - - Content of Tab Pane 2 - - - Content of Tab Pane 3 - - - Content of Tab Pane 4 - + {[ + { + tab: 'Tab 2', + key: 2, + text: 'Content of Tab Pane 2', + closable: false, + }, + { + tab: 'Tab 3', + key: 3, + text: 'Content of Tab Pane 3', + }, + { + tab: 'Tab 4', + key: 4, + text: 'Content of Tab Pane 4', + }, + { + tab: 'Tab 5', + key: 5, + text: 'Content of Tab Pane 5', + }, + { + tab: 'Tab 6', + key: 6, + text: 'Content of Tab Pane 6', + }, + { + tab: 'Tab 7', + key: 7, + text: 'Content of Tab Pane 7', + }, + ].map((pane: any, index: number) => { + const { tab, key, text, closable } = pane; + return ; + })} ); ``` diff --git a/lerna.json b/lerna.json index 7c099736..2f5aa008 100755 --- a/lerna.json +++ b/lerna.json @@ -1,5 +1,5 @@ { - "version": "0.10.0", + "version": "1.0.0", "useWorkspaces": true, "packages": [ "packages/*" diff --git a/package-lock.json b/package-lock.json old mode 100644 new mode 100755 index a1cd482b..30c1854a --- a/package-lock.json +++ b/package-lock.json @@ -4675,12 +4675,6 @@ "integrity": "sha1-7ihweulOEdK4J7y+UnC86n8+ce4=", "dev": true }, - "@types/katex": { - "version": "0.11.0", - "resolved": "https://registry.npmjs.org/@types/katex/-/katex-0.11.0.tgz", - "integrity": "sha512-27BfE8zASRLYfSBNMk5/+KIjr2CBBrH0i5lhsO04fca4TGirIIMay73v3zNkzqmsaeIa/Mi5kejWDcxPLAmkvA==", - "dev": true - }, "@types/lodash": { "version": "4.14.168", "resolved": "https://registry.npmjs.org/@types/lodash/-/lodash-4.14.168.tgz", @@ -4696,6 +4690,12 @@ "@types/lodash": "*" } }, + "@types/mathjax": { + "version": "0.0.36", + "resolved": "https://registry.npmjs.org/@types/mathjax/-/mathjax-0.0.36.tgz", + "integrity": "sha512-TqDJc2GWuTqd/m+G/FbNkN+/TF2OCCHvcawmhIrUaZkdVquMdNZmNiNUkupNg9qctorXXkVLVSogZv1DhmgLmg==", + "dev": true + }, "@types/mdast": { "version": "3.0.3", "resolved": "https://registry.npmjs.org/@types/mdast/-/mdast-3.0.3.tgz", @@ -5047,12 +5047,42 @@ } }, "@umijs/ast": { - "version": "3.4.8", - "resolved": "https://registry.npmjs.org/@umijs/ast/-/ast-3.4.8.tgz", - "integrity": "sha512-3JAAdrZXcE78rODzhoK9yABlJK59DGscx3c0iNwbvdK0ylyYgmb7+Qm9dbEQn4kYeKX5ximV4CD5X8IljzicIA==", + "version": "3.4.25", + "resolved": "https://registry.npmjs.org/@umijs/ast/-/ast-3.4.25.tgz", + "integrity": "sha512-//rm1DQboiieS0Hyq9g8FX498yfd6xYN05/YereV9CD0PCjpZAw3MAASIZN8ILccQog2KP1GUMTRnfJSrBT4hA==", "dev": true, "requires": { - "@umijs/utils": "3.4.8" + "@umijs/utils": "3.4.25" + }, + "dependencies": { + "@umijs/deps": { + "version": "3.4.25", + "resolved": "https://registry.npmjs.org/@umijs/deps/-/deps-3.4.25.tgz", + "integrity": "sha512-lMZsuRKq9hlLEBZxTje/DHu2ONRr+OIpfV1gaqH/IwrDZ5W9n3fLp/7L1potKq8xLV4GacSWBy40HRrzsulNog==", + "dev": true, + "requires": { + "@bloomberg/record-tuple-polyfill": "0.0.3", + "chokidar": "3.5.1", + "clipboardy": "2.3.0", + "jest-worker": "24.9.0", + "prettier": "2.2.1" + } + }, + "@umijs/utils": { + "version": "3.4.25", + "resolved": "https://registry.npmjs.org/@umijs/utils/-/utils-3.4.25.tgz", + "integrity": "sha512-r/IiNRE7gM572Tp6JJgJ6KhioOdFWUL+1OQ51QdTah44CSzFbQTh/tjF6CWEErBzTVZ6O6W9P04XnmF8TCin4Q==", + "dev": true, + "requires": { + "@umijs/deps": "3.4.25" + } + }, + "prettier": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.2.1.tgz", + "integrity": "sha512-PqyhM2yCjg/oKkFPtTGUojv7gnZAoG80ttl45O6x2Ug/rMJw4wcc9k6aaf2hibP7BGVCCM33gZoGjyvt9mm16Q==", + "dev": true + } } }, "@umijs/babel-plugin-auto-css-modules": { @@ -5122,26 +5152,118 @@ } }, "@umijs/bundler-utils": { - "version": "3.4.8", - "resolved": "https://registry.npmjs.org/@umijs/bundler-utils/-/bundler-utils-3.4.8.tgz", - "integrity": "sha512-R1iIOO3PeGiPaFF5yZ9E9KMn6vXH41b80saWjcAS2nTzb2edo4+HGZSdTYK8SbLHzQQzcaoGy9AUTi2bMDtAtw==", + "version": "3.4.25", + "resolved": "https://registry.npmjs.org/@umijs/bundler-utils/-/bundler-utils-3.4.25.tgz", + "integrity": "sha512-72DVeLkhol922P1B5vD3ZhnKJRhHneoVA6VkaS0Ftcq5HsYN0w0zumdoN6dwyYtsi6e27OIw8o2h5EQ17warXw==", "dev": true, "requires": { - "@umijs/babel-preset-umi": "3.4.8", - "@umijs/types": "3.4.8", - "@umijs/utils": "3.4.8" + "@umijs/babel-preset-umi": "3.4.25", + "@umijs/types": "3.4.25", + "@umijs/utils": "3.4.25" + }, + "dependencies": { + "@babel/runtime": { + "version": "7.12.5", + "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.12.5.tgz", + "integrity": "sha512-plcc+hbExy3McchJCEQG3knOsuh3HH+Prx1P6cLIkET/0dLuQDEnrT+s27Axgc9bqfsmNUNHfscgMUdBpC9xfg==", + "dev": true, + "requires": { + "regenerator-runtime": "^0.13.4" + } + }, + "@umijs/babel-plugin-auto-css-modules": { + "version": "3.4.25", + "resolved": "https://registry.npmjs.org/@umijs/babel-plugin-auto-css-modules/-/babel-plugin-auto-css-modules-3.4.25.tgz", + "integrity": "sha512-rlvePRMy2ak99/MeUCgjSYB9a6YmeG0gJqyQ1MVNJ6biDMkegKcI67zuIY+cNfr+2sIQ4gwj5oO0vGYS/THv5g==", + "dev": true + }, + "@umijs/babel-plugin-import-to-await-require": { + "version": "3.4.25", + "resolved": "https://registry.npmjs.org/@umijs/babel-plugin-import-to-await-require/-/babel-plugin-import-to-await-require-3.4.25.tgz", + "integrity": "sha512-Ca8OP6yEcaq1VnUy6GMLxPCVFFchT+dTgNpQmR6MMzDactXSM2gP/+BAny0tJm9Qr9LjyYJ9sPkZAMDsSwXFKA==", + "dev": true, + "requires": { + "@umijs/utils": "3.4.25" + } + }, + "@umijs/babel-plugin-lock-core-js-3": { + "version": "3.4.25", + "resolved": "https://registry.npmjs.org/@umijs/babel-plugin-lock-core-js-3/-/babel-plugin-lock-core-js-3-3.4.25.tgz", + "integrity": "sha512-/+zUcwZiZ8eq/wUzp886UkXGqiI9lxLub2HTNW09rnwCHTUd9BM/ccInXrPD/zsQ1xA+hYcQiWftBvhsV19fHQ==", + "dev": true, + "requires": { + "@umijs/utils": "3.4.25", + "core-js": "3.6.5" + } + }, + "@umijs/babel-plugin-no-anonymous-default-export": { + "version": "3.4.25", + "resolved": "https://registry.npmjs.org/@umijs/babel-plugin-no-anonymous-default-export/-/babel-plugin-no-anonymous-default-export-3.4.25.tgz", + "integrity": "sha512-znQAVkOu+3z343ZfprR4Kz+0grd90CJd21dHFnpa6mo5P4H2JBrrHCWS2GN0lGPuyW9r9zVboFBTFaXBnP0trw==", + "dev": true, + "requires": { + "@umijs/utils": "3.4.25" + } + }, + "@umijs/babel-preset-umi": { + "version": "3.4.25", + "resolved": "https://registry.npmjs.org/@umijs/babel-preset-umi/-/babel-preset-umi-3.4.25.tgz", + "integrity": "sha512-ml9K1oWtse9q42GddbW6ijh49uEW8WKqbiKhYP7wquNijmtWx5ZnQKF2VqRTkuzq3+kY50B9DtVSqoq+/YbjQg==", + "dev": true, + "requires": { + "@babel/runtime": "7.12.5", + "@umijs/babel-plugin-auto-css-modules": "3.4.25", + "@umijs/babel-plugin-import-to-await-require": "3.4.25", + "@umijs/babel-plugin-lock-core-js-3": "3.4.25", + "@umijs/babel-plugin-no-anonymous-default-export": "3.4.25" + } + }, + "@umijs/deps": { + "version": "3.4.25", + "resolved": "https://registry.npmjs.org/@umijs/deps/-/deps-3.4.25.tgz", + "integrity": "sha512-lMZsuRKq9hlLEBZxTje/DHu2ONRr+OIpfV1gaqH/IwrDZ5W9n3fLp/7L1potKq8xLV4GacSWBy40HRrzsulNog==", + "dev": true, + "requires": { + "@bloomberg/record-tuple-polyfill": "0.0.3", + "chokidar": "3.5.1", + "clipboardy": "2.3.0", + "jest-worker": "24.9.0", + "prettier": "2.2.1" + } + }, + "@umijs/utils": { + "version": "3.4.25", + "resolved": "https://registry.npmjs.org/@umijs/utils/-/utils-3.4.25.tgz", + "integrity": "sha512-r/IiNRE7gM572Tp6JJgJ6KhioOdFWUL+1OQ51QdTah44CSzFbQTh/tjF6CWEErBzTVZ6O6W9P04XnmF8TCin4Q==", + "dev": true, + "requires": { + "@umijs/deps": "3.4.25" + } + }, + "core-js": { + "version": "3.6.5", + "resolved": "https://registry.npmjs.org/core-js/-/core-js-3.6.5.tgz", + "integrity": "sha512-vZVEEwZoIsI+vPEuoF9Iqf5H7/M3eeQqWlQnYa8FSKKePuYTf5MWnxb5SDAzCa60b3JBRS5g9b+Dq7b1y/RCrA==", + "dev": true + }, + "prettier": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.2.1.tgz", + "integrity": "sha512-PqyhM2yCjg/oKkFPtTGUojv7gnZAoG80ttl45O6x2Ug/rMJw4wcc9k6aaf2hibP7BGVCCM33gZoGjyvt9mm16Q==", + "dev": true + } } }, "@umijs/bundler-webpack": { - "version": "3.4.8", - "resolved": "https://registry.npmjs.org/@umijs/bundler-webpack/-/bundler-webpack-3.4.8.tgz", - "integrity": "sha512-u5/or/rD1/yl2N7pFTbDfoOlYKOKpq67Pyy6hjxOJ6zvo+T3Ntc2iBGDtJ27KBSfhNyYULEaTkHSg7Q7yLM0Eg==", + "version": "3.4.25", + "resolved": "https://registry.npmjs.org/@umijs/bundler-webpack/-/bundler-webpack-3.4.25.tgz", + "integrity": "sha512-9/vzk2A0cVHEjmqsh0yOyC2wuswQ/Nd/m8DB2Tc+miyGtACTPesB6IMkh1Q3fHqkrB3RfbBxR2mooBVWvn6v3A==", "dev": true, "requires": { - "@umijs/bundler-utils": "3.4.8", - "@umijs/deps": "0.8.1", - "@umijs/types": "3.4.8", - "@umijs/utils": "3.4.8", + "@umijs/bundler-utils": "3.4.25", + "@umijs/deps": "3.4.25", + "@umijs/types": "3.4.25", + "@umijs/utils": "3.4.25", "jest-worker": "26.6.2", "node-libs-browser": "2.2.1", "normalize-url": "1.9.1", @@ -5154,6 +5276,40 @@ "webpack-chain": "6.5.1" }, "dependencies": { + "@umijs/deps": { + "version": "3.4.25", + "resolved": "https://registry.npmjs.org/@umijs/deps/-/deps-3.4.25.tgz", + "integrity": "sha512-lMZsuRKq9hlLEBZxTje/DHu2ONRr+OIpfV1gaqH/IwrDZ5W9n3fLp/7L1potKq8xLV4GacSWBy40HRrzsulNog==", + "dev": true, + "requires": { + "@bloomberg/record-tuple-polyfill": "0.0.3", + "chokidar": "3.5.1", + "clipboardy": "2.3.0", + "jest-worker": "24.9.0", + "prettier": "2.2.1" + }, + "dependencies": { + "jest-worker": { + "version": "24.9.0", + "resolved": "https://registry.npmjs.org/jest-worker/-/jest-worker-24.9.0.tgz", + "integrity": "sha512-51PE4haMSXcHohnSMdM42anbvZANYTqMrr52tVKPqqsPJMzoP6FYYDVqahX/HrAoKEKz3uUPzSvKs9A3qR4iVw==", + "dev": true, + "requires": { + "merge-stream": "^2.0.0", + "supports-color": "^6.1.0" + } + } + } + }, + "@umijs/utils": { + "version": "3.4.25", + "resolved": "https://registry.npmjs.org/@umijs/utils/-/utils-3.4.25.tgz", + "integrity": "sha512-r/IiNRE7gM572Tp6JJgJ6KhioOdFWUL+1OQ51QdTah44CSzFbQTh/tjF6CWEErBzTVZ6O6W9P04XnmF8TCin4Q==", + "dev": true, + "requires": { + "@umijs/deps": "3.4.25" + } + }, "chalk": { "version": "2.4.2", "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", @@ -5165,12 +5321,6 @@ "supports-color": "^5.3.0" }, "dependencies": { - "has-flag": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", - "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=", - "dev": true - }, "supports-color": { "version": "5.5.0", "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", @@ -5182,12 +5332,6 @@ } } }, - "has-flag": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", - "dev": true - }, "jest-worker": { "version": "26.6.2", "resolved": "https://registry.npmjs.org/jest-worker/-/jest-worker-26.6.2.tgz", @@ -5197,6 +5341,23 @@ "@types/node": "*", "merge-stream": "^2.0.0", "supports-color": "^7.0.0" + }, + "dependencies": { + "has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "dev": true + }, + "supports-color": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", + "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "dev": true, + "requires": { + "has-flag": "^4.0.0" + } + } } }, "postcss": { @@ -5208,25 +5369,14 @@ "chalk": "^2.4.2", "source-map": "^0.6.1", "supports-color": "^6.1.0" - }, - "dependencies": { - "has-flag": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", - "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=", - "dev": true - }, - "supports-color": { - "version": "6.1.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-6.1.0.tgz", - "integrity": "sha512-qe1jfm1Mg7Nq/NSh6XE24gPXROEVsWHxC1LIx//XNlD9iw7YZQGjZNjYN7xGaEG6iKdA8EtNFW6R0gjnVXp+wQ==", - "dev": true, - "requires": { - "has-flag": "^3.0.0" - } - } } }, + "prettier": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.2.1.tgz", + "integrity": "sha512-PqyhM2yCjg/oKkFPtTGUojv7gnZAoG80ttl45O6x2Ug/rMJw4wcc9k6aaf2hibP7BGVCCM33gZoGjyvt9mm16Q==", + "dev": true + }, "source-map": { "version": "0.6.1", "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", @@ -5234,12 +5384,12 @@ "dev": true }, "supports-color": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", - "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-6.1.0.tgz", + "integrity": "sha512-qe1jfm1Mg7Nq/NSh6XE24gPXROEVsWHxC1LIx//XNlD9iw7YZQGjZNjYN7xGaEG6iKdA8EtNFW6R0gjnVXp+wQ==", "dev": true, "requires": { - "has-flag": "^4.0.0" + "has-flag": "^3.0.0" } }, "terser": { @@ -5264,15 +5414,107 @@ } }, "@umijs/core": { - "version": "3.4.8", - "resolved": "https://registry.npmjs.org/@umijs/core/-/core-3.4.8.tgz", - "integrity": "sha512-UQY1VrAUQBGYjXMFsFou0TBBWrhlhPXYcgAM/2RSD10RZhTynoTiwAmkwDGU2R0gTtsf4GJO+3sDO4Qng2PbQw==", + "version": "3.4.25", + "resolved": "https://registry.npmjs.org/@umijs/core/-/core-3.4.25.tgz", + "integrity": "sha512-gB4KNxVbENIgdfZz7xAjkWxNmQDReYxq40ojJFcQX8HgV2EhDhXGQtp8uJ7mDpjrhx51uF46SrNwdpL4YBcizA==", "dev": true, "requires": { - "@umijs/ast": "3.4.8", - "@umijs/babel-preset-umi": "3.4.8", - "@umijs/deps": "0.8.1", - "@umijs/utils": "3.4.8" + "@umijs/ast": "3.4.25", + "@umijs/babel-preset-umi": "3.4.25", + "@umijs/deps": "3.4.25", + "@umijs/utils": "3.4.25" + }, + "dependencies": { + "@babel/runtime": { + "version": "7.12.5", + "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.12.5.tgz", + "integrity": "sha512-plcc+hbExy3McchJCEQG3knOsuh3HH+Prx1P6cLIkET/0dLuQDEnrT+s27Axgc9bqfsmNUNHfscgMUdBpC9xfg==", + "dev": true, + "requires": { + "regenerator-runtime": "^0.13.4" + } + }, + "@umijs/babel-plugin-auto-css-modules": { + "version": "3.4.25", + "resolved": "https://registry.npmjs.org/@umijs/babel-plugin-auto-css-modules/-/babel-plugin-auto-css-modules-3.4.25.tgz", + "integrity": "sha512-rlvePRMy2ak99/MeUCgjSYB9a6YmeG0gJqyQ1MVNJ6biDMkegKcI67zuIY+cNfr+2sIQ4gwj5oO0vGYS/THv5g==", + "dev": true + }, + "@umijs/babel-plugin-import-to-await-require": { + "version": "3.4.25", + "resolved": "https://registry.npmjs.org/@umijs/babel-plugin-import-to-await-require/-/babel-plugin-import-to-await-require-3.4.25.tgz", + "integrity": "sha512-Ca8OP6yEcaq1VnUy6GMLxPCVFFchT+dTgNpQmR6MMzDactXSM2gP/+BAny0tJm9Qr9LjyYJ9sPkZAMDsSwXFKA==", + "dev": true, + "requires": { + "@umijs/utils": "3.4.25" + } + }, + "@umijs/babel-plugin-lock-core-js-3": { + "version": "3.4.25", + "resolved": "https://registry.npmjs.org/@umijs/babel-plugin-lock-core-js-3/-/babel-plugin-lock-core-js-3-3.4.25.tgz", + "integrity": "sha512-/+zUcwZiZ8eq/wUzp886UkXGqiI9lxLub2HTNW09rnwCHTUd9BM/ccInXrPD/zsQ1xA+hYcQiWftBvhsV19fHQ==", + "dev": true, + "requires": { + "@umijs/utils": "3.4.25", + "core-js": "3.6.5" + } + }, + "@umijs/babel-plugin-no-anonymous-default-export": { + "version": "3.4.25", + "resolved": "https://registry.npmjs.org/@umijs/babel-plugin-no-anonymous-default-export/-/babel-plugin-no-anonymous-default-export-3.4.25.tgz", + "integrity": "sha512-znQAVkOu+3z343ZfprR4Kz+0grd90CJd21dHFnpa6mo5P4H2JBrrHCWS2GN0lGPuyW9r9zVboFBTFaXBnP0trw==", + "dev": true, + "requires": { + "@umijs/utils": "3.4.25" + } + }, + "@umijs/babel-preset-umi": { + "version": "3.4.25", + "resolved": "https://registry.npmjs.org/@umijs/babel-preset-umi/-/babel-preset-umi-3.4.25.tgz", + "integrity": "sha512-ml9K1oWtse9q42GddbW6ijh49uEW8WKqbiKhYP7wquNijmtWx5ZnQKF2VqRTkuzq3+kY50B9DtVSqoq+/YbjQg==", + "dev": true, + "requires": { + "@babel/runtime": "7.12.5", + "@umijs/babel-plugin-auto-css-modules": "3.4.25", + "@umijs/babel-plugin-import-to-await-require": "3.4.25", + "@umijs/babel-plugin-lock-core-js-3": "3.4.25", + "@umijs/babel-plugin-no-anonymous-default-export": "3.4.25" + } + }, + "@umijs/deps": { + "version": "3.4.25", + "resolved": "https://registry.npmjs.org/@umijs/deps/-/deps-3.4.25.tgz", + "integrity": "sha512-lMZsuRKq9hlLEBZxTje/DHu2ONRr+OIpfV1gaqH/IwrDZ5W9n3fLp/7L1potKq8xLV4GacSWBy40HRrzsulNog==", + "dev": true, + "requires": { + "@bloomberg/record-tuple-polyfill": "0.0.3", + "chokidar": "3.5.1", + "clipboardy": "2.3.0", + "jest-worker": "24.9.0", + "prettier": "2.2.1" + } + }, + "@umijs/utils": { + "version": "3.4.25", + "resolved": "https://registry.npmjs.org/@umijs/utils/-/utils-3.4.25.tgz", + "integrity": "sha512-r/IiNRE7gM572Tp6JJgJ6KhioOdFWUL+1OQ51QdTah44CSzFbQTh/tjF6CWEErBzTVZ6O6W9P04XnmF8TCin4Q==", + "dev": true, + "requires": { + "@umijs/deps": "3.4.25" + } + }, + "core-js": { + "version": "3.6.5", + "resolved": "https://registry.npmjs.org/core-js/-/core-js-3.6.5.tgz", + "integrity": "sha512-vZVEEwZoIsI+vPEuoF9Iqf5H7/M3eeQqWlQnYa8FSKKePuYTf5MWnxb5SDAzCa60b3JBRS5g9b+Dq7b1y/RCrA==", + "dev": true + }, + "prettier": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.2.1.tgz", + "integrity": "sha512-PqyhM2yCjg/oKkFPtTGUojv7gnZAoG80ttl45O6x2Ug/rMJw4wcc9k6aaf2hibP7BGVCCM33gZoGjyvt9mm16Q==", + "dev": true + } } }, "@umijs/deps": { @@ -5427,21 +5669,21 @@ } }, "@umijs/preset-built-in": { - "version": "3.4.8", - "resolved": "https://registry.npmjs.org/@umijs/preset-built-in/-/preset-built-in-3.4.8.tgz", - "integrity": "sha512-/Fzmh9FwNA0PMKwFN20VhhHkOUqzfeX0imNaigGjqC72AF36sLkGLk9IbT5dqdEsC0OJSs+1rpk7n8fWoqf95A==", + "version": "3.4.25", + "resolved": "https://registry.npmjs.org/@umijs/preset-built-in/-/preset-built-in-3.4.25.tgz", + "integrity": "sha512-N03bUIbk/P91P+P6tbe3ZENpnM6y+p9oDn3AEGyceEZIk0LhJ026h3r53zlO8acEWrYZfHq4LXUrF7ph3TnaYA==", "dev": true, "requires": { "@types/react-router-config": "5.0.2", - "@umijs/babel-preset-umi": "3.4.8", - "@umijs/bundler-webpack": "3.4.8", - "@umijs/deps": "0.8.1", - "@umijs/renderer-mpa": "3.4.8", - "@umijs/renderer-react": "3.4.8", - "@umijs/runtime": "3.4.8", - "@umijs/server": "3.4.8", - "@umijs/types": "3.4.8", - "@umijs/utils": "3.4.8", + "@umijs/babel-preset-umi": "3.4.25", + "@umijs/bundler-webpack": "3.4.25", + "@umijs/deps": "3.4.25", + "@umijs/renderer-mpa": "3.4.25", + "@umijs/renderer-react": "3.4.25", + "@umijs/runtime": "3.4.25", + "@umijs/server": "3.4.25", + "@umijs/types": "3.4.25", + "@umijs/utils": "3.4.25", "es5-imcompatible-versions": "^0.1.62", "history-with-query": "4.10.4", "react-refresh": "0.9.0", @@ -5451,6 +5693,96 @@ "regenerator-runtime": "0.13.5" }, "dependencies": { + "@babel/runtime": { + "version": "7.12.5", + "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.12.5.tgz", + "integrity": "sha512-plcc+hbExy3McchJCEQG3knOsuh3HH+Prx1P6cLIkET/0dLuQDEnrT+s27Axgc9bqfsmNUNHfscgMUdBpC9xfg==", + "dev": true, + "requires": { + "regenerator-runtime": "^0.13.4" + } + }, + "@umijs/babel-plugin-auto-css-modules": { + "version": "3.4.25", + "resolved": "https://registry.npmjs.org/@umijs/babel-plugin-auto-css-modules/-/babel-plugin-auto-css-modules-3.4.25.tgz", + "integrity": "sha512-rlvePRMy2ak99/MeUCgjSYB9a6YmeG0gJqyQ1MVNJ6biDMkegKcI67zuIY+cNfr+2sIQ4gwj5oO0vGYS/THv5g==", + "dev": true + }, + "@umijs/babel-plugin-import-to-await-require": { + "version": "3.4.25", + "resolved": "https://registry.npmjs.org/@umijs/babel-plugin-import-to-await-require/-/babel-plugin-import-to-await-require-3.4.25.tgz", + "integrity": "sha512-Ca8OP6yEcaq1VnUy6GMLxPCVFFchT+dTgNpQmR6MMzDactXSM2gP/+BAny0tJm9Qr9LjyYJ9sPkZAMDsSwXFKA==", + "dev": true, + "requires": { + "@umijs/utils": "3.4.25" + } + }, + "@umijs/babel-plugin-lock-core-js-3": { + "version": "3.4.25", + "resolved": "https://registry.npmjs.org/@umijs/babel-plugin-lock-core-js-3/-/babel-plugin-lock-core-js-3-3.4.25.tgz", + "integrity": "sha512-/+zUcwZiZ8eq/wUzp886UkXGqiI9lxLub2HTNW09rnwCHTUd9BM/ccInXrPD/zsQ1xA+hYcQiWftBvhsV19fHQ==", + "dev": true, + "requires": { + "@umijs/utils": "3.4.25", + "core-js": "3.6.5" + } + }, + "@umijs/babel-plugin-no-anonymous-default-export": { + "version": "3.4.25", + "resolved": "https://registry.npmjs.org/@umijs/babel-plugin-no-anonymous-default-export/-/babel-plugin-no-anonymous-default-export-3.4.25.tgz", + "integrity": "sha512-znQAVkOu+3z343ZfprR4Kz+0grd90CJd21dHFnpa6mo5P4H2JBrrHCWS2GN0lGPuyW9r9zVboFBTFaXBnP0trw==", + "dev": true, + "requires": { + "@umijs/utils": "3.4.25" + } + }, + "@umijs/babel-preset-umi": { + "version": "3.4.25", + "resolved": "https://registry.npmjs.org/@umijs/babel-preset-umi/-/babel-preset-umi-3.4.25.tgz", + "integrity": "sha512-ml9K1oWtse9q42GddbW6ijh49uEW8WKqbiKhYP7wquNijmtWx5ZnQKF2VqRTkuzq3+kY50B9DtVSqoq+/YbjQg==", + "dev": true, + "requires": { + "@babel/runtime": "7.12.5", + "@umijs/babel-plugin-auto-css-modules": "3.4.25", + "@umijs/babel-plugin-import-to-await-require": "3.4.25", + "@umijs/babel-plugin-lock-core-js-3": "3.4.25", + "@umijs/babel-plugin-no-anonymous-default-export": "3.4.25" + } + }, + "@umijs/deps": { + "version": "3.4.25", + "resolved": "https://registry.npmjs.org/@umijs/deps/-/deps-3.4.25.tgz", + "integrity": "sha512-lMZsuRKq9hlLEBZxTje/DHu2ONRr+OIpfV1gaqH/IwrDZ5W9n3fLp/7L1potKq8xLV4GacSWBy40HRrzsulNog==", + "dev": true, + "requires": { + "@bloomberg/record-tuple-polyfill": "0.0.3", + "chokidar": "3.5.1", + "clipboardy": "2.3.0", + "jest-worker": "24.9.0", + "prettier": "2.2.1" + } + }, + "@umijs/utils": { + "version": "3.4.25", + "resolved": "https://registry.npmjs.org/@umijs/utils/-/utils-3.4.25.tgz", + "integrity": "sha512-r/IiNRE7gM572Tp6JJgJ6KhioOdFWUL+1OQ51QdTah44CSzFbQTh/tjF6CWEErBzTVZ6O6W9P04XnmF8TCin4Q==", + "dev": true, + "requires": { + "@umijs/deps": "3.4.25" + } + }, + "core-js": { + "version": "3.6.5", + "resolved": "https://registry.npmjs.org/core-js/-/core-js-3.6.5.tgz", + "integrity": "sha512-vZVEEwZoIsI+vPEuoF9Iqf5H7/M3eeQqWlQnYa8FSKKePuYTf5MWnxb5SDAzCa60b3JBRS5g9b+Dq7b1y/RCrA==", + "dev": true + }, + "prettier": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.2.1.tgz", + "integrity": "sha512-PqyhM2yCjg/oKkFPtTGUojv7gnZAoG80ttl45O6x2Ug/rMJw4wcc9k6aaf2hibP7BGVCCM33gZoGjyvt9mm16Q==", + "dev": true + }, "regenerator-runtime": { "version": "0.13.5", "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.13.5.tgz", @@ -5460,9 +5792,9 @@ } }, "@umijs/preset-dumi": { - "version": "1.1.12", - "resolved": "https://registry.npmjs.org/@umijs/preset-dumi/-/preset-dumi-1.1.12.tgz", - "integrity": "sha512-ZUYW9J6Jj2uOx++QQldr9vzCJ9dUSPAvuaaHNijMSLgoo65UWFBc+TAqhpZq3bq8DUHfnLIYNS83TE4y+fB5uA==", + "version": "1.1.20", + "resolved": "https://registry.npmjs.org/@umijs/preset-dumi/-/preset-dumi-1.1.20.tgz", + "integrity": "sha512-VO7NuKcosi2S4o4HVAbdJIaXYVZrcqk+6Ie+c6n7x4d6giqHKZjYImTciWyBjiponvl2E/fkFboj++wnSw/rzA==", "dev": true, "requires": { "@babel/core": "^7.7.2", @@ -5479,7 +5811,7 @@ "copy-text-to-clipboard": "^2.2.0", "deepmerge": "^4.2.2", "dumi-assets-types": "1.0.0", - "dumi-theme-default": "1.0.12", + "dumi-theme-default": "1.1.3", "enhanced-resolve": "^4.1.1", "github-slugger": "^1.3.0", "hast-util-has-property": "^1.0.4", @@ -5489,11 +5821,10 @@ "hast-util-to-string": "^1.0.2", "hosted-git-info": "^3.0.2", "js-yaml": "^3.13.1", - "katex": "^0.11.1", "lz-string": "^1.4.4", "react-docgen-typescript": "^1.20.5", "rehype-autolink-headings": "^4.0.0", - "rehype-katex": "^4.0.0", + "rehype-mathjax": "^3.1.0", "rehype-remove-comments": "^4.0.2", "rehype-stringify": "^8.0.0", "remark-frontmatter": "^3.0.0", @@ -5542,20 +5873,20 @@ } }, "@umijs/renderer-mpa": { - "version": "3.4.8", - "resolved": "https://registry.npmjs.org/@umijs/renderer-mpa/-/renderer-mpa-3.4.8.tgz", - "integrity": "sha512-E7GrzFPtXXoAoR0R4Xqt3ztFL+VIfv+a4ammFdouxxWkONnmZ+ede+V2TEzEK3+89Eu2eryWqmx5rIKu1aWaUg==", + "version": "3.4.25", + "resolved": "https://registry.npmjs.org/@umijs/renderer-mpa/-/renderer-mpa-3.4.25.tgz", + "integrity": "sha512-P15ZlAZ93LfzqZk9Qs78Ege/WJWNJMMPZxbmoqaPYDLRyr6rsW8OsqYhbqLDJlHua48VHq15MNXkQVczsyQQAA==", "dev": true, "requires": { "@types/react": "^16.9.43", "@types/react-dom": "^16.9.8", - "@umijs/runtime": "3.4.8" + "@umijs/runtime": "3.4.25" }, "dependencies": { "@types/react": { - "version": "16.14.5", - "resolved": "https://registry.npmjs.org/@types/react/-/react-16.14.5.tgz", - "integrity": "sha512-YRRv9DNZhaVTVRh9Wmmit7Y0UFhEVqXqCSw3uazRWMxa2x85hWQZ5BN24i7GXZbaclaLXEcodEeIHsjBA8eAMw==", + "version": "16.14.8", + "resolved": "https://registry.npmjs.org/@types/react/-/react-16.14.8.tgz", + "integrity": "sha512-QN0/Qhmx+l4moe7WJuTxNiTsjBwlBGHqKGvInSQCBdo7Qio0VtOqwsC0Wq7q3PbJlB0cR4Y4CVo1OOe6BOsOmA==", "dev": true, "requires": { "@types/prop-types": "*", @@ -5564,9 +5895,9 @@ } }, "@types/react-dom": { - "version": "16.9.12", - "resolved": "https://registry.npmjs.org/@types/react-dom/-/react-dom-16.9.12.tgz", - "integrity": "sha512-i7NPZZpPte3jtVOoW+eLB7G/jsX5OM6GqQnH+lC0nq0rqwlK0x8WcMEvYDgFWqWhWMlTltTimzdMax6wYfZssA==", + "version": "16.9.13", + "resolved": "https://registry.npmjs.org/@types/react-dom/-/react-dom-16.9.13.tgz", + "integrity": "sha512-34Hr3XnmUSJbUVDxIw/e7dhQn2BJZhJmlAaPyPwfTQyuVS9mV/CeyghFcXyvkJXxI7notQJz8mF8FeCVvloJrA==", "dev": true, "requires": { "@types/react": "^16" @@ -5575,22 +5906,22 @@ } }, "@umijs/renderer-react": { - "version": "3.4.8", - "resolved": "https://registry.npmjs.org/@umijs/renderer-react/-/renderer-react-3.4.8.tgz", - "integrity": "sha512-kMnxOHGCWmpLG464uYCvRshH7R5XvdkjA/1kKGM9y3xUDxK3dm7pV8I+LXZFrTGykH2fI/EShhFaRRDLjwWNUw==", + "version": "3.4.25", + "resolved": "https://registry.npmjs.org/@umijs/renderer-react/-/renderer-react-3.4.25.tgz", + "integrity": "sha512-1yB3V4Zfd2iNfw1kCFRTWQAxSvTQqLo7t6MVM2YNMM4XeLNV8Em60oCo6QlV2qWEJnOC0ANGTNsfFdV1IuNMAA==", "dev": true, "requires": { "@types/react": "^16.9.43", "@types/react-dom": "^16.9.8", "@types/react-router-config": "^5.0.2", - "@umijs/runtime": "3.4.8", + "@umijs/runtime": "3.4.25", "react-router-config": "5.1.1" }, "dependencies": { "@types/react": { - "version": "16.14.5", - "resolved": "https://registry.npmjs.org/@types/react/-/react-16.14.5.tgz", - "integrity": "sha512-YRRv9DNZhaVTVRh9Wmmit7Y0UFhEVqXqCSw3uazRWMxa2x85hWQZ5BN24i7GXZbaclaLXEcodEeIHsjBA8eAMw==", + "version": "16.14.8", + "resolved": "https://registry.npmjs.org/@types/react/-/react-16.14.8.tgz", + "integrity": "sha512-QN0/Qhmx+l4moe7WJuTxNiTsjBwlBGHqKGvInSQCBdo7Qio0VtOqwsC0Wq7q3PbJlB0cR4Y4CVo1OOe6BOsOmA==", "dev": true, "requires": { "@types/prop-types": "*", @@ -5599,9 +5930,9 @@ } }, "@types/react-dom": { - "version": "16.9.12", - "resolved": "https://registry.npmjs.org/@types/react-dom/-/react-dom-16.9.12.tgz", - "integrity": "sha512-i7NPZZpPte3jtVOoW+eLB7G/jsX5OM6GqQnH+lC0nq0rqwlK0x8WcMEvYDgFWqWhWMlTltTimzdMax6wYfZssA==", + "version": "16.9.13", + "resolved": "https://registry.npmjs.org/@types/react-dom/-/react-dom-16.9.13.tgz", + "integrity": "sha512-34Hr3XnmUSJbUVDxIw/e7dhQn2BJZhJmlAaPyPwfTQyuVS9mV/CeyghFcXyvkJXxI7notQJz8mF8FeCVvloJrA==", "dev": true, "requires": { "@types/react": "^16" @@ -5622,9 +5953,9 @@ } }, "@umijs/runtime": { - "version": "3.4.8", - "resolved": "https://registry.npmjs.org/@umijs/runtime/-/runtime-3.4.8.tgz", - "integrity": "sha512-MhPL8Rx2HS9ruBrJr1lFjQ5hm2mweQ0cNUZNs5jMZnm8s3v4SpCOlGJFVA3J4OyW1IsD8mAgsSfT7RvD6eh1Kg==", + "version": "3.4.25", + "resolved": "https://registry.npmjs.org/@umijs/runtime/-/runtime-3.4.25.tgz", + "integrity": "sha512-P0mbS3lVMpmFoLb3SzAU8NcTLVFlHm7io/g90UA/HWHDcwye9ItWh4Gt90F2QPmNUi75EHDdFjqAjYs/VzR5Sw==", "dev": true, "requires": { "@types/react-router": "5.1.12", @@ -5648,13 +5979,43 @@ } }, "@umijs/server": { - "version": "3.4.8", - "resolved": "https://registry.npmjs.org/@umijs/server/-/server-3.4.8.tgz", - "integrity": "sha512-I/NrWamzxgoxm4DTkKC64HYnOQnZqxSsDaBXUHm/aJSv9mKfLU2wUQpG7LC8Za6tlGL9zq5Kq/oiNpuUdxss6Q==", + "version": "3.4.25", + "resolved": "https://registry.npmjs.org/@umijs/server/-/server-3.4.25.tgz", + "integrity": "sha512-Z07pWV3qw4F++YqRbeoq/0TzIot51NnhHApXGES6UzPopmSyBy0AgD7hAeAwqQWp0yfinL1z1yyFOlAGH+FTxQ==", "dev": true, "requires": { - "@umijs/deps": "0.8.1", - "@umijs/utils": "3.4.8" + "@umijs/deps": "3.4.25", + "@umijs/utils": "3.4.25" + }, + "dependencies": { + "@umijs/deps": { + "version": "3.4.25", + "resolved": "https://registry.npmjs.org/@umijs/deps/-/deps-3.4.25.tgz", + "integrity": "sha512-lMZsuRKq9hlLEBZxTje/DHu2ONRr+OIpfV1gaqH/IwrDZ5W9n3fLp/7L1potKq8xLV4GacSWBy40HRrzsulNog==", + "dev": true, + "requires": { + "@bloomberg/record-tuple-polyfill": "0.0.3", + "chokidar": "3.5.1", + "clipboardy": "2.3.0", + "jest-worker": "24.9.0", + "prettier": "2.2.1" + } + }, + "@umijs/utils": { + "version": "3.4.25", + "resolved": "https://registry.npmjs.org/@umijs/utils/-/utils-3.4.25.tgz", + "integrity": "sha512-r/IiNRE7gM572Tp6JJgJ6KhioOdFWUL+1OQ51QdTah44CSzFbQTh/tjF6CWEErBzTVZ6O6W9P04XnmF8TCin4Q==", + "dev": true, + "requires": { + "@umijs/deps": "3.4.25" + } + }, + "prettier": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.2.1.tgz", + "integrity": "sha512-PqyhM2yCjg/oKkFPtTGUojv7gnZAoG80ttl45O6x2Ug/rMJw4wcc9k6aaf2hibP7BGVCCM33gZoGjyvt9mm16Q==", + "dev": true + } } }, "@umijs/test": { @@ -5707,17 +6068,109 @@ } }, "@umijs/types": { - "version": "3.4.8", - "resolved": "https://registry.npmjs.org/@umijs/types/-/types-3.4.8.tgz", - "integrity": "sha512-YYbbCtay8GFEnXyEcBAgqIDfLYFnF7VVLVnKXNAO+Y3Tsh0NZIrMyiqpZIj5AMwl77C0BcC1xnI1T4b96LcXzw==", + "version": "3.4.25", + "resolved": "https://registry.npmjs.org/@umijs/types/-/types-3.4.25.tgz", + "integrity": "sha512-NxdqR0fLlHwT2sKbsjlJNYYDiDXBULoCxRL4DwzuJvgOMuoKgIQu215YHq9SMW09VvSEaP8u0W5sXGVkXJAvBA==", "dev": true, "requires": { - "@umijs/babel-preset-umi": "3.4.8", - "@umijs/core": "3.4.8", - "@umijs/deps": "0.8.1", - "@umijs/server": "3.4.8", - "@umijs/utils": "3.4.8", + "@umijs/babel-preset-umi": "3.4.25", + "@umijs/core": "3.4.25", + "@umijs/deps": "3.4.25", + "@umijs/server": "3.4.25", + "@umijs/utils": "3.4.25", "webpack-chain": "6.5.1" + }, + "dependencies": { + "@babel/runtime": { + "version": "7.12.5", + "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.12.5.tgz", + "integrity": "sha512-plcc+hbExy3McchJCEQG3knOsuh3HH+Prx1P6cLIkET/0dLuQDEnrT+s27Axgc9bqfsmNUNHfscgMUdBpC9xfg==", + "dev": true, + "requires": { + "regenerator-runtime": "^0.13.4" + } + }, + "@umijs/babel-plugin-auto-css-modules": { + "version": "3.4.25", + "resolved": "https://registry.npmjs.org/@umijs/babel-plugin-auto-css-modules/-/babel-plugin-auto-css-modules-3.4.25.tgz", + "integrity": "sha512-rlvePRMy2ak99/MeUCgjSYB9a6YmeG0gJqyQ1MVNJ6biDMkegKcI67zuIY+cNfr+2sIQ4gwj5oO0vGYS/THv5g==", + "dev": true + }, + "@umijs/babel-plugin-import-to-await-require": { + "version": "3.4.25", + "resolved": "https://registry.npmjs.org/@umijs/babel-plugin-import-to-await-require/-/babel-plugin-import-to-await-require-3.4.25.tgz", + "integrity": "sha512-Ca8OP6yEcaq1VnUy6GMLxPCVFFchT+dTgNpQmR6MMzDactXSM2gP/+BAny0tJm9Qr9LjyYJ9sPkZAMDsSwXFKA==", + "dev": true, + "requires": { + "@umijs/utils": "3.4.25" + } + }, + "@umijs/babel-plugin-lock-core-js-3": { + "version": "3.4.25", + "resolved": "https://registry.npmjs.org/@umijs/babel-plugin-lock-core-js-3/-/babel-plugin-lock-core-js-3-3.4.25.tgz", + "integrity": "sha512-/+zUcwZiZ8eq/wUzp886UkXGqiI9lxLub2HTNW09rnwCHTUd9BM/ccInXrPD/zsQ1xA+hYcQiWftBvhsV19fHQ==", + "dev": true, + "requires": { + "@umijs/utils": "3.4.25", + "core-js": "3.6.5" + } + }, + "@umijs/babel-plugin-no-anonymous-default-export": { + "version": "3.4.25", + "resolved": "https://registry.npmjs.org/@umijs/babel-plugin-no-anonymous-default-export/-/babel-plugin-no-anonymous-default-export-3.4.25.tgz", + "integrity": "sha512-znQAVkOu+3z343ZfprR4Kz+0grd90CJd21dHFnpa6mo5P4H2JBrrHCWS2GN0lGPuyW9r9zVboFBTFaXBnP0trw==", + "dev": true, + "requires": { + "@umijs/utils": "3.4.25" + } + }, + "@umijs/babel-preset-umi": { + "version": "3.4.25", + "resolved": "https://registry.npmjs.org/@umijs/babel-preset-umi/-/babel-preset-umi-3.4.25.tgz", + "integrity": "sha512-ml9K1oWtse9q42GddbW6ijh49uEW8WKqbiKhYP7wquNijmtWx5ZnQKF2VqRTkuzq3+kY50B9DtVSqoq+/YbjQg==", + "dev": true, + "requires": { + "@babel/runtime": "7.12.5", + "@umijs/babel-plugin-auto-css-modules": "3.4.25", + "@umijs/babel-plugin-import-to-await-require": "3.4.25", + "@umijs/babel-plugin-lock-core-js-3": "3.4.25", + "@umijs/babel-plugin-no-anonymous-default-export": "3.4.25" + } + }, + "@umijs/deps": { + "version": "3.4.25", + "resolved": "https://registry.npmjs.org/@umijs/deps/-/deps-3.4.25.tgz", + "integrity": "sha512-lMZsuRKq9hlLEBZxTje/DHu2ONRr+OIpfV1gaqH/IwrDZ5W9n3fLp/7L1potKq8xLV4GacSWBy40HRrzsulNog==", + "dev": true, + "requires": { + "@bloomberg/record-tuple-polyfill": "0.0.3", + "chokidar": "3.5.1", + "clipboardy": "2.3.0", + "jest-worker": "24.9.0", + "prettier": "2.2.1" + } + }, + "@umijs/utils": { + "version": "3.4.25", + "resolved": "https://registry.npmjs.org/@umijs/utils/-/utils-3.4.25.tgz", + "integrity": "sha512-r/IiNRE7gM572Tp6JJgJ6KhioOdFWUL+1OQ51QdTah44CSzFbQTh/tjF6CWEErBzTVZ6O6W9P04XnmF8TCin4Q==", + "dev": true, + "requires": { + "@umijs/deps": "3.4.25" + } + }, + "core-js": { + "version": "3.6.5", + "resolved": "https://registry.npmjs.org/core-js/-/core-js-3.6.5.tgz", + "integrity": "sha512-vZVEEwZoIsI+vPEuoF9Iqf5H7/M3eeQqWlQnYa8FSKKePuYTf5MWnxb5SDAzCa60b3JBRS5g9b+Dq7b1y/RCrA==", + "dev": true + }, + "prettier": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.2.1.tgz", + "integrity": "sha512-PqyhM2yCjg/oKkFPtTGUojv7gnZAoG80ttl45O6x2Ug/rMJw4wcc9k6aaf2hibP7BGVCCM33gZoGjyvt9mm16Q==", + "dev": true + } } }, "@umijs/utils": { @@ -6872,6 +7325,16 @@ "integrity": "sha512-jDctJ/IVQbZoJykoeHbhXpOlNBqGNcwXJKJog42E5HDPUwQTSdjCHdihjj0DlnheQ7blbT6dHOafNAiS8ooQKA==", "dev": true }, + "bindings": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/bindings/-/bindings-1.5.0.tgz", + "integrity": "sha512-p2q/t/mhvuOj/UeLlV6566GD/guowlr0hHxClI0W9m7MWYkL1F0hLo+0Aexs9HSPCtR1SXQ0TD3MMKrXZajbiQ==", + "dev": true, + "optional": true, + "requires": { + "file-uri-to-path": "1.0.0" + } + }, "bluebird": { "version": "3.7.2", "resolved": "https://registry.npmjs.org/bluebird/-/bluebird-3.7.2.tgz", @@ -9602,12 +10065,12 @@ } }, "dumi": { - "version": "1.1.12", - "resolved": "https://registry.npmjs.org/dumi/-/dumi-1.1.12.tgz", - "integrity": "sha512-8cElaaDbuh/4VqY4IZhi3FBFoyhneFJgTZvSBufFMRgQq0WksjRGC/o9xxJnbJI2Pcn0vENQ14NPKYQVITnKNg==", + "version": "1.1.20", + "resolved": "https://registry.npmjs.org/dumi/-/dumi-1.1.20.tgz", + "integrity": "sha512-xmg2rR/egKmDuq/H6q6ABwkIKBBnt0vL9bZzfEmbdndLJXgZQ6vt8kOegKPFdz9GZbW8FJFZ2SGrMqwLDwEC2g==", "dev": true, "requires": { - "@umijs/preset-dumi": "1.1.12", + "@umijs/preset-dumi": "1.1.20", "umi": "^3.0.0" } }, @@ -9618,9 +10081,9 @@ "dev": true }, "dumi-theme-default": { - "version": "1.0.12", - "resolved": "https://registry.npmjs.org/dumi-theme-default/-/dumi-theme-default-1.0.12.tgz", - "integrity": "sha512-iZdIE3y7kpWbITT7/DEPTsg0nPusxuH/Yi/6uoNheesh2XWillDhJ8mQ/NNlSk2y853mp5/Q77APDlxVeiIsgA==", + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/dumi-theme-default/-/dumi-theme-default-1.1.3.tgz", + "integrity": "sha512-5N/r7UsEh27Sw9B9toFAYbdv0fA8fwSKFW6JVCnDFgeQzeHkE8NJ5DjLBD/RRPsIUJTIzlQXqtI/1RUbPdw7iQ==", "dev": true, "requires": { "prism-react-renderer": "^1.1.1", @@ -10017,9 +10480,9 @@ } }, "es5-imcompatible-versions": { - "version": "0.1.67", - "resolved": "https://registry.npmjs.org/es5-imcompatible-versions/-/es5-imcompatible-versions-0.1.67.tgz", - "integrity": "sha512-L74XSKBby2NFW0Rxf6QhdQ45x0MrxbDmuNicti5arzoK7w2I+A6sxHGIQqPaN5NpoYDO3RTT/I3NZC5oIUskpw==", + "version": "0.1.73", + "resolved": "https://registry.npmjs.org/es5-imcompatible-versions/-/es5-imcompatible-versions-0.1.73.tgz", + "integrity": "sha512-P0SgLrYl9iqlrt0h6n/iz5z5P1uuhnfHp9BA/tcLfqgVIWHNvY4Rm+jtSvnh1ADK4DJOYDwJvxlrHMRoLQMgmQ==", "dev": true }, "es6-promise": { @@ -10760,6 +11223,12 @@ "integrity": "sha512-QudtT6av5WXels9WjIM7qz1XD1cWGvX4gGXvp/zBn9nXG02D0utdU3Em2m/QjTnrsk6bBjmCygl3rmj118msQQ==", "dev": true }, + "esm": { + "version": "3.2.25", + "resolved": "https://registry.npmjs.org/esm/-/esm-3.2.25.tgz", + "integrity": "sha512-U1suiZ2oDVWv4zPO56S0NcR5QriEahGtdN2OR6FiOG4WJvcjBVFB0qI4+eKoWFH483PKGuLuu6V8Z4T5g63UVA==", + "dev": true + }, "espree": { "version": "7.3.1", "resolved": "https://registry.npmjs.org/espree/-/espree-7.3.1.tgz", @@ -11627,6 +12096,13 @@ "flat-cache": "^3.0.4" } }, + "file-uri-to-path": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/file-uri-to-path/-/file-uri-to-path-1.0.0.tgz", + "integrity": "sha512-0Zt+s3L7Vf1biwWZ29aARiVYLx7iMGnEUl9x33fbB/j3jR81u/O2LbqK+Bm1CDSNDKVtJ/YjwY7TUd5SkeLQLw==", + "dev": true, + "optional": true + }, "fill-range": { "version": "7.0.1", "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", @@ -13332,6 +13808,16 @@ "web-namespaces": "^1.0.0" } }, + "hast-util-from-dom": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/hast-util-from-dom/-/hast-util-from-dom-3.0.0.tgz", + "integrity": "sha512-4vQuGiD5Y/wlD7fZiY4mZML/6oh0GOnH38UNyeDFcSTE4AHF0zjKHZfbd+ekVwPvsZXRl8choc99INHUwSPJlg==", + "dev": true, + "requires": { + "hastscript": "^6.0.0", + "web-namespaces": "^1.0.0" + } + }, "hast-util-from-parse5": { "version": "6.0.1", "resolved": "https://registry.npmjs.org/hast-util-from-parse5/-/hast-util-from-parse5-6.0.1.tgz", @@ -13390,9 +13876,9 @@ } }, "hast-util-to-html": { - "version": "7.1.2", - "resolved": "https://registry.npmjs.org/hast-util-to-html/-/hast-util-to-html-7.1.2.tgz", - "integrity": "sha512-pu73bvORzdF6XZgwl9eID/0RjBb/jtRfoGRRSykpR1+o9rCdiAHpgkSukZsQBRlIqMg6ylAcd7F0F7myJUb09Q==", + "version": "7.1.3", + "resolved": "https://registry.npmjs.org/hast-util-to-html/-/hast-util-to-html-7.1.3.tgz", + "integrity": "sha512-yk2+1p3EJTEE9ZEUkgHsUSVhIpCsL/bvT8E5GzmWc+N1Po5gBw+0F8bo7dpxXR0nu0bQVxVZGX2lBGF21CmeDw==", "dev": true, "requires": { "ccount": "^1.0.0", @@ -14703,9 +15189,9 @@ } }, "javascript-stringify": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/javascript-stringify/-/javascript-stringify-2.0.1.tgz", - "integrity": "sha512-yV+gqbd5vaOYjqlbk16EG89xB5udgjqQF3C5FAORDg4f/IS1Yc5ERCv5e/57yBcfJYw05V5JyIXabhwb75Xxow==", + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/javascript-stringify/-/javascript-stringify-2.1.0.tgz", + "integrity": "sha512-JVAfqNPTvNq3sB/VHQJAFxN/sPgKnsKrCwyRt15zwNCdrMMJDdcEOdubuy+DuJYYdm0ox1J4uzEuYKkN+9yhVg==", "dev": true }, "jest": { @@ -15221,7 +15707,11 @@ "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-1.2.13.tgz", "integrity": "sha512-oWb1Z6mkHIskLzEJ/XWX0srkpkTQ7vaopMQkyaEIoq0fmtFVxOthb8cCxeT+p3ynTdkk/RZwbgG4brR5BeWECw==", "dev": true, - "optional": true + "optional": true, + "requires": { + "bindings": "^1.5.0", + "nan": "^2.12.1" + } }, "html-encoding-sniffer": { "version": "1.0.2", @@ -16150,9 +16640,9 @@ } }, "katex": { - "version": "0.11.1", - "resolved": "https://registry.npmjs.org/katex/-/katex-0.11.1.tgz", - "integrity": "sha512-5oANDICCTX0NqYIyAiFCCwjQ7ERu3DQG2JFHLbYOf+fXaMoH8eg/zOq5WSYJsKMi/QebW+Eh3gSM+oss1H/bww==", + "version": "0.12.0", + "resolved": "https://registry.npmjs.org/katex/-/katex-0.12.0.tgz", + "integrity": "sha512-y+8btoc/CK70XqcHqjxiGWBOeIL8upbS0peTPXTvgrh21n1RiWWcIpSWM+4uXq+IAgNh9YYQWdc7LVDPDAEEAg==", "dev": true, "requires": { "commander": "^2.19.0" @@ -17049,6 +17539,18 @@ "repeat-string": "^1.0.0" } }, + "mathjax-full": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/mathjax-full/-/mathjax-full-3.2.0.tgz", + "integrity": "sha512-D2EBNvUG+mJyhn+M1C858k0f2Fc4KxXvbEX2WCMXroV10212JwfYqaBJ336ECBSz5X9L5LRoamxb7AJtg3KaJA==", + "dev": true, + "requires": { + "esm": "^3.2.25", + "mhchemparser": "^4.1.0", + "mj-context-menu": "^0.6.1", + "speech-rule-engine": "^3.3.3" + } + }, "mathml-tag-names": { "version": "2.1.3", "resolved": "https://registry.npmjs.org/mathml-tag-names/-/mathml-tag-names-2.1.3.tgz", @@ -17359,6 +17861,12 @@ "resolved": "https://registry.npmjs.org/methods/-/methods-1.1.2.tgz", "integrity": "sha1-VSmk1nZUE07cxSZmVoNbD4Ua/O4=" }, + "mhchemparser": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/mhchemparser/-/mhchemparser-4.1.0.tgz", + "integrity": "sha512-rFj6nGMLJQQ0WcDw3j4LY/kWCq1EftcsarQWnDg38U47XMR36Tlda19WsN4spHr0Qc9Wn4oj6YtvXuwVnOKC/g==", + "dev": true + }, "micromark": { "version": "2.11.4", "resolved": "https://registry.npmjs.org/micromark/-/micromark-2.11.4.tgz", @@ -17459,17 +17967,6 @@ "requires": { "katex": "^0.12.0", "micromark": "~2.11.0" - }, - "dependencies": { - "katex": { - "version": "0.12.0", - "resolved": "https://registry.npmjs.org/katex/-/katex-0.12.0.tgz", - "integrity": "sha512-y+8btoc/CK70XqcHqjxiGWBOeIL8upbS0peTPXTvgrh21n1RiWWcIpSWM+4uXq+IAgNh9YYQWdc7LVDPDAEEAg==", - "dev": true, - "requires": { - "commander": "^2.19.0" - } - } } }, "micromatch": { @@ -17689,6 +18186,12 @@ } } }, + "mj-context-menu": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/mj-context-menu/-/mj-context-menu-0.6.1.tgz", + "integrity": "sha512-7NO5s6n10TIV96d4g2uDpG7ZDpIhMh0QNfGdJw/W47JswFcosz457wqz/b5sAKvl12sxINGFCn80NZHKwxQEXA==", + "dev": true + }, "mkdirp": { "version": "0.5.5", "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.5.tgz", @@ -17828,6 +18331,13 @@ "thenify-all": "^1.0.0" } }, + "nan": { + "version": "2.14.2", + "resolved": "https://registry.npmjs.org/nan/-/nan-2.14.2.tgz", + "integrity": "sha512-M2ufzIiINKCuDfBSAUr1vWQ+vuVcA9kqx8JJUsbQi6yf1uGRyb7HfpdfUr5qLXf3B/t8dPvcjhKMmlfnP47EzQ==", + "dev": true, + "optional": true + }, "nanomatch": { "version": "1.2.13", "resolved": "https://registry.npmjs.org/nanomatch/-/nanomatch-1.2.13.tgz", @@ -18814,9 +19324,9 @@ "dev": true }, "pbkdf2": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/pbkdf2/-/pbkdf2-3.1.1.tgz", - "integrity": "sha512-4Ejy1OPxi9f2tt1rRV7Go7zmfDQ+ZectEQz3VGUQhgq62HtIRPDyG/JtnwIxs6x3uNMwo2V7q1fMvKjb+Tnpqg==", + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/pbkdf2/-/pbkdf2-3.1.2.tgz", + "integrity": "sha512-iuh7L6jA7JEGu2WxDwtQP1ddOpaJNC4KlDEFfdQajSGgGPNi4OyDc2R7QnbY2bR9QjBVGwgvTdNJZoE7RaxUMA==", "dev": true, "requires": { "create-hash": "^1.1.2", @@ -19072,14 +19582,12 @@ "dev": true }, "postcss-selector-parser": { - "version": "6.0.4", - "resolved": "https://registry.npmjs.org/postcss-selector-parser/-/postcss-selector-parser-6.0.4.tgz", - "integrity": "sha512-gjMeXBempyInaBqpp8gODmwZ52WaYsVOsfr4L4lDQ7n3ncD6mEyySiDtgzCT+NYC0mmeOLvtsF8iaEf0YT6dBw==", + "version": "6.0.6", + "resolved": "https://registry.npmjs.org/postcss-selector-parser/-/postcss-selector-parser-6.0.6.tgz", + "integrity": "sha512-9LXrvaaX3+mcv5xkg5kFwqSzSH1JIObIx51PrndZwlmznwXRfxMddDvo9gve3gVR8ZTKgoFDdWkbRFmEhT4PMg==", "dev": true, "requires": { "cssesc": "^3.0.0", - "indexes-of": "^1.0.1", - "uniq": "^1.0.1", "util-deprecate": "^1.0.2" } } @@ -19449,12 +19957,11 @@ } }, "postcss-initial": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/postcss-initial/-/postcss-initial-3.0.2.tgz", - "integrity": "sha512-ugA2wKonC0xeNHgirR4D3VWHs2JcU08WAi1KFLVcnb7IN89phID6Qtg2RIctWbnvp1TM2BOmDtX8GGLCKdR8YA==", + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/postcss-initial/-/postcss-initial-3.0.4.tgz", + "integrity": "sha512-3RLn6DIpMsK1l5UUy9jxQvoDeUN4gP939tDcKUHD/kM8SGSKbFAnvkpFpj3Bhtz3HGk1jWY5ZNWX6mPta5M9fg==", "dev": true, "requires": { - "lodash.template": "^4.5.0", "postcss": "^7.0.2" } }, @@ -20748,9 +21255,9 @@ } }, "prism-react-renderer": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/prism-react-renderer/-/prism-react-renderer-1.2.0.tgz", - "integrity": "sha512-GHqzxLYImx1iKN1jJURcuRoA/0ygCcNhfGw1IT8nPIMzarmKQ3Nc+JcG0gi8JXQzuh0C5ShE4npMIoqNin40hg==", + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/prism-react-renderer/-/prism-react-renderer-1.2.1.tgz", + "integrity": "sha512-w23ch4f75V1Tnz8DajsYKvY5lF7H1+WvzvLUcF0paFxkTHSp42RS0H5CttdN2Q8RR3DRGZ9v5xD/h3n8C8kGmg==", "dev": true }, "prismjs": { @@ -22057,59 +22564,18 @@ "unist-util-visit": "^2.0.0" } }, - "rehype-katex": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/rehype-katex/-/rehype-katex-4.0.0.tgz", - "integrity": "sha512-0mgBqYugQyIW0eUl6RDOZ28Cat2YzrnWGaYgKCMQnJw6ClmKgLqXBnkDAPGh2mwxvkkKwQOUMUpSLpA5rt7rzA==", + "rehype-mathjax": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/rehype-mathjax/-/rehype-mathjax-3.1.0.tgz", + "integrity": "sha512-Pmz92Y56lBFmDjFc9nIdrKu1xzKSBYevcwKiKiG7b5JJg74q1E62nRSbPEm37vXaXn7Bn25iRsWcP39bJKkMxg==", "dev": true, "requires": { - "@types/katex": "^0.11.0", + "@types/mathjax": "^0.0.36", + "hast-util-from-dom": "^3.0.0", "hast-util-to-text": "^2.0.0", - "katex": "^0.12.0", - "rehype-parse": "^7.0.0", - "unified": "^9.0.0", + "jsdom": "^16.0.0", + "mathjax-full": "^3.0.0", "unist-util-visit": "^2.0.0" - }, - "dependencies": { - "is-buffer": { - "version": "2.0.5", - "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-2.0.5.tgz", - "integrity": "sha512-i2R6zNFDwgEHJyQUtJEk0XFi1i0dPFn/oqjK3/vPCcDeJvW5NQ83V8QbicfF1SupOaB0h8ntgBC2YiE7dfyctQ==", - "dev": true - }, - "katex": { - "version": "0.12.0", - "resolved": "https://registry.npmjs.org/katex/-/katex-0.12.0.tgz", - "integrity": "sha512-y+8btoc/CK70XqcHqjxiGWBOeIL8upbS0peTPXTvgrh21n1RiWWcIpSWM+4uXq+IAgNh9YYQWdc7LVDPDAEEAg==", - "dev": true, - "requires": { - "commander": "^2.19.0" - } - }, - "unified": { - "version": "9.2.1", - "resolved": "https://registry.npmjs.org/unified/-/unified-9.2.1.tgz", - "integrity": "sha512-juWjuI8Z4xFg8pJbnEZ41b5xjGUWGHqXALmBZ3FC3WX0PIx1CZBIIJ6mXbYMcf6Yw4Fi0rFUTA1cdz/BglbOhA==", - "dev": true, - "requires": { - "bail": "^1.0.0", - "extend": "^3.0.0", - "is-buffer": "^2.0.0", - "is-plain-obj": "^2.0.0", - "trough": "^1.0.0", - "vfile": "^4.0.0" - } - } - } - }, - "rehype-parse": { - "version": "7.0.1", - "resolved": "https://registry.npmjs.org/rehype-parse/-/rehype-parse-7.0.1.tgz", - "integrity": "sha512-fOiR9a9xH+Le19i4fGzIEowAbwG7idy2Jzs4mOrFWBSJ0sNUgy0ev871dwWnbOo371SjgjG4pwzrbgSVrKxecw==", - "dev": true, - "requires": { - "hast-util-from-parse5": "^6.0.0", - "parse5": "^6.0.0" } }, "rehype-remove-comments": { @@ -22204,12 +22670,12 @@ } }, "remark-rehype": { - "version": "8.0.0", - "resolved": "https://registry.npmjs.org/remark-rehype/-/remark-rehype-8.0.0.tgz", - "integrity": "sha512-gVvOH02TMFqXOWoL6iXU7NXMsDJguNkNuMrzfkQeA4V6WCyHQnOKptn+IQBVVPuIH2sMJBwo8hlrmtn1MLTh9w==", + "version": "8.1.0", + "resolved": "https://registry.npmjs.org/remark-rehype/-/remark-rehype-8.1.0.tgz", + "integrity": "sha512-EbCu9kHgAxKmW1yEYjx3QafMyGY3q8noUbNUI5xyKbaFP89wbhDrKxyIQNukNYthzjNHZu6J7hwFg7hRm1svYA==", "dev": true, "requires": { - "mdast-util-to-hast": "^10.0.0" + "mdast-util-to-hast": "^10.2.0" } }, "remark-stringify": { @@ -23781,6 +24247,25 @@ "integrity": "sha512-1klA3Gi5PD1Wv9Q0wUoOQN1IWAuPu0D1U03ThXTr0cJ20+/iq2tHSDnK7Kk/0LXJ1ztUB2/1Os0wKmfyNgUQfg==", "dev": true }, + "speech-rule-engine": { + "version": "3.3.3", + "resolved": "https://registry.npmjs.org/speech-rule-engine/-/speech-rule-engine-3.3.3.tgz", + "integrity": "sha512-0exWw+0XauLjat+f/aFeo5T8SiDsO1JtwpY3qgJE4cWt+yL/Stl0WP4VNDWdh7lzGkubUD9lWP4J1ASnORXfyQ==", + "dev": true, + "requires": { + "commander": ">=7.0.0", + "wicked-good-xpath": "^1.3.0", + "xmldom-sre": "^0.1.31" + }, + "dependencies": { + "commander": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/commander/-/commander-7.2.0.tgz", + "integrity": "sha512-QrWXB+ZQSVPmIWIhtEO9H+gwHaMGYiF5ChvoJ+K9ZGHG/sVsa6yiesAD1GC/x46sET00Xlwo1u49RVVVzvcSkw==", + "dev": true + } + } + }, "split": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/split/-/split-1.0.1.tgz", @@ -24251,9 +24736,9 @@ }, "dependencies": { "ajv": { - "version": "8.5.0", - "resolved": "https://registry.npmjs.org/ajv/-/ajv-8.5.0.tgz", - "integrity": "sha512-Y2l399Tt1AguU3BPRP9Fn4eN+Or+StUGWCUpbnFyXSo8NZ9S4uj+AG2pjs5apK+ZMOwYOz1+a+VKvKH7CudXgQ==", + "version": "8.6.1", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-8.6.1.tgz", + "integrity": "sha512-42VLtQUOLefAvKFAQIxIZDaThq6om/PrfP0CYk3/vn+y4BMNkKnbli8ON2QCiHov4KkzOSJ/xSoBJdayiiYvVQ==", "dev": true, "requires": { "fast-deep-equal": "^3.1.1", @@ -24322,9 +24807,9 @@ "dev": true }, "debug": { - "version": "4.3.1", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.1.tgz", - "integrity": "sha512-doEwdvm4PCeK4K3RQN2ZC2BYUBaxwLARCqZmMjtF8a51J2Rb0xpVloFRnCODwqjpwnAoao4pelN8l3RJdv3gRQ==", + "version": "4.3.2", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.2.tgz", + "integrity": "sha512-mOp8wKcvj7XxC78zLgw/ZA+6TSgkoE2C/ienthhRD298T7UNwAg9diBpLRxC0mOezLl4B0xV7M0cCO6P/O0Xhw==", "dev": true, "requires": { "ms": "2.1.2" @@ -24475,9 +24960,9 @@ "dev": true }, "yargs-parser": { - "version": "20.2.7", - "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-20.2.7.tgz", - "integrity": "sha512-FiNkvbeHzB/syOjIUxFDCnhSfzAL8R5vs40MgLFBorXACCOAEaWu0gRZl14vG8MR9AOJIZbmkjhusqBYZ3HTHw==", + "version": "20.2.9", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-20.2.9.tgz", + "integrity": "sha512-y11nGElTIV+CT3Zv9t7VKl+Q3hTQoT9a1Qzezhhl6Rp21gJ/IVTW7Z3y9EWXhuUBC2Shnf+DX0antecpAwSP8w==", "dev": true } } @@ -24593,9 +25078,9 @@ } }, "debug": { - "version": "4.3.1", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.1.tgz", - "integrity": "sha512-doEwdvm4PCeK4K3RQN2ZC2BYUBaxwLARCqZmMjtF8a51J2Rb0xpVloFRnCODwqjpwnAoao4pelN8l3RJdv3gRQ==", + "version": "4.3.2", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.2.tgz", + "integrity": "sha512-mOp8wKcvj7XxC78zLgw/ZA+6TSgkoE2C/ienthhRD298T7UNwAg9diBpLRxC0mOezLl4B0xV7M0cCO6P/O0Xhw==", "dev": true, "requires": { "ms": "2.1.2" @@ -26123,21 +26608,51 @@ "dev": true }, "umi": { - "version": "3.4.8", - "resolved": "https://registry.npmjs.org/umi/-/umi-3.4.8.tgz", - "integrity": "sha512-PKpXqZpBl5iAADFVEosp07l5PHSjUbTcGb8h2VGoYFAE3rUj3zpsSgJjF05nKoLdpVPxBLZt7zPmmuVfXNzxfg==", - "dev": true, - "requires": { - "@umijs/bundler-webpack": "3.4.8", - "@umijs/core": "3.4.8", - "@umijs/deps": "0.8.1", - "@umijs/preset-built-in": "3.4.8", - "@umijs/runtime": "3.4.8", - "@umijs/types": "3.4.8", - "@umijs/utils": "3.4.8", + "version": "3.4.25", + "resolved": "https://registry.npmjs.org/umi/-/umi-3.4.25.tgz", + "integrity": "sha512-67GMhP40Tz2sbyAzB4at7IUjXEIlG4j3zADfRhepLRWYbhUa55ZHnWyvuws3/dtUfifpraz4ckVcJJESoJ7Xaw==", + "dev": true, + "requires": { + "@umijs/bundler-webpack": "3.4.25", + "@umijs/core": "3.4.25", + "@umijs/deps": "3.4.25", + "@umijs/preset-built-in": "3.4.25", + "@umijs/runtime": "3.4.25", + "@umijs/types": "3.4.25", + "@umijs/utils": "3.4.25", "react": "16.x", "react-dom": "16.x", "v8-compile-cache": "2.3.0" + }, + "dependencies": { + "@umijs/deps": { + "version": "3.4.25", + "resolved": "https://registry.npmjs.org/@umijs/deps/-/deps-3.4.25.tgz", + "integrity": "sha512-lMZsuRKq9hlLEBZxTje/DHu2ONRr+OIpfV1gaqH/IwrDZ5W9n3fLp/7L1potKq8xLV4GacSWBy40HRrzsulNog==", + "dev": true, + "requires": { + "@bloomberg/record-tuple-polyfill": "0.0.3", + "chokidar": "3.5.1", + "clipboardy": "2.3.0", + "jest-worker": "24.9.0", + "prettier": "2.2.1" + } + }, + "@umijs/utils": { + "version": "3.4.25", + "resolved": "https://registry.npmjs.org/@umijs/utils/-/utils-3.4.25.tgz", + "integrity": "sha512-r/IiNRE7gM572Tp6JJgJ6KhioOdFWUL+1OQ51QdTah44CSzFbQTh/tjF6CWEErBzTVZ6O6W9P04XnmF8TCin4Q==", + "dev": true, + "requires": { + "@umijs/deps": "3.4.25" + } + }, + "prettier": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.2.1.tgz", + "integrity": "sha512-PqyhM2yCjg/oKkFPtTGUojv7gnZAoG80ttl45O6x2Ug/rMJw4wcc9k6aaf2hibP7BGVCCM33gZoGjyvt9mm16Q==", + "dev": true + } } }, "umi-request": { @@ -26979,6 +27494,12 @@ "integrity": "sha1-2e8H3Od7mQK4o6j6SzHD4/fm6Ho=", "dev": true }, + "wicked-good-xpath": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/wicked-good-xpath/-/wicked-good-xpath-1.3.0.tgz", + "integrity": "sha1-gbDpXoZQ5JyUsiKY//hoa1VTz2w=", + "dev": true + }, "wide-align": { "version": "1.1.3", "resolved": "https://registry.npmjs.org/wide-align/-/wide-align-1.1.3.tgz", @@ -27309,6 +27830,12 @@ "integrity": "sha512-JZnDKK8B0RCDw84FNdDAIpZK+JuJw+s7Lz8nksI7SIuU3UXJJslUthsi+uWBUYOwPFwW7W7PRLRfUKpxjtjFCw==", "dev": true }, + "xmldom-sre": { + "version": "0.1.31", + "resolved": "https://registry.npmjs.org/xmldom-sre/-/xmldom-sre-0.1.31.tgz", + "integrity": "sha512-f9s+fUkX04BxQf+7mMWAp5zk61pciie+fFLC9hX9UVvCeJQfNHRHXpeo5MPcR0EUf57PYLdt+ZO4f3Ipk2oZUw==", + "dev": true + }, "xtend": { "version": "4.0.2", "resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.2.tgz", diff --git a/package.json b/package.json index be77cd93..10332b30 100755 --- a/package.json +++ b/package.json @@ -27,7 +27,9 @@ "clean:lerna": "npx lerna clean --yes", "reset": "npm run clean && npx cross-env rimraf node_modules src/.umi && npm run clean:lerna && npm install && npm run boot", "reset:lock": "npm run clean && npx cross-env rimraf node_modules src/.umi package-lock.json && npm run cache clean --force && npm run clean:lerna && npm run boot", - "boot": "npx lerna bootstrap" + "boot": "npx lerna bootstrap", + "pack:admin": "npm run dist && cd packages/mlz-admin && rimraf *.tgz && npm pack", + "pack:adminer": "npm run dist && cd packages/mlz-adminer && rimraf *.tgz && npm pack" }, "gitHooks": { "pre-commit": "npx lint-staged && npx pretty-quick --staged" @@ -61,7 +63,7 @@ "axios": "^0.20.0", "babel-plugin-import": "^1.13.3", "babel-plugin-search-and-replace": "^1.1.0", - "dumi": "^1.0.6", + "dumi": "^1.1.20", "enzyme": "^3.11.0", "enzyme-adapter-react-16": "^1.15.4", "enzyme-to-json": "^3.6.1", diff --git a/packages/mlz-admin/package.json b/packages/mlz-admin/package.json index a35fa9cb..7e3cc328 100755 --- a/packages/mlz-admin/package.json +++ b/packages/mlz-admin/package.json @@ -1,6 +1,6 @@ { "name": "@mlz/admin", - "version": "0.10.0", + "version": "1.0.0", "description": "一套遵循编程猫组件使用规范的管理系统React组件库", "license": "MIT", "keywords": [ @@ -18,12 +18,12 @@ ], "dependencies": { "@babel/runtime": "^7.10.2", - "antd": "^4.9.4" + "antd": "^4.16.3" }, "peerDependencies": { "antd": ">=4.6.2", - "react": ">=16.12.0", - "react-dom": ">=16.12.0" + "react": ">=16.13.0", + "react-dom": ">=16.13.0" }, "devDependencies": { "@types/lodash-es": "^4.17.3", @@ -32,8 +32,8 @@ "mytils": "^1.3.21", "typescript": "~3.9.7", "typescript-transform-paths": "^2.0.1", - "react": "^16.14.0", - "react-dom": "^16.14.0" + "react": "^17.0.2", + "react-dom": "^17.0.2" }, "bugs": { "url": "https://github.com/juicecube/mlz-admin/issues" diff --git a/packages/mlz-admin/src/dark-theme-toggler/index.hooks.tsx b/packages/mlz-admin/src/dark-theme-toggler/index.hooks.tsx index 66a24c08..010ac5cf 100755 --- a/packages/mlz-admin/src/dark-theme-toggler/index.hooks.tsx +++ b/packages/mlz-admin/src/dark-theme-toggler/index.hooks.tsx @@ -1,4 +1,4 @@ -import React, { useState, useEffect, useLayoutEffect } from 'react'; +import React, { useState, useEffect, useLayoutEffect, useRef } from 'react'; import { appendNode2Body, simpleHash } from '../shared/utils'; import { UseDarkThemeOptions, ThemeKeyNameTypes } from './index.type'; // import * as darkColors from 'antd/lib/style/themes/dark.less'; @@ -18,6 +18,7 @@ const lightThemePalette = { export const calcDefaultCDNPath = ($antdVersion: string, $version: string, $BuildTime: string) => `https://cdn.bootcdn.net/ajax/libs/antd/${$antdVersion}/antd.dark.min.css?version=${$version}&t=${$BuildTime}`; +export const themeChangeEventName = 'themeChange'; const useDarkTheme = (callback: Function, observed?: any, conf?: UseDarkThemeOptions) => { const defaultCDNPath = calcDefaultCDNPath(AntdVersion, version, BuildTime); @@ -29,6 +30,12 @@ const useDarkTheme = (callback: Function, observed?: any, conf?: UseDarkThemeOpt // observed被观察对象为true时则切换主题 typeof observed !== 'undefined' && toggleTheme(observed ? 'dark' : 'light'); }, [observed]); + + const eventRef = useRef<(detail: 'dark' | 'default' | 'light') => Event>((_ = 'default') => { + return new CustomEvent(themeChangeEventName, { + detail: { theme: _ }, + }); + }); useLayoutEffect(() => { if (theme === 'dark') { // 当dark时 @@ -68,7 +75,12 @@ const useDarkTheme = (callback: Function, observed?: any, conf?: UseDarkThemeOpt saveDom(null); document.body.setAttribute('data-theme', 'default'); } + + // 回调 callback?.(theme); + + // 切换主题事件的分发 + window?.dispatchEvent(eventRef.current(theme)); }, [theme]); return { dom }; }; diff --git a/packages/mlz-admin/src/date-picker/index.type.ts b/packages/mlz-admin/src/date-picker/index.type.ts index c2323d1f..37dc2cc1 100755 --- a/packages/mlz-admin/src/date-picker/index.type.ts +++ b/packages/mlz-admin/src/date-picker/index.type.ts @@ -1,4 +1,6 @@ import { DatePickerProps, RangePickerProps } from 'antd/lib/date-picker'; +import { PickerPanelDateProps } from 'rc-picker/lib/PickerPanel'; +import { SharedTimeProps } from 'rc-picker/lib/panels/TimePanel'; import { unitOfTime, Moment } from 'moment'; export type valueProps = number | Moment | null; @@ -13,4 +15,5 @@ export interface IDatePickerProps extends Omit void; returnUnixValue?: boolean; + showTime?: boolean | SharedTimeProps; } diff --git a/packages/mlz-admin/src/error-boundary/index.less b/packages/mlz-admin/src/error-boundary/index.less index 34e8384c..afe57874 100755 --- a/packages/mlz-admin/src/error-boundary/index.less +++ b/packages/mlz-admin/src/error-boundary/index.less @@ -3,9 +3,20 @@ .admini-error-boundary { &__wrapper { background: @red-1; - .admini-error-boundary__paragraph { + .ant-result-content { background: @red-2; - padding: 24; + border-radius: 6px; + width: 76%; + min-width: 640px; + margin: 0 auto; + margin-top: 24px; + } + .admini-error-boundary__paragraph { + background: transparent; + hr { + border-color: @black; + opacity: 0.3; + } } } } diff --git a/packages/mlz-admin/src/error-boundary/index.tsx b/packages/mlz-admin/src/error-boundary/index.tsx index 5d74a50f..2760b3aa 100755 --- a/packages/mlz-admin/src/error-boundary/index.tsx +++ b/packages/mlz-admin/src/error-boundary/index.tsx @@ -1,7 +1,8 @@ -import React, { ErrorInfo } from 'react'; +import React, { CSSProperties, ErrorInfo } from 'react'; import { Result, Typography } from 'antd'; import { ResultProps } from 'antd/lib/result'; import { createBem } from '../shared/utils'; +import { themeChangeEventName } from '../dark-theme-toggler/index.hooks'; import './index.less'; type metaData = string; @@ -10,6 +11,7 @@ interface IErrorBoundaryState { error: Error; reactMetaStacks?: metaData[]; browserMetaStacks?: metaData[]; + isDarkTheme: boolean; } const errorStackGenerator = (errorStackString: Error['stack'] | ErrorInfo['componentStack']): metaData[] => { @@ -24,7 +26,7 @@ const errorStackGenerator = (errorStackString: Error['stack'] | ErrorInfo['compo const stackMetaTransformer = ($metaData: metaData[] | undefined) => { return $metaData?.map((meta, index) => ( // eslint-disable-next-line react/no-array-index-key -

+

{meta}

)); @@ -37,7 +39,7 @@ const { Paragraph, Text } = Typography; class ErrorBoundary extends React.Component { constructor(props) { super(props); - this.state = { hasError: false, error: { name: '', message: '' }, reactMetaStacks: [], browserMetaStacks: [] }; + this.state = { hasError: false, error: { name: '', message: '' }, reactMetaStacks: [], browserMetaStacks: [], isDarkTheme: false }; } static getDerivedStateFromError(error) { @@ -50,6 +52,12 @@ class ErrorBoundary extends React.Component { this.setState({ hasError: true, error, reactMetaStacks, browserMetaStacks }); } + componentDidMount() { + window?.addEventListener('themeChange', (e) => { + this.setState({ isDarkTheme: (e as any).detail.theme === 'dark' }); + }); + } + render() { if (this.state.hasError) { const { error } = this.state; @@ -57,9 +65,10 @@ class ErrorBoundary extends React.Component { + className={bem('wrapper')} + style={this.state.isDarkTheme ? { backgroundColor: `var(--theme-bg)` } : {}}> {shouldDisplayErrorDetail ? ( <> diff --git a/packages/mlz-admin/src/form/index.tsx b/packages/mlz-admin/src/form/index.tsx index dbf6e5c7..e9930afc 100755 --- a/packages/mlz-admin/src/form/index.tsx +++ b/packages/mlz-admin/src/form/index.tsx @@ -1,4 +1,4 @@ -import React, { useState, useEffect } from 'react'; +import React, { useState, useEffect, useMemo } from 'react'; import { Form as AntdForm, Spin, Button, Row } from 'antd'; import { NamePath } from 'rc-field-form/es/interface'; import { IFormProps, IFormColumnType, IDependencyItem, CompoundedForm } from './index.type'; @@ -9,14 +9,16 @@ Form.Block = (props: IFormProps) => { const [form] = AntdForm.useForm(); const [forceRefresh, toggleForceRefresh] = useState(false); // 所有表单项的所有依赖内容 - const allRelyOnKeys = Array.from( - new Set( - columns?.reduce((prev: unknown[], curr: IFormColumnType) => { - const currRelyOnKeys = curr?.relyOn?.reduce((prv: NamePath[], cur: IDependencyItem) => prv.concat([cur?.name] || []), []); - return prev.concat(currRelyOnKeys || []); - }, []), - ), - ); + const allRelyOnKeys = useMemo(() => { + return Array.from( + new Set( + columns?.reduce((prev: unknown[], curr: IFormColumnType) => { + const currRelyOnKeys = curr?.relyOn?.reduce((prv: NamePath[], cur: IDependencyItem) => prv.concat([cur?.name] || []), []); + return prev.concat(currRelyOnKeys || []); + }, []), + ), + ); + }, [columns]); const hasSettled = initialValues && Object.keys(initialValues).length; useEffect(() => { @@ -35,8 +37,7 @@ Form.Block = (props: IFormProps) => { toggleForceRefresh(!forceRefresh); } }} - {...{ form, style }} - {...props}> + {...{ form, style, props }}> {columns.map((item: IFormColumnType) => { const { relyOn, name, label, render } = item; const showItem = relyOn ? relyOn?.some((relyOnItem: IDependencyItem) => relyOnItem.toContain?.includes(form.getFieldValue(relyOnItem.name))) : true; diff --git a/packages/mlz-admin/src/layout/index.tsx b/packages/mlz-admin/src/layout/index.tsx index c04665d5..a0fe7e31 100755 --- a/packages/mlz-admin/src/layout/index.tsx +++ b/packages/mlz-admin/src/layout/index.tsx @@ -1,15 +1,17 @@ -import React from 'react'; +import React, { StrictMode } from 'react'; import { Layout as AntdLayout } from 'antd'; import ErrorBoundary from '../error-boundary'; -type AntdContentProps = typeof Content; +type AntdContentProps = typeof AntdLayout.Content; export interface ContentProps extends AntdContentProps { errorBoundary?: boolean; + children: React.ReactElement; } const Content = (props: ContentProps): typeof Content => { const { children, errorBoundary } = props; return errorBoundary === true || errorBoundary === undefined ? {children} : children; }; + AntdLayout.Content = Content; export default AntdLayout; diff --git a/packages/mlz-admin/src/table/common-search/index.tsx b/packages/mlz-admin/src/table/common-search/index.tsx index cc5910be..76388a17 100755 --- a/packages/mlz-admin/src/table/common-search/index.tsx +++ b/packages/mlz-admin/src/table/common-search/index.tsx @@ -1,4 +1,4 @@ -import React, { useContext, useState } from 'react'; +import React, { useContext, useState, memo } from 'react'; import { Form, Input, Row, Col, InputNumber, Select } from 'antd'; import Button from '../../button'; import DatePicker from '../../date-picker'; @@ -179,5 +179,5 @@ const InternalCommonSearch = (props: ICommonSearch) => { ); }; -const CommonSearchForm = (props: ICommonSearch) => ; +const CommonSearchForm = memo((props: ICommonSearch) => ); export default CommonSearchForm; diff --git a/packages/mlz-admin/src/table/index.tsx b/packages/mlz-admin/src/table/index.tsx index 08d85a46..b9e7b8ab 100755 --- a/packages/mlz-admin/src/table/index.tsx +++ b/packages/mlz-admin/src/table/index.tsx @@ -1,17 +1,17 @@ -import React from 'react'; +import React, { useMemo, memo } from 'react'; import CommonTable, { formatColumns } from './common-table'; import CommonSearchForm from './common-search'; import { ITableTypes } from './common-table/index.type'; import './index.less'; -const InteralTable = (props: ITableTypes) => { +const InteralTable = memo((props: ITableTypes) => { const { columns = [], tools = [], operations = [] } = props; - const formattedColumns = formatColumns(columns); + const formattedColumns = useMemo(() => formatColumns(columns), [columns]); return ( <> {tools.length || operations.length || formattedColumns.some((item) => item.searchable) ? : null} ); -}; +}); export default InteralTable; diff --git a/packages/mlz-admin/src/tabs/__tests__/index.test.tsx b/packages/mlz-admin/src/tabs/__tests__/index.test.tsx index 8868b61a..8147f05f 100755 --- a/packages/mlz-admin/src/tabs/__tests__/index.test.tsx +++ b/packages/mlz-admin/src/tabs/__tests__/index.test.tsx @@ -144,7 +144,7 @@ describe('🧪 Tabs', () => { .simulate('click'); expect(onTabClickHandler).toHaveBeenCalled(); // 一次是初始化时的变化,一次是click时的变化 - expect(onChangeHandler).toHaveBeenCalledTimes(2); + expect(onChangeHandler).toHaveBeenCalledTimes(3); }); // TODO: contextMenu属性设置内容时,点击关闭和新增按钮触发对应的onEdit事件 diff --git a/packages/mlz-admin/src/tabs/custom-tab-bar.less b/packages/mlz-admin/src/tabs/custom-tab-bar.less old mode 100644 new mode 100755 index 50700060..7af1998d --- a/packages/mlz-admin/src/tabs/custom-tab-bar.less +++ b/packages/mlz-admin/src/tabs/custom-tab-bar.less @@ -1,36 +1,17 @@ @import './index.less'; +@import '~antd/lib/style/themes/default.less'; .admini-tabs__wrapper { - overflow: hidden; + overflow-x: auto; padding: 0; + margin-bottom: 0; .admini-tabs__tab-pane { - cursor: pointer; - padding: 8px 16px; list-style: none; float: left; - background-color: rgba(250, 250, 250); - border: solid 1px rgba(240, 240, 240); border-bottom: none; - border-top-left-radius: 2px; - border-top-right-radius: 2px; - margin-left: 2px; - transition: transform 0.3s ease; .ant-tabs-tab-btn { margin-right: 8px; } - &.active { - background: white; - color: #1890ff; - } - &.context-menu-active { - color: #1890ff; - } - &:hover { - color: #1890ff; - .ant-tabs-add-btn { - color: #1890ff; - } - } .admini-tabs__tab-pane__content { font-size: 14px; line-height: 22px; @@ -40,7 +21,6 @@ &:extend(.tab-remove-btn-base-style all); } .ant-tabs-add-btn { - color: black; font-size: 24px; padding: 0; line-height: 1.1; diff --git a/packages/mlz-admin/src/tabs/index.less b/packages/mlz-admin/src/tabs/index.less index d13aedb2..eb2f150f 100755 --- a/packages/mlz-admin/src/tabs/index.less +++ b/packages/mlz-admin/src/tabs/index.less @@ -12,12 +12,14 @@ } } -.ant-tabs-nav .ant-tabs-nav-wrap .ant-tabs-nav-list .ant-tabs-tab { - transition: all 0.1s; - .ant-tabs-tab-btn { - margin-right: 8px; - } - .ant-tabs-tab-remove { - &:extend(.tab-remove-btn-base-style all); +.ant-tabs-nav .ant-tabs-nav-wrap { + overflow: auto !important; + .ant-tabs-nav-list .ant-tabs-tab { + .ant-tabs-tab-btn { + margin-right: 8px; + } + .ant-tabs-tab-remove { + &:extend(.tab-remove-btn-base-style all); + } } } diff --git a/packages/mlz-admin/src/tabs/index.tsx b/packages/mlz-admin/src/tabs/index.tsx index 041ef492..824eb5af 100755 --- a/packages/mlz-admin/src/tabs/index.tsx +++ b/packages/mlz-admin/src/tabs/index.tsx @@ -2,108 +2,135 @@ /* eslint-disable jsx-a11y/click-events-have-key-events */ import { Button, Tabs as AntdTabs, Dropdown } from 'antd'; import { TabsProps } from 'antd/lib/tabs'; -import React, { useEffect, useMemo, useState } from 'react'; +import React, { useEffect, useMemo, useState, useCallback } from 'react'; import { createBem } from '../shared/utils'; +import { ITabsProp, TTabPaneInfo } from './index.type'; +import { getDataType } from 'mytils'; +import { flatten } from 'lodash-es'; +import Icon from '../icon'; import './custom-tab-bar.less'; import './index.less'; -import { ITabsProp, TTabPaneInfo } from './index.type'; const defaultKey = 1; const bem = createBem('tabs'); -const AntdTabsVariety = AntdTabs; +const AntdTabsAlias = AntdTabs; + const ContextMenuTabs = (props: ITabsProp) => { const { children, contextMenu, onChange, onEdit, onTabClick, hideAdd, onContextMenuCapture, onContextMenuVisibleChange, ...others } = props; // const [activeKey, setActiveKey] = useState(defaultKey); useEffect(() => { - onChange?.(activeKey.toString()); + onChange?.(activeKey?.toString()); }, [activeKey]); + useEffect(() => { + setActiveKey(others.activeKey || ''); + }, [others.activeKey]); - // - const renderTabBar = (opts: any) => { - // - const tabs = useMemo(() => { - return opts.panes?.map((item) => { - return { - key: item.key || item.props.tab, - title: item.props.tab, - }; - }); - }, [opts.panes]); + const renderTabBar = useCallback( + (opts: any) => { + // + let tabs = []; + if (opts?.panes?.length) { + tabs = opts.panes + ?.filter((_) => _) + ?.map((item) => { + return { + key: item.key || item.props?.tab, + title: item.props?.tab, + props: item.props, + }; + }); + } - // - const [contextMenuVisible, toggleContextMenuVisible] = useState(false); - const [contextMenuCapturedKey, setContextMenuCapturedKey] = useState(defaultKey); + // + const [contextMenuVisible, toggleContextMenuVisible] = useState(false); + const [contextMenuCapturedKey, setContextMenuCapturedKey] = useState(defaultKey); - return ( - { - toggleContextMenuVisible(visible); - onContextMenuVisibleChange?.(visible); - }}> -
    - {tabs?.map((tab) => { - return ( -
  • { - setActiveKey(tab.key); - onTabClick?.(tab.key, e); - }} - onContextMenu={(e) => { - setContextMenuCapturedKey(tab.key); - onContextMenuCapture?.(tab, e); - }} - role="button"> - {tab.title} - + ) : null} +
  • + ) : null; + })} + {hideAdd !== true ? ( +
  • { - onEdit?.(tab.key, 'remove'); - e.stopPropagation(); - }}> - x - -
  • - ); - })} - {hideAdd !== true ? ( -
  • { - onEdit?.(e, 'add'); - }} - role="button"> - -
  • - ) : null} -
-
- ); - }; + onEdit?.(e, 'add'); + }} + role="button"> + + + ) : null} + + + + ); + }, + [props.children, contextMenu, activeKey], + ); return ( - - {children} - + + {getDataType(children) === 'array' ? flatten(children as React.ReactNode[]) : children} + ); }; interface compositedComponent extends React.ForwardRefExoticComponent> { ContextMenuTabs: typeof ContextMenuTabs; - TabPane: typeof AntdTabsVariety.TabPane; + TabPane: typeof AntdTabsAlias.TabPane; } -const Tabs = AntdTabsVariety as compositedComponent; +const Tabs = AntdTabsAlias as compositedComponent; Tabs.ContextMenuTabs = ContextMenuTabs; -Tabs.TabPane = AntdTabsVariety.TabPane; export default Tabs; diff --git a/packages/mlz-admin/src/tabs/index.type.ts b/packages/mlz-admin/src/tabs/index.type.ts old mode 100644 new mode 100755 index f103b2d8..a620ab8e --- a/packages/mlz-admin/src/tabs/index.type.ts +++ b/packages/mlz-admin/src/tabs/index.type.ts @@ -7,7 +7,7 @@ export type TTabPaneInfo = { title: string; }; export interface ITabsProp extends Omit { - contextMenu?: React.ReactElement; + contextMenu: React.ReactElement; onContextMenuCapture?(tab: TTabPaneInfo, e: React.MouseEvent): void; onContextMenuVisibleChange?(visible: boolean): void; } diff --git a/packages/mlz-admin/src/tree/index.less b/packages/mlz-admin/src/tree/index.less old mode 100644 new mode 100755 diff --git a/packages/mlz-adminer/package-lock.json b/packages/mlz-adminer/package-lock.json new file mode 100755 index 00000000..c0ac0c81 --- /dev/null +++ b/packages/mlz-adminer/package-lock.json @@ -0,0 +1,156 @@ +{ + "name": "@mlz/adminer", + "version": "1.0.0", + "lockfileVersion": 1, + "requires": true, + "dependencies": { + "history": { + "version": "4.10.1", + "resolved": "https://registry.npmjs.org/history/-/history-4.10.1.tgz", + "integrity": "sha512-36nwAD620w12kuzPAsyINPWJqlNbij+hpK1k9XRloDtym8mxzGYl2c17LnV6IAGB2Dmg4tEa7G7DlawS0+qjew==", + "requires": { + "@babel/runtime": "^7.1.2", + "loose-envify": "^1.2.0", + "resolve-pathname": "^3.0.0", + "tiny-invariant": "^1.0.2", + "tiny-warning": "^1.0.0", + "value-equal": "^1.0.1" + }, + "dependencies": { + "@babel/runtime": { + "version": "7.14.6", + "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.14.6.tgz", + "integrity": "sha512-/PCB2uJ7oM44tz8YhC4Z/6PeOKXp4K588f+5M3clr1M4zbqztlo0XEfJ2LEzj/FgwfgGcIdl8n7YYjTCI0BYwg==", + "requires": { + "regenerator-runtime": "^0.13.4" + } + } + } + }, + "hoist-non-react-statics": { + "version": "3.3.2", + "resolved": "https://registry.npmjs.org/hoist-non-react-statics/-/hoist-non-react-statics-3.3.2.tgz", + "integrity": "sha512-/gGivxi8JPKWNm/W0jSmzcMPpfpPLc3dY/6GxhX2hQ9iGj3aDfklV4ET7NjKpSinLpJ5vafa9iiGIEZg10SfBw==", + "requires": { + "react-is": "^16.7.0" + } + }, + "isarray": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz", + "integrity": "sha1-ihis/Kmo9Bd+Cav8YDiTmwXR7t8=" + }, + "js-tokens": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", + "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==" + }, + "loose-envify": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/loose-envify/-/loose-envify-1.4.0.tgz", + "integrity": "sha512-lyuxPGr/Wfhrlem2CL/UcnUc1zcqKAImBDzukY7Y5F/yQiNdko6+fRLevlw1HgMySw7f611UIY408EtxRSoK3Q==", + "requires": { + "js-tokens": "^3.0.0 || ^4.0.0" + } + }, + "mini-create-react-context": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/mini-create-react-context/-/mini-create-react-context-0.4.1.tgz", + "integrity": "sha512-YWCYEmd5CQeHGSAKrYvXgmzzkrvssZcuuQDDeqkT+PziKGMgE+0MCCtcKbROzocGBG1meBLl2FotlRwf4gAzbQ==", + "requires": { + "@babel/runtime": "^7.12.1", + "tiny-warning": "^1.0.3" + }, + "dependencies": { + "@babel/runtime": { + "version": "7.14.6", + "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.14.6.tgz", + "integrity": "sha512-/PCB2uJ7oM44tz8YhC4Z/6PeOKXp4K588f+5M3clr1M4zbqztlo0XEfJ2LEzj/FgwfgGcIdl8n7YYjTCI0BYwg==", + "requires": { + "regenerator-runtime": "^0.13.4" + } + } + } + }, + "object-assign": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", + "integrity": "sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM=" + }, + "path-to-regexp": { + "version": "1.8.0", + "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-1.8.0.tgz", + "integrity": "sha512-n43JRhlUKUAlibEJhPeir1ncUID16QnEjNpwzNdO3Lm4ywrBpBZ5oLD0I6br9evr1Y9JTqwRtAh7JLoOzAQdVA==", + "requires": { + "isarray": "0.0.1" + } + }, + "prop-types": { + "version": "15.7.2", + "resolved": "https://registry.npmjs.org/prop-types/-/prop-types-15.7.2.tgz", + "integrity": "sha512-8QQikdH7//R2vurIJSutZ1smHYTcLpRWEOlHnzcWHmBYrOGUysKwSsrC89BCiFj3CbrfJ/nXFdJepOVrY1GCHQ==", + "requires": { + "loose-envify": "^1.4.0", + "object-assign": "^4.1.1", + "react-is": "^16.8.1" + } + }, + "react-is": { + "version": "16.13.1", + "resolved": "https://registry.npmjs.org/react-is/-/react-is-16.13.1.tgz", + "integrity": "sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ==" + }, + "react-router": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/react-router/-/react-router-5.2.0.tgz", + "integrity": "sha512-smz1DUuFHRKdcJC0jobGo8cVbhO3x50tCL4icacOlcwDOEQPq4TMqwx3sY1TP+DvtTgz4nm3thuo7A+BK2U0Dw==", + "requires": { + "@babel/runtime": "^7.1.2", + "history": "^4.9.0", + "hoist-non-react-statics": "^3.1.0", + "loose-envify": "^1.3.1", + "mini-create-react-context": "^0.4.0", + "path-to-regexp": "^1.7.0", + "prop-types": "^15.6.2", + "react-is": "^16.6.0", + "tiny-invariant": "^1.0.2", + "tiny-warning": "^1.0.0" + }, + "dependencies": { + "@babel/runtime": { + "version": "7.14.6", + "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.14.6.tgz", + "integrity": "sha512-/PCB2uJ7oM44tz8YhC4Z/6PeOKXp4K588f+5M3clr1M4zbqztlo0XEfJ2LEzj/FgwfgGcIdl8n7YYjTCI0BYwg==", + "requires": { + "regenerator-runtime": "^0.13.4" + } + } + } + }, + "regenerator-runtime": { + "version": "0.13.7", + "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.13.7.tgz", + "integrity": "sha512-a54FxoJDIr27pgf7IgeQGxmqUNYrcV338lf/6gH456HZ/PhX+5BcwHXG9ajESmwe6WRO0tAzRUrRmNONWgkrew==" + }, + "resolve-pathname": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/resolve-pathname/-/resolve-pathname-3.0.0.tgz", + "integrity": "sha512-C7rARubxI8bXFNB/hqcp/4iUeIXJhJZvFPFPiSPRnhU5UPxzMFIl+2E6yY6c4k9giDJAhtV+enfA+G89N6Csng==" + }, + "tiny-invariant": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/tiny-invariant/-/tiny-invariant-1.1.0.tgz", + "integrity": "sha512-ytxQvrb1cPc9WBEI/HSeYYoGD0kWnGEOR8RY6KomWLBVhqz0RgTwVO9dLrGz7dC+nN9llyI7OKAgRq8Vq4ZBSw==" + }, + "tiny-warning": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/tiny-warning/-/tiny-warning-1.0.3.tgz", + "integrity": "sha512-lBN9zLN/oAf68o3zNXYrdCt1kP8WsiGW8Oo2ka41b2IM5JL/S1CTyX1rW0mb/zSuJun0ZUrDxx4sqvYS2FWzPA==" + }, + "value-equal": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/value-equal/-/value-equal-1.0.1.tgz", + "integrity": "sha512-NOJ6JZCAWr0zlxZt+xqCHNTEKOsrks2HQd4MqhP1qy4z1SkbEP467eNx6TgDKXMvUOb+OENfJCZwM+16n7fRfw==" + } + } +} diff --git a/packages/mlz-adminer/package.json b/packages/mlz-adminer/package.json index 7001b173..497b68bc 100755 --- a/packages/mlz-adminer/package.json +++ b/packages/mlz-adminer/package.json @@ -1,6 +1,6 @@ { "name": "@mlz/adminer", - "version": "0.10.0", + "version": "1.0.0", "description": "@mlz/admin配套的交互和业务代码库", "license": "MPL2", "keywords": [ @@ -19,12 +19,13 @@ "dependencies": { "@babel/runtime": "^7.10.2", "@mlz/admin": "^0.8.5", - "react": "^16.14.0", - "react-dom": "^16.14.0", + "react": "^17.0.2", + "react-dom": "^17.0.2", + "react-router": "^5.2.0", "umi-request": "^1.3.5" }, "peerDependencies": { - "@mlz/admin": ">=0.8.5", + "@mlz/admin": ">=0.9.2", "umi-request": ">=1.3.5" }, "devDependencies": { @@ -47,4 +48,4 @@ "registry": "https://registry.npmjs.org/" }, "gitHead": "2fed11fc4cc30fd18219c3ddf5aea7ca5e778143" -} \ No newline at end of file +} diff --git a/packages/mlz-adminer/src/shared/basic-class/index.ts b/packages/mlz-adminer/src/shared/basic-class/index.ts old mode 100644 new mode 100755 diff --git a/packages/mlz-adminer/src/shared/basic-request-hook/index.tsx b/packages/mlz-adminer/src/shared/basic-request-hook/index.tsx old mode 100644 new mode 100755 index 3c5e93cc..aba7ff06 --- a/packages/mlz-adminer/src/shared/basic-request-hook/index.tsx +++ b/packages/mlz-adminer/src/shared/basic-request-hook/index.tsx @@ -53,7 +53,12 @@ const useBasicRequest =

, R>(fetchPromise: // const devResult = { loading, run, data: response, abort, setResponse, toggleLoading }; - return isCompiled ? { loading, run, ...(!manual && { data: response, abort }) } : devResult; + + type TDevResult = typeof devResult; + type TCompiledBundleType = { loading: boolean; run: Function; data: R; abort: Function }; + + const returnedValue = (isCompiled ? ({ loading, run, ...(!manual && { data: response, abort }) } as TCompiledBundleType) : devResult) as TDevResult; + return returnedValue; }; export default useBasicRequest; diff --git a/packages/mlz-adminer/src/shared/basic-request-hook/index.type.ts b/packages/mlz-adminer/src/shared/basic-request-hook/index.type.ts old mode 100644 new mode 100755 diff --git a/packages/mlz-adminer/src/shared/index.tsx b/packages/mlz-adminer/src/shared/index.tsx old mode 100644 new mode 100755 diff --git a/packages/mlz-adminer/src/shared/service/index.ts b/packages/mlz-adminer/src/shared/service/index.ts index c0a686d6..1dcacd40 100755 --- a/packages/mlz-adminer/src/shared/service/index.ts +++ b/packages/mlz-adminer/src/shared/service/index.ts @@ -44,7 +44,7 @@ export type IHttpObject = Record { - $http[method] = async (url: URL['href'], opts?: Partial) => { + $http[method] = async (url: URL['href'], opts?: Partial): Promise => { const { host = config[env]?.['hosts']?.['open-service'], data, params, ...rests } = opts || {}; return umiRequest[method](`${host}/${url.replace(/^\//g, '')}`, { data, diff --git a/packages/mlz-adminer/src/shared/utils/index.ts b/packages/mlz-adminer/src/shared/utils/index.ts old mode 100644 new mode 100755 diff --git a/packages/mlz-adminer/src/use-auth-guard/accessories/auth-menu.tsx b/packages/mlz-adminer/src/use-auth-guard/accessories/auth-menu.tsx new file mode 100755 index 00000000..34c7bb26 --- /dev/null +++ b/packages/mlz-adminer/src/use-auth-guard/accessories/auth-menu.tsx @@ -0,0 +1,14 @@ +import React, { createContext, useContext } from 'react'; +import useAuthGuard from '..'; + +const InnerAuthMenu = (props: any) => { + console.log(props, 'InnerAuthMenu'); + return

1234
; +}; + +const AuthMenu = (props?: any) => { + const { AuthGuard } = useAuthGuard(); + return {(info) => }; +}; + +export default AuthMenu; diff --git a/packages/mlz-adminer/src/use-auth-guard/accessories/auth-resource.tsx b/packages/mlz-adminer/src/use-auth-guard/accessories/auth-resource.tsx new file mode 100755 index 00000000..fed2aaa1 --- /dev/null +++ b/packages/mlz-adminer/src/use-auth-guard/accessories/auth-resource.tsx @@ -0,0 +1,7 @@ +import React, { createContext, useContext } from 'react'; + +const AuthResource = (props?: any) => { + return
resources
; +}; + +export default AuthResource; diff --git a/packages/mlz-adminer/src/use-auth-guard/controller.ts b/packages/mlz-adminer/src/use-auth-guard/controller.ts new file mode 100755 index 00000000..bfa59471 --- /dev/null +++ b/packages/mlz-adminer/src/use-auth-guard/controller.ts @@ -0,0 +1,37 @@ +import $http, { paramsDiverter } from '../shared/service'; +import config, { isCompiled, env, mockHost, redirectMiddleService, OpenServiceHOST } from '../shared/service/constant'; +import { TMenuResponse, TResourceResponse, IAuthRequestParams } from './index.type'; + +const { timeout = 5000 } = config?.[env] || {}; + +// 获取菜单列表 +export const getMenus = (params?: IAuthRequestParams): Promise => { + const { host } = params || {}; + const DECODE_PHONE_MOCK_URL = `${mockHost}/menus`; + const logoutURL = isCompiled ? `${host || OpenServiceHOST}/decode/phone_number` : redirectMiddleService; + const requestUrl = new URL(logoutURL); + + return >$http.post(requestUrl.pathname, { + timeout, + ...paramsDiverter(params || {}, { + data: { url: `${DECODE_PHONE_MOCK_URL}` }, + }), + host: host || `https://${requestUrl.host}`, + }); +}; + +// 获取资源列表 +export const getResources = (params?: IAuthRequestParams): Promise => { + const { host } = params || {}; + const DECODE_PHONE_MOCK_URL = `${mockHost}/resources`; + const logoutURL = isCompiled ? `${OpenServiceHOST}/decode/phone_number` : redirectMiddleService; + const requestUrl = new URL(logoutURL); + + return >$http.post(requestUrl.pathname, { + timeout, + ...paramsDiverter(params || {}, { + data: { url: `${DECODE_PHONE_MOCK_URL}` }, + }), + host: host || `https://${requestUrl.host}`, + }); +}; diff --git a/packages/mlz-adminer/src/use-auth-guard/index.tsx b/packages/mlz-adminer/src/use-auth-guard/index.tsx new file mode 100755 index 00000000..005ad6e0 --- /dev/null +++ b/packages/mlz-adminer/src/use-auth-guard/index.tsx @@ -0,0 +1,66 @@ +import React, { createContext, useContext, useMemo } from 'react'; +import useBasicRequest from '../shared/basic-request-hook'; +import { useAuthGuardOptions, TMenuListItem, TResourceListItem, IAuthGuardProps } from './index.type'; +import AuthMenu from './accessories/auth-menu'; +import AuthResource from './accessories/auth-resource'; +import { default as Auth } from './model'; + +/** + * 创建context + */ +export const Context = createContext<{ menus: TMenuListItem[]; resources: TResourceListItem[]; routes: any[] }>({ + menus: [], + resources: [], + routes: [], +}); + +// +const useAuthGuard = (options?: useAuthGuardOptions, deps?: any[]) => { + const context = useContext(Context); + + const { data: menus = [{ menu_code: '/a/b' }, { menu_code: '/c/d' }] } = useBasicRequest(Auth.create().getMenus, { deps, ...options }); + const { data: resources = [] } = useBasicRequest(Auth.create().getResources, { deps, ...options }); + + /** + * 需求: + * 1.根据menus分配前端动态路由,没有的不允许访问。 + * 2.根据resources对应的resource_url,在status为YES的情况下,也要成为生成路由的素材。 + * 3. + */ + const routes = [ + ...menus.map(($m) => $m.menu_code), + ...resources.map(($r) => { + if ($r.status === 'YES') { + return $r.resource_url; + } else { + return undefined; + } + }), + ].filter((rt) => rt); + + const AuthGuard = useMemo(() => { + const contextPayload = { + menus, + resources, + routes, + }; + return (props: IAuthGuardProps) => { + const { children } = props; + return ( + <>{children(contextPayload)} + + // 权限系统目前来看,可以视为一个常量,用于派生 + // 对应的menus或resources,所以不需要context后续更改 + // + // + // {() => children(contextPayload)} + // + ); + }; + }, []); + + return { menus, resources, routes, AuthGuard, _Context: Context }; +}; + +export { AuthMenu, AuthResource }; +export default useAuthGuard; diff --git a/packages/mlz-adminer/src/use-auth-guard/index.type.ts b/packages/mlz-adminer/src/use-auth-guard/index.type.ts new file mode 100755 index 00000000..63ac7220 --- /dev/null +++ b/packages/mlz-adminer/src/use-auth-guard/index.type.ts @@ -0,0 +1,47 @@ +import React from 'react'; + +export type TContact = { + id: string; + name: string; +}; + +export type TMenuListItem = { + menu_code: string; + menu_id: number; + menu_name: string; + order_number: number; + parent_id: number; +}; + +export interface TMenuResponse extends Response { + readonly appid: number; + readonly app_name: string; + readonly authorizationContact: TContact; + readonly menu_list: TMenuListItem[]; +} + +export type TResourceListItem = { + description: string; + resourceId: number; + resource_code: string; + resource_name: string; + resource_url: string; + status: 'YES' | 'NO'; +}; + +export interface TResourceResponse extends Response { + readonly app_id: number; + readonly app_name: string; + readonly menu_id: number; + readonly resources: TResourceListItem[]; +} + +export interface useAuthGuardOptions {} + +export interface IAuthRequestParams { + host?: string; +} + +export interface IAuthGuardProps { + children: (...args: any) => React.ReactElement; +} diff --git a/packages/mlz-adminer/src/use-auth-guard/model.ts b/packages/mlz-adminer/src/use-auth-guard/model.ts new file mode 100755 index 00000000..d8356d0b --- /dev/null +++ b/packages/mlz-adminer/src/use-auth-guard/model.ts @@ -0,0 +1,24 @@ +import { getMenus, getResources } from './controller'; +import { TMenuListItem, TResourceListItem } from './index.type'; + +export default class Auth { + readonly menus: TMenuListItem[] = []; + + readonly resources: TResourceListItem[] = []; + + static create = () => { + return new Auth(); + }; + + getMenus = async () => { + const menus = await getMenus(); + return menus; + }; + + getResources = async () => { + const resources = await getResources(); + return resources; + }; + + genRouters = () => {}; +} diff --git a/packages/mlz-adminer/src/use-staff-logout/__tests__/index.test.tsx b/packages/mlz-adminer/src/use-staff-logout/__tests__/index.test.tsx old mode 100644 new mode 100755 diff --git a/packages/mlz-adminer/src/use-staff-logout/controller.ts b/packages/mlz-adminer/src/use-staff-logout/controller.ts old mode 100644 new mode 100755 diff --git a/packages/mlz-adminer/src/use-staff-logout/index.type.ts b/packages/mlz-adminer/src/use-staff-logout/index.type.ts old mode 100644 new mode 100755 diff --git a/packages/mlz-adminer/src/use-staff-logout/model.ts b/packages/mlz-adminer/src/use-staff-logout/model.ts old mode 100644 new mode 100755 diff --git a/scripts/common/genAdminerExports.js b/scripts/common/genAdminerExports.js index 650bd94e..fb08d5c2 100755 --- a/scripts/common/genAdminerExports.js +++ b/scripts/common/genAdminerExports.js @@ -7,7 +7,7 @@ const genAdminerExports = () => genExports(ADMINER_SRC_PATH, { donotCamelizes: [], donotCompiles: ['service'], - extraContents: [], + extraContents: [`export { AuthMenu } from './use-auth-guard';`, ` export { AuthResource } from './use-auth-guard';`], }); module.exports = genAdminerExports; diff --git a/scripts/common/genVersion.js b/scripts/common/genVersion.js index feae99c4..27308694 100755 --- a/scripts/common/genVersion.js +++ b/scripts/common/genVersion.js @@ -1,6 +1,6 @@ #!/usr/bin/env node -const pkg = require('../../package.json'); +const { version } = require('../../lerna.json'); const antdVersion = require('../../node_modules/antd/package.json').version; -module.exports = (opt = {}) => `export const version = '${pkg.version}';\n\r +module.exports = (opt = {}) => `export const version = '${version}';\n\r export const AntdVersion = '${opt.antdVersion || antdVersion}';`;