ly-utils-lib 1.0.11 → 2.4.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.
Files changed (103) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +889 -686
  3. package/dist/array.cjs +237 -0
  4. package/dist/array.cjs.map +1 -0
  5. package/dist/array.d.cts +2 -0
  6. package/dist/array.d.ts +2 -0
  7. package/dist/array.js +150 -0
  8. package/dist/array.js.map +1 -0
  9. package/dist/crypto.cjs +193 -0
  10. package/dist/crypto.cjs.map +1 -0
  11. package/dist/crypto.d.cts +3 -0
  12. package/dist/crypto.d.ts +3 -0
  13. package/dist/crypto.js +144 -0
  14. package/dist/crypto.js.map +1 -0
  15. package/dist/date.cjs +563 -0
  16. package/dist/date.cjs.map +1 -0
  17. package/dist/date.d.cts +2 -0
  18. package/dist/date.d.ts +2 -0
  19. package/dist/date.js +451 -0
  20. package/dist/date.js.map +1 -0
  21. package/dist/excel.cjs +227 -0
  22. package/dist/excel.cjs.map +1 -0
  23. package/dist/excel.d.cts +2 -0
  24. package/dist/excel.d.ts +2 -0
  25. package/dist/excel.js +196 -0
  26. package/dist/excel.js.map +1 -0
  27. package/dist/index-B80SEVzM.d.cts +382 -0
  28. package/dist/index-B80SEVzM.d.ts +382 -0
  29. package/dist/index-Ba1rjTzj.d.cts +299 -0
  30. package/dist/index-Ba1rjTzj.d.ts +299 -0
  31. package/dist/index-Bg1ise7y.d.cts +253 -0
  32. package/dist/index-Bg1ise7y.d.ts +253 -0
  33. package/dist/index-BoqNpwNa.d.cts +203 -0
  34. package/dist/index-BoqNpwNa.d.ts +203 -0
  35. package/dist/index-C0qUnb9Y.d.cts +533 -0
  36. package/dist/index-C0qUnb9Y.d.ts +533 -0
  37. package/dist/index-Cy-mb5v_.d.cts +262 -0
  38. package/dist/index-Cy-mb5v_.d.ts +262 -0
  39. package/dist/index-D1f9Sym2.d.cts +148 -0
  40. package/dist/index-D1f9Sym2.d.ts +148 -0
  41. package/dist/index-Dan5oF-5.d.cts +213 -0
  42. package/dist/index-Dan5oF-5.d.ts +213 -0
  43. package/dist/index-XABfrs7z.d.cts +596 -0
  44. package/dist/index-XABfrs7z.d.ts +596 -0
  45. package/dist/index-YXWfKCK7.d.cts +109 -0
  46. package/dist/index-YXWfKCK7.d.ts +109 -0
  47. package/dist/index.cjs +3355 -0
  48. package/dist/index.cjs.map +1 -0
  49. package/dist/index.d.cts +21 -0
  50. package/dist/index.d.ts +21 -0
  51. package/dist/index.js +3294 -0
  52. package/dist/index.js.map +1 -0
  53. package/dist/map.cjs +839 -0
  54. package/dist/map.cjs.map +1 -0
  55. package/dist/map.d.cts +6 -0
  56. package/dist/map.d.ts +6 -0
  57. package/dist/map.js +811 -0
  58. package/dist/map.js.map +1 -0
  59. package/dist/object.cjs +316 -0
  60. package/dist/object.cjs.map +1 -0
  61. package/dist/object.d.cts +2 -0
  62. package/dist/object.d.ts +2 -0
  63. package/dist/object.js +247 -0
  64. package/dist/object.js.map +1 -0
  65. package/dist/pdf.cjs +197 -0
  66. package/dist/pdf.cjs.map +1 -0
  67. package/dist/pdf.d.cts +3 -0
  68. package/dist/pdf.d.ts +3 -0
  69. package/dist/pdf.js +173 -0
  70. package/dist/pdf.js.map +1 -0
  71. package/dist/storage.cjs +255 -0
  72. package/dist/storage.cjs.map +1 -0
  73. package/dist/storage.d.cts +1 -0
  74. package/dist/storage.d.ts +1 -0
  75. package/dist/storage.js +226 -0
  76. package/dist/storage.js.map +1 -0
  77. package/dist/string.cjs +232 -0
  78. package/dist/string.cjs.map +1 -0
  79. package/dist/string.d.cts +2 -0
  80. package/dist/string.d.ts +2 -0
  81. package/dist/string.js +170 -0
  82. package/dist/string.js.map +1 -0
  83. package/dist/utils.cjs +429 -0
  84. package/dist/utils.cjs.map +1 -0
  85. package/dist/utils.d.cts +2 -0
  86. package/dist/utils.d.ts +2 -0
  87. package/dist/utils.js +371 -0
  88. package/dist/utils.js.map +1 -0
  89. package/package.json +159 -33
  90. package/dist/ly-utils-lib.cjs.js +0 -52929
  91. package/dist/ly-utils-lib.cjs.js.map +0 -1
  92. package/dist/ly-utils-lib.es.js +0 -69623
  93. package/dist/ly-utils-lib.es.js.map +0 -1
  94. package/dist/ly-utils-lib.umd.js +0 -53314
  95. package/dist/ly-utils-lib.umd.js.map +0 -1
  96. package/dist/types/index.d.ts +0 -15
  97. package/dist/types/utils/esToolkit.d.ts +0 -12
  98. package/dist/types/utils/ol.d.ts +0 -181
  99. package/dist/types/utils/router.d.ts +0 -15
  100. package/dist/types/utils/storage.d.ts +0 -42
  101. package/dist/types/utils/time.d.ts +0 -76
  102. package/dist/types/utils/tool.d.ts +0 -86
  103. package/dist/vite.svg +0 -1
