@gct-paas/core 0.1.5-dev.0 → 0.1.5-dev.10
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/index.esm.min.js +1 -1
- package/dist/redirect-index-Ck5Ddtcb.js +1 -0
- package/es/enums/app-designer/index.d.ts +11 -0
- package/es/enums/app-designer/index.mjs +14 -1
- package/es/enums/appEnum.d.ts +8 -0
- package/es/enums/appEnum.mjs +10 -1
- package/es/enums/page-designer/designer.d.ts +13 -13
- package/es/enums/page-designer/widget.d.ts +2 -2
- package/es/global/gct/gct.d.ts +108 -107
- package/es/hooks/index.d.ts +1 -0
- package/es/hooks/index.mjs +1 -0
- package/es/hooks/useFile.d.ts +4 -0
- package/es/hooks/useFile.mjs +22 -0
- package/es/index.d.ts +1 -0
- package/es/index.mjs +15 -6
- package/es/interface/i-kit-plugin-module/i-kit-plugin-module.d.ts +23 -0
- package/es/interface/i-pinia-action/i-global-actions.d.ts +3 -0
- package/es/interface/i-popover-options/i-popover-options.d.ts +98 -0
- package/es/interface/index.d.ts +3 -2
- package/es/interface/index.mjs +1 -0
- package/es/interface/model-designer/entity.d.ts +87 -79
- package/es/interface/model-designer/serial.d.ts +22 -0
- package/es/interface/model-designer/serial.mjs +49 -0
- package/es/interface/open-util/i-app-full-screen-container-options/i-app-full-screen-container-options.d.ts +26 -0
- package/es/interface/open-util/i-overlay-controller/i-overlay-controller.d.ts +52 -0
- package/es/interface/open-util/i-overlay-popover-container/i-overlay-popover-container.d.ts +21 -0
- package/es/interface/open-util/index.d.ts +3 -1
- package/es/locale/index.d.ts +26 -1
- package/es/locale/index.mjs +51 -3
- package/es/locale/sys/model.d.ts +5 -0
- package/es/locale/sys.d.ts +5 -0
- package/es/modules/mqtt/enums/mqtt-status.enum.d.ts +1 -0
- package/es/modules/mqtt/enums/mqtt-status.enum.mjs +2 -1
- package/es/modules/mqtt/mqtt-manager.d.ts +1 -1
- package/es/modules/mqtt/mqtt-manager.mjs +2 -1
- package/es/modules/platform-config/store.d.ts +106 -106
- package/es/modules/platform-config/store.mjs +0 -1
- package/es/modules/platform-config/useSecuritySetting.d.ts +1 -1
- package/es/modules/user-stores/store/tenant.store.d.ts +6 -8
- package/es/modules/user-stores/store/tenant.store.mjs +12 -14
- package/es/modules/user-stores/store/user.store.d.ts +11 -2
- package/es/modules/user-stores/store/user.store.mjs +15 -4
- package/es/modules/user-stores/types/tenant.d.ts +7 -1
- package/es/router/index.d.ts +3 -0
- package/es/router/index.mjs +37 -4
- package/es/router/redirect/redirect-index.vue.d.ts +2 -0
- package/es/router/redirect/redirect-index.vue.mjs +5 -0
- package/es/router/redirect/redirect-index.vue_vue_type_script_setup_true_lang.mjs +28 -0
- package/es/setup-app.mjs +6 -2
- package/es/store/global-store.mjs +3 -0
- package/es/store/index.d.ts +1 -0
- package/es/store/index.mjs +1 -0
- package/es/store/session-store.d.ts +7 -0
- package/es/store/session-store.mjs +7 -0
- package/es/store/storage-store.d.ts +2 -0
- package/es/store/storage-store.mjs +3 -2
- package/es/types/index.d.ts +0 -1
- package/es/utils/file/download.d.ts +1 -1
- package/es/utils/file/parser.d.ts +1 -1
- package/es/utils/i18n/index.mjs +3 -0
- package/es/utils/index.d.ts +3 -0
- package/es/utils/index.mjs +4 -0
- package/es/utils/kit-pkg-util/kit-pkg-util.d.ts +34 -13
- package/es/utils/kit-pkg-util/kit-pkg-util.mjs +51 -40
- package/es/utils/openUtil/index.d.ts +1 -0
- package/es/utils/openUtil/index.mjs +1 -0
- package/es/utils/openUtil/overlay-popover-container/overlay-popover-container.d.ts +15 -0
- package/es/utils/openUtil/overlay-popover-container/overlay-popover-container.mjs +19 -0
- package/es/utils/plugin-pkg-util/plugin-pkg-util.d.ts +3 -3
- package/es/utils/plugin-pkg-util/plugin-pkg-util.mjs +1 -1
- package/es/utils/script-loader/script-loader.d.ts +62 -0
- package/es/utils/script-loader/script-loader.mjs +92 -0
- package/es/utils/style/index.d.ts +8 -0
- package/es/utils/style/index.mjs +67 -1
- package/es/utils/text-measure/text-measure.d.ts +141 -0
- package/es/utils/text-measure/text-measure.mjs +191 -0
- package/es/utils/tools/tools.d.ts +1 -1
- package/es/utils/uploader/uploader.mjs +3 -5
- package/es/utils/util.d.ts +1 -0
- package/es/utils/util.mjs +9 -1
- package/es/utils/vue-component-code.d.ts +8 -0
- package/es/utils/vue-component-code.mjs +37 -0
- package/package.json +20 -20
- package/es/interface/i-import-style-map/i-import-style-map.d.ts +0 -15
- package/es/interface/i-kit-info/i-kit-info.d.ts +0 -20
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 文本测量工具类
|
|
3
|
+
* 使用 Canvas 测量文本宽度,支持批量测量
|
|
4
|
+
*/
|
|
5
|
+
interface TextMeasureOptions {
|
|
6
|
+
/** 字体大小,默认 14px */
|
|
7
|
+
fontSize?: string | number;
|
|
8
|
+
/** 字体族,默认 'Arial, sans-serif' */
|
|
9
|
+
fontFamily?: string;
|
|
10
|
+
/** 字体粗细,默认 'normal' */
|
|
11
|
+
fontWeight?: string | number;
|
|
12
|
+
/** 字体样式,默认 'normal' */
|
|
13
|
+
fontStyle?: string;
|
|
14
|
+
}
|
|
15
|
+
interface TextMeasureResult {
|
|
16
|
+
/** 文本内容 */
|
|
17
|
+
text: string;
|
|
18
|
+
/** 计算得到的宽度 */
|
|
19
|
+
width: number;
|
|
20
|
+
}
|
|
21
|
+
declare class TextMeasureUtil {
|
|
22
|
+
private canvas;
|
|
23
|
+
private ctx;
|
|
24
|
+
/**
|
|
25
|
+
* 获取 Canvas 上下文,懒加载创建
|
|
26
|
+
*/
|
|
27
|
+
private getContext;
|
|
28
|
+
/**
|
|
29
|
+
* 设置字体样式
|
|
30
|
+
*/
|
|
31
|
+
private setFont;
|
|
32
|
+
/**
|
|
33
|
+
* 测量单个文本的宽度
|
|
34
|
+
*
|
|
35
|
+
* @param text 要测量的文本
|
|
36
|
+
* @param options 字体选项
|
|
37
|
+
* @returns 文本宽度(像素)
|
|
38
|
+
*/
|
|
39
|
+
measureText(text: string, options?: TextMeasureOptions): number;
|
|
40
|
+
/**
|
|
41
|
+
* 批量测量多段文本的宽度
|
|
42
|
+
*
|
|
43
|
+
* @param texts 要测量的文本数组
|
|
44
|
+
* @param options 字体选项
|
|
45
|
+
* @returns 包含每段文本和对应宽度的结果数组
|
|
46
|
+
*/
|
|
47
|
+
measureTexts(texts: string[], options?: TextMeasureOptions): TextMeasureResult[];
|
|
48
|
+
/**
|
|
49
|
+
* 获取文本的最大宽度
|
|
50
|
+
*
|
|
51
|
+
* @param texts 要测量的文本数组
|
|
52
|
+
* @param options 字体选项
|
|
53
|
+
* @returns 最大宽度(像素)
|
|
54
|
+
*/
|
|
55
|
+
getMaxWidth(texts: string[], options?: TextMeasureOptions): number;
|
|
56
|
+
/**
|
|
57
|
+
* 获取文本的最小宽度
|
|
58
|
+
*
|
|
59
|
+
* @param texts 要测量的文本数组
|
|
60
|
+
* @param options 字体选项
|
|
61
|
+
* @returns 最小宽度(像素)
|
|
62
|
+
*/
|
|
63
|
+
getMinWidth(texts: string[], options?: TextMeasureOptions): number;
|
|
64
|
+
/**
|
|
65
|
+
* 计算文本的总宽度(用于水平排列的文本)
|
|
66
|
+
*
|
|
67
|
+
* @param texts 要测量的文本数组
|
|
68
|
+
* @param options 字体选项
|
|
69
|
+
* @param spacing 文本间的间距,默认 0
|
|
70
|
+
* @returns 总宽度(像素)
|
|
71
|
+
*/
|
|
72
|
+
getTotalWidth(texts: string[], options?: TextMeasureOptions, spacing?: number): number;
|
|
73
|
+
/**
|
|
74
|
+
* 根据最大宽度截断文本,添加省略号
|
|
75
|
+
*
|
|
76
|
+
* @param text 原始文本
|
|
77
|
+
* @param maxWidth 最大宽度
|
|
78
|
+
* @param options 字体选项
|
|
79
|
+
* @param ellipsis 省略号,默认 '...'
|
|
80
|
+
* @param minChars 最少显示字符数,默认 0
|
|
81
|
+
* @returns 截断后的文本
|
|
82
|
+
*/
|
|
83
|
+
truncateText(text: string, maxWidth: number, options?: TextMeasureOptions, ellipsis?: string, minChars?: number): string;
|
|
84
|
+
/**
|
|
85
|
+
* 销毁资源
|
|
86
|
+
*/
|
|
87
|
+
destroy(): void;
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* 测量单个文本的宽度
|
|
91
|
+
*
|
|
92
|
+
* @param text 要测量的文本
|
|
93
|
+
* @param options 字体选项
|
|
94
|
+
* @returns 文本宽度(像素)
|
|
95
|
+
*/
|
|
96
|
+
export declare function measureText(text: string, options?: TextMeasureOptions): number;
|
|
97
|
+
/**
|
|
98
|
+
* 批量测量多段文本的宽度
|
|
99
|
+
*
|
|
100
|
+
* @param texts 要测量的文本数组
|
|
101
|
+
* @param options 字体选项
|
|
102
|
+
* @returns 包含每段文本和对应宽度的结果数组
|
|
103
|
+
*/
|
|
104
|
+
export declare function measureTexts(texts: string[], options?: TextMeasureOptions): TextMeasureResult[];
|
|
105
|
+
/**
|
|
106
|
+
* 获取文本的最大宽度
|
|
107
|
+
*
|
|
108
|
+
* @param texts 要测量的文本数组
|
|
109
|
+
* @param options 字体选项
|
|
110
|
+
* @returns 最大宽度(像素)
|
|
111
|
+
*/
|
|
112
|
+
export declare function getMaxTextWidth(texts: string[], options?: TextMeasureOptions): number;
|
|
113
|
+
/**
|
|
114
|
+
* 获取文本的最小宽度
|
|
115
|
+
*
|
|
116
|
+
* @param texts 要测量的文本数组
|
|
117
|
+
* @param options 字体选项
|
|
118
|
+
* @returns 最小宽度(像素)
|
|
119
|
+
*/
|
|
120
|
+
export declare function getMinTextWidth(texts: string[], options?: TextMeasureOptions): number;
|
|
121
|
+
/**
|
|
122
|
+
* 计算文本的总宽度(用于水平排列的文本)
|
|
123
|
+
*
|
|
124
|
+
* @param texts 要测量的文本数组
|
|
125
|
+
* @param options 字体选项
|
|
126
|
+
* @param spacing 文本间的间距,默认 0
|
|
127
|
+
* @returns 总宽度(像素)
|
|
128
|
+
*/
|
|
129
|
+
export declare function getTotalTextWidth(texts: string[], options?: TextMeasureOptions, spacing?: number): number;
|
|
130
|
+
/**
|
|
131
|
+
* 根据最大宽度截断文本,添加省略号
|
|
132
|
+
*
|
|
133
|
+
* @param text 原始文本
|
|
134
|
+
* @param maxWidth 最大宽度
|
|
135
|
+
* @param options 字体选项
|
|
136
|
+
* @param ellipsis 省略号,默认 '...'
|
|
137
|
+
* @param minChars 最少显示字符数,默认 0
|
|
138
|
+
* @returns 截断后的文本
|
|
139
|
+
*/
|
|
140
|
+
export declare function truncateText(text: string, maxWidth: number, options?: TextMeasureOptions, ellipsis?: string, minChars?: number): string;
|
|
141
|
+
export { TextMeasureUtil, type TextMeasureOptions, type TextMeasureResult };
|
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
//#region src/utils/text-measure/text-measure.ts
|
|
2
|
+
var TextMeasureUtil = class {
|
|
3
|
+
canvas = null;
|
|
4
|
+
ctx = null;
|
|
5
|
+
/**
|
|
6
|
+
* 获取 Canvas 上下文,懒加载创建
|
|
7
|
+
*/
|
|
8
|
+
getContext() {
|
|
9
|
+
if (!this.canvas) {
|
|
10
|
+
this.canvas = document.createElement("canvas");
|
|
11
|
+
this.ctx = this.canvas.getContext("2d");
|
|
12
|
+
if (!this.ctx) throw new Error("无法创建 Canvas 2D 上下文");
|
|
13
|
+
}
|
|
14
|
+
return this.ctx;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* 设置字体样式
|
|
18
|
+
*/
|
|
19
|
+
setFont(options = {}) {
|
|
20
|
+
const { fontSize = 14, fontFamily = "Arial, sans-serif", fontWeight = "normal", fontStyle = "normal" } = options;
|
|
21
|
+
const ctx = this.getContext();
|
|
22
|
+
ctx.font = `${fontStyle} ${fontWeight} ${typeof fontSize === "number" ? `${fontSize}px` : fontSize} ${fontFamily}`;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* 测量单个文本的宽度
|
|
26
|
+
*
|
|
27
|
+
* @param text 要测量的文本
|
|
28
|
+
* @param options 字体选项
|
|
29
|
+
* @returns 文本宽度(像素)
|
|
30
|
+
*/
|
|
31
|
+
measureText(text, options = {}) {
|
|
32
|
+
if (!text) return 0;
|
|
33
|
+
this.setFont(options);
|
|
34
|
+
const metrics = this.getContext().measureText(text);
|
|
35
|
+
return Math.ceil(metrics.width);
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* 批量测量多段文本的宽度
|
|
39
|
+
*
|
|
40
|
+
* @param texts 要测量的文本数组
|
|
41
|
+
* @param options 字体选项
|
|
42
|
+
* @returns 包含每段文本和对应宽度的结果数组
|
|
43
|
+
*/
|
|
44
|
+
measureTexts(texts, options = {}) {
|
|
45
|
+
if (!texts || texts.length === 0) return [];
|
|
46
|
+
this.setFont(options);
|
|
47
|
+
const ctx = this.getContext();
|
|
48
|
+
return texts.map((text) => ({
|
|
49
|
+
text,
|
|
50
|
+
width: text ? Math.ceil(ctx.measureText(text).width) : 0
|
|
51
|
+
}));
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* 获取文本的最大宽度
|
|
55
|
+
*
|
|
56
|
+
* @param texts 要测量的文本数组
|
|
57
|
+
* @param options 字体选项
|
|
58
|
+
* @returns 最大宽度(像素)
|
|
59
|
+
*/
|
|
60
|
+
getMaxWidth(texts, options = {}) {
|
|
61
|
+
const results = this.measureTexts(texts, options);
|
|
62
|
+
return Math.max(...results.map((result) => result.width), 0);
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* 获取文本的最小宽度
|
|
66
|
+
*
|
|
67
|
+
* @param texts 要测量的文本数组
|
|
68
|
+
* @param options 字体选项
|
|
69
|
+
* @returns 最小宽度(像素)
|
|
70
|
+
*/
|
|
71
|
+
getMinWidth(texts, options = {}) {
|
|
72
|
+
const results = this.measureTexts(texts, options);
|
|
73
|
+
return Math.min(...results.map((result) => result.width), 0);
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* 计算文本的总宽度(用于水平排列的文本)
|
|
77
|
+
*
|
|
78
|
+
* @param texts 要测量的文本数组
|
|
79
|
+
* @param options 字体选项
|
|
80
|
+
* @param spacing 文本间的间距,默认 0
|
|
81
|
+
* @returns 总宽度(像素)
|
|
82
|
+
*/
|
|
83
|
+
getTotalWidth(texts, options = {}, spacing = 0) {
|
|
84
|
+
return this.measureTexts(texts, options).reduce((sum, result) => sum + result.width, 0) + Math.max(0, texts.length - 1) * spacing;
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* 根据最大宽度截断文本,添加省略号
|
|
88
|
+
*
|
|
89
|
+
* @param text 原始文本
|
|
90
|
+
* @param maxWidth 最大宽度
|
|
91
|
+
* @param options 字体选项
|
|
92
|
+
* @param ellipsis 省略号,默认 '...'
|
|
93
|
+
* @param minChars 最少显示字符数,默认 0
|
|
94
|
+
* @returns 截断后的文本
|
|
95
|
+
*/
|
|
96
|
+
truncateText(text, maxWidth, options = {}, ellipsis = "...", minChars = 0) {
|
|
97
|
+
if (!text) return "";
|
|
98
|
+
if (this.measureText(text, options) <= maxWidth) return text;
|
|
99
|
+
const availableWidth = maxWidth - this.measureText(ellipsis, options);
|
|
100
|
+
if (availableWidth <= 0) {
|
|
101
|
+
if (minChars > 0) return text.substring(0, minChars) + ellipsis;
|
|
102
|
+
return ellipsis;
|
|
103
|
+
}
|
|
104
|
+
let left = minChars;
|
|
105
|
+
let right = text.length;
|
|
106
|
+
let result = minChars > 0 ? text.substring(0, minChars) : "";
|
|
107
|
+
while (left <= right) {
|
|
108
|
+
const mid = Math.floor((left + right) / 2);
|
|
109
|
+
const substring = text.substring(0, mid);
|
|
110
|
+
if (this.measureText(substring, options) <= availableWidth) {
|
|
111
|
+
result = substring;
|
|
112
|
+
left = mid + 1;
|
|
113
|
+
} else right = mid - 1;
|
|
114
|
+
}
|
|
115
|
+
return result + ellipsis;
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* 销毁资源
|
|
119
|
+
*/
|
|
120
|
+
destroy() {
|
|
121
|
+
this.canvas = null;
|
|
122
|
+
this.ctx = null;
|
|
123
|
+
}
|
|
124
|
+
};
|
|
125
|
+
var textMeasureUtil = new TextMeasureUtil();
|
|
126
|
+
/**
|
|
127
|
+
* 测量单个文本的宽度
|
|
128
|
+
*
|
|
129
|
+
* @param text 要测量的文本
|
|
130
|
+
* @param options 字体选项
|
|
131
|
+
* @returns 文本宽度(像素)
|
|
132
|
+
*/
|
|
133
|
+
function measureText(text, options) {
|
|
134
|
+
return textMeasureUtil.measureText(text, options);
|
|
135
|
+
}
|
|
136
|
+
/**
|
|
137
|
+
* 批量测量多段文本的宽度
|
|
138
|
+
*
|
|
139
|
+
* @param texts 要测量的文本数组
|
|
140
|
+
* @param options 字体选项
|
|
141
|
+
* @returns 包含每段文本和对应宽度的结果数组
|
|
142
|
+
*/
|
|
143
|
+
function measureTexts(texts, options) {
|
|
144
|
+
return textMeasureUtil.measureTexts(texts, options);
|
|
145
|
+
}
|
|
146
|
+
/**
|
|
147
|
+
* 获取文本的最大宽度
|
|
148
|
+
*
|
|
149
|
+
* @param texts 要测量的文本数组
|
|
150
|
+
* @param options 字体选项
|
|
151
|
+
* @returns 最大宽度(像素)
|
|
152
|
+
*/
|
|
153
|
+
function getMaxTextWidth(texts, options) {
|
|
154
|
+
return textMeasureUtil.getMaxWidth(texts, options);
|
|
155
|
+
}
|
|
156
|
+
/**
|
|
157
|
+
* 获取文本的最小宽度
|
|
158
|
+
*
|
|
159
|
+
* @param texts 要测量的文本数组
|
|
160
|
+
* @param options 字体选项
|
|
161
|
+
* @returns 最小宽度(像素)
|
|
162
|
+
*/
|
|
163
|
+
function getMinTextWidth(texts, options) {
|
|
164
|
+
return textMeasureUtil.getMinWidth(texts, options);
|
|
165
|
+
}
|
|
166
|
+
/**
|
|
167
|
+
* 计算文本的总宽度(用于水平排列的文本)
|
|
168
|
+
*
|
|
169
|
+
* @param texts 要测量的文本数组
|
|
170
|
+
* @param options 字体选项
|
|
171
|
+
* @param spacing 文本间的间距,默认 0
|
|
172
|
+
* @returns 总宽度(像素)
|
|
173
|
+
*/
|
|
174
|
+
function getTotalTextWidth(texts, options, spacing) {
|
|
175
|
+
return textMeasureUtil.getTotalWidth(texts, options, spacing);
|
|
176
|
+
}
|
|
177
|
+
/**
|
|
178
|
+
* 根据最大宽度截断文本,添加省略号
|
|
179
|
+
*
|
|
180
|
+
* @param text 原始文本
|
|
181
|
+
* @param maxWidth 最大宽度
|
|
182
|
+
* @param options 字体选项
|
|
183
|
+
* @param ellipsis 省略号,默认 '...'
|
|
184
|
+
* @param minChars 最少显示字符数,默认 0
|
|
185
|
+
* @returns 截断后的文本
|
|
186
|
+
*/
|
|
187
|
+
function truncateText(text, maxWidth, options, ellipsis, minChars) {
|
|
188
|
+
return textMeasureUtil.truncateText(text, maxWidth, options, ellipsis, minChars);
|
|
189
|
+
}
|
|
190
|
+
//#endregion
|
|
191
|
+
export { TextMeasureUtil, getMaxTextWidth, getMinTextWidth, getTotalTextWidth, measureText, measureTexts, truncateText };
|
|
@@ -26,9 +26,7 @@ var Uploader = class {
|
|
|
26
26
|
}
|
|
27
27
|
}
|
|
28
28
|
static async uploadByFile(file, isApp = false, modelKey) {
|
|
29
|
-
|
|
30
|
-
formData.append("file", file, file.name);
|
|
31
|
-
return "/" + await (isApp ? appUploadapis : passUploadapis)(formData, modelKey);
|
|
29
|
+
return "/" + (await (isApp ? appUploadapis : passUploadapis)(file, modelKey)).data;
|
|
32
30
|
}
|
|
33
31
|
static toBase64(file) {
|
|
34
32
|
return new Promise((resolve, reject) => {
|
|
@@ -77,10 +75,10 @@ var Uploader = class {
|
|
|
77
75
|
}
|
|
78
76
|
};
|
|
79
77
|
async function appUploadapis(formData, modelKey) {
|
|
80
|
-
return _api.apaas.fileResource.postUpload({ ...modelKey ? { modelKey } : {} },
|
|
78
|
+
return _api.apaas.fileResource.postUpload({ ...modelKey ? { modelKey } : {} }, { file: formData });
|
|
81
79
|
}
|
|
82
80
|
async function passUploadapis(formData) {
|
|
83
|
-
return _api.apaas.file.postUploadImage({ bucket: "IMAGE" },
|
|
81
|
+
return _api.apaas.file.postUploadImage({ bucket: "IMAGE" }, { file: formData });
|
|
84
82
|
}
|
|
85
83
|
//#endregion
|
|
86
84
|
export { Uploader };
|
package/es/utils/util.d.ts
CHANGED
|
@@ -37,3 +37,4 @@ export declare function genUrl(url: string, data: IObject): string;
|
|
|
37
37
|
* ```
|
|
38
38
|
*/
|
|
39
39
|
export declare function openWindow(url: string, options?: IOpenWindowOptions): Window | null;
|
|
40
|
+
export declare const deleteAndInsertArr: (arr: IObject[], deleteIndex: number, insertIndex: number) => void;
|
package/es/utils/util.mjs
CHANGED
|
@@ -56,5 +56,13 @@ function openWindow(url, options) {
|
|
|
56
56
|
if (optionStr) featuresStr = featuresStr ? `${featuresStr},${optionStr}` : optionStr;
|
|
57
57
|
return window.open(finalUrl, target, featuresStr);
|
|
58
58
|
}
|
|
59
|
+
var deleteAndInsertArr = (arr, deleteIndex, insertIndex) => {
|
|
60
|
+
if (deleteIndex < 0 || deleteIndex >= arr.length || insertIndex < 0 || insertIndex > arr.length) {
|
|
61
|
+
console.log("下标超出数组范围");
|
|
62
|
+
return;
|
|
63
|
+
}
|
|
64
|
+
const deletedElement = arr.splice(deleteIndex, 1)[0];
|
|
65
|
+
arr.splice(insertIndex, 0, deletedElement);
|
|
66
|
+
};
|
|
59
67
|
//#endregion
|
|
60
|
-
export { genUrl, openWindow };
|
|
68
|
+
export { deleteAndInsertArr, genUrl, openWindow };
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import * as Vue from "vue";
|
|
2
|
+
//#region src/utils/vue-component-code.ts
|
|
3
|
+
/**
|
|
4
|
+
* 从字符串形式的 Vue 组件代码中解析并创建 Vue 组件实例
|
|
5
|
+
*
|
|
6
|
+
* @export
|
|
7
|
+
* @param {string} comStr
|
|
8
|
+
* @return {*} {IObject}
|
|
9
|
+
*/
|
|
10
|
+
function getVueComponentByCode(comStr) {
|
|
11
|
+
if (!comStr) return {};
|
|
12
|
+
let parsedCode;
|
|
13
|
+
try {
|
|
14
|
+
parsedCode = JSON.parse(comStr);
|
|
15
|
+
} catch (e) {
|
|
16
|
+
console.warn("Vue component JSON parsing failed.", e);
|
|
17
|
+
return {};
|
|
18
|
+
}
|
|
19
|
+
const { js, render } = parsedCode;
|
|
20
|
+
if (!js || !render) {
|
|
21
|
+
console.warn("Vue component is missing \"js\" or \"render\" code.");
|
|
22
|
+
return {};
|
|
23
|
+
}
|
|
24
|
+
try {
|
|
25
|
+
const exports = { default: {} };
|
|
26
|
+
new Function("exports", js)(exports);
|
|
27
|
+
new Function("exports", "_vue", render)(exports.default, Vue);
|
|
28
|
+
/**检查data是否合法 */
|
|
29
|
+
exports.default.data?.();
|
|
30
|
+
return exports.default;
|
|
31
|
+
} catch (e) {
|
|
32
|
+
console.warn("Vue component creation from parsed code failed.", e);
|
|
33
|
+
return {};
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
//#endregion
|
|
37
|
+
export { getVueComponentByCode };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gct-paas/core",
|
|
3
|
-
"version": "0.1.5-dev.
|
|
3
|
+
"version": "0.1.5-dev.10",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "paas 平台核心包",
|
|
6
6
|
"loader": "dist/index.esm.min.js",
|
|
@@ -30,23 +30,10 @@
|
|
|
30
30
|
},
|
|
31
31
|
"license": "MIT",
|
|
32
32
|
"author": "gct",
|
|
33
|
-
"scripts": {
|
|
34
|
-
"dev": "cross-env NODE_ENV=development vite build --watch --config vite.dev.config.ts",
|
|
35
|
-
"es:build": "vite build --config vite.dev.config.ts",
|
|
36
|
-
"build": "npm run lint && vite build --config vite.dev.config.ts && vite build --config vite.config.ts",
|
|
37
|
-
"lint": "eslint src/",
|
|
38
|
-
"test": "vitest",
|
|
39
|
-
"test:run": "vitest run",
|
|
40
|
-
"test:coverage": "vitest run --coverage",
|
|
41
|
-
"publish:next": "npm run build && npm publish --access public --tag=next --registry=https://registry.npmjs.org/",
|
|
42
|
-
"publish:dev": "npm run build && npm publish --access public --tag=dev --registry=https://registry.npmjs.org/",
|
|
43
|
-
"publish:alpha": "npm run build && npm publish --access public --tag=alpha --registry=https://registry.npmjs.org/",
|
|
44
|
-
"publish:beta": "npm run build && npm publish --access public --tag=beta --registry=https://registry.npmjs.org/",
|
|
45
|
-
"publish:npm": "npm run build && npm publish --access public --registry=https://registry.npmjs.org/"
|
|
46
|
-
},
|
|
47
33
|
"dependencies": {
|
|
48
34
|
"@fingerprintjs/fingerprintjs": "^5.1.0",
|
|
49
|
-
"@
|
|
35
|
+
"@floating-ui/dom": "^1.7.6",
|
|
36
|
+
"@gct-paas/api": "^0.1.4-dev.4",
|
|
50
37
|
"@module-federation/runtime": "^2.2.3",
|
|
51
38
|
"@vueuse/core": "^14.1.0",
|
|
52
39
|
"async-validator": "^4.2.5",
|
|
@@ -62,7 +49,7 @@
|
|
|
62
49
|
"qx-util": "^0.4.8",
|
|
63
50
|
"vue": "^3.5.30",
|
|
64
51
|
"vue-i18n": "11.3.0",
|
|
65
|
-
"vue-router": "
|
|
52
|
+
"vue-router": "4.6.4",
|
|
66
53
|
"wujie": "^1.0.29"
|
|
67
54
|
},
|
|
68
55
|
"devDependencies": {
|
|
@@ -71,10 +58,23 @@
|
|
|
71
58
|
"playwright": "^1.58.0"
|
|
72
59
|
},
|
|
73
60
|
"peerDependencies": {
|
|
74
|
-
"@gct-paas/api": "
|
|
61
|
+
"@gct-paas/api": "^0.1.4-dev.4",
|
|
75
62
|
"vue": ">=3",
|
|
76
63
|
"vue-i18n": ">=11",
|
|
77
64
|
"vue-router": ">=4"
|
|
78
65
|
},
|
|
79
|
-
"
|
|
80
|
-
|
|
66
|
+
"scripts": {
|
|
67
|
+
"dev": "cross-env NODE_ENV=development vite build --watch --config vite.dev.config.ts",
|
|
68
|
+
"es:build": "vite build --config vite.dev.config.ts",
|
|
69
|
+
"build": "npm run lint && vue-tsc --noEmit && vite build --config vite.dev.config.ts && vite build --config vite.config.ts",
|
|
70
|
+
"lint": "eslint src/",
|
|
71
|
+
"test": "vitest",
|
|
72
|
+
"test:run": "vitest run",
|
|
73
|
+
"test:coverage": "vitest run --coverage",
|
|
74
|
+
"publish:next": "npm run build && npm publish --access public --tag=next --registry=https://registry.npmjs.org/",
|
|
75
|
+
"publish:dev": "npm run build && npm publish --access public --tag=dev --registry=https://registry.npmjs.org/",
|
|
76
|
+
"publish:alpha": "npm run build && npm publish --access public --tag=alpha --registry=https://registry.npmjs.org/",
|
|
77
|
+
"publish:beta": "npm run build && npm publish --access public --tag=beta --registry=https://registry.npmjs.org/",
|
|
78
|
+
"publish:npm": "npm run build && npm publish --access public --registry=https://registry.npmjs.org/"
|
|
79
|
+
}
|
|
80
|
+
}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* systemjs 扩展样式模块加载声明
|
|
3
|
-
*
|
|
4
|
-
* @export
|
|
5
|
-
* @interface IStyleIMportMap
|
|
6
|
-
* @extends {System.ImportMap}
|
|
7
|
-
*/
|
|
8
|
-
export interface IStyleIMportMap extends System.ImportMap {
|
|
9
|
-
/**
|
|
10
|
-
* 样式静态资源相对或者绝对路径与 imports 里边对应,会在加载 import 脚本时,自动加载样式文件
|
|
11
|
-
*
|
|
12
|
-
* @type {(Record<string, string[] | string>)}
|
|
13
|
-
*/
|
|
14
|
-
styles?: Record<string, string[] | string>;
|
|
15
|
-
}
|