@veltra/sheet 2.1.1 → 2.3.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 +100 -0
- package/dist/components/report/designer/cell-coords.js +46 -0
- package/dist/components/report/designer/col-widths.js +29 -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 +422 -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 +253 -0
- package/dist/components/report/designer/rules-dialog.js +118 -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/preview-grid-size.js +32 -0
- package/dist/components/report/report-designer.js +393 -0
- package/dist/components/report/report-viewer.js +124 -0
- package/dist/components/report/style.d.ts +17 -0
- package/dist/components/report/style.js +18 -0
- package/dist/components/report/style2.css +874 -0
- package/dist/components/report/use-report-designer.js +382 -0
- package/dist/components/report/use-report-viewer.js +55 -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 +31 -3
- 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 +3 -3
- package/dist/{vue → components/sheet}/popups/find-popup.js +1 -1
- package/dist/{vue → components/sheet}/popups/font-color-popup.js +3 -3
- package/dist/{vue → components/sheet}/popups/font-size-popup.js +3 -3
- 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 +7 -4
- 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 +16 -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 +22 -4
- package/dist/{vue → components/sheet}/use-sheet-state.js +6 -5
- 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 +83 -0
- package/dist/report/binding.js +332 -0
- package/dist/report/connector.d.ts +66 -0
- package/dist/report/connector.js +159 -0
- package/dist/report/export-xlsx.d.ts +17 -0
- package/dist/report/export-xlsx.js +92 -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 +169 -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 +63 -0
- package/dist/report/template.js +83 -0
- package/dist/report/types.d.ts +85 -0
- package/dist/tools/apply-style.js +29 -0
- package/dist/tools/builtin.js +17 -17
- package/dist/tools/context.d.ts +39 -6
- package/dist/tools/context.js +38 -1
- package/dist/types/index.d.ts +3 -2
- package/dist/types/report-designer.d.ts +38 -0
- package/dist/types/report-viewer.d.ts +38 -0
- package/dist/types/sheet.d.ts +21 -1
- package/package.json +6 -8
- package/src/components/report/__test__/conditional-rules-helpers.test.ts +88 -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__/preview-grid-size.test.ts +63 -0
- package/src/components/report/__test__/report-designer.test.ts +464 -0
- package/src/components/report/__test__/report-viewer.test.ts +357 -0
- package/src/components/report/__test__/topology.test.ts +143 -0
- package/src/components/report/__test__/use-report-designer.test.ts +697 -0
- package/src/components/report/binding-badge.ts +92 -0
- package/src/components/report/designer/cell-coords.ts +94 -0
- package/src/components/report/designer/col-widths.ts +56 -0
- package/src/components/report/designer/conditional-rules/helpers.ts +189 -0
- package/src/components/report/designer/drop-highlight-overlay.vue +74 -0
- package/src/components/report/designer/float-panel.vue +431 -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 +110 -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/preview-grid-size.ts +33 -0
- package/src/components/report/report-designer.vue +420 -0
- package/src/components/report/report-viewer.vue +136 -0
- package/src/components/report/style-designer.scss +587 -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 +596 -0
- package/src/components/report/use-report-viewer.ts +88 -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 +77 -3
- package/src/{vue → components/sheet}/__test__/sheet-context-menu.test.ts +4 -3
- 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 +32 -4
- package/src/{vue → components/sheet}/popups/export-popup.vue +2 -2
- package/src/{vue → components/sheet}/popups/fill-color-popup.vue +3 -3
- package/src/{vue → components/sheet}/popups/find-popup.vue +1 -1
- package/src/{vue → components/sheet}/popups/font-color-popup.vue +3 -3
- package/src/{vue → components/sheet}/popups/font-size-popup.vue +3 -3
- package/src/{vue → components/sheet}/popups/insert-image-popup.vue +1 -1
- package/src/{vue → components/sheet}/sheet-context-menu.ts +10 -4
- package/src/{vue → components/sheet}/sheet-toolbar.vue +2 -2
- package/src/{vue → components/sheet}/sheet.vue +6 -3
- package/src/{vue → components/sheet}/use-find-replace.ts +1 -1
- package/src/{vue → components/sheet}/use-sheet-grid.ts +23 -5
- package/src/{vue → components/sheet}/use-sheet-state.ts +11 -6
- 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 +320 -0
- package/src/report/__test__/connector.test.ts +239 -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 +830 -0
- package/src/report/__test__/rules.test.ts +131 -0
- package/src/report/__test__/template.test.ts +366 -0
- package/src/report/binding.ts +474 -0
- package/src/report/connector.ts +206 -0
- package/src/report/export-xlsx.ts +113 -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 +261 -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 +145 -0
- package/src/report/types.ts +96 -0
- package/src/tools/__test__/apply-style.test.ts +129 -0
- package/src/tools/apply-style.ts +41 -0
- package/src/tools/builtin.ts +20 -20
- package/src/tools/context.ts +67 -4
- package/src/tools/index.ts +1 -0
- package/src/types/index.ts +2 -6
- package/src/types/report-designer.ts +38 -0
- package/src/types/report-viewer.ts +37 -0
- package/src/types/sheet.ts +26 -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
|
@@ -0,0 +1,422 @@
|
|
|
1
|
+
import { formatBindingPlaceholder, formatCellAddress, formatParentCandidateLabel, inferReportPreset, isReductionAggregate } from "../../../report/binding.js";
|
|
2
|
+
import { resolveGridOverlayLayout } from "./cell-coords.js";
|
|
3
|
+
import { readCellOverlayRect, resolveBindingFloatPanelPosition, useGridOverlaySync } from "./use-grid-overlay.js";
|
|
4
|
+
import { REPORT_PRESET_OPTIONS, presetBindingDefaults } from "./role.js";
|
|
5
|
+
import { computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, createTextVNode, createVNode, defineComponent, nextTick, normalizeClass, normalizeStyle, openBlock, ref, toDisplayString, toRef, unref, vShow, watch, withCtx, withDirectives, withModifiers } from "vue";
|
|
6
|
+
import { UButton, URadioGroup, USelect, USwitch } from "@veltra/desktop";
|
|
7
|
+
import { bem } from "@veltra/utils";
|
|
8
|
+
//#region src/components/report/designer/float-panel.vue
|
|
9
|
+
const _hoisted_1 = ["title"];
|
|
10
|
+
const CUSTOM_PRESET_VALUE = "__custom__";
|
|
11
|
+
const _sfc_main = /*@__PURE__*/ defineComponent({
|
|
12
|
+
name: "UReportFloatPanel",
|
|
13
|
+
__name: "float-panel",
|
|
14
|
+
props: {
|
|
15
|
+
cell: {},
|
|
16
|
+
binding: {},
|
|
17
|
+
resolvedRowParentLabel: {},
|
|
18
|
+
resolvedColParentLabel: {},
|
|
19
|
+
parentPickMode: {},
|
|
20
|
+
rowParentCandidates: {},
|
|
21
|
+
colParentCandidates: {},
|
|
22
|
+
resolveFieldLabel: { type: Function },
|
|
23
|
+
getBindingAt: { type: Function },
|
|
24
|
+
hostEl: {},
|
|
25
|
+
getGrid: { type: Function }
|
|
26
|
+
},
|
|
27
|
+
emits: [
|
|
28
|
+
"patch",
|
|
29
|
+
"remove",
|
|
30
|
+
"open-rules",
|
|
31
|
+
"start-parent-pick",
|
|
32
|
+
"cancel-parent-pick",
|
|
33
|
+
"clear-parent"
|
|
34
|
+
],
|
|
35
|
+
setup(__props, { emit: __emit }) {
|
|
36
|
+
const props = __props;
|
|
37
|
+
const emit = __emit;
|
|
38
|
+
const cls = bem("report-float-panel");
|
|
39
|
+
const hostEl = toRef(props, "hostEl");
|
|
40
|
+
const panelRef = ref(null);
|
|
41
|
+
const expanded = ref(false);
|
|
42
|
+
const placement = ref("above");
|
|
43
|
+
const presetOptions = computed(() => {
|
|
44
|
+
const options = REPORT_PRESET_OPTIONS.map((item) => ({ ...item }));
|
|
45
|
+
if (props.binding && inferReportPreset(props.binding) === null) options.unshift({
|
|
46
|
+
value: CUSTOM_PRESET_VALUE,
|
|
47
|
+
label: "自定义"
|
|
48
|
+
});
|
|
49
|
+
return options;
|
|
50
|
+
});
|
|
51
|
+
const ALL_AGGREGATE_OPTIONS = [
|
|
52
|
+
{
|
|
53
|
+
value: "list",
|
|
54
|
+
label: "明细"
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
value: "group",
|
|
58
|
+
label: "分组"
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
value: "sum",
|
|
62
|
+
label: "求和"
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
value: "avg",
|
|
66
|
+
label: "平均"
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
value: "count",
|
|
70
|
+
label: "计数"
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
value: "max",
|
|
74
|
+
label: "最大"
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
value: "min",
|
|
78
|
+
label: "最小"
|
|
79
|
+
}
|
|
80
|
+
];
|
|
81
|
+
const REDUCTION_AGGREGATE_OPTIONS = ALL_AGGREGATE_OPTIONS.filter((item) => isReductionAggregate(item.value));
|
|
82
|
+
const expandOptions = [
|
|
83
|
+
{
|
|
84
|
+
value: "down",
|
|
85
|
+
label: "向下"
|
|
86
|
+
},
|
|
87
|
+
{
|
|
88
|
+
value: "right",
|
|
89
|
+
label: "向右"
|
|
90
|
+
},
|
|
91
|
+
{
|
|
92
|
+
value: "none",
|
|
93
|
+
label: "不展开"
|
|
94
|
+
}
|
|
95
|
+
];
|
|
96
|
+
const sortOptions = [
|
|
97
|
+
{
|
|
98
|
+
value: "none",
|
|
99
|
+
label: "无"
|
|
100
|
+
},
|
|
101
|
+
{
|
|
102
|
+
value: "asc",
|
|
103
|
+
label: "升序"
|
|
104
|
+
},
|
|
105
|
+
{
|
|
106
|
+
value: "desc",
|
|
107
|
+
label: "降序"
|
|
108
|
+
}
|
|
109
|
+
];
|
|
110
|
+
const panelLeft = ref(0);
|
|
111
|
+
const panelTop = ref(0);
|
|
112
|
+
const inView = ref(false);
|
|
113
|
+
const currentPresetValue = computed(() => {
|
|
114
|
+
if (!props.binding) return "detail";
|
|
115
|
+
return inferReportPreset(props.binding) ?? CUSTOM_PRESET_VALUE;
|
|
116
|
+
});
|
|
117
|
+
const showAggregateSelect = computed(() => {
|
|
118
|
+
const preset = currentPresetValue.value;
|
|
119
|
+
return preset === CUSTOM_PRESET_VALUE || preset === "subtotal" || preset === "grandTotal" || preset === "cross";
|
|
120
|
+
});
|
|
121
|
+
const showExpandSelect = computed(() => {
|
|
122
|
+
const preset = currentPresetValue.value;
|
|
123
|
+
return preset === CUSTOM_PRESET_VALUE || preset === "groupHeader" || preset === "detail";
|
|
124
|
+
});
|
|
125
|
+
const aggregateOptions = computed(() => currentPresetValue.value === CUSTOM_PRESET_VALUE ? ALL_AGGREGATE_OPTIONS : REDUCTION_AGGREGATE_OPTIONS);
|
|
126
|
+
const summaryText = computed(() => {
|
|
127
|
+
if (!props.binding) return "";
|
|
128
|
+
const parts = [formatBindingPlaceholder(props.binding, props.resolveFieldLabel)];
|
|
129
|
+
if (props.binding.rowParent && props.resolvedRowParentLabel !== "—") {
|
|
130
|
+
const parent = props.getBindingAt?.(props.binding.rowParent);
|
|
131
|
+
const name = parent ? props.resolveFieldLabel?.(parent.dataset, parent.field) ?? parent.field : props.resolvedRowParentLabel;
|
|
132
|
+
parts.push(`行父格 ${name} ${props.resolvedRowParentLabel}`);
|
|
133
|
+
}
|
|
134
|
+
if (props.binding.colParent && props.resolvedColParentLabel !== "—") {
|
|
135
|
+
const parent = props.getBindingAt?.(props.binding.colParent);
|
|
136
|
+
const name = parent ? props.resolveFieldLabel?.(parent.dataset, parent.field) ?? parent.field : props.resolvedColParentLabel;
|
|
137
|
+
parts.push(`列父格 ${name} ${props.resolvedColParentLabel}`);
|
|
138
|
+
}
|
|
139
|
+
return parts.join(" · ");
|
|
140
|
+
});
|
|
141
|
+
function candidateOption(addr) {
|
|
142
|
+
const value = formatCellAddress(addr);
|
|
143
|
+
const binding = props.getBindingAt?.(addr);
|
|
144
|
+
return {
|
|
145
|
+
value,
|
|
146
|
+
label: binding ? formatParentCandidateLabel(addr, binding, props.resolveFieldLabel) : value
|
|
147
|
+
};
|
|
148
|
+
}
|
|
149
|
+
const rowParentOptions = computed(() => props.rowParentCandidates.map(candidateOption));
|
|
150
|
+
const colParentOptions = computed(() => props.colParentCandidates.map(candidateOption));
|
|
151
|
+
const rowParentSelectValue = computed(() => props.binding?.rowParent ? formatCellAddress(props.binding.rowParent) : void 0);
|
|
152
|
+
const colParentSelectValue = computed(() => props.binding?.colParent ? formatCellAddress(props.binding.colParent) : void 0);
|
|
153
|
+
const visible = computed(() => !!props.binding && !!props.cell && inView.value);
|
|
154
|
+
const panelStyle = computed(() => ({
|
|
155
|
+
left: `${panelLeft.value}px`,
|
|
156
|
+
top: `${panelTop.value}px`
|
|
157
|
+
}));
|
|
158
|
+
watch(() => [props.cell?.row, props.cell?.col], () => {
|
|
159
|
+
if (props.parentPickMode) return;
|
|
160
|
+
expanded.value = false;
|
|
161
|
+
});
|
|
162
|
+
watch(() => props.parentPickMode, (mode) => {
|
|
163
|
+
if (mode) expanded.value = true;
|
|
164
|
+
});
|
|
165
|
+
watch(expanded, () => {
|
|
166
|
+
nextTick(() => updatePosition());
|
|
167
|
+
});
|
|
168
|
+
watch(visible, (show) => {
|
|
169
|
+
if (!show) return;
|
|
170
|
+
nextTick(() => updatePosition());
|
|
171
|
+
});
|
|
172
|
+
function onPreset(preset) {
|
|
173
|
+
if (preset === CUSTOM_PRESET_VALUE) return;
|
|
174
|
+
emit("patch", presetBindingDefaults(preset));
|
|
175
|
+
}
|
|
176
|
+
function aggregateDefaultExpand(aggregate) {
|
|
177
|
+
return isReductionAggregate(aggregate) ? "none" : "down";
|
|
178
|
+
}
|
|
179
|
+
function onAggregate(aggregate) {
|
|
180
|
+
emit("patch", {
|
|
181
|
+
aggregate,
|
|
182
|
+
expand: aggregateDefaultExpand(aggregate)
|
|
183
|
+
});
|
|
184
|
+
}
|
|
185
|
+
function onExpand(expand) {
|
|
186
|
+
emit("patch", { expand });
|
|
187
|
+
}
|
|
188
|
+
function onSort(value) {
|
|
189
|
+
emit("patch", { sort: value });
|
|
190
|
+
}
|
|
191
|
+
function onMergeSpan(merged) {
|
|
192
|
+
emit("patch", { mergeSpan: merged });
|
|
193
|
+
}
|
|
194
|
+
function onRowParentSelect(label) {
|
|
195
|
+
const addr = props.rowParentCandidates.find((item) => formatCellAddress(item) === label);
|
|
196
|
+
if (!addr) return;
|
|
197
|
+
emit("patch", { rowParent: { ...addr } });
|
|
198
|
+
}
|
|
199
|
+
function onColParentSelect(label) {
|
|
200
|
+
const addr = props.colParentCandidates.find((item) => formatCellAddress(item) === label);
|
|
201
|
+
if (!addr) return;
|
|
202
|
+
emit("patch", { colParent: { ...addr } });
|
|
203
|
+
}
|
|
204
|
+
function updatePosition() {
|
|
205
|
+
const cell = props.cell;
|
|
206
|
+
const host = props.hostEl;
|
|
207
|
+
if (!cell || !host) {
|
|
208
|
+
inView.value = false;
|
|
209
|
+
return;
|
|
210
|
+
}
|
|
211
|
+
const layoutResolved = resolveGridOverlayLayout(host);
|
|
212
|
+
const rect = readCellOverlayRect(cell, host, props.getGrid);
|
|
213
|
+
if (!rect || !layoutResolved) {
|
|
214
|
+
inView.value = false;
|
|
215
|
+
return;
|
|
216
|
+
}
|
|
217
|
+
inView.value = true;
|
|
218
|
+
const panelEl = panelRef.value;
|
|
219
|
+
const panelWidth = panelEl?.offsetWidth ?? 340;
|
|
220
|
+
const panelHeight = panelEl?.offsetHeight ?? (expanded.value ? 360 : 68);
|
|
221
|
+
const position = resolveBindingFloatPanelPosition(rect, layoutResolved.layout, panelWidth, panelHeight, host.clientWidth);
|
|
222
|
+
placement.value = position.placement;
|
|
223
|
+
panelLeft.value = position.left;
|
|
224
|
+
panelTop.value = position.top;
|
|
225
|
+
}
|
|
226
|
+
useGridOverlaySync({
|
|
227
|
+
hostEl,
|
|
228
|
+
getGrid: () => props.getGrid(),
|
|
229
|
+
watchSources: () => [
|
|
230
|
+
props.cell?.row,
|
|
231
|
+
props.cell?.col,
|
|
232
|
+
props.binding,
|
|
233
|
+
props.hostEl,
|
|
234
|
+
expanded.value,
|
|
235
|
+
props.parentPickMode
|
|
236
|
+
],
|
|
237
|
+
update: updatePosition
|
|
238
|
+
});
|
|
239
|
+
return (_ctx, _cache) => {
|
|
240
|
+
return __props.binding && __props.cell ? withDirectives((openBlock(), createElementBlock("div", {
|
|
241
|
+
key: 0,
|
|
242
|
+
ref_key: "panelRef",
|
|
243
|
+
ref: panelRef,
|
|
244
|
+
class: normalizeClass([
|
|
245
|
+
unref(cls).b,
|
|
246
|
+
unref(cls).m(placement.value),
|
|
247
|
+
expanded.value ? unref(cls).m("expanded") : ""
|
|
248
|
+
]),
|
|
249
|
+
style: normalizeStyle(panelStyle.value),
|
|
250
|
+
onMousedown: _cache[8] || (_cache[8] = withModifiers(() => {}, ["stop"])),
|
|
251
|
+
onPointerdown: _cache[9] || (_cache[9] = withModifiers(() => {}, ["stop"]))
|
|
252
|
+
}, [createElementVNode("div", { class: normalizeClass(unref(cls).e("bar")) }, [createElementVNode("div", {
|
|
253
|
+
class: normalizeClass(unref(cls).e("summary")),
|
|
254
|
+
title: summaryText.value
|
|
255
|
+
}, toDisplayString(summaryText.value), 11, _hoisted_1), createElementVNode("div", { class: normalizeClass(unref(cls).e("toolbar")) }, [
|
|
256
|
+
createVNode(unref(USelect), {
|
|
257
|
+
size: "small",
|
|
258
|
+
class: normalizeClass([unref(cls).e("select"), unref(cls).em("select", "role")]),
|
|
259
|
+
"model-value": currentPresetValue.value,
|
|
260
|
+
options: presetOptions.value,
|
|
261
|
+
"onUpdate:modelValue": onPreset
|
|
262
|
+
}, null, 8, [
|
|
263
|
+
"class",
|
|
264
|
+
"model-value",
|
|
265
|
+
"options"
|
|
266
|
+
]),
|
|
267
|
+
showAggregateSelect.value ? (openBlock(), createBlock(unref(USelect), {
|
|
268
|
+
key: 0,
|
|
269
|
+
size: "small",
|
|
270
|
+
class: normalizeClass([unref(cls).e("select"), unref(cls).em("select", "aggregate")]),
|
|
271
|
+
"model-value": __props.binding.aggregate,
|
|
272
|
+
options: aggregateOptions.value,
|
|
273
|
+
"onUpdate:modelValue": onAggregate
|
|
274
|
+
}, null, 8, [
|
|
275
|
+
"class",
|
|
276
|
+
"model-value",
|
|
277
|
+
"options"
|
|
278
|
+
])) : createCommentVNode("v-if", true),
|
|
279
|
+
showExpandSelect.value ? (openBlock(), createBlock(unref(USelect), {
|
|
280
|
+
key: 1,
|
|
281
|
+
size: "small",
|
|
282
|
+
class: normalizeClass([unref(cls).e("select"), unref(cls).em("select", "expand")]),
|
|
283
|
+
"model-value": __props.binding.expand,
|
|
284
|
+
options: expandOptions,
|
|
285
|
+
"onUpdate:modelValue": onExpand
|
|
286
|
+
}, null, 8, ["class", "model-value"])) : createCommentVNode("v-if", true),
|
|
287
|
+
createVNode(unref(UButton), {
|
|
288
|
+
size: "small",
|
|
289
|
+
plain: "",
|
|
290
|
+
onClick: _cache[0] || (_cache[0] = ($event) => emit("open-rules"))
|
|
291
|
+
}, {
|
|
292
|
+
default: withCtx(() => [..._cache[10] || (_cache[10] = [createTextVNode("条件样式", -1)])]),
|
|
293
|
+
_: 1
|
|
294
|
+
}),
|
|
295
|
+
createVNode(unref(UButton), {
|
|
296
|
+
size: "small",
|
|
297
|
+
text: "",
|
|
298
|
+
type: "danger",
|
|
299
|
+
onClick: _cache[1] || (_cache[1] = ($event) => emit("remove"))
|
|
300
|
+
}, {
|
|
301
|
+
default: withCtx(() => [..._cache[11] || (_cache[11] = [createTextVNode("删除绑定", -1)])]),
|
|
302
|
+
_: 1
|
|
303
|
+
}),
|
|
304
|
+
createVNode(unref(UButton), {
|
|
305
|
+
size: "small",
|
|
306
|
+
text: "",
|
|
307
|
+
class: normalizeClass(unref(cls).e("expand")),
|
|
308
|
+
title: expanded.value ? "收起" : "展开更多",
|
|
309
|
+
onClick: _cache[2] || (_cache[2] = ($event) => expanded.value = !expanded.value)
|
|
310
|
+
}, {
|
|
311
|
+
default: withCtx(() => [createTextVNode(toDisplayString(expanded.value ? "收起" : "展开"), 1)]),
|
|
312
|
+
_: 1
|
|
313
|
+
}, 8, ["class", "title"])
|
|
314
|
+
], 2)], 2), expanded.value ? (openBlock(), createElementBlock("div", {
|
|
315
|
+
key: 0,
|
|
316
|
+
class: normalizeClass(unref(cls).e("body"))
|
|
317
|
+
}, [
|
|
318
|
+
createElementVNode("section", { class: normalizeClass(unref(cls).e("section")) }, [createElementVNode("div", { class: normalizeClass(unref(cls).e("section-label")) }, "数据集", 2), createElementVNode("p", { class: normalizeClass(unref(cls).e("hint")) }, toDisplayString(__props.binding.dataset), 3)], 2),
|
|
319
|
+
createElementVNode("section", { class: normalizeClass(unref(cls).e("section")) }, [createElementVNode("div", { class: normalizeClass(unref(cls).e("section-label")) }, "排序", 2), createVNode(unref(URadioGroup), {
|
|
320
|
+
size: "small",
|
|
321
|
+
items: sortOptions,
|
|
322
|
+
"model-value": __props.binding.sort ?? "none",
|
|
323
|
+
"onUpdate:modelValue": onSort
|
|
324
|
+
}, null, 8, ["model-value"])], 2),
|
|
325
|
+
createElementVNode("section", { class: normalizeClass(unref(cls).e("section")) }, [createElementVNode("div", { class: normalizeClass(unref(cls).e("section-label")) }, "扩展实例合并单元格", 2), createVNode(unref(USwitch), {
|
|
326
|
+
size: "small",
|
|
327
|
+
"model-value": __props.binding.mergeSpan !== false,
|
|
328
|
+
"onUpdate:modelValue": onMergeSpan
|
|
329
|
+
}, null, 8, ["model-value"])], 2),
|
|
330
|
+
createElementVNode("section", { class: normalizeClass(unref(cls).e("section")) }, [
|
|
331
|
+
createElementVNode("div", { class: normalizeClass(unref(cls).e("section-label")) }, "行方向父格", 2),
|
|
332
|
+
createElementVNode("p", { class: normalizeClass(unref(cls).e("hint")) }, "当前:" + toDisplayString(__props.resolvedRowParentLabel), 3),
|
|
333
|
+
createElementVNode("div", { class: normalizeClass(unref(cls).e("parent-actions")) }, [
|
|
334
|
+
createVNode(unref(UButton), {
|
|
335
|
+
size: "small",
|
|
336
|
+
plain: "",
|
|
337
|
+
type: __props.parentPickMode === "row" ? "primary" : void 0,
|
|
338
|
+
onClick: _cache[3] || (_cache[3] = ($event) => emit("start-parent-pick", "row"))
|
|
339
|
+
}, {
|
|
340
|
+
default: withCtx(() => [createTextVNode(toDisplayString(__props.parentPickMode === "row" ? "点选目标格…" : "设置行方向父格"), 1)]),
|
|
341
|
+
_: 1
|
|
342
|
+
}, 8, ["type"]),
|
|
343
|
+
rowParentOptions.value.length > 0 ? (openBlock(), createBlock(unref(USelect), {
|
|
344
|
+
key: 0,
|
|
345
|
+
size: "small",
|
|
346
|
+
class: normalizeClass(unref(cls).e("parent-select")),
|
|
347
|
+
placeholder: "候选格",
|
|
348
|
+
"model-value": rowParentSelectValue.value,
|
|
349
|
+
options: rowParentOptions.value,
|
|
350
|
+
"onUpdate:modelValue": onRowParentSelect
|
|
351
|
+
}, null, 8, [
|
|
352
|
+
"class",
|
|
353
|
+
"model-value",
|
|
354
|
+
"options"
|
|
355
|
+
])) : createCommentVNode("v-if", true),
|
|
356
|
+
__props.binding.rowParent ? (openBlock(), createBlock(unref(UButton), {
|
|
357
|
+
key: 1,
|
|
358
|
+
size: "small",
|
|
359
|
+
text: "",
|
|
360
|
+
type: "danger",
|
|
361
|
+
onClick: _cache[4] || (_cache[4] = ($event) => emit("clear-parent", "row"))
|
|
362
|
+
}, {
|
|
363
|
+
default: withCtx(() => [..._cache[12] || (_cache[12] = [createTextVNode(" 清除 ", -1)])]),
|
|
364
|
+
_: 1
|
|
365
|
+
})) : createCommentVNode("v-if", true)
|
|
366
|
+
], 2)
|
|
367
|
+
], 2),
|
|
368
|
+
createElementVNode("section", { class: normalizeClass(unref(cls).e("section")) }, [
|
|
369
|
+
createElementVNode("div", { class: normalizeClass(unref(cls).e("section-label")) }, "列方向父格", 2),
|
|
370
|
+
createElementVNode("p", { class: normalizeClass(unref(cls).e("hint")) }, "当前:" + toDisplayString(__props.resolvedColParentLabel), 3),
|
|
371
|
+
createElementVNode("div", { class: normalizeClass(unref(cls).e("parent-actions")) }, [
|
|
372
|
+
createVNode(unref(UButton), {
|
|
373
|
+
size: "small",
|
|
374
|
+
plain: "",
|
|
375
|
+
type: __props.parentPickMode === "col" ? "primary" : void 0,
|
|
376
|
+
onClick: _cache[5] || (_cache[5] = ($event) => emit("start-parent-pick", "col"))
|
|
377
|
+
}, {
|
|
378
|
+
default: withCtx(() => [createTextVNode(toDisplayString(__props.parentPickMode === "col" ? "点选目标格…" : "设置列方向父格"), 1)]),
|
|
379
|
+
_: 1
|
|
380
|
+
}, 8, ["type"]),
|
|
381
|
+
colParentOptions.value.length > 0 ? (openBlock(), createBlock(unref(USelect), {
|
|
382
|
+
key: 0,
|
|
383
|
+
size: "small",
|
|
384
|
+
class: normalizeClass(unref(cls).e("parent-select")),
|
|
385
|
+
placeholder: "候选格",
|
|
386
|
+
"model-value": colParentSelectValue.value,
|
|
387
|
+
options: colParentOptions.value,
|
|
388
|
+
"onUpdate:modelValue": onColParentSelect
|
|
389
|
+
}, null, 8, [
|
|
390
|
+
"class",
|
|
391
|
+
"model-value",
|
|
392
|
+
"options"
|
|
393
|
+
])) : createCommentVNode("v-if", true),
|
|
394
|
+
__props.binding.colParent ? (openBlock(), createBlock(unref(UButton), {
|
|
395
|
+
key: 1,
|
|
396
|
+
size: "small",
|
|
397
|
+
text: "",
|
|
398
|
+
type: "danger",
|
|
399
|
+
onClick: _cache[6] || (_cache[6] = ($event) => emit("clear-parent", "col"))
|
|
400
|
+
}, {
|
|
401
|
+
default: withCtx(() => [..._cache[13] || (_cache[13] = [createTextVNode(" 清除 ", -1)])]),
|
|
402
|
+
_: 1
|
|
403
|
+
})) : createCommentVNode("v-if", true)
|
|
404
|
+
], 2)
|
|
405
|
+
], 2),
|
|
406
|
+
__props.parentPickMode ? (openBlock(), createElementBlock("footer", {
|
|
407
|
+
key: 0,
|
|
408
|
+
class: normalizeClass(unref(cls).e("footer"))
|
|
409
|
+
}, [createVNode(unref(UButton), {
|
|
410
|
+
size: "small",
|
|
411
|
+
plain: "",
|
|
412
|
+
onClick: _cache[7] || (_cache[7] = ($event) => emit("cancel-parent-pick"))
|
|
413
|
+
}, {
|
|
414
|
+
default: withCtx(() => [..._cache[14] || (_cache[14] = [createTextVNode("取消点选", -1)])]),
|
|
415
|
+
_: 1
|
|
416
|
+
})], 2)) : createCommentVNode("v-if", true)
|
|
417
|
+
], 2)) : createCommentVNode("v-if", true)], 38)), [[vShow, visible.value]]) : createCommentVNode("v-if", true);
|
|
418
|
+
};
|
|
419
|
+
}
|
|
420
|
+
});
|
|
421
|
+
//#endregion
|
|
422
|
+
export { _sfc_main as default };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { presetBindingPatch } from "../../../report/binding.js";
|
|
2
|
+
const REPORT_PRESET_OPTIONS = Object.entries({
|
|
3
|
+
groupHeader: "分组头",
|
|
4
|
+
detail: "明细行",
|
|
5
|
+
subtotal: "小计行",
|
|
6
|
+
grandTotal: "总计行",
|
|
7
|
+
cross: "交叉格"
|
|
8
|
+
}).map(([value, label]) => ({
|
|
9
|
+
value,
|
|
10
|
+
label
|
|
11
|
+
}));
|
|
12
|
+
/** 切换预设时写入 expand / aggregate / 父格组合(父格除 grandTotal 外保留既有值) */
|
|
13
|
+
function presetBindingDefaults(preset) {
|
|
14
|
+
return presetBindingPatch(preset);
|
|
15
|
+
}
|
|
16
|
+
//#endregion
|
|
17
|
+
export { REPORT_PRESET_OPTIONS, presetBindingDefaults };
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { computed, createElementBlock, defineComponent, normalizeClass, normalizeStyle, openBlock, toDisplayString, unref } from "vue";
|
|
2
|
+
import { bem } from "@veltra/utils";
|
|
3
|
+
//#region src/components/report/designer/rule-preview.vue
|
|
4
|
+
const _hoisted_1 = ["title"];
|
|
5
|
+
const _sfc_main = /*@__PURE__*/ defineComponent({
|
|
6
|
+
name: "UReportRulePreview",
|
|
7
|
+
__name: "rule-preview",
|
|
8
|
+
props: { rule: {} },
|
|
9
|
+
setup(__props) {
|
|
10
|
+
const props = __props;
|
|
11
|
+
const cls = bem("report-rule-preview");
|
|
12
|
+
const previewStyle = computed(() => {
|
|
13
|
+
const { fill, font } = props.rule.style;
|
|
14
|
+
return {
|
|
15
|
+
backgroundColor: fill?.color || "transparent",
|
|
16
|
+
color: font?.color || "inherit",
|
|
17
|
+
fontWeight: font?.bold ? "700" : "400",
|
|
18
|
+
fontStyle: font?.italic ? "italic" : "normal"
|
|
19
|
+
};
|
|
20
|
+
});
|
|
21
|
+
const previewLabel = computed(() => props.rule.scope === "row" ? "整行" : "Aa");
|
|
22
|
+
const previewTitle = computed(() => props.rule.scope === "row" ? "整行作用范围:命中后染满物理输出行(交叉表会染满整行,明细行报表更合适)" : "本格作用范围");
|
|
23
|
+
return (_ctx, _cache) => {
|
|
24
|
+
return openBlock(), createElementBlock("span", {
|
|
25
|
+
class: normalizeClass([unref(cls).b, __props.rule.scope === "row" && unref(cls).m("row")]),
|
|
26
|
+
style: normalizeStyle(previewStyle.value),
|
|
27
|
+
title: previewTitle.value
|
|
28
|
+
}, toDisplayString(previewLabel.value), 15, _hoisted_1);
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
//#endregion
|
|
33
|
+
export { _sfc_main as default };
|