@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,385 @@
|
|
|
1
|
+
import { resolveGridOverlayLayout } from "./cell-coords.js";
|
|
2
|
+
import { formatBindingPlaceholder, formatCellAddress, inferReportPreset } from "../../../report/binding.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
|
+
hostEl: {},
|
|
24
|
+
getGrid: { type: Function }
|
|
25
|
+
},
|
|
26
|
+
emits: [
|
|
27
|
+
"patch",
|
|
28
|
+
"remove",
|
|
29
|
+
"open-rules",
|
|
30
|
+
"start-parent-pick",
|
|
31
|
+
"cancel-parent-pick",
|
|
32
|
+
"clear-parent"
|
|
33
|
+
],
|
|
34
|
+
setup(__props, { emit: __emit }) {
|
|
35
|
+
const props = __props;
|
|
36
|
+
const emit = __emit;
|
|
37
|
+
const cls = bem("report-float-panel");
|
|
38
|
+
const hostEl = toRef(props, "hostEl");
|
|
39
|
+
const panelRef = ref(null);
|
|
40
|
+
const expanded = ref(false);
|
|
41
|
+
const placement = ref("above");
|
|
42
|
+
const presetOptions = computed(() => {
|
|
43
|
+
const options = REPORT_PRESET_OPTIONS.map((item) => ({ ...item }));
|
|
44
|
+
if (props.binding && inferReportPreset(props.binding) === null) options.unshift({
|
|
45
|
+
value: CUSTOM_PRESET_VALUE,
|
|
46
|
+
label: "自定义"
|
|
47
|
+
});
|
|
48
|
+
return options;
|
|
49
|
+
});
|
|
50
|
+
const aggregateOptions = [
|
|
51
|
+
{
|
|
52
|
+
value: "list",
|
|
53
|
+
label: "明细"
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
value: "group",
|
|
57
|
+
label: "分组"
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
value: "sum",
|
|
61
|
+
label: "求和"
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
value: "avg",
|
|
65
|
+
label: "平均"
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
value: "count",
|
|
69
|
+
label: "计数"
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
value: "max",
|
|
73
|
+
label: "最大"
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
value: "min",
|
|
77
|
+
label: "最小"
|
|
78
|
+
}
|
|
79
|
+
];
|
|
80
|
+
const expandOptions = [
|
|
81
|
+
{
|
|
82
|
+
value: "down",
|
|
83
|
+
label: "向下"
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
value: "right",
|
|
87
|
+
label: "向右"
|
|
88
|
+
},
|
|
89
|
+
{
|
|
90
|
+
value: "none",
|
|
91
|
+
label: "不展开"
|
|
92
|
+
}
|
|
93
|
+
];
|
|
94
|
+
const sortOptions = [
|
|
95
|
+
{
|
|
96
|
+
value: "none",
|
|
97
|
+
label: "无"
|
|
98
|
+
},
|
|
99
|
+
{
|
|
100
|
+
value: "asc",
|
|
101
|
+
label: "升序"
|
|
102
|
+
},
|
|
103
|
+
{
|
|
104
|
+
value: "desc",
|
|
105
|
+
label: "降序"
|
|
106
|
+
}
|
|
107
|
+
];
|
|
108
|
+
const panelLeft = ref(0);
|
|
109
|
+
const panelTop = ref(0);
|
|
110
|
+
const inView = ref(false);
|
|
111
|
+
const currentPresetValue = computed(() => {
|
|
112
|
+
if (!props.binding) return "detail";
|
|
113
|
+
return inferReportPreset(props.binding) ?? CUSTOM_PRESET_VALUE;
|
|
114
|
+
});
|
|
115
|
+
const summaryText = computed(() => {
|
|
116
|
+
if (!props.binding) return "";
|
|
117
|
+
return formatBindingPlaceholder(props.binding, props.resolveFieldLabel);
|
|
118
|
+
});
|
|
119
|
+
const rowParentOptions = computed(() => props.rowParentCandidates.map((addr) => ({
|
|
120
|
+
value: formatCellAddress(addr),
|
|
121
|
+
label: formatCellAddress(addr)
|
|
122
|
+
})));
|
|
123
|
+
const colParentOptions = computed(() => props.colParentCandidates.map((addr) => ({
|
|
124
|
+
value: formatCellAddress(addr),
|
|
125
|
+
label: formatCellAddress(addr)
|
|
126
|
+
})));
|
|
127
|
+
const rowParentSelectValue = computed(() => props.binding?.rowParent ? formatCellAddress(props.binding.rowParent) : void 0);
|
|
128
|
+
const colParentSelectValue = computed(() => props.binding?.colParent ? formatCellAddress(props.binding.colParent) : void 0);
|
|
129
|
+
const visible = computed(() => !!props.binding && !!props.cell && inView.value);
|
|
130
|
+
const panelStyle = computed(() => ({
|
|
131
|
+
left: `${panelLeft.value}px`,
|
|
132
|
+
top: `${panelTop.value}px`
|
|
133
|
+
}));
|
|
134
|
+
watch(() => [props.cell?.row, props.cell?.col], () => {
|
|
135
|
+
expanded.value = false;
|
|
136
|
+
});
|
|
137
|
+
watch(expanded, () => {
|
|
138
|
+
nextTick(() => updatePosition());
|
|
139
|
+
});
|
|
140
|
+
watch(visible, (show) => {
|
|
141
|
+
if (!show) return;
|
|
142
|
+
nextTick(() => updatePosition());
|
|
143
|
+
});
|
|
144
|
+
function onPreset(preset) {
|
|
145
|
+
if (preset === CUSTOM_PRESET_VALUE) return;
|
|
146
|
+
emit("patch", presetBindingDefaults(preset));
|
|
147
|
+
}
|
|
148
|
+
function aggregateDefaultExpand(aggregate) {
|
|
149
|
+
return aggregate === "sum" || aggregate === "avg" || aggregate === "count" || aggregate === "max" || aggregate === "min" ? "none" : "down";
|
|
150
|
+
}
|
|
151
|
+
function onAggregate(aggregate) {
|
|
152
|
+
emit("patch", {
|
|
153
|
+
aggregate,
|
|
154
|
+
expand: aggregateDefaultExpand(aggregate)
|
|
155
|
+
});
|
|
156
|
+
}
|
|
157
|
+
function onExpand(expand) {
|
|
158
|
+
emit("patch", { expand });
|
|
159
|
+
}
|
|
160
|
+
function onSort(value) {
|
|
161
|
+
emit("patch", { sort: value });
|
|
162
|
+
}
|
|
163
|
+
function onMergeSpan(merged) {
|
|
164
|
+
emit("patch", { mergeSpan: merged });
|
|
165
|
+
}
|
|
166
|
+
function onRowParentSelect(label) {
|
|
167
|
+
const addr = props.rowParentCandidates.find((item) => formatCellAddress(item) === label);
|
|
168
|
+
if (!addr) return;
|
|
169
|
+
emit("patch", { rowParent: { ...addr } });
|
|
170
|
+
}
|
|
171
|
+
function onColParentSelect(label) {
|
|
172
|
+
const addr = props.colParentCandidates.find((item) => formatCellAddress(item) === label);
|
|
173
|
+
if (!addr) return;
|
|
174
|
+
emit("patch", { colParent: { ...addr } });
|
|
175
|
+
}
|
|
176
|
+
function updatePosition() {
|
|
177
|
+
const cell = props.cell;
|
|
178
|
+
const host = props.hostEl;
|
|
179
|
+
if (!cell || !host) {
|
|
180
|
+
inView.value = false;
|
|
181
|
+
return;
|
|
182
|
+
}
|
|
183
|
+
const layoutResolved = resolveGridOverlayLayout(host);
|
|
184
|
+
const rect = readCellOverlayRect(cell, host, props.getGrid);
|
|
185
|
+
if (!rect || !layoutResolved) {
|
|
186
|
+
inView.value = false;
|
|
187
|
+
return;
|
|
188
|
+
}
|
|
189
|
+
inView.value = true;
|
|
190
|
+
const panelEl = panelRef.value;
|
|
191
|
+
const panelWidth = panelEl?.offsetWidth ?? 340;
|
|
192
|
+
const panelHeight = panelEl?.offsetHeight ?? (expanded.value ? 360 : 68);
|
|
193
|
+
const position = resolveBindingFloatPanelPosition(rect, layoutResolved.layout, panelWidth, panelHeight, host.clientWidth);
|
|
194
|
+
placement.value = position.placement;
|
|
195
|
+
panelLeft.value = position.left;
|
|
196
|
+
panelTop.value = position.top;
|
|
197
|
+
}
|
|
198
|
+
useGridOverlaySync({
|
|
199
|
+
hostEl,
|
|
200
|
+
getGrid: () => props.getGrid(),
|
|
201
|
+
watchSources: () => [
|
|
202
|
+
props.cell?.row,
|
|
203
|
+
props.cell?.col,
|
|
204
|
+
props.binding,
|
|
205
|
+
props.hostEl,
|
|
206
|
+
expanded.value,
|
|
207
|
+
props.parentPickMode
|
|
208
|
+
],
|
|
209
|
+
update: updatePosition
|
|
210
|
+
});
|
|
211
|
+
return (_ctx, _cache) => {
|
|
212
|
+
return __props.binding && __props.cell ? withDirectives((openBlock(), createElementBlock("div", {
|
|
213
|
+
key: 0,
|
|
214
|
+
ref_key: "panelRef",
|
|
215
|
+
ref: panelRef,
|
|
216
|
+
class: normalizeClass([
|
|
217
|
+
unref(cls).b,
|
|
218
|
+
unref(cls).m(placement.value),
|
|
219
|
+
expanded.value ? unref(cls).m("expanded") : ""
|
|
220
|
+
]),
|
|
221
|
+
style: normalizeStyle(panelStyle.value),
|
|
222
|
+
onMousedown: _cache[8] || (_cache[8] = withModifiers(() => {}, ["stop"])),
|
|
223
|
+
onPointerdown: _cache[9] || (_cache[9] = withModifiers(() => {}, ["stop"]))
|
|
224
|
+
}, [createElementVNode("div", { class: normalizeClass(unref(cls).e("bar")) }, [createElementVNode("div", {
|
|
225
|
+
class: normalizeClass(unref(cls).e("summary")),
|
|
226
|
+
title: summaryText.value
|
|
227
|
+
}, toDisplayString(summaryText.value), 11, _hoisted_1), createElementVNode("div", { class: normalizeClass(unref(cls).e("toolbar")) }, [
|
|
228
|
+
createVNode(unref(USelect), {
|
|
229
|
+
size: "small",
|
|
230
|
+
class: normalizeClass([unref(cls).e("select"), unref(cls).em("select", "role")]),
|
|
231
|
+
"model-value": currentPresetValue.value,
|
|
232
|
+
options: presetOptions.value,
|
|
233
|
+
"onUpdate:modelValue": onPreset
|
|
234
|
+
}, null, 8, [
|
|
235
|
+
"class",
|
|
236
|
+
"model-value",
|
|
237
|
+
"options"
|
|
238
|
+
]),
|
|
239
|
+
createVNode(unref(USelect), {
|
|
240
|
+
size: "small",
|
|
241
|
+
class: normalizeClass([unref(cls).e("select"), unref(cls).em("select", "aggregate")]),
|
|
242
|
+
"model-value": __props.binding.aggregate,
|
|
243
|
+
options: aggregateOptions,
|
|
244
|
+
"onUpdate:modelValue": onAggregate
|
|
245
|
+
}, null, 8, ["class", "model-value"]),
|
|
246
|
+
createVNode(unref(USelect), {
|
|
247
|
+
size: "small",
|
|
248
|
+
class: normalizeClass([unref(cls).e("select"), unref(cls).em("select", "expand")]),
|
|
249
|
+
"model-value": __props.binding.expand,
|
|
250
|
+
options: expandOptions,
|
|
251
|
+
"onUpdate:modelValue": onExpand
|
|
252
|
+
}, null, 8, ["class", "model-value"]),
|
|
253
|
+
createVNode(unref(UButton), {
|
|
254
|
+
size: "small",
|
|
255
|
+
plain: "",
|
|
256
|
+
onClick: _cache[0] || (_cache[0] = ($event) => emit("open-rules"))
|
|
257
|
+
}, {
|
|
258
|
+
default: withCtx(() => [..._cache[10] || (_cache[10] = [createTextVNode("条件样式", -1)])]),
|
|
259
|
+
_: 1
|
|
260
|
+
}),
|
|
261
|
+
createVNode(unref(UButton), {
|
|
262
|
+
size: "small",
|
|
263
|
+
text: "",
|
|
264
|
+
class: normalizeClass(unref(cls).e("expand")),
|
|
265
|
+
title: expanded.value ? "收起" : "展开更多",
|
|
266
|
+
onClick: _cache[1] || (_cache[1] = ($event) => expanded.value = !expanded.value)
|
|
267
|
+
}, {
|
|
268
|
+
default: withCtx(() => [createTextVNode(toDisplayString(expanded.value ? "收起" : "展开"), 1)]),
|
|
269
|
+
_: 1
|
|
270
|
+
}, 8, ["class", "title"])
|
|
271
|
+
], 2)], 2), expanded.value ? (openBlock(), createElementBlock("div", {
|
|
272
|
+
key: 0,
|
|
273
|
+
class: normalizeClass(unref(cls).e("body"))
|
|
274
|
+
}, [
|
|
275
|
+
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),
|
|
276
|
+
createElementVNode("section", { class: normalizeClass(unref(cls).e("section")) }, [createElementVNode("div", { class: normalizeClass(unref(cls).e("section-label")) }, "排序", 2), createVNode(unref(URadioGroup), {
|
|
277
|
+
size: "small",
|
|
278
|
+
items: sortOptions,
|
|
279
|
+
"model-value": __props.binding.sort ?? "none",
|
|
280
|
+
"onUpdate:modelValue": onSort
|
|
281
|
+
}, null, 8, ["model-value"])], 2),
|
|
282
|
+
createElementVNode("section", { class: normalizeClass(unref(cls).e("section")) }, [createElementVNode("div", { class: normalizeClass(unref(cls).e("section-label")) }, "扩展实例合并单元格", 2), createVNode(unref(USwitch), {
|
|
283
|
+
size: "small",
|
|
284
|
+
"model-value": __props.binding.mergeSpan !== false,
|
|
285
|
+
"onUpdate:modelValue": onMergeSpan
|
|
286
|
+
}, null, 8, ["model-value"])], 2),
|
|
287
|
+
createElementVNode("section", { class: normalizeClass(unref(cls).e("section")) }, [
|
|
288
|
+
createElementVNode("div", { class: normalizeClass(unref(cls).e("section-label")) }, "行方向父格", 2),
|
|
289
|
+
createElementVNode("p", { class: normalizeClass(unref(cls).e("hint")) }, "当前:" + toDisplayString(__props.resolvedRowParentLabel), 3),
|
|
290
|
+
createElementVNode("div", { class: normalizeClass(unref(cls).e("parent-actions")) }, [
|
|
291
|
+
createVNode(unref(UButton), {
|
|
292
|
+
size: "small",
|
|
293
|
+
plain: "",
|
|
294
|
+
type: __props.parentPickMode === "row" ? "primary" : void 0,
|
|
295
|
+
onClick: _cache[2] || (_cache[2] = ($event) => emit("start-parent-pick", "row"))
|
|
296
|
+
}, {
|
|
297
|
+
default: withCtx(() => [createTextVNode(toDisplayString(__props.parentPickMode === "row" ? "点选目标格…" : "设置行方向父格"), 1)]),
|
|
298
|
+
_: 1
|
|
299
|
+
}, 8, ["type"]),
|
|
300
|
+
rowParentOptions.value.length > 0 ? (openBlock(), createBlock(unref(USelect), {
|
|
301
|
+
key: 0,
|
|
302
|
+
size: "small",
|
|
303
|
+
class: normalizeClass(unref(cls).e("parent-select")),
|
|
304
|
+
placeholder: "候选格",
|
|
305
|
+
"model-value": rowParentSelectValue.value,
|
|
306
|
+
options: rowParentOptions.value,
|
|
307
|
+
"onUpdate:modelValue": onRowParentSelect
|
|
308
|
+
}, null, 8, [
|
|
309
|
+
"class",
|
|
310
|
+
"model-value",
|
|
311
|
+
"options"
|
|
312
|
+
])) : createCommentVNode("v-if", true),
|
|
313
|
+
__props.binding.rowParent ? (openBlock(), createBlock(unref(UButton), {
|
|
314
|
+
key: 1,
|
|
315
|
+
size: "small",
|
|
316
|
+
text: "",
|
|
317
|
+
type: "danger",
|
|
318
|
+
onClick: _cache[3] || (_cache[3] = ($event) => emit("clear-parent", "row"))
|
|
319
|
+
}, {
|
|
320
|
+
default: withCtx(() => [..._cache[11] || (_cache[11] = [createTextVNode(" 清除 ", -1)])]),
|
|
321
|
+
_: 1
|
|
322
|
+
})) : createCommentVNode("v-if", true)
|
|
323
|
+
], 2)
|
|
324
|
+
], 2),
|
|
325
|
+
createElementVNode("section", { class: normalizeClass(unref(cls).e("section")) }, [
|
|
326
|
+
createElementVNode("div", { class: normalizeClass(unref(cls).e("section-label")) }, "列方向父格", 2),
|
|
327
|
+
createElementVNode("p", { class: normalizeClass(unref(cls).e("hint")) }, "当前:" + toDisplayString(__props.resolvedColParentLabel), 3),
|
|
328
|
+
createElementVNode("div", { class: normalizeClass(unref(cls).e("parent-actions")) }, [
|
|
329
|
+
createVNode(unref(UButton), {
|
|
330
|
+
size: "small",
|
|
331
|
+
plain: "",
|
|
332
|
+
type: __props.parentPickMode === "col" ? "primary" : void 0,
|
|
333
|
+
onClick: _cache[4] || (_cache[4] = ($event) => emit("start-parent-pick", "col"))
|
|
334
|
+
}, {
|
|
335
|
+
default: withCtx(() => [createTextVNode(toDisplayString(__props.parentPickMode === "col" ? "点选目标格…" : "设置列方向父格"), 1)]),
|
|
336
|
+
_: 1
|
|
337
|
+
}, 8, ["type"]),
|
|
338
|
+
colParentOptions.value.length > 0 ? (openBlock(), createBlock(unref(USelect), {
|
|
339
|
+
key: 0,
|
|
340
|
+
size: "small",
|
|
341
|
+
class: normalizeClass(unref(cls).e("parent-select")),
|
|
342
|
+
placeholder: "候选格",
|
|
343
|
+
"model-value": colParentSelectValue.value,
|
|
344
|
+
options: colParentOptions.value,
|
|
345
|
+
"onUpdate:modelValue": onColParentSelect
|
|
346
|
+
}, null, 8, [
|
|
347
|
+
"class",
|
|
348
|
+
"model-value",
|
|
349
|
+
"options"
|
|
350
|
+
])) : createCommentVNode("v-if", true),
|
|
351
|
+
__props.binding.colParent ? (openBlock(), createBlock(unref(UButton), {
|
|
352
|
+
key: 1,
|
|
353
|
+
size: "small",
|
|
354
|
+
text: "",
|
|
355
|
+
type: "danger",
|
|
356
|
+
onClick: _cache[5] || (_cache[5] = ($event) => emit("clear-parent", "col"))
|
|
357
|
+
}, {
|
|
358
|
+
default: withCtx(() => [..._cache[12] || (_cache[12] = [createTextVNode(" 清除 ", -1)])]),
|
|
359
|
+
_: 1
|
|
360
|
+
})) : createCommentVNode("v-if", true)
|
|
361
|
+
], 2)
|
|
362
|
+
], 2),
|
|
363
|
+
createElementVNode("footer", { class: normalizeClass(unref(cls).e("footer")) }, [__props.parentPickMode ? (openBlock(), createBlock(unref(UButton), {
|
|
364
|
+
key: 0,
|
|
365
|
+
size: "small",
|
|
366
|
+
plain: "",
|
|
367
|
+
onClick: _cache[6] || (_cache[6] = ($event) => emit("cancel-parent-pick"))
|
|
368
|
+
}, {
|
|
369
|
+
default: withCtx(() => [..._cache[13] || (_cache[13] = [createTextVNode(" 取消点选 ", -1)])]),
|
|
370
|
+
_: 1
|
|
371
|
+
})) : createCommentVNode("v-if", true), createVNode(unref(UButton), {
|
|
372
|
+
size: "small",
|
|
373
|
+
type: "danger",
|
|
374
|
+
plain: "",
|
|
375
|
+
onClick: _cache[7] || (_cache[7] = ($event) => emit("remove"))
|
|
376
|
+
}, {
|
|
377
|
+
default: withCtx(() => [..._cache[14] || (_cache[14] = [createTextVNode("删除绑定", -1)])]),
|
|
378
|
+
_: 1
|
|
379
|
+
})], 2)
|
|
380
|
+
], 2)) : createCommentVNode("v-if", true)], 38)), [[vShow, visible.value]]) : createCommentVNode("v-if", true);
|
|
381
|
+
};
|
|
382
|
+
}
|
|
383
|
+
});
|
|
384
|
+
//#endregion
|
|
385
|
+
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 };
|