@@ -1,15 +0,0 @@
1
- export * as esToolkit from 'es-toolkit'
2
- export { default as dayjs } from 'dayjs'
3
- export { default as html2canvas } from 'html2canvas'
4
- export * from './utils/ol'
5
- export * from './utils/time'
6
- export * from './utils/tool'
7
- export * from './utils/router'
8
- export * from './utils/esToolkit'
9
- export * from './utils/storage'
10
- export * as ol from './utils/ol'
11
- export * as time from './utils/time'
12
- export * as tool from './utils/tool'
13
- export * as es from './utils/esToolkit'
14
- export * as router from './utils/router'
15
- export * as storage from './utils/storage'
@@ -1,12 +0,0 @@
1
- export { isEqual, cloneDeep, merge, debounce, throttle, memoize, groupBy, uniqBy } from 'es-toolkit'
2
- export {
3
- map,
4
- filter,
5
- forEach,
6
- replace,
7
- includes,
8
- find,
9
- some,
10
- indexOf,
11
- findIndex
12
- } from 'es-toolkit/compat'
@@ -1,181 +0,0 @@
1
- /**
2
- * 创建地图
3
- * @param {string} container - dom
4
- * @param {string} center - 中心点左边
5
- * @param {number} zoom - 层级
6
- * @param {number} minZoom - 最小层级
7
- * @param {number} maxZoom - 最大层级
8
- * @returns {any} 地图实例
9
- */
10
- export declare function createMap(
11
- container: string,
12
- center?: [number, number],
13
- zoom?: number,
14
- minZoom?: number,
15
- maxZoom?: number
16
- ): any
17
- /**
18
- * 创建瓦片图层
19
- * @param {string} url - 瓦片路径
20
- * @returns {any} 图层实例
21
- */
22
- export declare function createTileLayer(url: string): any
23
- /**
24
- * 添加图层
25
- * @param {any} map - 地图实例
26
- * @param {any} layer -图层实例
27
- */
28
- export declare function addLayer(map: any, layer: any): void
29
- /**
30
- * 显示/隐藏图层
31
- * @param {any} layer -图层实例
32
- * @param {boolean} type - 显示/隐藏
33
- */
34
- export declare function setLayerVisible(layer: any, type: boolean): void
35
- /**
36
- * 设置层级
37
- * @param {any} map - 地图实例
38
- * @param {number} zoom - 层级
39
- */
40
- export declare function setZoom(map: any, zoom: number): void
41
- /**
42
- * 获取层级
43
- * @param {any} map - 地图实例
44
- * @returns {number} 图层层级
45
- */
46
- export declare function getZoom(map: any): number
47
- /**
48
- * 设置中心点
49
- * @param {any} map - 地图实例
50
- * @param {any} point - 中心点坐标
51
- */
52
- export declare function setCenter(map: any, point: [number, number]): void
53
- /**
54
- * 设置区域中心
55
- * @param {any} map - 地图实例
56
- * @param {any} point - 中心区域坐标
57
- */
58
- export declare function setAreaCenter(map: any, point: any): void
59
- /**
60
- * 设置图层中心
61
- * @param {any} map - 地图实例
62
- * @param {any} layer - 图层实例
63
- */
64
- export declare function setLayerCenter(map: any, layer: any): void
65
- /**
66
- * 创建图层
67
- * @param {number} minZoom - 最小层级
68
- * @param {number} maxZoom - 最大层级
69
- * @param {number} zIndex - 层级
70
- * @returns {any} 矢量图层实例
71
- */
72
- export declare function createVectorLayer(minZoom?: number, maxZoom?: number, zIndex?: number): any
73
- /**
74
- * 清空图层资源
75
- * @param {any} layer - 图层
76
- */
77
- export declare function clearLayer(layer: any): any
78
- /**
79
- * 获取图层元素
80
- * @param {any} layer - 图层
81
- * @returns {any} 矢量图层元素
82
- */
83
- export declare function getLayerFeature(layer: any): any
84
- /**
85
- * 设置图层样式
86
- * @param {any} layer - 图层
87
- * @param {any} style - 样式
88
- */
89
- export declare function setLayerStyle(layer: any, style: any): any
90
- /**
91
- * 创建图层资源
92
- * @returns {any} 图层资源实例
93
- */
94
- export declare function createSource(): any
95
- /**
96
- * 设置图层资源
97
- * @param {any} layer - 图层
98
- * @param {any} source - 图层资源
99
- */
100
- export declare function setSource(layer: any, source: any): any
101
- /**
102
- * 创建元素
103
- * @param {string} type - 类型
104
- * @param {any} data - 数据
105
- * @returns {any} 元素实例
106
- */
107
- export declare function createFeature(type: string, data: any): any
108
- /**
109
- * 添加元素
110
- * @param {any} layer - 图层
111
- * @param {any} feature - 元素
112
- */
113
- export declare function addFeature(layer: any, feature: any): any
114
- /**
115
- * 删除元素
116
- * @param {any} layer - 图层
117
- * @param {any} feature - 元素
118
- */
119
- export declare function delFeature(layer: any, feature: any): any
120
- /**
121
- * 设置元素样式
122
- * @param {string} type - 元素类型
123
- * @param {any} feature - 元素
124
- * @param {any} style - 样式
125
- */
126
- export declare function createStyle(type: string, style: any): any
127
- /**
128
- * 创建绘制交互
129
- * @param {any} map - 地图实例
130
- * @param {any} type - 元素类型
131
- * @returns {any} 绘制实例
132
- */
133
- export declare function createDraw(map: any, type: any): any
134
- /**
135
- * 删除绘制交互
136
- * @param {any} map - 地图实例
137
- * @param {any} draw - 绘制实例
138
- */
139
- export declare function clearDraw(map: any, draw: any): any
140
- /**
141
- * 删除最后一次绘制
142
- * @param {any} draw - 绘制实例
143
- */
144
- export declare function removeLastPoint(draw: any): any
145
- /**
146
- * 创建修改交互
147
- * @param {any} map - 地图实例
148
- * @param {any} feature - 元素
149
- * @returns {any} 修改实例
150
- */
151
- export declare function createModify(map: any, feature: any): any
152
- /**
153
- * 删除修改交互
154
- * @param {any} map - 地图实例
155
- * @param {any} modify - 修改实例
156
- */
157
- export declare function clearModify(map: any, modify: any): any
158
- /**
159
- * 创建选择交互
160
- * @param {any} map - 地图实例
161
- * @returns {any} 选择实例
162
- */
163
- export declare function createSelect(map: any): any
164
- /**
165
- * 删除选择交互
166
- * @param {any} map - 地图实例
167
- * @param {any} select - 选择实例
168
- */
169
- export declare function clearSelect(map: any, select: any): any
170
- /**
171
- * 创建弹框交互
172
- * @param {any} map - 地图实例
173
- * @param {any} container - 容器
174
- * @returns {any} 弹框实例
175
- */
176
- export declare function createOverlay(map: any, container: any): any
177
- /**
178
- * 隐藏弹框交互
179
- * @param {any} overlay - 弹框实例
180
- */
181
- export declare function hiddenOverlay(overlay: any): void
@@ -1,15 +0,0 @@
1
- export declare function formatFlatteningRoutes(arr: any): any
2
- export declare function formatTwoStageRoutes(arr: any):
3
- | false
4
- | {
5
- routes: any
6
- cacheList: string[]
7
- }
8
- export declare function backEndComponent(dynamicViewsModules: any, routes: any): any[] | undefined
9
- export declare function dynamicImport(
10
- dynamicViewsModules: Record<string, Function>,
11
- component: string
12
- ): false | Function | undefined
13
- export declare function setFilterHasRolesMenu(routes: any, roles: any): any
14
- export declare function hasRoles(roles: any, route: any): boolean
15
- export declare function setFilterRoute(chil: any, roles: any): any
@@ -1,42 +0,0 @@
1
- /**
2
- * 设置永久缓存
3
- * @param {string} key - 缓存名称
4
- * @param {string | number | object | Array<any>} value - 缓存内容
5
- */
6
- export declare function setLocal(key: string, value: string | number | object | Array<any>): void
7
- /**
8
- * 获取永久缓存
9
- * @param {string} key - 缓存名称
10
- * @returns {string} 格式化后的value
11
- */
12
- export declare function getLocal(key: string): string | number | object | Array<any> | undefined
13
- /**
14
- * 移除永久缓存
15
- * @param {string} key - 缓存名称
16
- */
17
- export declare function removeLocal(key: string): void
18
- /**
19
- * 移除全部永久缓存
20
- */
21
- export declare function clearLocal(): void
22
- /**
23
- * 设置临时缓存
24
- * @param {string} key - 缓存名称
25
- * @param {string | number | object | Array<any>} value - 缓存内容
26
- */
27
- export declare function setSession(key: string, value: string | number | object | Array<any>): void
28
- /**
29
- * 获取临时缓存
30
- * @param {string} key - 缓存名称
31
- * @returns {string | number | object | Array<any>} 格式化后的value
32
- */
33
- export declare function getSession(key: string): string | number | object | Array<any> | undefined
34
- /**
35
- * 移除临时缓存
36
- * @param {string} key - 缓存名称
37
- */
38
- export declare function removeSession(key: string): void
39
- /**
40
- * 移除全部临时缓存
41
- */
42
- export declare function clearSession(): void
@@ -1,76 +0,0 @@
1
- import { ManipulateType, OpUnitType } from 'dayjs'
2
- /**
3
- * 日期格式化函数
4
- * @param {Date | string} date - 日期
5
- * @param {string} format - 格式模板
6
- * @returns {string} 格式化后的日期字符串
7
- */
8
- export declare function formatDate(date?: Date | string, format?: string): string
9
- /**
10
- * 日期计算函数
11
- * @param {string} compute - 计算方式 'after' | 'before'
12
- * @param {Date | string} date - 日期
13
- * @param {string} type - 计算类型 'day' | 'week' | 'month' | 'quarter' | 'year' | 'hour' | 'minute' | 'second' | 'millisecond'
14
- * @param {number} num - 计算数量
15
- * @param {string} format - 格式模板
16
- * @returns {string} 格式化后的日期字符串
17
- */
18
- export declare function computeDate(
19
- compute?: string,
20
- date?: Date | string,
21
- type?: ManipulateType | undefined,
22
- num?: number,
23
- format?: string
24
- ): string | undefined
25
- /**
26
- * 开始时间函数
27
- * @param {string} type - 类型 'date' | 'day' | 'month' | 'quarter' | 'year' | 'week' | 'isoWeek' | 'hour' | 'minute' | 'second' | 'millisecond'
28
- * @param {string} format - 格式模板
29
- * @returns {string} 格式化后的日期字符串
30
- */
31
- export declare function startDate(type?: ManipulateType | undefined, format?: string): any
32
- /**
33
- * 结束时间函数
34
- * @param {string} type - 类型 'date' | 'day' | 'month' | 'quarter' | 'year' | 'week' | 'isoWeek' | 'hour' | 'minute' | 'second' | 'millisecond'
35
- * @param {string} format - 格式模板
36
- * @returns {string} 格式化后的日期字符串
37
- */
38
- export declare function endDate(type?: OpUnitType, format?: string): any
39
- /**
40
- * 获取时间戳函数
41
- * @param {Date | string} date - 日期
42
- * @returns {number} 时间戳
43
- */
44
- export declare function getTimeStamp(date?: Date | string): number
45
- /**
46
- * 时间戳格式化函数
47
- * @param {number} timeStamp - 时间戳
48
- * @param {string} format - 格式模板
49
- * @returns {string} 格式化后的日期字符串
50
- */
51
- export declare function formatTimeStamp(timeStamp?: number, format?: string): string
52
- /**
53
- * 获取两个日期时间之间的差异函数
54
- * @param {string} type - 类型 'week' | 'day' | 'month' | 'quarter' | 'year' | 'hour' | 'minute' | 'second' | 'millisecond'
55
- * @param {Date | string} startDate - 起始时间
56
- * @param {Date | string} endDate - 结束时间
57
- * @returns {number} 差异值
58
- */
59
- export declare function getDateDiff(
60
- type: OpUnitType | undefined,
61
- startDate: Date | string,
62
- endDate?: Date | string
63
- ): number
64
- /**
65
- * 获取一段范围内日期函数
66
- * @param {Date | string} startDate - 起始时间
67
- * @param {Date | string} endDate - 结束时间
68
- * @returns {array} 日期集合
69
- */
70
- export declare function getRangeDate(startDate: Date | string, endDate: Date | string): Array<any>
71
- /**
72
- * 获取相对时间函数
73
- * @param {Date | string} date - 日期
74
- * @returns {string} 相对时间描述
75
- */
76
- export declare function getRelativeTime(date: Date | string): string
@@ -1,86 +0,0 @@
1
- /**
2
- * 生成UUID
3
- */
4
- export declare function createUUID(): string
5
- /**
6
- * 导出xlsx文件
7
- * @param {string} name - 文件名称
8
- * @param {any} title - xlsx表头
9
- * @param {any} data - xlsx数据
10
- * @param {any} cols - xlsx宽度
11
- * @param {any} sheetName - xlsx页签名称
12
- * @returns {Promise<unknown>} 导出是否成功
13
- */
14
- export declare function exportExcel(
15
- name: string,
16
- title: any,
17
- data: any,
18
- cols: any,
19
- sheetName?: any
20
- ): Promise<unknown>
21
- /**
22
- * 导入xlsx文件
23
- * @param {string} file - xlsx文件
24
- * @returns {Promise<any>} xlsx表格数据
25
- */
26
- export declare function importExcel(file: any): Promise<any>
27
- /**
28
- * 导出pdf文件
29
- * @param {string} name - 文件名称
30
- * @param {any} dom - 页面dom
31
- * @param {any} type - 是否直接导出
32
- * @returns {Promise<unknown>} 不直接导出返回base64文件
33
- */
34
- /**
35
- * 生成图片文件
36
- * @param {any} dom - 页面dom
37
- * @param {string} type - 图片格式
38
- * @returns {Promise<unknown>} base64文件
39
- */
40
- /**
41
- * hex 颜色转 rgb 颜色
42
- * @param {string} str - hex 颜色
43
- * @returns {string} rgb 颜色
44
- */
45
- export declare function hexToRgb(str: string): string
46
- /**
47
- * rgb 颜色转 Hex 颜色
48
- * @param {number} r - r 颜色
49
- * @param {number} g - g 颜色
50
- * @param {number} b - b 颜色
51
- * @returns {string} hex 颜色
52
- */
53
- export declare function rgbToHex(r: number, g: number, b: number): string
54
- /**
55
- * hex 颜色变浅颜色值
56
- * @param {string} color - hex 颜色
57
- * @param {number} alpha - 透明度
58
- * @returns {string} hex 颜色
59
- */
60
- export declare function getLightColor(color: string, alpha: number): string
61
- /**
62
- * hex 颜色变深颜色值
63
- * @param {string} color - hex 颜色
64
- * @param {number} alpha - 透明度
65
- * @returns {string} hex 颜色
66
- */
67
- export declare function getDarkColor(color: string, alpha: number): string
68
- /**
69
- * 图片转base64
70
- * @param {string} url - 图片路径
71
- * @returns {Promise<string>} base64图片内容
72
- */
73
- export declare function imgToBase64(url: string): Promise<string>
74
- /**
75
- * base64转文件
76
- * @param {string} url - base64文件
77
- * @param {string} fileName - 文件名称
78
- * @returns {File} 文件
79
- */
80
- export declare function base64toFile(url: string, fileName: string): File
81
- /**
82
- * 下载文件
83
- * @param {string} url - 文件路径
84
- * @param {string} fileName - 文件名称
85
- */
86
- export declare function downloadFile(url: string, fileName?: string): void
package/dist/vite.svg DELETED
@@ -1 +0,0 @@
1
- <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" class="iconify iconify--logos" width="31.88" height="32" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 257"><defs><linearGradient id="IconifyId1813088fe1fbc01fb466" x1="-.828%" x2="57.636%" y1="7.652%" y2="78.411%"><stop offset="0%" stop-color="#41D1FF"></stop><stop offset="100%" stop-color="#BD34FE"></stop></linearGradient><linearGradient id="IconifyId1813088fe1fbc01fb467" x1="43.376%" x2="50.316%" y1="2.242%" y2="89.03%"><stop offset="0%" stop-color="#FFEA83"></stop><stop offset="8.333%" stop-color="#FFDD35"></stop><stop offset="100%" stop-color="#FFA800"></stop></linearGradient></defs><path fill="url(#IconifyId1813088fe1fbc01fb466)" d="M255.153 37.938L134.897 252.976c-2.483 4.44-8.862 4.466-11.382.048L.875 37.958c-2.746-4.814 1.371-10.646 6.827-9.67l120.385 21.517a6.537 6.537 0 0 0 2.322-.004l117.867-21.483c5.438-.991 9.574 4.796 6.877 9.62Z"></path><path fill="url(#IconifyId1813088fe1fbc01fb467)" d="M185.432.063L96.44 17.501a3.268 3.268 0 0 0-2.634 3.014l-5.474 92.456a3.268 3.268 0 0 0 3.997 3.378l24.777-5.718c2.318-.535 4.413 1.507 3.936 3.838l-7.361 36.047c-.495 2.426 1.782 4.5 4.151 3.78l15.304-4.649c2.372-.72 4.652 1.36 4.15 3.788l-11.698 56.621c-.732 3.542 3.979 5.473 5.943 2.437l1.313-2.028l72.516-144.72c1.215-2.423-.88-5.186-3.54-4.672l-25.505 4.922c-2.396.462-4.435-1.77-3.759-4.114l16.646-57.705c.677-2.35-1.37-4.583-3.769-4.113Z"></path></svg>