star-horse-lowcode 3.1.12 → 3.1.14
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/README.md +11 -0
- package/dist/assets/index.css +1 -1
- package/dist/components/comp/StarHorseDialog.vue.d.ts +31 -9
- package/dist/components/comp/StarHorseFormList.vue.d.ts +9 -0
- package/dist/components/comp/StarHorseFormTable.vue.d.ts +9 -0
- package/dist/components/comp/StarHorseStaticTable.vue.d.ts +1 -1
- package/dist/components/comp/items/tableItem.vue.d.ts +22 -0
- package/dist/components/formcomp/utils/EditDataDialog.vue.d.ts +1 -1
- package/dist/components/formcomp/utils/FormulaEngine.d.ts +8 -85
- package/dist/components/system/PageConfig.vue.d.ts +1 -1
- package/dist/components/system/code-editor/types.d.ts +40 -0
- package/dist/components/system/code-editor/useEditorGroups.d.ts +50 -0
- package/dist/components/types/ItemPreps.d.ts +4 -0
- package/dist/index.es.js +6 -6
- package/dist/lang/en_US.d.ts +17 -0
- package/dist/lang/zh_CN.d.ts +17 -0
- package/dist/store/ButtonPermission.d.ts +2 -20
- package/dist/store/ConsumerView.d.ts +2 -16
- package/dist/store/CopyerOperation.d.ts +2 -22
- package/dist/store/DesignForm.d.ts +3 -1155
- package/dist/store/DesignPage.d.ts +2 -100
- package/dist/store/DynamicForm.d.ts +2 -36
- package/dist/store/FormDataCache.d.ts +2 -3258
- package/dist/store/GlobalConfig.d.ts +2 -10
- package/dist/store/SelfOperation.d.ts +2 -472
- package/dist/store/StoreManager.d.ts +24 -24
- package/dist/store/UserInfo.d.ts +2 -30
- package/dist/types/components/comp/StarHorseDialog.vue.d.ts +31 -9
- package/dist/types/components/comp/StarHorseFormList.vue.d.ts +9 -0
- package/dist/types/components/comp/StarHorseFormTable.vue.d.ts +9 -0
- package/dist/types/components/comp/StarHorseStaticTable.vue.d.ts +1 -1
- package/dist/types/components/comp/items/tabPanelItem.vue.d.ts +10 -1
- package/dist/types/components/formcomp/utils/EditDataDialog.vue.d.ts +1 -1
- package/dist/types/components/formcomp/utils/FormulaEngine.d.ts +8 -85
- package/dist/types/components/system/PageConfig.vue.d.ts +1 -1
- package/dist/types/components/system/StarHorseCodeEditor.vue.d.ts +47 -1
- package/dist/types/components/system/code-editor/EditorPane.vue.d.ts +21 -0
- package/dist/types/components/system/code-editor/SplitView.vue.d.ts +35 -0
- package/dist/types/components/system/code-editor/types.d.ts +40 -0
- package/dist/types/components/system/code-editor/useEditorGroups.d.ts +50 -0
- package/dist/types/components/types/ItemPreps.d.ts +4 -0
- package/dist/types/index.d.ts +0 -1
- package/dist/types/lang/en_US.d.ts +17 -0
- package/dist/types/lang/zh_CN.d.ts +17 -0
- package/dist/types/store/ButtonPermission.d.ts +2 -20
- package/dist/types/store/ConsumerView.d.ts +2 -16
- package/dist/types/store/CopyerOperation.d.ts +2 -22
- package/dist/types/store/DesignForm.d.ts +3 -1155
- package/dist/types/store/DesignPage.d.ts +2 -100
- package/dist/types/store/DynamicForm.d.ts +2 -36
- package/dist/types/store/FormDataCache.d.ts +2 -3258
- package/dist/types/store/GlobalConfig.d.ts +2 -10
- package/dist/types/store/SelfOperation.d.ts +2 -472
- package/dist/types/store/StoreManager.d.ts +24 -24
- package/dist/types/store/UserInfo.d.ts +2 -30
- package/package.json +15 -14
- package/dist/api/pcas-code.json.d.ts +0 -185519
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import { PropType } from 'vue';
|
|
2
|
-
import { DialogProps } from '../types/DialogProps';
|
|
3
1
|
import { UserFuncInfo } from '../types/PageFieldInfo';
|
|
4
2
|
declare var __VLS_64: {}, __VLS_66: {}, __VLS_69: {}, __VLS_149: {};
|
|
5
3
|
type __VLS_Slots = {} & {
|
|
@@ -16,9 +14,9 @@ declare const __VLS_base: import('vue').DefineComponent<import('vue').ExtractPro
|
|
|
16
14
|
type: BooleanConstructor;
|
|
17
15
|
default: boolean;
|
|
18
16
|
};
|
|
19
|
-
|
|
20
|
-
type:
|
|
21
|
-
default:
|
|
17
|
+
modelValue: {
|
|
18
|
+
type: BooleanConstructor;
|
|
19
|
+
default: boolean;
|
|
22
20
|
};
|
|
23
21
|
isShowReset: {
|
|
24
22
|
type: BooleanConstructor;
|
|
@@ -104,6 +102,15 @@ declare const __VLS_base: import('vue').DefineComponent<import('vue').ExtractPro
|
|
|
104
102
|
type: StringConstructor;
|
|
105
103
|
default: string;
|
|
106
104
|
};
|
|
105
|
+
/** 手动指定 z-index;0 表示打开时自动计算(取当前页面最高弹层 +1) */
|
|
106
|
+
zIndex: {
|
|
107
|
+
type: NumberConstructor;
|
|
108
|
+
default: number;
|
|
109
|
+
};
|
|
110
|
+
appendTo: {
|
|
111
|
+
type: StringConstructor;
|
|
112
|
+
default: string;
|
|
113
|
+
};
|
|
107
114
|
}>, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
|
|
108
115
|
merge: (...args: any[]) => void;
|
|
109
116
|
resetForm: (...args: any[]) => void;
|
|
@@ -111,14 +118,16 @@ declare const __VLS_base: import('vue').DefineComponent<import('vue').ExtractPro
|
|
|
111
118
|
open: (...args: any[]) => void;
|
|
112
119
|
closeAction: (...args: any[]) => void;
|
|
113
120
|
minimize: (...args: any[]) => void;
|
|
121
|
+
"update:dialogVisible": (...args: any[]) => void;
|
|
122
|
+
"update:modelValue": (...args: any[]) => void;
|
|
114
123
|
}, string, import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<{
|
|
115
124
|
dialogVisible: {
|
|
116
125
|
type: BooleanConstructor;
|
|
117
126
|
default: boolean;
|
|
118
127
|
};
|
|
119
|
-
|
|
120
|
-
type:
|
|
121
|
-
default:
|
|
128
|
+
modelValue: {
|
|
129
|
+
type: BooleanConstructor;
|
|
130
|
+
default: boolean;
|
|
122
131
|
};
|
|
123
132
|
isShowReset: {
|
|
124
133
|
type: BooleanConstructor;
|
|
@@ -204,6 +213,15 @@ declare const __VLS_base: import('vue').DefineComponent<import('vue').ExtractPro
|
|
|
204
213
|
type: StringConstructor;
|
|
205
214
|
default: string;
|
|
206
215
|
};
|
|
216
|
+
/** 手动指定 z-index;0 表示打开时自动计算(取当前页面最高弹层 +1) */
|
|
217
|
+
zIndex: {
|
|
218
|
+
type: NumberConstructor;
|
|
219
|
+
default: number;
|
|
220
|
+
};
|
|
221
|
+
appendTo: {
|
|
222
|
+
type: StringConstructor;
|
|
223
|
+
default: string;
|
|
224
|
+
};
|
|
207
225
|
}>> & Readonly<{
|
|
208
226
|
onMerge?: (...args: any[]) => any;
|
|
209
227
|
onResetForm?: (...args: any[]) => any;
|
|
@@ -211,12 +229,15 @@ declare const __VLS_base: import('vue').DefineComponent<import('vue').ExtractPro
|
|
|
211
229
|
onOpen?: (...args: any[]) => any;
|
|
212
230
|
onCloseAction?: (...args: any[]) => any;
|
|
213
231
|
onMinimize?: (...args: any[]) => any;
|
|
232
|
+
"onUpdate:dialogVisible"?: (...args: any[]) => any;
|
|
233
|
+
"onUpdate:modelValue"?: (...args: any[]) => any;
|
|
214
234
|
}>, {
|
|
215
235
|
source: number;
|
|
216
236
|
title: string;
|
|
237
|
+
zIndex: number;
|
|
217
238
|
selfFunc: boolean;
|
|
218
|
-
dialogProps: DialogProps;
|
|
219
239
|
dialogVisible: boolean;
|
|
240
|
+
modelValue: boolean;
|
|
220
241
|
isShowReset: boolean;
|
|
221
242
|
isShowSave: boolean;
|
|
222
243
|
isShowBtnContinue: boolean;
|
|
@@ -231,6 +252,7 @@ declare const __VLS_base: import('vue').DefineComponent<import('vue').ExtractPro
|
|
|
231
252
|
userBtn: UserFuncInfo[];
|
|
232
253
|
btnTextContinue: string;
|
|
233
254
|
compSize: string;
|
|
255
|
+
appendTo: string;
|
|
234
256
|
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
|
|
235
257
|
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
236
258
|
declare const _default: typeof __VLS_export;
|
|
@@ -62,6 +62,10 @@ declare const __VLS_export: import('vue').DefineComponent<import('vue').ExtractP
|
|
|
62
62
|
type: BooleanConstructor;
|
|
63
63
|
default: boolean;
|
|
64
64
|
};
|
|
65
|
+
enableSubNode: {
|
|
66
|
+
type: BooleanConstructor;
|
|
67
|
+
default: boolean;
|
|
68
|
+
};
|
|
65
69
|
commonFormat: {
|
|
66
70
|
type: FunctionConstructor;
|
|
67
71
|
default: () => void;
|
|
@@ -132,6 +136,10 @@ declare const __VLS_export: import('vue').DefineComponent<import('vue').ExtractP
|
|
|
132
136
|
type: BooleanConstructor;
|
|
133
137
|
default: boolean;
|
|
134
138
|
};
|
|
139
|
+
enableSubNode: {
|
|
140
|
+
type: BooleanConstructor;
|
|
141
|
+
default: boolean;
|
|
142
|
+
};
|
|
135
143
|
commonFormat: {
|
|
136
144
|
type: FunctionConstructor;
|
|
137
145
|
default: () => void;
|
|
@@ -150,6 +158,7 @@ declare const __VLS_export: import('vue').DefineComponent<import('vue').ExtractP
|
|
|
150
158
|
initRows: number;
|
|
151
159
|
defaultValues: Record<string, any>;
|
|
152
160
|
staticColumn: string;
|
|
161
|
+
enableSubNode: boolean;
|
|
153
162
|
commonFormat: Function;
|
|
154
163
|
showCheckBox: boolean;
|
|
155
164
|
selectAll: boolean;
|
|
@@ -19,6 +19,10 @@ declare const __VLS_export: import('vue').DefineComponent<import('vue').ExtractP
|
|
|
19
19
|
type: NumberConstructor;
|
|
20
20
|
default: number;
|
|
21
21
|
};
|
|
22
|
+
enableSubNode: {
|
|
23
|
+
type: BooleanConstructor;
|
|
24
|
+
default: boolean;
|
|
25
|
+
};
|
|
22
26
|
commonFormat: {
|
|
23
27
|
type: FunctionConstructor;
|
|
24
28
|
default: () => void;
|
|
@@ -48,6 +52,10 @@ declare const __VLS_export: import('vue').DefineComponent<import('vue').ExtractP
|
|
|
48
52
|
type: NumberConstructor;
|
|
49
53
|
default: number;
|
|
50
54
|
};
|
|
55
|
+
enableSubNode: {
|
|
56
|
+
type: BooleanConstructor;
|
|
57
|
+
default: boolean;
|
|
58
|
+
};
|
|
51
59
|
commonFormat: {
|
|
52
60
|
type: FunctionConstructor;
|
|
53
61
|
default: () => void;
|
|
@@ -61,6 +69,7 @@ declare const __VLS_export: import('vue').DefineComponent<import('vue').ExtractP
|
|
|
61
69
|
source: number;
|
|
62
70
|
size: string;
|
|
63
71
|
initRows: number;
|
|
72
|
+
enableSubNode: boolean;
|
|
64
73
|
commonFormat: Function;
|
|
65
74
|
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
|
|
66
75
|
declare const _default: typeof __VLS_export;
|
|
@@ -92,8 +92,8 @@ declare const __VLS_export: import('vue').DefineComponent<import('vue').ExtractP
|
|
|
92
92
|
height: string;
|
|
93
93
|
dataFormat: Function;
|
|
94
94
|
compSize: string;
|
|
95
|
-
dialogInput: boolean;
|
|
96
95
|
expand: boolean;
|
|
96
|
+
dialogInput: boolean;
|
|
97
97
|
showBatchField: boolean;
|
|
98
98
|
allowSelectParent: boolean;
|
|
99
99
|
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { ContainerPreps } from '../../types/ItemPreps';
|
|
2
|
+
type __VLS_Props = ContainerPreps;
|
|
3
|
+
type __VLS_ModelProps = {
|
|
4
|
+
"dataForm"?: any;
|
|
5
|
+
};
|
|
6
|
+
type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
|
|
7
|
+
declare const __VLS_export: import('vue').DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
|
|
8
|
+
"update:dataForm": (value: any) => any;
|
|
9
|
+
}, string, import('vue').PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
|
|
10
|
+
"onUpdate:dataForm"?: (value: any) => any;
|
|
11
|
+
}>, {
|
|
12
|
+
source: number;
|
|
13
|
+
batchName: string;
|
|
14
|
+
subFormFlag: string;
|
|
15
|
+
dataIndex: number;
|
|
16
|
+
compSize: string;
|
|
17
|
+
propPrefix: string;
|
|
18
|
+
parentPreps: any;
|
|
19
|
+
batchFieldName: string;
|
|
20
|
+
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
|
|
21
|
+
declare const _default: typeof __VLS_export;
|
|
22
|
+
export default _default;
|
|
@@ -47,8 +47,8 @@ declare const __VLS_export: import('vue').DefineComponent<import('vue').ExtractP
|
|
|
47
47
|
}>, {
|
|
48
48
|
title: string;
|
|
49
49
|
disabled: boolean;
|
|
50
|
-
boxWidth: string;
|
|
51
50
|
modelValue: boolean;
|
|
51
|
+
boxWidth: string;
|
|
52
52
|
showFormItem: boolean;
|
|
53
53
|
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
|
|
54
54
|
declare const _default: typeof __VLS_export;
|
|
@@ -1,129 +1,52 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* 公式计算引擎
|
|
2
|
+
* 公式计算引擎 (Hardened Version)
|
|
3
3
|
*
|
|
4
4
|
* 统一字段引用语法:${fieldName}
|
|
5
|
-
* 支持 8 种公式类型:
|
|
6
|
-
* - calc: 数学运算 expression = '${price} * ${quantity}'
|
|
7
|
-
* - concat: 字符串拼接 expression = '${lastName}${firstName}'
|
|
8
|
-
* - condition: 多分支条件判断 branches = [{ when, then }]
|
|
9
|
-
* - lookup: 联动回填 lookupMappings = [{ key, values }]
|
|
10
|
-
* - aggregate: 聚合运算 expression = 'sum' / 'avg' / 'count' / 'min' / 'max'
|
|
11
|
-
* - dateCalc: 日期计算 expression = '${start} ~ ${end}', dateUnit = 'day'
|
|
12
|
-
* - format: 格式化 expression = 'thousands' / 'padStart' / 'toFixed' / 'regex'
|
|
13
|
-
* - ternary: 三元表达式 expression = '${score} >= 60 ? ${score} : 0'
|
|
5
|
+
* 支持 8 种公式类型:calc, concat, condition, lookup, aggregate, dateCalc, format, ternary
|
|
14
6
|
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
* type: 'calc',
|
|
22
|
-
* sourceFields: ['price', 'quantity'],
|
|
23
|
-
* expression: '${price} * ${quantity}',
|
|
24
|
-
* precision: 2,
|
|
25
|
-
* suffix: '元',
|
|
26
|
-
* }
|
|
27
|
-
* }
|
|
28
|
-
* }
|
|
7
|
+
* 核心安全与兼容性保障:
|
|
8
|
+
* 1. 表达式求值与条件判断分离,杜绝代码注入与类型丢失
|
|
9
|
+
* 2. 字符串拼接独立实现,避免空值被当作字面量文本
|
|
10
|
+
* 3. 跨浏览器健壮的日期解析,兼容 Safari 及非标准格式
|
|
11
|
+
* 4. 三元表达式交由原生引擎解析,完美支持嵌套
|
|
12
|
+
* 5. 聚合与正则格式化增加完整的边界防护
|
|
29
13
|
*/
|
|
30
|
-
/** 公式类型 */
|
|
31
14
|
export type FormulaType = "calc" | "concat" | "condition" | "lookup" | "aggregate" | "dateCalc" | "format" | "ternary";
|
|
32
|
-
/** 条件分支配置 */
|
|
33
15
|
export interface ConditionBranch {
|
|
34
|
-
/** 匹配表达式,如 '${score} >= 90' */
|
|
35
16
|
when: string;
|
|
36
|
-
/** 匹配时返回的值,支持常量或 ${fieldName} 引用 */
|
|
37
17
|
then: any;
|
|
38
18
|
}
|
|
39
|
-
/** 联动回填映射配置 */
|
|
40
19
|
export interface LookupMapping {
|
|
41
|
-
/** 匹配的源字段值 */
|
|
42
20
|
key: string;
|
|
43
|
-
/** 回填目标字段名 -> 回填值的映射 */
|
|
44
21
|
values: Record<string, any>;
|
|
45
22
|
}
|
|
46
|
-
/** 公式配置 */
|
|
47
23
|
export interface FormulaConfig {
|
|
48
|
-
/** 是否启用 */
|
|
49
24
|
enable: boolean;
|
|
50
|
-
/** 公式类型 */
|
|
51
25
|
type: FormulaType;
|
|
52
|
-
/** 依赖字段列表 */
|
|
53
26
|
sourceFields: string[];
|
|
54
|
-
/** 公式表达式,统一使用 ${fieldName} 引用字段 */
|
|
55
27
|
expression?: string;
|
|
56
|
-
/** 条件分支(type=condition 时使用) */
|
|
57
28
|
branches?: ConditionBranch[];
|
|
58
|
-
/** 联动回填映射(type=lookup 时使用) */
|
|
59
29
|
lookupMappings?: LookupMapping[];
|
|
60
|
-
/** 精度,type=calc/format(toFixed) 时使用 */
|
|
61
30
|
precision?: number;
|
|
62
|
-
/** 前缀,type=calc 时使用,如 '¥' */
|
|
63
31
|
prefix?: string;
|
|
64
|
-
/** 后缀,type=calc 时使用,如 '%'、'元' */
|
|
65
32
|
suffix?: string;
|
|
66
|
-
/** 日期单位,type=dateCalc 时使用:'year'|'month'|'day'|'hour'|'minute'|'second' */
|
|
67
33
|
dateUnit?: "year" | "month" | "day" | "hour" | "minute" | "second";
|
|
68
|
-
/** 日期偏移量,type=dateCalc 且 mode=offset 时使用,正数向后,负数向前 */
|
|
69
34
|
dateOffset?: number;
|
|
70
|
-
/** 日期计算模式:diff(差值) | offset(偏移) | format(格式化) */
|
|
71
35
|
dateMode?: "diff" | "offset" | "format";
|
|
72
|
-
/** 日期输出格式,type=dateCalc 且 mode=format 时使用,如 'YYYY-MM-DD' */
|
|
73
36
|
dateFormat?: string;
|
|
74
|
-
/** 格式化子类型,type=format 时使用 */
|
|
75
37
|
formatType?: "thousands" | "padStart" | "toFixed" | "regex";
|
|
76
|
-
/** 格式化参数:padStart 的目标长度 / regex 的替换模式 */
|
|
77
38
|
formatArg?: string | number;
|
|
78
|
-
/** 格式化参数2:padStart 的填充字符 / regex 的替换值 */
|
|
79
39
|
formatArg2?: string;
|
|
80
|
-
/** 聚合子字段,type=aggregate 时使用,指定子表单中要聚合的字段名 */
|
|
81
40
|
aggregateField?: string;
|
|
82
|
-
/** 条件不匹配时的默认值,type=condition/ternary 时使用 */
|
|
83
41
|
defaultValue?: any;
|
|
84
42
|
}
|
|
85
|
-
/** 字段定义(最小集) */
|
|
86
43
|
export interface FormulaField {
|
|
87
44
|
fieldName: string;
|
|
88
45
|
type?: string;
|
|
89
46
|
formula?: FormulaConfig;
|
|
90
47
|
preps?: Record<string, any>;
|
|
91
48
|
}
|
|
92
|
-
/**
|
|
93
|
-
* 执行公式计算,返回计算结果
|
|
94
|
-
* @param formula 公式配置
|
|
95
|
-
* @param formData 表单数据
|
|
96
|
-
* @returns 计算结果
|
|
97
|
-
*/
|
|
98
49
|
export declare const executeFormula: (formula: FormulaConfig, formData: Record<string, any>) => any;
|
|
99
|
-
/**
|
|
100
|
-
* 执行公式并回填表单数据
|
|
101
|
-
* - lookup: 回填多个目标字段
|
|
102
|
-
* - 其他类型: 结果赋值给当前字段
|
|
103
|
-
*
|
|
104
|
-
* @param field 当前字段
|
|
105
|
-
* @param formInfo 所有字段列表
|
|
106
|
-
* @param formData 表单数据(会被直接修改)
|
|
107
|
-
*/
|
|
108
50
|
export declare const executeFormulaWithFill: (field: FormulaField, formInfo: FormulaField[], formData: Record<string, any>) => void;
|
|
109
|
-
/**
|
|
110
|
-
* 构建字段级别的 watch 监听器
|
|
111
|
-
* 当依赖字段变化时,自动触发公式计算并回填
|
|
112
|
-
*
|
|
113
|
-
* @param field 当前字段
|
|
114
|
-
* @param formInfo 所有字段列表
|
|
115
|
-
* @param formData 响应式表单数据
|
|
116
|
-
* @param watchFn Vue watch 函数
|
|
117
|
-
* @returns stop 函数数组,用于在 onBeforeUnmount 中清理
|
|
118
|
-
*/
|
|
119
51
|
export declare const setupFormulaWatchers: (field: FormulaField, formInfo: FormulaField[], formData: any, watchFn: typeof import('vue').watch) => (() => void)[];
|
|
120
|
-
/**
|
|
121
|
-
* 批量初始化表单中所有带 formula 配置的字段
|
|
122
|
-
* 适合在表单容器组件 onMounted 时调用
|
|
123
|
-
*
|
|
124
|
-
* @param formInfo 所有字段列表
|
|
125
|
-
* @param formData 响应式表单数据
|
|
126
|
-
* @param watchFn Vue watch 函数
|
|
127
|
-
* @returns stop 函数数组,用于在 onBeforeUnmount 中清理
|
|
128
|
-
*/
|
|
129
52
|
export declare const initFormFormulaWatchers: (formInfo: FormulaField[], formData: any, watchFn: typeof import('vue').watch) => (() => void)[];
|
|
@@ -51,8 +51,8 @@ declare const __VLS_base: import('vue').DefineComponent<__VLS_Props, {
|
|
|
51
51
|
}>, {
|
|
52
52
|
title: string;
|
|
53
53
|
direction: string;
|
|
54
|
-
compSize: string;
|
|
55
54
|
modelValue: boolean;
|
|
55
|
+
compSize: string;
|
|
56
56
|
hideDefaultConfig: boolean;
|
|
57
57
|
resizable: boolean;
|
|
58
58
|
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
|
|
@@ -16,6 +16,10 @@ export interface TabInfo {
|
|
|
16
16
|
modified: boolean;
|
|
17
17
|
/** 父目录路径,用于区分不同目录下的同名文件 */
|
|
18
18
|
path?: string;
|
|
19
|
+
/** 原始内容(用于 diff 对比) */
|
|
20
|
+
originalContent?: string;
|
|
21
|
+
/** 服务器版本内容(用于冲突解决) */
|
|
22
|
+
serverContent?: string;
|
|
19
23
|
}
|
|
20
24
|
/** 菜单项定义 */
|
|
21
25
|
export interface MenuItemDef {
|
|
@@ -37,3 +41,39 @@ export interface ThemeContext {
|
|
|
37
41
|
currentTheme: string;
|
|
38
42
|
switchTheme: (theme: string) => void;
|
|
39
43
|
}
|
|
44
|
+
/** 编辑器组(一个分屏面板的标签页集合) */
|
|
45
|
+
export interface EditorGroup {
|
|
46
|
+
/** 组唯一ID */
|
|
47
|
+
id: string;
|
|
48
|
+
/** 组内的标签页列表 */
|
|
49
|
+
tabs: TabInfo[];
|
|
50
|
+
/** 组内当前激活的标签页ID */
|
|
51
|
+
activeTabId: string;
|
|
52
|
+
}
|
|
53
|
+
/** 分屏方向:horizontal=左右分屏,vertical=上下分屏 */
|
|
54
|
+
export type SplitDirection = "horizontal" | "vertical";
|
|
55
|
+
/** 分屏侧:相对于源组,新组放置在哪个方向 */
|
|
56
|
+
export type SplitSide = "left" | "right" | "up" | "down";
|
|
57
|
+
/** 分屏树节点(递归结构,支持任意嵌套分屏) */
|
|
58
|
+
export interface SplitNode {
|
|
59
|
+
/** 节点唯一ID */
|
|
60
|
+
id: string;
|
|
61
|
+
/** 叶子节点:所属编辑器组ID */
|
|
62
|
+
groupId?: string;
|
|
63
|
+
/** 容器节点:子节点的排列方向 */
|
|
64
|
+
direction?: SplitDirection;
|
|
65
|
+
/** 容器节点:两个子节点(左/上 与 右/下) */
|
|
66
|
+
children?: [SplitNode, SplitNode];
|
|
67
|
+
/** 在父容器中所占比例 (0-1),仅第一个子节点使用 */
|
|
68
|
+
size?: number;
|
|
69
|
+
}
|
|
70
|
+
/** Tab 拖拽时放置区域 */
|
|
71
|
+
export type DropZone = "center" | "left" | "right" | "top" | "bottom";
|
|
72
|
+
/** Tab 拖拽数据载荷 */
|
|
73
|
+
export interface TabDragPayload {
|
|
74
|
+
type: "tab";
|
|
75
|
+
/** 源组ID */
|
|
76
|
+
fromGroupId: string;
|
|
77
|
+
/** 拖拽的标签页ID */
|
|
78
|
+
tabId: string;
|
|
79
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { DropZone, EditorGroup, FileNode, SplitSide, SplitNode, TabInfo } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* 编辑器分组管理:维护分屏树(SplitNode)与组列表(EditorGroup)。
|
|
4
|
+
* 一个组对应一个 Monaco 编辑器实例,组之间通过共享 fileId 实现模型复用。
|
|
5
|
+
*/
|
|
6
|
+
export declare function useEditorGroups(opts?: {
|
|
7
|
+
/** 由父级提供的:根据 id 获取文件节点 */
|
|
8
|
+
findNode?: (id: string) => FileNode | undefined;
|
|
9
|
+
/** 由父级提供的:获取父目录路径 */
|
|
10
|
+
getParentPath?: (id: string) => string;
|
|
11
|
+
}): {
|
|
12
|
+
splitRoot: import('vue').Ref<{
|
|
13
|
+
id: string;
|
|
14
|
+
groupId?: string;
|
|
15
|
+
direction?: import('./types').SplitDirection;
|
|
16
|
+
children?: [/*elided*/ any, /*elided*/ any];
|
|
17
|
+
size?: number;
|
|
18
|
+
}, SplitNode | {
|
|
19
|
+
id: string;
|
|
20
|
+
groupId?: string;
|
|
21
|
+
direction?: import('./types').SplitDirection;
|
|
22
|
+
children?: [/*elided*/ any, /*elided*/ any];
|
|
23
|
+
size?: number;
|
|
24
|
+
}>;
|
|
25
|
+
groups: import('vue').Ref<Record<string, EditorGroup>, Record<string, EditorGroup>>;
|
|
26
|
+
activeGroupId: import('vue').Ref<string, string>;
|
|
27
|
+
activeTabId: import('vue').Ref<string, string>;
|
|
28
|
+
activeGroup: import('vue').ComputedRef<EditorGroup>;
|
|
29
|
+
allGroups: import('vue').ComputedRef<string[]>;
|
|
30
|
+
getGroup: (gid: string) => EditorGroup;
|
|
31
|
+
findNode: (id: string) => FileNode;
|
|
32
|
+
openFile: (file: FileNode) => void;
|
|
33
|
+
openFileInGroup: (gid: string, file: FileNode) => void;
|
|
34
|
+
closeTabInGroup: (gid: string, tabId: string) => void;
|
|
35
|
+
closeOthersInGroup: (gid: string, keepTabId: string) => void;
|
|
36
|
+
switchTabInGroup: (gid: string, tabId: string) => void;
|
|
37
|
+
setActiveGroup: (gid: string) => void;
|
|
38
|
+
setTabModified: (gid: string, tabId: string, modified: boolean) => void;
|
|
39
|
+
refreshAllTabPaths: () => void;
|
|
40
|
+
renameTab: (tabId: string, newName: string, language?: string) => void;
|
|
41
|
+
getAllOpenTabs: () => TabInfo[];
|
|
42
|
+
closeTabsByFileId: (fileId: string) => void;
|
|
43
|
+
splitGroup: (fromGid: string, side: SplitSide, copyTabId?: string) => string;
|
|
44
|
+
moveTab: (fromGid: string, tabId: string, toGid: string, toIndex?: number) => void;
|
|
45
|
+
canCloseGroup: (gid: string) => boolean;
|
|
46
|
+
closeGroup: (gid: string) => boolean;
|
|
47
|
+
handleDrop: (fromGid: string, tabId: string, toGid: string, zone: DropZone) => boolean;
|
|
48
|
+
getAdjacentGroup: (gid: string, dir: "next" | "prev") => string;
|
|
49
|
+
reset: () => void;
|
|
50
|
+
};
|