@sec-fe/v-grid-layout 0.0.2
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 +232 -0
- package/lib/index.css +1 -0
- package/lib/index.d.ts +433 -0
- package/lib/v-grid-layout.js +5240 -0
- package/package.json +77 -0
package/lib/index.d.ts
ADDED
|
@@ -0,0 +1,433 @@
|
|
|
1
|
+
import { ComponentOptionsMixin } from 'vue';
|
|
2
|
+
import { ComponentProvideOptions } from 'vue';
|
|
3
|
+
import { ComputedRef } from 'vue';
|
|
4
|
+
import { DefineComponent } from 'vue';
|
|
5
|
+
import { Plugin as Plugin_2 } from 'vue';
|
|
6
|
+
import { PublicProps } from 'vue';
|
|
7
|
+
import { Ref } from 'vue';
|
|
8
|
+
|
|
9
|
+
declare const __VLS_component: DefineComponent<__VLS_Props, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {
|
|
10
|
+
save: (...args: any[]) => void;
|
|
11
|
+
"go-back": (...args: any[]) => void;
|
|
12
|
+
init: (...args: any[]) => void;
|
|
13
|
+
}, string, PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
14
|
+
onSave?: ((...args: any[]) => any) | undefined;
|
|
15
|
+
"onGo-back"?: ((...args: any[]) => any) | undefined;
|
|
16
|
+
onInit?: ((...args: any[]) => any) | undefined;
|
|
17
|
+
}>, {
|
|
18
|
+
data: string;
|
|
19
|
+
showTab: boolean;
|
|
20
|
+
}, {}, {}, {}, string, ComponentProvideOptions, false, {}, any>;
|
|
21
|
+
|
|
22
|
+
declare const __VLS_component_2: DefineComponent<__VLS_Props_2, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {
|
|
23
|
+
mounted: (...args: any[]) => void;
|
|
24
|
+
}, string, PublicProps, Readonly<__VLS_Props_2> & Readonly<{
|
|
25
|
+
onMounted?: ((...args: any[]) => any) | undefined;
|
|
26
|
+
}>, {
|
|
27
|
+
data: string;
|
|
28
|
+
themeType: "fullPage" | "dashboard";
|
|
29
|
+
}, {}, {}, {}, string, ComponentProvideOptions, false, {}, HTMLDivElement>;
|
|
30
|
+
|
|
31
|
+
declare type __VLS_Props = {
|
|
32
|
+
data?: string;
|
|
33
|
+
showTab?: boolean;
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
declare type __VLS_Props_2 = {
|
|
37
|
+
data?: string;
|
|
38
|
+
themeType?: 'fullPage' | 'dashboard';
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
declare function __VLS_template(): {
|
|
42
|
+
attrs: Partial<{}>;
|
|
43
|
+
slots: {
|
|
44
|
+
left?(_: {}): any;
|
|
45
|
+
};
|
|
46
|
+
refs: {};
|
|
47
|
+
rootEl: any;
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
declare function __VLS_template_2(): {
|
|
51
|
+
attrs: Partial<{}>;
|
|
52
|
+
slots: Readonly<Record<string, any>> & Record<string, any>;
|
|
53
|
+
refs: {};
|
|
54
|
+
rootEl: HTMLDivElement;
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
declare type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
|
|
58
|
+
|
|
59
|
+
declare type __VLS_TemplateResult_2 = ReturnType<typeof __VLS_template_2>;
|
|
60
|
+
|
|
61
|
+
declare type __VLS_WithTemplateSlots<T, S> = T & {
|
|
62
|
+
new (): {
|
|
63
|
+
$slots: S;
|
|
64
|
+
};
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
declare type __VLS_WithTemplateSlots_2<T, S> = T & {
|
|
68
|
+
new (): {
|
|
69
|
+
$slots: S;
|
|
70
|
+
};
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* 获取拖拽放置时的网格索引
|
|
75
|
+
* @param event - 拖拽事件对象
|
|
76
|
+
* @returns 网格项索引,如果未找到则返回 0
|
|
77
|
+
*/
|
|
78
|
+
export declare function getDropGridIndex(event: DragEvent): number;
|
|
79
|
+
|
|
80
|
+
export declare interface IBackground {
|
|
81
|
+
backgroundType?: 'none' | 'color' | 'image';
|
|
82
|
+
backgroundColor?: string;
|
|
83
|
+
backgroundImage?: string;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
export declare interface IBorder extends IFrameOptions {
|
|
87
|
+
borderStyle?: 'dashed' | 'solid' | 'dotted';
|
|
88
|
+
borderWidth?: number;
|
|
89
|
+
borderColor?: string;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
export declare interface IBoxShadow {
|
|
93
|
+
type: 'none' | 'inset' | 'outset';
|
|
94
|
+
offsetX: number;
|
|
95
|
+
offsetY: number;
|
|
96
|
+
blur: number;
|
|
97
|
+
spread: number;
|
|
98
|
+
color: string;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
export declare interface ICell {
|
|
102
|
+
id: number;
|
|
103
|
+
area: number[];
|
|
104
|
+
mergedCellIds: number[];
|
|
105
|
+
themes: Record<string, Partial<ICellThemeStyle>>;
|
|
106
|
+
data: Record<string, any>;
|
|
107
|
+
[key: string]: any;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
/**
|
|
111
|
+
* 单元格数据接口
|
|
112
|
+
*/
|
|
113
|
+
export declare interface ICellData {
|
|
114
|
+
/** 报表ID */
|
|
115
|
+
reportId?: string | number;
|
|
116
|
+
/** 时间间隔 */
|
|
117
|
+
timeInterval: string | number;
|
|
118
|
+
/** 刷新频率 */
|
|
119
|
+
refreshFrequency: string | number;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
export declare interface ICellThemeStyle {
|
|
123
|
+
frame: IBorder;
|
|
124
|
+
title: IFont & IPandding & Record<string, any>;
|
|
125
|
+
subtitle: IFont & IPandding & Record<string, any>;
|
|
126
|
+
shadow: IBoxShadow;
|
|
127
|
+
padding: IPandding;
|
|
128
|
+
boxContent: IPandding;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
/**
|
|
132
|
+
* 单元格标题样式类型
|
|
133
|
+
*/
|
|
134
|
+
export declare type ICellTitleStyle = IPandding & IFont & {
|
|
135
|
+
/** 是否显示图标 */
|
|
136
|
+
showIcon?: boolean;
|
|
137
|
+
};
|
|
138
|
+
|
|
139
|
+
export declare interface IFont {
|
|
140
|
+
fontSize: number;
|
|
141
|
+
fontWeight: number;
|
|
142
|
+
fontStyle: string;
|
|
143
|
+
fontFamily: string;
|
|
144
|
+
lineHeight: number;
|
|
145
|
+
color: string;
|
|
146
|
+
justifyContent: 'flex-start' | 'center' | 'flex-end';
|
|
147
|
+
alignItems: 'flex-start' | 'center' | 'flex-end';
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
export declare interface IFrameOptions {
|
|
151
|
+
borderRadius?: number;
|
|
152
|
+
borderType?: 'none' | 'line' | 'component';
|
|
153
|
+
backgroundColor?: string;
|
|
154
|
+
fillColor?: string;
|
|
155
|
+
reverse?: boolean;
|
|
156
|
+
dur?: number;
|
|
157
|
+
colors?: string[];
|
|
158
|
+
componentName?: string;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
export declare interface IMargin {
|
|
162
|
+
marginTop: number;
|
|
163
|
+
marginRight: number;
|
|
164
|
+
marginBottom: number;
|
|
165
|
+
marginLeft: number;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
export declare interface IPandding {
|
|
169
|
+
paddingTop: number;
|
|
170
|
+
paddingRight: number;
|
|
171
|
+
paddingBottom: number;
|
|
172
|
+
paddingLeft: number;
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
/**
|
|
176
|
+
* 专题数据接口
|
|
177
|
+
*/
|
|
178
|
+
export declare interface ISubjectData {
|
|
179
|
+
/** 专题ID */
|
|
180
|
+
id?: number | string;
|
|
181
|
+
/** 专题名称 */
|
|
182
|
+
name: string;
|
|
183
|
+
/** 专题描述 */
|
|
184
|
+
desc: string;
|
|
185
|
+
/** 刷新频率 */
|
|
186
|
+
refreshFrequency: string | number;
|
|
187
|
+
/** 时间间隔 */
|
|
188
|
+
timeInterval: string | number;
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
export declare type IThemeType = 'dashboard' | 'fullPage';
|
|
192
|
+
|
|
193
|
+
/**
|
|
194
|
+
* RootStore State 类型
|
|
195
|
+
*/
|
|
196
|
+
export declare interface RootStoreState {
|
|
197
|
+
gridData: {
|
|
198
|
+
colArr: any[];
|
|
199
|
+
rowArr: any[];
|
|
200
|
+
cols: number;
|
|
201
|
+
rows: number;
|
|
202
|
+
colGap: number;
|
|
203
|
+
rowGap: number;
|
|
204
|
+
};
|
|
205
|
+
gridCells: ICell[];
|
|
206
|
+
subjectData: {
|
|
207
|
+
id?: number | string;
|
|
208
|
+
name: string;
|
|
209
|
+
desc: string;
|
|
210
|
+
refreshFrequency: string | number;
|
|
211
|
+
timeInterval: string | number;
|
|
212
|
+
};
|
|
213
|
+
themeType: IThemeType;
|
|
214
|
+
themes: {
|
|
215
|
+
dashboard: any;
|
|
216
|
+
fullPage: any;
|
|
217
|
+
};
|
|
218
|
+
rubberband: any;
|
|
219
|
+
selectedCells: HTMLElement[];
|
|
220
|
+
selectedCellIds: number[];
|
|
221
|
+
tmpData: {
|
|
222
|
+
colorPickerColors: string[];
|
|
223
|
+
propPopover: Record<string, boolean>;
|
|
224
|
+
showFullIndex: boolean;
|
|
225
|
+
};
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
/**
|
|
229
|
+
* useEditor Hook 返回值类型
|
|
230
|
+
*/
|
|
231
|
+
export declare interface UseEditorReturn {
|
|
232
|
+
/** 当前选中单元格的索引列表 */
|
|
233
|
+
selectedCellIndexes: ComputedRef<number[]>;
|
|
234
|
+
/**
|
|
235
|
+
* 清除所有选中的单元格
|
|
236
|
+
*/
|
|
237
|
+
clearSelected: () => void;
|
|
238
|
+
/**
|
|
239
|
+
* 设置是否显示大屏索引
|
|
240
|
+
* @param val - 是否显示
|
|
241
|
+
*/
|
|
242
|
+
setShowFullIndex: (val: boolean) => void;
|
|
243
|
+
/** 设置选中单元格 ID 列表 */
|
|
244
|
+
setSelectedCellIds: (ids: number[]) => void;
|
|
245
|
+
/**
|
|
246
|
+
* 重置编辑器状态
|
|
247
|
+
*/
|
|
248
|
+
reset: () => void;
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
/**
|
|
252
|
+
* useGrid Hook 返回值类型
|
|
253
|
+
*/
|
|
254
|
+
export declare interface UseGridReturn {
|
|
255
|
+
/** 列模板字符串 (CSS grid-template-columns) */
|
|
256
|
+
colTemplate: ComputedRef<string>;
|
|
257
|
+
/** 行模板字符串 (CSS grid-template-rows) */
|
|
258
|
+
rowTemplate: ComputedRef<string>;
|
|
259
|
+
/** 总单元格数量 (rows * cols) */
|
|
260
|
+
divNum: ComputedRef<number>;
|
|
261
|
+
/** 有效单元格数量 (非空单元格) */
|
|
262
|
+
itemNum: ComputedRef<number>;
|
|
263
|
+
/** 所有有效单元格的 ID 列表 */
|
|
264
|
+
allCellIndexes: ComputedRef<number[]>;
|
|
265
|
+
/**
|
|
266
|
+
* 初始化行列数组和单元格列表
|
|
267
|
+
*/
|
|
268
|
+
initRowAndColArr: () => void;
|
|
269
|
+
/**
|
|
270
|
+
* 初始化单个单元格对象
|
|
271
|
+
* @param index - 单元格索引
|
|
272
|
+
* @param empty - 是否创建空单元格(不计算坐标)
|
|
273
|
+
* @returns 单元格对象
|
|
274
|
+
*/
|
|
275
|
+
initCellByIndex: (index: number, empty?: boolean) => ICell;
|
|
276
|
+
/**
|
|
277
|
+
* 更新单元格属性
|
|
278
|
+
* @param index - 单元格索引
|
|
279
|
+
* @param cell - 要更新的属性
|
|
280
|
+
* @param isMerged - 是否是合并操作
|
|
281
|
+
*/
|
|
282
|
+
updateCell: (index: number, cell: Partial<ICell>, isMerged?: boolean) => void;
|
|
283
|
+
/**
|
|
284
|
+
* 更新单元格业务数据
|
|
285
|
+
* @param index - 单元格索引
|
|
286
|
+
* @param data - 业务数据对象
|
|
287
|
+
* @param isMerged - 是否合并数据
|
|
288
|
+
*/
|
|
289
|
+
updateCellData: (index: number, data: Partial<ICellData> & Record<string, any>, isMerged?: boolean) => void;
|
|
290
|
+
/**
|
|
291
|
+
* 更新单元格样式
|
|
292
|
+
* @param index - 单元格索引
|
|
293
|
+
* @param type - 主题类型
|
|
294
|
+
* @param newCellStyle - 新的样式对象
|
|
295
|
+
* @param isMerge - 是否合并样式
|
|
296
|
+
*/
|
|
297
|
+
updateCellStyle: (index: number, type: IThemeType, newCellStyle: Partial<ICellThemeStyle>, isMerge?: boolean) => void;
|
|
298
|
+
/**
|
|
299
|
+
* 获取单元格的最终样式(合并全局样式)
|
|
300
|
+
* @param index - 单元格索引
|
|
301
|
+
* @param type - 主题类型
|
|
302
|
+
* @returns 合并后的样式对象
|
|
303
|
+
*/
|
|
304
|
+
getCellStyle: (index: number, type: IThemeType) => ICellThemeStyle;
|
|
305
|
+
/**
|
|
306
|
+
* 合并选中的单元格
|
|
307
|
+
* @param selectedCells - 选中的 DOM 元素列表
|
|
308
|
+
*/
|
|
309
|
+
mergeCells: (selectedCells?: HTMLElement[]) => void;
|
|
310
|
+
/**
|
|
311
|
+
* 拆分单元格
|
|
312
|
+
* @param selectedCells - 选中的 DOM 元素列表
|
|
313
|
+
*/
|
|
314
|
+
splitCell: (selectedCells?: HTMLElement[]) => void;
|
|
315
|
+
/**
|
|
316
|
+
* 重置网格布局(恢复默认间距,重新初始化)
|
|
317
|
+
*/
|
|
318
|
+
resetLayout: () => void;
|
|
319
|
+
/**
|
|
320
|
+
* 获取纯 JSON 数据(用于保存或导出)
|
|
321
|
+
* @param isExport - 是否为导出模式
|
|
322
|
+
* @returns JSON 字符串
|
|
323
|
+
*/
|
|
324
|
+
getPureJsonData: (isExport?: boolean) => string;
|
|
325
|
+
/**
|
|
326
|
+
* 初始化纯 JSON 数据(从文件或接口加载)
|
|
327
|
+
* @param jsonData - JSON 字符串或对象
|
|
328
|
+
*/
|
|
329
|
+
initPureJsonData: (jsonData: string | Record<string, any>) => {
|
|
330
|
+
ok: true;
|
|
331
|
+
} | {
|
|
332
|
+
ok: false;
|
|
333
|
+
reason: string;
|
|
334
|
+
} | void;
|
|
335
|
+
/**
|
|
336
|
+
* 解析并应用数据
|
|
337
|
+
* @param data - 数据对象
|
|
338
|
+
*/
|
|
339
|
+
parseData: (data: Record<string, any>) => void;
|
|
340
|
+
}
|
|
341
|
+
|
|
342
|
+
/**
|
|
343
|
+
* useMainStore 返回值类型(Facade)
|
|
344
|
+
* 组合了所有 hooks 的功能,并添加了 state 引用
|
|
345
|
+
*/
|
|
346
|
+
export declare interface UseMainStoreReturn {
|
|
347
|
+
gridData: Ref<any>;
|
|
348
|
+
gridCells: Ref<ICell[]>;
|
|
349
|
+
subjectData: Ref<any>;
|
|
350
|
+
themeType: Ref<IThemeType>;
|
|
351
|
+
themes: Ref<any>;
|
|
352
|
+
tmpData: Ref<any>;
|
|
353
|
+
selectedCells: Ref<HTMLElement[]>;
|
|
354
|
+
selectedCellIds: Ref<number[]>;
|
|
355
|
+
rubberband: Ref<any>;
|
|
356
|
+
colTemplate: ComputedRef<string>;
|
|
357
|
+
rowTemplate: ComputedRef<string>;
|
|
358
|
+
divNum: ComputedRef<number>;
|
|
359
|
+
itemNum: ComputedRef<number>;
|
|
360
|
+
allCellIndexes: ComputedRef<number[]>;
|
|
361
|
+
initRowAndColArr: () => void;
|
|
362
|
+
initCellByIndex: (index: number, empty?: boolean) => ICell;
|
|
363
|
+
updateCell: (index: number, cell: Partial<ICell>, isMerged?: boolean) => void;
|
|
364
|
+
updateCellData: (index: number, data: Partial<ICellData> & Record<string, any>, isMerged?: boolean) => void;
|
|
365
|
+
updateCellStyle: (index: number, type: IThemeType, newCellStyle: Partial<ICellThemeStyle>, isMerge?: boolean) => void;
|
|
366
|
+
getCellStyle: (index: number, type: IThemeType) => ICellThemeStyle;
|
|
367
|
+
mergeCells: (selectedCells?: HTMLElement[]) => void;
|
|
368
|
+
splitCell: (selectedCells?: HTMLElement[]) => void;
|
|
369
|
+
resetLayout: () => void;
|
|
370
|
+
getPureJsonData: (isExport?: boolean) => string;
|
|
371
|
+
initPureJsonData: (jsonData: string | Record<string, any>) => {
|
|
372
|
+
ok: true;
|
|
373
|
+
} | {
|
|
374
|
+
ok: false;
|
|
375
|
+
reason: string;
|
|
376
|
+
} | void;
|
|
377
|
+
parseData: (data: Record<string, any>) => void;
|
|
378
|
+
globalThemeStyle: ComputedRef<any>;
|
|
379
|
+
globalCellStyle: ComputedRef<ICellThemeStyle>;
|
|
380
|
+
updateGlobalThemeStyle: (themeStyle: Record<string, any>, type?: IThemeType) => void;
|
|
381
|
+
updateGlobalCellStyle: (type: IThemeType, style: Partial<ICellThemeStyle>) => void;
|
|
382
|
+
changeThemeType: (type: IThemeType) => void;
|
|
383
|
+
selectedCellIndexes: ComputedRef<number[]>;
|
|
384
|
+
clearSelected: () => void;
|
|
385
|
+
setShowFullIndex: (val: boolean) => void;
|
|
386
|
+
setSelectedCellIds: (ids: number[]) => void;
|
|
387
|
+
resetEditor: () => void;
|
|
388
|
+
/**
|
|
389
|
+
* 重置所有状态到初始值
|
|
390
|
+
*/
|
|
391
|
+
$reset: () => void;
|
|
392
|
+
}
|
|
393
|
+
|
|
394
|
+
/**
|
|
395
|
+
* useTheme Hook 返回值类型
|
|
396
|
+
*/
|
|
397
|
+
export declare interface UseThemeReturn {
|
|
398
|
+
/** 当前主题的全局样式配置 */
|
|
399
|
+
globalThemeStyle: ComputedRef<any>;
|
|
400
|
+
/** 当前主题的全局单元格样式 */
|
|
401
|
+
globalCellStyle: ComputedRef<ICellThemeStyle>;
|
|
402
|
+
/**
|
|
403
|
+
* 更新全局主题样式
|
|
404
|
+
* @param themeStyle - 样式对象
|
|
405
|
+
* @param type - 主题类型(可选)
|
|
406
|
+
*/
|
|
407
|
+
updateGlobalThemeStyle: (themeStyle: Record<string, any>, type?: IThemeType) => void;
|
|
408
|
+
/**
|
|
409
|
+
* 更新全局单元格样式
|
|
410
|
+
* @param type - 主题类型
|
|
411
|
+
* @param style - 样式对象
|
|
412
|
+
*/
|
|
413
|
+
updateGlobalCellStyle: (type: IThemeType, style: Partial<ICellThemeStyle>) => void;
|
|
414
|
+
/**
|
|
415
|
+
* 切换当前主题类型
|
|
416
|
+
* @param type - 目标主题类型
|
|
417
|
+
*/
|
|
418
|
+
changeThemeType: (type: IThemeType) => void;
|
|
419
|
+
}
|
|
420
|
+
|
|
421
|
+
export declare const VGridLayoutEditor: Plugin_2;
|
|
422
|
+
|
|
423
|
+
export declare const VGridLayoutEditorComponent: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
|
|
424
|
+
|
|
425
|
+
/**
|
|
426
|
+
* 网格布局查看器插件
|
|
427
|
+
* 仅包含查看器组件
|
|
428
|
+
*/
|
|
429
|
+
export declare const VGridLayoutViewer: Plugin_2;
|
|
430
|
+
|
|
431
|
+
export declare const VGridLayoutViewerComponent: __VLS_WithTemplateSlots_2<typeof __VLS_component_2, __VLS_TemplateResult_2["slots"]>;
|
|
432
|
+
|
|
433
|
+
export { }
|