(() => ({
14 | theme: isDark.value ? darkTheme : lightTheme
15 | }));
16 |
17 | const { message } = createDiscreteApi(["message"], {
18 | configProviderProps: configProviderPropsRef
19 | });
20 |
21 | return {
22 | message
23 | };
24 | }
25 |
--------------------------------------------------------------------------------
/docs/utils/math/sum.vue:
--------------------------------------------------------------------------------
1 |
8 |
9 |
10 |
11 | 原数组:{{ arr }}
12 |
13 |
14 | 求数字类型组成数组中的和
15 |
16 |
17 | 和:{{ sumNum }}
18 |
19 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/playgrounds/react/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "react-demo",
3 | "private": true,
4 | "version": "0.0.0",
5 | "type": "module",
6 | "scripts": {
7 | "dev": "vite",
8 | "build": "tsc && vite build",
9 | "preview": "vite build && vite preview"
10 | },
11 | "dependencies": {
12 | "@pureadmin/utils": "^2.1.1",
13 | "react": "^18.2.0",
14 | "react-dom": "^18.2.0"
15 | },
16 | "devDependencies": {
17 | "@types/react": "^18.2.46",
18 | "@types/react-dom": "^18.2.18",
19 | "@vitejs/plugin-react": "^4.2.1",
20 | "typescript": "^5.3.3",
21 | "vite": "^5.0.10"
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/docs/utils/math/max.vue:
--------------------------------------------------------------------------------
1 |
8 |
9 |
10 |
11 | 原数组:{{ arr }}
12 |
13 |
14 | 求数字类型组成数组中的最大值
15 |
16 |
17 | 最大值:{{ maxNum }}
18 |
19 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/docs/utils/math/min.vue:
--------------------------------------------------------------------------------
1 |
8 |
9 |
10 |
11 | 原数组:{{ arr }}
12 |
13 |
14 | 求数字类型组成数组中的最小值
15 |
16 |
17 | 最小值:{{ minNum }}
18 |
19 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/docs/hooks/useECharts/demo/business/index.ts:
--------------------------------------------------------------------------------
1 | import { withInstall } from "@pureadmin/utils";
2 |
3 | import edynamic from "./dynamic.vue";
4 | import erequest from "./request.vue";
5 | import eloading from "./loading.vue";
6 | import ecustomTheme from "./customTheme.vue";
7 |
8 | const Edynamic = withInstall(edynamic);
9 | const Erequest = withInstall(erequest);
10 | const Eloading = withInstall(eloading);
11 | const EcustomTheme = withInstall(ecustomTheme);
12 |
13 | export {
14 | /** 加载动画 */
15 | Eloading,
16 | /** 动态图表 */
17 | Edynamic,
18 | /** 接口请求 */
19 | Erequest,
20 | /** 自定义主题 */
21 | EcustomTheme
22 | };
23 |
--------------------------------------------------------------------------------
/docs/hooks/useECharts/demo/advanced/index.ts:
--------------------------------------------------------------------------------
1 | import { withInstall } from "@pureadmin/utils";
2 |
3 | import edemo1 from "./demo1.vue";
4 | import edemo2 from "./demo2.vue";
5 | import edemo3 from "./demo3.vue";
6 | import edemo4 from "./demo4.vue";
7 | import edemo5 from "./demo5.vue";
8 | import edemo6 from "./demo6.vue";
9 |
10 | const Edemo1 = withInstall(edemo1);
11 | const Edemo2 = withInstall(edemo2);
12 | const Edemo3 = withInstall(edemo3);
13 | const Edemo4 = withInstall(edemo4);
14 | const Edemo5 = withInstall(edemo5);
15 | const Edemo6 = withInstall(edemo6);
16 |
17 | export { Edemo1, Edemo2, Edemo3, Edemo4, Edemo5, Edemo6 };
18 |
--------------------------------------------------------------------------------
/docs/utils/uuid/buildGUID.vue:
--------------------------------------------------------------------------------
1 |
8 |
9 |
10 |
11 |
12 | 点击生成36位带横杠的GUID
13 |
14 |
15 | 长度:{{ GUID.length }}
16 |
17 | {{ GUID }}
18 |
19 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/docs/utils/uuid/buildUUID.vue:
--------------------------------------------------------------------------------
1 |
8 |
9 |
10 |
11 |
12 | 点击生成32位uuid
13 |
14 |
15 | 长度:{{ UUID.length }}
16 |
17 | {{ UUID }}
18 |
19 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/playgrounds/node/index.js:
--------------------------------------------------------------------------------
1 | const Koa = require('koa')
2 | const logger = require('koa-logger')
3 | const router = require('@koa/router')()
4 | const { dateFormat, getCurrentWeek, uuid } = require('@pureadmin/utils')
5 | // https://pure-admin-utils.netlify.app/
6 |
7 | const app = new Koa()
8 |
9 | // middlewares
10 |
11 | app.use(logger())
12 |
13 |
14 | const helloWorld = ctx => {
15 | ctx.body = `${dateFormat("YYYY/MM/DD HH:mm")} ${getCurrentWeek()} ${uuid()}`
16 | }
17 |
18 | router.get('/', helloWorld)
19 |
20 | app.use(router.routes())
21 |
22 | app.listen(3000, () => {
23 | console.log('Server Address: http://localhost:3000 ')
24 | })
25 |
--------------------------------------------------------------------------------
/docs/utils/math/average.vue:
--------------------------------------------------------------------------------
1 |
8 |
9 |
10 |
11 | 原数组:{{ arr }}
12 |
13 |
14 | 求数字类型组成数组中的平均值
15 |
16 |
17 | 平均值:{{ averageNum }}
18 |
19 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/docs/utils/substring/splitNum.vue:
--------------------------------------------------------------------------------
1 |
7 |
8 |
9 |
10 |
11 |
12 | 将数字拆分为单个数字组成的数组
13 |
14 | 原数字:123456
15 |
16 | 拆分后的数字:{{ character6 }}
17 |
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/playgrounds/solid/src/App.module.css:
--------------------------------------------------------------------------------
1 | .App {
2 | text-align: center;
3 | }
4 |
5 | .logo {
6 | animation: logo-spin infinite 20s linear;
7 | height: 40vmin;
8 | pointer-events: none;
9 | }
10 |
11 | .header {
12 | background-color: #282c34;
13 | min-height: 100vh;
14 | display: flex;
15 | flex-direction: column;
16 | align-items: center;
17 | justify-content: center;
18 | font-size: calc(10px + 2vmin);
19 | color: white;
20 | }
21 |
22 | .link {
23 | color: #b318f0;
24 | }
25 |
26 | @keyframes logo-spin {
27 | from {
28 | transform: rotate(0deg);
29 | }
30 | to {
31 | transform: rotate(360deg);
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/docs/utils/date/getCurrentWeek.vue:
--------------------------------------------------------------------------------
1 |
7 |
8 |
9 |
10 |
11 |
12 | 获取当前是星期几
13 |
14 |
15 | 获取当前是周几
16 |
17 |
18 | {{ currentWeek }}
19 |
20 |
21 |
22 |
23 |
--------------------------------------------------------------------------------
/docs/utils/math/numberToChinese.vue:
--------------------------------------------------------------------------------
1 |
7 |
8 |
9 |
10 |
11 |
17 |
18 | 中文数字:{{ numberToChinese(value) }}
19 |
20 |
21 |
22 |
23 |
--------------------------------------------------------------------------------
/docs/utils/mouseEvent/allowMouseEvent.vue:
--------------------------------------------------------------------------------
1 |
4 |
5 |
6 |
7 |
8 | 允许右键
9 | 允许选择
10 | 允许拷贝
11 |
14 | 同时允许右键、选择、拷贝
15 |
16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/docs/utils/substring/subAfter.vue:
--------------------------------------------------------------------------------
1 |
7 |
8 |
9 |
10 |
11 |
12 | 截取指定字符后面的值
13 |
14 | 原字符:hello,gird
15 |
16 | 截取后字符:{{ character2 }}
17 |
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/docs/utils/substring/subBefore.vue:
--------------------------------------------------------------------------------
1 |
7 |
8 |
9 |
10 |
11 |
12 | 截取指定字符前面的值
13 |
14 | 原字符:hello,gird
15 |
16 | 截取后字符:{{ character1 }}
17 |
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/docs/utils/substring/subBothSides.vue:
--------------------------------------------------------------------------------
1 |
7 |
8 |
9 |
10 |
11 |
12 | 截取指定字符两边的值
13 |
14 | 原字符:hello,gird
15 |
16 | 截取后字符:{{ character3 }}
17 |
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/playgrounds/react/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | "target": "ESNext",
4 | "useDefineForClassFields": true,
5 | "lib": ["DOM", "DOM.Iterable", "ESNext"],
6 | "allowJs": false,
7 | "skipLibCheck": true,
8 | "esModuleInterop": false,
9 | "allowSyntheticDefaultImports": true,
10 | "strict": true,
11 | "forceConsistentCasingInFileNames": true,
12 | "module": "ESNext",
13 | "moduleResolution": "Node",
14 | "resolveJsonModule": true,
15 | "isolatedModules": true,
16 | "noEmit": true,
17 | "jsx": "react-jsx"
18 | },
19 | "include": ["src"],
20 | "references": [{ "path": "./tsconfig.node.json" }]
21 | }
22 |
--------------------------------------------------------------------------------
/docs/hooks/useWatermark/demo/forever.vue:
--------------------------------------------------------------------------------
1 |
17 |
18 |
19 |
20 |
24 |
25 |
26 |
--------------------------------------------------------------------------------
/docs/utils/debounce/delay.vue:
--------------------------------------------------------------------------------
1 |
17 |
18 |
19 |
20 |
21 |
22 | {{ isActive ? `${second} 秒后函数执行` : `函数执行花费 ${second} 秒` }}
23 |
24 |
25 |
26 |
27 |
--------------------------------------------------------------------------------
/docs/utils/substring/subBetween.vue:
--------------------------------------------------------------------------------
1 |
7 |
8 |
9 |
10 |
11 |
12 | 截取指定两个字符之间的值
13 |
14 | 原字符:i love you
15 |
16 | 截取后字符:{{ character4 }}
17 |
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/playgrounds/next/app/globals.css:
--------------------------------------------------------------------------------
1 | @tailwind base;
2 | @tailwind components;
3 | @tailwind utilities;
4 |
5 | :root {
6 | --foreground-rgb: 0, 0, 0;
7 | --background-start-rgb: 214, 219, 220;
8 | --background-end-rgb: 255, 255, 255;
9 | }
10 |
11 | @media (prefers-color-scheme: dark) {
12 | :root {
13 | --foreground-rgb: 255, 255, 255;
14 | --background-start-rgb: 0, 0, 0;
15 | --background-end-rgb: 0, 0, 0;
16 | }
17 | }
18 |
19 | body {
20 | color: rgb(var(--foreground-rgb));
21 | background: linear-gradient(
22 | to bottom,
23 | transparent,
24 | rgb(var(--background-end-rgb))
25 | )
26 | rgb(var(--background-start-rgb));
27 | }
28 |
--------------------------------------------------------------------------------
/playgrounds/vue-cli/src/App.vue:
--------------------------------------------------------------------------------
1 |
2 | {{ `${dateFormat("YYYY/MM/DD HH:mm")} ${getCurrentWeek()} ${uuid()}` }}
3 |
4 |
5 |
19 |
20 |
30 |
--------------------------------------------------------------------------------
/docs/utils/date/createYear.vue:
--------------------------------------------------------------------------------
1 |
7 |
8 |
9 |
10 |
11 |
12 | 获取从当前年份到指定开始年份的数组
13 |
14 |
15 | 数组反转
16 |
17 |
18 | {{ yearsList }}
19 |
20 |
21 |
22 |
23 |
--------------------------------------------------------------------------------
/docs/components/theme-change.vue:
--------------------------------------------------------------------------------
1 |
12 |
13 |
14 |
15 |
16 | 回到light主题
17 | 切换dark主题
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/docs/utils/device/deviceDetection.vue:
--------------------------------------------------------------------------------
1 |
12 |
13 |
14 |
15 |
16 |
17 | 当前设备类型:
18 |
19 | {{ device ? "移动端" : "pc端" }}
20 |
21 |
22 |
23 |
24 |
25 |
--------------------------------------------------------------------------------
/docs/public/favicon.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/docs/utils/color/types/randomGradient.ts:
--------------------------------------------------------------------------------
1 | export interface GradientOptions {
2 | /** 基础色相(`0`-`360`度),默认为一个随机色相 */
3 | baseHue?: number;
4 | /** 从基础色相偏移的度数,用于创建第二种和谐色相,默认为`30`度 */
5 | hueOffset?: number;
6 | /** 饱和度百分比(`50`-`100%`),颜色的鲜艳程度,默认为`70%` */
7 | saturation?: number;
8 | /** 亮度百分比(`40`-`70%`),颜色的明亮程度,默认为`60%` */
9 | lightness?: number;
10 | /** 渐变角度(`0`-`360`度),决定渐变的方向,默认为`135`度 */
11 | angle?: number;
12 | /** 是否随机生成色相,默认为`false` */
13 | randomizeHue?: boolean;
14 | /** 是否随机生成饱和度,默认为`false` */
15 | randomizeSaturation?: boolean;
16 | /** 是否随机生成亮度,默认为`false` */
17 | randomizeLightness?: boolean;
18 | /** 是否随机生成渐变角度,默认为`false` */
19 | randomizeAngle?: boolean;
20 | }
21 |
--------------------------------------------------------------------------------
/docs/utils/object/object.md:
--------------------------------------------------------------------------------
1 |
5 |
6 | ::: tip 支持任意 `JavaScript` 环境或框架
7 | 处理对象
8 | :::
9 |
10 | ## delObjectProperty
11 |
12 | 从对象中删除指定的属性,返回修改后的新对象,不会修改原始对象
13 |
14 |
15 |
16 | 接收两个参数,第一个 `obj`,第二个 `props`
17 |
18 | | **参数属性** | **说明** |
19 | | ------------ | ---------------------------------------------------------------- |
20 | | `obj` | 需要删除属性的对象 |
21 | | `props` | 指定要删除的属性,可以是单个属性名(字符串)或一个属性名字符串数组 |
22 |
23 |
24 |
--------------------------------------------------------------------------------
/docs/utils/substring/subTextAddEllipsis.vue:
--------------------------------------------------------------------------------
1 |
7 |
8 |
9 |
10 |
11 |
12 | 截取字符并追加省略号(常用场景:echarts)
13 |
14 | 原字符:hello,gird
15 |
16 | 截取后字符:{{ character5 }}
17 |
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/playgrounds/vue-cli/public/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 | <%= htmlWebpackPlugin.options.title %>
9 |
10 |
11 |
14 |
15 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/docs/utils/class/addClass.vue:
--------------------------------------------------------------------------------
1 |
17 |
18 |
19 |
20 |
21 |
22 |
点击添加类名
23 |
当前元素的类名 {{ names }}
24 |
25 |
26 |
27 |
--------------------------------------------------------------------------------
/playgrounds/svelte/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "svelte-demo",
3 | "private": true,
4 | "version": "0.0.0",
5 | "type": "module",
6 | "scripts": {
7 | "dev": "vite",
8 | "build": "vite build",
9 | "preview": "vite build && vite preview",
10 | "check": "svelte-check --tsconfig ./tsconfig.json"
11 | },
12 | "dependencies": {
13 | "@pureadmin/utils": "^2.1.1"
14 | },
15 | "devDependencies": {
16 | "@sveltejs/vite-plugin-svelte": "^3.0.1",
17 | "@tsconfig/svelte": "^5.0.2",
18 | "svelte": "^4.2.8",
19 | "svelte-check": "^3.6.2",
20 | "svelte-preprocess": "^5.1.3",
21 | "tslib": "^2.6.2",
22 | "typescript": "^5.3.3",
23 | "vite": "^5.0.10"
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/docs/utils/svg/svg.md:
--------------------------------------------------------------------------------
1 |
5 |
6 | ::: tip 支持任意运行在浏览器的 `JavaScript` 语言
7 | 处理`SVG`
8 | :::
9 |
10 | ## getSvgInfo
11 |
12 | 解析传入的SVG字符串并提取其关键信息
13 |
14 |
15 |
16 | ####
{#param1}
17 |
18 | 接收一个参数 `svgStr`,返回值类型为 `SvgInfo`
19 |
20 | | **参数属性** | **说明** | **类型** |
21 | | ------------ | ------------------------------------------ | -------- |
22 | | `svgStr` | 包含SVG内容的字符串,格式为标准的`SVG XML` | `string` |
23 |
24 | ####
{#type1}
25 |
26 | <<< @/utils/svg/types/getSvgInfo.ts
27 |
28 |
29 |
--------------------------------------------------------------------------------
/docs/utils/uuid/uuid.vue:
--------------------------------------------------------------------------------
1 |
8 |
9 |
10 |
11 |
12 |
13 | 点击生成指定长度和基数的uuid
14 |
15 |
16 |
17 | 长度:{{ customUUID.length }}
18 |
19 | {{ customUUID }}
20 |
21 |
22 |
23 |
24 |
--------------------------------------------------------------------------------
/playgrounds/next/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | "target": "es5",
4 | "lib": ["dom", "dom.iterable", "esnext"],
5 | "allowJs": true,
6 | "skipLibCheck": true,
7 | "strict": true,
8 | "noEmit": true,
9 | "esModuleInterop": true,
10 | "module": "esnext",
11 | "moduleResolution": "bundler",
12 | "resolveJsonModule": true,
13 | "isolatedModules": true,
14 | "jsx": "preserve",
15 | "incremental": true,
16 | "plugins": [
17 | {
18 | "name": "next"
19 | }
20 | ],
21 | "paths": {
22 | "@/*": ["./*"]
23 | }
24 | },
25 | "include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"],
26 | "exclude": ["node_modules"]
27 | }
28 |
--------------------------------------------------------------------------------
/playgrounds/preact/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | "target": "ESNext",
4 | "useDefineForClassFields": true,
5 | "lib": ["DOM", "DOM.Iterable", "ESNext"],
6 | "allowJs": false,
7 | "skipLibCheck": true,
8 | "esModuleInterop": false,
9 | "allowSyntheticDefaultImports": true,
10 | "strict": true,
11 | "forceConsistentCasingInFileNames": true,
12 | "module": "ESNext",
13 | "moduleResolution": "Node",
14 | "resolveJsonModule": true,
15 | "isolatedModules": true,
16 | "noEmit": true,
17 | "jsx": "preserve",
18 | "jsxFactory": "h",
19 | "jsxFragmentFactory": "Fragment"
20 | },
21 | "include": ["src"],
22 | "references": [{ "path": "./tsconfig.node.json" }]
23 | }
24 |
--------------------------------------------------------------------------------
/docs/utils/class/removeClass.vue:
--------------------------------------------------------------------------------
1 |
17 |
18 |
19 |
20 |
21 |
22 |
点击删除类名
23 |
当前元素的类名 {{ names }}
24 |
25 |
26 |
27 |
--------------------------------------------------------------------------------
/docs/utils/array/getKeyList.vue:
--------------------------------------------------------------------------------
1 |
9 |
10 |
11 |
12 |
13 | 原数组
14 |
15 | {{ arr }}
16 |
17 | 提取name后的新数组
18 |
19 | {{ getKeyList(arr, "name") }}
20 |
21 | 提取age后的新数组
22 |
23 | {{ getKeyList(arr, "age") }}
24 |
25 |
26 |
27 |
28 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 | pure-admin-utils 保姆级文档
10 |
11 |
12 |
13 | 采用 vitepress 和 naive-ui 搭配编写
15 |
16 |
17 | ## 👀 预览
18 |
19 | [查看文档](https://pure-admin-utils.netlify.app)
20 |
21 | ## 📡 安装依赖
22 |
23 | ```
24 | pnpm install
25 | ```
26 |
27 | ## 🚀 运行
28 |
29 | ```
30 | pnpm dev
31 | ```
32 |
33 | ## 🕋 打包
34 |
35 | ```
36 | pnpm build
37 | ```
38 |
--------------------------------------------------------------------------------
/docs/utils/class/toggleClass.vue:
--------------------------------------------------------------------------------
1 |
17 |
18 |
19 |
20 |
21 |
22 |
点击切换类名
23 |
当前元素的类名 {{ names }}
24 |
25 |
26 |
27 |
--------------------------------------------------------------------------------
/docs/utils/clone/cloneDeep.vue:
--------------------------------------------------------------------------------
1 |
12 |
13 |
14 |
15 |
16 |
深拷贝
17 |
18 | 拷贝数据改变:
19 |
20 | {{ copyArr }}
21 |
22 | 原数据不变:
23 |
24 | {{ arr }}
25 |
26 |
27 |
28 |
29 |
30 |
--------------------------------------------------------------------------------
/docs/components/description-popover.vue:
--------------------------------------------------------------------------------
1 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 | 此页面共{{ num }}个方法
25 |
26 |
27 |
28 |
--------------------------------------------------------------------------------
/playgrounds/next/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "next-demo",
3 | "version": "0.0.0",
4 | "private": true,
5 | "scripts": {
6 | "dev": "next dev",
7 | "build": "next build",
8 | "start": "next start",
9 | "lint": "next lint"
10 | },
11 | "dependencies": {
12 | "@pureadmin/utils": "^2.1.1",
13 | "next": "^14.0.4",
14 | "react": "^18.2.0",
15 | "react-dom": "^18.2.0"
16 | },
17 | "devDependencies": {
18 | "@types/node": "^20.10.5",
19 | "@types/react": "^18.2.46",
20 | "@types/react-dom": "^18.2.18",
21 | "autoprefixer": "^10.4.16",
22 | "eslint": "^8.56.0",
23 | "eslint-config-next": "^14.0.4",
24 | "postcss": "^8.4.32",
25 | "tailwindcss": "^3.4.0",
26 | "typescript": "^5.3.3"
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/playgrounds/svelte/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "@tsconfig/svelte/tsconfig.json",
3 | "compilerOptions": {
4 | "target": "ESNext",
5 | "useDefineForClassFields": true,
6 | "module": "ESNext",
7 | "resolveJsonModule": true,
8 | "baseUrl": ".",
9 | /**
10 | * Typecheck JS in `.svelte` and `.js` files by default.
11 | * Disable checkJs if you'd like to use dynamic types in JS.
12 | * Note that setting allowJs false does not prevent the use
13 | * of JS in `.svelte` files.
14 | */
15 | "allowJs": true,
16 | "checkJs": true,
17 | "isolatedModules": true
18 | },
19 | "include": ["src/**/*.d.ts", "src/**/*.ts", "src/**/*.js", "src/**/*.svelte"],
20 | "references": [{ "path": "./tsconfig.node.json" }]
21 | }
22 |
--------------------------------------------------------------------------------
/docs/utils/uuid/buildPrefixUUID.vue:
--------------------------------------------------------------------------------
1 |
8 |
9 |
10 |
11 |
12 |
13 | 点击生成自定义前缀的uuid
14 |
15 |
16 |
17 | 长度:{{ prefixUUID.length }}
18 |
19 | {{ prefixUUID }}
20 |
21 |
22 |
23 |
24 |
--------------------------------------------------------------------------------
/playgrounds/vue-vite/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | "target": "ES2020",
4 | "useDefineForClassFields": true,
5 | "module": "ESNext",
6 | "lib": ["ES2020", "DOM", "DOM.Iterable"],
7 | "skipLibCheck": true,
8 |
9 | /* Bundler mode */
10 | "moduleResolution": "bundler",
11 | "allowImportingTsExtensions": true,
12 | "resolveJsonModule": true,
13 | "isolatedModules": true,
14 | "noEmit": true,
15 | "jsx": "preserve",
16 |
17 | /* Linting */
18 | "strict": true,
19 | "noUnusedLocals": true,
20 | "noUnusedParameters": true,
21 | "noFallthroughCasesInSwitch": true
22 | },
23 | "include": ["src/**/*.ts", "src/**/*.tsx", "src/**/*.vue"],
24 | "references": [{ "path": "./tsconfig.node.json" }]
25 | }
26 |
--------------------------------------------------------------------------------
/playgrounds/react/src/App.css:
--------------------------------------------------------------------------------
1 | #root {
2 | max-width: 1280px;
3 | margin: 0 auto;
4 | padding: 2rem;
5 | text-align: center;
6 | }
7 |
8 | .logo {
9 | height: 6em;
10 | padding: 1.5em;
11 | will-change: filter;
12 | }
13 | .logo:hover {
14 | filter: drop-shadow(0 0 2em #646cffaa);
15 | }
16 | .logo.react:hover {
17 | filter: drop-shadow(0 0 2em #61dafbaa);
18 | }
19 |
20 | @keyframes logo-spin {
21 | from {
22 | transform: rotate(0deg);
23 | }
24 | to {
25 | transform: rotate(360deg);
26 | }
27 | }
28 |
29 | @media (prefers-reduced-motion: no-preference) {
30 | a:nth-of-type(2) .logo {
31 | animation: logo-spin infinite 20s linear;
32 | }
33 | }
34 |
35 | .card {
36 | padding: 2em;
37 | }
38 |
39 | .read-the-docs {
40 | color: #888;
41 | }
42 |
--------------------------------------------------------------------------------
/docs/utils/date/getCurrentDate.vue:
--------------------------------------------------------------------------------
1 |
7 |
8 |
9 |
10 |
11 |
12 | 当前的日期(年月日模式)
13 |
14 |
15 | 当前的日期( - 连接符模式)
16 |
17 |
18 | 当前的日期( / 连接符模式)
19 |
20 |
21 | {{ currentDate }}
22 |
23 |
24 |
25 |
26 |
--------------------------------------------------------------------------------
/docs/guide/tags.vue:
--------------------------------------------------------------------------------
1 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
--------------------------------------------------------------------------------
/docs/utils/convertPath/convertPath.md:
--------------------------------------------------------------------------------
1 |
7 |
8 | ::: tip 支持任意 `JavaScript` 环境或框架
9 | 路径转换
10 | :::
11 |
12 | ## convertPath
13 |
14 | 将 `Windows` 反斜杠路径转换为斜杠路径
15 |
16 |
17 |
18 | ####
{#base1}
19 |
20 |
21 |
22 |
23 |
24 | 查看代码
25 |
26 | <<< @/utils/convertPath/convertPath.vue
27 |
28 |
29 |
30 | ####
{#param1}
31 |
32 | 接收一个参数 `path` ,返回值类型 `string`
33 |
34 | | **参数属性** | **说明** | **类型** |
35 | | ------------ | -------- | -------- |
36 | | `path` | 路径地址 | `string` |
37 |
38 |
39 |
--------------------------------------------------------------------------------
/docs/utils/array/intersection.vue:
--------------------------------------------------------------------------------
1 |
24 |
25 |
26 |
27 |
28 |
29 | {{ text }}
30 |
31 |
32 |
33 |
34 |
--------------------------------------------------------------------------------
/docs/utils/color/randomColor.vue:
--------------------------------------------------------------------------------
1 |
7 |
8 |
9 |
10 |
11 | 随机生成rgb颜色
12 |
13 | 随机生成hex颜色
14 |
15 |
16 | 随机生成hsl颜色
17 |
18 |
19 | 随机生成指定数量的rgb颜色数组
20 |
21 |
22 |
23 | {{ color }}
24 |
25 |
26 |
27 |
--------------------------------------------------------------------------------
/docs/utils/date/getTime.vue:
--------------------------------------------------------------------------------
1 |
4 |
5 |
6 |
7 |
8 |
9 | 60 秒等于 {{ getTime(60, false).m }} 分钟
10 |
11 |
12 |
13 |
14 |
15 | 4233600 秒等于 {{ getTime(4233600).h }} 小时
16 |
17 |
18 |
19 |
20 |
21 | 299.099375 秒等于 {{ getTime(299.099375).h }}:{{
22 | getTime(299.099375).m
23 | }}:{{ getTime(299.099375).s }}
24 |
25 |
26 |
27 |
28 |
--------------------------------------------------------------------------------
/docs/utils/equal/isEqualArray.vue:
--------------------------------------------------------------------------------
1 |
9 |
10 |
11 |
12 |
13 |
14 | {{
15 | isEqualArray(array1, array2)
16 | ? `[${array1}] 等于 [${array2}]`
17 | : `[${array1}] 不等于 [${array2}]`
18 | }}
19 |
20 |
21 |
22 | {{
23 | isEqualArray(array1, array3)
24 | ? `[${array1}] 等于 [${array3}]`
25 | : `[${array1}] 不等于 [${array3}]`
26 | }}
27 |
28 |
29 |
30 |
31 |
--------------------------------------------------------------------------------
/docs/hooks/useCopyToClipboard/code.vue:
--------------------------------------------------------------------------------
1 |
23 |
24 |
25 |
26 |
27 |
28 | 拷贝
29 |
30 |
31 |
32 |
--------------------------------------------------------------------------------
/docs/utils/array/extractFields.vue:
--------------------------------------------------------------------------------
1 |
8 |
9 |
10 |
11 |
12 | 原数组
13 |
14 | {{ arr }}
15 |
16 | 提取name后的新数组
17 |
18 | {{ extractFields(arr, "name") }}
19 |
20 | 提取age后的新数组
21 |
22 | {{ extractFields(arr, "age") }}
23 |
24 | 提取age、sex后的新数组
25 |
26 | {{ extractFields(arr, "age", "sex") }}
27 |
28 |
29 |
30 |
31 |
--------------------------------------------------------------------------------
/docs/utils/color/darken.vue:
--------------------------------------------------------------------------------
1 |
8 |
9 |
10 |
11 |
12 |
13 | 颜色值加深
14 |
15 | 颜色值还原
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 | {{ currentColor }}
24 |
25 |
26 |
27 |
28 |
29 |
--------------------------------------------------------------------------------
/docs/utils/color/lighten.vue:
--------------------------------------------------------------------------------
1 |
8 |
9 |
10 |
11 |
12 |
13 | 颜色值变浅
14 |
15 | 颜色值还原
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 | {{ currentColor }}
24 |
25 |
26 |
27 |
28 |
29 |
--------------------------------------------------------------------------------
/docs/utils/date/dateFormat.vue:
--------------------------------------------------------------------------------
1 |
16 |
17 |
18 |
19 |
20 |
21 | {{ time1 }}
22 |
23 |
24 | {{ time2 }}
25 |
26 |
27 | {{ time3 }}
28 |
29 |
30 |
31 |
32 |
--------------------------------------------------------------------------------
/docs/hooks/useCopyToClipboard/input.vue:
--------------------------------------------------------------------------------
1 |
20 |
21 |
22 |
23 |
24 |
30 | 拷贝
31 |
32 |
33 |
34 |
--------------------------------------------------------------------------------
/docs/hooks/useWatermark/demo/wrap.vue:
--------------------------------------------------------------------------------
1 |
23 |
24 |
25 |
26 |
30 |
31 |
32 |
--------------------------------------------------------------------------------
/docs/components/typeit.ts:
--------------------------------------------------------------------------------
1 | import { h, defineComponent } from "vue";
2 | import TypeIt from "typeit";
3 |
4 | // 打字机效果组件
5 | export default defineComponent({
6 | name: "TypeIt",
7 | // 配置项参考 https://www.typeitjs.com/docs/vanilla/usage#options
8 | props: {
9 | /** 打字速度,以每一步之间的毫秒数为单位 */
10 | speed: {
11 | type: Number,
12 | default: 200
13 | },
14 | values: {
15 | type: Array,
16 | defalut: []
17 | },
18 | className: {
19 | type: String,
20 | default: "type-it"
21 | }
22 | },
23 | render() {
24 | return h(
25 | "span",
26 | {
27 | class: this.className
28 | },
29 | {
30 | default: () => []
31 | }
32 | );
33 | },
34 | mounted() {
35 | new TypeIt(`.${this.className}`, {
36 | strings: this.values,
37 | speed: this.speed,
38 | cursor: false
39 | }).go();
40 | }
41 | });
42 |
--------------------------------------------------------------------------------
/docs/public/table.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/docs/hooks/useECharts/demo/simple/gauge.vue:
--------------------------------------------------------------------------------
1 |
37 |
38 |
39 |
40 |
41 |
--------------------------------------------------------------------------------
/docs/public/github.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/docs/utils/array/swapOrder.vue:
--------------------------------------------------------------------------------
1 |
18 |
19 |
20 |
21 |
22 | 点击互换两个元素位置
23 |
24 | {{ arr }}
25 |
26 |
27 | {{ arr1 }}
28 |
29 |
30 | {{ arr2 }}
31 |
32 |
33 |
34 |
35 |
--------------------------------------------------------------------------------
/docs/utils/space/removeAllSpace.vue:
--------------------------------------------------------------------------------
1 |
10 |
11 |
12 |
13 |
14 | 原字符串:
15 |
20 |
21 |
22 |
23 | 转换后字符串:
24 |
25 |
26 |
27 |
28 |
29 | 点击去掉字符串全部空格
30 |
31 |
32 |
33 |
34 |
--------------------------------------------------------------------------------
/docs/utils/space/removeLeftSpace.vue:
--------------------------------------------------------------------------------
1 |
10 |
11 |
12 |
13 |
14 | 原字符串:
15 |
20 |
21 |
22 |
23 | 转换后字符串:
24 |
25 |
26 |
27 |
28 |
29 | 点击去掉字符串左边空格
30 |
31 |
32 |
33 |
34 |
--------------------------------------------------------------------------------
/docs/utils/space/removeRightSpace.vue:
--------------------------------------------------------------------------------
1 |
10 |
11 |
12 |
13 |
14 | 原字符串:
15 |
20 |
21 |
22 |
23 | 转换后字符串:
24 |
25 |
26 |
27 |
28 |
29 | 点击去掉字符串右边空格
30 |
31 |
32 |
33 |
34 |
--------------------------------------------------------------------------------
/docs/utils/device/getBrowserInfo.vue:
--------------------------------------------------------------------------------
1 |
14 |
15 |
16 |
17 |
18 |
19 | 当前浏览器型号:
20 |
21 | {{ browser }}
22 |
23 |
24 |
25 |
26 | 当前浏览器版本:
27 |
28 | {{ version }}
29 |
30 |
31 |
32 |
33 |
34 |
--------------------------------------------------------------------------------
/docs/utils/install/install.md:
--------------------------------------------------------------------------------
1 |
5 |
6 | ::: tip 仅用于`Vue3`
7 | 组件注册
8 | :::
9 |
10 | ## withInstall
11 |
12 | 向组件中添加 `install` 方法,使其既可以使用 `app.component` 注册又可以使用 `app.use` 安装,且无需考虑 `TypeScript` 类型
13 |
14 |
15 |
16 | 接收两个参数,第一个 `main`,第二个 `extra`
17 |
18 | | **参数属性** | **说明** |
19 | | ------------ | ---------------------------------------------- |
20 | | `main` | 主组件(第一个被注册的组件) |
21 | | `extra` | 额外组件,对象格式(会按照传入的先后顺序注册) |
22 |
23 |
24 |
25 | ::: info 提示信息
26 | 每个使用 `withInstall` 的组件都应该有个唯一 `name`,以便兼容各种场景。如果要在全局中使用,组件名需传 `name` 值
27 | :::
28 |
29 | ## withNoopInstall
30 |
31 | 向组件中添加空的`install`方法,接收一个参数 `component` 组件
32 |
33 | ::: info 使用场景
34 | 不希望组件自动注册,或者想要在控制注册时机和方式时提供灵活性。例如,想要在某些条件满足时才注册组件,或者已经有了注册逻辑的其他实现方式
35 | :::
36 |
--------------------------------------------------------------------------------
/docs/utils/space/removeBothSidesSpace.vue:
--------------------------------------------------------------------------------
1 |
10 |
11 |
12 |
13 |
14 | 原字符串:
15 |
20 |
21 |
22 |
23 | 转换后字符串:
24 |
25 |
26 |
27 |
28 |
29 | 点击去掉字符串左右两边空格
30 |
31 |
32 |
33 |
34 |
--------------------------------------------------------------------------------
/docs/utils/debounce/throttle.vue:
--------------------------------------------------------------------------------
1 |
18 |
19 |
20 |
21 |
22 |
23 | 连续点击我,每一秒只会执行一次点击事件
24 |
25 |
33 | 连续点击我,每一秒只会执行一次点击事件(可传参写法,不限制参数数量)
34 |
35 |
36 |
37 |
38 |
--------------------------------------------------------------------------------
/docs/utils/equal/isEqualObject.vue:
--------------------------------------------------------------------------------
1 |
9 |
10 |
11 |
12 |
13 |
14 | {{
15 | isEqualObject(obj1, obj2)
16 | ? `${JSON.stringify(obj1)} 等于 ${JSON.stringify(obj2)}`
17 | : `${JSON.stringify(obj1)} 不等于 ${JSON.stringify(obj2)}`
18 | }}
19 |
20 |
21 |
22 | {{
23 | isEqualObject(obj1, obj3)
24 | ? `${JSON.stringify(obj1)} 等于 ${JSON.stringify(obj3)}`
25 | : `${JSON.stringify(obj1)} 不等于 ${JSON.stringify(obj3)}`
26 | }}
27 |
28 |
29 |
30 |
31 |
--------------------------------------------------------------------------------
/playgrounds/vue-vite/src/components/HelloWorld.vue:
--------------------------------------------------------------------------------
1 |
8 |
9 |
10 | {{ msg }}
11 |
12 |
13 |
14 |
15 | Edit
16 | components/HelloWorld.vue to test HMR
17 |
18 |
19 |
20 |
21 | Check out
22 | create-vue, the official Vue + Vite starter
25 |
26 |
27 | Install
28 | Volar
29 | in your IDE for a better DX
30 |
31 | Click on the Vite and Vue logos to learn more
32 |
33 |
34 |
39 |
--------------------------------------------------------------------------------
/docs/hooks/useDraggable/naiveuiBase.vue:
--------------------------------------------------------------------------------
1 |
16 |
17 |
18 |
19 | 点击打开模态框
20 |
21 |
22 |
30 |
31 | 拖动我吧
32 |
33 | emm...不知道写点啥 🤷
34 |
35 |
36 |
37 |
38 |
39 |
--------------------------------------------------------------------------------
/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | "target": "ESNext",
4 | "module": "ESNext",
5 | "moduleResolution": "bundler",
6 | "strict": false,
7 | "jsx": "preserve",
8 | "importHelpers": true,
9 | "experimentalDecorators": true,
10 | "strictFunctionTypes": false,
11 | "skipLibCheck": true,
12 | "esModuleInterop": true,
13 | "isolatedModules": true,
14 | "allowSyntheticDefaultImports": true,
15 | "forceConsistentCasingInFileNames": true,
16 | "sourceMap": true,
17 | "baseUrl": ".",
18 | "allowJs": false,
19 | "resolveJsonModule": true,
20 | "lib": ["ESNext", "DOM"],
21 | "types": [
22 | "vitepress",
23 | "vite/client",
24 | "naive-ui/volar",
25 | "@vue-macros/reactivity-transform/macros-global"
26 | ]
27 | },
28 | "include": [
29 | "docs/**/*.ts",
30 | "docs/**/*.vue",
31 | "unocss.config.ts",
32 | "docs/.vitepress/**/*.ts"
33 | ],
34 | "exclude": ["dist", "node_modules", "docs/.vitepress/dist"]
35 | }
36 |
--------------------------------------------------------------------------------
/playgrounds/html/hooks/useWatermark.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 | useWatermark
9 |
10 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
40 |
41 |
42 |
43 |
--------------------------------------------------------------------------------
/docs/public/logo.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/docs/hooks/useECharts/demo/simple/candlestick.vue:
--------------------------------------------------------------------------------
1 |
40 |
41 |
42 |
43 |
44 |
--------------------------------------------------------------------------------
/docs/hooks/useResizeObserver/demo2.vue:
--------------------------------------------------------------------------------
1 |
20 |
21 |
22 |
25 | {{ `容器 width: ${divWidth}` }}
26 |
27 | {{ `容器 height: ${divHeight}` }}
28 |
29 |
30 |
31 |
40 |
--------------------------------------------------------------------------------
/docs/hooks/useDraggable/naiveuiDialog.vue:
--------------------------------------------------------------------------------
1 |
17 |
18 |
19 |
20 | 点击打开模态框
21 |
22 | 拖动我吧
23 |
24 |
naiveui:我暴露了足够的api,怎么会难用呢?🤔
25 |
二开疯子:确实,这下很多组件都能更好地二次封装了 😄
26 |
拷贝高手:好咧,赶紧动起来!👍
27 |
28 |
29 | 复位
30 | 关闭拖动
31 | 开启拖动
32 |
33 |
34 |
35 |
36 |
--------------------------------------------------------------------------------
/docs/components/description.vue:
--------------------------------------------------------------------------------
1 |
22 |
23 |
24 |
25 |
26 |
27 | {{ item }}
28 |
29 |
30 |
31 |
32 |
33 |
39 |
40 |
41 |
42 |
43 |
--------------------------------------------------------------------------------
/docs/utils/array/randomDivide.vue:
--------------------------------------------------------------------------------
1 |
24 |
25 |
26 |
27 |
28 | 点击随机分配
29 | 点击随机递增分配
30 | 点击随机递减分配
31 |
32 | {{ arr }}
33 |
34 | 和为:{{ sum(arr) }}
35 | 长度:{{ arr.length }}
36 |
37 |
38 |
39 |
--------------------------------------------------------------------------------
/docs/utils/url/url.md:
--------------------------------------------------------------------------------
1 |
8 |
9 | ::: tip 支持任意运行在浏览器的 `JavaScript` 语言
10 | 提取 `url` 中所有参数、获取当前的 `location` 信息
11 | :::
12 |
13 | ## getQueryMap
14 |
15 | 提取浏览器 `url` 中所有参数
16 |
17 |
18 |
19 | ####
{#base1}
20 |
21 |
22 |
23 |
24 |
25 | 查看代码
26 |
27 | <<< @/utils/url/getQueryMap.vue
28 |
29 |
30 |
31 | ####
{#param1}
32 |
33 | 接收一个参数 `url` ,返回值类型 `object`
34 |
35 | | **参数属性** | **说明** | **类型** |
36 | | ------------ | ---------- | -------- |
37 | | `url` | 超链接地址 | `string` |
38 |
39 |
40 |
41 | ## getLocation
42 |
43 | 获取浏览器当前的 `location` 信息
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 | 查看代码
52 |
53 | <<< @/utils/url/getLocation.vue
54 |
55 |
56 |
57 |
58 |
--------------------------------------------------------------------------------
/docs/utils/array/arrayAnyExist.vue:
--------------------------------------------------------------------------------
1 |
29 |
30 |
31 |
32 |
33 |
34 | {{ firstText }}
35 |
36 |
37 | {{ secondText }}
38 |
39 |
40 |
41 |
42 |
--------------------------------------------------------------------------------
/docs/utils/array/arrayAllExist.vue:
--------------------------------------------------------------------------------
1 |
29 |
30 |
31 |
32 |
33 |
34 | {{ firstText }}
35 |
36 |
37 | {{ secondText }}
38 |
39 |
40 |
41 |
42 |
--------------------------------------------------------------------------------
/docs/components/wordcloud/data.ts:
--------------------------------------------------------------------------------
1 | import { ref } from "vue";
2 | import { subBetween } from "@pureadmin/utils";
3 | import type { WorldCloudDataItem } from "../../.vitepress/plugins/wordcloud/index.d.ts"; // 路径要写完整,确保打包时引用正确
4 |
5 | const modules: any = import.meta.glob("../../{hooks,utils}/**/*.md", {
6 | eager: true
7 | });
8 |
9 | export function useData() {
10 | let utilsList = [];
11 | let hooksList = [];
12 | let dataList = ref([]);
13 |
14 | Object.keys(modules).forEach(v => {
15 | if (v.includes("/utils/")) utilsList.push(v);
16 | if (v.includes("/hooks/")) hooksList.push(v);
17 | });
18 |
19 | Object.keys(modules).map(key => {
20 | if (!modules[key].default?.name) return;
21 | dataList.value.push({
22 | name: subBetween(modules[key].default?.name, "/", "/"),
23 | value: 1
24 | });
25 | });
26 | dataList.value.push(
27 | { name: "Hooks", value: hooksList.length },
28 | { name: "Utils", value: utilsList.length }
29 | );
30 |
31 | return {
32 | data: dataList,
33 | hooksLen: hooksList.length,
34 | utilsLen: utilsList.length
35 | };
36 | }
37 |
--------------------------------------------------------------------------------
/docs/utils/array/isIncludeAllChildren.vue:
--------------------------------------------------------------------------------
1 |
28 |
29 |
30 |
31 |
32 |
33 | {{ firstText }}
34 |
35 |
36 | {{ secondText }}
37 |
38 |
39 |
40 |
41 |
--------------------------------------------------------------------------------
/docs/utils/base64Conver/convertImageToGray.vue:
--------------------------------------------------------------------------------
1 |
26 |
27 |
28 |
29 | 原彩色图片
30 |
31 |
![vueStr]()
32 |
![reactStr]()
33 |
34 | 转换后的灰色图片
35 |
36 |
![vueSvg]()
37 |
![reactPng]()
38 |
39 |
40 |
41 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2022-present, pure-admin
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/docs/utils/convertPath/convertPath.vue:
--------------------------------------------------------------------------------
1 |
8 |
9 |
10 |
11 |
12 |
13 |
14 | windows路径:{{ clone(path1) }}
15 |
16 |
17 |
18 | 转换后的路径:{{ convertPath(path1) }}
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 | windows路径:{{ clone(path2) }}
27 |
28 |
29 |
30 | 转换后的路径:{{ convertPath(path2) }}
31 |
32 |
33 |
34 |
35 |
36 |
--------------------------------------------------------------------------------
/playgrounds/vue-cli/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "vuecli-demo",
3 | "version": "0.0.0",
4 | "private": true,
5 | "scripts": {
6 | "dev": "vue-cli-service serve",
7 | "serve": "vue-cli-service serve",
8 | "build": "vue-cli-service build",
9 | "lint": "vue-cli-service lint"
10 | },
11 | "dependencies": {
12 | "@pureadmin/utils": "^2.1.1",
13 | "core-js": "^3.8.3",
14 | "vue": "^3.2.13"
15 | },
16 | "devDependencies": {
17 | "@babel/core": "^7.12.16",
18 | "@babel/eslint-parser": "^7.12.16",
19 | "@vue/cli-plugin-babel": "~5.0.0",
20 | "@vue/cli-plugin-eslint": "~5.0.0",
21 | "@vue/cli-service": "~5.0.0",
22 | "eslint": "^7.32.0",
23 | "eslint-plugin-vue": "^8.0.3"
24 | },
25 | "eslintConfig": {
26 | "root": true,
27 | "env": {
28 | "node": true
29 | },
30 | "extends": [
31 | "plugin:vue/vue3-essential",
32 | "eslint:recommended"
33 | ],
34 | "parserOptions": {
35 | "parser": "@babel/eslint-parser"
36 | },
37 | "rules": {}
38 | },
39 | "browserslist": [
40 | "> 1%",
41 | "last 2 versions",
42 | "not dead",
43 | "not ie 11"
44 | ]
45 | }
46 |
--------------------------------------------------------------------------------
/playgrounds/preact/public/vite.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/playgrounds/react/public/vite.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/playgrounds/svelte/public/vite.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/playgrounds/vue-vite/public/vite.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/docs/hooks/useECharts/demo/simple/bar.vue:
--------------------------------------------------------------------------------
1 |
53 |
54 |
55 |
56 |
57 |
--------------------------------------------------------------------------------
/docs/hooks/useECharts/demo/simple/line.vue:
--------------------------------------------------------------------------------
1 |
50 |
51 |
52 |
53 |
54 |
--------------------------------------------------------------------------------
/docs/hooks/useECharts/demo/simple/radar.vue:
--------------------------------------------------------------------------------
1 |
52 |
53 |
54 |
55 |
56 |
--------------------------------------------------------------------------------
/docs/utils/base64Conver/urlToBase64.vue:
--------------------------------------------------------------------------------
1 |
22 |
23 |
24 |
25 |
26 |
本地图片转base64
27 |
![base64Url]()
35 |
36 |
37 |
38 | 在线图片url转base64
39 |
40 |
![base64OnLineUrl]()
48 |
49 |
50 |
51 |
--------------------------------------------------------------------------------
/docs/hooks/useGlobal/useGlobal.md:
--------------------------------------------------------------------------------
1 |
4 |
5 | # useGlobal
6 |
7 | ::: tip 适用于 `Vue3`、`Nuxt3`、`HTML`
8 | 获取已经注册的全局属性对象 [globalProperties](https://cn.vuejs.org/api/application.html#app-config-globalproperties)
9 | :::
10 |
11 | `useGlobal`只做两件事,第一快速提取`globalProperties`,第二更方便、明确的类型提示
12 |
13 | #### 既然想获取全局`globalProperties`,肯定要先注册它呀(第一步)
14 |
15 | ::: code-group
16 |
17 | ```ts [Vue3]
18 | // main.ts
19 | import { type App, createApp } from "vue";
20 | import App from "./App.vue";
21 |
22 | import * as echarts from "echarts";
23 |
24 | const app = createApp(App);
25 | // 这里我们就以注册$echarts为例
26 | app.config.globalProperties.$echarts = echarts;
27 |
28 | app.mount("#app");
29 | ```
30 |
31 | ```ts [Nuxt3]
32 | // plugins/config.ts
33 | import * as echarts from "echarts";
34 |
35 | export default defineNuxtPlugin(nuxtApp => {
36 | // 这里我们就以注册$echarts为例
37 | nuxtApp.vueApp.config.globalProperties.$echarts = echarts;
38 | });
39 | ```
40 |
41 | :::
42 |
43 | #### 全局类型声明(第二步)
44 |
45 | <<< ../../global.d.ts
46 |
47 | #### 在组件中使用它(第三步即最后一步)
48 |
49 | <<< @/hooks/useGlobal/demo.vue
50 |
51 | ##### 获得类型提示,如下图
52 |
53 |
54 |
55 | ##### 获得实例的属性和方法,如下图
56 |
57 |
58 |
--------------------------------------------------------------------------------
/docs/utils/storage/storage.md:
--------------------------------------------------------------------------------
1 |
8 |
9 | ::: tip 支持任意运行在浏览器的 `JavaScript` 语言
10 | 本地存储
11 | :::
12 |
13 | ## storageLocal
14 |
15 | 处理 `localStorage`
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 | 查看代码
24 |
25 | <<< @/utils/storage/storageLocal.vue
26 |
27 |
28 |
29 |
30 |
31 | ## storageSession
32 |
33 | 处理 `sessionStorage`
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 | 查看代码
42 |
43 | <<< @/utils/storage/storageSession.vue
44 |
45 |
46 |
47 |
48 |
49 | ## 通用方法
50 |
51 | | **方法名** | **说明** | **参数** |
52 | | ------------ | ----------------------------- | -------------------------- |
53 | | `setItem` | 储存对应键名的 `Storage` 对象 | `k` (键名), `v` (键值) |
54 | | `getItem` | 获取对应键名的 `Storage` 对象 | `k` (键名) |
55 | | `removeItem` | 删除对应键名的 `Storage` 对象 | `k` (键名) |
56 | | `clear` | 删除此域的所有 `Storage` 对象 | |
57 |
--------------------------------------------------------------------------------
/playgrounds/next/public/next.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/docs/utils/array/arrayAllExistDeep.vue:
--------------------------------------------------------------------------------
1 |
39 |
40 |
41 |
42 |
43 |
44 | {{ firstText }}
45 |
46 |
47 | {{ secondText }}
48 |
49 |
50 |
51 |
52 |
--------------------------------------------------------------------------------
/docs/hooks/useECharts/demo/simple/scatter.vue:
--------------------------------------------------------------------------------
1 |
52 |
53 |
54 |
55 |
56 |
--------------------------------------------------------------------------------
/docs/components/theme.vue:
--------------------------------------------------------------------------------
1 |
37 |
38 |
39 |
44 |
45 |
46 |
47 |
--------------------------------------------------------------------------------
/docs/utils/array/arrayAnyExistDeep.vue:
--------------------------------------------------------------------------------
1 |
39 |
40 |
41 |
42 |
43 |
44 | {{ firstText }}
45 |
46 |
47 | {{ secondText }}
48 |
49 |
50 |
51 |
52 |
--------------------------------------------------------------------------------
/playgrounds/preact/src/assets/preact.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/docs/utils/nameTransform/nameTransform.md:
--------------------------------------------------------------------------------
1 |
8 |
9 | ::: tip 支持任意 `JavaScript` 环境或框架
10 | 横线、驼峰命名互转
11 | :::
12 |
13 | ## nameCamelize
14 |
15 | 横线转驼峰命名
16 |
17 |
18 |
19 | ####
{#base1}
20 |
21 |
22 |
23 |
24 |
25 | 查看代码
26 |
27 | <<< @/utils/nameTransform/nameCamelize.vue
28 |
29 |
30 |
31 | ####
{#param1}
32 |
33 | 接收一个参数 `str` ,返回值类型 `string`
34 |
35 | | **参数属性** | **说明** | **类型** |
36 | | ------------ | -------- | -------- |
37 | | `str` | 字符串 | `string` |
38 |
39 |
40 |
41 | ## nameHyphenate
42 |
43 | 驼峰命名转横线命名:拆分字符串,使用 `-` 相连,并且全部转换为小写
44 |
45 |
46 |
47 | ####
{#base2}
48 |
49 |
50 |
51 |
52 |
53 | 查看代码
54 |
55 | <<< @/utils/nameTransform/nameHyphenate.vue
56 |
57 |
58 |
59 | ####
{#param2}
60 |
61 | 接收一个参数 `str` ,返回值类型 `string`
62 |
63 | | **参数属性** | **说明** | **类型** |
64 | | ------------ | -------- | -------- |
65 | | `str` | 字符串 | `string` |
66 |
67 |
68 |
--------------------------------------------------------------------------------
/docs/utils/link/link.md:
--------------------------------------------------------------------------------
1 |
7 |
8 | ::: tip 支持任意运行在浏览器的 `JavaScript` 语言
9 | 超链接
10 | :::
11 |
12 | ## openLink
13 |
14 | 创建超链接
15 |
16 |
17 |
18 | ####
{#base1}
19 |
20 |
21 |
22 |
23 |
24 | 查看代码
25 |
26 | <<< @/utils/link/link.vue
27 |
28 |
29 |
30 | ####
{#param1}
31 |
32 | 接收两个参数,第一个参数 `href` ,第二个参数 `target` ,无返回值
33 |
34 | | **参数属性** | **说明** | **类型** | **默认值** |
35 | | ------------ | ---------------------------------------- | -------- | ---------- |
36 | | `href` | 要跳转的超链接地址 | `string` | |
37 | | `target` | 拥有五个属性,具体看下面的 `target` 详情 | `Target` | `_blank` |
38 |
39 | ####
{#target1}
40 |
41 | | **参数属性** | **说明** |
42 | | ------------ | ---------------------------------- |
43 | | _\_blank_ | _在新窗口中打开被链接文档(默认)_ |
44 | | _\_self_ | _在相同的框架中打开被链接文档_ |
45 | | _\_parent_ | _在父框架集中打开被链接文档_ |
46 | | _\_top_ | _在整个窗口中打开被链接文档_ |
47 | | _framename_ | _在指定的框架中打开被链接文档_ |
48 |
49 | ### 类型声明
50 |
51 | <<< @/utils/link/types/openLink.ts
52 |
53 |
54 |
--------------------------------------------------------------------------------
/docs/utils/amount/priceToThousands.vue:
--------------------------------------------------------------------------------
1 |
4 |
5 |
6 |
7 |
8 |
9 | 123456789 格式化
10 |
11 | {{ priceToThousands(123456789) }}
12 |
13 |
14 |
15 | 123456789 格式化并保留两位小数
16 |
17 | {{ priceToThousands(123456789, { digit: 2 }) }}
18 |
19 |
20 |
21 | 123456789.567 格式化并保留两位小数
22 |
23 | {{ priceToThousands(123456789.567, { digit: 2 }) }}
24 |
25 |
26 |
27 | 123456789.567 格式化并保留两位小数且小数位进行四舍五入
28 |
29 | {{ priceToThousands(123456789.567, { digit: 2, round: true }) }}
30 |
31 |
32 |
33 | 123456789.567 格式化并保留五位小数
34 |
35 | {{ priceToThousands(123456789.567, { digit: 5 }) }}
36 |
37 |
38 |
39 |
40 |
41 |
--------------------------------------------------------------------------------
/docs/hooks/useWatermark/demo/image.vue:
--------------------------------------------------------------------------------
1 |
35 |
36 |
37 |
38 |
42 | 来个灰色版咯
43 |
47 |
48 |
49 |
--------------------------------------------------------------------------------
/docs/hooks/useResizeObserver/demo1.vue:
--------------------------------------------------------------------------------
1 |
26 |
27 |
28 |
29 |
30 | {{
31 | isOpen ? "停止监听" : "启用监听"
32 | }}
33 |
34 |
39 |
40 |
41 |
42 |
54 |
--------------------------------------------------------------------------------
/docs/hooks/useECharts/demo/business/customTheme.vue:
--------------------------------------------------------------------------------
1 |
56 |
57 |
58 |
59 |
60 |
--------------------------------------------------------------------------------
/docs/.vitepress/plugins/wordcloud/WordCloudSeries.js:
--------------------------------------------------------------------------------
1 | import * as echarts from "echarts";
2 |
3 | echarts.extendSeriesModel({
4 | type: "series.wordCloud",
5 |
6 | visualStyleAccessPath: "textStyle",
7 | visualStyleMapper: function (model) {
8 | return {
9 | fill: model.get("color")
10 | };
11 | },
12 | visualDrawType: "fill",
13 |
14 | optionUpdated: function () {
15 | var option = this.option;
16 | option.gridSize = Math.max(Math.floor(option.gridSize), 4);
17 | },
18 |
19 | getInitialData: function (option, ecModel) {
20 | var dimensions = echarts.helper.createDimensions(option.data, {
21 | coordDimensions: ["value"]
22 | });
23 | var list = new echarts.List(dimensions, this);
24 | list.initData(option.data);
25 | return list;
26 | },
27 |
28 | // Most of options are from https://github.com/timdream/wordcloud2.js/blob/gh-pages/API.md
29 | defaultOption: {
30 | maskImage: null,
31 |
32 | // Shape can be 'circle', 'cardioid', 'diamond', 'triangle-forward', 'triangle', 'pentagon', 'star'
33 | shape: "circle",
34 | keepAspect: false,
35 |
36 | left: "center",
37 |
38 | top: "center",
39 |
40 | width: "70%",
41 |
42 | height: "80%",
43 |
44 | sizeRange: [12, 60],
45 |
46 | rotationRange: [-90, 90],
47 |
48 | rotationStep: 45,
49 |
50 | gridSize: 8,
51 |
52 | drawOutOfBound: false,
53 | shrinkToFit: false,
54 |
55 | textStyle: {
56 | fontWeight: "normal"
57 | }
58 | }
59 | });
60 |
--------------------------------------------------------------------------------
/playgrounds/preact/src/index.css:
--------------------------------------------------------------------------------
1 | :root {
2 | font-family: Inter, Avenir, Helvetica, Arial, sans-serif;
3 | font-size: 16px;
4 | line-height: 24px;
5 | font-weight: 400;
6 |
7 | color-scheme: light dark;
8 | color: rgba(255, 255, 255, 0.87);
9 | background-color: #242424;
10 |
11 | font-synthesis: none;
12 | text-rendering: optimizeLegibility;
13 | -webkit-font-smoothing: antialiased;
14 | -moz-osx-font-smoothing: grayscale;
15 | -webkit-text-size-adjust: 100%;
16 | }
17 |
18 | a {
19 | font-weight: 500;
20 | color: #646cff;
21 | text-decoration: inherit;
22 | }
23 | a:hover {
24 | color: #535bf2;
25 | }
26 |
27 | body {
28 | margin: 0;
29 | display: flex;
30 | place-items: center;
31 | min-width: 320px;
32 | min-height: 100vh;
33 | }
34 |
35 | h1 {
36 | font-size: 3.2em;
37 | line-height: 1.1;
38 | }
39 |
40 | button {
41 | border-radius: 8px;
42 | border: 1px solid transparent;
43 | padding: 0.6em 1.2em;
44 | font-size: 1em;
45 | font-weight: 500;
46 | font-family: inherit;
47 | background-color: #1a1a1a;
48 | cursor: pointer;
49 | transition: border-color 0.25s;
50 | }
51 | button:hover {
52 | border-color: #646cff;
53 | }
54 | button:focus,
55 | button:focus-visible {
56 | outline: 4px auto -webkit-focus-ring-color;
57 | }
58 |
59 | @media (prefers-color-scheme: light) {
60 | :root {
61 | color: #213547;
62 | background-color: #ffffff;
63 | }
64 | a:hover {
65 | color: #747bff;
66 | }
67 | button {
68 | background-color: #f9f9f9;
69 | }
70 | }
71 |
--------------------------------------------------------------------------------
/playgrounds/react/src/index.css:
--------------------------------------------------------------------------------
1 | :root {
2 | font-family: Inter, Avenir, Helvetica, Arial, sans-serif;
3 | font-size: 16px;
4 | line-height: 24px;
5 | font-weight: 400;
6 |
7 | color-scheme: light dark;
8 | color: rgba(255, 255, 255, 0.87);
9 | background-color: #242424;
10 |
11 | font-synthesis: none;
12 | text-rendering: optimizeLegibility;
13 | -webkit-font-smoothing: antialiased;
14 | -moz-osx-font-smoothing: grayscale;
15 | -webkit-text-size-adjust: 100%;
16 | }
17 |
18 | a {
19 | font-weight: 500;
20 | color: #646cff;
21 | text-decoration: inherit;
22 | }
23 | a:hover {
24 | color: #535bf2;
25 | }
26 |
27 | body {
28 | margin: 0;
29 | display: flex;
30 | place-items: center;
31 | min-width: 320px;
32 | min-height: 100vh;
33 | }
34 |
35 | h1 {
36 | font-size: 3.2em;
37 | line-height: 1.1;
38 | }
39 |
40 | button {
41 | border-radius: 8px;
42 | border: 1px solid transparent;
43 | padding: 0.6em 1.2em;
44 | font-size: 1em;
45 | font-weight: 500;
46 | font-family: inherit;
47 | background-color: #1a1a1a;
48 | cursor: pointer;
49 | transition: border-color 0.25s;
50 | }
51 | button:hover {
52 | border-color: #646cff;
53 | }
54 | button:focus,
55 | button:focus-visible {
56 | outline: 4px auto -webkit-focus-ring-color;
57 | }
58 |
59 | @media (prefers-color-scheme: light) {
60 | :root {
61 | color: #213547;
62 | background-color: #ffffff;
63 | }
64 | a:hover {
65 | color: #747bff;
66 | }
67 | button {
68 | background-color: #f9f9f9;
69 | }
70 | }
71 |
--------------------------------------------------------------------------------
/docs/hooks/useECharts/demo/simple/pie.vue:
--------------------------------------------------------------------------------
1 |
60 |
61 |
62 |
63 |
64 |
--------------------------------------------------------------------------------
/docs/components/index.ts:
--------------------------------------------------------------------------------
1 | import dividerBase from "./divider/base.vue";
2 | import dividerOptions from "./divider/options.vue";
3 | import dividerParam from "./divider/param.vue";
4 | import dividerTarget from "./divider/target.vue";
5 | import dividerType from "./divider/type.vue";
6 | import dividerUse from "./divider/use.vue";
7 | import naiveTheme from "./theme.vue";
8 | import description from "./description.vue";
9 | import visualLoad from "./visual-load.vue";
10 | import wordcloud from "./wordcloud/index.vue";
11 | import descriptionPopover from "./description-popover.vue";
12 | import previewImage from "./preview-image.vue";
13 | import themeChange from "./theme-change.vue";
14 | import layout from "./layout.vue";
15 |
16 | const DividerBase = dividerBase;
17 | const DividerOptions = dividerOptions;
18 | const DividerParam = dividerParam;
19 | const DividerTarget = dividerTarget;
20 | const DividerType = dividerType;
21 | const DividerUse = dividerUse;
22 | const NaiveTheme = naiveTheme;
23 | const Description = description;
24 | const VisualLoad = visualLoad;
25 | const Wordcloud = wordcloud;
26 | const DescriptionPopover = descriptionPopover;
27 | const PreviewImage = previewImage;
28 | const ThemeChange = themeChange;
29 | const Layout = layout;
30 |
31 | export {
32 | DividerBase,
33 | DividerOptions,
34 | DividerParam,
35 | DividerTarget,
36 | DividerType,
37 | DividerUse,
38 | NaiveTheme,
39 | Description,
40 | VisualLoad,
41 | Wordcloud,
42 | DescriptionPopover,
43 | PreviewImage,
44 | ThemeChange,
45 | Layout
46 | };
47 |
--------------------------------------------------------------------------------
/playgrounds/solid/src/logo.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/playgrounds/html/hooks/useDark.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 | useDark
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
{{ isDark ? 'dark' : '非dark' }}
23 |
25 |
26 |
27 |
28 |
45 |
46 |
47 |
48 |
--------------------------------------------------------------------------------
/docs/utils/packageSize/packageSize.md:
--------------------------------------------------------------------------------
1 |
5 |
6 | ::: tip 支持任意运行在 `Node` 的 `JavaScript` 语言
7 | 计算包的大小
8 | :::
9 |
10 | ## getPackageSize
11 |
12 | 获取指定文件夹中所有文件的总大小
13 |
14 |
15 |
16 | ####
{#use1}
17 |
18 | [demo1](https://github.com/pure-admin/vue-pure-admin/blob/main/build/info.ts#L37)、[demo2](https://github.com/pure-admin/pure-admin-release/blob/main/src/index.ts#L56)
19 |
20 | ####
{#param1}
21 |
22 | 接收一个参数 `options`
23 |
24 | | **参数属性** | **说明** | **类型** |
25 | | ------------ | ----------------------------------------- | ------------ |
26 | | `options` | 拥有三个属性,具体看下面的 `options` 详情 | `packageOpt` |
27 |
28 | ####
{#options1}
29 |
30 | | **参数属性** | **说明** | **类型** | **默认值** |
31 | | ------------ | ---------------------------------------------------------------------- | ------------------ | ---------- |
32 | | `folder` | 文件夹名 | `string` | `dist` |
33 | | `format` | 是否返回已经转化好单位的包总大小 (通过下面的 `formatBytes` 函数转化) | `boolean` | `true` |
34 | | `callback` | 回调函数,返回包总大小(单位:字节) | `CallableFunction` | |
35 |
36 | ####
{#type1}
37 |
38 | <<< @/utils/packageSize/types/getPackageSize.ts
39 |
40 |
41 |
--------------------------------------------------------------------------------
/docs/hooks/useECharts/demo/simple/sankey.vue:
--------------------------------------------------------------------------------
1 |
57 |
58 |
59 |
60 |
61 |
--------------------------------------------------------------------------------
/docs/utils/debounce/debounce.vue:
--------------------------------------------------------------------------------
1 |
29 |
30 |
31 |
32 |
33 |
34 | 连续点击我,只会执行第一次点击事件,立即执行
35 |
36 |
44 | 连续点击我,只会执行第一次点击事件,立即执行(可传参写法,不限制参数数量)
45 |
46 |
47 | 连续点击我,只会执行最后一次点击事件,延后执行
48 |
49 |
57 | 连续点击我,只会执行最后一次点击事件,延后执行(可传参写法,不限制参数数量)
58 |
59 |
60 |
61 |
62 |
--------------------------------------------------------------------------------
/docs/utils/color/randomGradient.vue:
--------------------------------------------------------------------------------
1 |
8 |
9 |
10 |
11 |
12 |
22 | 随机生成渐变色
23 |
24 |
25 | {{ color }}
26 |
27 |
28 |
29 |
30 |
34 |
35 |
39 | 渐变背景、边框、文字
40 |
41 |
42 |
43 |
44 |
45 |
59 |
--------------------------------------------------------------------------------
/playgrounds/vue-vite/src/style.css:
--------------------------------------------------------------------------------
1 | :root {
2 | font-family: Inter, system-ui, Avenir, Helvetica, Arial, sans-serif;
3 | line-height: 1.5;
4 | font-weight: 400;
5 |
6 | color-scheme: light dark;
7 | color: rgba(255, 255, 255, 0.87);
8 | background-color: #242424;
9 |
10 | font-synthesis: none;
11 | text-rendering: optimizeLegibility;
12 | -webkit-font-smoothing: antialiased;
13 | -moz-osx-font-smoothing: grayscale;
14 | }
15 |
16 | a {
17 | font-weight: 500;
18 | color: #646cff;
19 | text-decoration: inherit;
20 | }
21 | a:hover {
22 | color: #535bf2;
23 | }
24 |
25 | body {
26 | margin: 0;
27 | display: flex;
28 | place-items: center;
29 | min-width: 320px;
30 | min-height: 100vh;
31 | }
32 |
33 | h1 {
34 | font-size: 3.2em;
35 | line-height: 1.1;
36 | }
37 |
38 | button {
39 | border-radius: 8px;
40 | border: 1px solid transparent;
41 | padding: 0.6em 1.2em;
42 | font-size: 1em;
43 | font-weight: 500;
44 | font-family: inherit;
45 | background-color: #1a1a1a;
46 | cursor: pointer;
47 | transition: border-color 0.25s;
48 | }
49 | button:hover {
50 | border-color: #646cff;
51 | }
52 | button:focus,
53 | button:focus-visible {
54 | outline: 4px auto -webkit-focus-ring-color;
55 | }
56 |
57 | .card {
58 | padding: 2em;
59 | }
60 |
61 | #app {
62 | max-width: 1280px;
63 | margin: 0 auto;
64 | padding: 2rem;
65 | text-align: center;
66 | }
67 |
68 | @media (prefers-color-scheme: light) {
69 | :root {
70 | color: #213547;
71 | background-color: #ffffff;
72 | }
73 | a:hover {
74 | color: #747bff;
75 | }
76 | button {
77 | background-color: #f9f9f9;
78 | }
79 | }
80 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # Created by .ignore support plugin (hsz.mobi)
2 | ### Node template
3 | # Logs
4 | logs
5 | *.log
6 | npm-debug.log*
7 | yarn-debug.log*
8 | yarn-error.log*
9 |
10 | # Runtime data
11 | pids
12 | *.pid
13 | *.seed
14 | *.pid.lock
15 |
16 | # Directory for instrumented libs generated by jscoverage/JSCover
17 | lib-cov
18 |
19 | # Coverage directory used by tools like istanbul
20 | coverage
21 |
22 | # nyc test coverage
23 | .nyc_output
24 |
25 | # Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
26 | .grunt
27 |
28 | # Bower dependency directory (https://bower.io/)
29 | bower_components
30 |
31 | # node-waf configuration
32 | .lock-wscript
33 |
34 | # Compiled binary addons (https://nodejs.org/api/addons.html)
35 | build/Release
36 |
37 | # Dependency directories
38 | node_modules/
39 | jspm_packages/
40 |
41 | # TypeScript v1 declaration files
42 | typings/
43 |
44 | # Optional npm cache directory
45 | .npm
46 |
47 | # Optional eslint cache
48 | .eslintcache
49 |
50 | # Optional REPL history
51 | .node_repl_history
52 |
53 | # Output of 'npm pack'
54 | *.tgz
55 |
56 | # Yarn Integrity file
57 | .yarn-integrity
58 |
59 | # dotenv environment variables file
60 | .env
61 |
62 | # parcel-bundler cache (https://parceljs.org/)
63 | .cache
64 |
65 | # next.js build output
66 | .next
67 |
68 | # nuxt.js build output
69 | .nuxt
70 |
71 | # Nuxt generate
72 | dist
73 |
74 | # vuepress build output
75 | .vuepress/dist
76 | docs/.vitepress/dist
77 | docs/.vitepress/.temp
78 |
79 | # Serverless directories
80 | .serverless
81 |
82 | # IDE
83 | .idea
84 |
85 | .DS_Store
86 | docs/.vitepress/cache
87 | docs/dev-dist
88 |
89 | config.*.timestamp*
--------------------------------------------------------------------------------
/playgrounds/svelte/src/app.css:
--------------------------------------------------------------------------------
1 | :root {
2 | font-family: Inter, Avenir, Helvetica, Arial, sans-serif;
3 | font-size: 16px;
4 | line-height: 24px;
5 | font-weight: 400;
6 |
7 | color-scheme: light dark;
8 | color: rgba(255, 255, 255, 0.87);
9 | background-color: #242424;
10 |
11 | font-synthesis: none;
12 | text-rendering: optimizeLegibility;
13 | -webkit-font-smoothing: antialiased;
14 | -moz-osx-font-smoothing: grayscale;
15 | -webkit-text-size-adjust: 100%;
16 | }
17 |
18 | a {
19 | font-weight: 500;
20 | color: #646cff;
21 | text-decoration: inherit;
22 | }
23 | a:hover {
24 | color: #535bf2;
25 | }
26 |
27 | body {
28 | margin: 0;
29 | display: flex;
30 | place-items: center;
31 | min-width: 320px;
32 | min-height: 100vh;
33 | }
34 |
35 | h1 {
36 | font-size: 3.2em;
37 | line-height: 1.1;
38 | }
39 |
40 | .card {
41 | padding: 2em;
42 | }
43 |
44 | #app {
45 | max-width: 1280px;
46 | margin: 0 auto;
47 | padding: 2rem;
48 | text-align: center;
49 | }
50 |
51 | button {
52 | border-radius: 8px;
53 | border: 1px solid transparent;
54 | padding: 0.6em 1.2em;
55 | font-size: 1em;
56 | font-weight: 500;
57 | font-family: inherit;
58 | background-color: #1a1a1a;
59 | cursor: pointer;
60 | transition: border-color 0.25s;
61 | }
62 | button:hover {
63 | border-color: #646cff;
64 | }
65 | button:focus,
66 | button:focus-visible {
67 | outline: 4px auto -webkit-focus-ring-color;
68 | }
69 |
70 | @media (prefers-color-scheme: light) {
71 | :root {
72 | color: #213547;
73 | background-color: #ffffff;
74 | }
75 | a:hover {
76 | color: #747bff;
77 | }
78 | button {
79 | background-color: #f9f9f9;
80 | }
81 | }
82 |
--------------------------------------------------------------------------------
/playgrounds/svelte/src/assets/svelte.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/docs/utils/clone/clone.vue:
--------------------------------------------------------------------------------
1 |
26 |
27 |
28 |
29 |
30 |
浅拷贝(基本数据类型)
31 |
32 | 拷贝数据改变:
33 |
34 | {{ copyArr1 }}
35 |
36 | 原数据不变:
37 |
38 | {{ arr1 }}
39 |
40 |
41 |
42 |
浅拷贝(引用数据类型)
43 |
44 | 拷贝数据改变:
45 |
46 | {{ copyArr2 }}
47 |
48 | 原数据改变:
49 |
50 | {{ arr2 }}
51 |
52 |
53 |
54 |
深拷贝
55 |
56 | 拷贝数据改变:
57 |
58 | {{ copyArr3 }}
59 |
60 | 原数据不变:
61 |
62 | {{ arr3 }}
63 |
64 |
65 |
66 |
67 |
68 |
--------------------------------------------------------------------------------
/docs/hooks/useECharts/demo/simple/sunburst.vue:
--------------------------------------------------------------------------------
1 |
74 |
75 |
76 |
77 |
78 |
--------------------------------------------------------------------------------
/docs/utils/mouseEvent/mouseEvent.md:
--------------------------------------------------------------------------------
1 |
8 |
9 | ::: tip 支持任意运行在浏览器的 `JavaScript` 语言
10 | 禁止、允许指定的鼠标事件
11 | :::
12 |
13 | ## banMouseEvent
14 |
15 | 禁止指定的鼠标事件
16 |
17 |
18 |
19 | ####
{#base1}
20 |
21 |
22 |
23 |
24 |
25 | 查看代码
26 |
27 | <<< @/utils/mouseEvent/banMouseEvent.vue
28 |
29 |
30 |
31 | ####
{#param1}
32 |
33 | 接收一个参数 `eventList` ,无返回值
34 |
35 | | **参数属性** | **说明** | **类型** |
36 | | ------------ | ------------------------------------------------------------------------ | ------------------- |
37 | | `eventList` | 鼠标事件( `contextmenu` :右键、 `selectstart` :选择、 `copy` :拷贝) | `Array
` |
38 |
39 |
40 |
41 | ## allowMouseEvent
42 |
43 | 允许指定的鼠标事件
44 |
45 |
46 |
47 | ####
{#base2}
48 |
49 |
50 |
51 |
52 |
53 | 查看代码
54 |
55 | <<< @/utils/mouseEvent/allowMouseEvent.vue
56 |
57 |
58 |
59 | ####
{#param2}
60 |
61 | 接收一个参数 `eventList` ,无返回值
62 |
63 | | **参数属性** | **说明** | **类型** |
64 | | ------------ | ------------------------------------------------------------------------ | ------------------- |
65 | | `eventList` | 鼠标事件( `contextmenu` :右键、 `selectstart` :选择、 `copy` :拷贝) | `Array
` |
66 |
67 |
68 |
--------------------------------------------------------------------------------
/docs/.vitepress/theme/style/code.css:
--------------------------------------------------------------------------------
1 | /* Color scheme */
2 | html .vp-doc {
3 | --vt-code-comment: #a0ada0;
4 | --vt-code-punctuation: #8e8f8b;
5 | --vt-code-attribute: #429988;
6 | --vt-code-constant: #a65e2b;
7 | --vt-code-keyword: #1c6b48;
8 | --vt-code-variable: #c2b36e;
9 |
10 | --vt-code-string: #b56959;
11 | --vt-code-boolean: #1c6b48;
12 | --vt-code-number: #296aa3;
13 | --vt-code-entity: #2993a3;
14 | --vt-code-function-name: #6c7834;
15 | --vt-code-function: #6c7834;
16 |
17 | --vt-code-inserted: #1c6b48;
18 | --vt-code-deleted: #a14f55;
19 |
20 | /* --vp-code-line-number-color: red; */
21 |
22 | --pure-table-border-color: rgba(239, 239, 245, 1);
23 | }
24 |
25 | html.dark .vp-doc {
26 | --vt-code-comment: #758575;
27 | --vt-code-punctuation: #8e8f8b;
28 | --vt-code-attribute: #2f8a89;
29 | --vt-code-constant: #a65e2b;
30 | --vt-code-keyword: #4d9375;
31 | --vt-code-variable: #c2b36e;
32 |
33 | --vt-code-string: #d48372;
34 | --vt-code-boolean: #1c6b48;
35 | --vt-code-number: #6394bf;
36 | --vt-code-entity: #54b1bf;
37 | --vt-code-function-name: #a1b567;
38 | --vt-code-function: #a1b567;
39 |
40 | --vt-code-inserted: #4d9375;
41 | --vt-code-deleted: #bc6066;
42 |
43 | /* --vp-code-line-number-color: green; */
44 |
45 | --pure-table-border-color: rgba(45, 45, 48, 1);
46 | }
47 |
48 | /* Overrides */
49 | :not(pre) > code {
50 | padding: 1px 6px;
51 | border-radius: 3px;
52 | }
53 |
54 | a > code {
55 | color: var(--vt-c-brand) !important;
56 | }
57 |
58 | /* .vp-doc [class*="language-"] pre {
59 | padding: 24px;
60 | } */
61 |
62 | /* .vp-doc div[class*="language-"] {
63 | background: #fafafa;
64 | } */
65 |
66 | /* html.dark .vp-doc div[class*="language-"] {
67 | background: #1d1d1d;
68 | } */
69 |
--------------------------------------------------------------------------------
/docs/guide/guide.md:
--------------------------------------------------------------------------------
1 |
5 |
6 |
10 |
11 |
16 |
17 | ### 📦 安装
18 |
19 | ::: code-group
20 |
21 | ```bash [pnpm]
22 | pnpm add @pureadmin/utils
23 | ```
24 |
25 | ```bash [yarn]
26 | yarn add @pureadmin/utils
27 | ```
28 |
29 | ```bash [npm]
30 | npm install @pureadmin/utils
31 | ```
32 |
33 | :::
34 |
35 | ### 📡 `CDN`
36 |
37 | ::: code-group
38 |
39 | ```html [jsdelivr]
40 |
41 |
42 | ```
43 |
44 | ```html [unpkg]
45 |
46 |
47 | ```
48 |
49 | :::
50 |
51 | ### 📚 示例
52 |
53 | 集成 `vue-vite`、`vue-cli`、`preact`、`react`、`solid`、`svelte`、`nuxt3`、`next`、`node`、`html` 使用示例
54 |
55 | [查看示例代码](https://github.com/pure-admin/pure-admin-utils-docs/tree/master/playgrounds)
56 |
57 | 我们为`nuxt3`提供了所有`hooks`示例
58 | [代码仓库](https://github.com/pure-admin/pure-admin-utils-nuxt3) [在线预览](https://pure-admin.github.io/pure-admin-utils-nuxt3/)
59 |
60 | ### 🤔 常见问题、反馈
61 |
62 | 问题:如果自己项目中的函数与 `@pureadmin/utils` 内部的函数名称冲突怎么办?
63 | 答:这种问题很常见,可以使用 `ES6` 提供的 `as` 关键字来为导入的函数重命名,如下:
64 |
65 | ```ts
66 | import { cloneDeep as _cloneDeep } from "@pureadmin/utils";
67 | _cloneDeep();
68 | ```
69 |
70 | [反馈问题、新增需求](https://github.com/pure-admin/pure-admin-utils-docs/issues/new)
71 |
72 | ### 🔔 温馨提示
73 |
74 | 本站大部分图片使用`Github`静态资源。如遇加载空白或加载图片失败时,刷新几次即可
75 |
--------------------------------------------------------------------------------
/docs/utils/substring/hideTextAtIndex.vue:
--------------------------------------------------------------------------------
1 |
10 |
11 |
12 |
13 |
14 | 姓名:{{ oname }}
15 |
16 | 隐藏后的姓名:{{ hideTextAtIndex(oname, 1) }}
17 |
18 |
19 |
20 |
21 | 姓名:{{ name }}
22 |
23 | 隐藏后的姓名:{{ hideTextAtIndex(name, [1, 2]) }}
24 |
25 |
26 |
27 |
28 | 手机号:{{ phone }}
29 |
30 | 隐藏后的手机号:{{ hideTextAtIndex(phone, { start: 3, end: 6 }) }}
31 |
32 |
33 |
34 |
35 | 身份证号:{{ idNum }}
36 |
37 | 隐藏后的身份证号:{{
38 | hideTextAtIndex(idNum, [
39 | { start: 3, end: 6 },
40 | { start: 10, end: 13 }
41 | ])
42 | }}
43 |
44 |
45 |
46 |
47 | 使用指定符号:{{ word }}
48 |
49 | 使用指定符号隐藏后的值:{{ hideTextAtIndex(word, 5, "&") }}
50 |
51 |
52 |
53 |
54 |
--------------------------------------------------------------------------------
/docs/utils/storage/storageLocal.vue:
--------------------------------------------------------------------------------
1 |
41 |
42 |
43 |
44 |
45 |
46 | 打开控制台,根据对应操作观察 Local Storage 变化
47 |
48 |
49 |
50 | 储存localStorage对象
51 |
52 |
53 |
54 | 获取localStorage对象
55 |
56 |
57 | {{ storages.info.name ? storages : "" }}
58 |
59 |
60 |
61 | 删除localStorage对象
62 |
63 |
64 | 删除此域的所有localStorage对象
65 |
66 |
67 |
68 |
69 |
--------------------------------------------------------------------------------
/docs/components/layout.vue:
--------------------------------------------------------------------------------
1 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
75 |
--------------------------------------------------------------------------------