@allahjs/utils 0.0.1

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 (160) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +244 -0
  3. package/dist/.tsbuildinfo +1 -0
  4. package/dist/browser/cookieUtils/index.cjs +100 -0
  5. package/dist/browser/cookieUtils/index.cjs.map +1 -0
  6. package/dist/browser/cookieUtils/index.d.ts +55 -0
  7. package/dist/browser/domUtils/index.cjs +237 -0
  8. package/dist/browser/domUtils/index.cjs.map +1 -0
  9. package/dist/browser/domUtils/index.d.ts +116 -0
  10. package/dist/browser/index.cjs +12 -0
  11. package/dist/browser/index.cjs.map +1 -0
  12. package/dist/browser/index.d.ts +3 -0
  13. package/dist/browser/urlUtils/index.cjs +262 -0
  14. package/dist/browser/urlUtils/index.cjs.map +1 -0
  15. package/dist/browser/urlUtils/index.d.ts +72 -0
  16. package/dist/core/arrayUtils/index.cjs +109 -0
  17. package/dist/core/arrayUtils/index.cjs.map +1 -0
  18. package/dist/core/arrayUtils/index.d.ts +67 -0
  19. package/dist/core/asyncUtils/index.cjs +180 -0
  20. package/dist/core/asyncUtils/index.cjs.map +1 -0
  21. package/dist/core/asyncUtils/index.d.ts +80 -0
  22. package/dist/core/colorUtils/index.cjs +38 -0
  23. package/dist/core/colorUtils/index.cjs.map +1 -0
  24. package/dist/core/colorUtils/index.d.ts +10 -0
  25. package/dist/core/cryptoUtils/index.cjs +428 -0
  26. package/dist/core/cryptoUtils/index.cjs.map +1 -0
  27. package/dist/core/cryptoUtils/index.d.ts +132 -0
  28. package/dist/core/dateUtils/index.cjs +245 -0
  29. package/dist/core/dateUtils/index.cjs.map +1 -0
  30. package/dist/core/dateUtils/index.d.ts +117 -0
  31. package/dist/core/index.cjs +34 -0
  32. package/dist/core/index.cjs.map +1 -0
  33. package/dist/core/index.d.ts +118 -0
  34. package/dist/core/numberUtils/index.cjs +126 -0
  35. package/dist/core/numberUtils/index.cjs.map +1 -0
  36. package/dist/core/numberUtils/index.d.ts +91 -0
  37. package/dist/core/objectUtils/index.cjs +249 -0
  38. package/dist/core/objectUtils/index.cjs.map +1 -0
  39. package/dist/core/objectUtils/index.d.ts +91 -0
  40. package/dist/core/pageUtils/index.cjs +74 -0
  41. package/dist/core/pageUtils/index.cjs.map +1 -0
  42. package/dist/core/pageUtils/index.d.ts +52 -0
  43. package/dist/core/stringUtils/index.cjs +163 -0
  44. package/dist/core/stringUtils/index.cjs.map +1 -0
  45. package/dist/core/stringUtils/index.d.ts +69 -0
  46. package/dist/core/validationUtils/index.cjs +154 -0
  47. package/dist/core/validationUtils/index.cjs.map +1 -0
  48. package/dist/core/validationUtils/index.d.ts +87 -0
  49. package/dist/esm/browser/cookieUtils/index.d.ts +55 -0
  50. package/dist/esm/browser/cookieUtils/index.js +96 -0
  51. package/dist/esm/browser/cookieUtils/index.js.map +1 -0
  52. package/dist/esm/browser/domUtils/index.d.ts +116 -0
  53. package/dist/esm/browser/domUtils/index.js +233 -0
  54. package/dist/esm/browser/domUtils/index.js.map +1 -0
  55. package/dist/esm/browser/index.d.ts +3 -0
  56. package/dist/esm/browser/index.js +4 -0
  57. package/dist/esm/browser/index.js.map +1 -0
  58. package/dist/esm/browser/urlUtils/index.d.ts +72 -0
  59. package/dist/esm/browser/urlUtils/index.js +248 -0
  60. package/dist/esm/browser/urlUtils/index.js.map +1 -0
  61. package/dist/esm/core/arrayUtils/index.d.ts +67 -0
  62. package/dist/esm/core/arrayUtils/index.js +105 -0
  63. package/dist/esm/core/arrayUtils/index.js.map +1 -0
  64. package/dist/esm/core/asyncUtils/index.d.ts +80 -0
  65. package/dist/esm/core/asyncUtils/index.js +175 -0
  66. package/dist/esm/core/asyncUtils/index.js.map +1 -0
  67. package/dist/esm/core/colorUtils/index.d.ts +10 -0
  68. package/dist/esm/core/colorUtils/index.js +34 -0
  69. package/dist/esm/core/colorUtils/index.js.map +1 -0
  70. package/dist/esm/core/cryptoUtils/index.d.ts +132 -0
  71. package/dist/esm/core/cryptoUtils/index.js +424 -0
  72. package/dist/esm/core/cryptoUtils/index.js.map +1 -0
  73. package/dist/esm/core/dateUtils/index.d.ts +117 -0
  74. package/dist/esm/core/dateUtils/index.js +241 -0
  75. package/dist/esm/core/dateUtils/index.js.map +1 -0
  76. package/dist/esm/core/index.d.ts +118 -0
  77. package/dist/esm/core/index.js +30 -0
  78. package/dist/esm/core/index.js.map +1 -0
  79. package/dist/esm/core/numberUtils/index.d.ts +91 -0
  80. package/dist/esm/core/numberUtils/index.js +122 -0
  81. package/dist/esm/core/numberUtils/index.js.map +1 -0
  82. package/dist/esm/core/objectUtils/index.d.ts +91 -0
  83. package/dist/esm/core/objectUtils/index.js +245 -0
  84. package/dist/esm/core/objectUtils/index.js.map +1 -0
  85. package/dist/esm/core/pageUtils/index.d.ts +52 -0
  86. package/dist/esm/core/pageUtils/index.js +66 -0
  87. package/dist/esm/core/pageUtils/index.js.map +1 -0
  88. package/dist/esm/core/stringUtils/index.d.ts +69 -0
  89. package/dist/esm/core/stringUtils/index.js +159 -0
  90. package/dist/esm/core/stringUtils/index.js.map +1 -0
  91. package/dist/esm/core/validationUtils/index.d.ts +87 -0
  92. package/dist/esm/core/validationUtils/index.js +150 -0
  93. package/dist/esm/core/validationUtils/index.js.map +1 -0
  94. package/dist/esm/index.d.ts +22 -0
  95. package/dist/esm/index.js +26 -0
  96. package/dist/esm/index.js.map +1 -0
  97. package/dist/esm/request/ReqQueue/index.js +59 -0
  98. package/dist/esm/request/ReqQueue/index.js.map +1 -0
  99. package/dist/esm/request/httpCode/index.js +49 -0
  100. package/dist/esm/request/httpCode/index.js.map +1 -0
  101. package/dist/esm/request/httpUtils/index.js +359 -0
  102. package/dist/esm/request/httpUtils/index.js.map +1 -0
  103. package/dist/esm/request/index.d.ts +15 -0
  104. package/dist/esm/request/index.js +166 -0
  105. package/dist/esm/request/index.js.map +1 -0
  106. package/dist/esm/request/typings/index.d.ts +184 -0
  107. package/dist/esm/request/uniRequest/index.js +62 -0
  108. package/dist/esm/request/uniRequest/index.js.map +1 -0
  109. package/dist/esm/types/data/index.d.ts +188 -0
  110. package/dist/esm/types/data/index.js +13 -0
  111. package/dist/esm/types/data/index.js.map +1 -0
  112. package/dist/esm/types/index.d.ts +1 -0
  113. package/dist/esm/types/index.js +2 -0
  114. package/dist/esm/types/index.js.map +1 -0
  115. package/dist/esm/uniapp/Tips/index.d.ts +295 -0
  116. package/dist/esm/uniapp/Tips/index.js +498 -0
  117. package/dist/esm/uniapp/Tips/index.js.map +1 -0
  118. package/dist/esm/uniapp/cloudUtils/index.d.ts +56 -0
  119. package/dist/esm/uniapp/cloudUtils/index.js +90 -0
  120. package/dist/esm/uniapp/cloudUtils/index.js.map +1 -0
  121. package/dist/esm/uniapp/index.d.ts +3 -0
  122. package/dist/esm/uniapp/index.js +4 -0
  123. package/dist/esm/uniapp/index.js.map +1 -0
  124. package/dist/esm/uniapp/uniUtils/index.d.ts +113 -0
  125. package/dist/esm/uniapp/uniUtils/index.js +199 -0
  126. package/dist/esm/uniapp/uniUtils/index.js.map +1 -0
  127. package/dist/index.cjs +88 -0
  128. package/dist/index.cjs.map +1 -0
  129. package/dist/index.d.ts +22 -0
  130. package/dist/request/ReqQueue/index.cjs +63 -0
  131. package/dist/request/ReqQueue/index.cjs.map +1 -0
  132. package/dist/request/httpCode/index.cjs +52 -0
  133. package/dist/request/httpCode/index.cjs.map +1 -0
  134. package/dist/request/httpUtils/index.cjs +365 -0
  135. package/dist/request/httpUtils/index.cjs.map +1 -0
  136. package/dist/request/index.cjs +170 -0
  137. package/dist/request/index.cjs.map +1 -0
  138. package/dist/request/index.d.ts +15 -0
  139. package/dist/request/typings/index.d.ts +184 -0
  140. package/dist/request/uniRequest/index.cjs +66 -0
  141. package/dist/request/uniRequest/index.cjs.map +1 -0
  142. package/dist/types/data/index.cjs +15 -0
  143. package/dist/types/data/index.cjs.map +1 -0
  144. package/dist/types/data/index.d.ts +188 -0
  145. package/dist/types/index.cjs +8 -0
  146. package/dist/types/index.cjs.map +1 -0
  147. package/dist/types/index.d.ts +1 -0
  148. package/dist/uniapp/Tips/index.cjs +521 -0
  149. package/dist/uniapp/Tips/index.cjs.map +1 -0
  150. package/dist/uniapp/Tips/index.d.ts +295 -0
  151. package/dist/uniapp/cloudUtils/index.cjs +92 -0
  152. package/dist/uniapp/cloudUtils/index.cjs.map +1 -0
  153. package/dist/uniapp/cloudUtils/index.d.ts +56 -0
  154. package/dist/uniapp/index.cjs +53 -0
  155. package/dist/uniapp/index.cjs.map +1 -0
  156. package/dist/uniapp/index.d.ts +3 -0
  157. package/dist/uniapp/uniUtils/index.cjs +213 -0
  158. package/dist/uniapp/uniUtils/index.cjs.map +1 -0
  159. package/dist/uniapp/uniUtils/index.d.ts +113 -0
  160. package/package.json +129 -0
