@veltra/sheet 2.5.7 → 2.5.8
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/formula-bar.js +1 -1
- package/dist/components/sheet/import-file.js +1 -1
- package/dist/components/sheet/popup-helpers.js +1 -1
- package/dist/components/sheet/popups/border-popup.js +2 -2
- package/dist/components/sheet/popups/functions-popup.js +1 -1
- package/dist/components/sheet/popups/import.worker.d.ts +1 -1
- package/dist/components/sheet/popups/import.worker.js +1 -1
- package/dist/components/sheet/sheet-context-menu.js +1 -1
- package/dist/components/sheet/use-find-replace.js +2 -2
- package/dist/components/sheet/use-formula-suggest.js +1 -1
- package/dist/components/sheet/use-sheet-state.js +1 -1
- package/dist/tools/builtin.js +1 -1
- package/dist/tools/context.d.ts +11 -11
- package/dist/tools/download.js +1 -1
- package/dist/tools/export.worker.d.ts +1 -1
- package/dist/tools/export.worker.js +1 -1
- package/dist/tools/registry.js +1 -1
- package/dist/types/sheet.d.ts +2 -2
- package/package.json +1 -1
- package/src/components/sheet/__test__/formula-bar.test.ts +2 -2
- package/src/components/sheet/__test__/functions-popup.test.ts +1 -1
- package/src/components/sheet/__test__/import-file.test.ts +3 -3
- package/src/components/sheet/__test__/insert-image-popup.test.ts +1 -1
- package/src/components/sheet/__test__/insert-image.test.ts +1 -1
- package/src/components/sheet/__test__/sheet-component.test.ts +1 -1
- package/src/components/sheet/__test__/sheet-context-menu.test.ts +2 -2
- package/src/components/sheet/__test__/use-formula-suggest.test.ts +1 -1
- package/src/components/sheet/formula-bar.vue +3 -3
- package/src/components/sheet/import-file.ts +3 -3
- package/src/components/sheet/insert-image.ts +1 -1
- package/src/components/sheet/popup-helpers.ts +3 -3
- package/src/components/sheet/popups/border-popup.vue +3 -3
- package/src/components/sheet/popups/find-popup.vue +1 -1
- package/src/components/sheet/popups/functions-popup.vue +1 -1
- package/src/components/sheet/popups/import.worker.ts +2 -2
- package/src/components/sheet/sheet-context-menu.ts +2 -2
- package/src/components/sheet/sheet-tabs.vue +2 -2
- package/src/components/sheet/use-find-replace.ts +3 -3
- package/src/components/sheet/use-formula-suggest.ts +1 -1
- package/src/components/sheet/use-sheet-grid.ts +2 -2
- package/src/components/sheet/use-sheet-state.ts +2 -2
- package/src/tools/__test__/apply-style.test.ts +2 -2
- package/src/tools/__test__/builtin.test.ts +3 -3
- package/src/tools/__test__/context.test.ts +2 -2
- package/src/tools/apply-style.ts +3 -3
- package/src/tools/builtin.ts +2 -2
- package/src/tools/context.ts +11 -11
- package/src/tools/download.ts +2 -2
- package/src/tools/export.worker.ts +3 -3
- package/src/tools/registry.ts +1 -1
- package/src/types/sheet.ts +2 -2
|
@@ -2,7 +2,7 @@ import _sfc_main$1 from "./formula-suggest-list.js";
|
|
|
2
2
|
import { applySuggest, filterFormulaSuggestions, getSuggestContext, moveSuggestIndex } from "./use-formula-suggest.js";
|
|
3
3
|
import _sfc_main$2 from "./popups/functions-popup.js";
|
|
4
4
|
import { insertRefText, isRefSelectContext } from "./use-formula-ref-select.js";
|
|
5
|
-
import { formatAddress, formatRange, parseRange } from "@veltra/sheet-core/core/address";
|
|
5
|
+
import { formatAddress, formatRange, parseRange } from "@veltra/sheet-core/core/address.js";
|
|
6
6
|
import { computed, createCommentVNode, createElementBlock, createElementVNode, createVNode, defineComponent, nextTick, normalizeClass, onBeforeUnmount, onMounted, openBlock, ref, shallowRef, unref, useTemplateRef, vModelText, watch, withCtx, withDirectives, withModifiers } from "vue";
|
|
7
7
|
import { UDropdown, message } from "@veltra/desktop";
|
|
8
8
|
import { bem } from "@veltra/utils";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { message, messageConfirm } from "@veltra/desktop";
|
|
2
2
|
import { nextFrame } from "@veltra/utils";
|
|
3
|
-
import { importCsv, importXlsx, replaceWorkbookWithSnapshots } from "@veltra/sheet-core/core/io/import";
|
|
3
|
+
import { importCsv, importXlsx, replaceWorkbookWithSnapshots } from "@veltra/sheet-core/core/io/import.js";
|
|
4
4
|
//#region src/components/sheet/import-file.ts
|
|
5
5
|
/** 导入文件 accept(工具栏直接选文件) */
|
|
6
6
|
const IMPORT_FILE_ACCEPT = ".xlsx,.csv";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { BORDER_STYLE_WIDTH } from "@veltra/sheet-core/core/style/types";
|
|
1
|
+
import { BORDER_STYLE_WIDTH } from "@veltra/sheet-core/core/style/types.js";
|
|
2
2
|
//#region src/components/sheet/popup-helpers.ts
|
|
3
3
|
/** 当前选区(ranges[0] 优先;无区域选区时用活动格单格) */
|
|
4
4
|
function currentRange(context) {
|
|
@@ -3,8 +3,8 @@ import _sfc_main$1 from "./border-preset-glyph.js";
|
|
|
3
3
|
import { Fragment, createElementBlock, createElementVNode, createVNode, defineComponent, normalizeClass, normalizeStyle, openBlock, ref, renderList, unref } from "vue";
|
|
4
4
|
import { UPalette } from "@veltra/desktop";
|
|
5
5
|
import { bem } from "@veltra/utils";
|
|
6
|
-
import { buildBorderPresetItems } from "@veltra/sheet-core/core/style/border-presets";
|
|
7
|
-
import { BORDER_STYLE_WIDTH } from "@veltra/sheet-core/core/style/types";
|
|
6
|
+
import { buildBorderPresetItems } from "@veltra/sheet-core/core/style/border-presets.js";
|
|
7
|
+
import { BORDER_STYLE_WIDTH } from "@veltra/sheet-core/core/style/types.js";
|
|
8
8
|
//#region src/components/sheet/popups/border-popup.vue
|
|
9
9
|
const _hoisted_1 = ["title", "onClick"];
|
|
10
10
|
const _hoisted_2 = ["title", "onClick"];
|
|
@@ -2,7 +2,7 @@ import { COMMON_FORMULA_NAMES, FUNCTION_POPUP_CATEGORIES, formatFunctionSignatur
|
|
|
2
2
|
import { Fragment, computed, createCommentVNode, createElementBlock, createElementVNode, createVNode, defineComponent, normalizeClass, onMounted, openBlock, ref, renderList, toDisplayString, unref, useTemplateRef, watch, withCtx } from "vue";
|
|
3
3
|
import { UInput, UScroll } from "@veltra/desktop";
|
|
4
4
|
import { bem } from "@veltra/utils";
|
|
5
|
-
import { listFormulaFunctions } from "@veltra/sheet-core/core/formula/functions";
|
|
5
|
+
import { listFormulaFunctions } from "@veltra/sheet-core/core/formula/functions.js";
|
|
6
6
|
//#region src/components/sheet/popups/functions-popup.vue
|
|
7
7
|
const _hoisted_1 = ["onClick"];
|
|
8
8
|
const _hoisted_2 = ["onClick", "onMouseenter"];
|
|
@@ -3,7 +3,7 @@ self.onmessage = (e) => {
|
|
|
3
3
|
const { buffer } = e.data;
|
|
4
4
|
(async () => {
|
|
5
5
|
try {
|
|
6
|
-
const { importXlsx } = await import("@veltra/sheet-core/core/io/import");
|
|
6
|
+
const { importXlsx } = await import("@veltra/sheet-core/core/io/import.js");
|
|
7
7
|
let lastPercent = -1;
|
|
8
8
|
const wb = await importXlsx(new Uint8Array(buffer), (done, total) => {
|
|
9
9
|
const percent = total > 0 ? Math.floor(done / total * 10) : 10;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { defaultToolRegistry } from "../../tools/registry.js";
|
|
2
2
|
import { pickAndInsertImage } from "./insert-image.js";
|
|
3
3
|
import _sfc_main from "./insert-count-menu-item.js";
|
|
4
|
-
import { createRange } from "@veltra/sheet-core/core/address";
|
|
4
|
+
import { createRange } from "@veltra/sheet-core/core/address.js";
|
|
5
5
|
import { defineComponent, h } from "vue";
|
|
6
6
|
const INSERT_COUNT_MAX = 1e3;
|
|
7
7
|
/** 选区覆盖行/列数 → 插入默认 N(min 1 / max 1000) */
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { computed, ref, shallowRef, watch } from "vue";
|
|
2
2
|
import { debounce } from "@cat-kit/core";
|
|
3
|
-
import { inferCellType, normalizeInputValue } from "@veltra/sheet-core/core/cell-store";
|
|
4
|
-
import { findAll, findNextFrom, findPrevFrom } from "@veltra/sheet-core/core/find";
|
|
3
|
+
import { inferCellType, normalizeInputValue } from "@veltra/sheet-core/core/cell-store.js";
|
|
4
|
+
import { findAll, findNextFrom, findPrevFrom } from "@veltra/sheet-core/core/find.js";
|
|
5
5
|
//#region src/components/sheet/use-find-replace.ts
|
|
6
6
|
/**
|
|
7
7
|
* 查找条逻辑(关键词 / 上一个 / 下一个 / 命中计数 / 替换):
|
|
@@ -2,7 +2,7 @@ import { defaultToolRegistry } from "../../tools/registry.js";
|
|
|
2
2
|
import { createSheetContext } from "../../tools/context.js";
|
|
3
3
|
import { resolveRenderSize } from "./sheet-context-menu.js";
|
|
4
4
|
import { computed, onBeforeUnmount, onMounted, ref, shallowRef, watch } from "vue";
|
|
5
|
-
import { Workbook } from "@veltra/sheet-core/core/workbook";
|
|
5
|
+
import { Workbook } from "@veltra/sheet-core/core/workbook.js";
|
|
6
6
|
//#region src/components/sheet/use-sheet-state.ts
|
|
7
7
|
/**
|
|
8
8
|
* USheet 的状态源(单一数据源,其余状态由此推导):
|
package/dist/tools/builtin.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { registerTool } from "./registry.js";
|
|
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
|
-
import { rangesEqual } from "@veltra/sheet-core/core/address";
|
|
4
|
+
import { rangesEqual } from "@veltra/sheet-core/core/address.js";
|
|
5
5
|
//#region src/tools/builtin.ts
|
|
6
6
|
/** 取活动格所在首选区;无选区返回 null */
|
|
7
7
|
function selectionRange(ctx) {
|
package/dist/tools/context.d.ts
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { CellAddress, CellRange } from "@veltra/sheet-core/core/address";
|
|
2
|
-
import { CellStyle, CellStylePatch } from "@veltra/sheet-core/core/style/types";
|
|
3
|
-
import { CellData, CellValue } from "@veltra/sheet-core/core/cell-store";
|
|
4
|
-
import { Workbook } from "@veltra/sheet-core/core/workbook";
|
|
5
|
-
import { FrozenState, Sheet } from "@veltra/sheet-core/core/sheet";
|
|
6
|
-
import { HistoryState } from "@veltra/sheet-core/core/command/history";
|
|
7
|
-
import { ImageUpdateFields } from "@veltra/sheet-core/core/command/image";
|
|
8
|
-
import { SetCellValueItem } from "@veltra/sheet-core/core/command/set-cell-value";
|
|
9
|
-
import { ImageInput, SheetImage } from "@veltra/sheet-core/core/image";
|
|
10
|
-
import { CellInfo } from "@veltra/sheet-core/core/merge-manager";
|
|
11
|
-
import { SelectionState } from "@veltra/sheet-core/core/selection";
|
|
1
|
+
import { CellAddress, CellRange } from "@veltra/sheet-core/core/address.js";
|
|
2
|
+
import { CellStyle, CellStylePatch } from "@veltra/sheet-core/core/style/types.js";
|
|
3
|
+
import { CellData, CellValue } from "@veltra/sheet-core/core/cell-store.js";
|
|
4
|
+
import { Workbook } from "@veltra/sheet-core/core/workbook.js";
|
|
5
|
+
import { FrozenState, Sheet } from "@veltra/sheet-core/core/sheet.js";
|
|
6
|
+
import { HistoryState } from "@veltra/sheet-core/core/command/history.js";
|
|
7
|
+
import { ImageUpdateFields } from "@veltra/sheet-core/core/command/image.js";
|
|
8
|
+
import { SetCellValueItem } from "@veltra/sheet-core/core/command/set-cell-value.js";
|
|
9
|
+
import { ImageInput, SheetImage } from "@veltra/sheet-core/core/image.js";
|
|
10
|
+
import { CellInfo } from "@veltra/sheet-core/core/merge-manager.js";
|
|
11
|
+
import { SelectionState } from "@veltra/sheet-core/core/selection.js";
|
|
12
12
|
//#region src/tools/context.d.ts
|
|
13
13
|
/**
|
|
14
14
|
* SheetContext:工具的唯一操作门面。
|
package/dist/tools/download.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { saveBlob } from "@cat-kit/fe";
|
|
2
|
-
import { exportSheetCsv, exportWorkbookXlsx } from "@veltra/sheet-core/core/io/export";
|
|
2
|
+
import { exportSheetCsv, exportWorkbookXlsx } from "@veltra/sheet-core/core/io/export.js";
|
|
3
3
|
//#region src/tools/download.ts
|
|
4
4
|
/**
|
|
5
5
|
* 大工作簿的 XLSX 导出(sheet-core 序列化 + ZIP 压缩为秒级同步重活)移入 Web Worker:
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
//#region src/tools/export.worker.ts
|
|
2
2
|
self.onmessage = (e) => {
|
|
3
|
-
Promise.all([import("@veltra/sheet-core/core/io/export"), import("@veltra/sheet-core/core/workbook")]).then(([{ exportWorkbookXlsx }, { Workbook }]) => {
|
|
3
|
+
Promise.all([import("@veltra/sheet-core/core/io/export.js"), import("@veltra/sheet-core/core/workbook.js")]).then(([{ exportWorkbookXlsx }, { Workbook }]) => {
|
|
4
4
|
const wb = new Workbook();
|
|
5
5
|
const sheets = e.data.sheets;
|
|
6
6
|
for (let i = 0; i < sheets.length; i++) {
|
package/dist/tools/registry.js
CHANGED
package/dist/types/sheet.d.ts
CHANGED
|
@@ -2,8 +2,8 @@ import { SheetContext } from "../tools/context.js";
|
|
|
2
2
|
import { ComputedRef } from "vue";
|
|
3
3
|
import { DeconstructValue } from "@veltra/utils";
|
|
4
4
|
import { ResolveCellRenderer, ResolveCellStyleHook, ResolveDisplayValue, SheetGrid } from "@veltra/sheet-core/grid";
|
|
5
|
-
import { Workbook } from "@veltra/sheet-core/core/workbook";
|
|
6
|
-
import { Sheet } from "@veltra/sheet-core/core/sheet";
|
|
5
|
+
import { Workbook } from "@veltra/sheet-core/core/workbook.js";
|
|
6
|
+
import { Sheet } from "@veltra/sheet-core/core/sheet.js";
|
|
7
7
|
//#region src/types/sheet.d.ts
|
|
8
8
|
/** 电子表格组件属性 */
|
|
9
9
|
export interface SheetProps {
|
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { parseRange } from '@veltra/sheet-core/core/address'
|
|
2
|
-
import { Workbook } from '@veltra/sheet-core/core/workbook'
|
|
1
|
+
import { parseRange } from '@veltra/sheet-core/core/address.js'
|
|
2
|
+
import { Workbook } from '@veltra/sheet-core/core/workbook.js'
|
|
3
3
|
import type { SheetGrid } from '@veltra/sheet-core/grid'
|
|
4
4
|
import { afterEach, describe, expect, it } from 'vitest'
|
|
5
5
|
import { createApp, h, nextTick, type App } from 'vue'
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
listFormulaFunctions,
|
|
3
3
|
registerFormulaFunction
|
|
4
|
-
} from '@veltra/sheet-core/core/formula/functions'
|
|
4
|
+
} from '@veltra/sheet-core/core/formula/functions.js'
|
|
5
5
|
import { afterEach, describe, expect, it, vi } from 'vitest'
|
|
6
6
|
import { createApp, h, nextTick, type App } from 'vue'
|
|
7
7
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { Sheet } from '@veltra/sheet-core/core/sheet'
|
|
2
|
-
import { Workbook } from '@veltra/sheet-core/core/workbook'
|
|
1
|
+
import type { Sheet } from '@veltra/sheet-core/core/sheet.js'
|
|
2
|
+
import { Workbook } from '@veltra/sheet-core/core/workbook.js'
|
|
3
3
|
import { afterEach, describe, expect, it, vi } from 'vitest'
|
|
4
4
|
import { ref } from 'vue'
|
|
5
5
|
|
|
@@ -36,7 +36,7 @@ const EMPTY_SNAPSHOT = {
|
|
|
36
36
|
|
|
37
37
|
vi.mock('@veltra/desktop', () => ({ message: mocks.message, messageConfirm: mocks.messageConfirm }))
|
|
38
38
|
|
|
39
|
-
vi.mock('@veltra/sheet-core/core/io/import', () => ({
|
|
39
|
+
vi.mock('@veltra/sheet-core/core/io/import.js', () => ({
|
|
40
40
|
importCsv: mocks.importCsv,
|
|
41
41
|
importXlsx: mocks.importXlsx,
|
|
42
42
|
replaceWorkbookWithSnapshots: mocks.replaceWorkbookWithSnapshots
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { createRange } from '@veltra/sheet-core/core/address'
|
|
2
|
-
import { Sheet } from '@veltra/sheet-core/core/sheet'
|
|
1
|
+
import { createRange } from '@veltra/sheet-core/core/address.js'
|
|
2
|
+
import { Sheet } from '@veltra/sheet-core/core/sheet.js'
|
|
3
3
|
import { describe, expect, it } from 'vitest'
|
|
4
4
|
|
|
5
5
|
import { createSheetContext } from '../../../tools/context'
|
|
@@ -101,9 +101,9 @@ import {
|
|
|
101
101
|
parseRange,
|
|
102
102
|
type CellAddress,
|
|
103
103
|
type CellRange
|
|
104
|
-
} from '@veltra/sheet-core/core/address'
|
|
105
|
-
import type { SelectionState } from '@veltra/sheet-core/core/selection'
|
|
106
|
-
import type { Sheet } from '@veltra/sheet-core/core/sheet'
|
|
104
|
+
} from '@veltra/sheet-core/core/address.js'
|
|
105
|
+
import type { SelectionState } from '@veltra/sheet-core/core/selection.js'
|
|
106
|
+
import type { Sheet } from '@veltra/sheet-core/core/sheet.js'
|
|
107
107
|
import { bem } from '@veltra/utils'
|
|
108
108
|
import {
|
|
109
109
|
computed,
|
|
@@ -3,9 +3,9 @@ import {
|
|
|
3
3
|
importCsv,
|
|
4
4
|
importXlsx,
|
|
5
5
|
replaceWorkbookWithSnapshots
|
|
6
|
-
} from '@veltra/sheet-core/core/io/import'
|
|
7
|
-
import type { Sheet, SheetSnapshot } from '@veltra/sheet-core/core/sheet'
|
|
8
|
-
import type { Workbook } from '@veltra/sheet-core/core/workbook'
|
|
6
|
+
} from '@veltra/sheet-core/core/io/import.js'
|
|
7
|
+
import type { Sheet, SheetSnapshot } from '@veltra/sheet-core/core/sheet.js'
|
|
8
|
+
import type { Workbook } from '@veltra/sheet-core/core/workbook.js'
|
|
9
9
|
import { nextFrame } from '@veltra/utils'
|
|
10
10
|
import type { Ref } from 'vue'
|
|
11
11
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { message } from '@veltra/desktop'
|
|
2
|
-
import type { SheetImageAnchor, SheetImageType } from '@veltra/sheet-core/core/image'
|
|
2
|
+
import type { SheetImageAnchor, SheetImageType } from '@veltra/sheet-core/core/image.js'
|
|
3
3
|
|
|
4
4
|
import type { SheetContext } from '../../tools/context'
|
|
5
5
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { CellRange } from '@veltra/sheet-core/core/address'
|
|
2
|
-
import type { BorderPreset } from '@veltra/sheet-core/core/style/border-presets'
|
|
3
|
-
import { BORDER_STYLE_WIDTH, type BorderLineStyle } from '@veltra/sheet-core/core/style/types'
|
|
1
|
+
import type { CellRange } from '@veltra/sheet-core/core/address.js'
|
|
2
|
+
import type { BorderPreset } from '@veltra/sheet-core/core/style/border-presets.js'
|
|
3
|
+
import { BORDER_STYLE_WIDTH, type BorderLineStyle } from '@veltra/sheet-core/core/style/types.js'
|
|
4
4
|
|
|
5
5
|
import type { SheetContext } from '../../tools/context'
|
|
6
6
|
|
|
@@ -35,14 +35,14 @@
|
|
|
35
35
|
|
|
36
36
|
<script lang="ts" setup>
|
|
37
37
|
import { UPalette } from '@veltra/desktop'
|
|
38
|
-
import type { SetCellStyleItem } from '@veltra/sheet-core/core/command/set-cell-style'
|
|
39
|
-
import { buildBorderPresetItems } from '@veltra/sheet-core/core/style/border-presets'
|
|
38
|
+
import type { SetCellStyleItem } from '@veltra/sheet-core/core/command/set-cell-style.js'
|
|
39
|
+
import { buildBorderPresetItems } from '@veltra/sheet-core/core/style/border-presets.js'
|
|
40
40
|
import {
|
|
41
41
|
BORDER_STYLE_WIDTH,
|
|
42
42
|
type BorderEdge,
|
|
43
43
|
type BorderLineStyle,
|
|
44
44
|
type CellStylePatch
|
|
45
|
-
} from '@veltra/sheet-core/core/style/types'
|
|
45
|
+
} from '@veltra/sheet-core/core/style/types.js'
|
|
46
46
|
import { bem } from '@veltra/utils'
|
|
47
47
|
import { ref } from 'vue'
|
|
48
48
|
|
|
@@ -69,7 +69,7 @@
|
|
|
69
69
|
|
|
70
70
|
<script lang="ts" setup>
|
|
71
71
|
import { UInput } from '@veltra/desktop'
|
|
72
|
-
import type { Sheet } from '@veltra/sheet-core/core/sheet'
|
|
72
|
+
import type { Sheet } from '@veltra/sheet-core/core/sheet.js'
|
|
73
73
|
import { bem } from '@veltra/utils'
|
|
74
74
|
|
|
75
75
|
import type { SheetContext } from '../../../tools/context'
|
|
@@ -47,7 +47,7 @@ import { UInput, UScroll } from '@veltra/desktop'
|
|
|
47
47
|
import {
|
|
48
48
|
listFormulaFunctions,
|
|
49
49
|
type FormulaFunctionMeta
|
|
50
|
-
} from '@veltra/sheet-core/core/formula/functions'
|
|
50
|
+
} from '@veltra/sheet-core/core/formula/functions.js'
|
|
51
51
|
import { bem } from '@veltra/utils'
|
|
52
52
|
import { computed, onMounted, ref, useTemplateRef, watch } from 'vue'
|
|
53
53
|
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
* 注意:必须用**运行时动态 import**——worker 顶层静态 import 在 vite dev 的
|
|
16
16
|
* worker 上下文中会因模块图加载顺序导致 `Workbook is not defined`(实测)。
|
|
17
17
|
*/
|
|
18
|
-
import type { SheetSnapshot } from '@veltra/sheet-core/core/sheet'
|
|
18
|
+
import type { SheetSnapshot } from '@veltra/sheet-core/core/sheet.js'
|
|
19
19
|
|
|
20
20
|
export type ImportWorkerResponse =
|
|
21
21
|
| { type: 'progress'; done: number; total: number }
|
|
@@ -31,7 +31,7 @@ self.onmessage = (e: MessageEvent<{ buffer: ArrayBuffer }>): void => {
|
|
|
31
31
|
const { buffer } = e.data
|
|
32
32
|
void (async () => {
|
|
33
33
|
try {
|
|
34
|
-
const { importXlsx } = await import('@veltra/sheet-core/core/io/import')
|
|
34
|
+
const { importXlsx } = await import('@veltra/sheet-core/core/io/import.js')
|
|
35
35
|
// 分片构建:按 10% 粒度回报进度(避免 196 条/秒的消息风暴与文字跳变过快;
|
|
36
36
|
// 模型构建段约 1s,10 次更新肉眼可见数字推进)
|
|
37
37
|
let lastPercent = -1
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { ContextmenuItem } from '@veltra/desktop'
|
|
2
|
-
import { createRange, type CellAddress, type CellRange } from '@veltra/sheet-core/core/address'
|
|
3
|
-
import type { NumFmt } from '@veltra/sheet-core/core/style/types'
|
|
2
|
+
import { createRange, type CellAddress, type CellRange } from '@veltra/sheet-core/core/address.js'
|
|
3
|
+
import type { NumFmt } from '@veltra/sheet-core/core/style/types.js'
|
|
4
4
|
import { defineComponent, h } from 'vue'
|
|
5
5
|
|
|
6
6
|
import type { SheetContext } from '../../tools/context'
|
|
@@ -54,8 +54,8 @@
|
|
|
54
54
|
<script lang="ts" setup>
|
|
55
55
|
import { contextmenu, message, messageConfirm, UIcon } from '@veltra/desktop'
|
|
56
56
|
import { ArrowLeft, ArrowRight } from '@veltra/icons/normal'
|
|
57
|
-
import type { Sheet } from '@veltra/sheet-core/core/sheet'
|
|
58
|
-
import type { Workbook } from '@veltra/sheet-core/core/workbook'
|
|
57
|
+
import type { Sheet } from '@veltra/sheet-core/core/sheet.js'
|
|
58
|
+
import type { Workbook } from '@veltra/sheet-core/core/workbook.js'
|
|
59
59
|
import { bem } from '@veltra/utils'
|
|
60
60
|
import { nextTick, ref, toRef, useTemplateRef } from 'vue'
|
|
61
61
|
|
|
@@ -3,15 +3,15 @@ import {
|
|
|
3
3
|
inferCellType,
|
|
4
4
|
normalizeInputValue,
|
|
5
5
|
type CellData
|
|
6
|
-
} from '@veltra/sheet-core/core/cell-store'
|
|
6
|
+
} from '@veltra/sheet-core/core/cell-store.js'
|
|
7
7
|
import {
|
|
8
8
|
findAll,
|
|
9
9
|
findNextFrom,
|
|
10
10
|
findPrevFrom,
|
|
11
11
|
type FindMatch,
|
|
12
12
|
type FindOptions
|
|
13
|
-
} from '@veltra/sheet-core/core/find'
|
|
14
|
-
import type { Sheet } from '@veltra/sheet-core/core/sheet'
|
|
13
|
+
} from '@veltra/sheet-core/core/find.js'
|
|
14
|
+
import type { Sheet } from '@veltra/sheet-core/core/sheet.js'
|
|
15
15
|
import { computed, ref, shallowRef, watch } from 'vue'
|
|
16
16
|
|
|
17
17
|
import type { SheetContext } from '../../tools/context'
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { contextmenu } from '@veltra/desktop'
|
|
2
|
-
import type { CellAddress, CellRange } from '@veltra/sheet-core/core/address'
|
|
3
|
-
import type { Sheet } from '@veltra/sheet-core/core/sheet'
|
|
2
|
+
import type { CellAddress, CellRange } from '@veltra/sheet-core/core/address.js'
|
|
3
|
+
import type { Sheet } from '@veltra/sheet-core/core/sheet.js'
|
|
4
4
|
import { SheetGrid, type SheetGridContextMenuInfo } from '@veltra/sheet-core/grid'
|
|
5
5
|
import { onBeforeUnmount, onMounted, watch } from 'vue'
|
|
6
6
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { Sheet } from '@veltra/sheet-core/core/sheet'
|
|
2
|
-
import { Workbook } from '@veltra/sheet-core/core/workbook'
|
|
1
|
+
import type { Sheet } from '@veltra/sheet-core/core/sheet.js'
|
|
2
|
+
import { Workbook } from '@veltra/sheet-core/core/workbook.js'
|
|
3
3
|
import { computed, onBeforeUnmount, onMounted, ref, shallowRef, watch } from 'vue'
|
|
4
4
|
|
|
5
5
|
import { createSheetContext } from '../../tools/context'
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { createRange } from '@veltra/sheet-core/core/address'
|
|
2
|
-
import { Sheet } from '@veltra/sheet-core/core/sheet'
|
|
1
|
+
import { createRange } from '@veltra/sheet-core/core/address.js'
|
|
2
|
+
import { Sheet } from '@veltra/sheet-core/core/sheet.js'
|
|
3
3
|
import { describe, expect, it } from 'vitest'
|
|
4
4
|
|
|
5
5
|
import { classifySelectionStyleTarget, type SelectionStyleTarget } from '../apply-style'
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { createRange } from '@veltra/sheet-core/core/address'
|
|
1
|
+
import { createRange } from '@veltra/sheet-core/core/address.js'
|
|
2
2
|
|
|
3
3
|
import '../builtin'
|
|
4
|
-
import { Sheet } from '@veltra/sheet-core/core/sheet'
|
|
5
|
-
import { Workbook } from '@veltra/sheet-core/core/workbook'
|
|
4
|
+
import { Sheet } from '@veltra/sheet-core/core/sheet.js'
|
|
5
|
+
import { Workbook } from '@veltra/sheet-core/core/workbook.js'
|
|
6
6
|
import { describe, expect, it, vi } from 'vitest'
|
|
7
7
|
|
|
8
8
|
import { createSheetContext } from '../context'
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { createRange } from '@veltra/sheet-core/core/address'
|
|
2
|
-
import { Sheet } from '@veltra/sheet-core/core/sheet'
|
|
1
|
+
import { createRange } from '@veltra/sheet-core/core/address.js'
|
|
2
|
+
import { Sheet } from '@veltra/sheet-core/core/sheet.js'
|
|
3
3
|
import { describe, expect, it, vi } from 'vitest'
|
|
4
4
|
|
|
5
5
|
import { createSheetContext } from '../context'
|
package/src/tools/apply-style.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { CellRange } from '@veltra/sheet-core/core/address'
|
|
2
|
-
import type { SetAxisStyleItem } from '@veltra/sheet-core/core/command/set-axis-style'
|
|
3
|
-
import type { CellStylePatch } from '@veltra/sheet-core/core/style/types'
|
|
1
|
+
import type { CellRange } from '@veltra/sheet-core/core/address.js'
|
|
2
|
+
import type { SetAxisStyleItem } from '@veltra/sheet-core/core/command/set-axis-style.js'
|
|
3
|
+
import type { CellStylePatch } from '@veltra/sheet-core/core/style/types.js'
|
|
4
4
|
|
|
5
5
|
/** 样式写入目标:整行 / 整列默认样式,或逐格 */
|
|
6
6
|
export type SelectionStyleTarget = 'row' | 'col' | 'cell'
|
package/src/tools/builtin.ts
CHANGED
|
@@ -24,8 +24,8 @@ import {
|
|
|
24
24
|
VerticalAlignRight,
|
|
25
25
|
Wrap
|
|
26
26
|
} from '@veltra/icons/normal'
|
|
27
|
-
import { rangesEqual } from '@veltra/sheet-core/core/address'
|
|
28
|
-
import type { HorizontalAlign, VerticalAlign } from '@veltra/sheet-core/core/style/types'
|
|
27
|
+
import { rangesEqual } from '@veltra/sheet-core/core/address.js'
|
|
28
|
+
import type { HorizontalAlign, VerticalAlign } from '@veltra/sheet-core/core/style/types.js'
|
|
29
29
|
|
|
30
30
|
import type { SheetContext } from './context'
|
|
31
31
|
import { registerTool } from './registry'
|
package/src/tools/context.ts
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import type { CellAddress, CellRange } from '@veltra/sheet-core/core/address'
|
|
2
|
-
import type { CellData, CellValue } from '@veltra/sheet-core/core/cell-store'
|
|
3
|
-
import type { HistoryState } from '@veltra/sheet-core/core/command/history'
|
|
4
|
-
import type { ImageUpdateFields } from '@veltra/sheet-core/core/command/image'
|
|
5
|
-
import type { SetCellValueItem } from '@veltra/sheet-core/core/command/set-cell-value'
|
|
6
|
-
import type { ImageInput, SheetImage } from '@veltra/sheet-core/core/image'
|
|
7
|
-
import type { CellInfo } from '@veltra/sheet-core/core/merge-manager'
|
|
8
|
-
import type { SelectionState } from '@veltra/sheet-core/core/selection'
|
|
9
|
-
import type { FrozenState, Sheet } from '@veltra/sheet-core/core/sheet'
|
|
10
|
-
import type { CellStyle, CellStylePatch } from '@veltra/sheet-core/core/style/types'
|
|
11
|
-
import type { Workbook } from '@veltra/sheet-core/core/workbook'
|
|
1
|
+
import type { CellAddress, CellRange } from '@veltra/sheet-core/core/address.js'
|
|
2
|
+
import type { CellData, CellValue } from '@veltra/sheet-core/core/cell-store.js'
|
|
3
|
+
import type { HistoryState } from '@veltra/sheet-core/core/command/history.js'
|
|
4
|
+
import type { ImageUpdateFields } from '@veltra/sheet-core/core/command/image.js'
|
|
5
|
+
import type { SetCellValueItem } from '@veltra/sheet-core/core/command/set-cell-value.js'
|
|
6
|
+
import type { ImageInput, SheetImage } from '@veltra/sheet-core/core/image.js'
|
|
7
|
+
import type { CellInfo } from '@veltra/sheet-core/core/merge-manager.js'
|
|
8
|
+
import type { SelectionState } from '@veltra/sheet-core/core/selection.js'
|
|
9
|
+
import type { FrozenState, Sheet } from '@veltra/sheet-core/core/sheet.js'
|
|
10
|
+
import type { CellStyle, CellStylePatch } from '@veltra/sheet-core/core/style/types.js'
|
|
11
|
+
import type { Workbook } from '@veltra/sheet-core/core/workbook.js'
|
|
12
12
|
|
|
13
13
|
import { axisStyleItemsForRange, classifySelectionStyleTarget } from './apply-style'
|
|
14
14
|
|
package/src/tools/download.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { saveBlob } from '@cat-kit/fe'
|
|
2
|
-
import { exportSheetCsv, exportWorkbookXlsx } from '@veltra/sheet-core/core/io/export'
|
|
3
|
-
import type { Workbook } from '@veltra/sheet-core/core/workbook'
|
|
2
|
+
import { exportSheetCsv, exportWorkbookXlsx } from '@veltra/sheet-core/core/io/export.js'
|
|
3
|
+
import type { Workbook } from '@veltra/sheet-core/core/workbook.js'
|
|
4
4
|
|
|
5
5
|
import type { SheetContext } from './context'
|
|
6
6
|
import type { ExportWorkerPayload, ExportWorkerResponse } from './export.worker'
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
* 静态 import 在 vite dev 的 worker 上下文中会因模块图加载顺序导致
|
|
13
13
|
* `Workbook is not defined`(实测)。
|
|
14
14
|
*/
|
|
15
|
-
import type { SheetSnapshot } from '@veltra/sheet-core/core/sheet'
|
|
15
|
+
import type { SheetSnapshot } from '@veltra/sheet-core/core/sheet.js'
|
|
16
16
|
|
|
17
17
|
export interface ExportWorkerPayload {
|
|
18
18
|
sheets: { name: string; snapshot: SheetSnapshot }[]
|
|
@@ -27,8 +27,8 @@ export interface ExportWorkerResponse {
|
|
|
27
27
|
|
|
28
28
|
self.onmessage = (e: MessageEvent<ExportWorkerPayload>): void => {
|
|
29
29
|
void Promise.all([
|
|
30
|
-
import('@veltra/sheet-core/core/io/export'),
|
|
31
|
-
import('@veltra/sheet-core/core/workbook')
|
|
30
|
+
import('@veltra/sheet-core/core/io/export.js'),
|
|
31
|
+
import('@veltra/sheet-core/core/workbook.js')
|
|
32
32
|
])
|
|
33
33
|
.then(([{ exportWorkbookXlsx }, { Workbook }]) => {
|
|
34
34
|
const wb = new Workbook()
|
package/src/tools/registry.ts
CHANGED
package/src/types/sheet.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { Sheet } from '@veltra/sheet-core/core/sheet'
|
|
2
|
-
import type { Workbook } from '@veltra/sheet-core/core/workbook'
|
|
1
|
+
import type { Sheet } from '@veltra/sheet-core/core/sheet.js'
|
|
2
|
+
import type { Workbook } from '@veltra/sheet-core/core/workbook.js'
|
|
3
3
|
import type {
|
|
4
4
|
ResolveCellRenderer,
|
|
5
5
|
ResolveCellStyleHook,
|