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