@geelato/gl-runtime-core 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.
- package/dist/gl-runtime-core.css +1 -0
- package/dist/gl-runtime-core.css.gz +0 -0
- package/dist/gl-runtime-core.js +169768 -0
- package/dist/gl-runtime-core.js.gz +0 -0
- package/dist/gl-runtime-core.umd.cjs +35 -0
- package/dist/iconfont-BJ2VOOKJ.js +35 -0
- package/dist/iconfont-BJ2VOOKJ.js.gz +0 -0
- package/dist/types/actions/JsScriptExecutor.d.ts +291 -0
- package/dist/types/actions/fns/datetime.d.ts +22 -0
- package/dist/types/actions/fns/device.d.ts +23 -0
- package/dist/types/actions/fns/math.d.ts +27 -0
- package/dist/types/api/EntityApi.d.ts +143 -0
- package/dist/types/api/EntityDataSource.d.ts +272 -0
- package/dist/types/api/EntityDeleteService.d.ts +47 -0
- package/dist/types/api/EntityQueryCache.d.ts +62 -0
- package/dist/types/api/EntityQueryService.d.ts +71 -0
- package/dist/types/api/EntityResultMapping.d.ts +11 -0
- package/dist/types/api/EntitySaveService.d.ts +46 -0
- package/dist/types/api/EntityTypes.d.ts +135 -0
- package/dist/types/api/EntityUtilService.d.ts +42 -0
- package/dist/types/assets/globalConfig.d.ts +5 -0
- package/dist/types/components/AppProvideProxy.d.ts +21 -0
- package/dist/types/components/ComponentTreeParser.d.ts +17 -0
- package/dist/types/components/FormProvideProxy.d.ts +35 -0
- package/dist/types/components/Hooks.d.ts +7 -0
- package/dist/types/components/PageDataSourceManager.d.ts +28 -0
- package/dist/types/components/PageLoader.d.ts +6 -0
- package/dist/types/components/PageProvideProxy.d.ts +413 -0
- package/dist/types/components/UiEventNames.d.ts +15 -0
- package/dist/types/components/gl-chart/GlChart.vue.d.ts +135 -0
- package/dist/types/components/gl-component/GlComponent.vue.d.ts +191 -0
- package/dist/types/components/gl-component/GlComponentSupport.d.ts +49 -0
- package/dist/types/components/gl-component/GlInsts.vue.d.ts +19 -0
- package/dist/types/components/gl-div/GlDiv.vue.d.ts +107 -0
- package/dist/types/components/gl-dnd-placeholder/Index.vue.d.ts +112 -0
- package/dist/types/components/gl-html/Index.vue.d.ts +7 -0
- package/dist/types/components/gl-iconfont/IconsJson.d.ts +15 -0
- package/dist/types/components/gl-iconfont/Index.vue.d.ts +19 -0
- package/dist/types/components/gl-loader/GlLoader.vue.d.ts +3 -0
- package/dist/types/components/gl-login/FloatingActionButton.vue.d.ts +9 -0
- package/dist/types/components/gl-login/LoginDialog.vue.d.ts +9 -0
- package/dist/types/components/gl-loop/GlLoop.vue.d.ts +230 -0
- package/dist/types/components/gl-page-viewer/GlPageViewer.vue.d.ts +221 -0
- package/dist/types/components/gl-scanner/GlScanner.vue.d.ts +44 -0
- package/dist/types/components/gl-template/GlTemplate.vue.d.ts +154 -0
- package/dist/types/components/gl-template/Typs.d.ts +4 -0
- package/dist/types/components/gl-virtual/Index.vue.d.ts +3 -0
- package/dist/types/components/mixins.d.ts +86 -0
- package/dist/types/components/ui-mixins.d.ts +16 -0
- package/dist/types/composables/useApiUrl.d.ts +30 -0
- package/dist/types/composables/useGlobal.d.ts +21 -0
- package/dist/types/composables/useLoading.d.ts +6 -0
- package/dist/types/composables/useLogger.d.ts +32 -0
- package/dist/types/composables/useMessages.d.ts +15 -0
- package/dist/types/composables/useRole.d.ts +5 -0
- package/dist/types/locales/index.d.ts +21 -0
- package/dist/types/locales/lang/en-US.d.ts +4 -0
- package/dist/types/locales/lang/zh-CN.d.ts +4 -0
- package/dist/types/m/datasource/ApplicationApi.d.ts +163 -0
- package/dist/types/m/datasource/ArcoApi.d.ts +76 -0
- package/dist/types/m/datasource/Base.d.ts +99 -0
- package/dist/types/m/datasource/BranchApi.d.ts +2 -0
- package/dist/types/m/datasource/CompanyApi.d.ts +49 -0
- package/dist/types/m/datasource/DictApi.d.ts +127 -0
- package/dist/types/m/datasource/DictionaryApi.d.ts +16 -0
- package/dist/types/m/datasource/EncodingApi.d.ts +59 -0
- package/dist/types/m/datasource/Entry.d.ts +5 -0
- package/dist/types/m/datasource/FieldMeta.d.ts +6 -0
- package/dist/types/m/datasource/FileApi.d.ts +273 -0
- package/dist/types/m/datasource/FileTemplateApi.d.ts +114 -0
- package/dist/types/m/datasource/InterApi.d.ts +104 -0
- package/dist/types/m/datasource/MarketApi.d.ts +191 -0
- package/dist/types/m/datasource/MessageApi.d.ts +27 -0
- package/dist/types/m/datasource/ModelApi.d.ts +327 -0
- package/dist/types/m/datasource/NoticeApi.d.ts +37 -0
- package/dist/types/m/datasource/OcrPdfApi.d.ts +145 -0
- package/dist/types/m/datasource/PluginApi.d.ts +35 -0
- package/dist/types/m/datasource/ScheduleApi.d.ts +67 -0
- package/dist/types/m/datasource/SecurityApi.d.ts +253 -0
- package/dist/types/m/datasource/SiteApi.d.ts +38 -0
- package/dist/types/m/datasource/SqlApi.d.ts +45 -0
- package/dist/types/m/datasource/SysConfigApi.d.ts +52 -0
- package/dist/types/m/datasource/TenantApi.d.ts +107 -0
- package/dist/types/m/datasource/UserApi.d.ts +173 -0
- package/dist/types/m/datasource/VersionApi.d.ts +59 -0
- package/dist/types/m/datasource/WeChatApi.d.ts +34 -0
- package/dist/types/m/datasource/WorkflowApi.d.ts +317 -0
- package/dist/types/m/datasource/ZxingApi.d.ts +38 -0
- package/dist/types/main.d.ts +114 -0
- package/dist/types/store/index.d.ts +2 -0
- package/dist/types/store/modules/user/index.d.ts +16 -0
- package/dist/types/types/Operators.d.ts +19 -0
- package/dist/types/types/global.d.ts +198 -0
- package/dist/types/types/options.d.ts +35 -0
- package/dist/types/utils/Auth.d.ts +37 -0
- package/dist/types/utils/CacheManager.d.ts +110 -0
- package/dist/types/utils/CheckUtil.d.ts +5 -0
- package/dist/types/utils/ClipboardUtil.d.ts +24 -0
- package/dist/types/utils/ConvertUtil.d.ts +81 -0
- package/dist/types/utils/Event.d.ts +2 -0
- package/dist/types/utils/FileUtil.d.ts +7 -0
- package/dist/types/utils/GenerateUtil.d.ts +14 -0
- package/dist/types/utils/IsUtil.d.ts +126 -0
- package/dist/types/utils/MixUtil.d.ts +49 -0
- package/dist/types/utils/Monitor.d.ts +2 -0
- package/dist/types/utils/PageUtil.d.ts +14 -0
- package/dist/types/utils/PluginUtil.d.ts +9 -0
- package/dist/types/utils/RecordsUtil.d.ts +3 -0
- package/dist/types/utils/SseClient.d.ts +34 -0
- package/dist/types/utils/StoreUtil.d.ts +8 -0
- package/dist/types/utils/StringUtil.d.ts +29 -0
- package/dist/types/utils/Utils.d.ts +217 -0
- package/dist/types/utils/emitter.d.ts +3 -0
- package/dist/types/utils/renderTemplate.d.ts +6 -0
- package/dist/types/utils/toChineseCurrency.d.ts +5 -0
- package/package.json +76 -0
- package/src/main.ts +498 -0
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { I18nItem } from '@geelato/gl-types';
|
|
2
|
+
export default class ConvertUtil {
|
|
3
|
+
/**
|
|
4
|
+
* 'false' -> false ,'0' -> false
|
|
5
|
+
* @param v
|
|
6
|
+
* @returns {boolean}
|
|
7
|
+
*/
|
|
8
|
+
static toBoolean(v: string | boolean | number): boolean;
|
|
9
|
+
static trim(str: string): string;
|
|
10
|
+
/**
|
|
11
|
+
* 从包含有邮箱的字符串中提取邮箱,返回数组,并自动去重邮箱
|
|
12
|
+
* @param strContianEmail
|
|
13
|
+
*/
|
|
14
|
+
static toEmails(strContianEmail: string): string[];
|
|
15
|
+
/**
|
|
16
|
+
*
|
|
17
|
+
* @param data 列表数据
|
|
18
|
+
* @param pid 根id
|
|
19
|
+
* @param renameId 重命名pid字段名,默认为“id”
|
|
20
|
+
* @param renamePid 重命名pid字段名,默认为“pid”
|
|
21
|
+
* @returns {Array}
|
|
22
|
+
*/
|
|
23
|
+
static listToTree(params: {
|
|
24
|
+
data: Array<any>;
|
|
25
|
+
pid: string | number;
|
|
26
|
+
renameId?: string;
|
|
27
|
+
renamePid?: string;
|
|
28
|
+
compareFn: Function;
|
|
29
|
+
}): any[];
|
|
30
|
+
/**
|
|
31
|
+
* 列表分组
|
|
32
|
+
*/
|
|
33
|
+
static listGroup(): void;
|
|
34
|
+
/**
|
|
35
|
+
* 数组指定列去重,返回去重后的列对象
|
|
36
|
+
* @param arr 数组
|
|
37
|
+
* @param col
|
|
38
|
+
*/
|
|
39
|
+
static distinct(arr: Array<any>, col: string | number): any;
|
|
40
|
+
/**
|
|
41
|
+
*
|
|
42
|
+
* @param d 需格式化的日期,可为数值或字符串或日期对象
|
|
43
|
+
* @param formatString 日期格式,默认为:yyyy-MM-dd HH:mm:ss
|
|
44
|
+
* @returns {*}
|
|
45
|
+
*/
|
|
46
|
+
static dateFormat(d: string | number | object, formatString?: string): string;
|
|
47
|
+
static i18nConvert(value?: string, i18n?: Array<I18nItem>): any;
|
|
48
|
+
static convertPx2num(px: string): number;
|
|
49
|
+
static convertNum2px(num: number): string;
|
|
50
|
+
static stringToBase64(str: string, hasPrefix?: boolean): Promise<unknown>;
|
|
51
|
+
/**
|
|
52
|
+
*
|
|
53
|
+
* @param hex 16进制
|
|
54
|
+
* @param alpha 透明度,默认为1,即不透明
|
|
55
|
+
* @returns {string}
|
|
56
|
+
*/
|
|
57
|
+
static hex2Rgb(hex: string, alpha: number): string;
|
|
58
|
+
/**
|
|
59
|
+
* 字符串转对象格式,如应用于多币种的值转换
|
|
60
|
+
* @param str 多币种字符串格式:CNY:18145.1;USD:176.48
|
|
61
|
+
* @param separator 默认为:“;”
|
|
62
|
+
* @return 对象{CNY:18145.1,USD:176.48},为空时{}
|
|
63
|
+
*/
|
|
64
|
+
static convertStrToObj(str: string, separator?: string): Record<string, string | number>;
|
|
65
|
+
/**
|
|
66
|
+
* 简单的对象转为字符串格式,如应用于多币种的值转换
|
|
67
|
+
* @param obj 如 {CNY:18145.1,USD:176.48}
|
|
68
|
+
* @param separator 默认为:“;”
|
|
69
|
+
* @return 如 CNY:18145.1;USD:176.48
|
|
70
|
+
*/
|
|
71
|
+
static convertObjToStr(obj: Record<string, string>, separator?: string): string;
|
|
72
|
+
/**
|
|
73
|
+
* 将包含多种分隔符的字符串统一转换为单一分隔符格式
|
|
74
|
+
* @param str 有各种分隔符的字符串
|
|
75
|
+
* @param separator 分隔符,默认为“,”
|
|
76
|
+
* @param extraSeparators 额外的分隔符数组,默认为[]
|
|
77
|
+
* @param ignoreSeparator 忽略的分隔符数组,默认为[]
|
|
78
|
+
* @returns 标准化后的字符串
|
|
79
|
+
*/
|
|
80
|
+
static normalizeSeparators(str: string, separator?: string, extraSeparators?: string[], ignoreSeparator?: string[]): string;
|
|
81
|
+
}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export declare function addEventListen(target: Window | HTMLElement, event: string, handler: EventListenerOrEventListenerObject, capture?: boolean): void;
|
|
2
|
+
export declare function removeEventListen(target: Window | HTMLElement, event: string, handler: EventListenerOrEventListenerObject, capture?: boolean): void;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export default class GenerateUtil {
|
|
2
|
+
/**
|
|
3
|
+
* @param prefix 用于区分gid的类型,如node、div、component
|
|
4
|
+
* @param maxLength 加上prefix和连接符“_”总的gid长度,默认为16
|
|
5
|
+
*/
|
|
6
|
+
static gid(prefix?: string, maxLength?: number): string;
|
|
7
|
+
static uuid(len: number, radix?: number): string;
|
|
8
|
+
/**
|
|
9
|
+
* 生成随机数
|
|
10
|
+
* @param extent
|
|
11
|
+
* @constructor
|
|
12
|
+
*/
|
|
13
|
+
static generateRandom(extent?: number, chars?: string): string;
|
|
14
|
+
}
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 类型检查工具类
|
|
3
|
+
* 提供各种类型检查方法,使用单例模式
|
|
4
|
+
*/
|
|
5
|
+
export declare class IsUtil {
|
|
6
|
+
private static instance;
|
|
7
|
+
private readonly opt;
|
|
8
|
+
private constructor();
|
|
9
|
+
static getInstance(): IsUtil;
|
|
10
|
+
/**
|
|
11
|
+
* 检查是否为数组
|
|
12
|
+
* @param obj - 待检查的对象
|
|
13
|
+
* @returns 如果对象是数组返回 true,否则返回 false
|
|
14
|
+
*/
|
|
15
|
+
isArray<T>(obj: unknown): obj is T[];
|
|
16
|
+
/**
|
|
17
|
+
* 检查是否为对象
|
|
18
|
+
* @param obj - 待检查的对象
|
|
19
|
+
* @returns 如果对象是普通对象返回 true,否则返回 false
|
|
20
|
+
*/
|
|
21
|
+
isObject(obj: unknown): obj is Record<string, unknown>;
|
|
22
|
+
/**
|
|
23
|
+
* 检查是否为字符串
|
|
24
|
+
* @param obj - 待检查的对象
|
|
25
|
+
* @returns 如果对象是字符串返回 true,否则返回 false
|
|
26
|
+
*/
|
|
27
|
+
isString(obj: unknown): obj is string;
|
|
28
|
+
/**
|
|
29
|
+
* 检查是否为数字
|
|
30
|
+
* @param obj - 待检查的对象
|
|
31
|
+
* @returns 如果对象是有效数字返回 true,否则返回 false
|
|
32
|
+
*/
|
|
33
|
+
isNumber(obj: unknown): obj is number;
|
|
34
|
+
/**
|
|
35
|
+
* 检查是否为布尔值
|
|
36
|
+
* @param obj - 待检查的对象
|
|
37
|
+
* @returns 如果对象是布尔值返回 true,否则返回 false
|
|
38
|
+
*/
|
|
39
|
+
isBoolean(obj: unknown): obj is boolean;
|
|
40
|
+
/**
|
|
41
|
+
* 检查是否为正则表达式
|
|
42
|
+
* @param obj - 待检查的对象
|
|
43
|
+
* @returns 如果对象是正则表达式返回 true,否则返回 false
|
|
44
|
+
*/
|
|
45
|
+
isRegExp(obj: unknown): obj is RegExp;
|
|
46
|
+
/**
|
|
47
|
+
* 检查是否为 File 对象
|
|
48
|
+
* @param obj - 待检查的对象
|
|
49
|
+
* @returns 如果对象是 File 对象返回 true,否则返回 false
|
|
50
|
+
*/
|
|
51
|
+
isFile(obj: unknown): obj is File;
|
|
52
|
+
/**
|
|
53
|
+
* 检查是否为 Blob 对象
|
|
54
|
+
* @param obj - 待检查的对象
|
|
55
|
+
* @returns 如果对象是 Blob 对象返回 true,否则返回 false
|
|
56
|
+
*/
|
|
57
|
+
isBlob(obj: unknown): obj is Blob;
|
|
58
|
+
/**
|
|
59
|
+
* 检查是否为 undefined
|
|
60
|
+
* @param obj - 待检查的对象
|
|
61
|
+
* @returns 如果对象是 undefined 返回 true,否则返回 false
|
|
62
|
+
*/
|
|
63
|
+
isUndefined(obj: unknown): obj is undefined;
|
|
64
|
+
/**
|
|
65
|
+
* 检查是否为 null
|
|
66
|
+
* @param obj - 待检查的对象
|
|
67
|
+
* @returns 如果对象是 null 返回 true,否则返回 false
|
|
68
|
+
*/
|
|
69
|
+
isNull(obj: unknown): obj is null;
|
|
70
|
+
/**
|
|
71
|
+
* 检查是否为空对象
|
|
72
|
+
* @param obj - 待检查的对象
|
|
73
|
+
* @returns 如果对象是空对象返回 true,否则返回 false
|
|
74
|
+
*/
|
|
75
|
+
isEmptyObject(obj: unknown): boolean;
|
|
76
|
+
/**
|
|
77
|
+
* 检查是否为空对象或 null
|
|
78
|
+
* @param obj - 待检查的对象
|
|
79
|
+
* @returns 如果对象是空对象或 null 返回 true,否则返回 false
|
|
80
|
+
*/
|
|
81
|
+
isNullOrEmpty(obj: unknown): boolean;
|
|
82
|
+
/**
|
|
83
|
+
* 检查对象是否存在(非 null、undefined、空字符串)
|
|
84
|
+
* @param obj - 待检查的对象
|
|
85
|
+
* @returns 如果对象存在返回 true,否则返回 false
|
|
86
|
+
*/
|
|
87
|
+
isExist(obj: unknown): boolean;
|
|
88
|
+
/**
|
|
89
|
+
* 检查是否为 Window 对象
|
|
90
|
+
* @param el - 待检查的对象
|
|
91
|
+
* @returns 如果对象是 Window 对象返回 true,否则返回 false
|
|
92
|
+
*/
|
|
93
|
+
isWindow(el: unknown): el is Window;
|
|
94
|
+
/**
|
|
95
|
+
* 检查字符串是否为空(null 或空字符串)
|
|
96
|
+
* @param s - 待检查的字符串
|
|
97
|
+
* @returns 如果字符串为空返回 true,否则返回 false
|
|
98
|
+
*/
|
|
99
|
+
isEmpty(s: string | object | any[] | null | undefined): boolean;
|
|
100
|
+
/**
|
|
101
|
+
* 检查字符串是否不为空
|
|
102
|
+
* @param s - 待检查的字符串
|
|
103
|
+
* @returns 如果字符串不为空返回 true,否则返回 false
|
|
104
|
+
*/
|
|
105
|
+
isNotEmpty(s: string | null | undefined): boolean;
|
|
106
|
+
/**
|
|
107
|
+
* 检查字符串是否为空(null、空字符串或只包含空白字符)
|
|
108
|
+
* @param s - 待检查的字符串
|
|
109
|
+
* @returns 如果字符串为空返回 true,否则返回 false
|
|
110
|
+
*/
|
|
111
|
+
isBlank(s: string | null | undefined): boolean;
|
|
112
|
+
/**
|
|
113
|
+
* 检查字符串是否不为空(非 null、非空字符串且不全是空白字符)
|
|
114
|
+
* @param s - 待检查的字符串
|
|
115
|
+
* @returns 如果字符串不为空返回 true,否则返回 false
|
|
116
|
+
*/
|
|
117
|
+
isNotBlank(s: string | null | undefined): boolean;
|
|
118
|
+
/**
|
|
119
|
+
* 检查字符串是否为有效的 JSON 字符串
|
|
120
|
+
* @param val - 待检查的值
|
|
121
|
+
* @returns 如果字符串是有效的 JSON 返回 true,否则返回 false
|
|
122
|
+
*/
|
|
123
|
+
isJSON(val: unknown): boolean;
|
|
124
|
+
}
|
|
125
|
+
export declare const isUtil: IsUtil;
|
|
126
|
+
export default isUtil;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
export default class MixUtil {
|
|
2
|
+
static clearExpressionCache(): void;
|
|
3
|
+
static getExpressionCacheSize(): {
|
|
4
|
+
fn: number;
|
|
5
|
+
fnBody: number;
|
|
6
|
+
};
|
|
7
|
+
/**
|
|
8
|
+
* 执行表达式
|
|
9
|
+
* @param expression 例如在脚本配置器中配置示例:
|
|
10
|
+
* 若为:"true",则expression为"'true'",返回结果为"true"
|
|
11
|
+
* 若为:true,则expression为"true",返回结果为true
|
|
12
|
+
* 若为:"123",则expression为"'123'",返回结果为"123"
|
|
13
|
+
* 若为:123,则expression为"123",返回结果为123
|
|
14
|
+
* 有可能不通过脚本配置器配置,如直接通过api调用的,有可能会输入非字符串类型,则直接返回该输入值。
|
|
15
|
+
* @param $gl 用于expression的上下文参数
|
|
16
|
+
* @param glName 指定上下文的参数名,默认为$gl
|
|
17
|
+
* @param errorMessage 出错时提示的错误信息
|
|
18
|
+
* @param solutionDescription 如果出错,建议的解决方案信息
|
|
19
|
+
* @returns {*} 非字符串类型,直接返回;字符串类型,则返回执行结果
|
|
20
|
+
*/
|
|
21
|
+
static evalExpression(expression: unknown, $gl: object, glName?: string, errorMessage?: string, solutionDescription?: string): any;
|
|
22
|
+
/**
|
|
23
|
+
* 直接执行方法体内容
|
|
24
|
+
* @param fnBody 方法体的内容,如果内容
|
|
25
|
+
* @param $gl 用于fnBody的上下文参数
|
|
26
|
+
* @param glName 指定上下文的参数名,默认为$gl
|
|
27
|
+
* @param async 对于fnBody里有wait的场景,可以设置async为true
|
|
28
|
+
* @returns {*}
|
|
29
|
+
*/
|
|
30
|
+
static evalFn(fnBody: string, $gl: object, glName?: string, async?: boolean): any;
|
|
31
|
+
/**
|
|
32
|
+
* 直接执行eval
|
|
33
|
+
* @param expression
|
|
34
|
+
* @param $ctx 用于expression的上下文参数
|
|
35
|
+
* @param ctxName 指定上下文的参数名,默认为$ctx
|
|
36
|
+
* @returns {*}
|
|
37
|
+
*/
|
|
38
|
+
static evalPlus(expression: string, ctx: object, ctxName?: string): any;
|
|
39
|
+
/**
|
|
40
|
+
*
|
|
41
|
+
* @param ms 毫秒
|
|
42
|
+
*/
|
|
43
|
+
static sleep(ms: number): Promise<void>;
|
|
44
|
+
/**
|
|
45
|
+
* 延迟执行
|
|
46
|
+
* @param ms 毫秒
|
|
47
|
+
*/
|
|
48
|
+
static delay(ms: number): Promise<unknown>;
|
|
49
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export default class PageUtil {
|
|
2
|
+
/**
|
|
3
|
+
* 查找当前组件所在的页面组件
|
|
4
|
+
* @param component 组件实例
|
|
5
|
+
* @return 查找到当前组件所处的页面,若找不到则返回undefined
|
|
6
|
+
*/
|
|
7
|
+
static findCurrentPage(component: Record<string, any>): any;
|
|
8
|
+
/**
|
|
9
|
+
* 查找当前控件(基础组件)所在的组件(高级组件)
|
|
10
|
+
* @param control 组件实例
|
|
11
|
+
* @return 查找到当前组件所处的页面,若找不到则返回undefined
|
|
12
|
+
*/
|
|
13
|
+
static findCurrentComponent(component: Record<string, any>): any;
|
|
14
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
export declare const UPGRADE_DICTIONARY_TOPIC = "upgrade_dictionary_topic";
|
|
2
|
+
export declare const UPGRADE_PAGE_TOPIC = "upgrade_page_topic";
|
|
3
|
+
export declare const UPGRADE_STATE_WORKFLOW_TOPIC = "upgrade_state_workflow_topic";
|
|
4
|
+
type TopicHandler = (data: any) => void;
|
|
5
|
+
export declare class SseClient {
|
|
6
|
+
private esAll?;
|
|
7
|
+
private topicSources;
|
|
8
|
+
private handlers;
|
|
9
|
+
private fetchAbort?;
|
|
10
|
+
private topicFetchAbort;
|
|
11
|
+
private activeReaders;
|
|
12
|
+
startAll(): void;
|
|
13
|
+
subscribe(topic: string): void;
|
|
14
|
+
on(topic: string, handler: TopicHandler): void;
|
|
15
|
+
off(topic: string, handler: TopicHandler): void;
|
|
16
|
+
close(): void;
|
|
17
|
+
/**
|
|
18
|
+
* 销毁实例,释放所有资源
|
|
19
|
+
* 与close()的区别:destroy()更彻底,确保所有引用都被清空
|
|
20
|
+
*/
|
|
21
|
+
destroy(): void;
|
|
22
|
+
private dispatch;
|
|
23
|
+
private handleDictionaryUpgrade;
|
|
24
|
+
private handlePageUpgrade;
|
|
25
|
+
private handleStateWorkflowUpgrade;
|
|
26
|
+
clearPageCache(pageId: string, extendId?: string): Promise<void>;
|
|
27
|
+
clearStateWorkflowCache(procDefId: string): Promise<void>;
|
|
28
|
+
clearDictionaryCache(dictId: string): Promise<void>;
|
|
29
|
+
refreshDictionaryCache(dictId: string): Promise<void>;
|
|
30
|
+
triggerTestDictionaryUpgrade(dictId: string): Promise<void>;
|
|
31
|
+
}
|
|
32
|
+
export declare const sseClient: SseClient;
|
|
33
|
+
export declare const initRuntimeSse: () => void;
|
|
34
|
+
export {};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
export declare class StringUtil {
|
|
2
|
+
constructor();
|
|
3
|
+
trim(str: string): string;
|
|
4
|
+
/**
|
|
5
|
+
* 将特定字符串转为驼峰字符串
|
|
6
|
+
* @param s
|
|
7
|
+
*/
|
|
8
|
+
toCamelCase(s: string): string;
|
|
9
|
+
/**
|
|
10
|
+
* 去除字符串中的 se,如‘ zhang he wang ’ to ‘[zhang,he,wang]’
|
|
11
|
+
* @param s1 字符串
|
|
12
|
+
* @param s2 分隔符
|
|
13
|
+
*/
|
|
14
|
+
formatSeparator(s1: string, s2: string): string[];
|
|
15
|
+
/**
|
|
16
|
+
* 日期格式化
|
|
17
|
+
* @param date
|
|
18
|
+
* @param format
|
|
19
|
+
*/
|
|
20
|
+
formatTime(date: Date, format?: string): string;
|
|
21
|
+
/**
|
|
22
|
+
* 特殊字符串缩略处理
|
|
23
|
+
* @param value
|
|
24
|
+
* @param type 1: 电话,2:邮箱
|
|
25
|
+
*/
|
|
26
|
+
abbreviateValue(value: string, type: string): string;
|
|
27
|
+
}
|
|
28
|
+
declare const stringUtil: StringUtil;
|
|
29
|
+
export default stringUtil;
|
|
@@ -0,0 +1,217 @@
|
|
|
1
|
+
import { default as CheckUtil } from './CheckUtil.ts';
|
|
2
|
+
import { default as MixUtil } from './MixUtil.ts';
|
|
3
|
+
import { default as ConvertUtil } from './ConvertUtil.ts';
|
|
4
|
+
import { default as GenerateUtil } from './GenerateUtil.ts';
|
|
5
|
+
import { default as ClipboardUtil } from './ClipboardUtil.ts';
|
|
6
|
+
import { default as FileUtil } from './FileUtil.ts';
|
|
7
|
+
import { hasRole, hasAnyRole, hasAllRoles, withoutRole, checkRolePermission } from '../composables/useRole.ts';
|
|
8
|
+
export declare class Utils {
|
|
9
|
+
constructor();
|
|
10
|
+
toBoolean: typeof ConvertUtil.toBoolean;
|
|
11
|
+
toEmails: typeof ConvertUtil.toEmails;
|
|
12
|
+
dateFormat: typeof ConvertUtil.dateFormat;
|
|
13
|
+
convertPx2num: typeof ConvertUtil.convertPx2num;
|
|
14
|
+
convertNum2px: typeof ConvertUtil.convertNum2px;
|
|
15
|
+
stringToBase64: typeof ConvertUtil.stringToBase64;
|
|
16
|
+
listToTree: typeof ConvertUtil.listToTree;
|
|
17
|
+
abbreviateValue: (val: unknown, type: string) => string;
|
|
18
|
+
formatSeparator: (s1: string, s2: string) => string[];
|
|
19
|
+
formatTime: (date: Date, format?: string) => string;
|
|
20
|
+
toCamelCase: (s: string) => string;
|
|
21
|
+
trim: (str: string) => string;
|
|
22
|
+
gid: typeof GenerateUtil.gid;
|
|
23
|
+
uuid: typeof GenerateUtil.uuid;
|
|
24
|
+
generateRandom: typeof GenerateUtil.generateRandom;
|
|
25
|
+
isBrowser: typeof CheckUtil.isBrowser;
|
|
26
|
+
isJSON: (val: unknown) => boolean;
|
|
27
|
+
isArray: (val: unknown) => val is unknown[];
|
|
28
|
+
isObject: (val: unknown) => val is Record<string, unknown>;
|
|
29
|
+
isString: (val: unknown) => val is string;
|
|
30
|
+
isNumber: (val: unknown) => val is number;
|
|
31
|
+
isRegExp: (val: unknown) => val is RegExp;
|
|
32
|
+
isUndefined: (val: unknown) => val is undefined;
|
|
33
|
+
isNull: (val: unknown) => val is null;
|
|
34
|
+
isEmpty: (val: object | string | any[] | null | undefined) => boolean;
|
|
35
|
+
isNullOrEmpty: (val: string | null | undefined) => boolean;
|
|
36
|
+
isNotBlank: (val: string | null | undefined) => boolean;
|
|
37
|
+
isBlank: (val: string | null | undefined) => boolean;
|
|
38
|
+
isExist: (val: unknown) => boolean;
|
|
39
|
+
isWindow: (val: unknown) => val is Window;
|
|
40
|
+
isFile: (val: unknown) => val is File;
|
|
41
|
+
isEmptyObject: (val: unknown) => boolean;
|
|
42
|
+
isSelectQuery: (sql: string) => boolean;
|
|
43
|
+
/**
|
|
44
|
+
* 基于sessionStorage存储
|
|
45
|
+
* @param key
|
|
46
|
+
* @param json 默认返回{}
|
|
47
|
+
*/
|
|
48
|
+
session(key: string, json: object): any;
|
|
49
|
+
/**
|
|
50
|
+
* 数组指定列去重,返回去重后的列对象
|
|
51
|
+
* @param arr 数组
|
|
52
|
+
* @param col
|
|
53
|
+
*/
|
|
54
|
+
distinct(arr: Array<any>, col: string | number): any;
|
|
55
|
+
listToTree2<T extends {
|
|
56
|
+
[key: string]: any;
|
|
57
|
+
}>(list: Array<T>): Record<string, any>[];
|
|
58
|
+
/**
|
|
59
|
+
* 树结构转成列表结构
|
|
60
|
+
* @param treeNodes
|
|
61
|
+
*/
|
|
62
|
+
treeToList(treeNodes: Record<string, any>[]): Record<string, any>[];
|
|
63
|
+
/**
|
|
64
|
+
* 将树结构数据,转成以主键为key,value为节点的Map
|
|
65
|
+
* @param treeNodes
|
|
66
|
+
* @param keyName
|
|
67
|
+
* @param map
|
|
68
|
+
*/
|
|
69
|
+
treeToMap(treeNodes: Record<string, any>[], keyName: string, map: Record<any, any>): void;
|
|
70
|
+
/**
|
|
71
|
+
* 将时间转为XX时间之前
|
|
72
|
+
* const time = "2024-03-04 16:18:40";
|
|
73
|
+
* const result = timeAgo(time);
|
|
74
|
+
* @param time 格式如:"2024-03-04 16:18:40"
|
|
75
|
+
*/
|
|
76
|
+
timeAgo(time: string): string;
|
|
77
|
+
/**
|
|
78
|
+
* 获取对象的属性值
|
|
79
|
+
* @param obj
|
|
80
|
+
* @param propPath 支持链式,如x.y.z
|
|
81
|
+
*/
|
|
82
|
+
getProperty(obj: object, propPath: string): Record<string, any>;
|
|
83
|
+
/**
|
|
84
|
+
* 查找当前组件所在的页面组件
|
|
85
|
+
* @param component 组件实例
|
|
86
|
+
* @return 查找到当前组件所处的页面,若找不到则返回undefined
|
|
87
|
+
*/
|
|
88
|
+
findCurrentPage(component: any): any;
|
|
89
|
+
/**
|
|
90
|
+
* 查找当前控件(基础组件)所在的组件(高级组件)
|
|
91
|
+
* @param component 组件实例
|
|
92
|
+
* @return 查找到当前组件所处的页面,若找不到则返回undefined
|
|
93
|
+
*/
|
|
94
|
+
findCurrentComponent(component: any): any;
|
|
95
|
+
/**
|
|
96
|
+
* 获取url的查询参数
|
|
97
|
+
* @param paramName
|
|
98
|
+
*/
|
|
99
|
+
getUrlQueryParam(paramName: string): string | undefined;
|
|
100
|
+
/**
|
|
101
|
+
* 将Record对象,构建成url参数数组,并进行url编码
|
|
102
|
+
* @param params
|
|
103
|
+
*/
|
|
104
|
+
toUrlParamAry(params: Record<string, any>): string[];
|
|
105
|
+
/**
|
|
106
|
+
* 获取url的查询参数对象
|
|
107
|
+
*/
|
|
108
|
+
getSearchParams: () => Record<string, string>;
|
|
109
|
+
groupSum(data: {
|
|
110
|
+
[key: string]: any;
|
|
111
|
+
}[], groupField: string, sumFields: string[]): any;
|
|
112
|
+
/**
|
|
113
|
+
* 反转数组,返回新的数组,不改变原数据
|
|
114
|
+
* @param array
|
|
115
|
+
*/
|
|
116
|
+
arrayReverse(array: Array<any>): any[];
|
|
117
|
+
/**
|
|
118
|
+
* 移动数组内的项,改变原数据
|
|
119
|
+
* @param array
|
|
120
|
+
* @param oldIndex 被移动项的位置
|
|
121
|
+
* @param newIndex 移动到新的位置
|
|
122
|
+
*/
|
|
123
|
+
arrayMoveItem: (array: any[], oldIndex: number, newIndex: number) => any[];
|
|
124
|
+
/**
|
|
125
|
+
* 查询选项值对应标题
|
|
126
|
+
* @param optionValue 选项值
|
|
127
|
+
* @param data 选项集合
|
|
128
|
+
*/
|
|
129
|
+
getOptionLabel(optionValue: string | number | boolean, data: any[]): any;
|
|
130
|
+
getOptionRemark(optionValue: string | number | boolean, data: any[]): any;
|
|
131
|
+
copyToClipboard: (value: string, successCallBack?: any, failCallBack?: any) => Promise<void>;
|
|
132
|
+
readClipboardTable: typeof ClipboardUtil.readClipboardTable;
|
|
133
|
+
readClipboardImage: typeof ClipboardUtil.readClipboardImage;
|
|
134
|
+
/**
|
|
135
|
+
* 值处于数值的那个区间
|
|
136
|
+
* @param options 数组
|
|
137
|
+
* @param value 值
|
|
138
|
+
* @param defaultValue 默认值
|
|
139
|
+
*/
|
|
140
|
+
resetValueByOptions(options: number[], value: number, defaultValue: number): number;
|
|
141
|
+
toChineseCurrency(num: number | string): string;
|
|
142
|
+
convertStrToObj: typeof ConvertUtil.convertStrToObj;
|
|
143
|
+
convertObjToStr: typeof ConvertUtil.convertObjToStr;
|
|
144
|
+
normalizeSeparators: typeof ConvertUtil.normalizeSeparators;
|
|
145
|
+
/**
|
|
146
|
+
* 获取嵌套对象属性值
|
|
147
|
+
* const obj = {
|
|
148
|
+
* a: {
|
|
149
|
+
* b: {
|
|
150
|
+
* c: 'hello world'
|
|
151
|
+
* }
|
|
152
|
+
* }
|
|
153
|
+
* };
|
|
154
|
+
* const value = getNestedProperty(obj, 'a.b.c');
|
|
155
|
+
* console.log(value); // 输出: 'hello world'
|
|
156
|
+
* @param obj
|
|
157
|
+
* @param propString
|
|
158
|
+
*/
|
|
159
|
+
getNestedProperty(obj: object, propString: string): object | undefined;
|
|
160
|
+
/**
|
|
161
|
+
* 对分组的数据,按某一字段对分组进行排序
|
|
162
|
+
* 注意是对分组进行排序,不对分组内的数据进行排序
|
|
163
|
+
* @param items 需要分组的数组对象
|
|
164
|
+
* @param groupNameField 用于分组的数据字段
|
|
165
|
+
* @param sortField 该字段在分组件的值是一致的,否则排序结果不可预料
|
|
166
|
+
*/
|
|
167
|
+
sortGroupsByField(items: [], groupNameField: string, sortField: string): any[];
|
|
168
|
+
getFileParts: typeof FileUtil.getFileParts;
|
|
169
|
+
uploadFile: typeof FileUtil.uploadFile;
|
|
170
|
+
validateCrontab(cron: string): {
|
|
171
|
+
err: boolean;
|
|
172
|
+
msg: string;
|
|
173
|
+
};
|
|
174
|
+
/**
|
|
175
|
+
* 增加异常描述
|
|
176
|
+
* @param additionalMessage
|
|
177
|
+
* @param originalError
|
|
178
|
+
*/
|
|
179
|
+
addMessageToError(additionalMessage: string, originalError: Error): Error;
|
|
180
|
+
/**
|
|
181
|
+
* 构建过滤器,根据operator来构建
|
|
182
|
+
* @param filter 过滤器
|
|
183
|
+
* @param operator 过滤类型
|
|
184
|
+
*/
|
|
185
|
+
filterOperator(filter: Record<string, any>, operator: Record<string, any>): Record<string, any>;
|
|
186
|
+
/**
|
|
187
|
+
* 将user_name 修改为 userName
|
|
188
|
+
* @param obj 集合
|
|
189
|
+
* @param keysToRemove 移除的字段
|
|
190
|
+
*/
|
|
191
|
+
convertKeysToCamelCase(obj: Record<string, any>, keysToRemove?: string[]): Record<string, any>;
|
|
192
|
+
evalPlus: typeof MixUtil.evalPlus;
|
|
193
|
+
evalFn: typeof MixUtil.evalFn;
|
|
194
|
+
evalExpression: typeof MixUtil.evalExpression;
|
|
195
|
+
sleep: typeof MixUtil.sleep;
|
|
196
|
+
delay: typeof MixUtil.delay;
|
|
197
|
+
/**
|
|
198
|
+
* 从sortable对象中获取排序字符串
|
|
199
|
+
* @param sortable 排序对象,格式为 {field: {sortOrder: 'ascend'|'descend'|''}}
|
|
200
|
+
* @returns 排序字符串,格式为 'field|asc' 或 'field|desc',无排序时返回空字符串
|
|
201
|
+
*/
|
|
202
|
+
getOrderFromSortable(sortable: Record<string, any>): string;
|
|
203
|
+
/**
|
|
204
|
+
* 渲染字符串模板为html
|
|
205
|
+
* @param templateContent
|
|
206
|
+
* @param params
|
|
207
|
+
*/
|
|
208
|
+
renderToString: (templateContent: string, props: Record<string, any>) => string;
|
|
209
|
+
hasRole: typeof hasRole;
|
|
210
|
+
hasAnyRole: typeof hasAnyRole;
|
|
211
|
+
hasAllRoles: typeof hasAllRoles;
|
|
212
|
+
withoutRole: typeof withoutRole;
|
|
213
|
+
checkRolePermission: typeof checkRolePermission;
|
|
214
|
+
isAdmin: () => boolean;
|
|
215
|
+
}
|
|
216
|
+
declare const utils: Utils;
|
|
217
|
+
export default utils;
|