xiaodao-spreader 0.1.35 → 0.1.37
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.ZH.md +87 -2
- package/README.md +87 -2
- package/dist/style.css +1 -1
- package/dist/types/components/spreader/components/data-validation-input-message.vue.d.ts +8 -8
- package/dist/types/components/spreader/components/dropdown.vue.d.ts +4 -1
- package/dist/types/components/spreader/components/pickers/border-picker.vue.d.ts +3 -0
- package/dist/types/components/spreader/components/pickers/calc-picker.vue.d.ts +2 -0
- package/dist/types/components/spreader/components/pickers/color-picker.vue.d.ts +3 -0
- package/dist/types/components/spreader/components/pickers/conditional-format-menu.vue.d.ts +9 -1
- package/dist/types/components/spreader/components/pickers/data-validation-alert.vue.d.ts +2 -2
- package/dist/types/components/spreader/components/pickers/data-validation-dialog.vue.d.ts +4 -4
- package/dist/types/components/spreader/components/pickers/data-validation-dropdown.vue.d.ts +12 -10
- package/dist/types/components/spreader/components/pickers/filter-popup.vue.d.ts +2 -0
- package/dist/types/components/spreader/components/pickers/merge-picker.vue.d.ts +3 -0
- package/dist/types/components/spreader/components/pickers/outline-picker.vue.d.ts +32 -0
- package/dist/types/components/spreader/components/pickers/sort-picker.vue.d.ts +3 -0
- package/dist/types/components/spreader/components/spreader.vue.d.ts +43 -0
- package/dist/types/components/spreader/components/tabbar.vue.d.ts +2 -0
- package/dist/types/components/spreader/components/toolbar.vue.d.ts +29 -0
- package/dist/types/components/spreader/composables/core-state.d.ts +41 -1
- package/dist/types/components/spreader/composables/interactions.d.ts +10 -0
- package/dist/types/components/spreader/composables/useFloatMenuPosition.d.ts +39 -0
- package/dist/types/components/spreader/core/autofill.d.ts +11 -2
- package/dist/types/components/spreader/core/constants.d.ts +2 -0
- package/dist/types/components/spreader/core/outline-core.d.ts +64 -0
- package/dist/types/components/spreader/core/types.d.ts +24 -0
- package/dist/types/components/spreader/core/utils.d.ts +20 -0
- package/dist/xiaodao-spreader.es.js +8597 -7810
- package/dist/xiaodao-spreader.umd.js +9 -9
- package/package.json +1 -1
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import type { DimensionOutline } from './types';
|
|
2
|
+
/** 分组校验失败的原因 */
|
|
3
|
+
export type OutlineValidationCode = 'outlineMinSize' | 'outlineCrossing' | 'outlineTooDeep' | 'outlineInvalid';
|
|
4
|
+
export interface OutlineValidationResult {
|
|
5
|
+
ok: boolean;
|
|
6
|
+
code?: OutlineValidationCode;
|
|
7
|
+
/** 通过校验时,根据嵌套关系算出的层级(1 起) */
|
|
8
|
+
level?: number;
|
|
9
|
+
}
|
|
10
|
+
/** 范围内包含多少既有分组(严格包含该范围的组越多,层级越深) */
|
|
11
|
+
export declare function countContaining(outlines: DimensionOutline[], start: number, end: number): number;
|
|
12
|
+
/**
|
|
13
|
+
* 校验一个新分组(start/end 为 0-based 闭区间)是否可在既有分组集合上创建。
|
|
14
|
+
* 规则:
|
|
15
|
+
* - start <= end
|
|
16
|
+
* - 至少连续 2 个维度
|
|
17
|
+
* - 与既有分组必须完全不相交,禁止部分重叠与嵌套(仅支持一层分组)
|
|
18
|
+
* - 层级恒为 1(countContaining 必须为 0)
|
|
19
|
+
*/
|
|
20
|
+
export declare function validateGroup(existing: DimensionOutline[], start: number, end: number): OutlineValidationResult;
|
|
21
|
+
/** 创建分组后的新集合(校验失败返回原集合,同时给出校验结果供调用方提示) */
|
|
22
|
+
export declare function addOutline(existing: DimensionOutline[], axis: 'row' | 'column', start: number, end: number, id: string, opts?: {
|
|
23
|
+
collapsed?: boolean;
|
|
24
|
+
}): {
|
|
25
|
+
outlines: DimensionOutline[];
|
|
26
|
+
validation: OutlineValidationResult;
|
|
27
|
+
};
|
|
28
|
+
/** 设置某个分组的折叠状态 */
|
|
29
|
+
export declare function setOutlineCollapsed(outlines: DimensionOutline[], id: string, collapsed: boolean): DimensionOutline[];
|
|
30
|
+
/** 删除某个分组(返回新集合) */
|
|
31
|
+
export declare function removeOutline(outlines: DimensionOutline[], id: string): DimensionOutline[];
|
|
32
|
+
/** 清除全部(某方向)分组 */
|
|
33
|
+
export declare function clearOutlines(): DimensionOutline[];
|
|
34
|
+
/** 插入 count 个维度到 index 处后,调整既有分组范围(完全遵循 Range 插入语义) */
|
|
35
|
+
export declare function addOutlineForInsert(outlines: DimensionOutline[], index: number, count: number): DimensionOutline[];
|
|
36
|
+
/** 删除 [index, index+count-1] 这段维度后,调整既有分组;空组自动移除 */
|
|
37
|
+
export declare function addOutlineForDelete(outlines: DimensionOutline[], index: number, count: number): DimensionOutline[];
|
|
38
|
+
/**
|
|
39
|
+
* 根据嵌套关系重建每个分组的 level:
|
|
40
|
+
* level = (严格包含该分组的其它分组数量) + 1
|
|
41
|
+
* 注意:必须排除自身,否则每个分组都会被自己计数导致层级 +1。
|
|
42
|
+
*/
|
|
43
|
+
export declare function recomputeOutlineLevels(outlines: DimensionOutline[]): DimensionOutline[];
|
|
44
|
+
/**
|
|
45
|
+
* 维度可见性索引。
|
|
46
|
+
* - levels[i] : 维度 i 所处的 outline 层级(0 = 不在任何分组内)
|
|
47
|
+
* - hidden[i] : 维度 i 是否被某个「已折叠分组」包含(不可见)
|
|
48
|
+
* - maxLevel : 当前分组最深层级(≥1);无分组为 0
|
|
49
|
+
*/
|
|
50
|
+
export interface OutlineIndex {
|
|
51
|
+
levels: number[];
|
|
52
|
+
hidden: boolean[];
|
|
53
|
+
maxLevel: number;
|
|
54
|
+
}
|
|
55
|
+
/** 构建线性维度(行/列)的 outline 索引。count = 维度总数 */
|
|
56
|
+
export declare function buildOutlineIndex(outlines: DimensionOutline[], count: number): OutlineIndex;
|
|
57
|
+
/** 维度 i 所处的 outline 层级(无分组为 0) */
|
|
58
|
+
export declare function outlineLevelAt(outlines: DimensionOutline[], i: number): number;
|
|
59
|
+
/** 维度 i 是否被某个已折叠分组包含(不可见) */
|
|
60
|
+
export declare function isOutlineCollapsedAt(outlines: DimensionOutline[], i: number): boolean;
|
|
61
|
+
/** 是否已存在跨过该分组 cell 的既有分组(按 cell 命中) */
|
|
62
|
+
export declare function hasOutlineInRange(outlines: DimensionOutline[], start: number, end: number): boolean;
|
|
63
|
+
/** 生成稳定唯一分组 ID(避免与既有 ID 冲突) */
|
|
64
|
+
export declare function genOutlineId(existing: DimensionOutline[], axis: 'row' | 'column'): string;
|
|
@@ -252,6 +252,20 @@ export interface DataValidationResult {
|
|
|
252
252
|
title?: string;
|
|
253
253
|
message?: string;
|
|
254
254
|
}
|
|
255
|
+
/** 单个行列分组的最大支持层级:固定为 1,即仅支持一层分组(分组之间互不嵌套) */
|
|
256
|
+
export declare const MAX_OUTLINE_LEVEL = 1;
|
|
257
|
+
/** 维度分组:属于 Sheet 的结构元数据。start/end 为 0-based 闭区间,且 start <= end */
|
|
258
|
+
export interface DimensionOutline {
|
|
259
|
+
/** 稳定唯一 ID(禁止数组 index) */
|
|
260
|
+
id: string;
|
|
261
|
+
axis: 'row' | 'column';
|
|
262
|
+
start: number;
|
|
263
|
+
end: number;
|
|
264
|
+
/** 由嵌套关系计算得到的层级(1 起),非用户手工输入 */
|
|
265
|
+
level: number;
|
|
266
|
+
/** 是否折叠(折叠时隐藏组内 Detail,逻辑行列仍存在) */
|
|
267
|
+
collapsed: boolean;
|
|
268
|
+
}
|
|
255
269
|
export interface SheetModelData {
|
|
256
270
|
name: string;
|
|
257
271
|
/** 表格级样式池:styles[0] 始终为默认空样式 {} */
|
|
@@ -278,6 +292,10 @@ export interface SheetModelData {
|
|
|
278
292
|
conditionalFormats?: ConditionalFormattingRule[];
|
|
279
293
|
/** 数据验证规则集合;旧数据缺省视为无数据验证 */
|
|
280
294
|
dataValidations?: DataValidationRule[];
|
|
295
|
+
/** 行分组集合;旧数据缺省视为无分组 */
|
|
296
|
+
rowOutlines?: DimensionOutline[];
|
|
297
|
+
/** 列分组集合;旧数据缺省视为无分组 */
|
|
298
|
+
columnOutlines?: DimensionOutline[];
|
|
281
299
|
}
|
|
282
300
|
export interface SheetState {
|
|
283
301
|
id: string;
|
|
@@ -306,6 +324,10 @@ export interface SheetState {
|
|
|
306
324
|
conditionalFormats: ConditionalFormattingRule[];
|
|
307
325
|
/** 数据验证规则集合;缺省为空数组 */
|
|
308
326
|
dataValidations: DataValidationRule[];
|
|
327
|
+
/** 行分组集合;缺省为空数组 */
|
|
328
|
+
rowOutlines: DimensionOutline[];
|
|
329
|
+
/** 列分组集合;缺省为空数组 */
|
|
330
|
+
columnOutlines: DimensionOutline[];
|
|
309
331
|
}
|
|
310
332
|
/** 视口区域:冻结窗格将画布划分为四个独立滚动区域 */
|
|
311
333
|
export interface ViewportRegion {
|
|
@@ -341,6 +363,8 @@ export interface ThemeColors {
|
|
|
341
363
|
gridLine: string;
|
|
342
364
|
selectionBg: string;
|
|
343
365
|
activeCellBorder: string;
|
|
366
|
+
outlineGroupBg1: string;
|
|
367
|
+
outlineGroupBg2: string;
|
|
344
368
|
cellText: string;
|
|
345
369
|
scrollTrack: string;
|
|
346
370
|
scrollThumb: string;
|
|
@@ -24,3 +24,23 @@ export declare function getCanvasXY(e: MouseEvent, canvas: HTMLCanvasElement | n
|
|
|
24
24
|
export declare function gridViewW(viewW: number, sbSize: number): number;
|
|
25
25
|
/** 网格可视区域高度(减去行头和滚动条) */
|
|
26
26
|
export declare function gridViewH(viewH: number, sbSize: number): number;
|
|
27
|
+
/** 浮层可用的有效边界(视口坐标系)。
|
|
28
|
+
*
|
|
29
|
+
* 取「组件容器(boundaryEl)」∩「浏览器视口」的交集,两者都不能单独作为判据:
|
|
30
|
+
* - 浏览器视口:浮层 Teleport 到 body + position:fixed,挂在视口坐标系,越出视口一定看不见(硬边界)。
|
|
31
|
+
* 但组件作为子组件嵌入宿主页面时只占页面一部分,纯视口判定会漏算两侧留白 → 越界盖住宿主内容。
|
|
32
|
+
* - 组件容器:嵌入场景下把浮层夹在表格可视区内。但容器可能大于视口(页面滚动、边缘在视口外),
|
|
33
|
+
* 纯容器判定会把「其实已在视口外」当成有空间 → 浮层照样看不见。
|
|
34
|
+
*
|
|
35
|
+
* 取交集后:组件全屏时容器≈视口,自然退化为纯视口判定;boundaryEl 为空时同样退化为纯视口。
|
|
36
|
+
*/
|
|
37
|
+
export interface FloatBounds {
|
|
38
|
+
left: number;
|
|
39
|
+
right: number;
|
|
40
|
+
top: number;
|
|
41
|
+
bottom: number;
|
|
42
|
+
}
|
|
43
|
+
export declare function getFloatBounds(boundaryEl?: HTMLElement | null): FloatBounds;
|
|
44
|
+
/** 把「视口坐标 x」换算成 fixed 定位的 CSS `right` 值(相对视口右缘的偏移)。
|
|
45
|
+
* 浮层以 position:fixed 挂在视口坐标系,故换算基准恒为 window.innerWidth,与有效边界无关。 */
|
|
46
|
+
export declare function cssRightFromX(x: number): number;
|