├── .github ├── ISSUE_TEMPLATE │ ├── BUG_REPORT.md │ └── FEATURE_REQUEST.md └── workflows │ └── ci.yml ├── .gitignore ├── .husky └── pre-commit ├── .prettierignore ├── .prettierrc ├── CHANGELOG.md ├── LICENSE ├── README.md ├── create-uiw-admin ├── .gitignore ├── .prettierignore ├── .prettierrc ├── README.md ├── package.json ├── renovate.json ├── src │ ├── cli.ts │ └── utils.ts ├── test │ └── cli.test.ts └── tsconfig.json ├── eslint-packages └── config │ ├── README.md │ ├── index.js │ └── package.json ├── examples ├── base │ ├── .editorconfig │ ├── .gitignore │ ├── .prettierignore │ ├── .prettierrc.js │ ├── .stackblitzrc │ ├── README.md │ ├── config │ │ ├── .kktprc.ts │ │ └── routes.json │ ├── mocker │ │ ├── auth │ │ │ └── index.js │ │ ├── demo.js │ │ ├── index.js │ │ ├── login.js │ │ └── selectPage.js │ ├── package.json │ ├── public │ │ ├── favicon.ico │ │ └── index.html │ ├── sandbox.config.json │ ├── src │ │ ├── assets │ │ │ ├── head.png │ │ │ ├── index.js │ │ │ ├── logo-dark.svg │ │ │ └── logo-light.svg │ │ ├── layouts │ │ │ ├── BasicLayout.tsx │ │ │ ├── UserLayout.tsx │ │ │ └── logo.svg │ │ ├── models │ │ │ ├── Doc │ │ │ │ └── doc.ts │ │ │ ├── demo.ts │ │ │ ├── global.ts │ │ │ ├── home.ts │ │ │ └── login.ts │ │ ├── pages │ │ │ ├── Dashboard │ │ │ │ ├── index.tsx │ │ │ │ └── models │ │ │ │ │ └── index.ts │ │ │ ├── Demo │ │ │ │ ├── Detail │ │ │ │ │ ├── index.tsx │ │ │ │ │ └── items.tsx │ │ │ │ ├── index.tsx │ │ │ │ └── models │ │ │ │ │ └── index.ts │ │ │ ├── Form │ │ │ │ ├── index.less │ │ │ │ ├── index.tsx │ │ │ │ ├── items.tsx │ │ │ │ └── models │ │ │ │ │ └── index.ts │ │ │ ├── TableList │ │ │ │ └── index.tsx │ │ │ └── ceshi.tsx │ │ ├── react-app-env.d.ts │ │ ├── routesOutletElement │ │ │ ├── index.css │ │ │ └── index.tsx │ │ └── servers │ │ │ ├── demo.ts │ │ │ └── index.ts │ └── tsconfig.json └── website │ ├── README.md │ ├── config │ ├── .kktprc.ts │ └── routes.js │ ├── package.json │ ├── public │ ├── index.html │ └── logo.svg │ ├── src │ ├── components │ │ ├── Layouts │ │ │ ├── Menu │ │ │ │ ├── index.tsx │ │ │ │ └── style.ts │ │ │ ├── Navbar │ │ │ │ ├── index.tsx │ │ │ │ └── style.ts │ │ │ └── index │ │ │ │ ├── index.tsx │ │ │ │ └── style.ts │ │ ├── Loading │ │ │ ├── index.tsx │ │ │ └── style.ts │ │ └── Preview │ │ │ ├── index.tsx │ │ │ ├── nodes │ │ │ ├── toc.less │ │ │ └── toc.tsx │ │ │ ├── useHyperlink.tsx │ │ │ └── useMdData.ts │ ├── global.css │ ├── index.less │ ├── menus.ts │ ├── pages │ │ ├── auth │ │ │ ├── README.md │ │ │ └── index.tsx │ │ ├── authorized │ │ │ └── index.tsx │ │ ├── basic-layouts │ │ │ └── index.tsx │ │ ├── components │ │ │ ├── ProDrawer.tsx │ │ │ ├── ProForm.tsx │ │ │ ├── Protable.tsx │ │ │ ├── Skeleton.tsx │ │ │ └── index.tsx │ │ ├── config │ │ │ └── index.tsx │ │ ├── document-title │ │ │ └── index.tsx │ │ ├── eslint-config │ │ │ ├── README.md │ │ │ └── index.tsx │ │ ├── example │ │ │ ├── index.module.css │ │ │ └── index.tsx │ │ ├── exceptions │ │ │ └── index.tsx │ │ ├── home │ │ │ ├── index.tsx │ │ │ └── style.ts │ │ ├── layout-tabs │ │ │ └── index.tsx │ │ ├── mocker │ │ │ ├── README.md │ │ │ └── index.tsx │ │ ├── models │ │ │ ├── README.md │ │ │ └── index.tsx │ │ ├── navbar │ │ │ └── index.tsx │ │ ├── newPages │ │ │ ├── README.md │ │ │ └── index.tsx │ │ ├── plugins │ │ │ └── index.tsx │ │ ├── proxy │ │ │ ├── README.md │ │ │ └── index.tsx │ │ ├── quick-start │ │ │ ├── README.md │ │ │ └── index.tsx │ │ ├── request │ │ │ ├── README.md │ │ │ └── index.tsx │ │ ├── router-control │ │ │ └── index.tsx │ │ ├── user-login │ │ │ ├── Example.tsx │ │ │ ├── Examples.tsx │ │ │ ├── index.tsx │ │ │ ├── index2.tsx │ │ │ └── logo-large.svg │ │ └── utils │ │ │ └── index.tsx │ └── react-app-env.d.ts │ └── tsconfig.json ├── lerna.json ├── package.json ├── packages ├── authorized │ ├── README.md │ ├── package.json │ ├── src │ │ ├── Auth.tsx │ │ └── index.tsx │ └── tsconfig.json ├── basic-layouts │ ├── README.md │ ├── package.json │ ├── src │ │ ├── components │ │ │ ├── BodyContent │ │ │ │ └── index.tsx │ │ │ ├── Breadcrumb │ │ │ │ ├── index.css │ │ │ │ └── index.tsx │ │ │ ├── FullScreen │ │ │ │ └── index.tsx │ │ │ ├── HeaderRightMenu │ │ │ │ ├── index.css │ │ │ │ └── index.tsx │ │ │ ├── IconBox │ │ │ │ ├── index.css │ │ │ │ └── index.tsx │ │ │ ├── LogoHeader │ │ │ │ └── index.tsx │ │ │ ├── Menu │ │ │ │ ├── Search.tsx │ │ │ │ └── index.tsx │ │ │ └── index.ts │ │ ├── hook.ts │ │ ├── index.css │ │ ├── index.tsx │ │ ├── useLayouts.tsx │ │ └── utils.ts │ └── tsconfig.json ├── components │ ├── README.md │ ├── __tests__ │ │ └── components.test.js │ ├── package.json │ ├── src │ │ ├── ProDrawer │ │ │ ├── README.md │ │ │ └── index.tsx │ │ ├── ProForm │ │ │ ├── README.md │ │ │ ├── formdom.tsx │ │ │ ├── hooks │ │ │ │ ├── store.tsx │ │ │ │ └── useForm.tsx │ │ │ ├── index.tsx │ │ │ ├── readform.tsx │ │ │ ├── style │ │ │ │ └── form-item.css │ │ │ ├── type.ts │ │ │ ├── utils │ │ │ │ └── index.tsx │ │ │ └── widgets │ │ │ │ ├── CheckBox │ │ │ │ └── index.tsx │ │ │ │ ├── SearchTree │ │ │ │ └── index.tsx │ │ │ │ ├── SelectMultiple │ │ │ │ └── index.tsx │ │ │ │ ├── Upload │ │ │ │ └── index.tsx │ │ │ │ └── index.tsx │ │ ├── ProTable │ │ │ ├── BaseForm.tsx │ │ │ ├── BaseTable.tsx │ │ │ ├── README.md │ │ │ ├── hooks.ts │ │ │ ├── index.css │ │ │ ├── index.tsx │ │ │ ├── style │ │ │ │ └── index.less │ │ │ ├── types.ts │ │ │ ├── useSelections.ts │ │ │ ├── useTable.ts │ │ │ └── widgets │ │ │ │ ├── Radio.tsx │ │ │ │ ├── SearchTree.tsx │ │ │ │ └── Select.tsx │ │ ├── Skeleton │ │ │ ├── README.md │ │ │ └── index.tsx │ │ ├── form │ │ │ ├── index.tsx │ │ │ ├── interface.ts │ │ │ └── utils │ │ │ │ └── index.ts │ │ └── index.tsx │ └── tsconfig.json ├── config │ ├── README.md │ ├── package.json │ ├── src │ │ ├── index.ts │ │ └── uitls.ts │ └── tsconfig.json ├── document-title │ ├── README.md │ ├── package.json │ ├── src │ │ └── index.tsx │ ├── tsconfig copy.json │ └── tsconfig.json ├── exceptions │ ├── README.md │ ├── package.json │ ├── src │ │ ├── Exceptions │ │ │ ├── 403.tsx │ │ │ ├── 404.tsx │ │ │ ├── 500.tsx │ │ │ ├── asset │ │ │ │ ├── 403.svg │ │ │ │ ├── 404.svg │ │ │ │ └── 500.svg │ │ │ └── styles │ │ │ │ └── index.css │ │ └── index.ts │ └── tsconfig.json ├── layout-tabs │ ├── README.md │ ├── package.json │ ├── src │ │ ├── index.tsx │ │ ├── styles │ │ │ └── index.css │ │ └── utils.ts │ └── tsconfig.json ├── markdown-navbar │ ├── README.md │ ├── package.json │ ├── src │ │ ├── index.tsx │ │ └── style.css │ └── tsconfig.json ├── models │ ├── README.md │ ├── package.json │ ├── src │ │ ├── index.ts │ │ └── react-app-env.d.ts │ └── tsconfig.json ├── plugins │ ├── README.md │ ├── package.json │ ├── src │ │ ├── index.ts │ │ ├── initIndex │ │ │ ├── index.ts │ │ │ └── temp.ts │ │ ├── rematch │ │ │ ├── index.ts │ │ │ ├── temp.ts │ │ │ └── utils.ts │ │ ├── routes │ │ │ ├── index.ts │ │ │ └── temp.ts │ │ └── utils │ │ │ ├── babel.ts │ │ │ ├── index.ts │ │ │ ├── interface.ts │ │ │ └── rematch.ts │ └── tsconfig.json ├── router-control │ ├── README.md │ ├── package.json │ ├── src │ │ └── index.ts │ └── tsconfig.json ├── uiw-admin │ ├── LICENSE │ ├── README.md │ ├── package.json │ └── tsconfig.json ├── user-login │ ├── README.md │ ├── package.json │ ├── src │ │ ├── assets │ │ │ ├── bg.jpeg │ │ │ └── r2g7rm.jpg │ │ ├── index.tsx │ │ ├── react-app-env.d.ts │ │ └── styles │ │ │ └── index.css │ └── tsconfig.json └── utils │ ├── README.md │ ├── package.json │ ├── src │ ├── cookies.ts │ ├── index.ts │ ├── request.ts │ └── utils.ts │ └── tsconfig.json ├── renovate.json ├── script └── copy.js ├── test └── copy.test.ts └── tsconfig.json /.github/ISSUE_TEMPLATE/BUG_REPORT.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: 错误报告(Bug Report) 3 | about: 当出现问题时提交报告以便修复! 4 | title: "[TimePicker<组件名称>]: 清晰简洁地一句话描述错误" 5 | labels: bug,question 6 | --- 7 | 8 | 注意:根据下面内容复现错误问题,以方便测试。 9 | 10 | ### 描述错误 11 | 12 | 清晰简洁地描述错误是什么。 13 | 14 | ### 错误复现 15 | 16 | 重现行为的步骤: 17 | 18 | 1. 转到“...” 19 | 2. 点击“....” 20 | 3. 向下滚动到“....” 21 | 4. 查看错误 22 | 23 | ### 提供在线重现示例 24 | 25 | 尽可能的提供一个在线示例,帮助我们快速解决问题。 26 | 27 | [![Open in CodeSandbox](https://img.shields.io/badge/Open%20in-CodeSandbox-blue?logo=codesandbox)](https://codesandbox.io/) 28 | 29 | ### 预期行为 30 | 31 | 对您期望发生的事情进行清晰简洁的描述。 32 | 33 | ### 截图 34 | 35 | 如果适用,请添加屏幕截图以帮助解释您的问题。 36 | 37 | ### 桌面(请填写以下信息): 38 | 39 | - UIW:[例如 v4.13.4] 40 | - 操作系统:[例如 macOS] 41 | - 浏览器:[例如 火狐、Chrome、Safari] 42 | - 版本和构建:[例如 59.0.2(64 位)] 43 | 44 | ### 智能手机(请填写以下信息): 45 | 46 | - 设备:[例如 iPhone 6] 47 | - 操作系统:[例如 iOS8.1] 48 | - 浏览器 [例如 股票浏览器,野生动物园] 49 | - 版本 [例如 22] 50 | 51 | ### 附加上下文 52 | 53 | 在此处添加有关该问题的任何其他上下文。 -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/FEATURE_REQUEST.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: 功能要求(Feature Request) 3 | about: 为 uiw-admin 组件推荐一个功能(添加一个组件,一个组件 API...)! 4 | labels: feature,enhancement 5 | --- 6 | 7 | **您的功能请求是否与问题有关?请描述。** 8 | 9 | 对推荐的新功能,添加清晰简洁的描述。前任。当 [...] 10 | 11 | **描述您想要的解决方案** 12 | 13 | 对您想要发生的事情的清晰简洁的描述。 14 | 15 | **描述您考虑过的替代方案** 16 | 17 | 对您考虑过的任何替代解决方案或功能的清晰简洁的描述。 18 | 19 | **附加上下文** 20 | 21 | 在此处添加有关功能请求的任何其他上下文或屏幕截图。 22 | 23 | ### 问题清单 24 | 25 | 完成每个步骤后,在方框中打一个 x。您也可以在创建问题后填写这些内容。如果您不确定其中的任何一个,请随时询问。我们是来帮忙的!这只是提醒我们在回应问题之前要寻找什么。 26 | 27 | - [ ] 我已经检查过其他类似的问题 28 | - [ ] 我已经解释了为什么这个改变很重要 29 | - [ ] 我添加了必要的文件(如果适用) -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | dist 2 | build 3 | lib 4 | esm 5 | coverage 6 | node_modules 7 | npm-debug.log* 8 | yarn-debug.log* 9 | yarn-error.log* 10 | package-lock.json 11 | yarn.lock 12 | baseJS 13 | basejs 14 | .kktp 15 | .uiw 16 | 17 | *.lerna_backup 18 | .DS_Store 19 | .cache 20 | .vscode 21 | .idea 22 | .snap 23 | .env 24 | 25 | *.bak 26 | *.tem 27 | *.temp 28 | #.swp 29 | *.*~ 30 | ~*.* 31 | 32 | # IDEA 33 | *.iml 34 | *.ipr 35 | *.iws -------------------------------------------------------------------------------- /.husky/pre-commit: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | . "$(dirname "$0")/_/husky.sh" 3 | 4 | npx --no-install lint-staged -------------------------------------------------------------------------------- /.prettierignore: -------------------------------------------------------------------------------- 1 | **/*.md 2 | **/*.svg 3 | **/*.ejs 4 | **/*.html 5 | examples/website/build 6 | package.json 7 | dist 8 | lib 9 | .kktp 10 | -------------------------------------------------------------------------------- /.prettierrc: -------------------------------------------------------------------------------- 1 | { 2 | "singleQuote": true, 3 | "trailingComma": "all", 4 | "printWidth": 80, 5 | "overrides": [ 6 | { 7 | "files": ".prettierrc", 8 | "options": { "parser": "json" } 9 | } 10 | ] 11 | } 12 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT LICENSE 2 | 3 | Copyright (c) 2020-present 尼好 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining 6 | a copy of this software and associated documentation files (the 7 | "Software"), to deal in the Software without restriction, including 8 | without limitation the rights to use, copy, modify, merge, publish, 9 | distribute, sublicense, and/or sell copies of the Software, and to 10 | permit persons to whom the Software is furnished to do so, subject to 11 | the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be 14 | included in all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 20 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 21 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 22 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | packages/uiw-admin/README.md -------------------------------------------------------------------------------- /create-uiw-admin/.gitignore: -------------------------------------------------------------------------------- 1 | build 2 | lib 3 | cjs 4 | esm 5 | node_modules 6 | coverage 7 | npm-debug.log* 8 | package-lock.json 9 | 10 | .eslintcache 11 | .DS_Store 12 | .cache 13 | .rdoc-dist 14 | 15 | *.log 16 | *.bak 17 | *.tem 18 | *.temp 19 | #.swp 20 | *.*~ 21 | ~*.* -------------------------------------------------------------------------------- /create-uiw-admin/.prettierignore: -------------------------------------------------------------------------------- 1 | **/*.md 2 | **/*.svg 3 | **/*.ejs 4 | **/*.html 5 | 6 | package.json 7 | dist 8 | build 9 | lib 10 | esm 11 | -------------------------------------------------------------------------------- /create-uiw-admin/.prettierrc: -------------------------------------------------------------------------------- 1 | { 2 | "singleQuote": true, 3 | "trailingComma": "all", 4 | "printWidth": 80, 5 | "overrides": [ 6 | { 7 | "files": ".prettierrc", 8 | "options": { "parser": "json" } 9 | } 10 | ] 11 | } 12 | -------------------------------------------------------------------------------- /create-uiw-admin/README.md: -------------------------------------------------------------------------------- 1 |

