ebuilds-shared 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +69 -0
- package/dist/chunk-6DZX6EAA.mjs +37 -0
- package/dist/chunk-G4JQ2UQV.mjs +2878 -0
- package/dist/chunk-LATZ6U6A.js +2878 -0
- package/dist/chunk-MXO66M74.js +36 -0
- package/dist/chunk-OW2EL2VY.mjs +36 -0
- package/dist/chunk-QGM4M3NI.js +37 -0
- package/dist/chunk-QQPGJGSU.js +6916 -0
- package/dist/chunk-RRULL645.mjs +6916 -0
- package/dist/functionalComponent/index.d.mts +16 -0
- package/dist/functionalComponent/index.d.ts +16 -0
- package/dist/functionalComponent/index.js +25 -0
- package/dist/functionalComponent/index.mjs +25 -0
- package/dist/index-CVmrbYyU.d.mts +34 -0
- package/dist/index-CVmrbYyU.d.ts +34 -0
- package/dist/index.css +69 -0
- package/dist/index.d.mts +11 -0
- package/dist/index.d.ts +11 -0
- package/dist/index.js +65 -0
- package/dist/index.mjs +65 -0
- package/dist/stores/index.d.mts +294 -0
- package/dist/stores/index.d.ts +294 -0
- package/dist/stores/index.js +13 -0
- package/dist/stores/index.mjs +13 -0
- package/dist/styles/index.css +69 -0
- package/dist/styles/index.d.mts +2 -0
- package/dist/styles/index.d.ts +2 -0
- package/dist/uno-config/index.d.mts +8 -0
- package/dist/uno-config/index.d.ts +8 -0
- package/dist/uno-config/index.js +9 -0
- package/dist/uno-config/index.mjs +9 -0
- package/dist/utils/index.d.mts +157 -0
- package/dist/utils/index.d.ts +157 -0
- package/dist/utils/index.js +49 -0
- package/dist/utils/index.mjs +49 -0
- package/dist/vite-config/index.d.mts +31 -0
- package/dist/vite-config/index.d.ts +31 -0
- package/dist/vite-config/index.js +7 -0
- package/dist/vite-config/index.mjs +7 -0
- package/package.json +79 -0
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
import { AxiosRequestConfig, AxiosResponse } from 'axios';
|
|
2
|
+
export { AxiosResponse } from 'axios';
|
|
3
|
+
import { Ref } from 'vue';
|
|
4
|
+
export { M as MenuItem, f as filterMenu, u as updateDocumentTitle } from '../index-CVmrbYyU.js';
|
|
5
|
+
import { Router } from 'vue-router';
|
|
6
|
+
|
|
7
|
+
interface curlParams {
|
|
8
|
+
url: string;
|
|
9
|
+
method?: AxiosRequestConfig['method'];
|
|
10
|
+
headers?: AxiosRequestConfig['headers'];
|
|
11
|
+
query?: AxiosRequestConfig['params'];
|
|
12
|
+
data?: AxiosRequestConfig['data'];
|
|
13
|
+
responseType?: AxiosRequestConfig['responseType'];
|
|
14
|
+
timeout?: AxiosRequestConfig['timeout'];
|
|
15
|
+
errorMessage?: string;
|
|
16
|
+
showErrorMessage?: boolean;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
declare const request: <T = any>(params: curlParams, token: string, serverBaseUrl?: string) => Promise<AxiosResponse<T>>;
|
|
20
|
+
|
|
21
|
+
interface FormState {
|
|
22
|
+
username: string;
|
|
23
|
+
password: string;
|
|
24
|
+
captcha: string;
|
|
25
|
+
checkKey: number;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* 登录页面方法
|
|
29
|
+
* @param curl 请求方法
|
|
30
|
+
* @param params 请求参数
|
|
31
|
+
*/
|
|
32
|
+
declare const useLoginHook: (curl: Function, params: {
|
|
33
|
+
queryCodeUrl: string;
|
|
34
|
+
}) => {
|
|
35
|
+
codeLoading: Ref<boolean>;
|
|
36
|
+
randCodeImage: Ref<string>;
|
|
37
|
+
submitLoading: Ref<boolean>;
|
|
38
|
+
formState: FormState;
|
|
39
|
+
rules: Record<string, any[]>;
|
|
40
|
+
handleChangeCheckCode: () => Promise<void>;
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* 路由权限
|
|
45
|
+
* @param router
|
|
46
|
+
* @param useMenuStore
|
|
47
|
+
*/
|
|
48
|
+
declare function setupPermission(router: Router, useMenuStore: any, pages: any, useUserStore: any): void;
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* 清单排序函数,支持按指定字段进行自然排序
|
|
52
|
+
* @param arr 需要排序的数组
|
|
53
|
+
* @param key 排序依据的字段名,默认为'no'
|
|
54
|
+
* @param callback 排序前对每个元素执行的回调函数
|
|
55
|
+
* @returns 排序后的数组
|
|
56
|
+
*/
|
|
57
|
+
declare function listSort<T extends Record<string, any>>(arr: T[], key?: string, callback?: (item: T) => void): T[];
|
|
58
|
+
/**
|
|
59
|
+
* 月份去重、补齐、排序
|
|
60
|
+
* @param months - 包含月份信息的数组,每个元素应包含key属性,格式为'YYYY-MM'
|
|
61
|
+
* @returns 返回一个完整的、排序后的月份数组,每个元素包含key、label和align属性
|
|
62
|
+
*/
|
|
63
|
+
declare function duplicateRemovalCompleteSort(months: Array<{
|
|
64
|
+
key: string;
|
|
65
|
+
}>): Array<{
|
|
66
|
+
key: string;
|
|
67
|
+
label: string;
|
|
68
|
+
align: string;
|
|
69
|
+
}>;
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* 截断或四舍五入数字到指定小数位数
|
|
73
|
+
* @param num 要处理的数字
|
|
74
|
+
* @param fixed 保留的小数位数,默认为2位
|
|
75
|
+
* @param round 是否四舍五入,默认为false(截断)
|
|
76
|
+
* @returns 处理后的数字
|
|
77
|
+
*/
|
|
78
|
+
declare const roundOrTruncate: (num: number, fixed?: number, round?: boolean) => number;
|
|
79
|
+
/**
|
|
80
|
+
* 格式化数字为千分位格式
|
|
81
|
+
* @param num 要格式化的数字
|
|
82
|
+
* @param fixed 保留的小数位数,默认为2位
|
|
83
|
+
* @returns 格式化后的字符串
|
|
84
|
+
*/
|
|
85
|
+
declare const formatNumber: (num: number, fixed?: number) => string;
|
|
86
|
+
/**
|
|
87
|
+
* 将千分位格式的字符串转换为数字
|
|
88
|
+
* @param str 千分位格式的字符串
|
|
89
|
+
* @returns 转换后的数字
|
|
90
|
+
*/
|
|
91
|
+
declare const parseFormattedNumber: (str: string) => number;
|
|
92
|
+
/**
|
|
93
|
+
* 数字补零
|
|
94
|
+
* @param num 要补零的数字
|
|
95
|
+
* @param width 总宽度
|
|
96
|
+
* @returns 补零后的字符串
|
|
97
|
+
*/
|
|
98
|
+
declare const padZero: (num: number, width: number) => string;
|
|
99
|
+
/**
|
|
100
|
+
* 获取数字的整数部分
|
|
101
|
+
* @param num 数字
|
|
102
|
+
* @returns 整数部分
|
|
103
|
+
*/
|
|
104
|
+
declare const getIntegerPart: (num: number) => number;
|
|
105
|
+
/**
|
|
106
|
+
* 获取数字的小数部分
|
|
107
|
+
* @param num 数字
|
|
108
|
+
* @returns 小数部分
|
|
109
|
+
*/
|
|
110
|
+
declare const getDecimalPart: (num: number) => number;
|
|
111
|
+
/**
|
|
112
|
+
* 数字转中文大写
|
|
113
|
+
* @param num 要转换的数字
|
|
114
|
+
* @returns 中文大写字符串
|
|
115
|
+
*/
|
|
116
|
+
declare const numberToChinese: (num: number) => string;
|
|
117
|
+
/**
|
|
118
|
+
* 限制数字在指定范围内
|
|
119
|
+
* @param num 要限制的数字
|
|
120
|
+
* @param min 最小值
|
|
121
|
+
* @param max 最大值
|
|
122
|
+
* @returns 限制后的数字
|
|
123
|
+
*/
|
|
124
|
+
declare const clamp: (num: number, min: number, max: number) => number;
|
|
125
|
+
/**
|
|
126
|
+
* 判断是否为整数
|
|
127
|
+
* @param num 要判断的数字
|
|
128
|
+
* @returns 是否为整数
|
|
129
|
+
*/
|
|
130
|
+
declare const isInteger: (num: number) => boolean;
|
|
131
|
+
/**
|
|
132
|
+
* 判断是否为有效数字
|
|
133
|
+
* @param num 要判断的值
|
|
134
|
+
* @returns 是否为有效数字
|
|
135
|
+
*/
|
|
136
|
+
declare const isNumber: (num: unknown) => boolean;
|
|
137
|
+
|
|
138
|
+
declare const prototypeInterceptor: {
|
|
139
|
+
install(): void;
|
|
140
|
+
};
|
|
141
|
+
|
|
142
|
+
declare function timeFix(): "早上好" | "上午好" | "中午好" | "下午好" | "晚上好";
|
|
143
|
+
declare function welcome(): string;
|
|
144
|
+
|
|
145
|
+
/**
|
|
146
|
+
* 对密码加密处理
|
|
147
|
+
* @param pwd 密码
|
|
148
|
+
* @returns 加密后的密码
|
|
149
|
+
*/
|
|
150
|
+
declare function encryptPwd(pwd: string): string | false;
|
|
151
|
+
|
|
152
|
+
declare const jsonp: <T = any>(url: string, params?: Record<string, any>, options?: {
|
|
153
|
+
callbackParam?: string;
|
|
154
|
+
timeout?: number;
|
|
155
|
+
}) => Promise<T>;
|
|
156
|
+
|
|
157
|
+
export { type FormState, clamp, type curlParams, duplicateRemovalCompleteSort, encryptPwd, formatNumber, getDecimalPart, getIntegerPart, isInteger, isNumber, jsonp, listSort, numberToChinese, padZero, parseFormattedNumber, prototypeInterceptor, request, roundOrTruncate, setupPermission, timeFix, useLoginHook, welcome };
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
var _chunkQQPGJGSUjs = require('../chunk-QQPGJGSU.js');
|
|
25
|
+
require('../chunk-QGM4M3NI.js');
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
exports.clamp = _chunkQQPGJGSUjs.clamp; exports.duplicateRemovalCompleteSort = _chunkQQPGJGSUjs.duplicateRemovalCompleteSort; exports.encryptPwd = _chunkQQPGJGSUjs.encryptPwd; exports.filterMenu = _chunkQQPGJGSUjs.filterMenu; exports.formatNumber = _chunkQQPGJGSUjs.formatNumber; exports.getDecimalPart = _chunkQQPGJGSUjs.getDecimalPart; exports.getIntegerPart = _chunkQQPGJGSUjs.getIntegerPart; exports.isInteger = _chunkQQPGJGSUjs.isInteger; exports.isNumber = _chunkQQPGJGSUjs.isNumber; exports.jsonp = _chunkQQPGJGSUjs.jsonp; exports.listSort = _chunkQQPGJGSUjs.listSort; exports.numberToChinese = _chunkQQPGJGSUjs.numberToChinese; exports.padZero = _chunkQQPGJGSUjs.padZero; exports.parseFormattedNumber = _chunkQQPGJGSUjs.parseFormattedNumber; exports.prototypeInterceptor = _chunkQQPGJGSUjs.prototypeInterceptor; exports.request = _chunkQQPGJGSUjs.request; exports.roundOrTruncate = _chunkQQPGJGSUjs.roundOrTruncate; exports.setupPermission = _chunkQQPGJGSUjs.setupPermission; exports.timeFix = _chunkQQPGJGSUjs.timeFix; exports.updateDocumentTitle = _chunkQQPGJGSUjs.updateDocumentTitle; exports.useLoginHook = _chunkQQPGJGSUjs.useLoginHook; exports.welcome = _chunkQQPGJGSUjs.welcome;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import {
|
|
2
|
+
clamp,
|
|
3
|
+
duplicateRemovalCompleteSort,
|
|
4
|
+
encryptPwd,
|
|
5
|
+
filterMenu,
|
|
6
|
+
formatNumber,
|
|
7
|
+
getDecimalPart,
|
|
8
|
+
getIntegerPart,
|
|
9
|
+
isInteger,
|
|
10
|
+
isNumber,
|
|
11
|
+
jsonp,
|
|
12
|
+
listSort,
|
|
13
|
+
numberToChinese,
|
|
14
|
+
padZero,
|
|
15
|
+
parseFormattedNumber,
|
|
16
|
+
prototypeInterceptor,
|
|
17
|
+
request,
|
|
18
|
+
roundOrTruncate,
|
|
19
|
+
setupPermission,
|
|
20
|
+
timeFix,
|
|
21
|
+
updateDocumentTitle,
|
|
22
|
+
useLoginHook,
|
|
23
|
+
welcome
|
|
24
|
+
} from "../chunk-RRULL645.mjs";
|
|
25
|
+
import "../chunk-6DZX6EAA.mjs";
|
|
26
|
+
export {
|
|
27
|
+
clamp,
|
|
28
|
+
duplicateRemovalCompleteSort,
|
|
29
|
+
encryptPwd,
|
|
30
|
+
filterMenu,
|
|
31
|
+
formatNumber,
|
|
32
|
+
getDecimalPart,
|
|
33
|
+
getIntegerPart,
|
|
34
|
+
isInteger,
|
|
35
|
+
isNumber,
|
|
36
|
+
jsonp,
|
|
37
|
+
listSort,
|
|
38
|
+
numberToChinese,
|
|
39
|
+
padZero,
|
|
40
|
+
parseFormattedNumber,
|
|
41
|
+
prototypeInterceptor,
|
|
42
|
+
request,
|
|
43
|
+
roundOrTruncate,
|
|
44
|
+
setupPermission,
|
|
45
|
+
timeFix,
|
|
46
|
+
updateDocumentTitle,
|
|
47
|
+
useLoginHook,
|
|
48
|
+
welcome
|
|
49
|
+
};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import * as vite from 'vite';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* 代理配置接口 - 定义代理路径前缀与目标服务地址的映射关系
|
|
5
|
+
* @property {string} prefix - 代理路径前缀,用于匹配请求路径
|
|
6
|
+
* @property {string} url - 目标服务基础地址,代理将转发到该地址
|
|
7
|
+
*/
|
|
8
|
+
interface ProxyConfig {
|
|
9
|
+
prefix: string;
|
|
10
|
+
url: string;
|
|
11
|
+
}
|
|
12
|
+
type proxyConfigType = {
|
|
13
|
+
data: ProxyConfig[];
|
|
14
|
+
replaceFunction?: (path: string) => string;
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
interface Options {
|
|
18
|
+
port?: number;
|
|
19
|
+
plugins?: any[];
|
|
20
|
+
proxy?: proxyConfigType;
|
|
21
|
+
showDevTools?: boolean;
|
|
22
|
+
enableOptimizeDeps?: boolean;
|
|
23
|
+
baseUrl?: string;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* 创建 vite 配置
|
|
27
|
+
* @param options 配置项
|
|
28
|
+
*/
|
|
29
|
+
declare function createBaseViteConfig(options: Options): vite.UserConfigFnObject;
|
|
30
|
+
|
|
31
|
+
export { createBaseViteConfig };
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import * as vite from 'vite';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* 代理配置接口 - 定义代理路径前缀与目标服务地址的映射关系
|
|
5
|
+
* @property {string} prefix - 代理路径前缀,用于匹配请求路径
|
|
6
|
+
* @property {string} url - 目标服务基础地址,代理将转发到该地址
|
|
7
|
+
*/
|
|
8
|
+
interface ProxyConfig {
|
|
9
|
+
prefix: string;
|
|
10
|
+
url: string;
|
|
11
|
+
}
|
|
12
|
+
type proxyConfigType = {
|
|
13
|
+
data: ProxyConfig[];
|
|
14
|
+
replaceFunction?: (path: string) => string;
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
interface Options {
|
|
18
|
+
port?: number;
|
|
19
|
+
plugins?: any[];
|
|
20
|
+
proxy?: proxyConfigType;
|
|
21
|
+
showDevTools?: boolean;
|
|
22
|
+
enableOptimizeDeps?: boolean;
|
|
23
|
+
baseUrl?: string;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* 创建 vite 配置
|
|
27
|
+
* @param options 配置项
|
|
28
|
+
*/
|
|
29
|
+
declare function createBaseViteConfig(options: Options): vite.UserConfigFnObject;
|
|
30
|
+
|
|
31
|
+
export { createBaseViteConfig };
|
package/package.json
ADDED
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "ebuilds-shared",
|
|
3
|
+
"publishConfig": {
|
|
4
|
+
"access": "public"
|
|
5
|
+
},
|
|
6
|
+
"version": "0.1.0",
|
|
7
|
+
"description": "共享工具库和类型定义",
|
|
8
|
+
"author": "ebuilds",
|
|
9
|
+
"license": "MIT",
|
|
10
|
+
"keywords": [
|
|
11
|
+
"shared",
|
|
12
|
+
"utils",
|
|
13
|
+
"vue",
|
|
14
|
+
"pinia",
|
|
15
|
+
"vite"
|
|
16
|
+
],
|
|
17
|
+
"main": "dist/index.js",
|
|
18
|
+
"module": "dist/index.mjs",
|
|
19
|
+
"types": "dist/index.d.ts",
|
|
20
|
+
"exports": {
|
|
21
|
+
".": {
|
|
22
|
+
"default": "./dist/index.mjs",
|
|
23
|
+
"import": "./dist/index.mjs",
|
|
24
|
+
"require": "./dist/index.js",
|
|
25
|
+
"types": "./dist/index.d.ts"
|
|
26
|
+
},
|
|
27
|
+
"./utils": {
|
|
28
|
+
"default": "./dist/utils/index.mjs",
|
|
29
|
+
"import": "./dist/utils/index.mjs",
|
|
30
|
+
"require": "./dist/utils/index.js",
|
|
31
|
+
"types": "./dist/utils/index.d.ts"
|
|
32
|
+
},
|
|
33
|
+
"./stores": {
|
|
34
|
+
"default": "./dist/stores/index.mjs",
|
|
35
|
+
"import": "./dist/stores/index.mjs",
|
|
36
|
+
"require": "./dist/stores/index.js",
|
|
37
|
+
"types": "./dist/stores/index.d.ts"
|
|
38
|
+
},
|
|
39
|
+
"./vite-config": {
|
|
40
|
+
"default": "./dist/vite-config/index.mjs",
|
|
41
|
+
"import": "./dist/vite-config/index.mjs",
|
|
42
|
+
"require": "./dist/vite-config/index.js",
|
|
43
|
+
"types": "./dist/vite-config/index.d.mts"
|
|
44
|
+
},
|
|
45
|
+
"./uno-config": {
|
|
46
|
+
"default": "./dist/uno-config/index.mjs",
|
|
47
|
+
"import": "./dist/uno-config/index.mjs",
|
|
48
|
+
"require": "./dist/uno-config/index.js",
|
|
49
|
+
"types": "./dist/uno-config/index.d.ts"
|
|
50
|
+
},
|
|
51
|
+
"./functionalComponent": {
|
|
52
|
+
"default": "./dist/functionalComponent/index.mjs",
|
|
53
|
+
"import": "./dist/functionalComponent/index.mjs",
|
|
54
|
+
"require": "./dist/functionalComponent/index.js",
|
|
55
|
+
"types": "./dist/functionalComponent/index.d.ts"
|
|
56
|
+
},
|
|
57
|
+
"./styles": "./dist/styles/index.css"
|
|
58
|
+
},
|
|
59
|
+
"files": [
|
|
60
|
+
"dist"
|
|
61
|
+
],
|
|
62
|
+
"scripts": {
|
|
63
|
+
"build": "tsup --config tsup.config.ts",
|
|
64
|
+
"dev": "tsup --config tsup.config.ts --watch",
|
|
65
|
+
"lint": "eslint --quiet \"src/**/*.{ts,tsx}\"",
|
|
66
|
+
"lint:fix": "eslint --quiet \"src/**/*.{ts,tsx}\" --fix",
|
|
67
|
+
"pub": "pnpm build && npm publish"
|
|
68
|
+
},
|
|
69
|
+
"peerDependencies": {
|
|
70
|
+
"pinia": "3.0.1"
|
|
71
|
+
},
|
|
72
|
+
"dependencies": {
|
|
73
|
+
"axios": "^1.8.4",
|
|
74
|
+
"jsencrypt": "^3.3.2"
|
|
75
|
+
},
|
|
76
|
+
"devDependencies": {
|
|
77
|
+
"tsup": "^8.0.2"
|
|
78
|
+
}
|
|
79
|
+
}
|