xframelib 0.9.1 → 0.9.3

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.
@@ -153,6 +153,10 @@ export interface ISystemConfig {
153
153
  * 用于控制功能是否启用
154
154
  */
155
155
  Enables?: IEnablesObject;
156
+ /**
157
+ * 框架商业授权KEY
158
+ */
159
+ KEY?: string;
156
160
  [props: string]: any;
157
161
  }
158
162
  import { Component } from 'vue';
@@ -0,0 +1,35 @@
1
+ export interface IExtraProperty {
2
+ title?: string;
3
+ footer?: string;
4
+ other?: number;
5
+ /**
6
+ * 其他扩展的Key属性
7
+ */
8
+ [props: string]: any;
9
+ }
10
+ /**
11
+ * 用于显示对话框,传递参数数据
12
+ * 针对:ModalContainerWidget_LoadModal事件
13
+ */
14
+ export interface IModalEventData {
15
+ /**
16
+ * 对话框ID
17
+ */
18
+ modalID: string;
19
+ /**
20
+ * 对话框宽度,默认为500
21
+ */
22
+ width?: number;
23
+ /**
24
+ * 标题参数
25
+ */
26
+ extraData?: IExtraProperty;
27
+ /**
28
+ * 数据参数
29
+ */
30
+ rowData?: any;
31
+ /**
32
+ * 其他扩展的Key属性
33
+ */
34
+ [props: string]: any;
35
+ }
@@ -0,0 +1,44 @@
1
+ import { RouteMeta, RouteRecordName, RouteRecordRedirectOption } from 'vue-router';
2
+ export interface Route {
3
+ name: string;
4
+ path: string;
5
+ redirect?: RouteRecordRedirectOption | undefined;
6
+ component?: any;
7
+ children?: Route[];
8
+ meta?: RouteMeta;
9
+ props?: boolean | Record<string, any> | ((to: any) => Record<string, any>);
10
+ /**
11
+ * 其他扩展的Key属性
12
+ */
13
+ [props: string]: any;
14
+ }
15
+ export interface RouteData {
16
+ title?: string;
17
+ fullPath?: string;
18
+ path?: string;
19
+ icon?: string;
20
+ keepAlive?: boolean;
21
+ name: RouteRecordName | null | undefined;
22
+ /**
23
+ * 其他扩展的Key属性
24
+ */
25
+ [props: string]: any;
26
+ }
27
+ /**
28
+ * 定义右键菜单
29
+ */
30
+ export interface IContextMenuItem {
31
+ id?: string;
32
+ label?: string;
33
+ icon?: string;
34
+ tag?: any;
35
+ children?: Array<IContextMenuItem>;
36
+ }
37
+ export interface ViewportOffsetResult {
38
+ left: number;
39
+ top: number;
40
+ right: number;
41
+ bottom: number;
42
+ rightIncludeBody: number;
43
+ bottomIncludeBody: number;
44
+ }
@@ -0,0 +1,27 @@
1
+ /**
2
+ * 菜单对象的枚举类型
3
+ */
4
+ export declare enum MenuItemEnum {
5
+ Widget = 0,
6
+ Route = 1,
7
+ URL = 2,
8
+ Action = 3
9
+ }
10
+ export interface IWidgetMenu {
11
+ name: string;
12
+ index?: number;
13
+ icon?: string;
14
+ path?: string;
15
+ type?: MenuItemEnum;
16
+ blank?: boolean;
17
+ selected?: boolean;
18
+ children?: Array<IWidgetMenu>;
19
+ hidden?: boolean;
20
+ group?: string;
21
+ unload?: boolean;
22
+ tag?: object;
23
+ /**
24
+ * 其他扩展的Key属性
25
+ */
26
+ [props: string]: any;
27
+ }
@@ -3,3 +3,6 @@ export * from './IUserModel';
3
3
  export * from './Constants';
4
4
  export * from './Layout';
5
5
  export * from './IRole';