@@ -0,0 +1,295 @@
1
+ /**
2
+ * 提示类型枚举
3
+ */
4
+ declare enum ToastType {
5
+ SUCCESS = "success",
6
+ ERROR = "error",
7
+ WARNING = "warning",
8
+ INFO = "info",
9
+ LOADING = "loading"
10
+ }
11
+ /**
12
+ * 提示位置枚举
13
+ */
14
+ declare enum ToastPosition {
15
+ TOP = "top",
16
+ CENTER = "center",
17
+ BOTTOM = "bottom"
18
+ }
19
+ /**
20
+ * 模态框按钮配置
21
+ */
22
+ interface ModalButton {
23
+ text: string;
24
+ color?: string;
25
+ }
26
+ /**
27
+ * 模态框配置选项
28
+ */
29
+ interface ModalOptions {
30
+ title?: string;
31
+ content: string;
32
+ showCancel?: boolean;
33
+ cancelText?: string;
34
+ cancelColor?: string;
35
+ confirmText?: string;
36
+ confirmColor?: string;
37
+ editable?: boolean;
38
+ placeholderText?: string;
39
+ }
40
+ /**
41
+ * ActionSheet 选项配置
42
+ */
43
+ interface ActionSheetItem {
44
+ text: string;
45
+ color?: string;
46
+ }
47
+ /**
48
+ * ActionSheet 配置选项
49
+ */
50
+ interface ActionSheetOptions {
51
+ itemList: string[] | ActionSheetItem[];
52
+ itemColor?: string;
53
+ title?: string;
54
+ }
55
+ /**
56
+ * 统一的提示工具对象
57
+ */
58
+ declare const Tips: {
59
+ /**
60
+ * 显示成功提示
61
+ */
62
+ success: (title: string, duration?: number, mask?: boolean) => void;
63
+ /**
64
+ * 显示错误提示
65
+ */
66
+ error: (title: string, duration?: number, mask?: boolean) => void;
67
+ /**
68
+ * 显示警告提示
69
+ */
70
+ warning: (title: string, duration?: number, mask?: boolean) => void;
71
+ /**
72
+ * 显示普通提示
73
+ */
74
+ info: (title: string, duration?: number, mask?: boolean) => void;
75
+ /**
76
+ * 显示加载提示
77
+ */
78
+ loading: (title?: string, mask?: boolean) => void;
79
+ /**
80
+ * 隐藏加载提示
81
+ */
82
+ hideLoading: () => void;
83
+ /**
84
+ * 隐藏所有提示
85
+ */
86
+ hide: () => void;
87
+ /**
88
+ * 显示确认对话框
89
+ */
90
+ confirm: (content: string, title?: string) => Promise<boolean>;
91
+ /**
92
+ * 显示自定义模态框
93
+ */
94
+ modal: (options: ModalOptions) => Promise<{
95
+ confirm: boolean;
96
+ cancel: boolean;
97
+ content?: string;
98
+ }>;
99
+ /**
100
+ * 显示输入框对话框
101
+ */
102
+ input: (content: string, placeholder?: string, title?: string) => Promise<{
103
+ confirmed: boolean;
104
+ content: string;
105
+ }>;
106
+ /**
107
+ * 显示操作菜单
108
+ */
109
+ actionSheet: (options: ActionSheetOptions) => Promise<{
110
+ tapIndex: number;
111
+ cancelled: boolean;
112
+ }>;
113
+ /**
114
+ * 显示带回调的成功提示
115
+ */
116
+ successCallback: (title: string, callback: () => void, duration?: number) => void;
117
+ /**
118
+ * 显示带回调的错误提示
119
+ */
120
+ errorCallback: (title: string, callback: () => void, duration?: number) => void;
121
+ /**
122
+ * 显示加载提示并执行异步操作
123
+ */
124
+ async: <T>(asyncFn: () => Promise<T>, loadingText?: string, successText?: string, errorText?: string) => Promise<T>;
125
+ /**
126
+ * 显示删除确认对话框
127
+ */
128
+ deleteConfirm: (itemName: string, title?: string) => Promise<boolean>;
129
+ /**
130
+ * 显示网络错误提示
131
+ */
132
+ networkError: (customMessage?: string) => void;
133
+ /**
134
+ * 显示权限请求提示
135
+ */
136
+ permission: (permissionName: string) => Promise<boolean>;
137
+ /**
138
+ * 显示版本更新提示
139
+ */
140
+ update: (version: string, updateContent: string, isForced?: boolean) => Promise<boolean>;
141
+ /**
142
+ * 防抖成功提示
143
+ */
144
+ successDebounced: (title: string, duration?: number) => void;
145
+ /**
146
+ * 防抖错误提示
147
+ */
148
+ errorDebounced: (title: string, duration?: number) => void;
149
+ /**
150
+ * 创建批量操作提示管理器
151
+ */
152
+ batch: () => BatchOperationTips;
153
+ };
154
+ /**
155
+ * 显示成功提示
156
+ * @deprecated 建议使用 Tips.success
157
+ */
158
+ declare const showSuccessToast: (title: string, duration?: number, mask?: boolean) => void;
159
+ /**
160
+ * 显示错误提示
161
+ * @deprecated 建议使用 Tips.error
162
+ */
163
+ declare const showErrorToast: (title: string, duration?: number, mask?: boolean) => void;
164
+ /**
165
+ * 显示警告提示
166
+ * @deprecated 建议使用 Tips.warning
167
+ */
168
+ declare const showWarningToast: (title: string, duration?: number, mask?: boolean) => void;
169
+ /**
170
+ * 显示普通提示(无图标)
171
+ * @deprecated 建议使用 Tips.info
172
+ */
173
+ declare const showToast: (title: string, duration?: number, mask?: boolean) => void;
174
+ /**
175
+ * 显示加载提示
176
+ * @deprecated 建议使用 Tips.loading
177
+ */
178
+ declare const showLoading: (title?: string, mask?: boolean) => void;
179
+ /**
180
+ * 隐藏加载提示
181
+ * @deprecated 建议使用 Tips.hideLoading
182
+ */
183
+ declare const hideLoading: () => void;
184
+ /**
185
+ * 隐藏所有提示
186
+ * @deprecated 建议使用 Tips.hide
187
+ */
188
+ declare const hideToast: () => void;
189
+ /**
190
+ * 显示确认对话框
191
+ * @deprecated 建议使用 Tips.confirm
192
+ */
193
+ declare const showConfirmDialog: (content: string, title?: string) => Promise<boolean>;
194
+ /**
195
+ * 显示自定义模态框
196
+ * @deprecated 建议使用 Tips.modal
197
+ */
198
+ declare const showModal: (options: ModalOptions) => Promise<{
199
+ confirm: boolean;
200
+ cancel: boolean;
201
+ content?: string;
202
+ }>;
203
+ /**
204
+ * 显示输入框对话框
205
+ * @deprecated 建议使用 Tips.input
206
+ */
207
+ declare const showInputDialog: (content: string, placeholder?: string, title?: string) => Promise<{
208
+ confirmed: boolean;
209
+ content: string;
210
+ }>;
211
+ /**
212
+ * 显示操作菜单
213
+ * @deprecated 建议使用 Tips.actionSheet
214
+ */
215
+ declare const showActionSheet: (options: ActionSheetOptions) => Promise<{
216
+ tapIndex: number;
217
+ cancelled: boolean;
218
+ }>;
219
+ /**
220
+ * 显示带回调的成功提示
221
+ * @deprecated 建议使用 Tips.successCallback
222
+ */
223
+ declare const showSuccessToastWithCallback: (title: string, callback: () => void, duration?: number) => void;
224
+ /**
225
+ * 显示带回调的错误提示
226
+ * @deprecated 建议使用 Tips.errorCallback
227
+ */
228
+ declare const showErrorToastWithCallback: (title: string, callback: () => void, duration?: number) => void;
229
+ /**
230
+ * 显示加载提示并执行异步操作
231
+ * @deprecated 建议使用 Tips.async
232
+ */
233
+ declare const showLoadingWithAsync: <T>(asyncFn: () => Promise<T>, loadingText?: string, successText?: string, errorText?: string) => Promise<T>;
234
+ /**
235
+ * 显示删除确认对话框
236
+ * @deprecated 建议使用 Tips.deleteConfirm
237
+ */
238
+ declare const showDeleteConfirm: (itemName: string, title?: string) => Promise<boolean>;
239
+ /**
240
+ * 显示网络错误提示
241
+ * @deprecated 建议使用 Tips.networkError
242
+ */
243
+ declare const showNetworkError: (customMessage?: string) => void;
244
+ /**
245
+ * 显示权限请求提示
246
+ * @deprecated 建议使用 Tips.permission
247
+ */
248
+ declare const showPermissionRequest: (permissionName: string) => Promise<boolean>;
249
+ /**
250
+ * 显示版本更新提示
251
+ * @deprecated 建议使用 Tips.update
252
+ */
253
+ declare const showUpdateDialog: (version: string, updateContent: string, isForced?: boolean) => Promise<boolean>;
254
+ /**
255
+ * 防抖成功提示
256
+ * @deprecated 建议使用 Tips.successDebounced
257
+ */
258
+ declare const showSuccessToastDebounced: (title: string, duration?: number) => void;
259
+ /**
260
+ * 防抖错误提示
261
+ * @deprecated 建议使用 Tips.errorDebounced
262
+ */
263
+ declare const showErrorToastDebounced: (title: string, duration?: number) => void;
264
+ /**
265
+ * 批量操作提示管理器
266
+ */
267
+ declare class BatchOperationTips {
268
+ private total;
269
+ private current;
270
+ private operation;
271
+ /**
272
+ * 开始批量操作
273
+ * @param total 总数量
274
+ * @param operation 操作名称
275
+ */
276
+ start(total: number, operation?: string): void;
277
+ /**
278
+ * 更新进度
279
+ * @param increment 增加的数量,默认1
280
+ */
281
+ progress(increment?: number): void;
282
+ /**
283
+ * 完成批量操作
284
+ * @param successMessage 成功提示信息
285
+ */
286
+ complete(successMessage?: string): void;
287
+ /**
288
+ * 批量操作失败
289
+ * @param errorMessage 错误提示信息
290
+ */
291
+ error(errorMessage?: string): void;
292
+ }
293
+
294
+ export { BatchOperationTips, Tips, ToastPosition, ToastType, hideLoading, hideToast, showActionSheet, showConfirmDialog, showDeleteConfirm, showErrorToast, showErrorToastDebounced, showErrorToastWithCallback, showInputDialog, showLoading, showLoadingWithAsync, showModal, showNetworkError, showPermissionRequest, showSuccessToast, showSuccessToastDebounced, showSuccessToastWithCallback, showToast, showUpdateDialog, showWarningToast };
295
+ export type { ActionSheetItem, ActionSheetOptions, ModalButton, ModalOptions };