@veltra/sheet 2.1.1 → 2.2.0
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/report/binding-badge.js +76 -0
- package/dist/components/report/designer/cell-coords.js +46 -0
- package/dist/components/report/designer/col-widths.js +15 -0
- package/dist/components/report/designer/conditional-rules/helpers.js +139 -0
- package/dist/components/report/designer/drop-highlight-overlay.js +76 -0
- package/dist/components/report/designer/float-panel.js +385 -0
- package/dist/components/report/designer/role.js +17 -0
- package/dist/components/report/designer/rule-preview.js +33 -0
- package/dist/components/report/designer/rule-row.js +269 -0
- package/dist/components/report/designer/rules-dialog.js +135 -0
- package/dist/components/report/designer/topology-overlay.js +122 -0
- package/dist/components/report/designer/topology.js +64 -0
- package/dist/components/report/designer/use-grid-overlay.js +75 -0
- package/dist/components/report/designer-hub.js +177 -0
- package/dist/components/report/field-panel-helpers.js +33 -0
- package/dist/components/report/field-panel.js +132 -0
- package/dist/components/report/filter-bar.js +74 -0
- package/dist/components/report/hub-connection-form.js +145 -0
- package/dist/components/report/hub-dataset-editor.js +394 -0
- package/dist/components/report/report-designer.js +343 -0
- package/dist/components/report/report-viewer.js +111 -0
- package/dist/components/report/style.d.ts +17 -0
- package/dist/components/report/style.js +18 -0
- package/dist/components/report/style2.css +869 -0
- package/dist/components/report/use-report-designer.js +360 -0
- package/dist/components/report/use-report-viewer.js +50 -0
- package/dist/{vue → components/sheet}/formula-bar.js +1 -1
- package/dist/{vue → components/sheet}/formula-suggest-list.js +1 -1
- package/dist/{vue → components/sheet}/import-file.js +1 -1
- package/dist/{vue → components/sheet}/insert-count-menu-item.js +1 -1
- package/dist/{vue → components/sheet}/insert-image.js +1 -1
- package/dist/{vue → components/sheet}/popup-helpers.js +1 -1
- package/dist/{vue → components/sheet}/popups/border-popup.js +1 -1
- package/dist/{vue → components/sheet}/popups/border-preset-glyph.js +1 -1
- package/dist/{vue → components/sheet}/popups/export-popup.js +2 -2
- package/dist/{vue → components/sheet}/popups/fill-color-popup.js +1 -1
- package/dist/{vue → components/sheet}/popups/find-popup.js +1 -1
- package/dist/{vue → components/sheet}/popups/font-color-popup.js +1 -1
- package/dist/{vue → components/sheet}/popups/font-size-popup.js +1 -1
- package/dist/{vue → components/sheet}/popups/import.worker.d.ts +1 -1
- package/dist/{vue → components/sheet}/popups/import.worker.js +1 -1
- package/dist/{vue → components/sheet}/popups/insert-image-popup.js +1 -1
- package/dist/{vue → components/sheet}/sheet-context-menu.js +1 -1
- package/dist/{vue → components/sheet}/sheet-tabs.js +1 -1
- package/dist/{vue → components/sheet}/sheet-toolbar.js +1 -1
- package/dist/{vue → components/sheet}/sheet.js +8 -1
- package/dist/{vue → components/sheet}/use-find-replace.js +1 -1
- package/dist/{vue → components/sheet}/use-formula-ref-select.js +1 -1
- package/dist/{vue → components/sheet}/use-sheet-grid.js +10 -2
- package/dist/{vue → components/sheet}/use-sheet-state.js +3 -3
- package/dist/{vue → components/sheet}/use-sheet-tabs-bar.js +1 -1
- package/dist/{vue → components/sheet}/use-tool-groups.js +2 -2
- package/dist/{vue → components/sheet}/use-tool-popup.js +2 -2
- package/dist/{vue → components/sheet}/use-toolbar-scroll.js +1 -1
- package/dist/index.d.ts +17 -3
- package/dist/index.js +13 -3
- package/dist/report/binding.d.ts +45 -0
- package/dist/report/binding.js +175 -0
- package/dist/report/connector.d.ts +66 -0
- package/dist/report/connector.js +159 -0
- package/dist/report/export-xlsx.d.ts +19 -0
- package/dist/report/export-xlsx.js +95 -0
- package/dist/report/filter-bar.d.ts +10 -0
- package/dist/report/filter-bar.js +31 -0
- package/dist/report/index.d.ts +12 -0
- package/dist/report/params.d.ts +13 -0
- package/dist/report/params.js +61 -0
- package/dist/report/render/aggregate.js +157 -0
- package/dist/report/render/builder.d.ts +12 -0
- package/dist/report/render/builder.js +139 -0
- package/dist/report/render/coordinate.d.ts +25 -0
- package/dist/report/render/coordinate.js +733 -0
- package/dist/report/render/index.d.ts +14 -0
- package/dist/report/render/index.js +21 -0
- package/dist/report/render/style-resolver.js +50 -0
- package/dist/report/render/template-index.d.ts +24 -0
- package/dist/report/render/template-index.js +137 -0
- package/dist/report/rules/evaluate.d.ts +25 -0
- package/dist/report/rules/evaluate.js +82 -0
- package/dist/report/rules/index.d.ts +2 -0
- package/dist/report/template.d.ts +59 -0
- package/dist/report/template.js +80 -0
- package/dist/report/types.d.ts +85 -0
- package/dist/tools/context.d.ts +1 -1
- package/dist/types/index.d.ts +3 -2
- package/dist/types/report-designer.d.ts +36 -0
- package/dist/types/report-viewer.d.ts +38 -0
- package/dist/types/sheet.d.ts +17 -1
- package/package.json +3 -5
- package/src/components/report/__test__/conditional-rules-helpers.test.ts +87 -0
- package/src/components/report/__test__/field-panel-helpers.test.ts +65 -0
- package/src/components/report/__test__/float-panel-position.test.ts +45 -0
- package/src/components/report/__test__/report-designer.test.ts +388 -0
- package/src/components/report/__test__/report-viewer.test.ts +334 -0
- package/src/components/report/__test__/topology.test.ts +143 -0
- package/src/components/report/__test__/use-report-designer.test.ts +565 -0
- package/src/components/report/binding-badge.ts +73 -0
- package/src/components/report/designer/cell-coords.ts +94 -0
- package/src/components/report/designer/col-widths.ts +33 -0
- package/src/components/report/designer/conditional-rules/helpers.ts +186 -0
- package/src/components/report/designer/drop-highlight-overlay.vue +74 -0
- package/src/components/report/designer/float-panel.vue +387 -0
- package/src/components/report/designer/role.ts +32 -0
- package/src/components/report/designer/rule-preview.vue +40 -0
- package/src/components/report/designer/rule-row.vue +252 -0
- package/src/components/report/designer/rules-dialog.vue +126 -0
- package/src/components/report/designer/topology-overlay.vue +127 -0
- package/src/components/report/designer/topology.ts +124 -0
- package/src/components/report/designer/use-grid-overlay.ts +113 -0
- package/src/components/report/designer-hub.vue +198 -0
- package/src/components/report/field-panel-helpers.ts +44 -0
- package/src/components/report/field-panel.vue +136 -0
- package/src/components/report/filter-bar.vue +77 -0
- package/src/components/report/hub-connection-form.vue +124 -0
- package/src/components/report/hub-dataset-editor.vue +369 -0
- package/src/components/report/index.ts +2 -0
- package/src/components/report/report-designer.vue +356 -0
- package/src/components/report/report-viewer.vue +128 -0
- package/src/components/report/style-designer.scss +583 -0
- package/src/components/report/style-hub.scss +292 -0
- package/src/components/report/style-viewer.scss +104 -0
- package/src/components/report/style.scss +3 -0
- package/src/components/report/style.ts +20 -0
- package/src/components/report/use-report-designer.ts +547 -0
- package/src/components/report/use-report-viewer.ts +79 -0
- package/src/{vue → components/sheet}/__test__/formula-bar.test.ts +37 -18
- package/src/{vue → components/sheet}/__test__/insert-image-popup.test.ts +1 -1
- package/src/{vue → components/sheet}/__test__/insert-image.test.ts +1 -1
- package/src/{vue → components/sheet}/__test__/sheet-component.test.ts +40 -3
- package/src/{vue → components/sheet}/__test__/sheet-context-menu.test.ts +1 -1
- package/src/{vue → components/sheet}/formula-bar.vue +1 -1
- package/src/{vue → components/sheet}/insert-image.ts +1 -1
- package/src/{vue → components/sheet}/popup-helpers.ts +1 -1
- package/src/{vue → components/sheet}/popups/border-popup.vue +1 -1
- package/src/{vue → components/sheet}/popups/export-popup.vue +2 -2
- package/src/{vue → components/sheet}/popups/fill-color-popup.vue +1 -1
- package/src/{vue → components/sheet}/popups/find-popup.vue +1 -1
- package/src/{vue → components/sheet}/popups/font-color-popup.vue +1 -1
- package/src/{vue → components/sheet}/popups/font-size-popup.vue +1 -1
- package/src/{vue → components/sheet}/popups/insert-image-popup.vue +1 -1
- package/src/{vue → components/sheet}/sheet-context-menu.ts +2 -2
- package/src/{vue → components/sheet}/sheet-toolbar.vue +2 -2
- package/src/{vue → components/sheet}/sheet.vue +4 -3
- package/src/{vue → components/sheet}/use-find-replace.ts +1 -1
- package/src/{vue → components/sheet}/use-sheet-grid.ts +7 -3
- package/src/{vue → components/sheet}/use-sheet-state.ts +3 -3
- package/src/{vue → components/sheet}/use-tool-groups.ts +2 -2
- package/src/{vue → components/sheet}/use-tool-popup.ts +2 -2
- package/src/index.ts +24 -188
- package/src/report/__test__/binding.test.ts +218 -0
- package/src/report/__test__/connector.test.ts +218 -0
- package/src/report/__test__/export-xlsx.test.ts +118 -0
- package/src/report/__test__/filter-bar.test.ts +58 -0
- package/src/report/__test__/params.test.ts +156 -0
- package/src/report/__test__/render.test.ts +728 -0
- package/src/report/__test__/rules.test.ts +131 -0
- package/src/report/__test__/template.test.ts +355 -0
- package/src/report/binding.ts +243 -0
- package/src/report/connector.ts +205 -0
- package/src/report/export-xlsx.ts +118 -0
- package/src/report/filter-bar.ts +36 -0
- package/src/report/index.ts +13 -0
- package/src/report/params.ts +96 -0
- package/src/report/render/__test__/aggregate.test.ts +16 -0
- package/src/report/render/__test__/coordinate.test.ts +405 -0
- package/src/report/render/aggregate.ts +240 -0
- package/src/report/render/builder.ts +211 -0
- package/src/report/render/coordinate.ts +1239 -0
- package/src/report/render/index.ts +30 -0
- package/src/report/render/style-resolver.ts +68 -0
- package/src/report/render/template-index.ts +200 -0
- package/src/report/rules/evaluate.ts +113 -0
- package/src/report/rules/index.ts +7 -0
- package/src/report/template.ts +141 -0
- package/src/report/types.ts +96 -0
- package/src/tools/builtin.ts +2 -2
- package/src/types/index.ts +2 -6
- package/src/types/report-designer.ts +36 -0
- package/src/types/report-viewer.ts +37 -0
- package/src/types/sheet.ts +22 -1
- /package/dist/{vue → components/sheet}/style.d.ts +0 -0
- /package/dist/{vue → components/sheet}/style.js +0 -0
- /package/dist/{vue → components/sheet}/style2.css +0 -0
- /package/dist/{vue → components/sheet}/use-formula-suggest.js +0 -0
- /package/src/{vue → components/sheet}/__test__/import-file.test.ts +0 -0
- /package/src/{vue → components/sheet}/__test__/insert-count-menu-item.test.ts +0 -0
- /package/src/{vue → components/sheet}/__test__/use-formula-ref-select.test.ts +0 -0
- /package/src/{vue → components/sheet}/__test__/use-formula-suggest.test.ts +0 -0
- /package/src/{vue → components/sheet}/formula-suggest-list.vue +0 -0
- /package/src/{vue → components/sheet}/import-file.ts +0 -0
- /package/src/{vue → components/sheet}/index.ts +0 -0
- /package/src/{vue → components/sheet}/insert-count-menu-item.vue +0 -0
- /package/src/{vue → components/sheet}/parsing.ts +0 -0
- /package/src/{vue → components/sheet}/popups/border-preset-glyph.vue +0 -0
- /package/src/{vue → components/sheet}/popups/import.worker.ts +0 -0
- /package/src/{vue → components/sheet}/sheet-tabs.vue +0 -0
- /package/src/{vue → components/sheet}/style.scss +0 -0
- /package/src/{vue → components/sheet}/style.ts +0 -0
- /package/src/{vue → components/sheet}/use-formula-ref-select.ts +0 -0
- /package/src/{vue → components/sheet}/use-formula-suggest.ts +0 -0
- /package/src/{vue → components/sheet}/use-sheet-tabs-bar.ts +0 -0
- /package/src/{vue → components/sheet}/use-toolbar-scroll.ts +0 -0
|
@@ -1,10 +1,12 @@
|
|
|
1
|
+
import { parseRange } from '@veltra/sheet-core/core/address'
|
|
1
2
|
import { Workbook } from '@veltra/sheet-core/core/workbook'
|
|
2
|
-
import { ListTable } from '@visactor/vtable'
|
|
3
3
|
import { afterEach, describe, expect, it } from 'vitest'
|
|
4
4
|
import { createApp, h, nextTick, type App } from 'vue'
|
|
5
5
|
|
|
6
|
-
import { USheet } from '
|
|
7
|
-
import
|
|
6
|
+
import { USheet } from '../../../index'
|
|
7
|
+
import { createSheetContext } from '../../../tools/context'
|
|
8
|
+
import type { SheetExposed } from '../../../types'
|
|
9
|
+
import UFormulaBar from '../formula-bar.vue'
|
|
8
10
|
|
|
9
11
|
const apps: App[] = []
|
|
10
12
|
const containers: HTMLElement[] = []
|
|
@@ -32,6 +34,26 @@ function mount(
|
|
|
32
34
|
return { app, el }
|
|
33
35
|
}
|
|
34
36
|
|
|
37
|
+
function mountFormulaBar(sheet: Workbook['activeSheet']) {
|
|
38
|
+
const el = document.createElement('div')
|
|
39
|
+
document.body.appendChild(el)
|
|
40
|
+
containers.push(el)
|
|
41
|
+
const exposed: { value: InstanceType<typeof UFormulaBar> | undefined } = { value: undefined }
|
|
42
|
+
const app = createApp({
|
|
43
|
+
render: () =>
|
|
44
|
+
h(UFormulaBar, {
|
|
45
|
+
sheet,
|
|
46
|
+
context: createSheetContext(sheet),
|
|
47
|
+
ref: (value: unknown) => {
|
|
48
|
+
exposed.value = value as InstanceType<typeof UFormulaBar> | undefined
|
|
49
|
+
}
|
|
50
|
+
})
|
|
51
|
+
})
|
|
52
|
+
app.mount(el)
|
|
53
|
+
apps.push(app)
|
|
54
|
+
return { el, exposed }
|
|
55
|
+
}
|
|
56
|
+
|
|
35
57
|
function createWorkbook() {
|
|
36
58
|
const workbook = new Workbook()
|
|
37
59
|
workbook.addSheet('Sheet2')
|
|
@@ -397,15 +419,16 @@ describe('USheet 公式栏:函数补全与引用选择', () => {
|
|
|
397
419
|
expect(sheet.getCellData({ row: 2, col: 0 })).toBeUndefined()
|
|
398
420
|
expect(input.value).toBe('=SUM(')
|
|
399
421
|
|
|
400
|
-
//
|
|
401
|
-
const
|
|
402
|
-
table.selectCells([{ start: { col: 1, row: 1 }, end: { col: 2, row: 2 } }])
|
|
403
|
-
table.fireListeners(ListTable.EVENT_TYPE.SELECTED_CELL, { col: 2, row: 2 })
|
|
422
|
+
// 网格选区拦截 → handleRefSelect 路径(VTable 时序见 sheet-core selection-debug)
|
|
423
|
+
const { el: barEl, exposed: barExposed } = mountFormulaBar(sheet)
|
|
404
424
|
await nextTick()
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
425
|
+
setFxText(barEl, '=SUM(')
|
|
426
|
+
await nextTick()
|
|
427
|
+
barExposed.value!.handleRefSelect(parseRange('A1:B2'))
|
|
428
|
+
await nextTick()
|
|
429
|
+
const barInput = fxInput(barEl)
|
|
430
|
+
expect(barInput.value).toBe('=SUM(A1:B2')
|
|
431
|
+
expect(barInput.selectionStart).toBe('=SUM(A1:B2'.length)
|
|
409
432
|
|
|
410
433
|
// 非引用选择场景失焦提交
|
|
411
434
|
setFxText(el, 'plain')
|
|
@@ -436,19 +459,15 @@ describe('USheet 公式栏:函数补全与引用选择', () => {
|
|
|
436
459
|
})
|
|
437
460
|
|
|
438
461
|
it('连续引用选择:=A1+ 后再插入 B1', async () => {
|
|
439
|
-
const
|
|
440
|
-
const
|
|
441
|
-
const exposed: { value: SheetExposed | undefined } = { value: undefined }
|
|
442
|
-
const { el } = mount(() => ({ workbook, rows: 20, cols: 8 }), exposed)
|
|
462
|
+
const sheet = new Workbook().activeSheet
|
|
463
|
+
const { el, exposed } = mountFormulaBar(sheet)
|
|
443
464
|
await nextTick()
|
|
444
465
|
sheet.selectCell({ row: 2, col: 0 })
|
|
445
466
|
await nextTick()
|
|
446
467
|
|
|
447
468
|
setFxText(el, '=A1+')
|
|
448
469
|
await nextTick()
|
|
449
|
-
|
|
450
|
-
table.selectCells([{ start: { col: 2, row: 1 }, end: { col: 2, row: 1 } }])
|
|
451
|
-
table.fireListeners(ListTable.EVENT_TYPE.SELECTED_CELL, { col: 2, row: 1 })
|
|
470
|
+
exposed.value!.handleRefSelect(parseRange('B1'))
|
|
452
471
|
await nextTick()
|
|
453
472
|
expect(fxInput(el).value).toBe('=A1+B1')
|
|
454
473
|
})
|
|
@@ -2,7 +2,7 @@ import { Sheet } from '@veltra/sheet-core/core/sheet'
|
|
|
2
2
|
import { afterEach, describe, expect, it, vi } from 'vitest'
|
|
3
3
|
import { createApp, h, type App } from 'vue'
|
|
4
4
|
|
|
5
|
-
import { createSheetContext } from '
|
|
5
|
+
import { createSheetContext } from '../../../tools/context'
|
|
6
6
|
import USheetInsertImagePopup from '../popups/insert-image-popup.vue'
|
|
7
7
|
|
|
8
8
|
const mocks = vi.hoisted(() => {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Sheet } from '@veltra/sheet-core/core/sheet'
|
|
2
2
|
import { afterEach, describe, expect, it, vi } from 'vitest'
|
|
3
3
|
|
|
4
|
-
import { createSheetContext } from '
|
|
4
|
+
import { createSheetContext } from '../../../tools/context'
|
|
5
5
|
import {
|
|
6
6
|
INSERT_IMAGE_ACCEPT,
|
|
7
7
|
insertImageFromFile,
|
|
@@ -2,9 +2,9 @@ import { Workbook } from '@veltra/sheet-core/core/workbook'
|
|
|
2
2
|
import { afterEach, describe, expect, it, vi } from 'vitest'
|
|
3
3
|
import { createApp, h, nextTick, ref, type App } from 'vue'
|
|
4
4
|
|
|
5
|
-
import { USheet } from '
|
|
6
|
-
import { registerTool, unregisterTool } from '
|
|
7
|
-
import type { SheetExposed } from '
|
|
5
|
+
import { USheet } from '../../../index'
|
|
6
|
+
import { registerTool, unregisterTool } from '../../../tools/registry'
|
|
7
|
+
import type { SheetExposed } from '../../../types'
|
|
8
8
|
|
|
9
9
|
const apps: App[] = []
|
|
10
10
|
const containers: HTMLElement[] = []
|
|
@@ -258,6 +258,43 @@ describe('USheet 组件', () => {
|
|
|
258
258
|
expect(gridAfter).not.toBe(gridBefore)
|
|
259
259
|
})
|
|
260
260
|
|
|
261
|
+
it('resolveCellStyle prop 传入 SheetGrid 视口渲染', async () => {
|
|
262
|
+
const workbook = createWorkbook()
|
|
263
|
+
const sheet = workbook.activeSheet
|
|
264
|
+
const exposed: { value: SheetExposed | undefined } = { value: undefined }
|
|
265
|
+
mount(
|
|
266
|
+
() => ({
|
|
267
|
+
workbook,
|
|
268
|
+
rows: 10,
|
|
269
|
+
cols: 6,
|
|
270
|
+
resolveCellStyle: (
|
|
271
|
+
addr: { row: number; col: number },
|
|
272
|
+
baseStyle?: { fill?: { color: string } }
|
|
273
|
+
) => {
|
|
274
|
+
if (addr.row === 1 && addr.col === 1) {
|
|
275
|
+
return { ...baseStyle, fill: { color: '#FFE0E0' } }
|
|
276
|
+
}
|
|
277
|
+
return baseStyle
|
|
278
|
+
}
|
|
279
|
+
}),
|
|
280
|
+
exposed
|
|
281
|
+
)
|
|
282
|
+
await nextTick()
|
|
283
|
+
|
|
284
|
+
const addr = { row: 1, col: 1 }
|
|
285
|
+
sheet.setCellStyle({ start: addr, end: addr }, { fill: { color: '#CCCCCC' } })
|
|
286
|
+
await nextTick()
|
|
287
|
+
|
|
288
|
+
const table = exposed.value?.getGrid()?.getTable()
|
|
289
|
+
expect(table).toBeDefined()
|
|
290
|
+
const column = table!.getBodyColumnDefine(2, 2) as {
|
|
291
|
+
style?: (arg: { row: number; col: number; table: unknown }) => Record<string, unknown>
|
|
292
|
+
}
|
|
293
|
+
const rendered = column.style!({ row: 2, col: 2, table })
|
|
294
|
+
expect(rendered.bgColor).toBe('#FFE0E0')
|
|
295
|
+
expect(sheet.getCellStyle(addr)?.fill?.color).toBe('#CCCCCC')
|
|
296
|
+
})
|
|
297
|
+
|
|
261
298
|
it('workbook prop 变更:tabs 与 grid 切到新工作簿', async () => {
|
|
262
299
|
const workbook1 = createWorkbook()
|
|
263
300
|
const workbook2 = new Workbook()
|
|
@@ -2,7 +2,7 @@ import { createRange } from '@veltra/sheet-core/core/address'
|
|
|
2
2
|
import { Sheet } from '@veltra/sheet-core/core/sheet'
|
|
3
3
|
import { describe, expect, it } from 'vitest'
|
|
4
4
|
|
|
5
|
-
import { createSheetContext } from '
|
|
5
|
+
import { createSheetContext } from '../../../tools/context'
|
|
6
6
|
import {
|
|
7
7
|
buildBodyMenus,
|
|
8
8
|
buildColHeaderMenus,
|
|
@@ -86,7 +86,7 @@ import {
|
|
|
86
86
|
watch
|
|
87
87
|
} from 'vue'
|
|
88
88
|
|
|
89
|
-
import type { SheetContext } from '
|
|
89
|
+
import type { SheetContext } from '../../tools/context'
|
|
90
90
|
import UFormulaSuggestList from './formula-suggest-list.vue'
|
|
91
91
|
import { insertRefText, isRefSelectContext } from './use-formula-ref-select'
|
|
92
92
|
import {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { message } from '@veltra/desktop'
|
|
2
2
|
import type { SheetImageType } from '@veltra/sheet-core/core/image'
|
|
3
3
|
|
|
4
|
-
import type { SheetContext } from '
|
|
4
|
+
import type { SheetContext } from '../../tools/context'
|
|
5
5
|
|
|
6
6
|
/** 文件选择 accept(工具栏弹层与右键菜单共用;不用裸 image/*) */
|
|
7
7
|
export const INSERT_IMAGE_ACCEPT = '.png,.jpg,.jpeg,.gif,.svg,.webp'
|
|
@@ -2,7 +2,7 @@ import type { CellRange } from '@veltra/sheet-core/core/address'
|
|
|
2
2
|
import type { BorderPreset } from '@veltra/sheet-core/core/style/border-presets'
|
|
3
3
|
import { BORDER_STYLE_WIDTH, type BorderLineStyle } from '@veltra/sheet-core/core/style/types'
|
|
4
4
|
|
|
5
|
-
import type { SheetContext } from '
|
|
5
|
+
import type { SheetContext } from '../../tools/context'
|
|
6
6
|
|
|
7
7
|
/** 当前选区(ranges[0] 优先;无区域选区时用活动格单格) */
|
|
8
8
|
export function currentRange(context: SheetContext): CellRange | null {
|
|
@@ -13,8 +13,8 @@
|
|
|
13
13
|
import { message } from '@veltra/desktop'
|
|
14
14
|
import { bem } from '@veltra/utils'
|
|
15
15
|
|
|
16
|
-
import type { SheetContext } from '
|
|
17
|
-
import { exportSheetCsvFile, exportWorkbookFile } from '
|
|
16
|
+
import type { SheetContext } from '../../../tools/context'
|
|
17
|
+
import { exportSheetCsvFile, exportWorkbookFile } from '../../../tools/download'
|
|
18
18
|
|
|
19
19
|
defineOptions({ name: 'USheetExportPopup' })
|
|
20
20
|
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
import { UPalette } from '@veltra/desktop'
|
|
7
7
|
import { onMounted, ref } from 'vue'
|
|
8
8
|
|
|
9
|
-
import type { SheetContext } from '
|
|
9
|
+
import type { SheetContext } from '../../../tools/context'
|
|
10
10
|
import { currentRange } from '../popup-helpers'
|
|
11
11
|
|
|
12
12
|
defineOptions({ name: 'USheetFillColorPopup' })
|
|
@@ -72,7 +72,7 @@ import { UInput } from '@veltra/desktop'
|
|
|
72
72
|
import type { Sheet } from '@veltra/sheet-core/core/sheet'
|
|
73
73
|
import { bem } from '@veltra/utils'
|
|
74
74
|
|
|
75
|
-
import type { SheetContext } from '
|
|
75
|
+
import type { SheetContext } from '../../../tools/context'
|
|
76
76
|
import { useFindReplace } from '../use-find-replace'
|
|
77
77
|
|
|
78
78
|
defineOptions({ name: 'USheetFindPopup' })
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
import { UPalette } from '@veltra/desktop'
|
|
7
7
|
import { onMounted, ref } from 'vue'
|
|
8
8
|
|
|
9
|
-
import type { SheetContext } from '
|
|
9
|
+
import type { SheetContext } from '../../../tools/context'
|
|
10
10
|
import { currentRange } from '../popup-helpers'
|
|
11
11
|
|
|
12
12
|
defineOptions({ name: 'USheetFontColorPopup' })
|
|
@@ -20,7 +20,7 @@ import { UScroll } from '@veltra/desktop'
|
|
|
20
20
|
import { bem } from '@veltra/utils'
|
|
21
21
|
import { onMounted, ref } from 'vue'
|
|
22
22
|
|
|
23
|
-
import type { SheetContext } from '
|
|
23
|
+
import type { SheetContext } from '../../../tools/context'
|
|
24
24
|
import { currentRange } from '../popup-helpers'
|
|
25
25
|
|
|
26
26
|
defineOptions({ name: 'USheetFontSizePopup' })
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
import { UFilePicker } from '@veltra/desktop'
|
|
16
16
|
import { bem } from '@veltra/utils'
|
|
17
17
|
|
|
18
|
-
import type { SheetContext } from '
|
|
18
|
+
import type { SheetContext } from '../../../tools/context'
|
|
19
19
|
import { INSERT_IMAGE_ACCEPT, insertImageFromFile } from '../insert-image'
|
|
20
20
|
|
|
21
21
|
defineOptions({ name: 'USheetInsertImagePopup' })
|
|
@@ -2,8 +2,8 @@ import type { ContextmenuItem } from '@veltra/desktop'
|
|
|
2
2
|
import { createRange, type CellAddress, type CellRange } from '@veltra/sheet-core/core/address'
|
|
3
3
|
import { defineComponent, h } from 'vue'
|
|
4
4
|
|
|
5
|
-
import type { SheetContext } from '
|
|
6
|
-
import { defaultToolRegistry } from '
|
|
5
|
+
import type { SheetContext } from '../../tools/context'
|
|
6
|
+
import { defaultToolRegistry } from '../../tools/registry'
|
|
7
7
|
import InsertCountMenuItem from './insert-count-menu-item.vue'
|
|
8
8
|
import { pickAndInsertImage } from './insert-image'
|
|
9
9
|
|
|
@@ -61,8 +61,8 @@ import { ArrowLeft, ArrowRight } from '@veltra/icons/normal'
|
|
|
61
61
|
import { bem } from '@veltra/utils'
|
|
62
62
|
import { toRef, useTemplateRef } from 'vue'
|
|
63
63
|
|
|
64
|
-
import type { SheetTool } from '
|
|
65
|
-
import type { ToolGroupView } from '
|
|
64
|
+
import type { SheetTool } from '../../tools/registry'
|
|
65
|
+
import type { ToolGroupView } from './use-tool-groups'
|
|
66
66
|
import { useToolbarScroll } from './use-toolbar-scroll'
|
|
67
67
|
|
|
68
68
|
defineOptions({ name: 'USheetToolbar' })
|
|
@@ -77,8 +77,8 @@ import { UDropdown } from '@veltra/desktop'
|
|
|
77
77
|
import { bem } from '@veltra/utils'
|
|
78
78
|
import { computed, ref, useTemplateRef, watch } from 'vue'
|
|
79
79
|
|
|
80
|
-
import type { SheetTool } from '
|
|
81
|
-
import type { SheetEmits, SheetProps, _SheetExposed } from '
|
|
80
|
+
import type { SheetTool } from '../../tools/registry'
|
|
81
|
+
import type { SheetEmits, SheetProps, _SheetExposed } from '../../types'
|
|
82
82
|
import UFormulaBar from './formula-bar.vue'
|
|
83
83
|
import { pickAndImportFile } from './import-file'
|
|
84
84
|
import USheetBorderPopup from './popups/border-popup.vue'
|
|
@@ -102,7 +102,8 @@ const props = withDefaults(defineProps<SheetProps>(), {
|
|
|
102
102
|
cols: 26,
|
|
103
103
|
showToolbar: true,
|
|
104
104
|
showFormulaBar: true,
|
|
105
|
-
showTabs: true
|
|
105
|
+
showTabs: true,
|
|
106
|
+
readonly: false
|
|
106
107
|
})
|
|
107
108
|
|
|
108
109
|
const emit = defineEmits<SheetEmits>()
|
|
@@ -14,7 +14,7 @@ import {
|
|
|
14
14
|
import type { Sheet } from '@veltra/sheet-core/core/sheet'
|
|
15
15
|
import { computed, ref, shallowRef, watch } from 'vue'
|
|
16
16
|
|
|
17
|
-
import type { SheetContext } from '
|
|
17
|
+
import type { SheetContext } from '../../tools/context'
|
|
18
18
|
|
|
19
19
|
interface UseFindReplaceOptions {
|
|
20
20
|
/** 目标 sheet(弹层存活期间固定;tab 切换会关闭并销毁弹层) */
|
|
@@ -4,8 +4,8 @@ import type { Sheet } from '@veltra/sheet-core/core/sheet'
|
|
|
4
4
|
import { SheetGrid, type SheetGridContextMenuInfo } from '@veltra/sheet-core/grid/sheet-grid'
|
|
5
5
|
import { onBeforeUnmount, onMounted, watch } from 'vue'
|
|
6
6
|
|
|
7
|
-
import type { SheetContext } from '
|
|
8
|
-
import type { SheetProps } from '
|
|
7
|
+
import type { SheetContext } from '../../tools/context'
|
|
8
|
+
import type { SheetProps } from '../../types'
|
|
9
9
|
import {
|
|
10
10
|
buildBodyMenus,
|
|
11
11
|
buildColHeaderMenus,
|
|
@@ -114,6 +114,10 @@ export function useSheetGrid(options: UseSheetGridOptions) {
|
|
|
114
114
|
sheet,
|
|
115
115
|
rows: props.rows,
|
|
116
116
|
cols: props.cols,
|
|
117
|
+
readonly: props.readonly,
|
|
118
|
+
resolveDisplayValue: props.resolveDisplayValue,
|
|
119
|
+
resolveCellStyle: props.resolveCellStyle,
|
|
120
|
+
resolveCellRenderer: props.resolveCellRenderer,
|
|
117
121
|
onContextMenu: handleContextMenu,
|
|
118
122
|
onEditStart: (addr) => formulaBarRef.value?.mirrorGridEdit(addr),
|
|
119
123
|
onEditEnd: (addr) => formulaBarRef.value?.exitMirror(addr),
|
|
@@ -233,7 +237,7 @@ export function useSheetGrid(options: UseSheetGridOptions) {
|
|
|
233
237
|
|
|
234
238
|
onMounted(activateGrid)
|
|
235
239
|
|
|
236
|
-
watch(() => [props.rows, props.cols], rebuildGrid)
|
|
240
|
+
watch(() => [props.rows, props.cols, props.readonly], rebuildGrid)
|
|
237
241
|
|
|
238
242
|
onBeforeUnmount(() => {
|
|
239
243
|
invalidateAll()
|
|
@@ -2,9 +2,9 @@ import type { Sheet } from '@veltra/sheet-core/core/sheet'
|
|
|
2
2
|
import { Workbook } from '@veltra/sheet-core/core/workbook'
|
|
3
3
|
import { computed, onBeforeUnmount, onMounted, ref, shallowRef, watch } from 'vue'
|
|
4
4
|
|
|
5
|
-
import { createSheetContext } from '
|
|
6
|
-
import { defaultToolRegistry } from '
|
|
7
|
-
import type { SheetProps } from '
|
|
5
|
+
import { createSheetContext } from '../../tools/context'
|
|
6
|
+
import { defaultToolRegistry } from '../../tools/registry'
|
|
7
|
+
import type { SheetProps } from '../../types'
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
10
|
* useSheetState 与宿主组件的协作钩子。
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { computed, type ComputedRef, type Ref } from 'vue'
|
|
2
2
|
|
|
3
|
-
import type { SheetContext } from '
|
|
4
|
-
import { defaultToolRegistry, type SheetTool } from '
|
|
3
|
+
import type { SheetContext } from '../../tools/context'
|
|
4
|
+
import { defaultToolRegistry, type SheetTool } from '../../tools/registry'
|
|
5
5
|
|
|
6
6
|
/** 工具栏按钮视图模型 */
|
|
7
7
|
export interface ToolGroupItem {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { onBeforeUnmount, onMounted, shallowRef } from 'vue'
|
|
2
2
|
|
|
3
|
-
import type { SheetContext } from '
|
|
4
|
-
import { defaultToolRegistry, type SheetTool } from '
|
|
3
|
+
import type { SheetContext } from '../../tools/context'
|
|
4
|
+
import { defaultToolRegistry, type SheetTool } from '../../tools/registry'
|
|
5
5
|
|
|
6
6
|
/** 模板 ref 只读形态 */
|
|
7
7
|
type ElRef = { readonly value: HTMLElement | null | undefined }
|
package/src/index.ts
CHANGED
|
@@ -3,192 +3,10 @@
|
|
|
3
3
|
// 无头场景不涉及
|
|
4
4
|
import './tools/builtin'
|
|
5
5
|
|
|
6
|
-
// 数据模型 /
|
|
7
|
-
//
|
|
8
|
-
//
|
|
9
|
-
//
|
|
10
|
-
// ToolRegistry 类等,见 #31)不在此导出,测试一律深导入 @veltra/sheet-core 子路径。
|
|
11
|
-
// 类成员方法(Sheet.setCell / setCellStyles、CellStore.setCellValue 等)随类整体
|
|
12
|
-
// 导出,属内部实现细节,见 packages/sheet/AGENTS.md「核心语义」注。
|
|
13
|
-
|
|
14
|
-
export {
|
|
15
|
-
cellKey,
|
|
16
|
-
colIndexToName,
|
|
17
|
-
colNameToIndex,
|
|
18
|
-
parseAddress,
|
|
19
|
-
formatAddress,
|
|
20
|
-
createRange,
|
|
21
|
-
parseRange,
|
|
22
|
-
formatRange,
|
|
23
|
-
rangesEqual,
|
|
24
|
-
rangesIntersect,
|
|
25
|
-
rangeContainsAddress,
|
|
26
|
-
boundingBox,
|
|
27
|
-
iterateRange,
|
|
28
|
-
type CellAddress,
|
|
29
|
-
type CellRange
|
|
30
|
-
} from '@veltra/sheet-core'
|
|
31
|
-
|
|
32
|
-
export {
|
|
33
|
-
NUMERIC_TEXT_RE,
|
|
34
|
-
normalizeInputValue,
|
|
35
|
-
inferCellType,
|
|
36
|
-
isEmptyCellData,
|
|
37
|
-
cellDataEqual,
|
|
38
|
-
CellStore,
|
|
39
|
-
type CellType,
|
|
40
|
-
type CellValue,
|
|
41
|
-
type CellData,
|
|
42
|
-
type CellSnapshotItem
|
|
43
|
-
} from '@veltra/sheet-core'
|
|
44
|
-
|
|
45
|
-
export {
|
|
46
|
-
computeFillTargetRange,
|
|
47
|
-
generateFill,
|
|
48
|
-
type FillDirection,
|
|
49
|
-
type GenerateFillOptions
|
|
50
|
-
} from '@veltra/sheet-core'
|
|
51
|
-
|
|
52
|
-
export {
|
|
53
|
-
findAll,
|
|
54
|
-
findNext,
|
|
55
|
-
findNextFrom,
|
|
56
|
-
findPrev,
|
|
57
|
-
findPrevFrom,
|
|
58
|
-
type FindOptions,
|
|
59
|
-
type FindMatch
|
|
60
|
-
} from '@veltra/sheet-core'
|
|
61
|
-
|
|
62
|
-
export {
|
|
63
|
-
MergeManager,
|
|
64
|
-
type MergedCellKind,
|
|
65
|
-
type CellInfo,
|
|
66
|
-
type MergeResult
|
|
67
|
-
} from '@veltra/sheet-core'
|
|
68
|
-
|
|
69
|
-
export { SelectionModel, type SelectionState } from '@veltra/sheet-core'
|
|
70
|
-
|
|
71
|
-
export { Sheet, type FrozenState, type SheetSnapshot, type SheetEvents } from '@veltra/sheet-core'
|
|
72
|
-
|
|
73
|
-
export {
|
|
74
|
-
createImageId,
|
|
75
|
-
cloneImageAnchor,
|
|
76
|
-
cloneSheetImage,
|
|
77
|
-
type SheetImageType,
|
|
78
|
-
type SheetImageAnchor,
|
|
79
|
-
type SheetImage,
|
|
80
|
-
type ImageInput
|
|
81
|
-
} from '@veltra/sheet-core'
|
|
82
|
-
|
|
83
|
-
export {
|
|
84
|
-
BORDER_SIDES,
|
|
85
|
-
BORDER_STYLE_WIDTH,
|
|
86
|
-
BORDER_EDGE_DEFAULTS,
|
|
87
|
-
FONT_STYLE_KEYS,
|
|
88
|
-
ALIGN_STYLE_KEYS,
|
|
89
|
-
type BorderLineStyle,
|
|
90
|
-
type BorderSide,
|
|
91
|
-
type BorderEdge,
|
|
92
|
-
type HorizontalAlign,
|
|
93
|
-
type VerticalAlign,
|
|
94
|
-
type CellFont,
|
|
95
|
-
type CellAlign,
|
|
96
|
-
type CellStyle,
|
|
97
|
-
type StyleId,
|
|
98
|
-
type CellStylePatch
|
|
99
|
-
} from '@veltra/sheet-core'
|
|
100
|
-
|
|
101
|
-
export { StylePool } from '@veltra/sheet-core'
|
|
102
|
-
|
|
103
|
-
export {
|
|
104
|
-
buildBorderPresetItems,
|
|
105
|
-
type BorderPreset,
|
|
106
|
-
type BorderPresetItem
|
|
107
|
-
} from '@veltra/sheet-core'
|
|
108
|
-
|
|
109
|
-
export { Workbook, type WorkbookEvents } from '@veltra/sheet-core'
|
|
110
|
-
|
|
111
|
-
export {
|
|
112
|
-
HistoryManager,
|
|
113
|
-
type HistoryState,
|
|
114
|
-
type PatchDirection,
|
|
115
|
-
type CellPatch,
|
|
116
|
-
type MergePatch,
|
|
117
|
-
type StructureChange,
|
|
118
|
-
type StructurePatch,
|
|
119
|
-
type SnapshotPatch,
|
|
120
|
-
type ImagePatch,
|
|
121
|
-
type Patch,
|
|
122
|
-
type Mutation,
|
|
123
|
-
type CommandResult,
|
|
124
|
-
type CommandContext,
|
|
125
|
-
type Command,
|
|
126
|
-
type SetCellValueItem,
|
|
127
|
-
type SetCellValueParams,
|
|
128
|
-
SetCellValueCommand,
|
|
129
|
-
type SetCellFormulaParams,
|
|
130
|
-
SetCellFormulaCommand,
|
|
131
|
-
type SetCellStyleItem,
|
|
132
|
-
type SetCellStyleParams,
|
|
133
|
-
SetCellStyleCommand,
|
|
134
|
-
type InsertCellsParams,
|
|
135
|
-
InsertCellsCommand,
|
|
136
|
-
type MergeCellsParams,
|
|
137
|
-
MergeCellsCommand,
|
|
138
|
-
type UnmergeCellsParams,
|
|
139
|
-
UnmergeCellsCommand,
|
|
140
|
-
type InsertImageParams,
|
|
141
|
-
InsertImageCommand,
|
|
142
|
-
type RemoveImageParams,
|
|
143
|
-
RemoveImageCommand,
|
|
144
|
-
type ImageUpdateFields,
|
|
145
|
-
type UpdateImageParams,
|
|
146
|
-
UpdateImageCommand,
|
|
147
|
-
defaultCommandRegistry
|
|
148
|
-
} from '@veltra/sheet-core'
|
|
149
|
-
|
|
150
|
-
export {
|
|
151
|
-
FORMULA_ERROR_CODES,
|
|
152
|
-
formulaError,
|
|
153
|
-
isFormulaError,
|
|
154
|
-
isFormulaErrorCode,
|
|
155
|
-
type FormulaErrorCode,
|
|
156
|
-
type FormulaError,
|
|
157
|
-
type BinaryOperator,
|
|
158
|
-
type AstNode,
|
|
159
|
-
type AstReference,
|
|
160
|
-
collectReferences,
|
|
161
|
-
FormulaParseError,
|
|
162
|
-
tokenizeFormula,
|
|
163
|
-
type FormulaOperator,
|
|
164
|
-
type FormulaToken,
|
|
165
|
-
parseFormula,
|
|
166
|
-
type ScalarValue,
|
|
167
|
-
type EvalValue,
|
|
168
|
-
type FormulaEvalContext,
|
|
169
|
-
coerceToNumber,
|
|
170
|
-
coerceToText,
|
|
171
|
-
coerceToBoolean,
|
|
172
|
-
evaluateAst,
|
|
173
|
-
registerFormulaFunction,
|
|
174
|
-
listFormulaFunctions,
|
|
175
|
-
invokeFormulaFunction,
|
|
176
|
-
type FormulaFunctionMeta,
|
|
177
|
-
type FormulaFunction,
|
|
178
|
-
type FormulaDependency,
|
|
179
|
-
type FormulaNode,
|
|
180
|
-
DependencyGraph
|
|
181
|
-
} from '@veltra/sheet-core'
|
|
182
|
-
|
|
183
|
-
export { exportWorkbookXlsx, exportSheetCsv } from '@veltra/sheet-core'
|
|
184
|
-
export { importXlsx, importCsv, replaceWorkbook } from '@veltra/sheet-core'
|
|
185
|
-
|
|
186
|
-
export {
|
|
187
|
-
SheetGrid,
|
|
188
|
-
type SheetGridOptions,
|
|
189
|
-
type SheetGridContextMenuKind,
|
|
190
|
-
type SheetGridContextMenuInfo
|
|
191
|
-
} from '@veltra/sheet-core'
|
|
6
|
+
// 数据模型 / 渲染内核在 @veltra/sheet-core(独立发包)。本包**不做** re-export:
|
|
7
|
+
// core API(Workbook / Sheet / SheetGrid / 公式 / IO 等)一律
|
|
8
|
+
// `from '@veltra/sheet-core'` 直导,白名单外符号深导入其子路径。
|
|
9
|
+
// 本入口只导出 sheet 自有能力:组件、tools、组件类型。
|
|
192
10
|
|
|
193
11
|
export { createSheetContext, type SheetContext } from './tools/context'
|
|
194
12
|
|
|
@@ -201,6 +19,24 @@ export {
|
|
|
201
19
|
type SheetToolGroup
|
|
202
20
|
} from './tools/registry'
|
|
203
21
|
|
|
204
|
-
export {
|
|
22
|
+
export {
|
|
23
|
+
type SheetProps,
|
|
24
|
+
type SheetEmits,
|
|
25
|
+
type _SheetExposed,
|
|
26
|
+
type SheetExposed,
|
|
27
|
+
type ReportViewerProps,
|
|
28
|
+
type _ReportViewerExposed,
|
|
29
|
+
type ReportViewerExposed,
|
|
30
|
+
type ReportDesignerProps,
|
|
31
|
+
type ReportDesignerEmits,
|
|
32
|
+
type _ReportDesignerExposed,
|
|
33
|
+
type ReportDesignerExposed
|
|
34
|
+
} from './types'
|
|
35
|
+
|
|
36
|
+
export { USheet } from './components/sheet'
|
|
37
|
+
|
|
38
|
+
export { UReportViewer, UReportDesigner } from './components/report'
|
|
205
39
|
|
|
206
|
-
|
|
40
|
+
// 报表纯 TS 内核:renderReport / binding / rules / params / DataConnector / Report Template /
|
|
41
|
+
// Filter Bar 值规范化(结构见 packages/sheet/AGENTS.md)
|
|
42
|
+
export * from './report'
|