6
+ export * from './IModalModels';
7
+ export * from './ITypes';
8
+ export * from './IWidgetMenu';
@@ -0,0 +1 @@
1
+ export declare const autoRefresh: () => void;
@@ -0,0 +1,8 @@
1
+ /**
2
+ * 根据属性数组,
3
+ * 过滤对象的特定属性值
4
+ * @param obj
5
+ * @param arr
6
+ * @returns
7
+ */
8
+ export declare function filterObj(obj: any, arr: string[]): {};
@@ -0,0 +1,27 @@
1
+ declare class DayjsTool {
2
+ /**
3
+ * 格式化日期的函数
4
+ * @param date
5
+ * @param format
6
+ * @returns
7
+ */
8
+ static formatToDate(dateValue?: Date | number | string | undefined, format?: string): string;
9
+ /**
10
+ * 格式化时间的函数
11
+ * @param date
12
+ * @param format
13
+ * @returns
14
+ */
15
+ static formatToTime(dateValue?: Date | number | string | undefined, format?: string): string;
16
+ /**
17
+ * 格式化日期和时间的函数
18
+ */
19
+ static formatToDateTime(dateValue?: Date | number | string | undefined, format?: string): string;
20
+ /**
21
+ * 格式化字符串为日期格式
22
+ * @param datestr 将字符串20250325120345格式化 2025-03-25 12:03:45
23
+ * @returns
24
+ */
25
+ static formatStringDateTime(datestr: string): string;
26
+ }
27
+ export default DayjsTool;
@@ -1,6 +1,17 @@
1
1
  import { XhrHeaders } from 'xhr';
2
2
  export type FileEventName = 'attempt' | 'attemptFailure' | 'chunkSuccess' | 'error' | 'offline' | 'online' | 'progress' | 'success';
3
3
  export type AllowedMethods = 'PUT' | 'POST' | 'PATCH';
4
+ /**
5
+ * 文件分片传输返回结果
6
+ */
7
+ export interface ChunkResult {
8
+ DATASOURCEID?: string;
9
+ NAME: string;
10
+ INDEX: number;
11
+ STATE: boolean;
12
+ END: boolean;
13
+ FILEPATH?: string;
14
+ }
4
15
  /**
5
16
  * 文件上传配置
6
17
  */
