cool-common-utils 0.0.1-beta.2

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.
@@ -0,0 +1 @@
1
+ export { drawCode, codeRandomColor } from './verification-code';
@@ -0,0 +1,6 @@
1
+ export interface DrawCodeType {
2
+ src: string;
3
+ text: string;
4
+ }
5
+ export declare const drawCode: () => DrawCodeType;
6
+ export declare const codeRandomColor: () => string;
@@ -0,0 +1,2 @@
1
+ export declare const encryptAES: (plaintext: string, keyWord?: string) => string;
2
+ export declare const decryptAES: (ciphered: string, keyWord?: string) => string;
@@ -0,0 +1 @@
1
+ export { encryptAES, decryptAES } from './aes';
@@ -0,0 +1,14 @@
1
+ interface ColumnsType {
2
+ label: string;
3
+ field?: string;
4
+ children?: ColumnsType[];
5
+ }
6
+ interface ExcelXlsxOptions {
7
+ columns?: ColumnsType[];
8
+ data?: Record<string, any>[];
9
+ sheetName?: string;
10
+ fileName?: string;
11
+ fileType?: string;
12
+ }
13
+ export declare const exportExcelXlsx: (options?: ExcelXlsxOptions) => void;
14
+ export {};
@@ -0,0 +1 @@
1
+ export { exportExcelXlsx } from './excel-xlsx-util';
@@ -0,0 +1,562 @@
1
+ interface PolygonOption {
2
+ path?: any[];
3
+ zIndex?: number;
4
+ bubble?: boolean;
5
+ cursor?: string;
6
+ strokeColor?: string;
7
+ strokeOpacity?: number;
8
+ strokeWeight?: number;
9
+ fillColor?: string;
10
+ fillOpacity?: number;
11
+ draggable?: boolean;
12
+ extData?: any;
13
+ strokeStyle?: string;
14
+ strokeDasharray?: number[];
15
+ }
16
+ interface PolylineOption {
17
+ path?: any[];
18
+ zIndex?: number;
19
+ bubble?: boolean;
20
+ cursor?: string;
21
+ strokeColor?: string;
22
+ strokeOpacity?: number;
23
+ strokeWeight?: number;
24
+ draggable?: boolean;
25
+ extData?: any;
26
+ strokeStyle?: string;
27
+ strokeDasharray?: number[];
28
+ lineJoin?: 'miter' | 'round' | 'bevel';
29
+ lineCap?: 'butt' | 'round' | 'square';
30
+ borderWeight?: number;
31
+ outlineColor?: string;
32
+ geodesic?: boolean;
33
+ showDir?: boolean;
34
+ isOutline?: boolean;
35
+ dirImg?: string;
36
+ }
37
+ interface MarkerOption {
38
+ position?: any;
39
+ icon?: any;
40
+ content?: any;
41
+ title?: string;
42
+ zIndex?: number;
43
+ offset?: any;
44
+ bubble?: boolean;
45
+ cursor?: string;
46
+ draggable?: boolean;
47
+ extData?: any;
48
+ label?: any;
49
+ clickable?: boolean;
50
+ }
51
+ declare global {
52
+ interface Window {
53
+ map: any;
54
+ AMap: any;
55
+ }
56
+ }
57
+ /**
58
+ * 点位居中
59
+ * @param lngLat
60
+ */
61
+ export declare const setCenter: (lngLat: any, mapOptions?: {}) => void;
62
+ /**
63
+ * 点位居中缩放
64
+ * @param lngLat
65
+ * @param zoom
66
+ */
67
+ export declare const setCenterZoom: (lngLat: any, zoom: number, mapOptions?: {}) => void;
68
+ export declare const setMapFitView: (overlays: Record<string, any>[], centerView: number[], mapOptions?: {}) => void;
69
+ export declare class AddPolygonList {
70
+ private polygons;
71
+ private layer;
72
+ data: any[];
73
+ callback?: any;
74
+ overlayOption?: any;
75
+ option: PolygonOption;
76
+ constructor(data: PolygonOption[], options?: any, callback?: any);
77
+ /**
78
+ * 初始化添加区域方法
79
+ */
80
+ private initPolygon;
81
+ private getOverlays;
82
+ /**
83
+ * 清除区域方法
84
+ */
85
+ removePolygon(): void;
86
+ /**
87
+ * 获取区域方法
88
+ */
89
+ getPolygons(): any;
90
+ /**
91
+ * 设置区域居中
92
+ */
93
+ private setPolygonFitView;
94
+ }
95
+ export declare class AddPolylineList {
96
+ private polylines;
97
+ private startMarkers;
98
+ private endMarkers;
99
+ private layer;
100
+ option: PolylineOption;
101
+ data: any[];
102
+ callback?: any;
103
+ overlayOption?: any;
104
+ constructor(data: PolylineOption[], options?: any, callback?: any);
105
+ /**
106
+ * 初始化添加路线方法
107
+ */
108
+ private initPolyline;
109
+ private getOverlays;
110
+ /**
111
+ * 清除路线方法
112
+ */
113
+ removePolyline(): void;
114
+ /**
115
+ * 获取路线方法
116
+ */
117
+ getPolylines(): any;
118
+ /**
119
+ * 设置路线居中
120
+ */
121
+ private setPolylineFitView;
122
+ }
123
+ export declare class AddCluster {
124
+ private cluster;
125
+ data: any[];
126
+ option: any;
127
+ clusterCallback?: any;
128
+ constructor(data: any[], clusterCallback?: any, option?: any);
129
+ /**
130
+ * 初始化添加聚合点方法
131
+ */
132
+ private initCluster;
133
+ /**
134
+ * 清除聚合点方法
135
+ */
136
+ removeCluster(): void;
137
+ /**
138
+ * 获取聚合对象方法
139
+ */
140
+ getCluster(): Record<string, any> | null;
141
+ /**
142
+ * 获取聚合对象方法
143
+ */
144
+ getMarkers(): Record<string, any>[];
145
+ /**
146
+ * 设置聚合对象居中
147
+ */
148
+ private setClusterFitView;
149
+ }
150
+ /**
151
+ * 弹窗类
152
+ */
153
+ export declare class AddInfoWindow {
154
+ private infoWindow;
155
+ private mapOptions;
156
+ content: any;
157
+ lngLat: any;
158
+ closeCallback?: any;
159
+ openCallback?: any;
160
+ closeStatus: boolean;
161
+ constructor(content: any, lngLat: any, mapOptions?: {}, closeCallback?: any, openCallback?: any);
162
+ private initInfoWindow;
163
+ removeInfoWindow(): void;
164
+ }
165
+ /**
166
+ * 轨迹弹窗类
167
+ */
168
+ export declare class AddTrackInfoWindow {
169
+ private infoWindow;
170
+ private mapOptions;
171
+ content: any;
172
+ lngLat: any;
173
+ constructor(content: any, lngLat: any, mapOptions?: {});
174
+ private initInfoWindow;
175
+ removeInfoWindow(): void;
176
+ }
177
+ /**
178
+ * 轨迹类
179
+ */
180
+ export declare class AddTrack {
181
+ private marker;
182
+ private startMarker;
183
+ private endMarker;
184
+ private labelMarker;
185
+ private polyLine;
186
+ private passPolyLine;
187
+ private speed;
188
+ private index;
189
+ private passLinePath;
190
+ private onePosition;
191
+ private progressCallback;
192
+ lineArr: any[];
193
+ callback: any;
194
+ trueLineArr: any[];
195
+ option: any;
196
+ linePath: Record<string, any>[];
197
+ playStatus: string;
198
+ constructor(markerObj: any, lineObj: any, passLineObj: any, option?: any, callback?: any);
199
+ private createTrack;
200
+ /**
201
+ * 创建车辆点位
202
+ * @param obj
203
+ */
204
+ private createMarker;
205
+ /**
206
+ * 创建轨迹线
207
+ * @param obj
208
+ */
209
+ private createPolyLine;
210
+ private getAngle;
211
+ /**
212
+ * 创建已播放轨迹
213
+ * @param obj
214
+ */
215
+ private createPassPolyLine;
216
+ getProgressData(callback: (num: number) => void): void;
217
+ setLabelContent(content: string, num: number): void;
218
+ /**
219
+ * 设置播放速度
220
+ * @param speed
221
+ */
222
+ setSpeed(speed: number): void;
223
+ /**
224
+ * 设置已播放路线
225
+ * @param index
226
+ */
227
+ setTrueLineArr(index: number): void;
228
+ /**
229
+ * 开始播放
230
+ */
231
+ startAnimation(): void;
232
+ /**
233
+ * 暂停播放
234
+ */
235
+ pauseAnimation(): void;
236
+ /**
237
+ * 继续播放
238
+ */
239
+ resumeAnimation(): void;
240
+ /**
241
+ * 停止播放
242
+ */
243
+ stopAnimation(): void;
244
+ clearStopAnimation(): void;
245
+ numStopAnimation(): void;
246
+ /**
247
+ * 清除区域方法
248
+ */
249
+ removeTrack(): void;
250
+ /**
251
+ * 获取资源方法
252
+ */
253
+ getOverlays(): Record<string, any>[];
254
+ /**
255
+ * 设置区域居中
256
+ */
257
+ private setTrackFitView;
258
+ }
259
+ /**
260
+ * 轨迹类数组
261
+ */
262
+ export declare class AddTrackList {
263
+ private tracks;
264
+ private tracksId;
265
+ private option;
266
+ trackState: string;
267
+ private readonly callback;
268
+ constructor(trackList: any[], option?: {}, callback?: any);
269
+ private initTracks;
270
+ startAnimation(): void;
271
+ pauseAnimation(): void;
272
+ resumeAnimation(): void;
273
+ stopAnimation(): void;
274
+ clearStopAnimation(): void;
275
+ removeTrack(): void;
276
+ getOverlays(): any;
277
+ private setTrackFitView;
278
+ }
279
+ export declare class AddMarkerList {
280
+ private markers;
281
+ private option;
282
+ data: any[];
283
+ callback?: any;
284
+ overlayOption?: any;
285
+ constructor(data: MarkerOption[], options?: any, callback?: any);
286
+ /**
287
+ * 初始化添加点位方法
288
+ */
289
+ private initMarker;
290
+ /**
291
+ * 清除点位方法
292
+ */
293
+ removeMarker(): void;
294
+ /**
295
+ * 获取点位方法
296
+ */
297
+ getMarkers(): any;
298
+ /**
299
+ * 设置区域居中
300
+ */
301
+ private setMarkerFitView;
302
+ }
303
+ export declare class AddHideMarkerList {
304
+ private markers;
305
+ private mapOptions;
306
+ data: any[];
307
+ constructor(data: any[], mapOptions?: {});
308
+ /**
309
+ * 初始化添加点位方法
310
+ */
311
+ private initMarker;
312
+ /**
313
+ * 清除点位方法
314
+ */
315
+ removeMarker(): void;
316
+ /**
317
+ * 获取点位方法
318
+ */
319
+ getMarkers(): any;
320
+ }
321
+ export declare class AddLabelMarkerList {
322
+ private markers;
323
+ private option;
324
+ private layer;
325
+ data: any[];
326
+ callback?: any;
327
+ overlayOption?: any;
328
+ constructor(data: MarkerOption[], options?: any, callback?: any);
329
+ /**
330
+ * 初始化添加点位方法
331
+ */
332
+ private initMarker;
333
+ /**
334
+ * 清除点位方法
335
+ */
336
+ removeMarker(): void;
337
+ /**
338
+ * 获取点位方法
339
+ */
340
+ getMarkers(): any;
341
+ /**
342
+ * 设置区域居中
343
+ */
344
+ private setMarkerFitView;
345
+ }
346
+ export declare class AddCircleList {
347
+ private circles;
348
+ private option;
349
+ data: any[];
350
+ callback?: any;
351
+ overlayOption?: any;
352
+ constructor(data: Record<string, any>[], options?: any, callback?: any);
353
+ /**
354
+ * 初始化添加点位方法
355
+ */
356
+ private initCircle;
357
+ /**
358
+ * 清除点位方法
359
+ */
360
+ removeCircle(): void;
361
+ /**
362
+ * 获取点位方法
363
+ */
364
+ getCircles(): any;
365
+ /**
366
+ * 设置区域居中
367
+ */
368
+ private setCircleFitView;
369
+ }
370
+ /**
371
+ * 实时轨迹类
372
+ */
373
+ export declare class RealtimeTrack {
374
+ private marker;
375
+ private polyLine;
376
+ private labelMarker;
377
+ onePosition: Record<string, any>[];
378
+ option: any;
379
+ callback: any;
380
+ linePath: Record<string, any>[];
381
+ constructor(markerObj: any, lineObj: any, option?: any, callback?: any);
382
+ private createTrack;
383
+ /**
384
+ * 创建车辆点位
385
+ * @param obj
386
+ */
387
+ private createMarker;
388
+ /**
389
+ * 创建轨迹线
390
+ * @param obj
391
+ */
392
+ private createPolyLine;
393
+ /**
394
+ * 创建已播放轨迹
395
+ */
396
+ private createPassPolyLine;
397
+ setLabelContent(content: string, num: number): void;
398
+ /**
399
+ * 开始播放
400
+ */
401
+ startAnimation(path: any[]): void;
402
+ /**
403
+ * 停止播放
404
+ */
405
+ stopAnimation(): void;
406
+ /**
407
+ * 清除区域方法
408
+ */
409
+ removeTrack(): void;
410
+ /**
411
+ * 获取资源方法
412
+ */
413
+ getOverlays(): Record<string, any>[];
414
+ /**
415
+ * 设置区域居中
416
+ */
417
+ private setTrackFitView;
418
+ }
419
+ export declare class AddCircleMarkerList {
420
+ private markers;
421
+ private circles;
422
+ private option;
423
+ data: any[];
424
+ callback?: any;
425
+ overlayOption?: any;
426
+ constructor(data: MarkerOption[], options?: any, callback?: any);
427
+ /**
428
+ * 初始化添加点位方法
429
+ */
430
+ private initCircleMarker;
431
+ getOverlays(): Record<string, any>[];
432
+ /**
433
+ * 清除点位方法
434
+ */
435
+ removeCircleMarker(): void;
436
+ /**
437
+ * 获取点位方法
438
+ */
439
+ getCircleMarkers(): any;
440
+ /**
441
+ * 设置区域居中
442
+ */
443
+ private setCircleMarkerFitView;
444
+ }
445
+ export declare class AddCarPolyline {
446
+ private polyline;
447
+ private driving;
448
+ private mapOptions;
449
+ private readonly startPoint;
450
+ private readonly endPoint;
451
+ private path;
452
+ private timer;
453
+ private index;
454
+ constructor(startPoint: number[], endPoint: number[], mapOptions?: {});
455
+ drawPolyline(): void;
456
+ animatePolyline(): void;
457
+ removePolyline(): void;
458
+ }
459
+ export declare class AddPolygonFormGeoJson {
460
+ private polygons;
461
+ private layer;
462
+ callback?: any;
463
+ overlayOption?: any;
464
+ url: string;
465
+ option: PolygonOption;
466
+ constructor(url: string, option?: Record<string, any>, options?: Record<string, any>, callback?: any);
467
+ initPolygon(): void;
468
+ /**
469
+ * 清除区域方法
470
+ */
471
+ removePolygon(): void;
472
+ /**
473
+ * 获取区域方法
474
+ */
475
+ getPolygons(): Record<string, any>[];
476
+ /**
477
+ * 设置区域居中
478
+ */
479
+ private setPolygonFitView;
480
+ }
481
+ export declare class AddPolylineFormGeoJson {
482
+ private polyLines;
483
+ private layer;
484
+ callback?: any;
485
+ overlayOption?: any;
486
+ url: string;
487
+ option: Record<string, any>;
488
+ constructor(url: string, option?: Record<string, any>, options?: Record<string, any>, callback?: any);
489
+ initPolyline(): void;
490
+ /**
491
+ * 清除路线方法
492
+ */
493
+ removePolyline(): void;
494
+ /**
495
+ * 获取路线方法
496
+ */
497
+ getPolyline(): Record<string, any>[];
498
+ /**
499
+ * 设置路线居中
500
+ */
501
+ private setPolylineFitView;
502
+ }
503
+ export declare class AddMarkerFormGeoJson {
504
+ private markers;
505
+ callback?: any;
506
+ overlayOption?: any;
507
+ url: string;
508
+ option: Record<string, any>;
509
+ constructor(url: string, option?: Record<string, any>, options?: Record<string, any>, callback?: any);
510
+ initMarker(): void;
511
+ /**
512
+ * 清除点位方法
513
+ */
514
+ removeMarker(): void;
515
+ /**
516
+ * 获取点位方法
517
+ */
518
+ getMarker(): Record<string, any>[];
519
+ /**
520
+ * 设置点位居中
521
+ */
522
+ private setMarkerFitView;
523
+ }
524
+ export declare class AddClusterFormGeoJson {
525
+ private cluster;
526
+ callback?: any;
527
+ overlayOption?: any;
528
+ url: string;
529
+ icon: any;
530
+ option: Record<string, any>;
531
+ constructor(url: string, icon: any, option?: Record<string, any>, callback?: any);
532
+ initCluster(): void;
533
+ /**
534
+ * 清除聚合方法
535
+ */
536
+ removeCluster(): void;
537
+ /**
538
+ * 获取聚合点位对象方法
539
+ */
540
+ getCluster(): any;
541
+ /**
542
+ * 设置聚合点位居中
543
+ */
544
+ private setClusterFitView;
545
+ }
546
+ export declare class RectSelect {
547
+ private mouseTool;
548
+ private rect;
549
+ private mapOptions;
550
+ callback?: any;
551
+ constructor(callback?: any, mapOptions?: {});
552
+ /**
553
+ * 初始化添加区域方法
554
+ */
555
+ private initMouseTool;
556
+ /**
557
+ * 清除区域方法
558
+ */
559
+ removeMouseTool(): void;
560
+ removeRect(): void;
561
+ }
562
+ export {};
@@ -0,0 +1 @@
1
+ export { setCenter, setCenterZoom, setMapFitView, AddPolygonList, AddPolylineList, AddCluster, AddInfoWindow, AddTrackInfoWindow, AddMarkerList, AddHideMarkerList, AddLabelMarkerList, AddCircleList, RectSelect, AddTrack, AddTrackList, RealtimeTrack, AddCircleMarkerList, AddCarPolyline, AddPolygonFormGeoJson, AddPolylineFormGeoJson, AddMarkerFormGeoJson, AddClusterFormGeoJson } from './amap-utils';
@@ -0,0 +1 @@
1
+ export { CreateRequest, ApiType, ConfigOptions, Options } from './request';
@@ -0,0 +1,76 @@
1
+ import { AxiosProxyConfig, ResponseType } from 'axios';
2
+ export interface ApiType<T = any> {
3
+ code: number | string;
4
+ success: boolean;
5
+ msg: string;
6
+ data: T;
7
+ }
8
+ export interface ConfigOptions {
9
+ type: string;
10
+ timeout: number;
11
+ responseType: ResponseType;
12
+ proxy: AxiosProxyConfig | false;
13
+ withCredentials: boolean;
14
+ ERROR_CODES: string[];
15
+ callback?: () => void;
16
+ Authorization?: string;
17
+ errorCallback?: () => void;
18
+ cancelCallback?: (cancelToken: any) => void;
19
+ [key: string]: any;
20
+ }
21
+ export interface Options {
22
+ type?: string;
23
+ timeout?: number;
24
+ responseType?: ResponseType;
25
+ ERROR_CODES?: string[];
26
+ callback?: () => void;
27
+ Authorization?: string;
28
+ errorCallback?: () => void;
29
+ cancelCallback?: (cancelToken: any) => void;
30
+ [key: string]: any;
31
+ }
32
+ export declare class CreateRequest {
33
+ private instance;
34
+ private postType;
35
+ private config;
36
+ constructor(baseURL: string, options?: Options);
37
+ /**
38
+ * 设置请求拦截器
39
+ * @private
40
+ */
41
+ private setupInterceptors;
42
+ /**
43
+ * 统一错误处理
44
+ * @param error
45
+ */
46
+ handleError(error: any): Promise<never>;
47
+ /**
48
+ * 发起GET请求到指定的URL,并携带请求参数
49
+ *
50
+ * @param url - 请求的URL地址
51
+ * @param data - 请求参数,类型为泛型D,默认为any类型
52
+ * @returns 返回一个Promise对象,解析后提供API响应数据,类型为ApiType<U>
53
+ */
54
+ get<D = any, U = any>(url: string, data: D): Promise<ApiType<U>>;
55
+ /**
56
+ * 发起POST请求到指定的URL,并携带请求参数
57
+ * @param url
58
+ * @param data
59
+ * @returns 返回一个Promise对象,解析后提供API响应数据,类型为ApiType<U>
60
+ */
61
+ post<D = any, U = any>(url: string, data: D): Promise<ApiType<U>>;
62
+ /**
63
+ * 发起PUT请求到指定的URL,并携带请求参数
64
+ * @param url
65
+ * @param data
66
+ * @returns 返回一个Promise对象,解析后提供API响应数据,类型为ApiType<U>
67
+ */
68
+ put<D = any, U = any>(url: string, data: D): Promise<ApiType<U>>;
69
+ /**
70
+ * 发起DELETE请求到指定的URL,并携带请求参数
71
+ * @param url
72
+ * @param id
73
+ * @returns 返回一个Promise对象,解析后提供API响应数据,类型为ApiType<U>
74
+ */
75
+ delete<U = any>(url: string, id: number | string): Promise<ApiType<U>>;
76
+ }
@@ -0,0 +1,3 @@
1
+ export { Websocket, EventId, WebSocketRequestMessage, WebSocketResponseMessage } from './websocket';
2
+ export { SocketIO } from './socket-io';
3
+ export { MQTTClient } from './mqtt';
@@ -0,0 +1,21 @@
1
+ export declare class MQTTClient {
2
+ private _client;
3
+ private readonly _url;
4
+ private readonly _options?;
5
+ private _hasInit;
6
+ private _publishQueueList;
7
+ private _subscribeQueueList;
8
+ private _unsubscribeQueueList;
9
+ private _registerMessageHandlerMap;
10
+ constructor(url: string, options?: any);
11
+ private init;
12
+ publish(topic: string, body: any, opt?: any): void;
13
+ subscribe(topic: string, callback: any): void;
14
+ unsubscribe(topic: string): void;
15
+ destroyed(): void;
16
+ private _onConnect;
17
+ private _onReconnect;
18
+ private _onMessage;
19
+ private _onClose;
20
+ private _onError;
21
+ }