ly-utils-lib 1.0.3 → 1.0.4

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.
@@ -12,3 +12,71 @@ export declare function createUUID(): string;
12
12
  * @returns {Promise<unknown>} 导出是否成功
13
13
  */
14
14
  export declare function exportExcel(name: string, title: any, data: any, cols: any, sheetName?: any): Promise<unknown>;
15
+ /**
16
+ * 导入xlsx文件
17
+ * @param {string} file - xlsx文件
18
+ * @returns {Promise<any>} xlsx表格数据
19
+ */
20
+ export declare function importExcel(file: any): Promise<any>;
21
+ /**
22
+ * 导出pdf文件
23
+ * @param {string} name - 文件名称
24
+ * @param {any} dom - 页面dom
25
+ * @param {any} type - 是否直接导出
26
+ * @returns {Promise<unknown>} 不直接导出返回base64文件
27
+ */
28
+ export declare function exportPdf(name: string, dom: any, type?: boolean): Promise<unknown>;
29
+ /**
30
+ * 生成图片文件
31
+ * @param {any} dom - 页面dom
32
+ * @param {string} type - 图片格式
33
+ * @returns {Promise<unknown>} base64文件
34
+ */
35
+ export declare function importImage(dom: any, type?: string): Promise<unknown>;
36
+ /**
37
+ * hex 颜色转 rgb 颜色
38
+ * @param {string} str - hex 颜色
39
+ * @returns {string} rgb 颜色
40
+ */
41
+ export declare function hexToRgb(str: string): string;
42
+ /**
43
+ * rgb 颜色转 Hex 颜色
44
+ * @param {number} r - r 颜色
45
+ * @param {number} g - g 颜色
46
+ * @param {number} b - b 颜色
47
+ * @returns {string} hex 颜色
48
+ */
49
+ export declare function rgbToHex(r: number, g: number, b: number): string;
50
+ /**
51
+ * hex 颜色变浅颜色值
52
+ * @param {string} color - hex 颜色
53
+ * @param {number} alpha - 透明度
54
+ * @returns {string} hex 颜色
55
+ */
56
+ export declare function getLightColor(color: string, alpha: number): string;
57
+ /**
58
+ * hex 颜色变深颜色值
59
+ * @param {string} color - hex 颜色
60
+ * @param {number} alpha - 透明度
61
+ * @returns {string} hex 颜色
62
+ */
63
+ export declare function getDarkColor(color: string, alpha: number): string;
64
+ /**
65
+ * 图片转base64
66
+ * @param {string} url - 图片路径
67
+ * @returns {Promise<string>} base64图片内容
68
+ */
69
+ export declare function imgToBase64(url: string): Promise<string>;
70
+ /**
71
+ * base64转文件
72
+ * @param {string} url - base64文件
73
+ * @param {string} fileName - 文件名称
74
+ * @returns {File} 文件
75
+ */
76
+ export declare function base64toFile(url: string, fileName: string): File;
77
+ /**
78
+ * 下载文件
79
+ * @param {string} url - 文件路径
80
+ * @param {string} fileName - 文件名称
81
+ */
82
+ export declare function downloadFile(url: string, fileName?: string): void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ly-utils-lib",
3
- "version": "1.0.3",
3
+ "version": "1.0.4",
4
4
  "type": "module",
5
5
  "description": "自定义函数库,集成 day.js 和 es-toolkit",
6
6
  "private": false,
@@ -25,6 +25,8 @@
25
25
  "dependencies": {
26
26
  "dayjs": "^1.11.19",
27
27
  "es-toolkit": "^1.43.0",
28
+ "html2canvas": "^1.4.1",
29
+ "jspdf": "^4.0.0",
28
30
  "xlsx": "^0.18.5"
29
31
  },
30
32
  "devDependencies": {