@veltra/sheet 4.1.3 → 4.1.5
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/components/sheet/float-image-menu.js +1 -2
- package/dist/components/sheet/formula-bar.js +1 -2
- package/dist/components/sheet/formula-suggest-list.js +1 -2
- package/dist/components/sheet/import-file.js +3 -5
- package/dist/components/sheet/insert-count-menu-item.js +1 -2
- package/dist/components/sheet/insert-image.js +1 -2
- package/dist/components/sheet/popup-helpers.js +1 -2
- package/dist/components/sheet/popups/border-popup.js +1 -2
- package/dist/components/sheet/popups/border-preset-glyph.js +1 -2
- package/dist/components/sheet/popups/export-popup.js +1 -2
- package/dist/components/sheet/popups/fill-color-popup.js +1 -2
- package/dist/components/sheet/popups/find-popup.js +1 -2
- package/dist/components/sheet/popups/font-color-popup.js +1 -2
- package/dist/components/sheet/popups/font-size-popup.js +1 -2
- package/dist/components/sheet/popups/functions-popup.js +1 -2
- package/dist/components/sheet/popups/hyperlink-popup.js +1 -2
- package/dist/components/sheet/popups/import.worker.d.ts +1 -3
- package/dist/components/sheet/popups/import.worker.js +23462 -3
- package/dist/components/sheet/popups/insert-image-popup.js +1 -2
- package/dist/components/sheet/sheet-context-menu.js +0 -1
- package/dist/components/sheet/sheet-tabs.js +1 -2
- package/dist/components/sheet/sheet-toolbar.js +1 -2
- package/dist/components/sheet/sheet.js +1 -2
- package/dist/components/sheet/use-cell-link-tooltip.js +1 -2
- package/dist/components/sheet/use-find-replace.js +1 -2
- package/dist/components/sheet/use-formula-ref-select.js +1 -2
- package/dist/components/sheet/use-formula-suggest.js +0 -1
- package/dist/components/sheet/use-sheet-grid.js +1 -2
- package/dist/components/sheet/use-sheet-state.js +1 -2
- package/dist/components/sheet/use-sheet-tabs-bar.js +1 -2
- package/dist/components/sheet/use-tool-groups.js +1 -2
- package/dist/components/sheet/use-tool-popup.js +1 -2
- package/dist/components/sheet/use-toolbar-scroll.js +1 -2
- package/dist/tools/apply-style.js +1 -2
- package/dist/tools/builtin.js +1 -2
- package/dist/tools/context.d.ts +1 -3
- package/dist/tools/context.js +0 -1
- package/dist/tools/download.js +9 -6
- package/dist/tools/export.worker.d.ts +1 -3
- package/dist/tools/export.worker.js +23459 -3
- package/dist/tools/registry.d.ts +1 -3
- package/dist/tools/registry.js +1 -2
- package/dist/types/sheet.d.ts +1 -3
- package/package.json +5 -5
- package/src/components/sheet/__test__/formula-bar.test.ts +4 -3
- package/src/components/sheet/__test__/import-file.test.ts +57 -4
- package/src/components/sheet/__test__/insert-image.test.ts +3 -3
- package/src/components/sheet/__test__/sheet-context-menu.test.ts +2 -2
- package/src/components/sheet/import-file.ts +3 -3
- package/src/tools/__test__/builtin.test.ts +2 -2
- package/src/tools/__test__/context.test.ts +2 -2
- package/src/tools/__test__/download.test.ts +108 -0
- package/src/tools/download.ts +9 -5
|
@@ -2,7 +2,7 @@ import { INSERT_IMAGE_ACCEPT, insertImageFromFile, insertImageFromUrl } from "..
|
|
|
2
2
|
import { Fragment, createElementBlock, createElementVNode, createTextVNode, createVNode, defineComponent, normalizeClass, openBlock, ref, unref, withCtx, withKeys } from "vue";
|
|
3
3
|
import { UButton, UFilePicker, UInput } from "@veltra/desktop";
|
|
4
4
|
import { bem } from "@veltra/utils";
|
|
5
|
-
|
|
5
|
+
// src/components/sheet/popups/insert-image-popup.vue
|
|
6
6
|
const _sfc_main = /*@__PURE__*/ defineComponent({
|
|
7
7
|
name: "USheetInsertImagePopup",
|
|
8
8
|
__name: "insert-image-popup",
|
|
@@ -55,5 +55,4 @@ const _sfc_main = /*@__PURE__*/ defineComponent({
|
|
|
55
55
|
};
|
|
56
56
|
}
|
|
57
57
|
});
|
|
58
|
-
//#endregion
|
|
59
58
|
export { _sfc_main as default };
|
|
@@ -403,5 +403,4 @@ function ensureContextMenuSelection(ctx, info, renderSize) {
|
|
|
403
403
|
if (!isColInSelection(ranges, info.col)) ctx.selectRange(wholeColRange(info.col, renderSize.rows));
|
|
404
404
|
}
|
|
405
405
|
}
|
|
406
|
-
//#endregion
|
|
407
406
|
export { AXIS_SIZE_MAX, INSERT_COUNT_MAX, applyNumFmtToSelection, buildBodyMenus, buildColHeaderMenus, buildRowHeaderMenus, cellImageToFloat, defaultInsertCount, ensureContextMenuSelection, isColInSelection, isRowInSelection, resolveRenderSize, wholeColRange, wholeRowRange };
|
|
@@ -3,7 +3,7 @@ import { ArrowLeft, ArrowRight } from "@veltra/icons/normal";
|
|
|
3
3
|
import { Fragment, createElementBlock, createElementVNode, createVNode, defineComponent, nextTick, normalizeClass, openBlock, ref, renderList, toDisplayString, toRef, unref, useTemplateRef, vModelText, vShow, withCtx, withDirectives, withKeys, withModifiers } from "vue";
|
|
4
4
|
import { UIcon, contextmenu, message, messageConfirm } from "@veltra/desktop";
|
|
5
5
|
import { bem } from "@veltra/utils";
|
|
6
|
-
|
|
6
|
+
// src/components/sheet/sheet-tabs.vue
|
|
7
7
|
const _hoisted_1 = ["disabled"];
|
|
8
8
|
const _hoisted_2 = ["onClick", "onContextmenu"];
|
|
9
9
|
const _hoisted_3 = ["onKeydown"];
|
|
@@ -158,5 +158,4 @@ const _sfc_main = /*@__PURE__*/ defineComponent({
|
|
|
158
158
|
};
|
|
159
159
|
}
|
|
160
160
|
});
|
|
161
|
-
//#endregion
|
|
162
161
|
export { _sfc_main as default };
|
|
@@ -3,7 +3,7 @@ import { ArrowLeft, ArrowRight } from "@veltra/icons/normal";
|
|
|
3
3
|
import { Fragment, createBlock, createCommentVNode, createElementBlock, createElementVNode, createVNode, defineComponent, normalizeClass, openBlock, renderList, resolveDynamicComponent, toDisplayString, toRef, unref, useTemplateRef, withCtx } from "vue";
|
|
4
4
|
import { UIcon, UTip } from "@veltra/desktop";
|
|
5
5
|
import { bem } from "@veltra/utils";
|
|
6
|
-
|
|
6
|
+
// src/components/sheet/sheet-toolbar.vue
|
|
7
7
|
const _hoisted_1 = ["disabled"];
|
|
8
8
|
const _hoisted_2 = [
|
|
9
9
|
"data-tool-id",
|
|
@@ -101,5 +101,4 @@ const _sfc_main = /*@__PURE__*/ defineComponent({
|
|
|
101
101
|
};
|
|
102
102
|
}
|
|
103
103
|
});
|
|
104
|
-
//#endregion
|
|
105
104
|
export { _sfc_main as default };
|
|
@@ -19,7 +19,7 @@ import { useToolPopup } from "./use-tool-popup.js";
|
|
|
19
19
|
import { computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, createVNode, defineComponent, normalizeClass, normalizeStyle, openBlock, ref, shallowRef, toDisplayString, unref, useTemplateRef, watch, withCtx, withModifiers } from "vue";
|
|
20
20
|
import { UDropdown, UImagePreviewer, messageConfirm } from "@veltra/desktop";
|
|
21
21
|
import { bem } from "@veltra/utils";
|
|
22
|
-
|
|
22
|
+
// src/components/sheet/sheet.vue
|
|
23
23
|
const _sfc_main = /*@__PURE__*/ defineComponent({
|
|
24
24
|
name: "USheet",
|
|
25
25
|
__name: "sheet",
|
|
@@ -358,5 +358,4 @@ const _sfc_main = /*@__PURE__*/ defineComponent({
|
|
|
358
358
|
};
|
|
359
359
|
}
|
|
360
360
|
});
|
|
361
|
-
//#endregion
|
|
362
361
|
export { _sfc_main as default };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { shallowRef } from "vue";
|
|
2
|
-
|
|
2
|
+
// src/components/sheet/use-cell-link-tooltip.ts
|
|
3
3
|
/**
|
|
4
4
|
* tooltip 相对悬停落点的偏移:右下错开,浮层不遮指针与命中的链接文本。
|
|
5
5
|
*/
|
|
@@ -29,5 +29,4 @@ function useCellLinkTooltip() {
|
|
|
29
29
|
onCellLinkLeave
|
|
30
30
|
};
|
|
31
31
|
}
|
|
32
|
-
//#endregion
|
|
33
32
|
export { useCellLinkTooltip };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { findAll, findNextFrom, findPrevFrom, inferCellType, normalizeInputValue } from "infinitable/sheet";
|
|
2
2
|
import { computed, ref, shallowRef, watch } from "vue";
|
|
3
3
|
import { debounce } from "@cat-kit/core";
|
|
4
|
-
|
|
4
|
+
// src/components/sheet/use-find-replace.ts
|
|
5
5
|
/**
|
|
6
6
|
* 查找条逻辑(关键词 / 上一个 / 下一个 / 命中计数 / 替换):
|
|
7
7
|
* - 关键词 / 选项变化 → 重新查找并定位第一个命中
|
|
@@ -156,5 +156,4 @@ function useFindReplace(options) {
|
|
|
156
156
|
replaceAll
|
|
157
157
|
};
|
|
158
158
|
}
|
|
159
|
-
//#endregion
|
|
160
159
|
export { useFindReplace };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// src/components/sheet/use-formula-ref-select.ts
|
|
2
2
|
/** 引用选择上下文:光标前一个非空字符属于此集合时可插入单元格引用 */
|
|
3
3
|
const REF_TRIGGER_CHARS = /* @__PURE__ */ new Set([
|
|
4
4
|
"=",
|
|
@@ -41,5 +41,4 @@ function replaceRefText(text, start, end, rangeText) {
|
|
|
41
41
|
cursor: start + rangeText.length
|
|
42
42
|
};
|
|
43
43
|
}
|
|
44
|
-
//#endregion
|
|
45
44
|
export { REF_HIGHLIGHT_COLORS, insertRefText, isRefSelectContext, replaceRefText };
|
|
@@ -139,5 +139,4 @@ function moveSuggestIndex(activeIndex, length, delta) {
|
|
|
139
139
|
if (length <= 0) return 0;
|
|
140
140
|
return ((activeIndex % length + length) % length + delta + length) % length;
|
|
141
141
|
}
|
|
142
|
-
//#endregion
|
|
143
142
|
export { COMMON_FORMULA_NAMES, FUNCTION_POPUP_CATEGORIES, applySuggest, filterFormulaSuggestions, formatFunctionSignature, getSuggestContext, moveSuggestIndex };
|
|
@@ -4,7 +4,7 @@ import { SheetGrid } from "infinitable/sheet";
|
|
|
4
4
|
import { onBeforeUnmount, onMounted, watch } from "vue";
|
|
5
5
|
import { contextmenu } from "@veltra/desktop";
|
|
6
6
|
import { currentTheme } from "@veltra/styles/theme";
|
|
7
|
-
|
|
7
|
+
// src/components/sheet/use-sheet-grid.ts
|
|
8
8
|
/**
|
|
9
9
|
* 缓存容量:最近 N 个 sheet 的 SheetGrid 实例常驻(tab 来回切换零重建)。
|
|
10
10
|
* 大文件多 sheet 场景下切换卡顿的主因是每次重建引擎表格(实例创建 + 画布分层
|
|
@@ -300,5 +300,4 @@ function useSheetGrid(options) {
|
|
|
300
300
|
setRefHighlights
|
|
301
301
|
};
|
|
302
302
|
}
|
|
303
|
-
//#endregion
|
|
304
303
|
export { resolveCanvasThemeOverride, useSheetGrid };
|
|
@@ -3,7 +3,7 @@ import { defaultToolRegistry } from "../../tools/registry.js";
|
|
|
3
3
|
import { resolveRenderSize } from "./sheet-context-menu.js";
|
|
4
4
|
import { Workbook } from "infinitable/sheet";
|
|
5
5
|
import { computed, onBeforeUnmount, onMounted, ref, shallowRef, watch } from "vue";
|
|
6
|
-
|
|
6
|
+
// src/components/sheet/use-sheet-state.ts
|
|
7
7
|
/**
|
|
8
8
|
* USheet 的状态源(单一数据源,其余状态由此推导):
|
|
9
9
|
* - workbook(外部传入或内部自建单 sheet 工作簿)、sheetList、activeIndex、activeSheet
|
|
@@ -123,5 +123,4 @@ function useSheetState(props, emit, hooks) {
|
|
|
123
123
|
syncFromWorkbook
|
|
124
124
|
};
|
|
125
125
|
}
|
|
126
|
-
//#endregion
|
|
127
126
|
export { useSheetState };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { nextTick, onBeforeUnmount, onMounted, shallowRef, watch } from "vue";
|
|
2
2
|
import { applyWheelHorizontalScroll, computeOverflowNavState, scrollElementIntoView, scrollViewportByStep } from "@veltra/utils";
|
|
3
|
-
|
|
3
|
+
// src/components/sheet/use-sheet-tabs-bar.ts
|
|
4
4
|
/**
|
|
5
5
|
* Sheet 底部标签栏溢出滚动(滚动几何/滚轮转横滚/元素滚入视野共享
|
|
6
6
|
* @veltra/utils overflow-nav,见 #17;此处保留事件绑定与 watch 差异):
|
|
@@ -86,5 +86,4 @@ function useSheetTabsBar(options) {
|
|
|
86
86
|
scrollByStep
|
|
87
87
|
};
|
|
88
88
|
}
|
|
89
|
-
//#endregion
|
|
90
89
|
export { useSheetTabsBar };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { defaultToolRegistry } from "../../tools/registry.js";
|
|
2
2
|
import { computed } from "vue";
|
|
3
|
-
|
|
3
|
+
// src/components/sheet/use-tool-groups.ts
|
|
4
4
|
/**
|
|
5
5
|
* 内置组稳定顺序:history | cell | text | edit | insert | file。
|
|
6
6
|
* 未列出的自定义组按注册先后排在已知组之后。
|
|
@@ -38,5 +38,4 @@ function useToolGroups(context, stateTick) {
|
|
|
38
38
|
});
|
|
39
39
|
});
|
|
40
40
|
}
|
|
41
|
-
//#endregion
|
|
42
41
|
export { useToolGroups };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { defaultToolRegistry } from "../../tools/registry.js";
|
|
2
2
|
import { onBeforeUnmount, onMounted, shallowRef } from "vue";
|
|
3
|
-
|
|
3
|
+
// src/components/sheet/use-tool-popup.ts
|
|
4
4
|
/**
|
|
5
5
|
* 面板打开期间的写入是否合并为一个 undo 单元(关闭时提交):
|
|
6
6
|
* 填充颜色 / 边框 / 字体颜色 / 字号参与事务;查找(每次替换独立 undo)、
|
|
@@ -131,5 +131,4 @@ function useToolPopup(context, rootEl, getFallbackAnchor) {
|
|
|
131
131
|
handleToolClick
|
|
132
132
|
};
|
|
133
133
|
}
|
|
134
|
-
//#endregion
|
|
135
134
|
export { useToolPopup };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { onBeforeUnmount, onMounted, shallowRef, watch } from "vue";
|
|
2
2
|
import { applyWheelHorizontalScroll, computeOverflowNavState, scrollViewportByStep } from "@veltra/utils";
|
|
3
|
-
|
|
3
|
+
// src/components/sheet/use-toolbar-scroll.ts
|
|
4
4
|
/**
|
|
5
5
|
* 工具栏溢出滚动(滚动几何/滚轮转横滚共享 @veltra/utils overflow-nav,见 #17;
|
|
6
6
|
* 无活动项跟随):
|
|
@@ -68,5 +68,4 @@ function useToolbarScroll(options) {
|
|
|
68
68
|
scrollByStep
|
|
69
69
|
};
|
|
70
70
|
}
|
|
71
|
-
//#endregion
|
|
72
71
|
export { useToolbarScroll };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// src/tools/apply-style.ts
|
|
2
2
|
/**
|
|
3
3
|
* 按选区相对渲染网格的跨度判定样式写入目标(对齐 Excel):
|
|
4
4
|
* - 跨满全部列且未跨满全部行 → 行默认样式(rowStyles)
|
|
@@ -25,5 +25,4 @@ function axisStyleItemsForRange(range, axis, patch) {
|
|
|
25
25
|
});
|
|
26
26
|
return items;
|
|
27
27
|
}
|
|
28
|
-
//#endregion
|
|
29
28
|
export { axisStyleItemsForRange, classifySelectionStyleTarget };
|
package/dist/tools/builtin.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { rangesEqual } from "infinitable/sheet";
|
|
2
2
|
import { FontColor } from "@veltra/icons/colorful";
|
|
3
3
|
import { AlignBottom, AlignCenter, AlignTop, Bold, Border, Download, Fill, FontSize, Italic, MergeCells, PictureRounded, Rollback, Rollfront, Search, Strikethrough, Underline, UnmergeCells, Upload, Variable, VerticalAlignCenter, VerticalAlignLeft, VerticalAlignRight, Wrap } from "@veltra/icons/normal";
|
|
4
|
-
|
|
4
|
+
// src/tools/builtin.ts
|
|
5
5
|
/** 取活动格所在首选区;无选区返回 null */
|
|
6
6
|
function selectionRange(ctx) {
|
|
7
7
|
const { activeCell, ranges } = ctx.getSelection();
|
|
@@ -351,5 +351,4 @@ const BUILTIN_TOOLS = [
|
|
|
351
351
|
onClick: () => {}
|
|
352
352
|
}
|
|
353
353
|
];
|
|
354
|
-
//#endregion
|
|
355
354
|
export { BUILTIN_TOOLS };
|
package/dist/tools/context.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { CellAddress, CellData, CellImagePayload, CellInfo, CellLinkPayload, CellRange, CellStyle, CellStylePatch, CellValue, FrozenState, HistoryState, ImageInput, ImageUpdateFields, SelectionState, SetCellValueItem, Sheet, SheetImage, Workbook } from "infinitable/sheet";
|
|
2
|
-
//#region src/tools/context.d.ts
|
|
3
2
|
/**
|
|
4
3
|
* SheetContext:工具的唯一操作门面。
|
|
5
4
|
*
|
|
@@ -151,5 +150,4 @@ export interface SheetContextOptions {
|
|
|
151
150
|
* @param options.resolveGridSize 渲染尺寸解析器(整行/整列样式路由)
|
|
152
151
|
* @param options.syncAxisSizes 行列尺寸写模型后的即时同步钩子(USheet 接活动 grid)
|
|
153
152
|
*/
|
|
154
|
-
export declare function createSheetContext(resolveSheet: Sheet | (() => Sheet), workbook?: Workbook | (() => Workbook), options?: SheetContextOptions): SheetContext;
|
|
155
|
-
//#endregion
|
|
153
|
+
export declare function createSheetContext(resolveSheet: Sheet | (() => Sheet), workbook?: Workbook | (() => Workbook), options?: SheetContextOptions): SheetContext;
|
package/dist/tools/context.js
CHANGED
package/dist/tools/download.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { exportSheetCsv, exportWorkbookXlsx } from "infinitable/sheet";
|
|
2
2
|
import { saveBlob } from "@cat-kit/fe";
|
|
3
|
-
|
|
3
|
+
// src/tools/download.ts
|
|
4
4
|
/**
|
|
5
5
|
* 大工作簿的 XLSX 导出(引擎序列化 + ZIP 压缩为秒级同步重活)移入 Web Worker:
|
|
6
6
|
* 主线程只采集快照(结构化克隆友好的纯数据,行高随 SheetSnapshot.rowHeights
|
|
@@ -28,17 +28,21 @@ async function exportWorkbookXlsxAsync(workbook) {
|
|
|
28
28
|
if (settled) return;
|
|
29
29
|
settled = true;
|
|
30
30
|
worker.terminate();
|
|
31
|
-
|
|
31
|
+
try {
|
|
32
|
+
resolve(exportWorkbookXlsx(workbook));
|
|
33
|
+
} catch (err) {
|
|
34
|
+
reject(err);
|
|
35
|
+
}
|
|
32
36
|
};
|
|
33
37
|
worker.onmessage = (e) => {
|
|
34
38
|
if (settled) return;
|
|
35
|
-
settled = true;
|
|
36
|
-
worker.terminate();
|
|
37
39
|
const data = e.data;
|
|
38
40
|
if (!data.ok || !data.buffer) {
|
|
39
|
-
|
|
41
|
+
fallback();
|
|
40
42
|
return;
|
|
41
43
|
}
|
|
44
|
+
settled = true;
|
|
45
|
+
worker.terminate();
|
|
42
46
|
resolve(data.buffer);
|
|
43
47
|
};
|
|
44
48
|
worker.onerror = () => fallback();
|
|
@@ -64,5 +68,4 @@ function exportSheetCsvFile(ctx) {
|
|
|
64
68
|
const csv = exportSheetCsv(workbook.activeSheet);
|
|
65
69
|
saveBlob(new Blob([csv], { type: "text/csv;charset=utf-8" }), `${workbook.activeSheet.name || "sheet"}.csv`);
|
|
66
70
|
}
|
|
67
|
-
//#endregion
|
|
68
71
|
export { exportSheetCsvFile, exportWorkbookFile };
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { SheetSnapshot } from "infinitable/sheet";
|
|
2
|
-
//#region src/tools/export.worker.d.ts
|
|
3
2
|
export interface ExportWorkerPayload {
|
|
4
3
|
sheets: {
|
|
5
4
|
name: string;
|
|
@@ -11,5 +10,4 @@ export interface ExportWorkerResponse {
|
|
|
11
10
|
ok: boolean;
|
|
12
11
|
buffer?: Uint8Array;
|
|
13
12
|
error?: string;
|
|
14
|
-
}
|
|
15
|
-
//#endregion
|
|
13
|
+
}
|