2 | 3 | 4 | 5 |

6 | 7 | 8 |

9 | 10 | Build & Deploy 11 | 12 | 13 | Coverage Status 14 | 15 | 16 | NPM Downloads 17 | 18 | 19 | Open in unpkg 20 | 21 | 22 | 23 | 24 |

25 | 26 | Creates a [`uiw-admin`](https://github.com/uiwjs/uiw-admin) application using the command line. 27 | 28 | ## Usage 29 | 30 | ```shell 31 | # npm 6.x 32 | $ npm init uiw-admin my-app --example uiw-admin-ts 33 | # npm 7+, extra double-dash is needed: 34 | $ npm init uiw-admin my-app -- --example uiw-admin-ts 35 | 36 | $ yarn create uiw-admin [appName] 37 | # or npm 38 | $ npm create uiw-admin my-app 39 | # or npx 40 | $ npx create-uiw-admin my-app 41 | ``` 42 | 43 | ## Command Help 44 | 45 | Below is a help of commands you might find useful. The example download is from https://uiwjs.github.io/uiw-admin/zip/ 46 | 47 | ```bash 48 | Usage: create-uiw-admin [options] [--help|h] 49 | 50 | Options: 51 | 52 | --version, -v Show version number 53 | --help, -h Displays help information. 54 | --output, -o Output directory. 55 | --example, -e Example from: https://uiwjs.github.io/uiw-admin/zip/, default: "uiw-admin-ts" 56 | --path, -p Specify the download target git address. 57 | default: "https://uiwjs.github.io/uiw-admin/zip/" 58 | 59 | Example: 60 | 61 | yarn create uiw-admin appName 62 | npx create-uiw-admin my-app 63 | npm create uiw-admin my-app 64 | npm create uiw-admin my-app -f 65 | npm create uiw-admin my-app -p https://uiwjs.github.io/uiw-admin/zip/ 66 | 67 | Copyright 2021 68 | ``` 69 | 70 | ## License 71 | 72 | [MIT © Kenny Wong](https://github.com/jaywcjlove) 73 | -------------------------------------------------------------------------------- /create-uiw-admin/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "create-uiw-admin", 3 | "version": "6.1.9", 4 | "description": "Creates a antdp application using the command line.", 5 | "homepage": "https://uiwjs.github.io/uiw-admin", 6 | "author": "Kenny Wong (https://github.com/jaywcjlove)", 7 | "main": "lib/index.js", 8 | "license": "MIT", 9 | "repository": { 10 | "type": "git", 11 | "url": "https://github.com/uiwjs/uiw-admin" 12 | }, 13 | "bin": { 14 | "create-uiw-admin": "lib/cli.js" 15 | }, 16 | "scripts": { 17 | "build": "tsbb build --disable-babel --file-names src/cli.ts", 18 | "watch": "tsbb watch --disable-babel --file-names src/cli.ts", 19 | "prettier": "prettier --write '**/*.{js,jsx,tsx,ts,md,json}'", 20 | "coverage": "tsbb test --coverage --detectOpenHandles", 21 | "test": "tsbb test --detectOpenHandles" 22 | }, 23 | "files": [ 24 | "lib", 25 | "src" 26 | ], 27 | "jest": { 28 | "testMatch": [ 29 | "/test/*.{ts,tsx}" 30 | ] 31 | }, 32 | "keywords": [ 33 | "tsbb", 34 | "create-tsbb", 35 | "react", 36 | "redux", 37 | "rematch", 38 | "uiw", 39 | "redux-saga", 40 | "framework", 41 | "frontend" 42 | ], 43 | "devDependencies": { 44 | "prettier": "^2.7.0", 45 | "pretty-quick": "~3.1.3", 46 | "tsbb": "^4.0.5" 47 | }, 48 | "dependencies": { 49 | "create-kkt": "3.0.0" 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /create-uiw-admin/renovate.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": ["config:base"] 3 | } 4 | -------------------------------------------------------------------------------- /create-uiw-admin/src/cli.ts: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | import { run } from './utils'; 4 | 5 | try { 6 | run(); 7 | } catch (error) { 8 | console.log(`\x1b[31m${error.message}\x1b[0m`); 9 | console.log(error); 10 | process.exit(1); 11 | } 12 | -------------------------------------------------------------------------------- /create-uiw-admin/src/utils.ts: -------------------------------------------------------------------------------- 1 | import minimist from 'minimist'; 2 | import { create } from 'create-kkt'; 3 | 4 | export async function run(): Promise { 5 | const argvs = minimist(process.argv.slice(2), { 6 | alias: { 7 | output: 'o', 8 | version: 'v', 9 | force: 'f', 10 | path: 'p', 11 | example: 'e', 12 | }, 13 | default: { 14 | path: 'https://uiwjs.github.io/uiw-admin/zip/', 15 | output: '.', 16 | force: false, 17 | example: 'uiw-admin-ts', 18 | }, 19 | }); 20 | if (argvs.h || argvs.help) { 21 | console.log(helpCli); 22 | return; 23 | } 24 | const { version } = require('../package.json'); 25 | if (argvs.v || argvs.version) { 26 | console.log(`\n create-uiw-admin v${version}\n`); 27 | return; 28 | } 29 | argvs.appName = argvs._[0]; 30 | argvs.example = argvs.e = String(argvs.example).toLocaleLowerCase(); 31 | await create(argvs, helpExample); 32 | } 33 | 34 | export const helpExample: string = `Example: 35 | 36 | \x1b[35myarn\x1b[0m create uiw-admin \x1b[33mappName\x1b[0m 37 | \x1b[35mnpx\x1b[0m create-uiw-admin \x1b[33mmy-app\x1b[0m 38 | \x1b[35mnpm\x1b[0m create uiw-admin \x1b[33mmy-app\x1b[0m 39 | \x1b[35mnpm\x1b[0m create uiw-admin \x1b[33mmy-app\x1b[0m -f 40 | \x1b[35mnpm\x1b[0m create uiw-admin \x1b[33mmy-app\x1b[0m -p \x1b[34mhttps://uiwjs.github.io/uiw-admin/zip/\x1b[0m 41 | `; 42 | 43 | export const helpCli: string = ` 44 | Usage: create-uiw-admin [options] [--help|h] 45 | 46 | Options: 47 | 48 | --version, -v Show version number 49 | --help, -h Displays help information. 50 | --output, -o Output directory. 51 | --example, -e Example from: \x1b[34mhttps://uiwjs.github.io/uiw-admin/zip/\x1b[0m, default: "uiw-admin-ts" 52 | --path, -p Specify the download target git address. 53 | default: "\x1b[34mhttps://uiwjs.github.io/uiw-admin/zip/\x1b[0m" 54 | 55 | ${helpExample} 56 | 57 | Copyright 2022 58 | 59 | `; 60 | -------------------------------------------------------------------------------- /create-uiw-admin/test/cli.test.ts: -------------------------------------------------------------------------------- 1 | /** @jest-environment node */ 2 | import fs from 'fs-extra'; 3 | import path from 'path'; 4 | import pkg from '../package.json'; 5 | import { helpCli, run, helpExample } from '../src/utils'; 6 | 7 | it('help test case.', async () => { 8 | expect(typeof helpExample).toEqual('string'); 9 | expect(typeof helpCli).toEqual('string'); 10 | }); 11 | 12 | it('help test case.', async () => { 13 | const mockExit = jest.spyOn(console, 'log').mockImplementation(); 14 | process.argv = process.argv.slice(0, 2); 15 | process.argv.push('my-app3'); 16 | process.argv.push('--help'); 17 | await import('../src/cli'); 18 | expect(mockExit).toHaveBeenCalledWith(helpCli); 19 | mockExit.mockRestore(); 20 | mockExit.mockClear(); 21 | mockExit.mockReset(); 22 | }); 23 | 24 | it('version test case.', async () => { 25 | const mockExit = jest.spyOn(console, 'log').mockImplementation(); 26 | process.argv = process.argv.slice(0, 2); 27 | process.argv.push('my-app4'); 28 | process.argv.push('--version'); 29 | await run(); 30 | // @ts-ignore 31 | expect(mockExit).toHaveBeenCalledWith( 32 | `\n create-uiw-admin v${pkg.version}\n`, 33 | ); 34 | mockExit.mockRestore(); 35 | mockExit.mockClear(); 36 | mockExit.mockReset(); 37 | }); 38 | 39 | it('create project. 1', async () => { 40 | console.log = jest.fn(); 41 | process.argv = process.argv.slice(0, 2); 42 | process.argv.push('my-app2'); 43 | process.argv.push('-f'); 44 | process.argv.push('--output'); 45 | process.argv.push('test'); 46 | await run(); 47 | expect(await fs.existsSync(path.resolve(__dirname, 'my-app2'))).toBeTruthy(); 48 | await fs.remove('test/my-app2'); 49 | }, 10000); 50 | -------------------------------------------------------------------------------- /create-uiw-admin/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "module": "commonjs", 4 | "esModuleInterop": true, 5 | "declaration": true, 6 | "target": "es2017", 7 | "noImplicitAny": true, 8 | "resolveJsonModule": true, 9 | "moduleResolution": "node", 10 | "emitDecoratorMetadata": true, 11 | "experimentalDecorators": true, 12 | "sourceMap": true, 13 | "strict": false, 14 | "skipLibCheck": true, 15 | "outDir": "lib", 16 | "baseUrl": "." 17 | }, 18 | "include": ["src/**/*"] 19 | } 20 | -------------------------------------------------------------------------------- /eslint-packages/config/README.md: -------------------------------------------------------------------------------- 1 | # eslint config 2 | 3 | uiw-admin 内置 eslint 规则配置 4 | 5 | 6 | ## 安装 7 | 8 | ```bash 9 | npm i eslint-config-uiw-admin -D # yarn add eslint-config-uiw-admin -D 10 | ``` 11 | 12 | ## 用法 13 | 14 | 1. 第一种:项目的根文件夹中创建一个名为`.eslintrc.json`以下内​​容的文件: 15 | 16 | ```js 17 | module.exports ={ 18 | // ... 19 | "extends": "uiw-admin" 20 | } 21 | ``` 22 | 23 | 24 | 2. 第二种:项目的`package.json`加入以下内容 25 | 26 | ```json 27 | // ... 28 | "eslintConfig": { 29 | "extends": [ 30 | "uiw-admin" 31 | ] 32 | } 33 | // ... 34 | ``` 35 | 36 | > React17以上的版本配合babel可以单独使用 JSX 而无需引入 React 37 | > https://zh-hans.reactjs.org/blog/2020/09/22/introducing-the-new-jsx-transform.html 38 | 39 | ## 移除未使用的 React 引入 40 | 41 | ``` 42 | cd your_project 43 | npx react-codemod update-react-imports 44 | 45 | ``` 46 | 47 | 如果使用ts修改tsconfig.json文件 48 | 49 | ```json 50 | "jsx": "react-jsx", 51 | ``` 52 | 53 | 54 | `eslint-config-uiw-admin` 您可以通过编辑`.eslintrc.json`文件来覆盖设置。在 [ESLint](https://eslint.org/docs/user-guide/configuring) 网站上了解更多关于配置 ESLint的信息。 55 | 56 | ## 默认规则 57 | 58 | - [no-const-assign](https://eslint.org/docs/rules/no-const-assign#no-const-assign): 'error', 59 | - [eqeqeq](https://eslint.org/docs/rules/eqeqeq#eqeqeq): 'error', 60 | - [max-lines](https://eslint.org/docs/rules/max-lines#max-lines): ['error', { max: 500 }], 61 | - [max-depth](https://eslint.org/docs/rules/max-depth#max-depth): ['error', 4], 62 | - [no-empty-function](https://eslint.org/docs/rules/no-empty-function#no-empty-function): 'error', 63 | - [no-empty](https://eslint.org/docs/rules/no-empty#no-empty): 'error', 64 | - [no-var](https://eslint.org/docs/rules/no-var#no-var): 'error', 65 | - [no-use-before-define](https://eslint.org/docs/rules/no-use-before-define#no-use-before-define): 'off', 66 | - [@typescript-eslint/no-use-before-define](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/src/rules/no-use-before-define.ts): ['error'] -------------------------------------------------------------------------------- /eslint-packages/config/index.js: -------------------------------------------------------------------------------- 1 | const fs = require('fs'); 2 | const path = require('path'); 3 | const isTsProject = fs.existsSync(path.join(process.cwd(), './tsconfig.json')); 4 | 5 | const isJsMoreTs = async (path = 'src') => { 6 | const fg = require('fast-glob'); 7 | const jsFiles = await fg(`${path}/src/**/*.{js,jsx}`, { deep: 3 }); 8 | const tsFiles = await fg(`${path}/src/**/*.{ts,tsx}`, { deep: 3 }); 9 | return jsFiles.length > tsFiles.length; 10 | }; 11 | 12 | if (isTsProject) { 13 | try { 14 | isJsMoreTs(process.cwd()).then((jsMoreTs) => { 15 | if (!jsMoreTs) return; 16 | console.log('这是一个 TypeScript 项目,如果不是请删除 tsconfig.json'); 17 | }); 18 | } catch (e) { 19 | console.log(e); 20 | } 21 | } 22 | 23 | module.exports = { 24 | env: { 25 | browser: true, 26 | es2021: true, 27 | node: true, 28 | jest: true, 29 | }, 30 | extends: ['react-app', 'plugin:react/jsx-runtime'], 31 | parser: '@typescript-eslint/parser', 32 | parserOptions: { 33 | ecmaFeatures: { 34 | jsx: true, 35 | }, 36 | ecmaVersion: 12, 37 | sourceType: 'module', 38 | }, 39 | plugins: ['react', '@typescript-eslint'], 40 | rules: { 41 | 'no-const-assign': 'error', 42 | eqeqeq: 'error', 43 | 'max-lines': ['error', { max: 500 }], 44 | 'max-depth': ['error', 4], 45 | 'no-empty-function': 'error', 46 | 'no-empty': 'error', 47 | 'no-var': 'error', 48 | 'no-use-before-define': 'off', 49 | 'react/jsx-uses-react': 'off', 50 | 'react/react-in-jsx-scope': 'off', 51 | 52 | // '@typescript-eslint/no-use-before-define': ['error'], 53 | }, 54 | }; 55 | -------------------------------------------------------------------------------- /eslint-packages/config/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "eslint-config-uiw-admin", 3 | "version": "6.1.9", 4 | "description": "eslint 配置", 5 | "author": "Kenny Wong ", 6 | "homepage": "https://github.com/uiwjs/uiw-admin/tree/master/eslint-packages/config#readme", 7 | "main": "index.js", 8 | "license": "MIT", 9 | "files": [ 10 | "index.js" 11 | ], 12 | "peerDependencies": { 13 | "eslint": ">=7.32.0", 14 | "eslint-plugin-import": "^2.26.0", 15 | "eslint-plugin-react": "^7.30.1" 16 | }, 17 | "devDependencies": { 18 | "eslint-config-standard": "16.0.3", 19 | "eslint-plugin-node": "11.1.0", 20 | "eslint-plugin-promise": "6.0.0" 21 | }, 22 | "publishConfig": { 23 | "access": "public" 24 | }, 25 | "repository": { 26 | "type": "git", 27 | "url": "git+https://github.com/uiwjs/uiw-admin.git" 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /examples/base/.editorconfig: -------------------------------------------------------------------------------- 1 | # http://editorconfig.org 2 | root = true 3 | 4 | [*] 5 | indent_style = space 6 | indent_size = 2 7 | end_of_line = lf 8 | charset = utf-8 9 | trim_trailing_whitespace = true 10 | insert_final_newline = true 11 | 12 | [*.md] 13 | trim_trailing_whitespace = false 14 | 15 | [Makefile] 16 | indent_style = tab 17 | -------------------------------------------------------------------------------- /examples/base/.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | lib 3 | build 4 | npm-debug.log* 5 | package-lock.json 6 | .eslintcache 7 | .DS_Store 8 | .cache 9 | .rdoc-dist 10 | .vscode 11 | 12 | *.bak 13 | *.tem 14 | *.temp 15 | #.swp 16 | *.*~ 17 | ~*.* 18 | .uiw 19 | .idea 20 | .kktp -------------------------------------------------------------------------------- /examples/base/.prettierignore: -------------------------------------------------------------------------------- 1 | **/*.md 2 | **/*.svg 3 | package.json 4 | -------------------------------------------------------------------------------- /examples/base/.prettierrc.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | tabWidth: 2, 3 | bracketSameLine: true, 4 | arrowParens: 'always', 5 | singleQuote: true, 6 | semi: false, // 行位是否使用分号,默认为true 7 | bracketSpacing: true, // 对象大括号直接是否有空格,默认为true,效果:{ foo: bar } 8 | } 9 | -------------------------------------------------------------------------------- /examples/base/.stackblitzrc: -------------------------------------------------------------------------------- 1 | { 2 | "installDependencies": true, 3 | "startCommand": "npm start", 4 | "installOptions": { 5 | "frozen-lockfile": true, 6 | "no-optional": true 7 | }, 8 | "node": "16", 9 | "env": { 10 | "NODE_ENV": "development" 11 | } 12 | } -------------------------------------------------------------------------------- /examples/base/README.md: -------------------------------------------------------------------------------- 1 | uiw-admin Example 2 | === 3 | 4 | ## Open in CodeSandbox 5 | 6 | [![Edit uiw-admin Demo](https://codesandbox.io/static/img/play-codesandbox.svg)](https://codesandbox.io/s/github/uiwjs/uiw-admin/tree/master/examples/base) 7 | 8 | ## Quick Start 9 | 10 | **development** 11 | 12 | Runs the project in development mode. 13 | 14 | ```bash 15 | npm install 16 | npm start 17 | ``` 18 | 19 | ## 目录结构 20 | ``` 21 | . 22 | ├── README.md 23 | ├── config 24 | │   └── routes.json 路由配置 25 | ├── mocker mock 数据 26 | │   ├── auth 27 | │   │   └── index.js 28 | │   ├── demo.js 29 | │   ├── index.js 30 | │   ├── login.js 31 | │   └── selectPage.js 32 | ├── package.json 33 | ├── public 34 | │   ├── favicon.ico 35 | │   └── index.html 36 | ├── sandbox.config.json 37 | ├── src 38 | │   ├── assets 39 | │   │   ├── head.png 40 | │   │   ├── logo-dark.svg 41 | │   │   └── logo-light.svg 42 | │   ├── index.css 43 | │   ├── index.tsx 44 | │   ├── layouts 框架组件 45 | │   │   ├── BasicLayout.tsx 46 | │   │   ├── UserLayout.tsx 47 | │   │   └── logo.svg 48 | │   ├── models remach models 49 | │   │   ├── Doc 50 | │   │   │   └── doc.ts 51 | │   │   ├── demo.ts 52 | │   │   ├── global.ts 53 | │   │   ├── home.ts 54 | │   │   └── login.ts 55 | │   ├── pages 页面, 文件名大写 56 | │   │   ├── Dashboard 57 | │   │   │   └── index.tsx 58 | │   │   ├── Demo 59 | │   │   │   ├── Detail 60 | │   │   │   │   ├── index.tsx 61 | │   │   │   │   └── items.tsx 62 | │   │   │   └── index.tsx 63 | │   │   ├── TableList 64 | │   │   │   └── index.tsx 65 | │   │   └── login 66 | │   │   ├── index.module.less 67 | │   │   └── index.tsx 68 | │   ├── react-app-env.d.ts 69 | │   └── servers 放置api文件的地方,文件名已后端接口模块名命名,不以路由命名 70 | │   └── index.ts 71 | └── tsconfig.json 72 | ``` -------------------------------------------------------------------------------- /examples/base/config/.kktprc.ts: -------------------------------------------------------------------------------- 1 | export default { 2 | initEntery: true, 3 | initRoutes: { 4 | routesOutletElement: '@/routesOutletElement', 5 | }, 6 | initModel: true, 7 | queryClient: true, 8 | define: { 9 | AUTH: false, 10 | STORAGE: 'local', 11 | SEARCH_MENU: true, 12 | BASE_NAME: '/uiw', 13 | TOKEN_NAME: 'aaa', 14 | TOKEN_STORAGE: 'bbb', 15 | }, 16 | publicPath: './', 17 | } 18 | -------------------------------------------------------------------------------- /examples/base/config/routes.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "path": "/login", 4 | "element": "@/layouts/UserLayout" 5 | }, 6 | { 7 | "path": "/", 8 | "element": "@/layouts/BasicLayout", 9 | "children": [ 10 | { 11 | "index": true, 12 | "redirect": "/home" 13 | }, 14 | { 15 | "path": "/home", 16 | "name": "首页", 17 | "element": "@/pages/TableList", 18 | "icon": "home" 19 | }, 20 | { 21 | "path": "/demo", 22 | "name": "列表查询/新增", 23 | "element": "@/pages/Demo", 24 | "icon": "home" 25 | }, 26 | { 27 | "path": "/form", 28 | "name": "高级表单", 29 | "element": "@/pages/Form", 30 | "icon": "document" 31 | }, 32 | { 33 | "path": "/:group/*", 34 | "name": "测试点击页面", 35 | "hideInMenu": true, 36 | "component": "@/pages/TableList", 37 | "icon": "home" 38 | }, 39 | { 40 | "path": "/dom/exceptions", 41 | "name": "异常", 42 | "icon": "warning-o", 43 | "side": false, 44 | "children": [ 45 | { 46 | "index": true, 47 | "redirect": "/dom/exceptions/403" 48 | }, 49 | { 50 | "path": "/dom/exceptions/403", 51 | "name": "403", 52 | "element": "@uiw-admin/exceptions/esm/Exceptions/403" 53 | }, 54 | { 55 | "path": "/dom/exceptions/500", 56 | "name": "500", 57 | "element": "@uiw-admin/exceptions/esm/Exceptions/500" 58 | }, 59 | { 60 | "path": "/dom/exceptions/404", 61 | "name": "404", 62 | "element": "@uiw-admin/exceptions/esm/Exceptions/404" 63 | } 64 | ] 65 | } 66 | ] 67 | } 68 | ] 69 | -------------------------------------------------------------------------------- /examples/base/mocker/auth/index.js: -------------------------------------------------------------------------------- 1 | module.exports.authList = [ 2 | '/tableList', 3 | '/home', 4 | '/demo', 5 | '/dom', 6 | '/dom/*', 7 | '/tableList/:id', 8 | '/exceptions', 9 | '/exceptions/403', 10 | '/exceptions/404', 11 | '/exceptions/500', 12 | ] 13 | -------------------------------------------------------------------------------- /examples/base/mocker/demo.js: -------------------------------------------------------------------------------- 1 | module.exports.insert = function (req, res) { 2 | return res.status(200).json({ 3 | code: 200, 4 | message: '新增成功', 5 | data: {}, 6 | }) 7 | } 8 | 9 | module.exports.update = function (req, res) { 10 | return res.status(200).json({ 11 | code: 200, 12 | message: '编辑成功', 13 | data: {}, 14 | }) 15 | } 16 | 17 | module.exports.selectById = function (req, res) { 18 | return res.status(200).json({ 19 | code: 200, 20 | message: '获取详情成功', 21 | data: { 22 | input: 'Jason', 23 | textarea: '蟠龙路', 24 | select: 4, 25 | switch: true, 26 | radio: 'man', 27 | checkbox: ['sichuan', 'hubei'], 28 | dateInputsecond: '2021-1-21 23:59:59', 29 | dateInput: '2021-1-21', 30 | monthPicker: '2021-1', 31 | timePicker: '2021-1-21 23:59:59', 32 | slider: 90, 33 | upload: [ 34 | { 35 | dataURL: 'https://avatars2.githubusercontent.com/u/1680273?s=40&v=4', 36 | name: 'uiw.png', 37 | }, 38 | ], 39 | searchSelect: [1, 2], 40 | rate: 4, 41 | input2: '123456789', 42 | }, 43 | }) 44 | } 45 | 46 | module.exports.upload = function (req, res) { 47 | return res.status(200).json({ 48 | code: 200, 49 | message: '获取详情成功', 50 | uid: '1234', 51 | }) 52 | } 53 | -------------------------------------------------------------------------------- /examples/base/mocker/index.js: -------------------------------------------------------------------------------- 1 | const { getData, getCity } = require('./selectPage') 2 | const { login, verify, logout, reloadAuth } = require('./login') 3 | const { insert, update, selectById, upload } = require('./demo') 4 | 5 | const proxy = { 6 | 'GET /api/user': { id: 1, username: 'kenny', sex: 6 }, 7 | 'POST /api/user': { id: 1, username: 'kenny', sex: 6 }, 8 | 'POST /api/login': login, 9 | 'POST /api/logout': logout, 10 | 'GET /api/user/verify': verify, 11 | 'GET /api/city': getCity, 12 | 'POST /api/getData': getData, 13 | 'POST /api/reloadAuth': reloadAuth, 14 | 'POST /api/demo/selectById': selectById, 15 | 'POST /api/demo/insert': insert, 16 | 'POST /api/demo/update': update, 17 | 'POST /api/demo/upload': upload, 18 | } 19 | 20 | module.exports = proxy 21 | -------------------------------------------------------------------------------- /examples/base/mocker/login.js: -------------------------------------------------------------------------------- 1 | const { authList } = require('./auth') 2 | 3 | let token = '' 4 | 5 | module.exports.login = function (req, res) { 6 | const { password, username } = req.body 7 | if (password === 'admin' && username === 'admin') { 8 | token = '5c2d6d45-ec94-319c-a9c8-cae43e192b65' 9 | return res.json({ 10 | updated_at: '2018/09/23 15:59:52', 11 | created_at: '2018/09/23 15:59:52', 12 | id: 1, 13 | username: 'admin', 14 | name: 'admin', 15 | admin: true, 16 | bio: '', 17 | location: '', 18 | organization: '', 19 | preferred_language: '', 20 | email: 'admin@admin.com', 21 | public_email: null, 22 | avatar: '', 23 | linkedin: '', 24 | web_url: null, 25 | skype: '', 26 | state: 'active', 27 | token: '5c2d6d45-ec94-319c-a9c8-cae43e192b65', 28 | authList: authList || [], 29 | }) 30 | } 31 | return res.status(401).json({ 32 | code: 401, 33 | error: '用户名或密码错误!', 34 | }) 35 | } 36 | 37 | module.exports.reloadAuth = function (req, res) { 38 | return res.json({ 39 | code: 200, 40 | token: '5c2d6d45-ec94-319c-a9c8-cae43e192b65', 41 | authList: authList || [], 42 | }) 43 | } 44 | 45 | module.exports.verify = function (req, res) { 46 | if (!token) { 47 | return res.status(401).json({ 48 | code: 401, 49 | error: '用户未登录!', 50 | }) 51 | } 52 | return res.json({ 53 | updated_at: '2018/09/23 15:59:52', 54 | created_at: '2018/09/23 15:59:52', 55 | id: 1, 56 | username: 'admin', 57 | name: 'admin', 58 | admin: true, 59 | bio: '', 60 | location: '', 61 | organization: '', 62 | preferred_language: '', 63 | email: 'admin@admin.com', 64 | public_email: null, 65 | avatar: '', 66 | linkedin: '', 67 | web_url: null, 68 | skype: '', 69 | state: 'active', 70 | token: token, 71 | authList: authList || [], 72 | }) 73 | } 74 | 75 | module.exports.logout = function (req, res) { 76 | token = '' 77 | return res.status(200).json({ 78 | message: '退出登录!', 79 | }) 80 | } 81 | 82 | module.exports.refesh = function (req, res) { 83 | return res.status(200).json({ 84 | code: 200, 85 | message: '刷新权限成功', 86 | data: { 87 | authList: authList || [], 88 | }, 89 | }) 90 | } 91 | -------------------------------------------------------------------------------- /examples/base/mocker/selectPage.js: -------------------------------------------------------------------------------- 1 | module.exports.getData = function (req, res) { 2 | const { page, pageSize } = req.body 3 | setTimeout(() => { 4 | return res.status(200).json({ 5 | code: 1, 6 | total: 30, 7 | page: page, 8 | pageSize: pageSize, 9 | data: [ 10 | { 11 | name: '邓紫棋', 12 | age: page, 13 | info: '又名G.E.M.,原名邓诗颖,1991年8月16日生于中国上海,中国香港创作型女歌手。', 14 | }, 15 | { 16 | name: '李易峰', 17 | age: page, 18 | info: '1987年5月4日出生于四川成都,中国内地男演员、流行乐歌手、影视制片人', 19 | }, 20 | { 21 | name: '范冰冰', 22 | age: page, 23 | info: '1981年9月16日出生于山东青岛,中国影视女演员、制片人、流行乐女歌手', 24 | }, 25 | { 26 | name: '杨幂', 27 | age: page, 28 | info: '1986年9月12日出生于北京市,中国内地影视女演员、流行乐歌手、影视制片人。', 29 | }, 30 | { 31 | name: 'Angelababy', 32 | age: page, 33 | info: '1989年2月28日出生于上海市,华语影视女演员、时尚模特。', 34 | }, 35 | { 36 | name: '唐嫣', 37 | age: page, 38 | info: '1983年12月6日出生于上海市,毕业于中央戏剧学院表演系本科班', 39 | }, 40 | { 41 | name: '吴亦凡', 42 | age: page, 43 | info: '1990年11月06日出生于广东省广州市,华语影视男演员、流行乐歌手。', 44 | }, 45 | ], 46 | }) 47 | }, 1000) 48 | } 49 | 50 | module.exports.getCity = function (req, res) { 51 | const search = req.query.val 52 | ? [{ label: req.query.val, val: req.query.val }] 53 | : [] 54 | setTimeout(() => { 55 | return res.status(200).json({ 56 | code: 1, 57 | data: [ 58 | { 59 | label: '南通', 60 | value: '南通', 61 | }, 62 | { 63 | label: '通州', 64 | value: '通州', 65 | }, 66 | ].concat(search), 67 | }) 68 | }, 1000) 69 | } 70 | -------------------------------------------------------------------------------- /examples/base/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@examples/base", 3 | "version": "6.1.9", 4 | "description": "Use Rematch & TypeScript for the project.", 5 | "private": true, 6 | "scripts": { 7 | "start": "kktp start", 8 | "build": "kktp build", 9 | "doc": "kktp doc --entry=./build --local", 10 | "test": "kktp test --env=jsdom", 11 | "coverage": "kktp test --env=jsdom --coverage" 12 | }, 13 | "repository": { 14 | "type": "git", 15 | "url": "https://github.com/uiwjs/uiw-admin.git" 16 | }, 17 | "keywords": [], 18 | "author": "", 19 | "license": "MIT", 20 | "peerDependencies": { 21 | "@babel/runtime": ">=7.21.0", 22 | "@swc-node/core": ">=1.10.1", 23 | "@swc-node/register": ">=1.6.1", 24 | "@swc/core": ">=1.3.55" 25 | }, 26 | "dependencies": { 27 | "@kkt/pro": "^1.0.14", 28 | "@uiw-admin/authorized": "6.1.9", 29 | "@uiw-admin/basic-layouts": "6.1.9", 30 | "@uiw-admin/components": "6.1.9", 31 | "@uiw-admin/config": "6.1.9", 32 | "@uiw-admin/document-title": "6.1.9", 33 | "@uiw-admin/exceptions": "6.1.9", 34 | "@uiw-admin/layout-tabs": "6.1.9", 35 | "@uiw-admin/user-login": "6.1.9", 36 | "@uiw-admin/utils": "6.1.9", 37 | "@uiw/reset.css": "~1.0.5", 38 | "axios": "^0.27.0", 39 | "classnames": "~2.3.1", 40 | "styled-components": "^5.3.5", 41 | "uiw": "^4.21.26" 42 | }, 43 | "devDependencies": { 44 | "lint-staged": "~12.5.0", 45 | "pirates": "~4.0.5", 46 | "prettier": "^2.7.0", 47 | "yorkie": "~2.0.0" 48 | }, 49 | "lint-staged": { 50 | "*.{js,jsx,ts,tsx}": [ 51 | "eslint --fix" 52 | ], 53 | "*.{js,jsx,ts,tsx,less,md,json}": [ 54 | "prettier --write" 55 | ] 56 | }, 57 | "gitHooks": { 58 | "pre-commit": "lint-staged" 59 | }, 60 | "eslintConfig": { 61 | "extends": [ 62 | "react-app", 63 | "react-app/jest", 64 | "uiw-admin" 65 | ] 66 | }, 67 | "browserslist": { 68 | "production": [ 69 | ">0.2%", 70 | "not dead", 71 | "not op_mini all" 72 | ], 73 | "development": [ 74 | "last 1 chrome version", 75 | "last 1 firefox version", 76 | "last 1 safari version" 77 | ] 78 | } 79 | } 80 | -------------------------------------------------------------------------------- /examples/base/public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uiwjs/uiw-admin/f4abb975dd6a203b5755df1b5e025596204d9186/examples/base/public/favicon.ico -------------------------------------------------------------------------------- /examples/base/public/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | uiw admin 9 | 10 | 11 | 12 |
13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /examples/base/sandbox.config.json: -------------------------------------------------------------------------------- 1 | { 2 | "template": "node", 3 | "container": { 4 | "node": "16" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /examples/base/src/assets/head.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uiwjs/uiw-admin/f4abb975dd6a203b5755df1b5e025596204d9186/examples/base/src/assets/head.png -------------------------------------------------------------------------------- /examples/base/src/assets/index.js: -------------------------------------------------------------------------------- 1 | import React from 'react' 2 | export const chat = ( 3 | 4 | 8 | 9 | ) 10 | -------------------------------------------------------------------------------- /examples/base/src/assets/logo-dark.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /examples/base/src/assets/logo-light.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /examples/base/src/layouts/BasicLayout.tsx: -------------------------------------------------------------------------------- 1 | import { Badge, Icon } from 'uiw' 2 | import AuthPage from '@uiw-admin/authorized' 3 | import { KktproPageProps, useReactMutation } from '@kkt/pro' 4 | import BasicLayout, { 5 | useLayouts, 6 | BasicLayoutProps, 7 | } from '@uiw-admin/basic-layouts' 8 | import LayoutsTabs from '@uiw-admin/layout-tabs' 9 | 10 | function BasicLayoutScreen(props: KktproPageProps) { 11 | const { navigate, routes = [] } = props 12 | 13 | const layouts = useLayouts() 14 | 15 | const { mutate } = useReactMutation({ 16 | url: '/api/reloadAuth', 17 | method: 'POST', 18 | onSuccess: (data: any) => { 19 | if (data && data.code === 200) { 20 | sessionStorage.setItem('token', data.token) 21 | sessionStorage.setItem('auth', JSON.stringify(data.authList || [])) 22 | localStorage.setItem('token', data.token) 23 | localStorage.setItem('auth', JSON.stringify(data.authList || [])) 24 | // window.location.reload() 25 | layouts.closeMenu() 26 | } 27 | }, 28 | }) 29 | 30 | const basicLayoutProps: BasicLayoutProps = { 31 | onReloadAuth: () => mutate(), 32 | // 修改密码以及其他操作在项目中进行 33 | menus: [ 34 | { 35 | title: '欢迎来到uiw', 36 | icon: , 37 | onClick: () => layouts.closeMenu(), 38 | }, 39 | { 40 | title: '修改密码', 41 | icon: , 42 | onClick: () => layouts.closeMenu(), 43 | }, 44 | ], 45 | profile: { 46 | avatar: require('../assets/head.png'), 47 | menuLeft: ( 48 |
49 | 50 | 55 | 56 |
57 | ), 58 | }, 59 | layouts, 60 | routes: routes, 61 | headerLayout: 'top', 62 | headerBackground: '#343a40', 63 | headerFontColor: '#fff', 64 | } 65 | 66 | return ( 67 | 68 | { 72 | navigate('/') 73 | }}> 74 | 75 | {/* */} 76 | 77 | 78 | ) 79 | } 80 | export default BasicLayoutScreen 81 | -------------------------------------------------------------------------------- /examples/base/src/layouts/UserLayout.tsx: -------------------------------------------------------------------------------- 1 | import UserLogin from '@uiw-admin/user-login' 2 | import { setCookie } from '@uiw-admin/utils' 3 | import { Notify } from 'uiw' 4 | import { KktproPageProps } from '@kkt/pro' 5 | 6 | const UserLayout = (props: KktproPageProps) => { 7 | const { navigate } = props 8 | 9 | return ( 10 | ({ a: 12, b: 1221, ...store })} 28 | onSuccess={(data) => { 29 | if (data && data.token) { 30 | setCookie('token', data.token) 31 | sessionStorage.setItem('token', data.token) 32 | sessionStorage.setItem('auth', JSON.stringify(data.authList || [])) 33 | localStorage.setItem('token', data.token) 34 | localStorage.setItem('auth', JSON.stringify(data.authList || [])) 35 | navigate?.('/home', { replace: true }) 36 | } else { 37 | Notify.error({ 38 | title: '错误通知', 39 | description: data.error || '请求失败', 40 | }) 41 | } 42 | }} 43 | /> 44 | ) 45 | } 46 | export default UserLayout 47 | -------------------------------------------------------------------------------- /examples/base/src/layouts/logo.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /examples/base/src/models/Doc/doc.ts: -------------------------------------------------------------------------------- 1 | import { Dispatch } from '@kkt/pro' 2 | 3 | export interface GlobalState { 4 | test: string 5 | [s: string]: any 6 | } 7 | 8 | const doc = { 9 | name: 'doc', 10 | state: { 11 | test: 'doc model', 12 | }, 13 | reducers: { 14 | updateState: (state: GlobalState, payload: GlobalState) => ({ 15 | ...state, 16 | ...payload, 17 | }), 18 | }, 19 | effects: (dispatch: Dispatch) => ({ 20 | async verify() { 21 | const dph = dispatch 22 | dph.doc.updateState({ test: '测试2' }) 23 | }, 24 | }), 25 | } 26 | 27 | export default doc 28 | -------------------------------------------------------------------------------- /examples/base/src/models/demo.ts: -------------------------------------------------------------------------------- 1 | import { selectById } from '../servers/demo' 2 | 3 | const demo = { 4 | name: 'demo', 5 | state: { 6 | drawerVisible: false, 7 | tableType: '', 8 | queryInfo: {}, 9 | isView: false, 10 | a: 1, 11 | }, 12 | reducers: { 13 | updateState: (state: any, payload: any) => ({ 14 | ...state, 15 | ...payload, 16 | }), 17 | }, 18 | effects: (dispatch: any) => ({ 19 | async selectById(payload: any) { 20 | const dph = dispatch 21 | const data = await selectById(payload) 22 | if (data.code === 200) { 23 | dph.demo.updateState({ 24 | drawerVisible: true, 25 | queryInfo: data.data || {}, 26 | }) 27 | } 28 | }, 29 | clean() { 30 | const dph = dispatch 31 | dph.demo.updateState({ 32 | drawerVisible: false, 33 | tableType: '', 34 | queryInfo: {}, 35 | isView: false, 36 | }) 37 | }, 38 | }), 39 | } 40 | export default demo 41 | -------------------------------------------------------------------------------- /examples/base/src/models/global.ts: -------------------------------------------------------------------------------- 1 | import { Dispatch } from '@kkt/pro' 2 | export interface GlobalState { 3 | test: string 4 | [s: string]: any 5 | } 6 | 7 | const global = { 8 | name: 'global', 9 | state: { 10 | test: '测试全局State', 11 | }, 12 | reducers: { 13 | updateState: (state: GlobalState, payload: GlobalState) => ({ 14 | ...state, 15 | ...payload, 16 | }), 17 | }, 18 | effects: (dispatch: Dispatch) => ({ 19 | async verify() { 20 | const dph = dispatch 21 | dph.global.updateState({ test: '测试2' }) 22 | }, 23 | }), 24 | } 25 | 26 | export default global 27 | -------------------------------------------------------------------------------- /examples/base/src/models/home.ts: -------------------------------------------------------------------------------- 1 | import { Dispatch } from '@kkt/pro' 2 | 3 | export interface GlobalState { 4 | test: string 5 | [s: string]: any 6 | } 7 | 8 | const home = { 9 | name: 'home', 10 | state: { 11 | test: 'home', 12 | }, 13 | reducers: { 14 | updateState: (state: GlobalState, payload: GlobalState) => ({ 15 | ...state, 16 | ...payload, 17 | }), 18 | }, 19 | effects: (dispatch: any) => ({ 20 | async verify() { 21 | const dph = dispatch as Dispatch 22 | dph.global.updateState({ test: 'homg2323' }) 23 | }, 24 | }), 25 | } 26 | 27 | export default home 28 | -------------------------------------------------------------------------------- /examples/base/src/models/login.ts: -------------------------------------------------------------------------------- 1 | // import { Dispatch } from '@kkt/pro'; 2 | 3 | export interface LoginState { 4 | token?: string | null 5 | userData?: { 6 | username: string 7 | } | null 8 | } 9 | 10 | const login = { 11 | name: 'login', 12 | state: { 13 | userData: null, 14 | token: null, 15 | }, 16 | reducers: { 17 | updateState: (state: any, payload: LoginState) => ({ 18 | ...state, 19 | ...payload, 20 | }), 21 | }, 22 | effects: (dispatch: any) => ({ 23 | async submit() { 24 | // console.log(555, dispatch.login, data) 25 | // dispatch.login.updateState({ token: '测试2' }) 26 | // sessionStorage.setItem('auth', JSON.stringify(['/home', '/dac'])) 27 | // history.push('/home') 28 | // this.updateState() 29 | // await login({ username: 'test', password: 'www' }); 30 | // dispatch.sharks.increment(payload) 31 | // `dispatch.s` will suggest `sharks` 32 | }, 33 | }), 34 | } 35 | 36 | export default login 37 | -------------------------------------------------------------------------------- /examples/base/src/pages/Dashboard/index.tsx: -------------------------------------------------------------------------------- 1 | import { KktproPageProps } from '@kkt/pro' 2 | import { Form } from '@uiw-admin/components' 3 | import { Input } from 'uiw' 4 | 5 | const Dashboard = (props: KktproPageProps) => { 6 | return ( 7 |
8 |
, 13 | rules: [ 14 | { 15 | required: true, 16 | message: '必填', 17 | }, 18 | () => { 19 | return '222' 20 | }, 21 | ], 22 | }, 23 | }} 24 | /> 25 | Dashboard 26 | 27 | 28 | 29 | 30 | 31 |
32 | ) 33 | } 34 | export default Dashboard 35 | -------------------------------------------------------------------------------- /examples/base/src/pages/Dashboard/models/index.ts: -------------------------------------------------------------------------------- 1 | import { Dispatch, RootModel } from '@kkt/pro' 2 | import { createModel } from '@rematch/core' 3 | 4 | export interface GlobalState { 5 | test: string 6 | [s: string]: any 7 | } 8 | 9 | const doc = createModel()({ 10 | name: 'docDs', 11 | state: { 12 | test: 'doc model', 13 | }, 14 | reducers: { 15 | updateState: (state: GlobalState, payload: GlobalState) => ({ 16 | ...state, 17 | ...payload, 18 | }), 19 | }, 20 | effects: (dispatch) => ({ 21 | async verify() { 22 | const dph = dispatch as Dispatch 23 | dph.doc.updateState({ test: '测试2' }) 24 | }, 25 | }), 26 | }) 27 | 28 | export default doc 29 | -------------------------------------------------------------------------------- /examples/base/src/pages/Demo/models/index.ts: -------------------------------------------------------------------------------- 1 | import { Dispatch } from '@kkt/pro' 2 | 3 | export interface GlobalState { 4 | test: string 5 | [s: string]: any 6 | } 7 | 8 | const doc = { 9 | name: 'docD', 10 | state: { 11 | test: 'doc model', 12 | }, 13 | reducers: { 14 | updateState: (state: GlobalState, payload: GlobalState) => ({ 15 | ...state, 16 | ...payload, 17 | }), 18 | }, 19 | effects: (dispatch: any) => ({ 20 | async verify() { 21 | const dph = dispatch as Dispatch 22 | dph.doc.updateState({ test: '测试2' }) 23 | }, 24 | }), 25 | } 26 | 27 | export default doc 28 | -------------------------------------------------------------------------------- /examples/base/src/pages/Form/index.less: -------------------------------------------------------------------------------- 1 | .fiexd-btns { 2 | position: sticky; 3 | bottom: 0; 4 | background: #fff; 5 | z-index: 9; 6 | padding: 10px; 7 | margin-top: 14px; 8 | display: flex; 9 | justify-content: center; 10 | align-items: center; 11 | .btn { 12 | width: 120px; 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /examples/base/src/pages/Form/models/index.ts: -------------------------------------------------------------------------------- 1 | import { Dispatch } from '@kkt/pro' 2 | 3 | export interface GlobalState { 4 | test: string 5 | [s: string]: any 6 | } 7 | 8 | const doc = { 9 | name: 'form', 10 | state: { 11 | test: 'doc model', 12 | }, 13 | reducers: { 14 | updateState: (state: GlobalState, payload: GlobalState) => ({ 15 | ...state, 16 | ...payload, 17 | }), 18 | }, 19 | effects: (dispatch: any) => ({ 20 | async verify() { 21 | const dph = dispatch as Dispatch 22 | dph.doc.updateState({ test: '测试2' }) 23 | }, 24 | }), 25 | } 26 | 27 | export default doc 28 | -------------------------------------------------------------------------------- /examples/base/src/pages/ceshi.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react' 2 | 3 | const App = () => { 4 | return
234
5 | } 6 | 7 | export default App 8 | -------------------------------------------------------------------------------- /examples/base/src/react-app-env.d.ts: -------------------------------------------------------------------------------- 1 | /// 2 | 3 | declare module '*.module.less' { 4 | const classes: { readonly [key: string]: string } 5 | export default classes 6 | } 7 | -------------------------------------------------------------------------------- /examples/base/src/routesOutletElement/index.css: -------------------------------------------------------------------------------- 1 | #root, body, html { 2 | height: 100%; 3 | } -------------------------------------------------------------------------------- /examples/base/src/routesOutletElement/index.tsx: -------------------------------------------------------------------------------- 1 | import { cloneElement } from 'react' 2 | import { KktproRoutesProps } from '@kkt/pro' 3 | import '@uiw/reset.css' 4 | import './index.css' 5 | 6 | interface RoutesOutletElementProps { 7 | children: React.ReactNode 8 | routes: KktproRoutesProps[] 9 | } 10 | const RoutesOutletElement = (props: RoutesOutletElementProps) => { 11 | const { routes } = props 12 | 13 | return cloneElement(props.children as JSX.Element, { 14 | router: routes, 15 | }) 16 | } 17 | export default RoutesOutletElement 18 | -------------------------------------------------------------------------------- /examples/base/src/servers/demo.ts: -------------------------------------------------------------------------------- 1 | import { request } from '@uiw-admin/utils' 2 | 3 | function selectById(params: { id: string }) { 4 | return request('/api/demo/selectById', { 5 | method: 'POST', 6 | body: { ...params }, 7 | }) 8 | } 9 | 10 | export { selectById } 11 | -------------------------------------------------------------------------------- /examples/base/src/servers/index.ts: -------------------------------------------------------------------------------- 1 | import useSWR from 'swr' 2 | 3 | // 公共接口数据 重复数据hooks 都建在此文件夹 4 | // 利用swr复用接口数据,各个页面都可用 5 | // https://swr.vercel.app/zh-CN/docs/getting-started#%E5%8F%AF%E5%A4%8D%E7%94%A8%E7%BB%84%E4%BB%B6 6 | 7 | // 模糊获取城市接口 8 | function useCity(val: string) { 9 | const { data, error } = useSWR(`/api/city/?val=${val}`) 10 | return { 11 | city: data?.data, 12 | isLoading: !error && !data, 13 | isError: error, 14 | } 15 | } 16 | 17 | export { useCity } 18 | -------------------------------------------------------------------------------- /examples/base/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "esnext", 4 | "lib": ["esnext", "dom"], 5 | "allowJs": true, 6 | "skipLibCheck": true, 7 | "esModuleInterop": true, 8 | "allowSyntheticDefaultImports": true, 9 | "strict": true, 10 | "forceConsistentCasingInFileNames": true, 11 | "module": "esnext", 12 | "moduleResolution": "node", 13 | "resolveJsonModule": true, 14 | "isolatedModules": true, 15 | "declaration": true, 16 | "baseUrl": ".", 17 | "jsx": "react-jsx", 18 | "noFallthroughCasesInSwitch": true, 19 | "noEmit": true, 20 | "paths": { 21 | "@/*": ["./src/*"], 22 | "@@/*": ["./src/.kktp/*"] 23 | } 24 | }, 25 | "include": ["src/**/*", "config/.kktprc.ts"] 26 | } 27 | -------------------------------------------------------------------------------- /examples/website/README.md: -------------------------------------------------------------------------------- 1 | website: https://uiwjs.github.io/uiw-admin -------------------------------------------------------------------------------- /examples/website/config/.kktprc.ts: -------------------------------------------------------------------------------- 1 | import pkg from '../package.json'; 2 | import { mdCodeModulesLoader } from 'markdown-react-code-preview-loader'; 3 | import type { WebpackConfiguration, LoaderConfOptions } from 'kkt'; 4 | 5 | export default { 6 | initEntery: true, 7 | initRoutes: true, 8 | initModel: true, 9 | define: { 10 | VERSION: pkg.version, 11 | AUTH: false, 12 | STORAGE: 'local', 13 | SEARCH_MENU: true, 14 | }, 15 | publicPath: './', 16 | overrideWebpack: ( 17 | conf: WebpackConfiguration, 18 | env: 'development' | 'production', 19 | options: LoaderConfOptions | undefined, 20 | ) => { 21 | conf.module!.exprContextCritical = false; 22 | conf.module!.exprContextRecursive = false; 23 | conf = mdCodeModulesLoader(conf); 24 | return conf; 25 | }, 26 | }; 27 | -------------------------------------------------------------------------------- /examples/website/config/routes.js: -------------------------------------------------------------------------------- 1 | import { Navigate } from 'react-router-dom'; 2 | 3 | const routeList = [ 4 | { 5 | path: '/example', 6 | element: '@/pages/example', 7 | }, 8 | { 9 | path: '/', 10 | element: '@/components/Layouts/index', 11 | children: [ 12 | { 13 | index: true, 14 | redirect: '/home', 15 | }, 16 | { path: '/home', element: '@/pages/home' }, 17 | { 18 | path: '/docs', 19 | children: [ 20 | { 21 | index: true, 22 | redirect: '/docs/quick-start', 23 | }, 24 | { path: '/docs/quick-start/*', element: '@/pages/quick-start' }, 25 | { path: '/docs/newPages/*', element: '@/pages/newPages' }, 26 | { path: '/docs/mocker/*', element: '@/pages/mocker' }, 27 | { path: '/docs/request/*', element: '@/pages/request' }, 28 | { path: '/docs/models/*', element: '@/pages/models' }, 29 | { path: '/docs/auth/*', element: '@/pages/auth' }, 30 | { path: '/docs/proxy/*', element: '@/pages/proxy' }, 31 | { path: '/docs/eslint-config/*', element: '@/pages/eslint-config' }, 32 | ], 33 | }, 34 | { 35 | path: '/components', 36 | children: [ 37 | { 38 | index: true, 39 | redirect: '/components/authorized', 40 | }, 41 | { path: '/components/authorized/*', element: '@/pages/authorized' }, 42 | { 43 | path: '/components/basic-layouts/*', 44 | element: '@/pages/basic-layouts', 45 | }, 46 | { path: '/components/config/*', element: '@/pages/config' }, 47 | { 48 | path: '/components/document-title/*', 49 | element: '@/pages/document-title', 50 | }, 51 | { path: '/components/exceptions/*', element: '@/pages/exceptions' }, 52 | { 53 | name: '选项卡', 54 | path: '/components/layout-tabs/*', 55 | element: '@/pages/layout-tabs', 56 | }, 57 | { path: '/components/plugins/*', element: '@/pages/plugins' }, 58 | { 59 | name: '登录页', 60 | path: '/components/user-login/*', 61 | element: '@/pages/user-login', 62 | }, 63 | { path: '/components/utils/*', element: '@/pages/utils' }, 64 | { path: '/components/components/*', element: '@/pages/components' }, 65 | { 66 | path: '/components/protable/*', 67 | element: '@/pages/components/Protable', 68 | }, 69 | { 70 | path: '/components/prodrawer/*', 71 | element: '@/pages/components/ProDrawer', 72 | }, 73 | { 74 | path: '/components/proform/*', 75 | element: '@/pages/components/ProForm', 76 | }, 77 | { 78 | path: '/components/skeleton/*', 79 | element: '@/pages/components/Skeleton', 80 | }, 81 | ], 82 | }, 83 | { path: '*', element: '@uiw-admin/exceptions/esm/Exceptions/404' }, 84 | ], 85 | }, 86 | { path: '*', element: '@uiw-admin/exceptions/esm/Exceptions/404' }, 87 | ]; 88 | 89 | export default routeList; 90 | -------------------------------------------------------------------------------- /examples/website/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "website", 3 | "version": "6.1.9", 4 | "private": true, 5 | "description": "new webiste with kktp.", 6 | "scripts": { 7 | "build": "kktp build", 8 | "start": "CI=false kktp start", 9 | "prettier": "prettier --write '**/*.{js,jsx,tsx,ts,less,md,json}'", 10 | "map": "source-map-explorer build/static/js/*.js --html build/website-result.html" 11 | }, 12 | "license": "MIT", 13 | "peerDependencies": { 14 | "@babel/runtime": ">=7.12.0", 15 | "react": ">=16.14.0", 16 | "react-dom": ">=16.14.0" 17 | }, 18 | "dependencies": { 19 | "@babel/plugin-proposal-private-property-in-object": "7.21.0", 20 | "@react-login-page/base": "^0.4.4", 21 | "@react-login-page/page1": "^0.4.4", 22 | "@react-login-page/page2": "^0.4.4", 23 | "@react-login-page/page3": "^0.4.4", 24 | "@react-login-page/page4": "^0.4.4", 25 | "@react-login-page/page5": "^0.4.4", 26 | "@react-login-page/page6": "^0.4.4", 27 | "@react-login-page/page7": "^0.4.4", 28 | "@types/styled-components": "^5.1.26", 29 | "@uiw-admin/authorized": "6.1.9", 30 | "@uiw-admin/basic-layouts": "6.1.9", 31 | "@uiw-admin/components": "6.1.9", 32 | "@uiw-admin/config": "6.1.9", 33 | "@uiw-admin/document-title": "6.1.9", 34 | "@uiw-admin/exceptions": "6.1.9", 35 | "@uiw-admin/layout-tabs": "6.1.9", 36 | "@uiw-admin/plugins": "6.1.9", 37 | "@uiw-admin/user-login": "6.1.9", 38 | "@uiw/react-back-to-top": "^1.2.1", 39 | "@uiw/react-code-preview": "4.0.5", 40 | "@uiw/react-domain-verify": "1.1.2", 41 | "@uiw/react-github-corners": "1.5.3", 42 | "@uiw/react-loader": "4.9.7", 43 | "@uiw/react-markdown-preview": "4.1.10", 44 | "@uiw/reset.css": "1.0.5", 45 | "@wcj/dark-mode": "^1.0.15", 46 | "markdown-react-code-preview-loader": "2.1.5", 47 | "react-code-preview-layout": "3.0.0", 48 | "react-login-page": "^0.4.4", 49 | "react-test-renderer": "17.0.2", 50 | "styled-components": "^5.3.5", 51 | "uiw": "^4.21.26" 52 | }, 53 | "devDependencies": { 54 | "@kkt/pro": "^1.0.13", 55 | "@types/react-test-renderer": "17.0.1", 56 | "hast": "^1.0.0", 57 | "rehype-rewrite": "^3.0.6", 58 | "source-map-explorer": "~2.5.2" 59 | }, 60 | "browserslist": { 61 | "production": [ 62 | ">0.2%", 63 | "not dead", 64 | "not op_mini all" 65 | ], 66 | "development": [ 67 | "last 1 chrome version", 68 | "last 1 firefox version", 69 | "last 1 safari version" 70 | ] 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /examples/website/public/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | uiw admin 9 | 10 | 11 | 12 | 13 | 14 |
15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /examples/website/public/logo.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /examples/website/src/components/Layouts/Menu/index.tsx: -------------------------------------------------------------------------------- 1 | import { useEffect, useState } from 'react'; 2 | import { useLocation } from '@kkt/pro'; 3 | import { 4 | MenusConfigObject, 5 | menusDocsConfig, 6 | menusComponentsConfig, 7 | } from '@/menus'; 8 | import { Divider, MenuLabel, MenuA, Wrapper, MenuWrapper } from './style'; 9 | 10 | export interface MenuData { 11 | divider?: boolean; 12 | path?: string; 13 | size?: string | 'small'; 14 | name: string; 15 | } 16 | 17 | const getRouters = (data: MenusConfigObject[] = [], path: string = '') => { 18 | const result: React.ReactNode[] = []; 19 | data.forEach((item, idx) => { 20 | if (item.path) { 21 | if (item.target || /^https?:\/\//.test(path)) { 22 | result.push( 23 | 28 | {item.title} 29 | , 30 | ); 31 | } else { 32 | result.push( 33 | 38 | {item.title} 39 | , 40 | ); 41 | } 42 | } else { 43 | result.push( 44 | {item.title}, 45 | ); 46 | } 47 | }); 48 | return result; 49 | }; 50 | 51 | const Menu = () => { 52 | const { pathname } = useLocation(); 53 | const [result, setResult] = useState(); 54 | useEffect(() => { 55 | if (/docs/.test(pathname)) { 56 | setResult(getRouters(menusDocsConfig, pathname)); 57 | } 58 | if (/components/.test(pathname)) { 59 | setResult(getRouters(menusComponentsConfig, pathname)); 60 | } 61 | }, [pathname]); 62 | 63 | return ( 64 | 65 | {result} 66 | 67 | ); 68 | }; 69 | 70 | export default Menu; 71 | -------------------------------------------------------------------------------- /examples/website/src/components/Layouts/Menu/style.ts: -------------------------------------------------------------------------------- 1 | import styled from 'styled-components'; 2 | import { NavLink } from '@kkt/pro'; 3 | 4 | export const Wrapper = styled.div` 5 | position: fixed; 6 | top: 0; 7 | z-index: 2; 8 | width: 240px; 9 | height: 100%; 10 | padding-top: 58px; 11 | `; 12 | 13 | export const MenuWrapper = styled.div` 14 | overflow: auto; 15 | display: flex; 16 | padding: 10px 6px; 17 | flex-direction: column; 18 | gap: 6px; 19 | height: 100%; 20 | box-sizing: border-box; 21 | `; 22 | 23 | export const MenuLabel = styled(NavLink)` 24 | display: flex; 25 | text-decoration: none; 26 | justify-content: flex-start; 27 | align-items: stretch; 28 | padding: 5px 12px; 29 | border-radius: 4px; 30 | color: currentColor; 31 | margin-left: 0; 32 | &:hover, 33 | &[aria-current='page'], 34 | &.active { 35 | background-color: var(--color-neutral-muted); 36 | } 37 | &.active { 38 | background-color: var(--color-neutral-muted); 39 | gap: 5px; 40 | } 41 | `; 42 | 43 | export const MenuA = styled.a` 44 | display: flex; 45 | text-decoration: none; 46 | justify-content: flex-start; 47 | align-items: stretch; 48 | padding: 5px 12px; 49 | border-radius: 4px; 50 | color: currentColor; 51 | margin-left: 0; 52 | &:hover, 53 | &[aria-current='page'], 54 | &.active { 55 | background-color: var(--color-neutral-muted); 56 | } 57 | &.active { 58 | background-color: var(--color-neutral-muted); 59 | gap: 5px; 60 | } 61 | `; 62 | 63 | export const Divider = styled.div` 64 | font-size: 20px; 65 | font-weight: bold; 66 | padding: 15px 5px 5px 5px; 67 | color: var(--color-fg-default); 68 | `; 69 | -------------------------------------------------------------------------------- /examples/website/src/components/Layouts/Navbar/index.tsx: -------------------------------------------------------------------------------- 1 | import { FC, PropsWithRef } from 'react'; 2 | import { Link } from '@kkt/pro'; 3 | import Icon from '@uiw/react-icon'; 4 | import { 5 | Wrapper, 6 | Left, 7 | Right, 8 | Logo, 9 | HeaderTools, 10 | Title, 11 | Version, 12 | LinkMenu, 13 | AMenu, 14 | } from './style'; 15 | 16 | interface NavbarProps 17 | extends React.DetailedHTMLProps< 18 | React.HTMLAttributes, 19 | HTMLElement 20 | > {} 21 | 22 | const Navbar: FC> = (props) => { 23 | return ( 24 | 25 | 26 | 27 | 28 | 29 | UIW ADMIN<Version>{VERSION}</Version> 30 | 31 | 32 | 33 | 34 | 首页 35 | 39 | 实例预览 40 | 41 | 教程 42 | 组件 43 | 44 | 45 | 46 | 51 | 52 | 53 | 54 | 55 | ); 56 | }; 57 | 58 | export default Navbar; 59 | -------------------------------------------------------------------------------- /examples/website/src/components/Layouts/Navbar/style.ts: -------------------------------------------------------------------------------- 1 | import styled from 'styled-components'; 2 | import { NavLink } from '@kkt/pro'; 3 | 4 | export const Wrapper = styled.div` 5 | border-bottom: 1px solid var(--color-border-muted); 6 | height: 58px; 7 | display: flex; 8 | align-items: center; 9 | justify-content: space-between; 10 | position: fixed; 11 | padding: 0 12px; 12 | gap: 12px; 13 | top: 0; 14 | width: 100%; 15 | z-index: 9; 16 | background-color: var(--color-canvas-default); 17 | /* background-color: hsla(var(--color-header-bg) / 75%); 18 | backdrop-filter: saturate(180%) blur(0.4rem); */ 19 | `; 20 | 21 | export const Left = styled.div` 22 | display: flex; 23 | align-items: center; 24 | height: 58px; 25 | `; 26 | 27 | export const Right = styled.div` 28 | display: flex; 29 | align-items: center; 30 | height: 58px; 31 | `; 32 | 33 | export const Logo = styled(NavLink)` 34 | color: currentColor; 35 | padding: 0 0 0 10px; 36 | display: flex; 37 | align-items: center; 38 | gap: 10px; 39 | text-decoration: none; 40 | `; 41 | 42 | export const Title = styled.div` 43 | font-weight: bold; 44 | font-size: 18px; 45 | `; 46 | 47 | export const Version = styled.span` 48 | font-size: 12px; 49 | margin-left: 10px; 50 | font-weight: normal; 51 | position: relative; 52 | top: -5px; 53 | `; 54 | 55 | export const HeaderTools = styled.div` 56 | margin-right: 10px; 57 | font-size: 20px; 58 | margin-left: 20px; 59 | `; 60 | 61 | export const LinkMenu = styled(NavLink)` 62 | text-decoration: none; 63 | font-size: 16px; 64 | color: var(--color-fg-default); 65 | padding: 2px 15px; 66 | border-radius: 3px; 67 | &:first-child { 68 | margin-left: 0; 69 | } 70 | &.active { 71 | color: var(--font-color); 72 | background: var(--color1); 73 | } 74 | `; 75 | export const AMenu = styled.a` 76 | text-decoration: none; 77 | font-size: 16px; 78 | color: var(--color-fg-default); 79 | padding: 2px 15px; 80 | border-radius: 3px; 81 | &:first-child { 82 | margin-left: 0; 83 | } 84 | &.active { 85 | color: var(--font-color); 86 | background: var(--color1); 87 | } 88 | `; 89 | -------------------------------------------------------------------------------- /examples/website/src/components/Layouts/index/index.tsx: -------------------------------------------------------------------------------- 1 | import { Outlet, KktproPageProps, useLocation } from '@kkt/pro'; 2 | import Menu from '../Menu'; 3 | import Navbar from '../Navbar'; 4 | import { createGlobalStyle } from 'styled-components'; 5 | import { Wrapper, Main, Body, OutletWrap } from './style'; 6 | import '@wcj/dark-mode'; 7 | 8 | export const GlobalStyle = createGlobalStyle` 9 | [data-color-mode*='dark'], [data-color-mode*='dark'] body { 10 | --gradient-from: #1c1e20; 11 | --gradient-to: #0d1117; 12 | --color-rgb: 255 255 255; 13 | } 14 | [data-color-mode*='light'], [data-color-mode*='light'] body { 15 | --gradient-from: #e5eaf0; 16 | --gradient-to: #fff; 17 | --color-rgb: 0 0 0; 18 | } 19 | `; 20 | 21 | export default function Layout(props: KktproPageProps) { 22 | const { pathname } = useLocation(); 23 | const isHome: boolean = pathname === '/home'; 24 | 25 | return ( 26 | 27 | 28 | 29 |
30 | 31 | {!isHome && } 32 | 33 | 34 | 35 | 36 |
37 |
38 | ); 39 | } 40 | -------------------------------------------------------------------------------- /examples/website/src/components/Layouts/index/style.ts: -------------------------------------------------------------------------------- 1 | import styled, { css } from 'styled-components'; 2 | 3 | export const Wrapper = styled.div` 4 | width: 100%; 5 | height: 100%; 6 | `; 7 | 8 | export const Main = styled.main` 9 | box-sizing: border-box; 10 | display: block; 11 | height: 100%; 12 | overflow: auto; 13 | scroll-behavior: smooth; 14 | `; 15 | 16 | export const Body = styled.div<{ isHome?: boolean }>` 17 | max-width: 1400px; 18 | margin: 0 auto; 19 | height: 100%; 20 | width: 100%; 21 | position: relative; 22 | z-index: 1; 23 | ${({ isHome }) => { 24 | return ( 25 | isHome && 26 | css` 27 | max-width: 100%; 28 | ` 29 | ); 30 | }} 31 | `; 32 | 33 | export const OutletWrap = styled.div<{ isHome?: boolean }>` 34 | padding-top: 58px; 35 | height: 100%; 36 | padding-left: 240px; 37 | ${({ isHome }) => { 38 | return ( 39 | isHome && 40 | css` 41 | padding-left: 0; 42 | ` 43 | ); 44 | }} 45 | `; 46 | -------------------------------------------------------------------------------- /examples/website/src/components/Loading/index.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { Wrapper, LoadBox } from './style'; 3 | 4 | const Loading = ({ 5 | children, 6 | loading, 7 | }: { 8 | children: React.ReactNode; 9 | loading?: boolean; 10 | }) => { 11 | return ( 12 | 13 | {children} 14 | {loading && Loading...} 15 | 16 | ); 17 | }; 18 | 19 | export default Loading; 20 | -------------------------------------------------------------------------------- /examples/website/src/components/Loading/style.ts: -------------------------------------------------------------------------------- 1 | import styled from 'styled-components'; 2 | 3 | export const Wrapper = styled.div` 4 | position: relative; 5 | `; 6 | 7 | export const LoadBox = styled.div` 8 | position: absolute; 9 | left: 50%; 10 | transform: translateX(-50%); 11 | top: 200px; 12 | `; 13 | -------------------------------------------------------------------------------- /examples/website/src/components/Preview/nodes/toc.less: -------------------------------------------------------------------------------- 1 | .menu-toc { 2 | padding-left: 23px; 3 | .menu-modal { 4 | padding-top: 23px; 5 | position: sticky; 6 | top: 40px; 7 | z-index: 999; 8 | right: 0; 9 | } 10 | .menu-marker { 11 | height: 18px; 12 | width: 5px; 13 | background-color: #f38701; 14 | position: absolute; 15 | margin-left: -5px; 16 | margin-top: 3px; 17 | border-radius: 2px; 18 | transition: top 0.3s; 19 | } 20 | a { 21 | display: block; 22 | height: 100%; 23 | text-overflow: ellipsis; 24 | white-space: nowrap; 25 | overflow: hidden; 26 | padding-left: 8px; 27 | &.active { 28 | text-decoration: underline; 29 | font-weight: bold; 30 | } 31 | } 32 | a + a { 33 | margin-top: 5px; 34 | } 35 | .level1 { 36 | font-weight: bold; 37 | color: var(--color-theme-text); 38 | } 39 | .level3, 40 | .level4, 41 | .level5, 42 | .level6 { 43 | padding-left: 18px; 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /examples/website/src/components/Preview/nodes/toc.tsx: -------------------------------------------------------------------------------- 1 | import { Element, RootContent } from 'hast'; 2 | import { getCodeString } from 'rehype-rewrite'; 3 | 4 | export const titleNum = (tagName = '') => Number(tagName.replace(/^h/, '')); 5 | export function getTocTree( 6 | arr: RootContent[] = [], 7 | result: Element[] = [], 8 | ): Element { 9 | let n = 0; 10 | while (n < arr.length) { 11 | const toc = arr[n]; 12 | if (toc && toc.type === 'element' && /^h[1-6]/.test(toc.tagName)) { 13 | const titleNum = Number(toc.tagName.replace(/^h/, '')); 14 | result.push({ 15 | ...toc, 16 | tagName: 'a', 17 | properties: { 18 | class: `toc-link level${titleNum}`, 19 | href: `#${toc.properties?.id}`, 20 | }, 21 | children: [ 22 | { 23 | type: 'text', 24 | value: getCodeString(toc.children), 25 | }, 26 | ], 27 | }); 28 | } 29 | n++; 30 | } 31 | return { 32 | type: 'element', 33 | tagName: 'nav', 34 | properties: { 35 | class: 'menu-toc', 36 | id: 'menu-toc', 37 | }, 38 | children: [ 39 | { 40 | type: 'element', 41 | tagName: 'aside', 42 | properties: { 43 | class: 'menu-modal', 44 | 'data-top': '12px', 45 | }, 46 | children: [ 47 | { 48 | type: 'element', 49 | tagName: 'div', 50 | properties: { 51 | class: 'menu-marker', 52 | }, 53 | children: [], 54 | }, 55 | ...result, 56 | ], 57 | }, 58 | ], 59 | }; 60 | } 61 | -------------------------------------------------------------------------------- /examples/website/src/components/Preview/useMdData.ts: -------------------------------------------------------------------------------- 1 | import { useEffect, useState } from 'react'; 2 | import { CodeBlockData } from 'markdown-react-code-preview-loader'; 3 | 4 | export type MdDataHandle = () => Promise<{ default: CodeBlockData }>; 5 | 6 | export const useMdData = (path: MdDataHandle) => { 7 | const [mdData, setMdData] = useState({ 8 | source: '', 9 | components: {}, 10 | data: {}, 11 | }); 12 | const [loading, setLoading] = useState(false); 13 | 14 | useEffect(() => { 15 | const $main = document.getElementsByTagName( 16 | 'main', 17 | ) as HTMLCollectionOf; 18 | $main[0].scrollTo(0, 0); 19 | }, [path]); 20 | 21 | useEffect(() => { 22 | setLoading(() => true); 23 | const getMd = async () => { 24 | try { 25 | const result = await path(); 26 | if (result.default) { 27 | setMdData(result.default); 28 | } 29 | } catch (err) { 30 | console.warn(err); 31 | } 32 | setLoading(() => false); 33 | }; 34 | getMd(); 35 | // eslint-disable-next-line 36 | }, [path]); 37 | return { mdData, loading }; 38 | }; 39 | -------------------------------------------------------------------------------- /examples/website/src/global.css: -------------------------------------------------------------------------------- 1 | body { 2 | margin: 0; 3 | -webkit-font-smoothing: antialiased; 4 | font-family: -apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen,Ubuntu,Cantarell,Fira Sans,Droid Sans,Helvetica Neue,sans-serif; 5 | font-size: 16px; 6 | } 7 | 8 | body, html, #root{ 9 | height: 100%; 10 | padding: 0; 11 | margin: 0; 12 | } 13 | 14 | html, main { 15 | scroll-behavior: smooth; 16 | } 17 | 18 | *, :after, :before { 19 | box-sizing: border-box; 20 | } 21 | 22 | 23 | [data-color-mode*='light'] { 24 | --font-color: #333; 25 | --color-header-bg: 255 255 255; 26 | --color-border-muted: #e5e5e5; 27 | --color1: #f2f2f2; 28 | --color2: #1677ff; 29 | } 30 | 31 | [data-color-mode*='dark'] { 32 | --font-color: #fff; 33 | --color-header-bg: 13 17 22; 34 | --color-border-muted: #373737; 35 | --color1: #282828; 36 | --color2: #0053c8; 37 | } 38 | 39 | .menu-toc .menu-marker { 40 | background: var(--color-accent-fg) !important; 41 | } -------------------------------------------------------------------------------- /examples/website/src/index.less: -------------------------------------------------------------------------------- 1 | body, 2 | html { 3 | font-size: 14px; 4 | font-family: -apple-system, BlinkMacSystemFont, Segoe UI, Helvetica, Arial, 5 | sans-serif, Apple Color Emoji, Segoe UI Emoji, Segoe UI Symbol; 6 | } 7 | 8 | :global { 9 | #root { 10 | min-height: 100%; 11 | background-color: #f3f3f3; 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /examples/website/src/pages/auth/README.md: -------------------------------------------------------------------------------- 1 | # 权限管理 2 | 3 | ## 一、简介 4 | 在项目中经常有的场景是不同的用户的权限不同,通常有如下场景: 5 | - 不同的用户在页面中可以看到的元素和操作不同 6 | - 不同的用户对页面的访问权限不同 7 | 8 | ```bash 9 | 针对这些场景,我们为中台场景下常用的权限控制提供了一种更加简单、易用、通用的解决方案。实现了一个基于 umi 插件的权限管 10 | 理方案 - @uiw-admin/authorized。通过定义权限,使用权限,完成 React 组件内的执行权限控制,渲染权限控制。搭配 11 | @uiw-admin/basic-layouts 插件一起使用,还可以进一步完成对路由权限的控制。 12 | ``` 13 | 14 | ## 二、路由和菜单 15 | 当项目需要根据权限判断组件是否展示 使用组件时,在 `.kktprc.ts`文件中配置全局变量 16 | 17 | ```diff 18 | export default { 19 | define:{ 20 | + AUTH:true, 21 | // ... 22 | } 23 | // ... 24 | } 25 | ``` 26 | 如果是路由权限判断,请在route.json中添加对应菜单的权限``isAuth`` 27 | ```json 28 | [ 29 | { 30 | "path": "/new", 31 | "name": "新页面", 32 | "element": "@page/NewPage", 33 | "icon": "home", 34 | "isAuth":true 35 | }, 36 | ] 37 | ``` 38 | 39 | 然后在BasicLayout.tsx,使用 ``AuthPage``组件 40 | ```jsx 41 | import AuthPage from "@uiw-admin/authorized" 42 | import BasicLayout from '@uiw-admin/BasicLayout' 43 | export default ()=>{ 44 | return ( 45 | 46 | 47 | 48 | ) 49 | } 50 | ``` 51 | 52 | ## 三、页面中控件权限控制 53 | ```jsx 54 | import React from "react" 55 | import { AuthBtn } from "@uiw-admin/authorized" 56 | 57 | const Demos = ()=>{ 58 | return ( 59 |
60 | 61 | 子集渲染1 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 |
73 | ) 74 | } 75 | export default Demos 76 | ``` -------------------------------------------------------------------------------- /examples/website/src/pages/auth/index.tsx: -------------------------------------------------------------------------------- 1 | import Preview from '../../components/Preview'; 2 | 3 | const Page = () => import('./README.md')} />; 4 | 5 | export default Page; 6 | -------------------------------------------------------------------------------- /examples/website/src/pages/authorized/index.tsx: -------------------------------------------------------------------------------- 1 | import Preview from '../../components/Preview'; 2 | 3 | const Page = () => ( 4 | import('@uiw-admin/authorized/README.md')} /> 5 | ); 6 | 7 | export default Page; 8 | -------------------------------------------------------------------------------- /examples/website/src/pages/basic-layouts/index.tsx: -------------------------------------------------------------------------------- 1 | import Preview from '../../components/Preview'; 2 | 3 | const Page = () => ( 4 | import('@uiw-admin/basic-layouts/README.md')} /> 5 | ); 6 | 7 | export default Page; 8 | -------------------------------------------------------------------------------- /examples/website/src/pages/components/ProDrawer.tsx: -------------------------------------------------------------------------------- 1 | import Preview from '../../components/Preview'; 2 | 3 | const Page = () => ( 4 | import('@uiw-admin/components/src/ProDrawer/README.md')} 6 | /> 7 | ); 8 | 9 | export default Page; 10 | -------------------------------------------------------------------------------- /examples/website/src/pages/components/ProForm.tsx: -------------------------------------------------------------------------------- 1 | import Preview from '../../components/Preview'; 2 | 3 | const Page = () => ( 4 | import('@uiw-admin/components/src/ProForm/README.md')} /> 5 | ); 6 | 7 | export default Page; 8 | -------------------------------------------------------------------------------- /examples/website/src/pages/components/Protable.tsx: -------------------------------------------------------------------------------- 1 | import Preview from '../../components/Preview'; 2 | 3 | const Page = () => ( 4 | import('@uiw-admin/components/src/ProTable/README.md')} 6 | /> 7 | ); 8 | 9 | export default Page; 10 | -------------------------------------------------------------------------------- /examples/website/src/pages/components/Skeleton.tsx: -------------------------------------------------------------------------------- 1 | import Preview from '../../components/Preview'; 2 | 3 | const Page = () => ( 4 | import('@uiw-admin/components/src/Skeleton/README.md')} 6 | /> 7 | ); 8 | 9 | export default Page; 10 | -------------------------------------------------------------------------------- /examples/website/src/pages/components/index.tsx: -------------------------------------------------------------------------------- 1 | import Preview from '../../components/Preview'; 2 | 3 | const Page = () => ( 4 | import('@uiw-admin/components/README.md')} /> 5 | ); 6 | 7 | export default Page; 8 | -------------------------------------------------------------------------------- /examples/website/src/pages/config/index.tsx: -------------------------------------------------------------------------------- 1 | import Preview from '../../components/Preview'; 2 | 3 | const Page = () => ( 4 | import('@uiw-admin/config/README.md')} /> 5 | ); 6 | 7 | export default Page; 8 | -------------------------------------------------------------------------------- /examples/website/src/pages/document-title/index.tsx: -------------------------------------------------------------------------------- 1 | import Preview from '../../components/Preview'; 2 | 3 | const Page = () => ( 4 | import('@uiw-admin/document-title/README.md')} /> 5 | ); 6 | 7 | export default Page; 8 | -------------------------------------------------------------------------------- /examples/website/src/pages/eslint-config/README.md: -------------------------------------------------------------------------------- 1 | ../../../../../eslint-packages/config/README.md -------------------------------------------------------------------------------- /examples/website/src/pages/eslint-config/index.tsx: -------------------------------------------------------------------------------- 1 | import Preview from '../../components/Preview'; 2 | 3 | const Page = () => import('./README.md')} />; 4 | 5 | export default Page; 6 | -------------------------------------------------------------------------------- /examples/website/src/pages/example/index.module.css: -------------------------------------------------------------------------------- 1 | 2 | .loading { 3 | position: absolute; 4 | z-index: 9999; 5 | height: 100vh; 6 | width: 100%; 7 | backdrop-filter: saturate(180%) blur(.4rem); 8 | background-color: hsla(0,0%,100%,.75); 9 | display: flex; 10 | flex-direction: column; 11 | justify-content: center; 12 | align-items: center; 13 | } 14 | 15 | .tools { 16 | position: fixed; 17 | z-index: 99999; 18 | bottom: 10px; 19 | left: 10px; 20 | } -------------------------------------------------------------------------------- /examples/website/src/pages/example/index.tsx: -------------------------------------------------------------------------------- 1 | import { Fragment, useState } from 'react'; 2 | import { useNavigate } from 'react-router-dom'; 3 | import { Button, Loader, Icon } from 'uiw'; 4 | import styles from './index.module.css'; 5 | 6 | export default function Page() { 7 | const [loading, setLoading] = useState(true); 8 | const navigate = useNavigate(); 9 | return ( 10 | 11 | {loading && ( 12 |
13 | 14 |
15 | )} 16 |
17 | 20 |
21 |