@@ -12,6 +23,7 @@ export interface FileUploadOptions {
12
23
  maxFileSize?: number;
13
24
  chunkSize?: number;
14
25
  attempts?: number;
26
+ threadNumber?: number;
15
27
  /**
16
28
  * 单位:秒
17
29
  */
@@ -30,9 +42,10 @@ export declare class FileUpload {
30
42
  attempts: number;
31
43
  delayBeforeAttempt: number;
32
44
  md5: string;
33
- private chunk?;
34
45
  private chunkCount;
35
46
  private chunkByteSize;
47
+ private cacheSize;
48
+ private currentMaxIndex;
36
49
  private maxFileBytes;
37
50
  private endpointValue?;
38
51
  private totalChunks;
@@ -40,8 +53,9 @@ export declare class FileUpload {
40
53
  private offline;
41
54
  private paused;
42
55
  private success;
43
- private currentXhr?;
44
- private reader;
56
+ private isResumed;
57
+ private mapXhrRequest;
58
+ private okRecordList;
45
59
  private eventTarget;
46
60
  private fileName;
47
61
  constructor(options: FileUploadOptions);
@@ -51,7 +65,7 @@ export declare class FileUpload {
51
65
  on(FileEventName: FileEventName, fn: (event: any) => void): void;
52
66
  abort(): void;
53
67
  pause(): void;
54
- resume(): void;
68
+ resume(): Promise<void>;
55
69
  /**
56
70
  * 发送消息
57
71
  */
@@ -76,7 +90,6 @@ export declare class FileUpload {
76
90
  /**
77
91
  * 失败处理和尝试
78
92
  */
79
- private manageRetries;
80
93
  /**
81
94
  * 进行分片上传,并处理错误和重试
82
95
  */
@@ -0,0 +1,90 @@
1
+ import { XhrHeaders } from 'xhr';
2
+ export type FileEventName = 'attempt' | 'attemptFailure' | 'chunkSuccess' | 'error' | 'offline' | 'online' | 'progress' | 'success';
3
+ export type AllowedMethods = 'PUT' | 'POST' | 'PATCH';
4
+ /**
5
+ * 文件上传配置
6
+ */
7
+ export interface FileUploadOptions {
8
+ endpoint: string | ((file?: File) => Promise<string>);
9
+ file: File;
10
+ method?: AllowedMethods;
11
+ headers?: XhrHeaders;
12
+ maxFileSize?: number;
13
+ chunkSize?: number;
14
+ attempts?: number;
15
+ /**
16
+ * 单位:秒
17
+ */
18
+ delayBeforeAttempt?: number;
19
+ md5?: string;
20
+ }
21
+ /**
22
+ * 文件上传类
23
+ */
24
+ export declare class FileUpload {
25
+ endpoint: string | ((file?: File) => Promise<string>);
26
+ file: File;
27
+ headers: XhrHeaders;
28
+ method: AllowedMethods;
29
+ chunkSize: number;
30
+ attempts: number;
31
+ delayBeforeAttempt: number;
32
+ md5: string;
33
+ private chunk?;
34
+ private chunkCount;
35
+ private chunkByteSize;
36
+ private maxFileBytes;
37
+ private endpointValue?;
38
+ private totalChunks;
39
+ private attemptCount;
40
+ private offline;
41
+ private paused;
42
+ private success;
43
+ private currentXhr?;
44
+ private reader;
45
+ private eventTarget;
46
+ private fileName;
47
+ constructor(options: FileUploadOptions);
48
+ /**
49
+ * 订阅事件
50
+ */
51
+ on(FileEventName: FileEventName, fn: (event: any) => void): void;
52
+ abort(): void;
53
+ pause(): void;
54
+ resume(): void;
55
+ /**
56
+ * 发送消息
57
+ */
58
+ private dispatch;
59
+ /**
60
+ *验证参数的正确性
61
+ */
62
+ private validateOptions;
63
+ /**
64
+ * Endpoint can either be a URL or a function that returns a promise that resolves to a string.
65
+ */
66
+ private getEndpoint;
67
+ /**
68
+ * Get portion of the file of x bytes corresponding to chunkSize
69
+ */
70
+ private getChunk;
71
+ private xhrPromise;
72
+ /**
73
+ * Send chunk of the file with appropriate headers and add post parameters if it's last chunk
74
+ */
75
+ private sendChunk;
76
+ /**
77
+ * 失败处理和尝试
78
+ */
79
+ private manageRetries;
80
+ /**
81
+ * 进行分片上传,并处理错误和重试
82
+ */
83
+ private sendChunks;
84
+ }
85
+ /**
86
+ * 创建文件上传对象方法
87
+ * @param options
88
+ * @returns
89
+ */
90
+ export declare const createFileUpload: (options: FileUploadOptions) => FileUpload;
@@ -0,0 +1,90 @@
1
+ import { XhrHeaders } from 'xhr';
2
+ export type FileEventName = 'attempt' | 'attemptFailure' | 'chunkSuccess' | 'error' | 'offline' | 'online' | 'progress' | 'success';
3
+ export type AllowedMethods = 'PUT' | 'POST' | 'PATCH';
4
+ /**
5
+ * 文件上传配置
6
+ */
7
+ export interface FileUploadOptions {
8
+ endpoint: string | ((file?: File) => Promise<string>);
9
+ file: File;
10
+ method?: AllowedMethods;
11
+ headers?: XhrHeaders;
12
+ maxFileSize?: number;
13
+ chunkSize?: number;
14
+ attempts?: number;
15
+ /**
16
+ * 单位:秒
17
+ */
18
+ delayBeforeAttempt?: number;
19
+ md5?: string;
20
+ }
21
+ /**
22
+ * 文件上传类
23
+ */
24
+ export declare class FileUpload {
25
+ endpoint: string | ((file?: File) => Promise<string>);
26
+ file: File;
27
+ headers: XhrHeaders;
28
+ method: AllowedMethods;
29
+ chunkSize: number;
30
+ attempts: number;
31
+ delayBeforeAttempt: number;
32
+ md5: string;
33
+ private chunk?;
34
+ private chunkCount;
35
+ private chunkByteSize;
36
+ private maxFileBytes;
37
+ private endpointValue?;
38
+ private totalChunks;
39
+ private attemptCount;
40
+ private offline;
41
+ private paused;
42
+ private success;
43
+ private currentXhr?;
44
+ private reader;
45
+ private eventTarget;
46
+ private fileName;
47
+ constructor(options: FileUploadOptions);
48
+ /**
49
+ * 订阅事件
50
+ */
51
+ on(FileEventName: FileEventName, fn: (event: any) => void): void;
52
+ abort(): void;
53
+ pause(): void;
54
+ resume(): void;
55
+ /**
56
+ * 发送消息
57
+ */
58
+ private dispatch;
59
+ /**
60
+ *验证参数的正确性
61
+ */
62
+ private validateOptions;
63
+ /**
64
+ * Endpoint can either be a URL or a function that returns a promise that resolves to a string.
65
+ */
66
+ private getEndpoint;
67
+ /**
68
+ * Get portion of the file of x bytes corresponding to chunkSize
69
+ */
70
+ private getChunk;
71
+ private xhrPromise;
72
+ /**
73
+ * Send chunk of the file with appropriate headers and add post parameters if it's last chunk
74
+ */
75
+ private sendChunk;
76
+ /**
77
+ * 失败处理和尝试
78
+ */
79
+ private manageRetries;
80
+ /**
81
+ * 进行分片上传,并处理错误和重试
82
+ */
83
+ private sendChunks;
84
+ }
85
+ /**
86
+ * 创建文件上传对象方法
87
+ * @param options
88
+ * @returns
89
+ */
90
+ export declare const createFileUpload: (options: FileUploadOptions) => FileUpload;
@@ -0,0 +1,102 @@
1
+ import { XhrHeaders } from 'xhr';
2
+ export type FileEventName = 'attempt' | 'attemptFailure' | 'chunkSuccess' | 'error' | 'offline' | 'online' | 'progress' | 'success';
3
+ export type AllowedMethods = 'PUT' | 'POST' | 'PATCH';
4
+ /**
5
+ * 文件分片传输返回结果
6
+ */
7
+ export interface ChunkResult {
8
+ DATASOURCEID?: string;
9
+ NAME: string;
10
+ INDEX: number;
11
+ STATE: boolean;
12
+ END: boolean;
13
+ FILEPATH?: string;
14
+ }
15
+ /**
16
+ * 文件上传配置
17
+ */
18
+ export interface FileUploadOptions {
19
+ endpoint: string | ((file?: File) => Promise<string>);
20
+ file: File;
21
+ method?: AllowedMethods;
22
+ headers?: XhrHeaders;
23
+ maxFileSize?: number;
24
+ chunkSize?: number;
25
+ attempts?: number;
26
+ /**
27
+ * 单位:秒
28
+ */
29
+ delayBeforeAttempt?: number;
30
+ md5?: string;
31
+ }
32
+ /**
33
+ * 文件上传类
34
+ */
35
+ export declare class FileUpload {
36
+ endpoint: string | ((file?: File) => Promise<string>);
37
+ file: File;
38
+ headers: XhrHeaders;
39
+ method: AllowedMethods;
40
+ chunkSize: number;
41
+ attempts: number;
42
+ delayBeforeAttempt: number;
43
+ md5: string;
44
+ private chunkCount;
45
+ private chunkByteSize;
46
+ private cacheSize;
47
+ private currentMaxIndex;
48
+ private maxFileBytes;
49
+ private endpointValue?;
50
+ private totalChunks;
51
+ private attemptCount;
52
+ private offline;
53
+ private paused;
54
+ private success;
55
+ private isResumed;
56
+ private mapXhrRequest;
57
+ private okRecordList;
58
+ private eventTarget;
59
+ private fileName;
60
+ constructor(options: FileUploadOptions);
61
+ /**
62
+ * 订阅事件
63
+ */
64
+ on(FileEventName: FileEventName, fn: (event: any) => void): void;
65
+ abort(): void;
66
+ pause(): void;
67
+ resume(): Promise<void>;
68
+ /**
69
+ * 发送消息
70
+ */
71
+ private dispatch;
72
+ /**
73
+ *验证参数的正确性
74
+ */
75
+ private validateOptions;
76
+ /**
77
+ * Endpoint can either be a URL or a function that returns a promise that resolves to a string.
78
+ */
79
+ private getEndpoint;
80
+ /**
81
+ * Get portion of the file of x bytes corresponding to chunkSize
82
+ */
83
+ private getChunk;
84
+ private xhrPromise;
85
+ /**
86
+ * Send chunk of the file with appropriate headers and add post parameters if it's last chunk
87
+ */
88
+ private sendChunk;
89
+ /**
90
+ * 失败处理和尝试
91
+ */
92
+ /**
93
+ * 进行分片上传,并处理错误和重试
94
+ */
95
+ private sendChunks;
96
+ }
97
+ /**
98
+ * 创建文件上传对象方法
99
+ * @param options
100
+ * @returns
101
+ */
102
+ export declare const createFileUpload: (options: FileUploadOptions) => FileUpload;
@@ -367,4 +367,15 @@ export default class H5Tool {
367
367
  * 移除document粘贴处理事件
368
368
  */
369
369
  static offPasteHandler(): void;
370
+ /**
371
+ * 动态写入引入js文件
372
+ * @param url
373
+ * @param initAction
374
+ */
375
+ static loadScript(url: string): void;
376
+ /**
377
+ * 动态加载JS代码片段
378
+ * @param jscode JS代码
379
+ */
380
+ static loadJsCode(jscode: string): void;
370
381
  }
@@ -1,3 +1,4 @@
1
+ import { ViewportOffsetResult } from '../model/ITypes';
1
2
  /**
2
3
  * 模仿JQuery相关方法
3
4
  */
@@ -33,6 +34,23 @@ declare class JQuery {
33
34
  * @param propValue
34
35
  */
35
36
  setCSSProperty(ele: HTMLElement, propField: string, propValue: string | null): void;
37
+ getBoundingClientRect(element: Element): DOMRect | number;
38
+ /**
39
+ * Get the left and top offset of the current element
40
+ * left: the distance between the leftmost element and the left side of the document
41
+ * top: the distance from the top of the element to the top of the document
42
+ * right: the distance from the far right of the element to the right of the document
43
+ * bottom: the distance from the bottom of the element to the bottom of the document
44
+ * rightIncludeBody: the distance between the leftmost element and the right side of the document
45
+ * bottomIncludeBody: the distance from the bottom of the element to the bottom of the document
46
+ *
47
+ * @description:
48
+ */
49
+ getViewportOffset(element: Element): ViewportOffsetResult;
50
+ hackCss(attr: string, value: string): any;
51
+ on(element: Element | HTMLElement | Document | Window, event: string, handler: EventListenerOrEventListenerObject): void;
52
+ off(element: Element | HTMLElement | Document | Window, event: string, handler: EventListenerOrEventListenerObject): void;
53
+ once(el: HTMLElement, event: string, fn: EventListener): void;
36
54
  }
37
55
  /**
38
56
  * jquery对象
@@ -0,0 +1,61 @@
1
+ import { LocationQueryRaw, Router, RouteRecordRaw } from 'vue-router';
2
+ import { RouteData } from '../model/ITypes';
3
+ /**
4
+ * 将对象添加当作参数拼接到URL上面
5
+ * @param baseUrl 需要拼接的url
6
+ * @param obj 参数对象
7
+ * @returns {string} 拼接后的对象
8
+ * 例子:
9
+ * let obj = {a: '3', b: '4'}
10
+ * setObjToUrlParams('www.baidu.com', obj)
11
+ * ==>www.baidu.com?a=3&b=4
12
+ */
13
+ export declare function ObjToUrlParams(baseUrl: string, obj: object): string;
14
+ /**
15
+ * 深入拷贝对象, 将target合并到src里
16
+ * @param src 原始对象
17
+ * @param target 要合并的对象
18
+ * @returns 更新后的原始对象
19
+ */
20
+ export declare function deepMerge<T = any>(src?: any, target?: any): T;
21
+ /**
22
+ * 新窗体打开router路由URL
23
+ * @param router
24
+ * @param pathURL 相对路径
25
+ * @param queryObj LocationQueryRaw对象
26
+ */
27
+ export declare function OpenRouterURL(router: Router, pathURL: string, queryObj?: LocationQueryRaw): void;
28
+ /**
29
+ * 获取vue的URL
30
+ * @param sysURL
31
+ * @returns
32
+ */
33
+ export declare function getVueURL(sysURL: string): string | undefined;
34
+ /**
35
+ * 用于路由,获取完整的相对路由
36
+ * @param childPath
37
+ * @param path
38
+ * @returns
39
+ */
40
+ export declare function getRouteURL(childPath: string, path?: string): string | undefined;
41
+ /**
42
+ * 检查是否存在默认‘/’路由,并添加
43
+ * @param router 路由
44
+ * @param firstItem 默认权限的第一个
45
+ */
46
+ export declare function checkAddDefaultRoute(router: Router, firstItem: RouteRecordRaw): void;
47
+ export declare function recursiveRoutes(components: Record<string, unknown>): Array<RouteRecordRaw>;
48
+ /**
49
+ * 递归过滤其他的对象
50
+ * @param components
51
+ * @param orderIndex 是否需要排序
52
+ * @returns
53
+ */
54
+ export declare function globFilterObjects<T>(components: Record<string, unknown>, orderIndex?: boolean): Array<T>;
55
+ /**
56
+ * 根据路由路由配置记录,获取RouteData
57
+ * @param configRouteItem 路由配置记录
58
+ * @param startPath 起始路径
59
+ * @returns
60
+ */
61
+ export declare function getTabRouteData(configRouteItem: RouteRecordRaw, startPath?: string): RouteData;
@@ -16,5 +16,9 @@ declare class StringUtils {
16
16
  * @param url 文件url
17
17
  */
18
18
  static getFileName(url: string): string;
19
+ /**
20
+ * 首字母大写
21
+ */
22
+ static UpperFirst(str: string): string;
19
23
  }
20
24
  export default StringUtils;
@@ -0,0 +1,11 @@
1
+ import { IModalEventData } from '../model/IModalModels';
2
+ /**
3
+ * 调用弹框的方法
4
+ * @param modalData
5
+ */
6
+ export declare function doLoadModal(modalData?: IModalEventData): void;
7
+ /**
8
+ * 调用关闭弹框窗体的事件
9
+ * @param modalData
10
+ */
11
+ export declare function doCloseModal(modalData?: IModalEventData): void;
@@ -4,6 +4,11 @@ import StorageHelper, { storage } from './Storage';
4
4
  import uuid, { newGuid } from './uuid';
5
5
  import ZipTool from './ZipTool';
6
6
  import GzipTool from './GzipTool';
7
+ import DayjsTool from './DayjsTool';
8
+ import XXTEA from './XXTEA';
9
+ import WaterMark from './WaterMark';
10
+ import { GetSignalRClient } from './SignalrClient';
11
+ import iconv from 'iconv-lite';
7
12
  export * from './Color';
8
13
  export * from './FileDownload';
9
14
  export * from './Time';
@@ -14,12 +19,11 @@ export * from './JQuery';
14
19
  export * from './LockHelper';
15
20
  export * from './BigFileDownload';
16
21
  export * from './IsTool';
17
- export * from './URLTool';
22
+ export * from './RouterURLTool';
18
23
  export * from './CodeHelper';
19
24
  export * from './ValidateTool';
20
- import XXTEA from './XXTEA';
21
- import WaterMark from './WaterMark';
22
- import { GetSignalRClient } from './SignalrClient';
23
- import iconv from 'iconv-lite';
25
+ export * from './WidgetsTool';
26
+ export * from './CommonTool';
24
27
  export * from './FilenameUtils';
25
- export { iconv, GetSignalRClient, WaterMark, XXTEA, H5Tool, StringUtils, StorageHelper as Storage, storage, uuid, newGuid, ZipTool, GzipTool };
28
+ export * from './AutoUpdate';
29
+ export { iconv, GetSignalRClient, WaterMark, XXTEA, H5Tool, StringUtils, StorageHelper as Storage, storage, uuid, newGuid, ZipTool, GzipTool, DayjsTool };