@veltra/sheet 2.0.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/components/sheet/formula-bar.js +393 -0
- package/dist/components/sheet/formula-suggest-list.js +66 -0
- package/dist/components/sheet/import-file.js +140 -0
- package/dist/components/sheet/insert-count-menu-item.js +68 -0
- package/dist/components/sheet/insert-image.js +79 -0
- package/dist/components/sheet/popup-helpers.js +73 -0
- package/dist/components/sheet/popups/border-popup.js +75 -0
- package/dist/components/sheet/popups/border-preset-glyph.js +106 -0
- package/dist/components/sheet/popups/export-popup.js +51 -0
- package/dist/components/sheet/popups/fill-color-popup.js +37 -0
- package/dist/components/sheet/popups/find-popup.js +113 -0
- package/dist/components/sheet/popups/font-color-popup.js +37 -0
- package/dist/components/sheet/popups/font-size-popup.js +63 -0
- package/dist/components/sheet/popups/import.worker.d.ts +21 -0
- package/dist/components/sheet/popups/import.worker.js +41 -0
- package/dist/components/sheet/popups/insert-image-popup.js +38 -0
- package/dist/components/sheet/sheet-context-menu.js +200 -0
- package/dist/components/sheet/sheet-tabs.js +162 -0
- package/dist/components/sheet/sheet-toolbar.js +106 -0
- package/dist/components/sheet/sheet.js +198 -0
- package/dist/components/sheet/style.d.ts +11 -0
- package/dist/components/sheet/style.js +12 -0
- package/dist/components/sheet/style2.css +654 -0
- package/dist/components/sheet/use-find-replace.js +161 -0
- package/dist/components/sheet/use-formula-ref-select.js +37 -0
- package/dist/components/sheet/use-formula-suggest.js +126 -0
- package/dist/components/sheet/use-sheet-grid.js +188 -0
- package/dist/components/sheet/use-sheet-state.js +122 -0
- package/dist/components/sheet/use-sheet-tabs-bar.js +90 -0
- package/dist/components/sheet/use-tool-groups.js +42 -0
- package/dist/components/sheet/use-tool-popup.js +123 -0
- package/dist/components/sheet/use-toolbar-scroll.js +72 -0
- package/dist/index.d.ts +18 -26
- package/dist/index.js +14 -24
- 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/builtin.js +279 -8
- package/dist/tools/context.d.ts +54 -11
- package/dist/tools/context.js +28 -5
- package/dist/tools/download.js +68 -0
- package/dist/tools/export.worker.d.ts +16 -0
- package/dist/tools/export.worker.js +29 -0
- package/dist/tools/registry.d.ts +7 -4
- package/dist/tools/registry.js +1 -3
- package/dist/types/index.d.ts +3 -1
- package/dist/types/report-designer.d.ts +36 -0
- package/dist/types/report-viewer.d.ts +38 -0
- package/dist/types/sheet.d.ts +22 -5
- package/package.json +10 -7
- 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/components/sheet/__test__/formula-bar.test.ts +474 -0
- package/src/components/sheet/__test__/import-file.test.ts +183 -0
- package/src/components/sheet/__test__/insert-count-menu-item.test.ts +123 -0
- package/src/components/sheet/__test__/insert-image-popup.test.ts +89 -0
- package/src/components/sheet/__test__/insert-image.test.ts +100 -0
- package/src/components/sheet/__test__/sheet-component.test.ts +993 -0
- package/src/components/sheet/__test__/sheet-context-menu.test.ts +206 -0
- package/src/components/sheet/__test__/use-formula-ref-select.test.ts +35 -0
- package/src/components/sheet/__test__/use-formula-suggest.test.ts +83 -0
- package/src/components/sheet/formula-bar.vue +473 -0
- package/src/components/sheet/formula-suggest-list.vue +64 -0
- package/src/components/sheet/import-file.ts +173 -0
- package/src/components/sheet/insert-count-menu-item.vue +69 -0
- package/src/components/sheet/insert-image.ts +90 -0
- package/src/components/sheet/parsing.ts +11 -0
- package/src/components/sheet/popup-helpers.ts +50 -0
- package/src/components/sheet/popups/border-popup.vue +93 -0
- package/src/components/sheet/popups/border-preset-glyph.vue +111 -0
- package/src/components/sheet/popups/export-popup.vue +52 -0
- package/src/components/sheet/popups/fill-color-popup.vue +39 -0
- package/src/components/sheet/popups/find-popup.vue +111 -0
- package/src/components/sheet/popups/font-color-popup.vue +39 -0
- package/src/components/sheet/popups/font-size-popup.vue +52 -0
- package/src/components/sheet/popups/import.worker.ts +66 -0
- package/src/components/sheet/popups/insert-image-popup.vue +39 -0
- package/src/components/sheet/sheet-context-menu.ts +229 -0
- package/src/components/sheet/sheet-tabs.vue +162 -0
- package/src/components/sheet/sheet-toolbar.vue +91 -0
- package/src/components/sheet/sheet.vue +211 -0
- package/src/components/sheet/style.scss +737 -0
- package/src/components/sheet/style.ts +13 -0
- package/src/components/sheet/use-find-replace.ts +200 -0
- package/src/components/sheet/use-formula-ref-select.ts +34 -0
- package/src/components/sheet/use-formula-suggest.ts +150 -0
- package/src/components/sheet/use-sheet-grid.ts +247 -0
- package/src/components/sheet/use-sheet-state.ts +161 -0
- package/src/components/sheet/use-sheet-tabs-bar.ts +115 -0
- package/src/components/sheet/use-tool-groups.ts +61 -0
- package/src/components/sheet/use-tool-popup.ts +150 -0
- package/src/components/sheet/use-toolbar-scroll.ts +95 -0
- package/src/env.d.ts +11 -0
- package/src/index.ts +39 -14
- 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/__test__/builtin.test.ts +208 -66
- package/src/tools/__test__/context.test.ts +62 -2
- package/src/tools/builtin.ts +350 -6
- package/src/tools/context.ts +89 -11
- package/src/tools/download.ts +82 -0
- package/src/tools/export.worker.ts +61 -0
- package/src/tools/registry.ts +16 -1
- package/src/types/index.ts +2 -0
- package/src/types/report-designer.ts +36 -0
- package/src/types/report-viewer.ts +37 -0
- package/src/types/sheet.ts +26 -3
- package/dist/core/address.d.ts +0 -60
- package/dist/core/address.js +0 -142
- package/dist/core/address.js.map +0 -1
- package/dist/core/cell-store.d.ts +0 -61
- package/dist/core/cell-store.js +0 -135
- package/dist/core/cell-store.js.map +0 -1
- package/dist/core/command/default-registry.d.ts +0 -10
- package/dist/core/command/default-registry.js +0 -18
- package/dist/core/command/default-registry.js.map +0 -1
- package/dist/core/command/history.d.ts +0 -64
- package/dist/core/command/history.js +0 -127
- package/dist/core/command/history.js.map +0 -1
- package/dist/core/command/merge-cells.d.ts +0 -21
- package/dist/core/command/merge-cells.js +0 -74
- package/dist/core/command/merge-cells.js.map +0 -1
- package/dist/core/command/registry.d.ts +0 -17
- package/dist/core/command/registry.js +0 -26
- package/dist/core/command/registry.js.map +0 -1
- package/dist/core/command/set-cell-formula.d.ts +0 -17
- package/dist/core/command/set-cell-formula.js +0 -29
- package/dist/core/command/set-cell-formula.js.map +0 -1
- package/dist/core/command/set-cell-value.d.ts +0 -22
- package/dist/core/command/set-cell-value.js +0 -35
- package/dist/core/command/set-cell-value.js.map +0 -1
- package/dist/core/command/types.d.ts +0 -68
- package/dist/core/events.js +0 -29
- package/dist/core/events.js.map +0 -1
- package/dist/core/fill.d.ts +0 -34
- package/dist/core/fill.js +0 -320
- package/dist/core/fill.js.map +0 -1
- package/dist/core/formula/ast.d.ts +0 -58
- package/dist/core/formula/ast.js +0 -38
- package/dist/core/formula/ast.js.map +0 -1
- package/dist/core/formula/dependency-graph.d.ts +0 -70
- package/dist/core/formula/dependency-graph.js +0 -269
- package/dist/core/formula/dependency-graph.js.map +0 -1
- package/dist/core/formula/errors.d.ts +0 -25
- package/dist/core/formula/errors.js +0 -36
- package/dist/core/formula/errors.js.map +0 -1
- package/dist/core/formula/evaluator.d.ts +0 -41
- package/dist/core/formula/evaluator.js +0 -154
- package/dist/core/formula/evaluator.js.map +0 -1
- package/dist/core/formula/functions.d.ts +0 -30
- package/dist/core/formula/functions.js +0 -209
- package/dist/core/formula/functions.js.map +0 -1
- package/dist/core/formula/parser.d.ts +0 -7
- package/dist/core/formula/parser.js +0 -208
- package/dist/core/formula/parser.js.map +0 -1
- package/dist/core/formula/tokenizer.d.ts +0 -37
- package/dist/core/formula/tokenizer.js +0 -146
- package/dist/core/formula/tokenizer.js.map +0 -1
- package/dist/core/merge-manager.d.ts +0 -64
- package/dist/core/merge-manager.js +0 -111
- package/dist/core/merge-manager.js.map +0 -1
- package/dist/core/selection.d.ts +0 -31
- package/dist/core/selection.js +0 -62
- package/dist/core/selection.js.map +0 -1
- package/dist/core/sheet.d.ts +0 -116
- package/dist/core/sheet.js +0 -224
- package/dist/core/sheet.js.map +0 -1
- package/dist/core/workbook.d.ts +0 -43
- package/dist/core/workbook.js +0 -77
- package/dist/core/workbook.js.map +0 -1
- package/dist/grid/sheet-grid.d.ts +0 -81
- package/dist/grid/sheet-grid.js +0 -331
- package/dist/grid/sheet-grid.js.map +0 -1
- package/dist/grid/vtable-theme.js +0 -80
- package/dist/grid/vtable-theme.js.map +0 -1
- package/dist/tools/builtin.js.map +0 -1
- package/dist/tools/context.js.map +0 -1
- package/dist/tools/registry.js.map +0 -1
- package/dist/vue/index.d.ts +0 -2
- package/dist/vue/sheet.js +0 -211
- package/dist/vue/sheet.js.map +0 -1
- package/dist/vue/sheet.vue.d.ts +0 -24
- package/dist/vue/style.d.ts +0 -1
- package/dist/vue/style.js +0 -2
- package/dist/vue/style2.css +0 -93
- package/src/core/__test__/address.test.ts +0 -113
- package/src/core/__test__/cell-store.test.ts +0 -97
- package/src/core/__test__/command.test.ts +0 -377
- package/src/core/__test__/fill.test.ts +0 -140
- package/src/core/__test__/formula-adversarial.test.ts +0 -265
- package/src/core/__test__/formula-engine.test.ts +0 -470
- package/src/core/__test__/formula-functions.test.ts +0 -178
- package/src/core/__test__/formula-parser.test.ts +0 -160
- package/src/core/__test__/history.test.ts +0 -225
- package/src/core/__test__/merge-manager.test.ts +0 -106
- package/src/core/__test__/sheet.test.ts +0 -142
- package/src/core/address.ts +0 -166
- package/src/core/cell-store.ts +0 -173
- package/src/core/command/default-registry.ts +0 -15
- package/src/core/command/history.ts +0 -167
- package/src/core/command/index.ts +0 -7
- package/src/core/command/merge-cells.ts +0 -74
- package/src/core/command/registry.ts +0 -30
- package/src/core/command/set-cell-formula.ts +0 -29
- package/src/core/command/set-cell-value.ts +0 -38
- package/src/core/command/types.ts +0 -73
- package/src/core/events.ts +0 -37
- package/src/core/fill.ts +0 -314
- package/src/core/formula/ast.ts +0 -66
- package/src/core/formula/dependency-graph.ts +0 -329
- package/src/core/formula/errors.ts +0 -41
- package/src/core/formula/evaluator.ts +0 -219
- package/src/core/formula/functions.ts +0 -266
- package/src/core/formula/index.ts +0 -7
- package/src/core/formula/parser.ts +0 -198
- package/src/core/formula/tokenizer.ts +0 -160
- package/src/core/merge-manager.ts +0 -158
- package/src/core/selection.ts +0 -66
- package/src/core/sheet.ts +0 -282
- package/src/core/workbook.ts +0 -99
- package/src/grid/__test__/canvas-mock.ts +0 -49
- package/src/grid/__test__/setup.ts +0 -3
- package/src/grid/__test__/sheet-grid-formula.test.ts +0 -140
- package/src/grid/__test__/sheet-grid.test.ts +0 -275
- package/src/grid/sheet-grid.ts +0 -407
- package/src/grid/vtable-theme.ts +0 -61
- package/src/vue/__test__/sheet-component.test.ts +0 -267
- package/src/vue/sheet.vue +0 -235
- package/src/vue/style.scss +0 -94
- package/src/vue/style.ts +0 -2
- /package/src/{vue → components/sheet}/index.ts +0 -0
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { message } from "@veltra/desktop";
|
|
2
|
+
//#region src/components/sheet/insert-image.ts
|
|
3
|
+
/** 文件选择 accept(工具栏弹层与右键菜单共用;不用裸 image/*) */
|
|
4
|
+
const INSERT_IMAGE_ACCEPT = ".png,.jpg,.jpeg,.gif,.svg,.webp";
|
|
5
|
+
const MIME_TO_TYPE = {
|
|
6
|
+
"image/png": "png",
|
|
7
|
+
"image/jpeg": "jpeg",
|
|
8
|
+
"image/jpg": "jpeg",
|
|
9
|
+
"image/gif": "gif",
|
|
10
|
+
"image/svg+xml": "svg",
|
|
11
|
+
"image/webp": "webp"
|
|
12
|
+
};
|
|
13
|
+
const EXT_TO_TYPE = {
|
|
14
|
+
png: "png",
|
|
15
|
+
jpg: "jpeg",
|
|
16
|
+
jpeg: "jpeg",
|
|
17
|
+
gif: "gif",
|
|
18
|
+
svg: "svg",
|
|
19
|
+
webp: "webp"
|
|
20
|
+
};
|
|
21
|
+
/** MIME → hucre 图片类型;MIME 为空时回落扩展名 */
|
|
22
|
+
function resolveImageType(file) {
|
|
23
|
+
const mime = file.type.trim().toLowerCase();
|
|
24
|
+
if (mime && MIME_TO_TYPE[mime]) return MIME_TO_TYPE[mime];
|
|
25
|
+
const ext = file.name.includes(".") ? file.name.slice(file.name.lastIndexOf(".") + 1) : "";
|
|
26
|
+
return EXT_TO_TYPE[ext.toLowerCase()];
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* 从本地 File 插入浮动图片:读字节 → 映射类型 → 锚定活动格 → ctx.insertImage。
|
|
30
|
+
* 不支持的格式 / 无活动格时 message.error 提示并返回 undefined。
|
|
31
|
+
*/
|
|
32
|
+
async function insertImageFromFile(ctx, file) {
|
|
33
|
+
const type = resolveImageType(file);
|
|
34
|
+
if (!type) {
|
|
35
|
+
message.error("不支持的图片格式,请选择 png / jpeg / gif / svg / webp");
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
const active = ctx.getSelection().activeCell;
|
|
39
|
+
if (!active) {
|
|
40
|
+
message.error("请先选择单元格");
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
const buffer = await file.arrayBuffer();
|
|
44
|
+
return ctx.insertImage({
|
|
45
|
+
data: new Uint8Array(buffer),
|
|
46
|
+
type,
|
|
47
|
+
anchor: { from: {
|
|
48
|
+
row: active.row,
|
|
49
|
+
col: active.col
|
|
50
|
+
} }
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* 拉起系统文件选择框(右键菜单用;不用 UFilePicker——无编程式打开 API)。
|
|
55
|
+
* 选中文件后走 insertImageFromFile。
|
|
56
|
+
*/
|
|
57
|
+
function pickAndInsertImage(ctx) {
|
|
58
|
+
const input = document.createElement("input");
|
|
59
|
+
input.type = "file";
|
|
60
|
+
input.accept = INSERT_IMAGE_ACCEPT;
|
|
61
|
+
input.hidden = true;
|
|
62
|
+
const cleanup = () => {
|
|
63
|
+
input.remove();
|
|
64
|
+
};
|
|
65
|
+
input.addEventListener("change", () => {
|
|
66
|
+
const file = input.files?.[0];
|
|
67
|
+
cleanup();
|
|
68
|
+
if (file) insertImageFromFile(ctx, file);
|
|
69
|
+
});
|
|
70
|
+
window.addEventListener("focus", () => {
|
|
71
|
+
setTimeout(() => {
|
|
72
|
+
if (document.body.contains(input) && !input.files?.length) cleanup();
|
|
73
|
+
}, 300);
|
|
74
|
+
}, { once: true });
|
|
75
|
+
document.body.appendChild(input);
|
|
76
|
+
input.click();
|
|
77
|
+
}
|
|
78
|
+
//#endregion
|
|
79
|
+
export { INSERT_IMAGE_ACCEPT, insertImageFromFile, pickAndInsertImage, resolveImageType };
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { BORDER_STYLE_WIDTH } from "@veltra/sheet-core/core/style/types";
|
|
2
|
+
//#region src/components/sheet/popup-helpers.ts
|
|
3
|
+
/** 当前选区(ranges[0] 优先;无区域选区时用活动格单格) */
|
|
4
|
+
function currentRange(context) {
|
|
5
|
+
const { activeCell, ranges } = context.getSelection();
|
|
6
|
+
return ranges[0] ?? (activeCell ? {
|
|
7
|
+
start: activeCell,
|
|
8
|
+
end: activeCell
|
|
9
|
+
} : null);
|
|
10
|
+
}
|
|
11
|
+
const BORDER_LINE_STYLES = [
|
|
12
|
+
"thin",
|
|
13
|
+
"medium",
|
|
14
|
+
"thick",
|
|
15
|
+
"dashed",
|
|
16
|
+
"dotted"
|
|
17
|
+
];
|
|
18
|
+
const BORDER_LINE_TITLES = {
|
|
19
|
+
thin: "细线",
|
|
20
|
+
medium: "中粗线",
|
|
21
|
+
thick: "粗线",
|
|
22
|
+
dashed: "虚线",
|
|
23
|
+
dotted: "点线"
|
|
24
|
+
};
|
|
25
|
+
const BORDER_PRESETS = [
|
|
26
|
+
{
|
|
27
|
+
id: "outer",
|
|
28
|
+
title: "外边框",
|
|
29
|
+
glyph: "outer"
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
id: "inner",
|
|
33
|
+
title: "内边框",
|
|
34
|
+
glyph: "inner"
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
id: "all",
|
|
38
|
+
title: "所有边框",
|
|
39
|
+
glyph: "all"
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
id: "top",
|
|
43
|
+
title: "上边框",
|
|
44
|
+
glyph: "top"
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
id: "bottom",
|
|
48
|
+
title: "下边框",
|
|
49
|
+
glyph: "bottom"
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
id: "left",
|
|
53
|
+
title: "左边框",
|
|
54
|
+
glyph: "left"
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
id: "right",
|
|
58
|
+
title: "右边框",
|
|
59
|
+
glyph: "right"
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
id: "none",
|
|
63
|
+
title: "无边框",
|
|
64
|
+
glyph: "none"
|
|
65
|
+
}
|
|
66
|
+
];
|
|
67
|
+
/** 线型示例条样式(边框面板的线型按钮 swatch) */
|
|
68
|
+
function lineSwatchStyle(line) {
|
|
69
|
+
const dash = line === "dashed" ? "dashed" : line === "dotted" ? "dotted" : "solid";
|
|
70
|
+
return { borderBottom: `${BORDER_STYLE_WIDTH[line]}px ${dash} #000` };
|
|
71
|
+
}
|
|
72
|
+
//#endregion
|
|
73
|
+
export { BORDER_LINE_STYLES, BORDER_LINE_TITLES, BORDER_PRESETS, currentRange, lineSwatchStyle };
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { BORDER_LINE_STYLES, BORDER_LINE_TITLES, BORDER_PRESETS, currentRange, lineSwatchStyle } from "../popup-helpers.js";
|
|
2
|
+
import _sfc_main$1 from "./border-preset-glyph.js";
|
|
3
|
+
import { Fragment, createElementBlock, createElementVNode, createVNode, defineComponent, normalizeClass, normalizeStyle, openBlock, ref, renderList, unref } from "vue";
|
|
4
|
+
import { UPalette } from "@veltra/desktop";
|
|
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";
|
|
8
|
+
//#region src/components/sheet/popups/border-popup.vue
|
|
9
|
+
const _hoisted_1 = ["title", "onClick"];
|
|
10
|
+
const _hoisted_2 = ["title", "onClick"];
|
|
11
|
+
const _sfc_main = /*@__PURE__*/ defineComponent({
|
|
12
|
+
name: "USheetBorderPopup",
|
|
13
|
+
__name: "border-popup",
|
|
14
|
+
props: { context: {} },
|
|
15
|
+
setup(__props) {
|
|
16
|
+
/**
|
|
17
|
+
* 边框面板(外边框 / 内边框 / 所有边框 / 单侧边框 / 无边框预设 + 线型 / 颜色)。
|
|
18
|
+
* 预设补丁由 core/style/border-presets 生成(含邻居格共享边同步,对齐
|
|
19
|
+
* Excel「写入时同步、最近设置生效」);面板打开期间的写入由
|
|
20
|
+
* use-tool-popup 事务包裹为一个 undo 单元。
|
|
21
|
+
*/
|
|
22
|
+
const props = __props;
|
|
23
|
+
const cls = bem("sheet");
|
|
24
|
+
/** 当前线型 / 颜色 */
|
|
25
|
+
const borderLineStyle = ref("thin");
|
|
26
|
+
const borderColor = ref("#000000");
|
|
27
|
+
/** 应用边框预设:一次 executeCommand(items 批量,含邻居同步补丁)= 一个 undo 单元 */
|
|
28
|
+
function applyBorderPreset(preset) {
|
|
29
|
+
const range = currentRange(props.context);
|
|
30
|
+
if (!range) return;
|
|
31
|
+
const edge = {
|
|
32
|
+
style: borderLineStyle.value,
|
|
33
|
+
width: BORDER_STYLE_WIDTH[borderLineStyle.value],
|
|
34
|
+
color: borderColor.value
|
|
35
|
+
};
|
|
36
|
+
const items = buildBorderPresetItems(range, preset, edge, (addr) => props.context.getCellStyle(addr)).map(({ addr, patch }) => ({
|
|
37
|
+
addr,
|
|
38
|
+
partial: patch
|
|
39
|
+
}));
|
|
40
|
+
if (items.length === 0) return;
|
|
41
|
+
props.context.executeCommand("sheet.command.set-cell-style", { items });
|
|
42
|
+
}
|
|
43
|
+
return (_ctx, _cache) => {
|
|
44
|
+
return openBlock(), createElementBlock(Fragment, null, [
|
|
45
|
+
createElementVNode("div", { class: normalizeClass(unref(cls).e("popup-row")) }, [createElementVNode("span", { class: normalizeClass(unref(cls).e("popup-label")) }, "线型", 2), (openBlock(true), createElementBlock(Fragment, null, renderList(unref(BORDER_LINE_STYLES), (line) => {
|
|
46
|
+
return openBlock(), createElementBlock("button", {
|
|
47
|
+
key: line,
|
|
48
|
+
type: "button",
|
|
49
|
+
class: normalizeClass([unref(cls).e("popup-line"), unref(bem).is("active", borderLineStyle.value === line)]),
|
|
50
|
+
title: unref(BORDER_LINE_TITLES)[line],
|
|
51
|
+
onClick: ($event) => borderLineStyle.value = line
|
|
52
|
+
}, [createElementVNode("span", {
|
|
53
|
+
class: normalizeClass(unref(cls).e("popup-line-swatch")),
|
|
54
|
+
style: normalizeStyle(unref(lineSwatchStyle)(line))
|
|
55
|
+
}, null, 6)], 10, _hoisted_1);
|
|
56
|
+
}), 128))], 2),
|
|
57
|
+
createElementVNode("div", { class: normalizeClass(unref(cls).e("popup-row")) }, [createElementVNode("span", { class: normalizeClass(unref(cls).e("popup-label")) }, "颜色", 2), createVNode(unref(UPalette), {
|
|
58
|
+
"model-value": borderColor.value,
|
|
59
|
+
"onUpdate:modelValue": _cache[0] || (_cache[0] = (value) => borderColor.value = value || borderColor.value)
|
|
60
|
+
}, null, 8, ["model-value"])], 2),
|
|
61
|
+
createElementVNode("div", { class: normalizeClass(unref(cls).e("popup-row")) }, [(openBlock(true), createElementBlock(Fragment, null, renderList(unref(BORDER_PRESETS), (preset) => {
|
|
62
|
+
return openBlock(), createElementBlock("button", {
|
|
63
|
+
key: preset.id,
|
|
64
|
+
type: "button",
|
|
65
|
+
class: normalizeClass(unref(cls).e("popup-preset")),
|
|
66
|
+
title: preset.title,
|
|
67
|
+
onClick: ($event) => applyBorderPreset(preset.id)
|
|
68
|
+
}, [createVNode(_sfc_main$1, { glyph: preset.glyph }, null, 8, ["glyph"])], 10, _hoisted_2);
|
|
69
|
+
}), 128))], 2)
|
|
70
|
+
], 64);
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
});
|
|
74
|
+
//#endregion
|
|
75
|
+
export { _sfc_main as default };
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import { computed, createCommentVNode, createElementBlock, createElementVNode, defineComponent, normalizeClass, openBlock, unref } from "vue";
|
|
2
|
+
import { bem } from "@veltra/utils";
|
|
3
|
+
//#region src/components/sheet/popups/border-preset-glyph.vue
|
|
4
|
+
const _hoisted_1 = ["stroke"];
|
|
5
|
+
const _hoisted_2 = ["stroke"];
|
|
6
|
+
const _hoisted_3 = ["stroke"];
|
|
7
|
+
const _hoisted_4 = ["stroke"];
|
|
8
|
+
const _hoisted_5 = ["stroke"];
|
|
9
|
+
const _hoisted_6 = ["stroke"];
|
|
10
|
+
const MUTED = "var(--u-border-muted-color, #c0c4cc)";
|
|
11
|
+
const ACTIVE = "currentColor";
|
|
12
|
+
const _sfc_main = /*@__PURE__*/ defineComponent({
|
|
13
|
+
name: "USheetBorderPresetGlyph",
|
|
14
|
+
__name: "border-preset-glyph",
|
|
15
|
+
props: { glyph: {} },
|
|
16
|
+
setup(__props) {
|
|
17
|
+
/**
|
|
18
|
+
* 边框预设田字格 glyph(包内联 SVG,不进 @veltra/icons)。
|
|
19
|
+
* 3×3 网格(外框 + 十字),按 glyph 高亮对应边。
|
|
20
|
+
*/
|
|
21
|
+
const props = __props;
|
|
22
|
+
const cls = bem("sheet");
|
|
23
|
+
/** 田字格各线段是否高亮 */
|
|
24
|
+
function stroke(active) {
|
|
25
|
+
return active ? ACTIVE : MUTED;
|
|
26
|
+
}
|
|
27
|
+
const edges = computed(() => {
|
|
28
|
+
const g = props.glyph;
|
|
29
|
+
return {
|
|
30
|
+
top: g === "outer" || g === "all" || g === "top",
|
|
31
|
+
bottom: g === "outer" || g === "all" || g === "bottom",
|
|
32
|
+
left: g === "outer" || g === "all" || g === "left",
|
|
33
|
+
right: g === "outer" || g === "all" || g === "right",
|
|
34
|
+
innerH: g === "inner" || g === "all",
|
|
35
|
+
innerV: g === "inner" || g === "all"
|
|
36
|
+
};
|
|
37
|
+
});
|
|
38
|
+
return (_ctx, _cache) => {
|
|
39
|
+
return openBlock(), createElementBlock("svg", {
|
|
40
|
+
class: normalizeClass(unref(cls).e("popup-preset-glyph")),
|
|
41
|
+
viewBox: "0 0 16 16",
|
|
42
|
+
width: "16",
|
|
43
|
+
height: "16",
|
|
44
|
+
"aria-hidden": "true"
|
|
45
|
+
}, [
|
|
46
|
+
createCommentVNode(" 田字格:外框 + 十字;高亮边用 currentColor,其余用 muted "),
|
|
47
|
+
createElementVNode("line", {
|
|
48
|
+
x1: "2",
|
|
49
|
+
y1: "2",
|
|
50
|
+
x2: "14",
|
|
51
|
+
y2: "2",
|
|
52
|
+
stroke: stroke(edges.value.top),
|
|
53
|
+
"stroke-width": "1.5",
|
|
54
|
+
"stroke-linecap": "square"
|
|
55
|
+
}, null, 8, _hoisted_1),
|
|
56
|
+
createElementVNode("line", {
|
|
57
|
+
x1: "2",
|
|
58
|
+
y1: "14",
|
|
59
|
+
x2: "14",
|
|
60
|
+
y2: "14",
|
|
61
|
+
stroke: stroke(edges.value.bottom),
|
|
62
|
+
"stroke-width": "1.5",
|
|
63
|
+
"stroke-linecap": "square"
|
|
64
|
+
}, null, 8, _hoisted_2),
|
|
65
|
+
createElementVNode("line", {
|
|
66
|
+
x1: "2",
|
|
67
|
+
y1: "2",
|
|
68
|
+
x2: "2",
|
|
69
|
+
y2: "14",
|
|
70
|
+
stroke: stroke(edges.value.left),
|
|
71
|
+
"stroke-width": "1.5",
|
|
72
|
+
"stroke-linecap": "square"
|
|
73
|
+
}, null, 8, _hoisted_3),
|
|
74
|
+
createElementVNode("line", {
|
|
75
|
+
x1: "14",
|
|
76
|
+
y1: "2",
|
|
77
|
+
x2: "14",
|
|
78
|
+
y2: "14",
|
|
79
|
+
stroke: stroke(edges.value.right),
|
|
80
|
+
"stroke-width": "1.5",
|
|
81
|
+
"stroke-linecap": "square"
|
|
82
|
+
}, null, 8, _hoisted_4),
|
|
83
|
+
createElementVNode("line", {
|
|
84
|
+
x1: "2",
|
|
85
|
+
y1: "8",
|
|
86
|
+
x2: "14",
|
|
87
|
+
y2: "8",
|
|
88
|
+
stroke: stroke(edges.value.innerH),
|
|
89
|
+
"stroke-width": "1.5",
|
|
90
|
+
"stroke-linecap": "square"
|
|
91
|
+
}, null, 8, _hoisted_5),
|
|
92
|
+
createElementVNode("line", {
|
|
93
|
+
x1: "8",
|
|
94
|
+
y1: "2",
|
|
95
|
+
x2: "8",
|
|
96
|
+
y2: "14",
|
|
97
|
+
stroke: stroke(edges.value.innerV),
|
|
98
|
+
"stroke-width": "1.5",
|
|
99
|
+
"stroke-linecap": "square"
|
|
100
|
+
}, null, 8, _hoisted_6)
|
|
101
|
+
], 2);
|
|
102
|
+
};
|
|
103
|
+
}
|
|
104
|
+
});
|
|
105
|
+
//#endregion
|
|
106
|
+
export { _sfc_main as default };
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { exportSheetCsvFile, exportWorkbookFile } from "../../../tools/download.js";
|
|
2
|
+
import { createElementBlock, createElementVNode, defineComponent, normalizeClass, openBlock, unref } from "vue";
|
|
3
|
+
import { message } from "@veltra/desktop";
|
|
4
|
+
import { bem } from "@veltra/utils";
|
|
5
|
+
//#region src/components/sheet/popups/export-popup.vue
|
|
6
|
+
const _sfc_main = /*@__PURE__*/ defineComponent({
|
|
7
|
+
name: "USheetExportPopup",
|
|
8
|
+
__name: "export-popup",
|
|
9
|
+
props: { context: {} },
|
|
10
|
+
emits: ["close"],
|
|
11
|
+
setup(__props, { emit: __emit }) {
|
|
12
|
+
/**
|
|
13
|
+
* 导出选择面板(xlsx / csv)。不参与面板事务:点击即下载并关闭。
|
|
14
|
+
*/
|
|
15
|
+
const props = __props;
|
|
16
|
+
const emit = __emit;
|
|
17
|
+
const cls = bem("sheet");
|
|
18
|
+
function exportXlsx() {
|
|
19
|
+
emit("close");
|
|
20
|
+
const loading = message({
|
|
21
|
+
message: "正在导出…",
|
|
22
|
+
duration: 0
|
|
23
|
+
});
|
|
24
|
+
exportWorkbookFile(props.context).then(() => loading.close()).catch((err) => {
|
|
25
|
+
loading.close();
|
|
26
|
+
message.error(`导出失败:${err instanceof Error ? err.message : String(err)}`);
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
function exportCsv() {
|
|
30
|
+
emit("close");
|
|
31
|
+
try {
|
|
32
|
+
exportSheetCsvFile(props.context);
|
|
33
|
+
} catch (err) {
|
|
34
|
+
message.error(`导出失败:${err instanceof Error ? err.message : String(err)}`);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
return (_ctx, _cache) => {
|
|
38
|
+
return openBlock(), createElementBlock("div", { class: normalizeClass(unref(cls).e("export-menu")) }, [createElementVNode("button", {
|
|
39
|
+
type: "button",
|
|
40
|
+
class: normalizeClass(unref(cls).e("export-option")),
|
|
41
|
+
onClick: exportXlsx
|
|
42
|
+
}, " 导出 Excel (.xlsx) ", 2), createElementVNode("button", {
|
|
43
|
+
type: "button",
|
|
44
|
+
class: normalizeClass(unref(cls).e("export-option")),
|
|
45
|
+
onClick: exportCsv
|
|
46
|
+
}, " 导出 CSV (.csv) ", 2)], 2);
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
});
|
|
50
|
+
//#endregion
|
|
51
|
+
export { _sfc_main as default };
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { currentRange } from "../popup-helpers.js";
|
|
2
|
+
import { createBlock, defineComponent, onMounted, openBlock, ref, unref } from "vue";
|
|
3
|
+
import { UPalette } from "@veltra/desktop";
|
|
4
|
+
//#region src/components/sheet/popups/fill-color-popup.vue
|
|
5
|
+
const _sfc_main = /*@__PURE__*/ defineComponent({
|
|
6
|
+
name: "USheetFillColorPopup",
|
|
7
|
+
__name: "fill-color-popup",
|
|
8
|
+
props: { context: {} },
|
|
9
|
+
setup(__props) {
|
|
10
|
+
/**
|
|
11
|
+
* 填充颜色面板(UPalette 调色板 + 无填充 = 清除 fill 保留边框)。
|
|
12
|
+
* 面板打开期间的写入由 use-tool-popup 事务包裹为一个 undo 单元。
|
|
13
|
+
*/
|
|
14
|
+
const props = __props;
|
|
15
|
+
/** 填充颜色('' = 无填充) */
|
|
16
|
+
const fillColor = ref("");
|
|
17
|
+
onMounted(() => {
|
|
18
|
+
const active = props.context.getSelection().activeCell;
|
|
19
|
+
const style = active ? props.context.getCellStyle(active) : void 0;
|
|
20
|
+
fillColor.value = style?.fill?.color ?? "";
|
|
21
|
+
});
|
|
22
|
+
/** 填充颜色变化('' = 无填充:清除 fill 保留边框) */
|
|
23
|
+
function applyFillColor(color) {
|
|
24
|
+
const range = currentRange(props.context);
|
|
25
|
+
if (!range) return;
|
|
26
|
+
props.context.setCellStyle(range, color ? { fill: { color } } : { fill: {} });
|
|
27
|
+
}
|
|
28
|
+
return (_ctx, _cache) => {
|
|
29
|
+
return openBlock(), createBlock(unref(UPalette), {
|
|
30
|
+
"model-value": fillColor.value,
|
|
31
|
+
"onUpdate:modelValue": applyFillColor
|
|
32
|
+
}, null, 8, ["model-value"]);
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
//#endregion
|
|
37
|
+
export { _sfc_main as default };
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
import { useFindReplace } from "../use-find-replace.js";
|
|
2
|
+
import { Fragment, createElementBlock, createElementVNode, createTextVNode, createVNode, defineComponent, isRef, normalizeClass, openBlock, toDisplayString, unref, vModelCheckbox, vModelSelect, withDirectives } from "vue";
|
|
3
|
+
import { UInput } from "@veltra/desktop";
|
|
4
|
+
import { bem } from "@veltra/utils";
|
|
5
|
+
//#region src/components/sheet/popups/find-popup.vue
|
|
6
|
+
const _hoisted_1 = ["disabled"];
|
|
7
|
+
const _hoisted_2 = ["disabled"];
|
|
8
|
+
const _hoisted_3 = ["disabled"];
|
|
9
|
+
const _hoisted_4 = ["disabled"];
|
|
10
|
+
const _sfc_main = /*@__PURE__*/ defineComponent({
|
|
11
|
+
name: "USheetFindPopup",
|
|
12
|
+
__name: "find-popup",
|
|
13
|
+
props: {
|
|
14
|
+
sheet: {},
|
|
15
|
+
context: {}
|
|
16
|
+
},
|
|
17
|
+
emits: ["close"],
|
|
18
|
+
setup(__props, { emit: __emit }) {
|
|
19
|
+
/**
|
|
20
|
+
* 查找条(关键词 / 上一个 / 下一个 / 命中计数 / 关闭 + 替换 / 全部替换)。
|
|
21
|
+
* 不参与面板事务:每次替换独立为一个 undo 单元;全部替换 = 一次批量 = 单 undo 单元。
|
|
22
|
+
* 弹层随 v-if 挂载 / 销毁,每次打开都是全新状态(关键词清空)。
|
|
23
|
+
*/
|
|
24
|
+
const props = __props;
|
|
25
|
+
const emit = __emit;
|
|
26
|
+
const cls = bem("sheet");
|
|
27
|
+
const { findQuery, findReplace, caseSensitive, wholeCell, searchIn, canFind, canReplace, findCountText, findForward, findPrevious, handleFindKeydown, replaceCurrent, replaceAll } = useFindReplace({
|
|
28
|
+
getSheet: () => props.sheet,
|
|
29
|
+
context: props.context
|
|
30
|
+
});
|
|
31
|
+
return (_ctx, _cache) => {
|
|
32
|
+
return openBlock(), createElementBlock(Fragment, null, [
|
|
33
|
+
createElementVNode("div", { class: normalizeClass(unref(cls).e("find-row")) }, [
|
|
34
|
+
createVNode(unref(UInput), {
|
|
35
|
+
modelValue: unref(findQuery),
|
|
36
|
+
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => isRef(findQuery) ? findQuery.value = $event : null),
|
|
37
|
+
placeholder: "查找内容",
|
|
38
|
+
size: "small",
|
|
39
|
+
class: normalizeClass(unref(cls).e("find-input")),
|
|
40
|
+
onKeydown: unref(handleFindKeydown)
|
|
41
|
+
}, null, 8, [
|
|
42
|
+
"modelValue",
|
|
43
|
+
"class",
|
|
44
|
+
"onKeydown"
|
|
45
|
+
]),
|
|
46
|
+
createElementVNode("span", { class: normalizeClass(unref(cls).e("find-count")) }, toDisplayString(unref(findCountText)), 3),
|
|
47
|
+
createElementVNode("button", {
|
|
48
|
+
type: "button",
|
|
49
|
+
class: normalizeClass(unref(cls).e("find-nav")),
|
|
50
|
+
disabled: !unref(canFind),
|
|
51
|
+
title: "上一个(Shift+Enter)",
|
|
52
|
+
onClick: _cache[1] || (_cache[1] = (...args) => unref(findPrevious) && unref(findPrevious)(...args))
|
|
53
|
+
}, " ↑ ", 10, _hoisted_1),
|
|
54
|
+
createElementVNode("button", {
|
|
55
|
+
type: "button",
|
|
56
|
+
class: normalizeClass(unref(cls).e("find-nav")),
|
|
57
|
+
disabled: !unref(canFind),
|
|
58
|
+
title: "下一个(Enter)",
|
|
59
|
+
onClick: _cache[2] || (_cache[2] = (...args) => unref(findForward) && unref(findForward)(...args))
|
|
60
|
+
}, " ↓ ", 10, _hoisted_2),
|
|
61
|
+
createElementVNode("button", {
|
|
62
|
+
type: "button",
|
|
63
|
+
class: normalizeClass(unref(cls).e("find-close")),
|
|
64
|
+
title: "关闭",
|
|
65
|
+
onClick: _cache[3] || (_cache[3] = ($event) => emit("close"))
|
|
66
|
+
}, " ✕ ", 2)
|
|
67
|
+
], 2),
|
|
68
|
+
createElementVNode("div", { class: normalizeClass(unref(cls).e("find-row")) }, [
|
|
69
|
+
createVNode(unref(UInput), {
|
|
70
|
+
modelValue: unref(findReplace),
|
|
71
|
+
"onUpdate:modelValue": _cache[4] || (_cache[4] = ($event) => isRef(findReplace) ? findReplace.value = $event : null),
|
|
72
|
+
placeholder: "替换为",
|
|
73
|
+
size: "small",
|
|
74
|
+
class: normalizeClass(unref(cls).e("find-input")),
|
|
75
|
+
onKeydown: unref(handleFindKeydown)
|
|
76
|
+
}, null, 8, [
|
|
77
|
+
"modelValue",
|
|
78
|
+
"class",
|
|
79
|
+
"onKeydown"
|
|
80
|
+
]),
|
|
81
|
+
createElementVNode("button", {
|
|
82
|
+
type: "button",
|
|
83
|
+
class: normalizeClass(unref(cls).e("find-btn")),
|
|
84
|
+
disabled: !unref(canReplace),
|
|
85
|
+
onClick: _cache[5] || (_cache[5] = (...args) => unref(replaceCurrent) && unref(replaceCurrent)(...args))
|
|
86
|
+
}, " 替换 ", 10, _hoisted_3),
|
|
87
|
+
createElementVNode("button", {
|
|
88
|
+
type: "button",
|
|
89
|
+
class: normalizeClass(unref(cls).e("find-btn")),
|
|
90
|
+
disabled: !unref(canReplace),
|
|
91
|
+
onClick: _cache[6] || (_cache[6] = (...args) => unref(replaceAll) && unref(replaceAll)(...args))
|
|
92
|
+
}, " 全部替换 ", 10, _hoisted_4)
|
|
93
|
+
], 2),
|
|
94
|
+
createElementVNode("div", { class: normalizeClass(unref(cls).e("find-row")) }, [
|
|
95
|
+
createElementVNode("label", { class: normalizeClass(unref(cls).e("find-option")) }, [withDirectives(createElementVNode("input", {
|
|
96
|
+
"onUpdate:modelValue": _cache[7] || (_cache[7] = ($event) => isRef(caseSensitive) ? caseSensitive.value = $event : null),
|
|
97
|
+
type: "checkbox"
|
|
98
|
+
}, null, 512), [[vModelCheckbox, unref(caseSensitive)]]), _cache[10] || (_cache[10] = createTextVNode("区分大小写 ", -1))], 2),
|
|
99
|
+
createElementVNode("label", { class: normalizeClass(unref(cls).e("find-option")) }, [withDirectives(createElementVNode("input", {
|
|
100
|
+
"onUpdate:modelValue": _cache[8] || (_cache[8] = ($event) => isRef(wholeCell) ? wholeCell.value = $event : null),
|
|
101
|
+
type: "checkbox"
|
|
102
|
+
}, null, 512), [[vModelCheckbox, unref(wholeCell)]]), _cache[11] || (_cache[11] = createTextVNode("整格匹配 ", -1))], 2),
|
|
103
|
+
createElementVNode("label", { class: normalizeClass(unref(cls).e("find-option")) }, [_cache[13] || (_cache[13] = createTextVNode(" 查找 ", -1)), withDirectives(createElementVNode("select", {
|
|
104
|
+
"onUpdate:modelValue": _cache[9] || (_cache[9] = ($event) => isRef(searchIn) ? searchIn.value = $event : null),
|
|
105
|
+
class: normalizeClass(unref(cls).e("find-select"))
|
|
106
|
+
}, [..._cache[12] || (_cache[12] = [createElementVNode("option", { value: "value" }, "按显示值", -1), createElementVNode("option", { value: "formula" }, "按公式", -1)])], 2), [[vModelSelect, unref(searchIn)]])], 2)
|
|
107
|
+
], 2)
|
|
108
|
+
], 64);
|
|
109
|
+
};
|
|
110
|
+
}
|
|
111
|
+
});
|
|
112
|
+
//#endregion
|
|
113
|
+
export { _sfc_main as default };
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { currentRange } from "../popup-helpers.js";
|
|
2
|
+
import { createBlock, defineComponent, onMounted, openBlock, ref, unref } from "vue";
|
|
3
|
+
import { UPalette } from "@veltra/desktop";
|
|
4
|
+
//#region src/components/sheet/popups/font-color-popup.vue
|
|
5
|
+
const _sfc_main = /*@__PURE__*/ defineComponent({
|
|
6
|
+
name: "USheetFontColorPopup",
|
|
7
|
+
__name: "font-color-popup",
|
|
8
|
+
props: { context: {} },
|
|
9
|
+
setup(__props) {
|
|
10
|
+
/**
|
|
11
|
+
* 字体颜色面板(UPalette;空值 = 清除 color 保留其它字体字段)。
|
|
12
|
+
* 面板打开期间的写入由 use-tool-popup 事务包裹为一个 undo 单元。
|
|
13
|
+
*/
|
|
14
|
+
const props = __props;
|
|
15
|
+
/** 字体颜色('' = 自动/默认) */
|
|
16
|
+
const fontColor = ref("");
|
|
17
|
+
onMounted(() => {
|
|
18
|
+
const active = props.context.getSelection().activeCell;
|
|
19
|
+
const style = active ? props.context.getCellStyle(active) : void 0;
|
|
20
|
+
fontColor.value = style?.font?.color ?? "";
|
|
21
|
+
});
|
|
22
|
+
/** 字体颜色变化('' = 清除 color) */
|
|
23
|
+
function applyFontColor(color) {
|
|
24
|
+
const range = currentRange(props.context);
|
|
25
|
+
if (!range) return;
|
|
26
|
+
props.context.setCellStyle(range, color ? { font: { color } } : { font: { color: null } });
|
|
27
|
+
}
|
|
28
|
+
return (_ctx, _cache) => {
|
|
29
|
+
return openBlock(), createBlock(unref(UPalette), {
|
|
30
|
+
"model-value": fontColor.value,
|
|
31
|
+
"onUpdate:modelValue": applyFontColor
|
|
32
|
+
}, null, 8, ["model-value"]);
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
//#endregion
|
|
37
|
+
export { _sfc_main as default };
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { currentRange } from "../popup-helpers.js";
|
|
2
|
+
import { Fragment, createCommentVNode, createElementBlock, createElementVNode, createVNode, defineComponent, normalizeClass, onMounted, openBlock, ref, renderList, toDisplayString, unref, withCtx } from "vue";
|
|
3
|
+
import { UScroll } from "@veltra/desktop";
|
|
4
|
+
import { bem } from "@veltra/utils";
|
|
5
|
+
//#region src/components/sheet/popups/font-size-popup.vue
|
|
6
|
+
const _hoisted_1 = ["onClick"];
|
|
7
|
+
const _sfc_main = /*@__PURE__*/ defineComponent({
|
|
8
|
+
name: "USheetFontSizePopup",
|
|
9
|
+
__name: "font-size-popup",
|
|
10
|
+
props: { context: {} },
|
|
11
|
+
setup(__props) {
|
|
12
|
+
/** 预设字号列表(pt,与 Excel 常用档对齐) */
|
|
13
|
+
const FONT_SIZES = [
|
|
14
|
+
9,
|
|
15
|
+
10,
|
|
16
|
+
11,
|
|
17
|
+
12,
|
|
18
|
+
14,
|
|
19
|
+
16,
|
|
20
|
+
18,
|
|
21
|
+
20,
|
|
22
|
+
24,
|
|
23
|
+
28,
|
|
24
|
+
32
|
|
25
|
+
];
|
|
26
|
+
/**
|
|
27
|
+
* 字号面板(预设列表;点击写入 font.size)。
|
|
28
|
+
* 面板打开期间的写入由 use-tool-popup 事务包裹为一个 undo 单元。
|
|
29
|
+
*/
|
|
30
|
+
const props = __props;
|
|
31
|
+
const cls = bem("sheet");
|
|
32
|
+
const currentSize = ref(void 0);
|
|
33
|
+
onMounted(() => {
|
|
34
|
+
const active = props.context.getSelection().activeCell;
|
|
35
|
+
const style = active ? props.context.getCellStyle(active) : void 0;
|
|
36
|
+
currentSize.value = style?.font?.size;
|
|
37
|
+
});
|
|
38
|
+
function applyFontSize(size) {
|
|
39
|
+
const range = currentRange(props.context);
|
|
40
|
+
if (!range) return;
|
|
41
|
+
currentSize.value = size;
|
|
42
|
+
props.context.setCellStyle(range, { font: { size } });
|
|
43
|
+
}
|
|
44
|
+
return (_ctx, _cache) => {
|
|
45
|
+
return openBlock(), createElementBlock(Fragment, null, [createCommentVNode(" 下拉排列:每行一个字号;滚动用 desktop UScroll(自定义滚动条) "), createVNode(unref(UScroll), {
|
|
46
|
+
height: 280,
|
|
47
|
+
class: normalizeClass(unref(cls).e("popup-size-scroll"))
|
|
48
|
+
}, {
|
|
49
|
+
default: withCtx(() => [createElementVNode("div", { class: normalizeClass(unref(cls).e("popup-size-list")) }, [(openBlock(), createElementBlock(Fragment, null, renderList(FONT_SIZES, (size) => {
|
|
50
|
+
return createElementVNode("button", {
|
|
51
|
+
key: size,
|
|
52
|
+
type: "button",
|
|
53
|
+
class: normalizeClass([unref(cls).e("popup-size-item"), unref(bem).is("active", currentSize.value === size)]),
|
|
54
|
+
onClick: ($event) => applyFontSize(size)
|
|
55
|
+
}, toDisplayString(size), 11, _hoisted_1);
|
|
56
|
+
}), 64))], 2)]),
|
|
57
|
+
_: 1
|
|
58
|
+
}, 8, ["class"])], 2112);
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
});
|
|
62
|
+
//#endregion
|
|
63
|
+
export { _sfc_main as default };
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { SheetSnapshot } from "@veltra/sheet-core/core/sheet";
|
|
2
|
+
//#region src/components/sheet/popups/import.worker.d.ts
|
|
3
|
+
type ImportWorkerResponse = {
|
|
4
|
+
type: 'progress';
|
|
5
|
+
done: number;
|
|
6
|
+
total: number;
|
|
7
|
+
} | {
|
|
8
|
+
type: 'done';
|
|
9
|
+
ok: true;
|
|
10
|
+
sheets: {
|
|
11
|
+
name: string;
|
|
12
|
+
snapshot: SheetSnapshot;
|
|
13
|
+
}[];
|
|
14
|
+
activeIndex: number;
|
|
15
|
+
} | {
|
|
16
|
+
type: 'done';
|
|
17
|
+
ok: false;
|
|
18
|
+
error: string;
|
|
19
|
+
};
|
|
20
|
+
//#endregion
|
|
21
|
+
export { ImportWorkerResponse };
|