@gct-paas/core 0.1.5-dev.5 → 0.1.5-dev.7

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 (38) hide show
  1. package/dist/index.esm.min.js +1 -1
  2. package/es/enums/app-designer/index.d.ts +11 -0
  3. package/es/enums/app-designer/index.mjs +14 -1
  4. package/es/enums/appEnum.d.ts +8 -0
  5. package/es/enums/appEnum.mjs +10 -1
  6. package/es/enums/page-designer/designer.d.ts +13 -13
  7. package/es/index.mjs +9 -5
  8. package/es/interface/i-popover-options/i-popover-options.d.ts +98 -0
  9. package/es/interface/index.d.ts +2 -1
  10. package/es/interface/index.mjs +1 -0
  11. package/es/interface/model-designer/entity.d.ts +87 -79
  12. package/es/interface/model-designer/serial.d.ts +22 -0
  13. package/es/interface/model-designer/serial.mjs +49 -0
  14. package/es/interface/open-util/i-app-full-screen-container-options/i-app-full-screen-container-options.d.ts +26 -0
  15. package/es/interface/open-util/i-overlay-controller/i-overlay-controller.d.ts +52 -0
  16. package/es/interface/open-util/i-overlay-popover-container/i-overlay-popover-container.d.ts +21 -0
  17. package/es/interface/open-util/index.d.ts +3 -1
  18. package/es/modules/mqtt/enums/mqtt-status.enum.d.ts +1 -0
  19. package/es/modules/mqtt/enums/mqtt-status.enum.mjs +2 -1
  20. package/es/modules/mqtt/mqtt-manager.d.ts +1 -1
  21. package/es/modules/mqtt/mqtt-manager.mjs +2 -1
  22. package/es/modules/platform-config/store.mjs +0 -1
  23. package/es/router/index.mjs +1 -1
  24. package/es/setup-app.mjs +3 -1
  25. package/es/utils/index.d.ts +1 -0
  26. package/es/utils/index.mjs +2 -0
  27. package/es/utils/openUtil/index.d.ts +1 -0
  28. package/es/utils/openUtil/index.mjs +1 -0
  29. package/es/utils/openUtil/overlay-popover-container/overlay-popover-container.d.ts +15 -0
  30. package/es/utils/openUtil/overlay-popover-container/overlay-popover-container.mjs +19 -0
  31. package/es/utils/plugin-pkg-util/plugin-pkg-util.d.ts +1 -1
  32. package/es/utils/plugin-pkg-util/plugin-pkg-util.mjs +1 -1
  33. package/es/utils/text-measure/text-measure.d.ts +141 -0
  34. package/es/utils/text-measure/text-measure.mjs +191 -0
  35. package/es/utils/util.d.ts +1 -0
  36. package/es/utils/util.mjs +9 -1
  37. package/package.json +4 -3
  38. package/es/interface/i-import-style-map/i-import-style-map.d.ts +0 -15
@@ -0,0 +1,21 @@
1
+ import { IOverlayContainer } from '../i-overlay-container/i-overlay-container';
2
+ /**
3
+ * 飘窗容器
4
+ *
5
+ * @author chitanda
6
+ * @date 2022-11-09 14:11:39
7
+ * @export
8
+ * @interface IOverlayPopoverContainer
9
+ * @extends {IOverlayContainer}
10
+ */
11
+ export interface IOverlayPopoverContainer extends IOverlayContainer {
12
+ /**
13
+ * 展示飘窗容器
14
+ *
15
+ * @author chitanda
16
+ * @date 2022-11-09 14:11:47
17
+ * @param {HTMLElement} el
18
+ * @return {*} {Promise<void>}
19
+ */
20
+ present(el?: HTMLElement): Promise<void>;
21
+ }
@@ -1,7 +1,9 @@
1
+ export type { IAppFullScreenContainerOptions } from './i-app-full-screen-container-options/i-app-full-screen-container-options';
1
2
  export type { IMessageParams, IMessageUtil, } from './i-message-util/i-message-util';
2
3
  export type { IModal } from './i-modal/i-modal';
3
4
  export type { IModalData } from './i-modal-data/i-modal-data';
4
5
  export type { IModalOptions } from './i-modal-options/i-modal-options';
5
6
  export type { IOpenWindowOptions } from './i-open-window-options/i-open-window-options';
6
7
  export type { IOverlayContainer } from './i-overlay-container/i-overlay-container';
