@veltra/sheet 2.4.0 → 2.5.1
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 +50 -7
- package/dist/components/sheet/style2.css +2 -2
- package/dist/index.d.ts +2 -19
- package/dist/index.js +2 -15
- package/dist/types/index.d.ts +1 -3
- package/package.json +5 -6
- package/src/components/sheet/__test__/formula-bar.test.ts +29 -0
- package/src/components/sheet/formula-bar.vue +67 -6
- package/src/components/sheet/style.scss +1 -1
- package/src/index.ts +1 -27
- package/src/types/index.ts +0 -2
- package/dist/components/report/binding-badge.js +0 -118
- package/dist/components/report/designer/cell-coords.js +0 -46
- package/dist/components/report/designer/col-widths.js +0 -29
- package/dist/components/report/designer/conditional-rules/helpers.js +0 -139
- package/dist/components/report/designer/drill-dialog.js +0 -258
- package/dist/components/report/designer/drop-highlight-overlay.js +0 -76
- package/dist/components/report/designer/float-panel.js +0 -434
- package/dist/components/report/designer/role.js +0 -17
- package/dist/components/report/designer/rule-preview.js +0 -33
- package/dist/components/report/designer/rule-row.js +0 -253
- package/dist/components/report/designer/rules-dialog.js +0 -118
- package/dist/components/report/designer/topology-overlay.js +0 -122
- package/dist/components/report/designer/topology.js +0 -64
- package/dist/components/report/designer/use-grid-overlay.js +0 -75
- package/dist/components/report/designer-hub.js +0 -177
- package/dist/components/report/field-panel-helpers.js +0 -33
- package/dist/components/report/field-panel.js +0 -132
- package/dist/components/report/filter-bar.js +0 -74
- package/dist/components/report/hub-connection-form.js +0 -145
- package/dist/components/report/hub-dataset-editor.js +0 -409
- package/dist/components/report/preview-grid-size.js +0 -32
- package/dist/components/report/print.js +0 -39
- package/dist/components/report/report-designer.js +0 -428
- package/dist/components/report/report-viewer.js +0 -253
- package/dist/components/report/style.d.ts +0 -17
- package/dist/components/report/style.js +0 -18
- package/dist/components/report/style2.css +0 -965
- package/dist/components/report/use-report-designer.js +0 -387
- package/dist/components/report/use-report-viewer.js +0 -140
- package/dist/report/binding.d.ts +0 -83
- package/dist/report/binding.js +0 -334
- package/dist/report/connector.d.ts +0 -66
- package/dist/report/connector.js +0 -159
- package/dist/report/drill.d.ts +0 -48
- package/dist/report/drill.js +0 -78
- package/dist/report/export-xlsx.d.ts +0 -13
- package/dist/report/export-xlsx.js +0 -13
- package/dist/report/filter-bar.d.ts +0 -10
- package/dist/report/filter-bar.js +0 -31
- package/dist/report/index.d.ts +0 -14
- package/dist/report/params.d.ts +0 -13
- package/dist/report/params.js +0 -61
- package/dist/report/print.d.ts +0 -23
- package/dist/report/print.js +0 -197
- package/dist/report/render/aggregate.js +0 -193
- package/dist/report/render/builder.d.ts +0 -12
- package/dist/report/render/builder.js +0 -139
- package/dist/report/render/coordinate.d.ts +0 -25
- package/dist/report/render/coordinate.js +0 -733
- package/dist/report/render/index.d.ts +0 -14
- package/dist/report/render/index.js +0 -21
- package/dist/report/render/style-resolver.js +0 -50
- package/dist/report/render/template-index.d.ts +0 -24
- package/dist/report/render/template-index.js +0 -137
- package/dist/report/rules/evaluate.d.ts +0 -25
- package/dist/report/rules/evaluate.js +0 -82
- package/dist/report/rules/index.d.ts +0 -2
- package/dist/report/template.d.ts +0 -63
- package/dist/report/template.js +0 -83
- package/dist/report/types.d.ts +0 -103
- package/dist/types/report-designer.d.ts +0 -51
- package/dist/types/report-viewer.d.ts +0 -57
- package/src/components/report/__test__/binding-badge.test.ts +0 -92
- package/src/components/report/__test__/conditional-rules-helpers.test.ts +0 -88
- package/src/components/report/__test__/field-panel-helpers.test.ts +0 -65
- package/src/components/report/__test__/float-panel-position.test.ts +0 -45
- package/src/components/report/__test__/preview-grid-size.test.ts +0 -63
- package/src/components/report/__test__/report-designer.test.ts +0 -559
- package/src/components/report/__test__/report-drill.test.ts +0 -692
- package/src/components/report/__test__/report-viewer.test.ts +0 -400
- package/src/components/report/__test__/topology.test.ts +0 -143
- package/src/components/report/__test__/use-report-designer.test.ts +0 -804
- package/src/components/report/binding-badge.ts +0 -122
- package/src/components/report/designer/cell-coords.ts +0 -95
- package/src/components/report/designer/col-widths.ts +0 -56
- package/src/components/report/designer/conditional-rules/helpers.ts +0 -189
- package/src/components/report/designer/drill-dialog.vue +0 -245
- package/src/components/report/designer/drop-highlight-overlay.vue +0 -75
- package/src/components/report/designer/float-panel.vue +0 -444
- package/src/components/report/designer/role.ts +0 -32
- package/src/components/report/designer/rule-preview.vue +0 -40
- package/src/components/report/designer/rule-row.vue +0 -252
- package/src/components/report/designer/rules-dialog.vue +0 -110
- package/src/components/report/designer/topology-overlay.vue +0 -128
- package/src/components/report/designer/topology.ts +0 -124
- package/src/components/report/designer/use-grid-overlay.ts +0 -114
- package/src/components/report/designer-hub.vue +0 -198
- package/src/components/report/field-panel-helpers.ts +0 -44
- package/src/components/report/field-panel.vue +0 -136
- package/src/components/report/filter-bar.vue +0 -77
- package/src/components/report/hub-connection-form.vue +0 -124
- package/src/components/report/hub-dataset-editor.vue +0 -387
- package/src/components/report/index.ts +0 -2
- package/src/components/report/preview-grid-size.ts +0 -33
- package/src/components/report/print.ts +0 -44
- package/src/components/report/report-designer.vue +0 -454
- package/src/components/report/report-viewer.vue +0 -289
- package/src/components/report/style-designer.scss +0 -653
- package/src/components/report/style-hub.scss +0 -292
- package/src/components/report/style-viewer.scss +0 -144
- package/src/components/report/style.scss +0 -3
- package/src/components/report/style.ts +0 -20
- package/src/components/report/use-report-designer.ts +0 -603
- package/src/components/report/use-report-viewer.ts +0 -227
- package/src/report/__test__/binding.test.ts +0 -320
- package/src/report/__test__/connector.test.ts +0 -239
- package/src/report/__test__/drill.test.ts +0 -194
- package/src/report/__test__/export-xlsx.test.ts +0 -96
- package/src/report/__test__/filter-bar.test.ts +0 -58
- package/src/report/__test__/params.test.ts +0 -156
- package/src/report/__test__/print.test.ts +0 -170
- package/src/report/__test__/render.test.ts +0 -856
- package/src/report/__test__/rules.test.ts +0 -131
- package/src/report/__test__/template.test.ts +0 -366
- package/src/report/binding.ts +0 -474
- package/src/report/connector.ts +0 -206
- package/src/report/drill.ts +0 -112
- package/src/report/export-xlsx.ts +0 -15
- package/src/report/filter-bar.ts +0 -36
- package/src/report/index.ts +0 -16
- package/src/report/params.ts +0 -96
- package/src/report/print.ts +0 -234
- package/src/report/render/__test__/aggregate.test.ts +0 -16
- package/src/report/render/__test__/coordinate.test.ts +0 -405
- package/src/report/render/aggregate.ts +0 -289
- package/src/report/render/builder.ts +0 -211
- package/src/report/render/coordinate.ts +0 -1239
- package/src/report/render/index.ts +0 -30
- package/src/report/render/style-resolver.ts +0 -68
- package/src/report/render/template-index.ts +0 -200
- package/src/report/rules/evaluate.ts +0 -113
- package/src/report/rules/index.ts +0 -7
- package/src/report/template.ts +0 -145
- package/src/report/types.ts +0 -116
- package/src/types/report-designer.ts +0 -55
- package/src/types/report-viewer.ts +0 -54
|
@@ -1,428 +0,0 @@
|
|
|
1
|
-
import _sfc_main$1 from "../sheet/sheet.js";
|
|
2
|
-
import { applyGridColWidths, applySheetColWidths, readGridColWidths } from "./designer/col-widths.js";
|
|
3
|
-
import _sfc_main$2 from "./report-viewer.js";
|
|
4
|
-
import _sfc_main$3 from "./designer-hub.js";
|
|
5
|
-
import { resolveGridDropAddress } from "./designer/cell-coords.js";
|
|
6
|
-
import _sfc_main$4 from "./designer/drill-dialog.js";
|
|
7
|
-
import _sfc_main$5 from "./designer/drop-highlight-overlay.js";
|
|
8
|
-
import _sfc_main$6 from "./designer/float-panel.js";
|
|
9
|
-
import _sfc_main$7 from "./designer/rules-dialog.js";
|
|
10
|
-
import _sfc_main$8 from "./designer/topology-overlay.js";
|
|
11
|
-
import { FIELD_DRAG_MIME, parseFieldDragPayload } from "./field-panel-helpers.js";
|
|
12
|
-
import _sfc_main$9 from "./field-panel.js";
|
|
13
|
-
import { useReportDesigner } from "./use-report-designer.js";
|
|
14
|
-
import { Fragment, computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, createTextVNode, createVNode, defineComponent, nextTick, normalizeClass, onScopeDispose, openBlock, ref, renderList, shallowRef, toDisplayString, unref, useTemplateRef, watch, withCtx } from "vue";
|
|
15
|
-
import { UButton, UDrawer } from "@veltra/desktop";
|
|
16
|
-
import { bem } from "@veltra/utils";
|
|
17
|
-
import { Workbook } from "@veltra/sheet-core";
|
|
18
|
-
//#region src/components/report/report-designer.vue
|
|
19
|
-
const DESIGN_ROWS = 24;
|
|
20
|
-
const DESIGN_COLS = 10;
|
|
21
|
-
const _sfc_main = /*@__PURE__*/ defineComponent({
|
|
22
|
-
name: "UReportDesigner",
|
|
23
|
-
__name: "report-designer",
|
|
24
|
-
props: {
|
|
25
|
-
connector: {},
|
|
26
|
-
connections: { default: () => [] },
|
|
27
|
-
template: {},
|
|
28
|
-
workbook: {},
|
|
29
|
-
drillTemplates: {},
|
|
30
|
-
resolveTemplate: {}
|
|
31
|
-
},
|
|
32
|
-
emits: ["update:connections", "datasets-change"],
|
|
33
|
-
setup(__props, { expose: __expose, emit: __emit }) {
|
|
34
|
-
/** 与 `ReportDesignerProps` 交叉显式列出下钻 props,避免 SFC 对跨文件 interface 漏抽 runtime 声明 */
|
|
35
|
-
const props = __props;
|
|
36
|
-
const emit = __emit;
|
|
37
|
-
const cls = bem("report-designer");
|
|
38
|
-
/** 设计态网格默认尺寸(新建模板;已声明尺寸后以模型为准,避免删行后被 props 撑回) */
|
|
39
|
-
const EMPTY_CONDITIONAL_RULES = [];
|
|
40
|
-
/** `v-model:connections` 可写代理(连接为纯序列化对象,仅驻留内存) */
|
|
41
|
-
const connections = computed({
|
|
42
|
-
get: () => props.connections,
|
|
43
|
-
set: (value) => emit("update:connections", value)
|
|
44
|
-
});
|
|
45
|
-
const designer = useReportDesigner({
|
|
46
|
-
props,
|
|
47
|
-
connections
|
|
48
|
-
});
|
|
49
|
-
const { workbook, catalog, boundKeys, activeCell, selectionLabel, activeBinding, activeFieldType, activeDatasetFields, resolvedRowParentLabel, resolvedColParentLabel, parentPick, rowParentCandidates, colParentCandidates, bindingEntries, metaTick, getBindingAt, resolveFieldLabel, bindField, patchActiveBinding, startParentPick, cancelParentPick, pickParentAt, clearParent, removeActiveBinding, resolveCellStyle, resolveCellRenderer, getTemplate } = designer;
|
|
50
|
-
/** 渲染行列数跟随模型(删行后不再被固定 props 经 ensureTableSize 撑回) */
|
|
51
|
-
const gridRows = computed(() => {
|
|
52
|
-
const rows = workbook.value.activeSheet.rows;
|
|
53
|
-
return rows > 0 ? rows : DESIGN_ROWS;
|
|
54
|
-
});
|
|
55
|
-
const gridCols = computed(() => {
|
|
56
|
-
const cols = workbook.value.activeSheet.cols;
|
|
57
|
-
return cols > 0 ? cols : DESIGN_COLS;
|
|
58
|
-
});
|
|
59
|
-
const hubVisible = ref(false);
|
|
60
|
-
const rulesDialogVisible = ref(false);
|
|
61
|
-
const drillDialogVisible = ref(false);
|
|
62
|
-
/** 宿主传入可下钻模板列表时才出现下钻配置入口(不传则无入口,spec 兼容性要求) */
|
|
63
|
-
const hasDrillTemplates = computed(() => (props.drillTemplates?.length ?? 0) > 0);
|
|
64
|
-
const pickCandidateCells = computed(() => {
|
|
65
|
-
if (!parentPick.value) return [];
|
|
66
|
-
return parentPick.value.mode === "row" ? rowParentCandidates.value : colParentCandidates.value;
|
|
67
|
-
});
|
|
68
|
-
function onHubClose() {
|
|
69
|
-
hubVisible.value = false;
|
|
70
|
-
}
|
|
71
|
-
watch(hubVisible, (open) => {
|
|
72
|
-
if (!open) emit("datasets-change");
|
|
73
|
-
});
|
|
74
|
-
watch(() => designer.datasets.value, () => emit("datasets-change"), { deep: true });
|
|
75
|
-
const sheetRef = useTemplateRef("sheetRef");
|
|
76
|
-
const previewViewerRef = useTemplateRef("previewViewerRef");
|
|
77
|
-
const gridHostRef = useTemplateRef("gridHostRef");
|
|
78
|
-
const gridHostEl = computed(() => gridHostRef.value ?? null);
|
|
79
|
-
/** 字段拖拽落点高亮(dragover 时更新;落空时 overlay 提示回退当前选区) */
|
|
80
|
-
const isFieldDragging = ref(false);
|
|
81
|
-
const dropTargetAddr = ref(null);
|
|
82
|
-
function getDesignGrid() {
|
|
83
|
-
return sheetRef.value?.getGrid();
|
|
84
|
-
}
|
|
85
|
-
const viewMode = ref("design");
|
|
86
|
-
const isPreview = computed(() => viewMode.value === "preview");
|
|
87
|
-
/** 进入预览时的模板快照(getTemplate 吐出,设计态工作簿不受预览取数影响,切回绑定不丢) */
|
|
88
|
-
const previewTemplate = shallowRef(null);
|
|
89
|
-
/** 预览工作簿自持(XLSX 导出需要拿到填充后的 sheet,05 票 workbook? prop 先例) */
|
|
90
|
-
const previewWorkbook = new Workbook();
|
|
91
|
-
/** 当前设计态列宽(与 Sheet 模型同步;getTemplate 经 snapshot.colWidths 吐出) */
|
|
92
|
-
const designColWidths = ref([]);
|
|
93
|
-
const exporting = ref(false);
|
|
94
|
-
/** 从当前设计网格捕获列宽并写回 Sheet 模型(网格未就绪则保留旧值) */
|
|
95
|
-
function captureDesignColWidths() {
|
|
96
|
-
const widths = readGridColWidths(getDesignGrid(), Array.from({ length: gridCols.value }, (_, col) => col));
|
|
97
|
-
if (!widths) return;
|
|
98
|
-
const custom = widths.filter(([, width]) => width > 0);
|
|
99
|
-
designColWidths.value = custom;
|
|
100
|
-
applySheetColWidths(workbook.value.activeSheet, custom);
|
|
101
|
-
}
|
|
102
|
-
/** 设计网格重建后补刷新与列宽(restore 不发 content-reset 的场景由 grid 自行订阅,这里只管列宽) */
|
|
103
|
-
function syncDesignGridView() {
|
|
104
|
-
const grid = getDesignGrid();
|
|
105
|
-
grid?.flushPending();
|
|
106
|
-
grid?.refresh();
|
|
107
|
-
applyGridColWidths(grid, designColWidths.value);
|
|
108
|
-
}
|
|
109
|
-
function setViewMode(mode) {
|
|
110
|
-
if (viewMode.value === mode) return;
|
|
111
|
-
if (mode === "preview") {
|
|
112
|
-
captureDesignColWidths();
|
|
113
|
-
previewTemplate.value = getTemplate();
|
|
114
|
-
}
|
|
115
|
-
viewMode.value = mode;
|
|
116
|
-
if (mode === "design") nextTick(syncDesignGridView);
|
|
117
|
-
}
|
|
118
|
-
watch(() => props.template, (template) => {
|
|
119
|
-
viewMode.value = "design";
|
|
120
|
-
designColWidths.value = template?.colWidths?.length ? template.colWidths.map(([col, width]) => [col, width]) : [];
|
|
121
|
-
if (designColWidths.value.length) applySheetColWidths(workbook.value.activeSheet, designColWidths.value);
|
|
122
|
-
nextTick(syncDesignGridView);
|
|
123
|
-
});
|
|
124
|
-
watch(activeCell, (cell) => {
|
|
125
|
-
if (cell && parentPick.value) pickParentAt(cell);
|
|
126
|
-
});
|
|
127
|
-
watch(catalog, () => {
|
|
128
|
-
nextTick(() => getDesignGrid()?.refresh());
|
|
129
|
-
});
|
|
130
|
-
const offStructureChange = workbook.value.activeSheet.on("structure-change", () => {
|
|
131
|
-
nextTick(syncDesignGridView);
|
|
132
|
-
});
|
|
133
|
-
onScopeDispose(offStructureChange);
|
|
134
|
-
async function exportPreviewXlsx() {
|
|
135
|
-
if (!isPreview.value || exporting.value) return;
|
|
136
|
-
const viewer = previewViewerRef.value;
|
|
137
|
-
if (!viewer) throw new Error("预览查看器尚未就绪,请稍后再导出");
|
|
138
|
-
exporting.value = true;
|
|
139
|
-
try {
|
|
140
|
-
await viewer.exportXlsx();
|
|
141
|
-
} finally {
|
|
142
|
-
exporting.value = false;
|
|
143
|
-
}
|
|
144
|
-
}
|
|
145
|
-
function saveConditionalRules(rules) {
|
|
146
|
-
patchActiveBinding({ conditionalRules: rules });
|
|
147
|
-
}
|
|
148
|
-
function saveDrill(drill) {
|
|
149
|
-
patchActiveBinding({ drill });
|
|
150
|
-
}
|
|
151
|
-
function removeDrill() {
|
|
152
|
-
patchActiveBinding({ drill: void 0 });
|
|
153
|
-
}
|
|
154
|
-
function clearDropState() {
|
|
155
|
-
isFieldDragging.value = false;
|
|
156
|
-
dropTargetAddr.value = null;
|
|
157
|
-
}
|
|
158
|
-
function resolveDropAddress(event) {
|
|
159
|
-
const grid = getDesignGrid();
|
|
160
|
-
const gridEl = gridHostRef.value?.querySelector(".u-sheet__grid-instance");
|
|
161
|
-
if (!grid || !gridEl) return null;
|
|
162
|
-
return resolveGridDropAddress(grid, gridEl, event.clientX, event.clientY);
|
|
163
|
-
}
|
|
164
|
-
function onGridDragOver(event) {
|
|
165
|
-
if (!event.dataTransfer?.types.includes("application/x-sheet-report-field")) return;
|
|
166
|
-
event.preventDefault();
|
|
167
|
-
event.dataTransfer.dropEffect = "copy";
|
|
168
|
-
isFieldDragging.value = true;
|
|
169
|
-
dropTargetAddr.value = resolveDropAddress(event);
|
|
170
|
-
}
|
|
171
|
-
function onGridDragLeave(event) {
|
|
172
|
-
const host = gridHostRef.value;
|
|
173
|
-
const related = event.relatedTarget;
|
|
174
|
-
if (host && related instanceof Node && host.contains(related)) return;
|
|
175
|
-
clearDropState();
|
|
176
|
-
}
|
|
177
|
-
function onGridDrop(event) {
|
|
178
|
-
event.preventDefault();
|
|
179
|
-
clearDropState();
|
|
180
|
-
const raw = event.dataTransfer?.getData(FIELD_DRAG_MIME);
|
|
181
|
-
const payload = raw ? parseFieldDragPayload(raw) : null;
|
|
182
|
-
if (!payload) return;
|
|
183
|
-
const grid = getDesignGrid();
|
|
184
|
-
const gridEl = gridHostRef.value?.querySelector(".u-sheet__grid-instance");
|
|
185
|
-
if (!grid || !gridEl) return;
|
|
186
|
-
const dropAddr = resolveDropAddress(event);
|
|
187
|
-
if (dropAddr) {
|
|
188
|
-
bindField(payload.datasetId, payload.fieldName, dropAddr);
|
|
189
|
-
sheetRef.value?.getContext().selectCell(dropAddr);
|
|
190
|
-
} else bindField(payload.datasetId, payload.fieldName);
|
|
191
|
-
}
|
|
192
|
-
__expose({ getTemplate: () => {
|
|
193
|
-
captureDesignColWidths();
|
|
194
|
-
return getTemplate();
|
|
195
|
-
} });
|
|
196
|
-
return (_ctx, _cache) => {
|
|
197
|
-
return openBlock(), createElementBlock("div", { class: normalizeClass(unref(cls).b) }, [
|
|
198
|
-
createElementVNode("div", { class: normalizeClass(unref(cls).e("toolbar")) }, [
|
|
199
|
-
createVNode(unref(UButton), {
|
|
200
|
-
size: "small",
|
|
201
|
-
plain: "",
|
|
202
|
-
onClick: _cache[0] || (_cache[0] = ($event) => hubVisible.value = true)
|
|
203
|
-
}, {
|
|
204
|
-
default: withCtx(() => [..._cache[8] || (_cache[8] = [createTextVNode("数据中枢", -1)])]),
|
|
205
|
-
_: 1
|
|
206
|
-
}),
|
|
207
|
-
createElementVNode("div", {
|
|
208
|
-
class: normalizeClass(unref(cls).e("mode-toggle")),
|
|
209
|
-
role: "group",
|
|
210
|
-
"aria-label": "视图模式"
|
|
211
|
-
}, [createVNode(unref(UButton), {
|
|
212
|
-
size: "small",
|
|
213
|
-
type: !isPreview.value ? "primary" : void 0,
|
|
214
|
-
plain: isPreview.value,
|
|
215
|
-
onClick: _cache[1] || (_cache[1] = ($event) => setViewMode("design"))
|
|
216
|
-
}, {
|
|
217
|
-
default: withCtx(() => [..._cache[9] || (_cache[9] = [createTextVNode(" 设计模式 ", -1)])]),
|
|
218
|
-
_: 1
|
|
219
|
-
}, 8, ["type", "plain"]), createVNode(unref(UButton), {
|
|
220
|
-
size: "small",
|
|
221
|
-
type: isPreview.value ? "primary" : void 0,
|
|
222
|
-
plain: !isPreview.value,
|
|
223
|
-
onClick: _cache[2] || (_cache[2] = ($event) => setViewMode("preview"))
|
|
224
|
-
}, {
|
|
225
|
-
default: withCtx(() => [..._cache[10] || (_cache[10] = [createTextVNode(" 预览模式 ", -1)])]),
|
|
226
|
-
_: 1
|
|
227
|
-
}, 8, ["type", "plain"])], 2),
|
|
228
|
-
isPreview.value ? (openBlock(), createBlock(unref(UButton), {
|
|
229
|
-
key: 0,
|
|
230
|
-
size: "small",
|
|
231
|
-
type: "primary",
|
|
232
|
-
plain: "",
|
|
233
|
-
loading: exporting.value,
|
|
234
|
-
onClick: exportPreviewXlsx
|
|
235
|
-
}, {
|
|
236
|
-
default: withCtx(() => [..._cache[11] || (_cache[11] = [createTextVNode(" 导出 XLSX ", -1)])]),
|
|
237
|
-
_: 1
|
|
238
|
-
}, 8, ["loading"])) : createCommentVNode("v-if", true),
|
|
239
|
-
createElementVNode("span", { class: normalizeClass(unref(cls).e("hint")) }, " 在数据中枢配置连接与 SQL 数据集,再将左侧字段点击或拖拽到单元格完成绑定;选中已绑定格可通过悬浮卡片调整预设与条件样式。 ", 2)
|
|
240
|
-
], 2),
|
|
241
|
-
!isPreview.value ? (openBlock(), createElementBlock("div", {
|
|
242
|
-
key: 0,
|
|
243
|
-
class: normalizeClass(unref(cls).e("body"))
|
|
244
|
-
}, [createVNode(_sfc_main$9, {
|
|
245
|
-
class: normalizeClass(unref(cls).e("field-panel")),
|
|
246
|
-
datasets: unref(catalog),
|
|
247
|
-
"selection-label": unref(selectionLabel),
|
|
248
|
-
"bound-keys": unref(boundKeys),
|
|
249
|
-
onBind: unref(bindField)
|
|
250
|
-
}, null, 8, [
|
|
251
|
-
"class",
|
|
252
|
-
"datasets",
|
|
253
|
-
"selection-label",
|
|
254
|
-
"bound-keys",
|
|
255
|
-
"onBind"
|
|
256
|
-
]), createElementVNode("div", {
|
|
257
|
-
ref_key: "gridHostRef",
|
|
258
|
-
ref: gridHostRef,
|
|
259
|
-
class: normalizeClass(unref(cls).e("grid")),
|
|
260
|
-
onDragover: onGridDragOver,
|
|
261
|
-
onDragleave: onGridDragLeave,
|
|
262
|
-
onDrop: onGridDrop
|
|
263
|
-
}, [
|
|
264
|
-
createVNode(unref(_sfc_main$1), {
|
|
265
|
-
ref_key: "sheetRef",
|
|
266
|
-
ref: sheetRef,
|
|
267
|
-
class: normalizeClass(unref(cls).e("sheet")),
|
|
268
|
-
workbook: unref(workbook),
|
|
269
|
-
rows: gridRows.value,
|
|
270
|
-
cols: gridCols.value,
|
|
271
|
-
"show-tabs": false,
|
|
272
|
-
"resolve-cell-style": unref(resolveCellStyle),
|
|
273
|
-
"resolve-cell-renderer": unref(resolveCellRenderer)
|
|
274
|
-
}, null, 8, [
|
|
275
|
-
"class",
|
|
276
|
-
"workbook",
|
|
277
|
-
"rows",
|
|
278
|
-
"cols",
|
|
279
|
-
"resolve-cell-style",
|
|
280
|
-
"resolve-cell-renderer"
|
|
281
|
-
]),
|
|
282
|
-
createVNode(_sfc_main$8, {
|
|
283
|
-
cell: unref(activeCell),
|
|
284
|
-
binding: unref(activeBinding) ?? null,
|
|
285
|
-
entries: unref(bindingEntries),
|
|
286
|
-
"meta-tick": unref(metaTick),
|
|
287
|
-
"host-el": gridHostEl.value,
|
|
288
|
-
"get-grid": getDesignGrid,
|
|
289
|
-
"get-binding-at": unref(getBindingAt)
|
|
290
|
-
}, null, 8, [
|
|
291
|
-
"cell",
|
|
292
|
-
"binding",
|
|
293
|
-
"entries",
|
|
294
|
-
"meta-tick",
|
|
295
|
-
"host-el",
|
|
296
|
-
"get-binding-at"
|
|
297
|
-
]),
|
|
298
|
-
createVNode(_sfc_main$5, {
|
|
299
|
-
cell: dropTargetAddr.value,
|
|
300
|
-
"host-el": gridHostEl.value,
|
|
301
|
-
"get-grid": getDesignGrid,
|
|
302
|
-
dragging: isFieldDragging.value,
|
|
303
|
-
"fallback-label": unref(selectionLabel)
|
|
304
|
-
}, null, 8, [
|
|
305
|
-
"cell",
|
|
306
|
-
"host-el",
|
|
307
|
-
"dragging",
|
|
308
|
-
"fallback-label"
|
|
309
|
-
]),
|
|
310
|
-
(openBlock(true), createElementBlock(Fragment, null, renderList(pickCandidateCells.value, (addr) => {
|
|
311
|
-
return openBlock(), createBlock(_sfc_main$5, {
|
|
312
|
-
key: `pick-${addr.row}-${addr.col}`,
|
|
313
|
-
cell: addr,
|
|
314
|
-
"host-el": gridHostEl.value,
|
|
315
|
-
"get-grid": getDesignGrid,
|
|
316
|
-
dragging: false,
|
|
317
|
-
"fallback-label": ""
|
|
318
|
-
}, null, 8, ["cell", "host-el"]);
|
|
319
|
-
}), 128)),
|
|
320
|
-
unref(parentPick) ? (openBlock(), createElementBlock("div", {
|
|
321
|
-
key: 0,
|
|
322
|
-
class: normalizeClass(unref(cls).e("pick-hint")),
|
|
323
|
-
role: "status"
|
|
324
|
-
}, toDisplayString(unref(parentPick).mode === "row" ? "点击分组头作为行方向父格" : "点击分组头作为列方向父格"), 3)) : createCommentVNode("v-if", true),
|
|
325
|
-
createVNode(_sfc_main$6, {
|
|
326
|
-
cell: unref(activeCell),
|
|
327
|
-
binding: unref(activeBinding) ?? null,
|
|
328
|
-
"resolved-row-parent-label": unref(resolvedRowParentLabel),
|
|
329
|
-
"resolved-col-parent-label": unref(resolvedColParentLabel),
|
|
330
|
-
"parent-pick-mode": unref(parentPick)?.mode ?? null,
|
|
331
|
-
"row-parent-candidates": unref(rowParentCandidates),
|
|
332
|
-
"col-parent-candidates": unref(colParentCandidates),
|
|
333
|
-
"show-drill": hasDrillTemplates.value,
|
|
334
|
-
"resolve-field-label": unref(resolveFieldLabel),
|
|
335
|
-
"get-binding-at": unref(getBindingAt),
|
|
336
|
-
"host-el": gridHostEl.value,
|
|
337
|
-
"get-grid": getDesignGrid,
|
|
338
|
-
onPatch: unref(patchActiveBinding),
|
|
339
|
-
onRemove: unref(removeActiveBinding),
|
|
340
|
-
onOpenRules: _cache[3] || (_cache[3] = ($event) => rulesDialogVisible.value = true),
|
|
341
|
-
onOpenDrill: _cache[4] || (_cache[4] = ($event) => drillDialogVisible.value = true),
|
|
342
|
-
onStartParentPick: unref(startParentPick),
|
|
343
|
-
onCancelParentPick: unref(cancelParentPick),
|
|
344
|
-
onClearParent: unref(clearParent)
|
|
345
|
-
}, null, 8, [
|
|
346
|
-
"cell",
|
|
347
|
-
"binding",
|
|
348
|
-
"resolved-row-parent-label",
|
|
349
|
-
"resolved-col-parent-label",
|
|
350
|
-
"parent-pick-mode",
|
|
351
|
-
"row-parent-candidates",
|
|
352
|
-
"col-parent-candidates",
|
|
353
|
-
"show-drill",
|
|
354
|
-
"resolve-field-label",
|
|
355
|
-
"get-binding-at",
|
|
356
|
-
"host-el",
|
|
357
|
-
"onPatch",
|
|
358
|
-
"onRemove",
|
|
359
|
-
"onStartParentPick",
|
|
360
|
-
"onCancelParentPick",
|
|
361
|
-
"onClearParent"
|
|
362
|
-
])
|
|
363
|
-
], 34)], 2)) : previewTemplate.value ? (openBlock(), createElementBlock("div", {
|
|
364
|
-
key: 1,
|
|
365
|
-
class: normalizeClass(unref(cls).e("preview"))
|
|
366
|
-
}, [createVNode(_sfc_main$2, {
|
|
367
|
-
ref_key: "previewViewerRef",
|
|
368
|
-
ref: previewViewerRef,
|
|
369
|
-
connector: props.connector,
|
|
370
|
-
template: previewTemplate.value,
|
|
371
|
-
workbook: unref(previewWorkbook),
|
|
372
|
-
"resolve-template": props.resolveTemplate
|
|
373
|
-
}, null, 8, [
|
|
374
|
-
"connector",
|
|
375
|
-
"template",
|
|
376
|
-
"workbook",
|
|
377
|
-
"resolve-template"
|
|
378
|
-
])], 2)) : createCommentVNode("v-if", true),
|
|
379
|
-
createVNode(unref(UDrawer), {
|
|
380
|
-
modelValue: hubVisible.value,
|
|
381
|
-
"onUpdate:modelValue": _cache[5] || (_cache[5] = ($event) => hubVisible.value = $event),
|
|
382
|
-
class: normalizeClass(unref(cls).e("hub-drawer")),
|
|
383
|
-
"show-close": ""
|
|
384
|
-
}, {
|
|
385
|
-
default: withCtx(() => [createVNode(_sfc_main$3, {
|
|
386
|
-
hub: unref(designer),
|
|
387
|
-
onClose: onHubClose
|
|
388
|
-
}, null, 8, ["hub"])]),
|
|
389
|
-
_: 1
|
|
390
|
-
}, 8, ["modelValue", "class"]),
|
|
391
|
-
createVNode(_sfc_main$7, {
|
|
392
|
-
modelValue: rulesDialogVisible.value,
|
|
393
|
-
"onUpdate:modelValue": _cache[6] || (_cache[6] = ($event) => rulesDialogVisible.value = $event),
|
|
394
|
-
rules: unref(activeBinding)?.conditionalRules ?? EMPTY_CONDITIONAL_RULES,
|
|
395
|
-
"binding-field": unref(activeBinding)?.field ?? "",
|
|
396
|
-
"dataset-fields": unref(activeDatasetFields),
|
|
397
|
-
"field-type": unref(activeFieldType),
|
|
398
|
-
onSave: saveConditionalRules
|
|
399
|
-
}, null, 8, [
|
|
400
|
-
"modelValue",
|
|
401
|
-
"rules",
|
|
402
|
-
"binding-field",
|
|
403
|
-
"dataset-fields",
|
|
404
|
-
"field-type"
|
|
405
|
-
]),
|
|
406
|
-
hasDrillTemplates.value ? (openBlock(), createBlock(_sfc_main$4, {
|
|
407
|
-
key: 2,
|
|
408
|
-
modelValue: drillDialogVisible.value,
|
|
409
|
-
"onUpdate:modelValue": _cache[7] || (_cache[7] = ($event) => drillDialogVisible.value = $event),
|
|
410
|
-
templates: props.drillTemplates ?? [],
|
|
411
|
-
fields: unref(activeDatasetFields),
|
|
412
|
-
drill: unref(activeBinding)?.drill,
|
|
413
|
-
"resolve-template": props.resolveTemplate,
|
|
414
|
-
onSave: saveDrill,
|
|
415
|
-
onRemove: removeDrill
|
|
416
|
-
}, null, 8, [
|
|
417
|
-
"modelValue",
|
|
418
|
-
"templates",
|
|
419
|
-
"fields",
|
|
420
|
-
"drill",
|
|
421
|
-
"resolve-template"
|
|
422
|
-
])) : createCommentVNode("v-if", true)
|
|
423
|
-
], 2);
|
|
424
|
-
};
|
|
425
|
-
}
|
|
426
|
-
});
|
|
427
|
-
//#endregion
|
|
428
|
-
export { _sfc_main as default };
|
|
@@ -1,253 +0,0 @@
|
|
|
1
|
-
import _sfc_main$1 from "../sheet/sheet.js";
|
|
2
|
-
import { exportFilledReportXlsx } from "../../report/export-xlsx.js";
|
|
3
|
-
import { buildFilledReportPrintHtml } from "../../report/print.js";
|
|
4
|
-
import { applyGridColWidths, applySheetColWidths } from "./designer/col-widths.js";
|
|
5
|
-
import _sfc_main$2 from "./filter-bar.js";
|
|
6
|
-
import { previewGridSize } from "./preview-grid-size.js";
|
|
7
|
-
import { printHtmlDocument } from "./print.js";
|
|
8
|
-
import { useReportViewer } from "./use-report-viewer.js";
|
|
9
|
-
import { computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, createTextVNode, createVNode, defineComponent, nextTick, normalizeClass, openBlock, ref, resolveComponent, shallowRef, toDisplayString, unref, useTemplateRef, watch, withCtx } from "vue";
|
|
10
|
-
import { UButton, UDialog } from "@veltra/desktop";
|
|
11
|
-
import { bem } from "@veltra/utils";
|
|
12
|
-
import { saveBlob } from "@cat-kit/fe";
|
|
13
|
-
import { Workbook } from "@veltra/sheet-core";
|
|
14
|
-
//#region src/components/report/report-viewer.vue
|
|
15
|
-
const EXPORT_NOT_READY_MESSAGE = "报表数据尚未就绪,请等待取数完成后再导出";
|
|
16
|
-
const EXPORT_LOADING_MESSAGE = "报表数据加载中,请稍后再导出";
|
|
17
|
-
/** 取数未完成时拒绝打印的可读错误 */
|
|
18
|
-
const PRINT_NOT_READY_MESSAGE = "报表数据尚未就绪,请等待取数完成后再打印";
|
|
19
|
-
const PRINT_LOADING_MESSAGE = "报表数据加载中,请稍后再打印";
|
|
20
|
-
/** 查看器工作簿:宿主可注入(同 USheet `workbook?` 先例),缺省内部自建;模板 / 填充结果都 restore 进活动 sheet 只读展示 */
|
|
21
|
-
const _sfc_main = /*@__PURE__*/ defineComponent({
|
|
22
|
-
name: "UReportViewer",
|
|
23
|
-
__name: "report-viewer",
|
|
24
|
-
props: {
|
|
25
|
-
connector: {},
|
|
26
|
-
template: {},
|
|
27
|
-
workbook: {},
|
|
28
|
-
colWidths: {},
|
|
29
|
-
resolveTemplate: { type: Function },
|
|
30
|
-
initialValues: {}
|
|
31
|
-
},
|
|
32
|
-
setup(__props, { expose: __expose }) {
|
|
33
|
-
/** 与 `ReportViewerProps` 交叉显式列出下钻 props,避免 SFC 对跨文件 interface 漏抽 runtime 声明 */
|
|
34
|
-
const props = __props;
|
|
35
|
-
const cls = bem("report-viewer");
|
|
36
|
-
/** 取数未完成时拒绝导出的可读错误 */
|
|
37
|
-
const internalWorkbook = new Workbook();
|
|
38
|
-
const workbook = computed(() => props.workbook ?? internalWorkbook);
|
|
39
|
-
const sheetRef = useTemplateRef("sheetRef");
|
|
40
|
-
const { params, values, loading, error, filledSnapshot, filledColWidths, currentTemplate, canDrillBack, resolveDrillHit, resolveDrillTarget, drillInto, drillBack, refresh, setValues } = useReportViewer(props);
|
|
41
|
-
/** 配了下钻的单元格在查看态展示可点击链接样式(蓝字 + 下划线),便于用户直观感知 */
|
|
42
|
-
const resolveViewerCellStyle = (addr, base) => {
|
|
43
|
-
if (!props.resolveTemplate) return base;
|
|
44
|
-
if (!resolveDrillHit(addr)) return base;
|
|
45
|
-
return {
|
|
46
|
-
...base,
|
|
47
|
-
font: {
|
|
48
|
-
...base?.font,
|
|
49
|
-
color: base?.font?.color ?? "#2f54eb",
|
|
50
|
-
underline: base?.font?.underline ?? true
|
|
51
|
-
}
|
|
52
|
-
};
|
|
53
|
-
};
|
|
54
|
-
/** 弹框下钻:先挂 UDialog 再打开,避免 modelValue 初始为 true 时 overlay 不进入 */
|
|
55
|
-
const drillDialogVisible = ref(false);
|
|
56
|
-
const drillDialog = shallowRef(null);
|
|
57
|
-
const renderSize = computed(() => {
|
|
58
|
-
const filled = filledSnapshot.value;
|
|
59
|
-
if (filled) return previewGridSize(filled, "filled");
|
|
60
|
-
return previewGridSize(currentTemplate.value, "template");
|
|
61
|
-
});
|
|
62
|
-
/** 宿主显式传入优先;否则取数完成后用展开映射列宽;再回落当前层模板设计态列宽 */
|
|
63
|
-
const effectiveColWidths = computed(() => {
|
|
64
|
-
if (props.colWidths?.length) return props.colWidths;
|
|
65
|
-
if (filledColWidths.value?.length) return filledColWidths.value;
|
|
66
|
-
return currentTemplate.value.colWidths;
|
|
67
|
-
});
|
|
68
|
-
/** 将运行时列宽写入模型与 VTable(模型为单一事实源;grid 构造/content-reset 也会回放) */
|
|
69
|
-
function applyRuntimeColWidths() {
|
|
70
|
-
if (!effectiveColWidths.value?.length) return;
|
|
71
|
-
const sheet = workbook.value.activeSheet;
|
|
72
|
-
applySheetColWidths(sheet, effectiveColWidths.value);
|
|
73
|
-
applyGridColWidths(sheetRef.value?.getGrid(), effectiveColWidths.value);
|
|
74
|
-
}
|
|
75
|
-
/**
|
|
76
|
-
* restore 负责尺寸/冻结/行高/列宽/选区(静默),restoreContent 发 content-reset
|
|
77
|
-
* 触发网格全量刷新(grid 层订阅直刷,无需手动 flush);history.clear 使填充不进 undo
|
|
78
|
-
*/
|
|
79
|
-
function applySnapshot(snapshot, mode) {
|
|
80
|
-
const size = previewGridSize(snapshot, mode);
|
|
81
|
-
const trimmed = {
|
|
82
|
-
...snapshot,
|
|
83
|
-
rows: size.rows,
|
|
84
|
-
cols: size.cols
|
|
85
|
-
};
|
|
86
|
-
const sheet = workbook.value.activeSheet;
|
|
87
|
-
sheet.restore(trimmed);
|
|
88
|
-
sheet.restoreContent(trimmed);
|
|
89
|
-
sheet.history.clear();
|
|
90
|
-
nextTick(applyRuntimeColWidths);
|
|
91
|
-
}
|
|
92
|
-
watch(currentTemplate, (template) => applySnapshot(template, "template"), { immediate: true });
|
|
93
|
-
watch(filledSnapshot, (filled) => {
|
|
94
|
-
if (filled) applySnapshot(filled, "filled");
|
|
95
|
-
});
|
|
96
|
-
watch(effectiveColWidths, applyRuntimeColWidths);
|
|
97
|
-
/** 悬停命中下钻格时给网格加 cursor 提示 */
|
|
98
|
-
const drillHover = ref(false);
|
|
99
|
-
let pointerStart = null;
|
|
100
|
-
watch(drillDialogVisible, (visible) => {
|
|
101
|
-
if (!visible) drillDialog.value = null;
|
|
102
|
-
});
|
|
103
|
-
async function openDrillDialog(config, record) {
|
|
104
|
-
const next = await resolveDrillTarget(config, record);
|
|
105
|
-
if (!next) return;
|
|
106
|
-
drillDialog.value = next;
|
|
107
|
-
await nextTick();
|
|
108
|
-
drillDialogVisible.value = true;
|
|
109
|
-
}
|
|
110
|
-
/** 事件坐标 → 模型地址(经当前 SheetGrid 命中测试;网格随内容尺寸重建,实例按事件时刻取) */
|
|
111
|
-
function resolveEventAddr(event) {
|
|
112
|
-
const gridEl = event.currentTarget.querySelector(".u-sheet__grid-instance");
|
|
113
|
-
const grid = sheetRef.value?.getGrid();
|
|
114
|
-
if (!gridEl || !grid) return null;
|
|
115
|
-
const rect = gridEl.getBoundingClientRect();
|
|
116
|
-
return grid.hitTestSheetAddr(event.clientX - rect.left, event.clientY - rect.top);
|
|
117
|
-
}
|
|
118
|
-
function handleGridPointerDown(event) {
|
|
119
|
-
pointerStart = {
|
|
120
|
-
x: event.clientX,
|
|
121
|
-
y: event.clientY
|
|
122
|
-
};
|
|
123
|
-
}
|
|
124
|
-
function handleGridClick(event) {
|
|
125
|
-
if (!props.resolveTemplate) return;
|
|
126
|
-
const start = pointerStart;
|
|
127
|
-
pointerStart = null;
|
|
128
|
-
if (start) {
|
|
129
|
-
const dx = event.clientX - start.x;
|
|
130
|
-
const dy = event.clientY - start.y;
|
|
131
|
-
if (dx * dx + dy * dy > 16) return;
|
|
132
|
-
}
|
|
133
|
-
const addr = resolveEventAddr(event);
|
|
134
|
-
if (!addr) return;
|
|
135
|
-
const hit = resolveDrillHit(addr);
|
|
136
|
-
if (!hit) return;
|
|
137
|
-
if (hit.config.openMode === "dialog") {
|
|
138
|
-
openDrillDialog(hit.config, hit.record);
|
|
139
|
-
return;
|
|
140
|
-
}
|
|
141
|
-
drillInto(hit.config, hit.record);
|
|
142
|
-
}
|
|
143
|
-
function handleGridPointerMove(event) {
|
|
144
|
-
const addr = props.resolveTemplate ? resolveEventAddr(event) : null;
|
|
145
|
-
const next = !!(addr ? resolveDrillHit(addr) : null);
|
|
146
|
-
if (next !== drillHover.value) drillHover.value = next;
|
|
147
|
-
}
|
|
148
|
-
function handleGridPointerLeave() {
|
|
149
|
-
drillHover.value = false;
|
|
150
|
-
}
|
|
151
|
-
async function exportXlsx() {
|
|
152
|
-
if (loading.value) throw new Error(EXPORT_LOADING_MESSAGE);
|
|
153
|
-
if (!filledSnapshot.value) throw new Error(EXPORT_NOT_READY_MESSAGE);
|
|
154
|
-
const sheet = workbook.value.activeSheet;
|
|
155
|
-
const buffer = await exportFilledReportXlsx(sheet);
|
|
156
|
-
saveBlob(new Blob([buffer], { type: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" }), `${sheet.name || "报表"}.xlsx`);
|
|
157
|
-
}
|
|
158
|
-
/**
|
|
159
|
-
* 打印填充报表(纯前端):填充 sheet 模型 → 打印专用 HTML(buildFilledReportPrintHtml)
|
|
160
|
-
* → 隐藏 iframe 调起浏览器打印。守卫语义与 exportXlsx 一致(取数完成前拒绝)。
|
|
161
|
-
*/
|
|
162
|
-
function print(options) {
|
|
163
|
-
if (loading.value) throw new Error(PRINT_LOADING_MESSAGE);
|
|
164
|
-
if (!filledSnapshot.value) throw new Error(PRINT_NOT_READY_MESSAGE);
|
|
165
|
-
printHtmlDocument(buildFilledReportPrintHtml(workbook.value.activeSheet, options));
|
|
166
|
-
}
|
|
167
|
-
__expose({
|
|
168
|
-
refresh,
|
|
169
|
-
exportXlsx,
|
|
170
|
-
print
|
|
171
|
-
});
|
|
172
|
-
return (_ctx, _cache) => {
|
|
173
|
-
const _component_u_report_viewer = resolveComponent("u-report-viewer");
|
|
174
|
-
return openBlock(), createElementBlock("div", { class: normalizeClass(unref(cls).b) }, [
|
|
175
|
-
unref(params).length ? (openBlock(), createBlock(_sfc_main$2, {
|
|
176
|
-
key: 0,
|
|
177
|
-
"query-params": unref(params),
|
|
178
|
-
values: unref(values),
|
|
179
|
-
"onUpdate:values": unref(setValues)
|
|
180
|
-
}, null, 8, [
|
|
181
|
-
"query-params",
|
|
182
|
-
"values",
|
|
183
|
-
"onUpdate:values"
|
|
184
|
-
])) : createCommentVNode("v-if", true),
|
|
185
|
-
unref(canDrillBack) ? (openBlock(), createElementBlock("div", {
|
|
186
|
-
key: 1,
|
|
187
|
-
class: normalizeClass(unref(cls).e("drill-bar"))
|
|
188
|
-
}, [createVNode(unref(UButton), {
|
|
189
|
-
size: "small",
|
|
190
|
-
plain: "",
|
|
191
|
-
onClick: unref(drillBack)
|
|
192
|
-
}, {
|
|
193
|
-
default: withCtx(() => [..._cache[1] || (_cache[1] = [createTextVNode("返回上一层", -1)])]),
|
|
194
|
-
_: 1
|
|
195
|
-
}, 8, ["onClick"])], 2)) : createCommentVNode("v-if", true),
|
|
196
|
-
createElementVNode("div", { class: normalizeClass(unref(cls).e("body")) }, [unref(loading) ? (openBlock(), createElementBlock("div", {
|
|
197
|
-
key: 0,
|
|
198
|
-
class: normalizeClass(unref(cls).e("loading")),
|
|
199
|
-
"aria-live": "polite"
|
|
200
|
-
}, [createElementVNode("div", { class: normalizeClass(unref(cls).e("loading-spinner")) }, null, 2), _cache[2] || (_cache[2] = createElementVNode("span", null, "正在加载报表数据…", -1))], 2)) : unref(error) ? (openBlock(), createElementBlock("div", {
|
|
201
|
-
key: 1,
|
|
202
|
-
class: normalizeClass(unref(cls).e("error")),
|
|
203
|
-
role: "alert"
|
|
204
|
-
}, toDisplayString(unref(error).message), 3)) : createCommentVNode("v-if", true), createVNode(unref(_sfc_main$1), {
|
|
205
|
-
ref_key: "sheetRef",
|
|
206
|
-
ref: sheetRef,
|
|
207
|
-
class: normalizeClass([unref(cls).e("sheet"), drillHover.value ? unref(cls).em("sheet", "drill-hover") : ""]),
|
|
208
|
-
workbook: workbook.value,
|
|
209
|
-
rows: renderSize.value.rows,
|
|
210
|
-
cols: renderSize.value.cols,
|
|
211
|
-
"show-toolbar": false,
|
|
212
|
-
"show-formula-bar": false,
|
|
213
|
-
"show-tabs": false,
|
|
214
|
-
"show-row-header": false,
|
|
215
|
-
"show-col-header": false,
|
|
216
|
-
"resolve-cell-style": resolveViewerCellStyle,
|
|
217
|
-
readonly: "",
|
|
218
|
-
onPointerdown: handleGridPointerDown,
|
|
219
|
-
onPointermove: handleGridPointerMove,
|
|
220
|
-
onPointerleave: handleGridPointerLeave,
|
|
221
|
-
onClick: handleGridClick
|
|
222
|
-
}, null, 8, [
|
|
223
|
-
"class",
|
|
224
|
-
"workbook",
|
|
225
|
-
"rows",
|
|
226
|
-
"cols"
|
|
227
|
-
])], 2),
|
|
228
|
-
drillDialog.value ? (openBlock(), createBlock(unref(UDialog), {
|
|
229
|
-
key: 2,
|
|
230
|
-
modelValue: drillDialogVisible.value,
|
|
231
|
-
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => drillDialogVisible.value = $event),
|
|
232
|
-
title: "详情报表",
|
|
233
|
-
class: normalizeClass(unref(cls).e("drill-dialog"))
|
|
234
|
-
}, {
|
|
235
|
-
default: withCtx(() => [createVNode(_component_u_report_viewer, {
|
|
236
|
-
connector: __props.connector,
|
|
237
|
-
template: drillDialog.value.template,
|
|
238
|
-
"initial-values": drillDialog.value.params,
|
|
239
|
-
"resolve-template": __props.resolveTemplate
|
|
240
|
-
}, null, 8, [
|
|
241
|
-
"connector",
|
|
242
|
-
"template",
|
|
243
|
-
"initial-values",
|
|
244
|
-
"resolve-template"
|
|
245
|
-
])]),
|
|
246
|
-
_: 1
|
|
247
|
-
}, 8, ["modelValue", "class"])) : createCommentVNode("v-if", true)
|
|
248
|
-
], 2);
|
|
249
|
-
};
|
|
250
|
-
}
|
|
251
|
-
});
|
|
252
|
-
//#endregion
|
|
253
|
-
export { _sfc_main as default };
|