@veltra/sheet 2.4.0 → 2.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/sheet/formula-bar.js +50 -7
- package/dist/components/sheet/style2.css +2 -2
- package/dist/index.d.ts +2 -19
- package/dist/index.js +2 -15
- package/dist/types/index.d.ts +1 -3
- package/package.json +5 -6
- package/src/components/sheet/__test__/formula-bar.test.ts +29 -0
- package/src/components/sheet/formula-bar.vue +67 -6
- package/src/components/sheet/style.scss +1 -1
- package/src/index.ts +1 -27
- package/src/types/index.ts +0 -2
- package/dist/components/report/binding-badge.js +0 -118
- package/dist/components/report/designer/cell-coords.js +0 -46
- package/dist/components/report/designer/col-widths.js +0 -29
- package/dist/components/report/designer/conditional-rules/helpers.js +0 -139
- package/dist/components/report/designer/drill-dialog.js +0 -258
- package/dist/components/report/designer/drop-highlight-overlay.js +0 -76
- package/dist/components/report/designer/float-panel.js +0 -434
- package/dist/components/report/designer/role.js +0 -17
- package/dist/components/report/designer/rule-preview.js +0 -33
- package/dist/components/report/designer/rule-row.js +0 -253
- package/dist/components/report/designer/rules-dialog.js +0 -118
- package/dist/components/report/designer/topology-overlay.js +0 -122
- package/dist/components/report/designer/topology.js +0 -64
- package/dist/components/report/designer/use-grid-overlay.js +0 -75
- package/dist/components/report/designer-hub.js +0 -177
- package/dist/components/report/field-panel-helpers.js +0 -33
- package/dist/components/report/field-panel.js +0 -132
- package/dist/components/report/filter-bar.js +0 -74
- package/dist/components/report/hub-connection-form.js +0 -145
- package/dist/components/report/hub-dataset-editor.js +0 -409
- package/dist/components/report/preview-grid-size.js +0 -32
- package/dist/components/report/print.js +0 -39
- package/dist/components/report/report-designer.js +0 -428
- package/dist/components/report/report-viewer.js +0 -253
- package/dist/components/report/style.d.ts +0 -17
- package/dist/components/report/style.js +0 -18
- package/dist/components/report/style2.css +0 -965
- package/dist/components/report/use-report-designer.js +0 -387
- package/dist/components/report/use-report-viewer.js +0 -140
- package/dist/report/binding.d.ts +0 -83
- package/dist/report/binding.js +0 -334
- package/dist/report/connector.d.ts +0 -66
- package/dist/report/connector.js +0 -159
- package/dist/report/drill.d.ts +0 -48
- package/dist/report/drill.js +0 -78
- package/dist/report/export-xlsx.d.ts +0 -13
- package/dist/report/export-xlsx.js +0 -13
- package/dist/report/filter-bar.d.ts +0 -10
- package/dist/report/filter-bar.js +0 -31
- package/dist/report/index.d.ts +0 -14
- package/dist/report/params.d.ts +0 -13
- package/dist/report/params.js +0 -61
- package/dist/report/print.d.ts +0 -23
- package/dist/report/print.js +0 -197
- package/dist/report/render/aggregate.js +0 -193
- package/dist/report/render/builder.d.ts +0 -12
- package/dist/report/render/builder.js +0 -139
- package/dist/report/render/coordinate.d.ts +0 -25
- package/dist/report/render/coordinate.js +0 -733
- package/dist/report/render/index.d.ts +0 -14
- package/dist/report/render/index.js +0 -21
- package/dist/report/render/style-resolver.js +0 -50
- package/dist/report/render/template-index.d.ts +0 -24
- package/dist/report/render/template-index.js +0 -137
- package/dist/report/rules/evaluate.d.ts +0 -25
- package/dist/report/rules/evaluate.js +0 -82
- package/dist/report/rules/index.d.ts +0 -2
- package/dist/report/template.d.ts +0 -63
- package/dist/report/template.js +0 -83
- package/dist/report/types.d.ts +0 -103
- package/dist/types/report-designer.d.ts +0 -51
- package/dist/types/report-viewer.d.ts +0 -57
- package/src/components/report/__test__/binding-badge.test.ts +0 -92
- package/src/components/report/__test__/conditional-rules-helpers.test.ts +0 -88
- package/src/components/report/__test__/field-panel-helpers.test.ts +0 -65
- package/src/components/report/__test__/float-panel-position.test.ts +0 -45
- package/src/components/report/__test__/preview-grid-size.test.ts +0 -63
- package/src/components/report/__test__/report-designer.test.ts +0 -559
- package/src/components/report/__test__/report-drill.test.ts +0 -692
- package/src/components/report/__test__/report-viewer.test.ts +0 -400
- package/src/components/report/__test__/topology.test.ts +0 -143
- package/src/components/report/__test__/use-report-designer.test.ts +0 -804
- package/src/components/report/binding-badge.ts +0 -122
- package/src/components/report/designer/cell-coords.ts +0 -95
- package/src/components/report/designer/col-widths.ts +0 -56
- package/src/components/report/designer/conditional-rules/helpers.ts +0 -189
- package/src/components/report/designer/drill-dialog.vue +0 -245
- package/src/components/report/designer/drop-highlight-overlay.vue +0 -75
- package/src/components/report/designer/float-panel.vue +0 -444
- package/src/components/report/designer/role.ts +0 -32
- package/src/components/report/designer/rule-preview.vue +0 -40
- package/src/components/report/designer/rule-row.vue +0 -252
- package/src/components/report/designer/rules-dialog.vue +0 -110
- package/src/components/report/designer/topology-overlay.vue +0 -128
- package/src/components/report/designer/topology.ts +0 -124
- package/src/components/report/designer/use-grid-overlay.ts +0 -114
- package/src/components/report/designer-hub.vue +0 -198
- package/src/components/report/field-panel-helpers.ts +0 -44
- package/src/components/report/field-panel.vue +0 -136
- package/src/components/report/filter-bar.vue +0 -77
- package/src/components/report/hub-connection-form.vue +0 -124
- package/src/components/report/hub-dataset-editor.vue +0 -387
- package/src/components/report/index.ts +0 -2
- package/src/components/report/preview-grid-size.ts +0 -33
- package/src/components/report/print.ts +0 -44
- package/src/components/report/report-designer.vue +0 -454
- package/src/components/report/report-viewer.vue +0 -289
- package/src/components/report/style-designer.scss +0 -653
- package/src/components/report/style-hub.scss +0 -292
- package/src/components/report/style-viewer.scss +0 -144
- package/src/components/report/style.scss +0 -3
- package/src/components/report/style.ts +0 -20
- package/src/components/report/use-report-designer.ts +0 -603
- package/src/components/report/use-report-viewer.ts +0 -227
- package/src/report/__test__/binding.test.ts +0 -320
- package/src/report/__test__/connector.test.ts +0 -239
- package/src/report/__test__/drill.test.ts +0 -194
- package/src/report/__test__/export-xlsx.test.ts +0 -96
- package/src/report/__test__/filter-bar.test.ts +0 -58
- package/src/report/__test__/params.test.ts +0 -156
- package/src/report/__test__/print.test.ts +0 -170
- package/src/report/__test__/render.test.ts +0 -856
- package/src/report/__test__/rules.test.ts +0 -131
- package/src/report/__test__/template.test.ts +0 -366
- package/src/report/binding.ts +0 -474
- package/src/report/connector.ts +0 -206
- package/src/report/drill.ts +0 -112
- package/src/report/export-xlsx.ts +0 -15
- package/src/report/filter-bar.ts +0 -36
- package/src/report/index.ts +0 -16
- package/src/report/params.ts +0 -96
- package/src/report/print.ts +0 -234
- package/src/report/render/__test__/aggregate.test.ts +0 -16
- package/src/report/render/__test__/coordinate.test.ts +0 -405
- package/src/report/render/aggregate.ts +0 -289
- package/src/report/render/builder.ts +0 -211
- package/src/report/render/coordinate.ts +0 -1239
- package/src/report/render/index.ts +0 -30
- package/src/report/render/style-resolver.ts +0 -68
- package/src/report/render/template-index.ts +0 -200
- package/src/report/rules/evaluate.ts +0 -113
- package/src/report/rules/index.ts +0 -7
- package/src/report/template.ts +0 -145
- package/src/report/types.ts +0 -116
- package/src/types/report-designer.ts +0 -55
- package/src/types/report-viewer.ts +0 -54
|
@@ -1,139 +0,0 @@
|
|
|
1
|
-
//#region src/components/report/designer/conditional-rules/helpers.ts
|
|
2
|
-
const OPERATOR_LABELS = {
|
|
3
|
-
gt: "大于",
|
|
4
|
-
gte: "大于等于",
|
|
5
|
-
lt: "小于",
|
|
6
|
-
lte: "小于等于",
|
|
7
|
-
eq: "等于",
|
|
8
|
-
between: "介于",
|
|
9
|
-
contains: "包含"
|
|
10
|
-
};
|
|
11
|
-
const RULE_SCOPE_OPTIONS = [{
|
|
12
|
-
value: "cell",
|
|
13
|
-
label: "本格"
|
|
14
|
-
}, {
|
|
15
|
-
value: "row",
|
|
16
|
-
label: "整行"
|
|
17
|
-
}];
|
|
18
|
-
/** 求值字段下拉:缺省项表示本格绑定字段 */
|
|
19
|
-
function ruleEvalFieldOptions(bindingField, datasetFields) {
|
|
20
|
-
return [{
|
|
21
|
-
value: "",
|
|
22
|
-
label: "本格字段"
|
|
23
|
-
}, ...datasetFields.filter((field) => field.name !== bindingField).map((field) => ({
|
|
24
|
-
value: field.name,
|
|
25
|
-
label: field.label || field.name
|
|
26
|
-
}))];
|
|
27
|
-
}
|
|
28
|
-
/** 按规则所选求值字段解析字段类型(运算符映射用) */
|
|
29
|
-
function resolveEvalFieldType(rule, bindingField, datasetFields) {
|
|
30
|
-
const fieldName = rule.field ?? bindingField;
|
|
31
|
-
return datasetFields.find((field) => field.name === fieldName)?.type ?? "number";
|
|
32
|
-
}
|
|
33
|
-
const NUMERIC_OPERATORS = [
|
|
34
|
-
"gt",
|
|
35
|
-
"gte",
|
|
36
|
-
"lt",
|
|
37
|
-
"lte",
|
|
38
|
-
"eq",
|
|
39
|
-
"between"
|
|
40
|
-
];
|
|
41
|
-
const STRING_OPERATORS = ["eq", "contains"];
|
|
42
|
-
let draftIdSeq = 0;
|
|
43
|
-
function nextDraftId() {
|
|
44
|
-
draftIdSeq += 1;
|
|
45
|
-
return `rule-${draftIdSeq}`;
|
|
46
|
-
}
|
|
47
|
-
/** 按字段类型返回可用运算符 */
|
|
48
|
-
function operatorsForFieldType(fieldType) {
|
|
49
|
-
return (fieldType === "string" ? STRING_OPERATORS : NUMERIC_OPERATORS).map((value) => ({
|
|
50
|
-
value,
|
|
51
|
-
label: OPERATOR_LABELS[value]
|
|
52
|
-
}));
|
|
53
|
-
}
|
|
54
|
-
function isNumericFieldType(fieldType) {
|
|
55
|
-
return fieldType === "number" || fieldType === "date";
|
|
56
|
-
}
|
|
57
|
-
function defaultRuleValue(operator, fieldType) {
|
|
58
|
-
if (operator === "between") return isNumericFieldType(fieldType) ? [0, 100] : ["", ""];
|
|
59
|
-
if (operator === "contains" || operator === "eq" && fieldType === "string") return "";
|
|
60
|
-
return 0;
|
|
61
|
-
}
|
|
62
|
-
function defaultRuleStyle() {
|
|
63
|
-
return {
|
|
64
|
-
fill: { color: "#FEF3C7" },
|
|
65
|
-
font: { color: "#B45309" }
|
|
66
|
-
};
|
|
67
|
-
}
|
|
68
|
-
function createDraftItem(rule, fieldType = "number", _bindingField) {
|
|
69
|
-
if (rule) return {
|
|
70
|
-
id: nextDraftId(),
|
|
71
|
-
rule: cloneRule(rule)
|
|
72
|
-
};
|
|
73
|
-
const operator = operatorsForFieldType(fieldType)[0]?.value ?? "eq";
|
|
74
|
-
return {
|
|
75
|
-
id: nextDraftId(),
|
|
76
|
-
rule: {
|
|
77
|
-
operator,
|
|
78
|
-
value: defaultRuleValue(operator, fieldType),
|
|
79
|
-
style: defaultRuleStyle()
|
|
80
|
-
}
|
|
81
|
-
};
|
|
82
|
-
}
|
|
83
|
-
function initDraftFromRules(rules, fieldType, bindingField) {
|
|
84
|
-
if (rules.length === 0) return [];
|
|
85
|
-
return rules.map((rule) => createDraftItem(rule, fieldType, bindingField));
|
|
86
|
-
}
|
|
87
|
-
function cloneRule(rule) {
|
|
88
|
-
return {
|
|
89
|
-
operator: rule.operator,
|
|
90
|
-
value: cloneRuleValue(rule.value),
|
|
91
|
-
field: rule.field,
|
|
92
|
-
scope: rule.scope,
|
|
93
|
-
style: {
|
|
94
|
-
...rule.style,
|
|
95
|
-
fill: rule.style.fill ? { ...rule.style.fill } : void 0,
|
|
96
|
-
font: rule.style.font ? { ...rule.style.font } : void 0
|
|
97
|
-
}
|
|
98
|
-
};
|
|
99
|
-
}
|
|
100
|
-
function cloneRuleValue(value) {
|
|
101
|
-
if (Array.isArray(value)) return [...value];
|
|
102
|
-
return value;
|
|
103
|
-
}
|
|
104
|
-
function cloneRulesFromDraft(items) {
|
|
105
|
-
return items.map((item) => cloneRule(item.rule));
|
|
106
|
-
}
|
|
107
|
-
/** 运算符切换时重置比较值为合理缺省 */
|
|
108
|
-
function coerceValueForOperator(operator, fieldType, current) {
|
|
109
|
-
if (operator === "between") {
|
|
110
|
-
if (Array.isArray(current) && current.length === 2) return [...current];
|
|
111
|
-
return defaultRuleValue("between", fieldType);
|
|
112
|
-
}
|
|
113
|
-
if (operator === "contains") return typeof current === "string" ? current : "";
|
|
114
|
-
if (isNumericFieldType(fieldType)) {
|
|
115
|
-
const n = typeof current === "number" && Number.isFinite(current) ? current : Number(current);
|
|
116
|
-
return Number.isFinite(n) ? n : 0;
|
|
117
|
-
}
|
|
118
|
-
return typeof current === "string" ? current : "";
|
|
119
|
-
}
|
|
120
|
-
function toDisplayString(value) {
|
|
121
|
-
if (typeof value === "string") return value;
|
|
122
|
-
if (typeof value === "number" || typeof value === "boolean" || typeof value === "bigint") return String(value);
|
|
123
|
-
return "";
|
|
124
|
-
}
|
|
125
|
-
function readBetweenValue(value, index, fieldType) {
|
|
126
|
-
const raw = (Array.isArray(value) && value.length === 2 ? value : defaultRuleValue("between", fieldType))[index];
|
|
127
|
-
if (isNumericFieldType(fieldType)) {
|
|
128
|
-
const n = typeof raw === "number" ? raw : Number(raw);
|
|
129
|
-
return Number.isFinite(n) ? n : 0;
|
|
130
|
-
}
|
|
131
|
-
return typeof raw === "string" ? raw : toDisplayString(raw);
|
|
132
|
-
}
|
|
133
|
-
function writeBetweenValue(value, index, next, fieldType) {
|
|
134
|
-
const pair = [readBetweenValue(value, 0, fieldType), readBetweenValue(value, 1, fieldType)];
|
|
135
|
-
pair[index] = next;
|
|
136
|
-
return pair;
|
|
137
|
-
}
|
|
138
|
-
//#endregion
|
|
139
|
-
export { OPERATOR_LABELS, RULE_SCOPE_OPTIONS, cloneRule, cloneRulesFromDraft, coerceValueForOperator, createDraftItem, defaultRuleStyle, defaultRuleValue, initDraftFromRules, isNumericFieldType, operatorsForFieldType, readBetweenValue, resolveEvalFieldType, ruleEvalFieldOptions, writeBetweenValue };
|
|
@@ -1,258 +0,0 @@
|
|
|
1
|
-
import { resolveTemplateParams } from "../../../report/template.js";
|
|
2
|
-
import { Fragment, computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, createTextVNode, createVNode, defineComponent, normalizeClass, openBlock, ref, renderList, toDisplayString, unref, watch, withCtx } from "vue";
|
|
3
|
-
import { UButton, UDialog, URadioGroup, USelect } from "@veltra/desktop";
|
|
4
|
-
import { bem } from "@veltra/utils";
|
|
5
|
-
//#region src/components/report/designer/drill-dialog.vue
|
|
6
|
-
const _hoisted_1 = { key: 2 };
|
|
7
|
-
const _sfc_main = /*@__PURE__*/ defineComponent({
|
|
8
|
-
name: "UReportDrillDialog",
|
|
9
|
-
__name: "drill-dialog",
|
|
10
|
-
props: {
|
|
11
|
-
modelValue: { type: Boolean },
|
|
12
|
-
templates: {},
|
|
13
|
-
fields: { default: () => [] },
|
|
14
|
-
drill: { default: void 0 },
|
|
15
|
-
resolveTemplate: {
|
|
16
|
-
type: Function,
|
|
17
|
-
default: void 0
|
|
18
|
-
}
|
|
19
|
-
},
|
|
20
|
-
emits: [
|
|
21
|
-
"update:modelValue",
|
|
22
|
-
"save",
|
|
23
|
-
"remove"
|
|
24
|
-
],
|
|
25
|
-
setup(__props, { emit: __emit }) {
|
|
26
|
-
/** 映射编辑行草稿(保存时折叠为 Record<字段, 参数>) */
|
|
27
|
-
const props = __props;
|
|
28
|
-
const emit = __emit;
|
|
29
|
-
const cls = bem("report-drill-dialog");
|
|
30
|
-
const visible = computed({
|
|
31
|
-
get: () => props.modelValue,
|
|
32
|
-
set: (value) => emit("update:modelValue", value)
|
|
33
|
-
});
|
|
34
|
-
const openModeItems = [{
|
|
35
|
-
value: "switch",
|
|
36
|
-
label: "查看器内切换"
|
|
37
|
-
}, {
|
|
38
|
-
value: "dialog",
|
|
39
|
-
label: "弹框打开(UDialog)"
|
|
40
|
-
}];
|
|
41
|
-
const target = ref("");
|
|
42
|
-
const openMode = ref("switch");
|
|
43
|
-
const mappings = ref([]);
|
|
44
|
-
watch(() => props.modelValue, (open) => {
|
|
45
|
-
if (!open) return;
|
|
46
|
-
target.value = props.drill?.target ?? "";
|
|
47
|
-
openMode.value = props.drill?.openMode ?? "switch";
|
|
48
|
-
mappings.value = Object.entries(props.drill?.mapping ?? {}).map(([field, param]) => ({
|
|
49
|
-
field,
|
|
50
|
-
param
|
|
51
|
-
}));
|
|
52
|
-
resolveTargetParams(target.value);
|
|
53
|
-
});
|
|
54
|
-
const targetParams = ref([]);
|
|
55
|
-
const paramsLoading = ref(false);
|
|
56
|
-
const paramsError = ref("");
|
|
57
|
-
let paramsSeq = 0;
|
|
58
|
-
async function resolveTargetParams(ref) {
|
|
59
|
-
const seq = ++paramsSeq;
|
|
60
|
-
targetParams.value = [];
|
|
61
|
-
paramsError.value = "";
|
|
62
|
-
if (!ref) return;
|
|
63
|
-
const resolve = props.resolveTemplate;
|
|
64
|
-
if (!resolve) {
|
|
65
|
-
paramsError.value = "宿主未提供 resolveTemplate,无法解析目标模板参数";
|
|
66
|
-
return;
|
|
67
|
-
}
|
|
68
|
-
paramsLoading.value = true;
|
|
69
|
-
try {
|
|
70
|
-
const template = await resolve(ref);
|
|
71
|
-
if (seq !== paramsSeq) return;
|
|
72
|
-
targetParams.value = resolveTemplateParams(template);
|
|
73
|
-
} catch (error) {
|
|
74
|
-
if (seq !== paramsSeq) return;
|
|
75
|
-
paramsError.value = `解析目标模板参数失败:${error instanceof Error ? error.message : String(error)}`;
|
|
76
|
-
} finally {
|
|
77
|
-
if (seq === paramsSeq) paramsLoading.value = false;
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
const templateOptions = computed(() => props.templates.map((item) => ({
|
|
81
|
-
value: item.ref,
|
|
82
|
-
label: item.label
|
|
83
|
-
})));
|
|
84
|
-
const fieldOptions = computed(() => props.fields.map((field) => ({
|
|
85
|
-
value: field.name,
|
|
86
|
-
label: field.label
|
|
87
|
-
})));
|
|
88
|
-
const paramOptions = computed(() => targetParams.value.map((param) => ({
|
|
89
|
-
value: param.id,
|
|
90
|
-
label: param.label && param.label !== param.id ? `${param.label}(${param.id})` : param.id
|
|
91
|
-
})));
|
|
92
|
-
/** 用户改选目标:旧映射的参数 id 未必存在于新模板,直接清空重配 */
|
|
93
|
-
function onTarget(value) {
|
|
94
|
-
target.value = value ?? "";
|
|
95
|
-
mappings.value = [];
|
|
96
|
-
resolveTargetParams(target.value);
|
|
97
|
-
}
|
|
98
|
-
function onOpenMode(value) {
|
|
99
|
-
openMode.value = value;
|
|
100
|
-
}
|
|
101
|
-
function addMapping() {
|
|
102
|
-
mappings.value = [...mappings.value, {
|
|
103
|
-
field: "",
|
|
104
|
-
param: ""
|
|
105
|
-
}];
|
|
106
|
-
}
|
|
107
|
-
function removeMapping(index) {
|
|
108
|
-
mappings.value = mappings.value.filter((_, i) => i !== index);
|
|
109
|
-
}
|
|
110
|
-
function confirm() {
|
|
111
|
-
if (!target.value) return;
|
|
112
|
-
const mapping = {};
|
|
113
|
-
for (const row of mappings.value) if (row.field && row.param) mapping[row.field] = row.param;
|
|
114
|
-
emit("save", {
|
|
115
|
-
target: target.value,
|
|
116
|
-
mapping,
|
|
117
|
-
openMode: openMode.value
|
|
118
|
-
});
|
|
119
|
-
visible.value = false;
|
|
120
|
-
}
|
|
121
|
-
function remove() {
|
|
122
|
-
emit("remove");
|
|
123
|
-
visible.value = false;
|
|
124
|
-
}
|
|
125
|
-
function onClose() {
|
|
126
|
-
visible.value = false;
|
|
127
|
-
}
|
|
128
|
-
return (_ctx, _cache) => {
|
|
129
|
-
return openBlock(), createBlock(unref(UDialog), {
|
|
130
|
-
modelValue: visible.value,
|
|
131
|
-
"onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => visible.value = $event),
|
|
132
|
-
title: "下钻配置",
|
|
133
|
-
style: {
|
|
134
|
-
"width": "min(560px, 92vw)",
|
|
135
|
-
"max-height": "85vh"
|
|
136
|
-
},
|
|
137
|
-
onClose
|
|
138
|
-
}, {
|
|
139
|
-
footer: withCtx(() => [
|
|
140
|
-
__props.drill ? (openBlock(), createBlock(unref(UButton), {
|
|
141
|
-
key: 0,
|
|
142
|
-
size: "small",
|
|
143
|
-
text: "",
|
|
144
|
-
type: "danger",
|
|
145
|
-
style: { "margin-right": "auto" },
|
|
146
|
-
onClick: remove
|
|
147
|
-
}, {
|
|
148
|
-
default: withCtx(() => [..._cache[4] || (_cache[4] = [createTextVNode(" 移除下钻 ", -1)])]),
|
|
149
|
-
_: 1
|
|
150
|
-
})) : createCommentVNode("v-if", true),
|
|
151
|
-
createVNode(unref(UButton), {
|
|
152
|
-
size: "small",
|
|
153
|
-
onClick: _cache[0] || (_cache[0] = ($event) => visible.value = false)
|
|
154
|
-
}, {
|
|
155
|
-
default: withCtx(() => [..._cache[5] || (_cache[5] = [createTextVNode("取消", -1)])]),
|
|
156
|
-
_: 1
|
|
157
|
-
}),
|
|
158
|
-
createVNode(unref(UButton), {
|
|
159
|
-
size: "small",
|
|
160
|
-
type: "primary",
|
|
161
|
-
disabled: !target.value,
|
|
162
|
-
onClick: confirm
|
|
163
|
-
}, {
|
|
164
|
-
default: withCtx(() => [..._cache[6] || (_cache[6] = [createTextVNode("确定", -1)])]),
|
|
165
|
-
_: 1
|
|
166
|
-
}, 8, ["disabled"])
|
|
167
|
-
]),
|
|
168
|
-
default: withCtx(() => [createElementVNode("div", { class: normalizeClass(unref(cls).b) }, [
|
|
169
|
-
createElementVNode("section", { class: normalizeClass(unref(cls).e("section")) }, [
|
|
170
|
-
createElementVNode("div", { class: normalizeClass(unref(cls).e("label")) }, "目标模板", 2),
|
|
171
|
-
createVNode(unref(USelect), {
|
|
172
|
-
size: "small",
|
|
173
|
-
placeholder: "从模板列表选择目标",
|
|
174
|
-
"model-value": target.value,
|
|
175
|
-
options: templateOptions.value,
|
|
176
|
-
"onUpdate:modelValue": onTarget
|
|
177
|
-
}, null, 8, ["model-value", "options"]),
|
|
178
|
-
createElementVNode("p", { class: normalizeClass(unref(cls).e("hint")) }, "目标模板仅从宿主提供的列表选择,不支持手填引用。", 2)
|
|
179
|
-
], 2),
|
|
180
|
-
createElementVNode("section", { class: normalizeClass(unref(cls).e("section")) }, [createElementVNode("div", { class: normalizeClass(unref(cls).e("label")) }, "打开方式", 2), createVNode(unref(URadioGroup), {
|
|
181
|
-
size: "small",
|
|
182
|
-
items: openModeItems,
|
|
183
|
-
"model-value": openMode.value,
|
|
184
|
-
"onUpdate:modelValue": onOpenMode
|
|
185
|
-
}, null, 8, ["model-value"])], 2),
|
|
186
|
-
createElementVNode("section", { class: normalizeClass(unref(cls).e("section")) }, [createElementVNode("div", { class: normalizeClass(unref(cls).e("label")) }, "字段 → 详情报参数映射", 2), !target.value ? (openBlock(), createElementBlock("p", {
|
|
187
|
-
key: 0,
|
|
188
|
-
class: normalizeClass(unref(cls).e("hint"))
|
|
189
|
-
}, "先选择目标模板,再配置映射。", 2)) : paramsLoading.value ? (openBlock(), createElementBlock("p", {
|
|
190
|
-
key: 1,
|
|
191
|
-
class: normalizeClass(unref(cls).e("hint"))
|
|
192
|
-
}, "正在解析目标模板参数…", 2)) : paramsError.value ? (openBlock(), createElementBlock("p", {
|
|
193
|
-
key: 2,
|
|
194
|
-
class: normalizeClass(unref(cls).e("error"))
|
|
195
|
-
}, toDisplayString(paramsError.value), 3)) : (openBlock(), createElementBlock(Fragment, { key: 3 }, [targetParams.value.length === 0 ? (openBlock(), createElementBlock("p", {
|
|
196
|
-
key: 0,
|
|
197
|
-
class: normalizeClass(unref(cls).e("hint"))
|
|
198
|
-
}, " 目标模板没有查询参数,无需配置映射。 ", 2)) : (openBlock(), createElementBlock("ul", {
|
|
199
|
-
key: 1,
|
|
200
|
-
class: normalizeClass(unref(cls).e("list"))
|
|
201
|
-
}, [(openBlock(true), createElementBlock(Fragment, null, renderList(mappings.value, (row, index) => {
|
|
202
|
-
return openBlock(), createElementBlock("li", {
|
|
203
|
-
key: index,
|
|
204
|
-
class: normalizeClass(unref(cls).e("mapping"))
|
|
205
|
-
}, [
|
|
206
|
-
createVNode(unref(USelect), {
|
|
207
|
-
size: "small",
|
|
208
|
-
class: normalizeClass(unref(cls).e("field")),
|
|
209
|
-
placeholder: "字段",
|
|
210
|
-
"model-value": row.field,
|
|
211
|
-
options: fieldOptions.value,
|
|
212
|
-
"onUpdate:modelValue": ($event) => row.field = $event
|
|
213
|
-
}, null, 8, [
|
|
214
|
-
"class",
|
|
215
|
-
"model-value",
|
|
216
|
-
"options",
|
|
217
|
-
"onUpdate:modelValue"
|
|
218
|
-
]),
|
|
219
|
-
createElementVNode("span", { class: normalizeClass(unref(cls).e("arrow")) }, "→", 2),
|
|
220
|
-
createVNode(unref(USelect), {
|
|
221
|
-
size: "small",
|
|
222
|
-
class: normalizeClass(unref(cls).e("param")),
|
|
223
|
-
placeholder: "参数",
|
|
224
|
-
"model-value": row.param,
|
|
225
|
-
options: paramOptions.value,
|
|
226
|
-
"onUpdate:modelValue": ($event) => row.param = $event
|
|
227
|
-
}, null, 8, [
|
|
228
|
-
"class",
|
|
229
|
-
"model-value",
|
|
230
|
-
"options",
|
|
231
|
-
"onUpdate:modelValue"
|
|
232
|
-
]),
|
|
233
|
-
createVNode(unref(UButton), {
|
|
234
|
-
size: "small",
|
|
235
|
-
text: "",
|
|
236
|
-
type: "danger",
|
|
237
|
-
onClick: ($event) => removeMapping(index)
|
|
238
|
-
}, {
|
|
239
|
-
default: withCtx(() => [..._cache[2] || (_cache[2] = [createTextVNode(" 删除 ", -1)])]),
|
|
240
|
-
_: 1
|
|
241
|
-
}, 8, ["onClick"])
|
|
242
|
-
], 2);
|
|
243
|
-
}), 128))], 2)), targetParams.value.length > 0 ? (openBlock(), createElementBlock("div", _hoisted_1, [createVNode(unref(UButton), {
|
|
244
|
-
size: "small",
|
|
245
|
-
plain: "",
|
|
246
|
-
onClick: addMapping
|
|
247
|
-
}, {
|
|
248
|
-
default: withCtx(() => [..._cache[3] || (_cache[3] = [createTextVNode("添加映射", -1)])]),
|
|
249
|
-
_: 1
|
|
250
|
-
})])) : createCommentVNode("v-if", true)], 64))], 2)
|
|
251
|
-
], 2)]),
|
|
252
|
-
_: 1
|
|
253
|
-
}, 8, ["modelValue"]);
|
|
254
|
-
};
|
|
255
|
-
}
|
|
256
|
-
});
|
|
257
|
-
//#endregion
|
|
258
|
-
export { _sfc_main as default };
|
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
import { readCellOverlayRect, useGridOverlaySync } from "./use-grid-overlay.js";
|
|
2
|
-
import { computed, createCommentVNode, createElementBlock, defineComponent, normalizeClass, normalizeStyle, openBlock, ref, toDisplayString, toRef, unref } from "vue";
|
|
3
|
-
import { bem } from "@veltra/utils";
|
|
4
|
-
//#region src/components/report/designer/drop-highlight-overlay.vue
|
|
5
|
-
const _sfc_main = /*@__PURE__*/ defineComponent({
|
|
6
|
-
name: "UReportDropHighlightOverlay",
|
|
7
|
-
__name: "drop-highlight-overlay",
|
|
8
|
-
props: {
|
|
9
|
-
cell: {},
|
|
10
|
-
hostEl: {},
|
|
11
|
-
getGrid: { type: Function },
|
|
12
|
-
dragging: { type: Boolean },
|
|
13
|
-
fallbackLabel: {}
|
|
14
|
-
},
|
|
15
|
-
setup(__props) {
|
|
16
|
-
const props = __props;
|
|
17
|
-
const cls = bem("report-drop-highlight");
|
|
18
|
-
const hostEl = toRef(props, "hostEl");
|
|
19
|
-
const rectLeft = ref(0);
|
|
20
|
-
const rectTop = ref(0);
|
|
21
|
-
const rectWidth = ref(0);
|
|
22
|
-
const rectHeight = ref(0);
|
|
23
|
-
const inView = ref(false);
|
|
24
|
-
const visible = computed(() => !!props.cell && inView.value);
|
|
25
|
-
const showFallback = computed(() => props.dragging && !props.cell);
|
|
26
|
-
const highlightStyle = computed(() => ({
|
|
27
|
-
left: `${rectLeft.value}px`,
|
|
28
|
-
top: `${rectTop.value}px`,
|
|
29
|
-
width: `${rectWidth.value}px`,
|
|
30
|
-
height: `${rectHeight.value}px`
|
|
31
|
-
}));
|
|
32
|
-
function updateHighlight() {
|
|
33
|
-
const cell = props.cell;
|
|
34
|
-
const host = props.hostEl;
|
|
35
|
-
if (!cell || !host) {
|
|
36
|
-
inView.value = false;
|
|
37
|
-
return;
|
|
38
|
-
}
|
|
39
|
-
const rect = readCellOverlayRect(cell, host, props.getGrid);
|
|
40
|
-
if (!rect) {
|
|
41
|
-
inView.value = false;
|
|
42
|
-
return;
|
|
43
|
-
}
|
|
44
|
-
inView.value = true;
|
|
45
|
-
rectLeft.value = Math.round(rect.left);
|
|
46
|
-
rectTop.value = Math.round(rect.top);
|
|
47
|
-
rectWidth.value = Math.round(rect.width);
|
|
48
|
-
rectHeight.value = Math.round(rect.height);
|
|
49
|
-
}
|
|
50
|
-
useGridOverlaySync({
|
|
51
|
-
hostEl,
|
|
52
|
-
getGrid: () => props.getGrid(),
|
|
53
|
-
watchSources: () => [
|
|
54
|
-
props.cell?.row,
|
|
55
|
-
props.cell?.col,
|
|
56
|
-
props.hostEl,
|
|
57
|
-
props.dragging
|
|
58
|
-
],
|
|
59
|
-
update: updateHighlight
|
|
60
|
-
});
|
|
61
|
-
return (_ctx, _cache) => {
|
|
62
|
-
return __props.cell && visible.value ? (openBlock(), createElementBlock("div", {
|
|
63
|
-
key: 0,
|
|
64
|
-
class: normalizeClass(unref(cls).b),
|
|
65
|
-
style: normalizeStyle(highlightStyle.value),
|
|
66
|
-
"aria-hidden": "true"
|
|
67
|
-
}, null, 6)) : showFallback.value ? (openBlock(), createElementBlock("div", {
|
|
68
|
-
key: 1,
|
|
69
|
-
class: normalizeClass(unref(cls).e("fallback")),
|
|
70
|
-
role: "status"
|
|
71
|
-
}, " 松开将绑定到当前选区 " + toDisplayString(__props.fallbackLabel), 3)) : createCommentVNode("v-if", true);
|
|
72
|
-
};
|
|
73
|
-
}
|
|
74
|
-
});
|
|
75
|
-
//#endregion
|
|
76
|
-
export { _sfc_main as default };
|