7
- export type { IOverlayController } from './i-overlay-controller/i-overlay-controller';
8
+ export type { FloatingUIConfig, IOverlayController, } from './i-overlay-controller/i-overlay-controller';
9
+ export type { IOverlayPopoverContainer } from './i-overlay-popover-container/i-overlay-popover-container';
@@ -1,3 +1,4 @@
1
+ export declare const DEFAULT_MQTT_INSTANCE_ID = "DEFAULT_MQTT_INSTANCE_ID";
1
2
  /**
2
3
  * MQTT 连接状态枚举
3
4
  *
@@ -1,4 +1,5 @@
1
1
  //#region src/modules/mqtt/enums/mqtt-status.enum.ts
2
+ var DEFAULT_MQTT_INSTANCE_ID = "DEFAULT_MQTT_INSTANCE_ID";
2
3
  /**
3
4
  * MQTT 连接状态枚举
4
5
  *
@@ -21,4 +22,4 @@ var MqttConnectionStatus = /* @__PURE__ */ function(MqttConnectionStatus) {
21
22
  return MqttConnectionStatus;
22
23
  }({});
23
24
  //#endregion
24
- export { MqttConnectionStatus };
25
+ export { DEFAULT_MQTT_INSTANCE_ID, MqttConnectionStatus };
@@ -63,7 +63,7 @@ export declare class MqttManager implements IMqttManager {
63
63
  * @param instanceId 实例唯一标识
64
64
  * @returns 客户端实例,若不存在则返回 undefined
65
65
  */
66
- get(instanceId: string): IMqttClient | undefined;
66
+ get(instanceId?: string): IMqttClient | undefined;
67
67
  /**
68
68
  * 判断指定实例是否已存在
69
69
  *
@@ -1,3 +1,4 @@
1
+ import { DEFAULT_MQTT_INSTANCE_ID } from "./enums/mqtt-status.enum.mjs";
1
2
  import { MqttClient } from "./mqtt-client.mjs";
2
3
  import { createUUID } from "qx-util";
3
4
  //#region src/modules/mqtt/mqtt-manager.ts
@@ -77,7 +78,7 @@ var MqttManager = class {
77
78
  * @param instanceId 实例唯一标识
78
79
  * @returns 客户端实例,若不存在则返回 undefined
79
80
  */
80
- get(instanceId) {
81
+ get(instanceId = DEFAULT_MQTT_INSTANCE_ID) {
81
82
  return this._clients.get(instanceId);
82
83
  }
83
84
  /**
@@ -46,7 +46,6 @@ var usePlatformConfigStore = defineStore("platform-config", () => {
46
46
  if (map[PlatformSettingEnum.THEME]) theme.setThemeSetting(map[PlatformSettingEnum.THEME]);
47
47
  if (map[PlatformSettingEnum.WATERMARK]) watermark.setWatermarkSetting(map[PlatformSettingEnum.WATERMARK]);
48
48
  if (map[PlatformSettingEnum.DEPLOY]) deploy.setDeploySetting(map[PlatformSettingEnum.DEPLOY]);
49
- console.debug("平台配置初始化完成", map);
50
49
  }
51
50
  /**应用前台设置初始化 */
52
51
  async function renderInit() {
@@ -18,7 +18,7 @@ var RouterUtil = class {
18
18
  async add(route) {
19
19
  if (Array.isArray(route)) route.forEach((r) => this.router.addRoute(r));
20
20
  else this.router.addRoute(route);
21
- if (!this.router.hasRoute(this.router.currentRoute.value.name)) await this.router.replace(this.router.currentRoute.value.fullPath);
21
+ if (this.router.currentRoute.value.name && !this.router.hasRoute(this.router.currentRoute.value.name)) await this.router.replace(this.router.currentRoute.value.fullPath);
22
22
  }
23
23
  /**刷新当前路由 */
24
24
  async redo() {
package/es/setup-app.mjs CHANGED
@@ -20,7 +20,9 @@ async function setupApp(_app) {
20
20
  const token = getToken();
21
21
  if (token) try {
22
22
  await useUserStore().getUserInfoAction(token);
23
- } catch {}
23
+ } catch (error) {
24
+ console.error("获取用户信息失败", error);
25
+ }
24
26
  }
25
27
  //#endregion
26
28
  export { setupApp };
@@ -29,5 +29,6 @@ export * from './file/download';
29
29
  export * from './file/base64Conver';
30
30
  export * from './file/parser';
31
31
  export * from './design/design';
32
+ export * from './text-measure/text-measure';
32
33
  export { permission } from './permission';
33
34
  export { getVueComponentByCode } from './vue-component-code';
@@ -11,6 +11,7 @@ import "./model-loader/model-loader.mjs";
11
11
  import "./namespace/namespace.mjs";
12
12
  import "./openUtil/modal/modal.mjs";
13
13
  import "./openUtil/overlay-container/overlay-container.mjs";
14
+ import "./openUtil/overlay-popover-container/overlay-popover-container.mjs";
14
15
  import "./openUtil/index.mjs";
15
16
  import "./kit-pkg-util/kit-pkg-util.mjs";
16
17
  import "./plugin-pkg-util/plugin-pkg-util.mjs";
@@ -31,5 +32,6 @@ import "./file/base64Conver.mjs";
31
32
  import "./file/download.mjs";
32
33
  import "./file/parser.mjs";
33
34
  import "./design/design.mjs";
35
+ import "./text-measure/text-measure.mjs";
34
36
  import "./permission.mjs";
35
37
  import "./vue-component-code.mjs";
@@ -1,2 +1,3 @@
1
1
  export { Modal } from './modal/modal';
2
2
  export { OverlayContainer } from './overlay-container/overlay-container';
3
+ export { OverlayPopoverContainer } from './overlay-popover-container/overlay-popover-container';
@@ -1,2 +1,3 @@
1
1
  import "./modal/modal.mjs";
2
2
  import "./overlay-container/overlay-container.mjs";
3
+ import "./overlay-popover-container/overlay-popover-container.mjs";
@@ -0,0 +1,15 @@
1
+ import { IOverlayPopoverContainer, IPopoverOptions } from '../../../interface';
2
+ import { OverlayContainer } from '../overlay-container/overlay-container';
3
+ /**
4
+ * 飘窗组件呈现容器
5
+ *
6
+ * @author zhanghanrui
7
+ * @date 2024-04-08 09:04:42
8
+ * @export
9
+ * @class OverlayPopoverContainer
10
+ * @extends {OverlayContainer<IPopoverOptions>}
11
+ * @implements {IOverlayPopoverContainer}
12
+ */
13
+ export declare class OverlayPopoverContainer extends OverlayContainer<IPopoverOptions> implements IOverlayPopoverContainer {
14
+ present(): Promise<void>;
15
+ }
@@ -0,0 +1,19 @@
1
+ import { OverlayContainer } from "../overlay-container/overlay-container.mjs";
2
+ //#region src/utils/openUtil/overlay-popover-container/overlay-popover-container.ts
3
+ /**
4
+ * 飘窗组件呈现容器
5
+ *
6
+ * @author zhanghanrui
7
+ * @date 2024-04-08 09:04:42
8
+ * @export
9
+ * @class OverlayPopoverContainer
10
+ * @extends {OverlayContainer<IPopoverOptions>}
11
+ * @implements {IOverlayPopoverContainer}
12
+ */
13
+ var OverlayPopoverContainer = class extends OverlayContainer {
14
+ present(target) {
15
+ return this.modal.present(target);
16
+ }
17
+ };
18
+ //#endregion
19
+ export { OverlayPopoverContainer };
@@ -47,7 +47,7 @@ export declare class PluginPgkUtil {
47
47
  * @protected
48
48
  * @static
49
49
  * @param {IStyleIMportMap[]} plugins
50
- * @returns {*} {Promise<System.Module[]>}
50
+ * @returns {*} {Promise<IObject[]>}
51
51
  */
52
52
  protected static loadPlugins(mode: PluginModeEnum, configs?: PluginTenant['plugins']): Promise<IModuleMap>;
53
53
  /**
@@ -60,7 +60,7 @@ var PluginPgkUtil = class {
60
60
  * @protected
61
61
  * @static
62
62
  * @param {IStyleIMportMap[]} plugins
63
- * @returns {*} {Promise<System.Module[]>}
63
+ * @returns {*} {Promise<IObject[]>}
64
64
  */
65
65
  static async loadPlugins(mode, configs = []) {
66
66
  const moduleMap = {};
@@ -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 };
@@ -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 };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gct-paas/core",
3
- "version": "0.1.5-dev.5",
3
+ "version": "0.1.5-dev.7",
4
4
  "type": "module",
5
5
  "description": "paas 平台核心包",
6
6
  "loader": "dist/index.esm.min.js",
@@ -32,7 +32,8 @@
32
32
  "author": "gct",
33
33
  "dependencies": {
34
34
  "@fingerprintjs/fingerprintjs": "^5.1.0",
35
- "@gct-paas/api": "0.1.4-dev.0",
35
+ "@floating-ui/dom": "^1.7.6",
36
+ "@gct-paas/api": "0.1.4-dev.1",
36
37
  "@module-federation/runtime": "^2.2.3",
37
38
  "@vueuse/core": "^14.1.0",
38
39
  "async-validator": "^4.2.5",
@@ -57,7 +58,7 @@
57
58
  "playwright": "^1.58.0"
58
59
  },
59
60
  "peerDependencies": {
60
- "@gct-paas/api": "0.1.4-dev.0",
61
+ "@gct-paas/api": "0.1.4-dev.1",
61
62
  "vue": ">=3",
62
63
  "vue-i18n": ">=11",
63
64
  "vue-router": ">=4"
@@ -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
- }