yh-report 2.0.4 → 2.0.5

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.
@@ -0,0 +1,3303 @@
1
+ import { ref, computed, defineComponent, watch, nextTick, openBlock, createElementBlock, createVNode, unref, withCtx, Fragment, renderList, withDirectives, createBlock, normalizeStyle, resolveDynamicComponent, createElementVNode, withKeys, vShow, renderSlot, reactive, onMounted, resolveComponent, resolveDirective, createTextVNode, createCommentVNode, onUnmounted, toDisplayString, h } from "vue";
2
+ import { ElMessage, ElForm, ElFormItem, ElOption, ElEmpty, ElButton } from "element-plus";
3
+ import axios from "@/libs/api.request.js";
4
+ import { cloneDeep } from "lodash-es";
5
+ import { useRouter } from "vue-router";
6
+ import * as echarts from "echarts";
7
+ const statementDesign = "";
8
+ var CellType = /* @__PURE__ */ ((e) => (e.ROW = "row", e.COL = "col", e.CELL = "cell", e.HEAD = "head", e.TEXT = "text", e.ICON = "icon", e.FUN = "fun", e.IMAGE = "img", e.FIELD = "field", e))(CellType || {}), FormatType = /* @__PURE__ */ ((e) => (e.TEXT = "text", e.NUMBER = "number", e.CURRENCY = "currency", e.PERCENT = "percent", e.PROMILLE = "promille", e.SCIENTIFIC = "scientific", e.DATETIME = "datetime", e.STRING = "string", e))(FormatType || {}), DataSourceColumnDataType = /* @__PURE__ */ ((e) => (e[e.STRING = 0] = "STRING", e[e.PLONG = 1] = "PLONG", e[e.LONG = 2] = "LONG", e[e.DOUBLE = 3] = "DOUBLE", e[e.TEXT = 4] = "TEXT", e[e.BOOL = 5] = "BOOL", e[e.DATE = 6] = "DATE", e[e.TIME = 7] = "TIME", e[e.DATETIME = 8] = "DATETIME", e[e.PASSWORD = 9] = "PASSWORD", e[e.ID = 10] = "ID", e[e.LIST = 11] = "LIST", e[e.TABLE = 12] = "TABLE", e[e.TREE = 13] = "TREE", e[e.IMG = 14] = "IMG", e[e.OPEN = 15] = "OPEN", e[e.SQL = 16] = "SQL", e[e.COLOR = 17] = "COLOR", e[e.EDITOR = 18] = "EDITOR", e))(DataSourceColumnDataType || {});
9
+ const defaultCell = {
10
+ type: CellType.TEXT,
11
+ format: FormatType.TEXT,
12
+ formatType: {
13
+ date: "",
14
+ numberDecimal: "",
15
+ numberUseGrouping: "",
16
+ currencySymbol: "",
17
+ scientificNotation: ""
18
+ },
19
+ style: {},
20
+ colSpan: 1,
21
+ rowSpan: 1,
22
+ col: 1,
23
+ row: 1,
24
+ text: "",
25
+ data: void 0
26
+ }, defaultRow = {
27
+ size: 25,
28
+ data: void 0,
29
+ loop: !1,
30
+ index: 0
31
+ }, defaultCol = {
32
+ size: 80,
33
+ data: void 0,
34
+ loop: !1,
35
+ index: 0
36
+ };
37
+ let isComplete = !1;
38
+ function validateAndCompleteOptions(e) {
39
+ var r;
40
+ isComplete = !1;
41
+ const t = {
42
+ ...e,
43
+ // @ts-ignore
44
+ options: ((r = e.options) == null ? void 0 : r.map((n) => n.type === "report" ? validateAndCompleteStatementOption(n) : n)) || []
45
+ };
46
+ return {
47
+ isComplete,
48
+ data: t
49
+ };
50
+ }
51
+ function validateAndCompleteStatementOption(e) {
52
+ Object.keys(defaultReport).length !== Object.keys(e).length && (isComplete = !0);
53
+ const t = {
54
+ ...defaultReport,
55
+ ...e,
56
+ id: `report-${Date.now()}`
57
+ };
58
+ t.rowConfig.length === 0 && (isComplete = !0, t.rowConfig = Array.from({ length: 5 }, (i, c) => ({
59
+ size: 25,
60
+ data: void 0,
61
+ loop: !1,
62
+ index: c
63
+ }))), t.colConfig.length === 0 && (isComplete = !0, t.colConfig = Array.from({ length: 10 }, (i, c) => ({
64
+ ...defaultCol
65
+ })));
66
+ const r = t.rowConfig.length, n = t.colConfig.length;
67
+ return isComplete = t.config.length !== r, t.config = t.config.map((i, c) => (isComplete = i.length !== n, i.slice(0, n).map((s, m) => (isComplete = Object.keys(s).length !== Object.keys(defaultCell).length, {
68
+ ...defaultCell,
69
+ ...s,
70
+ row: c,
71
+ col: m
72
+ })).concat(
73
+ Array.from({ length: n - i.length }, (s, m) => ({
74
+ ...defaultCell,
75
+ row: c,
76
+ col: i.length + m
77
+ // 填充列时,列索引从当前行已有列数开始
78
+ }))
79
+ ))).concat(
80
+ Array.from({ length: r - t.config.length }, (i, c) => {
81
+ const s = t.config.length + c;
82
+ return Array(n).fill(0).map((m, f) => ({
83
+ ...defaultCell,
84
+ row: s,
85
+ col: f
86
+ }));
87
+ })
88
+ ), t.rowConfig = t.rowConfig.map((i) => (isComplete = Object.keys(i).length !== Object.keys(defaultRow).length, {
89
+ ...defaultRow,
90
+ ...i
91
+ })), t.colConfig = t.colConfig.map((i) => (isComplete = Object.keys(i) !== Object.keys(defaultCol), {
92
+ ...defaultCol,
93
+ ...i
94
+ })), t;
95
+ }
96
+ const TypeItems = ref([
97
+ {
98
+ name: "报表",
99
+ icon: "icon-table",
100
+ type: "report"
101
+ },
102
+ {
103
+ name: "折线图",
104
+ icon: "icon-linechart",
105
+ type: "line"
106
+ },
107
+ {
108
+ name: "条形图",
109
+ icon: "icon-align-left",
110
+ type: "rowBar"
111
+ },
112
+ {
113
+ name: "柱状图",
114
+ icon: "icon-barchart",
115
+ type: "bar"
116
+ },
117
+ {
118
+ name: "饼状图",
119
+ icon: "icon-piechart",
120
+ type: "pie"
121
+ },
122
+ {
123
+ name: "散点图",
124
+ icon: "icon-chart-bubble",
125
+ type: "scatter"
126
+ },
127
+ {
128
+ name: "雷达图",
129
+ icon: "icon-radarchart",
130
+ type: "radar"
131
+ },
132
+ {
133
+ name: "矩形树图",
134
+ icon: "icon-s-grid",
135
+ type: "treemap"
136
+ },
137
+ {
138
+ name: "自定义标签",
139
+ icon: "icon-books",
140
+ type: "label"
141
+ }
142
+ ]), ItemTypes = computed(() => TypeItems.value.map((e) => e.type)), colors = ["#5470c6", "#91cc75", "#fac858", "#ee6666", "#73c0de", "#3ba272"], renderItem = (e, t) => {
143
+ const r = e.dataIndex, n = t.value();
144
+ let i = t.value(1);
145
+ Array.isArray(i) && (i = i.map((N) => String.fromCharCode(N)).join(""));
146
+ const c = t.getWidth(), s = t.getHeight(), m = colors[r % 6], f = e.dataInsideLength;
147
+ let y = c * 0.01;
148
+ y < 10 && (y = 10), y > 15 && (y = 15);
149
+ let C = s * 0.5;
150
+ C < 60 && (C = 60);
151
+ const x = (c - y * 2 - y * (f - 1)) / f, S = 8, g = y + r * (x + y), b = (t.getHeight() - C) / 2;
152
+ return {
153
+ type: "group",
154
+ children: [
155
+ {
156
+ type: "rect",
157
+ shape: {
158
+ x: g,
159
+ y: b,
160
+ width: x,
161
+ height: C,
162
+ r: S
163
+ },
164
+ style: {
165
+ fill: m,
166
+ stroke: "#fff",
167
+ lineWidth: 1,
168
+ shadowBlur: 4,
169
+ shadowColor: "rgba(0,0,0,0.1)"
170
+ }
171
+ },
172
+ {
173
+ type: "text",
174
+ style: {
175
+ text: `${i}
176
+
177
+ ${n}`,
178
+ fill: "#fff",
179
+ // 自动反色可改为:echarts.color.lift(color, 0.8)
180
+ fontSize: 14,
181
+ fontWeight: "bold",
182
+ align: "center",
183
+ verticalAlign: "middle"
184
+ },
185
+ position: [g + x / 2, b + C / 2]
186
+ }
187
+ ]
188
+ };
189
+ }, chartsOption = {
190
+ line: {
191
+ backgroundColor: "#fff",
192
+ title: {
193
+ text: "Title Line"
194
+ },
195
+ tooltip: {
196
+ trigger: "axis"
197
+ },
198
+ legend: {
199
+ top: "8%"
200
+ },
201
+ grid: {
202
+ left: "3%",
203
+ right: "9%",
204
+ top: "20%",
205
+ bottom: "3%",
206
+ containLabel: !0
207
+ },
208
+ xAxis: {
209
+ name: "天",
210
+ type: "category",
211
+ boundaryGap: !1,
212
+ data: ["Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"]
213
+ },
214
+ yAxis: {
215
+ name: "值",
216
+ type: "value"
217
+ },
218
+ dataZoom: [
219
+ {
220
+ type: "inside",
221
+ start: 0,
222
+ end: 100
223
+ }
224
+ ],
225
+ series: [
226
+ {
227
+ name: "Email",
228
+ type: "line",
229
+ stack: "Total",
230
+ data: [120, 132, 101, 134, 90, 230, 210]
231
+ },
232
+ {
233
+ name: "Union",
234
+ type: "line",
235
+ stack: "Total",
236
+ data: [220, 182, 191, 234, 290, 330, 310]
237
+ },
238
+ {
239
+ name: "Video",
240
+ type: "line",
241
+ stack: "Total",
242
+ data: [150, 232, 201, 154, 190, 330, 410]
243
+ }
244
+ ]
245
+ },
246
+ rowBar: {
247
+ backgroundColor: "#fff",
248
+ title: {
249
+ text: "Title Bar"
250
+ },
251
+ tooltip: {
252
+ trigger: "axis",
253
+ axisPointer: {
254
+ type: "shadow"
255
+ }
256
+ },
257
+ legend: {
258
+ top: "8%"
259
+ },
260
+ grid: {
261
+ left: "3%",
262
+ right: "9%",
263
+ top: "20%",
264
+ bottom: "3%",
265
+ containLabel: !0
266
+ },
267
+ yAxis: {
268
+ name: "天",
269
+ type: "category",
270
+ axisTick: {
271
+ alignWithLabel: !0
272
+ },
273
+ data: ["2012", "2013", "2014", "2015", "2016"]
274
+ },
275
+ xAxis: {
276
+ name: "值",
277
+ type: "value"
278
+ },
279
+ dataZoom: [
280
+ {
281
+ type: "inside",
282
+ start: 0,
283
+ end: 100
284
+ }
285
+ ],
286
+ series: [
287
+ {
288
+ name: "Forest",
289
+ type: "bar",
290
+ barGap: 0,
291
+ emphasis: {
292
+ focus: "series"
293
+ },
294
+ data: [320, 332, 301, 334, 390]
295
+ },
296
+ {
297
+ name: "Steppe",
298
+ type: "bar",
299
+ emphasis: {
300
+ focus: "series"
301
+ },
302
+ data: [220, 182, 191, 234, 290]
303
+ },
304
+ {
305
+ name: "Desert",
306
+ type: "bar",
307
+ emphasis: {
308
+ focus: "series"
309
+ },
310
+ data: [150, 232, 201, 154, 190]
311
+ }
312
+ ]
313
+ },
314
+ bar: {
315
+ backgroundColor: "#fff",
316
+ title: {
317
+ text: "Title Bar"
318
+ },
319
+ tooltip: {
320
+ trigger: "axis",
321
+ axisPointer: {
322
+ type: "shadow"
323
+ }
324
+ },
325
+ legend: {
326
+ top: "8%"
327
+ },
328
+ grid: {
329
+ left: "3%",
330
+ right: "9%",
331
+ top: "20%",
332
+ bottom: "3%",
333
+ containLabel: !0
334
+ },
335
+ xAxis: {
336
+ name: "天",
337
+ type: "category",
338
+ axisTick: {
339
+ alignWithLabel: !0
340
+ },
341
+ data: ["2012", "2013", "2014", "2015", "2016"]
342
+ },
343
+ yAxis: {
344
+ name: "值",
345
+ type: "value"
346
+ },
347
+ dataZoom: [
348
+ {
349
+ type: "inside",
350
+ start: 0,
351
+ end: 100
352
+ }
353
+ ],
354
+ series: [
355
+ {
356
+ name: "Forest",
357
+ type: "bar",
358
+ barGap: 0,
359
+ emphasis: {
360
+ focus: "series"
361
+ },
362
+ data: [320, 332, 301, 334, 390]
363
+ },
364
+ {
365
+ name: "Steppe",
366
+ type: "bar",
367
+ emphasis: {
368
+ focus: "series"
369
+ },
370
+ data: [220, 182, 191, 234, 290]
371
+ },
372
+ {
373
+ name: "Desert",
374
+ type: "bar",
375
+ emphasis: {
376
+ focus: "series"
377
+ },
378
+ data: [150, 232, 201, 154, 190]
379
+ }
380
+ ]
381
+ },
382
+ pie: {
383
+ backgroundColor: "#fff",
384
+ title: {
385
+ text: "Title Pie"
386
+ },
387
+ tooltip: {
388
+ trigger: "item"
389
+ },
390
+ legend: {
391
+ top: "8%"
392
+ },
393
+ xAxis: {
394
+ show: !1
395
+ },
396
+ yAxis: {
397
+ show: !1
398
+ },
399
+ series: [
400
+ {
401
+ name: "Access From",
402
+ type: "pie",
403
+ radius: "50%",
404
+ top: "10%",
405
+ data: [
406
+ { value: 1048, name: "Search" },
407
+ { value: 735, name: "Direct" },
408
+ { value: 580, name: "Email" },
409
+ { value: 484, name: "Union" },
410
+ { value: 300, name: "Video" }
411
+ ],
412
+ labelLine: {
413
+ show: !0
414
+ },
415
+ emphasis: {
416
+ itemStyle: {
417
+ shadowBlur: 10,
418
+ shadowOffsetX: 0,
419
+ shadowColor: "rgba(0, 0, 0, 0.5)"
420
+ }
421
+ }
422
+ }
423
+ ]
424
+ },
425
+ scatter: {
426
+ backgroundColor: "#fff",
427
+ title: {
428
+ text: "Title Scatter"
429
+ },
430
+ tooltip: {},
431
+ legend: {
432
+ top: "8%",
433
+ data: ["1990", "2015"]
434
+ },
435
+ grid: {
436
+ left: "5%",
437
+ right: "5%",
438
+ top: "20%",
439
+ bottom: "3%",
440
+ containLabel: !0
441
+ },
442
+ xAxis: {
443
+ splitLine: {
444
+ lineStyle: {
445
+ type: "dashed"
446
+ }
447
+ }
448
+ },
449
+ yAxis: {
450
+ splitLine: {
451
+ lineStyle: {
452
+ type: "dashed"
453
+ }
454
+ },
455
+ scale: !0
456
+ },
457
+ dataZoom: [
458
+ {
459
+ type: "inside",
460
+ start: 0,
461
+ end: 100
462
+ }
463
+ ],
464
+ series: [
465
+ {
466
+ name: "1990",
467
+ data: [
468
+ [1516, 68],
469
+ [13670, 74.7],
470
+ [28599, 75],
471
+ [29476, 77.1],
472
+ [31476, 75.4],
473
+ [28666, 78.1],
474
+ [1777, 57.7],
475
+ [29550, 79.1],
476
+ [2076, 67.9],
477
+ [12087, 72],
478
+ [24021, 75.4],
479
+ [43296, 76.8],
480
+ [10088, 70.8],
481
+ [19349, 69.6],
482
+ [10670, 67.3],
483
+ [26424, 75.7],
484
+ [37062, 75.4]
485
+ ],
486
+ type: "scatter",
487
+ symbolSize: 20,
488
+ emphasis: {
489
+ focus: "series",
490
+ label: {
491
+ show: !0,
492
+ position: "top"
493
+ }
494
+ },
495
+ itemStyle: {
496
+ shadowBlur: 10,
497
+ shadowColor: "rgba(0, 0, 0, 0.2)",
498
+ shadowOffsetY: 5
499
+ }
500
+ },
501
+ {
502
+ name: "2015",
503
+ data: [
504
+ [13334, 76.9],
505
+ [21291, 78.5],
506
+ [38923, 80.8],
507
+ [37599, 81.9],
508
+ [44053, 81.1],
509
+ [42182, 82.8],
510
+ [5903, 66.8],
511
+ [36162, 83.5],
512
+ [1390, 71.4],
513
+ [34644, 80.7],
514
+ [34186, 80.6],
515
+ [64304, 81.6],
516
+ [24787, 77.3],
517
+ [23038, 73.13],
518
+ [19360, 76.5],
519
+ [38225, 81.4],
520
+ [53354, 79.1]
521
+ ],
522
+ type: "scatter",
523
+ symbolSize: 20,
524
+ emphasis: {
525
+ focus: "series",
526
+ label: {
527
+ show: !0,
528
+ position: "top"
529
+ }
530
+ },
531
+ itemStyle: {
532
+ shadowBlur: 10,
533
+ shadowColor: "rgba(0, 0, 0, 0.2)",
534
+ shadowOffsetY: 5
535
+ }
536
+ }
537
+ ]
538
+ },
539
+ radar: {
540
+ backgroundColor: "#fff",
541
+ title: {
542
+ text: "Title Radar"
543
+ },
544
+ tooltip: {
545
+ trigger: "axis"
546
+ },
547
+ legend: {
548
+ top: "8%",
549
+ data: ["Budget", "Spending"]
550
+ },
551
+ radar: {
552
+ indicator: [{ name: "Sales" }, { name: "Administration" }, { name: "Technology" }, { name: "Customer" }, { name: "Development" }, { name: "Marketing" }],
553
+ radius: 80
554
+ },
555
+ series: [
556
+ {
557
+ name: "Radar",
558
+ type: "radar",
559
+ tooltip: {
560
+ trigger: "item"
561
+ },
562
+ areaStyle: {},
563
+ data: [
564
+ {
565
+ value: [4200, 3e3, 2e4, 35e3, 5e4, 18e3],
566
+ name: "Budget"
567
+ },
568
+ {
569
+ value: [5e3, 14e3, 28e3, 26e3, 42e3, 21e3],
570
+ name: "Spending"
571
+ }
572
+ ]
573
+ }
574
+ ]
575
+ },
576
+ treemap: {
577
+ backgroundColor: "#fff",
578
+ title: {
579
+ show: !1
580
+ },
581
+ legend: {
582
+ show: !1
583
+ },
584
+ grid: {
585
+ left: "0px",
586
+ right: "0px",
587
+ top: "0px",
588
+ bottom: "0px"
589
+ },
590
+ series: [
591
+ {
592
+ type: "treemap",
593
+ label: {
594
+ fontSize: 50
595
+ },
596
+ width: "100%",
597
+ height: "100%",
598
+ breadcrumb: {
599
+ show: !1
600
+ },
601
+ data: [
602
+ {
603
+ name: "标签",
604
+ value: 20
605
+ }
606
+ ],
607
+ symbol: "none",
608
+ areaStyle: null
609
+ }
610
+ ]
611
+ },
612
+ label: {
613
+ backgroundColor: "#fff",
614
+ title: {
615
+ show: !1
616
+ },
617
+ legend: {
618
+ show: !1
619
+ },
620
+ grid: {
621
+ left: "0px",
622
+ right: "0px",
623
+ top: "0px",
624
+ bottom: "0px"
625
+ },
626
+ xAxis: {
627
+ show: !1,
628
+ type: "category",
629
+ data: []
630
+ },
631
+ yAxis: {
632
+ show: !1,
633
+ type: "category",
634
+ data: []
635
+ },
636
+ series: [
637
+ {
638
+ type: "custom",
639
+ renderItem,
640
+ data: [
641
+ [20, "标签1:20"],
642
+ [35, "标签2: 35"],
643
+ [15, "标签3: 15"]
644
+ ]
645
+ }
646
+ ]
647
+ }
648
+ }, defaultChart = {
649
+ type: "chart",
650
+ data: {
651
+ source: []
652
+ },
653
+ xAisData: "",
654
+ yAisData: "",
655
+ name: "",
656
+ icon: "",
657
+ id: "",
658
+ left: 0,
659
+ top: 0,
660
+ smooth: !1,
661
+ symbol: "",
662
+ showLabel: !1,
663
+ areaStyle: "",
664
+ labelColor: "",
665
+ labelPosition: "",
666
+ radius: !1,
667
+ widthUnit: "px",
668
+ width: 600,
669
+ heightUnit: "px",
670
+ height: 400,
671
+ isSuspend: !1,
672
+ zIndex: 0,
673
+ option: void 0,
674
+ seriesData: "",
675
+ groupBy: !1,
676
+ orderBy: "NONE",
677
+ cutLength: 5
678
+ }, defaultReport = {
679
+ id: "",
680
+ type: "report",
681
+ config: [],
682
+ widthType: "px",
683
+ width: 600,
684
+ fullHeight: !1,
685
+ height: 400,
686
+ seriesEnable: !0,
687
+ seriesHeadText: "#",
688
+ frozen: {
689
+ rowCount: 0,
690
+ colCount: 0,
691
+ trailingColCount: 0,
692
+ trailingRowCount: 0
693
+ },
694
+ params: [],
695
+ theme: "blue",
696
+ data: {
697
+ source: [],
698
+ pagination: !0,
699
+ pageSize: 10,
700
+ processData: ""
701
+ },
702
+ rowConfig: [],
703
+ colConfig: []
704
+ }, setXAxisData = (e, t) => {
705
+ let { option: r } = e, { xDataId: n } = r, i, c;
706
+ if (n.length === 3 ? (t && t[n[0]] && (i = t[n[0]][n[1]]), c = n[2]) : (i = t[n[0]], c = n[1]), !i)
707
+ return r;
708
+ let s = [];
709
+ if (e.groupBy) {
710
+ let m = /* @__PURE__ */ new Set();
711
+ i.forEach((f) => {
712
+ m.add(f[c]);
713
+ }), s = [...m];
714
+ } else
715
+ s = i.map((m) => m[c]);
716
+ return e.type == "rowBar" ? r.yAxis.data = s : ["line", "bar"].includes(e.type) ? r.xAxis.data = s : e.type == "radar" && (r.radar.indicator = s), r;
717
+ }, setYAxisData = (e, t) => {
718
+ let { option: r } = e, { yDataId: n } = r, i = [], c = "";
719
+ if (r.xDataId && (r.xDataId.length === 3 ? (t && t[r.xDataId[0]] && (i = t[r.xDataId[0]][r.xDataId[1]]), c = r.xDataId[2]) : (i = t[r.xDataId[0]], c = r.xDataId[1])), i)
720
+ if (e.groupBy) {
721
+ let s = /* @__PURE__ */ new Set();
722
+ i.forEach((m) => {
723
+ s.add(m[c]);
724
+ }), i = [...s];
725
+ } else
726
+ i = i.map((s) => s[c]);
727
+ if (e.type == "radar") {
728
+ r.series[0].data = [];
729
+ for (let s of n) {
730
+ let m, f;
731
+ s.length === 3 ? (t[s[0]] && (m = t[s[0]][s[1]]), f = s[2]) : (m = t[s[0]], f = s[1]);
732
+ let y = [];
733
+ if (e.groupBy && i) {
734
+ let C = {};
735
+ m.forEach((x) => {
736
+ let S = x[c], g = x[f];
737
+ S && !isNaN(g) && (C[S] || (C[S] = 0), C[S] = g);
738
+ }), y = i.map((x) => C[x]);
739
+ } else
740
+ y = m.map((C) => C[f]);
741
+ e.orderBy && e.orderBy !== "NONE" && (y = y.sort((C, x) => e.orderBy === "ASC" ? C - x : x - C), !isNaN(e.cutLength) && e.cutLength > 0 && (y = y.slice(0, e.cutLength))), r.series[0].data.push({
742
+ value: y
743
+ });
744
+ }
745
+ } else if (e.type == "treemap") {
746
+ if (n && n.length) {
747
+ let [s, m] = n[0];
748
+ if (t[s][0]) {
749
+ let f = t[s][0][m];
750
+ if (f) {
751
+ let y = r.series[0].data[0].name.split(":")[0];
752
+ r.series[0].data[0].name = `${y}:${f}`;
753
+ }
754
+ }
755
+ }
756
+ } else {
757
+ let s = cloneDeep(r.series);
758
+ n.length && (r.series = []);
759
+ for (let m = 0; m < n.length; m++) {
760
+ let f = n[m], y, C;
761
+ f.length === 3 ? (t[f[0]] && (y = t[f[0]][f[1]]), C = f[2]) : (y = t[f[0]], C = f[1]);
762
+ let x = cloneDeep(s[0]);
763
+ x.data = [];
764
+ let S = [];
765
+ if (y && c && i) {
766
+ switch (e.type) {
767
+ case "line":
768
+ case "rowBar":
769
+ case "bar":
770
+ if (e.groupBy) {
771
+ let g = {};
772
+ y.forEach((b) => {
773
+ let N = b[c], P = b[C];
774
+ N && !isNaN(P) && (g[N] || (g[N] = 0), g[N] = P);
775
+ }), S = i.map((b) => g[b]);
776
+ } else
777
+ S = y.map((g) => g[C]);
778
+ e.orderBy && e.orderBy !== "NONE" && (S = S.sort((g, b) => e.orderBy === "ASC" ? g - b : b - g), !isNaN(e.cutLength) && e.cutLength > 0 && (S = S.slice(0, e.cutLength)));
779
+ break;
780
+ case "pie":
781
+ if (e.groupBy) {
782
+ let g = {};
783
+ y.forEach((b) => {
784
+ let N = b[c], P = b[C];
785
+ N && !isNaN(P) && (g[N] || (g[N] = 0), g[N] = P);
786
+ }), S = i.map((b) => ({ value: g[b], name: b }));
787
+ } else
788
+ S = y.map((g) => ({ value: g[C], name: g[c] }));
789
+ e.orderBy && e.orderBy !== "NONE" && (S = S.sort((g, b) => e.orderBy === "ASC" ? g - b : b - g), !isNaN(e.cutLength) && e.cutLength > 0 && (S = S.slice(0, e.cutLength)));
790
+ break;
791
+ case "scatter":
792
+ if (e.groupBy) {
793
+ let g = {};
794
+ y.forEach((b) => {
795
+ let N = b[c], P = b[C];
796
+ N && !isNaN(P) && (g[N] || (g[N] = 0), g[N] = P);
797
+ }), S = i.map((b) => [b, g[b]]);
798
+ } else
799
+ S = y.map((g) => [g[c], g[C]]);
800
+ e.orderBy && e.orderBy !== "NONE" && (S = S.sort((g, b) => e.orderBy === "ASC" ? g - b : b - g), !isNaN(e.cutLength) && e.cutLength > 0 && (S = S.slice(0, e.cutLength)));
801
+ break;
802
+ case "label":
803
+ if (e.groupBy) {
804
+ let g = {};
805
+ y.forEach((b) => {
806
+ let N = b[c], P = b[C];
807
+ N && !isNaN(P) && (g[N] || (g[N] = 0), g[N] = P);
808
+ }), S = i.map((b) => {
809
+ const N = b ? b.split("").map((P) => P.charCodeAt()) : [];
810
+ return [g[b], N];
811
+ });
812
+ } else
813
+ S = y.map((g) => {
814
+ const b = g[c] ? g[c].split("").map((N) => N.charCodeAt()) : [];
815
+ return [g[C], b];
816
+ });
817
+ e.orderBy && e.orderBy !== "NONE" && (S = S.sort((g, b) => e.orderBy === "ASC" ? g - b : b - g), !isNaN(e.cutLength) && e.cutLength > 0 && (S = S.slice(0, e.cutLength))), x.renderItem = renderItem;
818
+ break;
819
+ }
820
+ x.data = S;
821
+ }
822
+ r.series.push(x);
823
+ }
824
+ }
825
+ return r;
826
+ };
827
+ function getReportDefaultOption(e) {
828
+ if (e === "report")
829
+ return validateAndCompleteStatementOption(defaultReport);
830
+ {
831
+ let t = cloneDeep(defaultChart);
832
+ return t.id = `${e}-${Date.now()}`, t.type = e, t.option = chartsOption[e], t;
833
+ }
834
+ }
835
+ function getList(e) {
836
+ return axios.request({
837
+ url: "sysReport/list",
838
+ method: "post",
839
+ type: "json",
840
+ data: e
841
+ });
842
+ }
843
+ function getConfig(e) {
844
+ return axios.request({
845
+ url: "sysReport/config",
846
+ method: "post",
847
+ params: {
848
+ id: e
849
+ }
850
+ }).then((t) => {
851
+ let r = JSON.parse(t.data.info), { id: n, name: i, code: c, description: s, config: m, chartConfig: f } = r, y = [];
852
+ if (m && (m = JSON.parse(m), Array.isArray(m) && m.length)) {
853
+ if (m[0].type === "tableSheet")
854
+ throw ElMessage.error("当前报表版本不支持老版本数据,请等待老版本数据转换工具上线"), useRouter().back(), new Error("当前报表版本不支持老版本数据,请等待老版本数据转换工具上线");
855
+ m = m.map((C) => (ItemTypes.value.includes(C.type) || (C.type = "report"), C)), y = y.concat(m);
856
+ }
857
+ return f && (f = JSON.parse(f), Array.isArray(f) && (f.forEach((C) => {
858
+ C.data || (C.data = { source: [] });
859
+ }), y = y.concat(f))), Promise.resolve({
860
+ id: n,
861
+ name: i,
862
+ code: c,
863
+ description: s,
864
+ remoteOptions: y
865
+ });
866
+ });
867
+ }
868
+ function save(e) {
869
+ return axios.request({
870
+ url: "sysReport/save",
871
+ method: "post",
872
+ type: "json",
873
+ data: e
874
+ });
875
+ }
876
+ function del(e) {
877
+ return axios.request({
878
+ url: "sysReport/delete",
879
+ method: "post",
880
+ type: "form",
881
+ data: { id: e }
882
+ });
883
+ }
884
+ var commonjsGlobal = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
885
+ function getDefaultExportFromCjs(e) {
886
+ return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
887
+ }
888
+ var dayjs_min = { exports: {} };
889
+ (function(e, t) {
890
+ (function(r, n) {
891
+ e.exports = n();
892
+ })(commonjsGlobal, function() {
893
+ var r = 1e3, n = 6e4, i = 36e5, c = "millisecond", s = "second", m = "minute", f = "hour", y = "day", C = "week", x = "month", S = "quarter", g = "year", b = "date", N = "Invalid Date", P = /^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/, J = /\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g, Y = { name: "en", weekdays: "Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"), months: "January_February_March_April_May_June_July_August_September_October_November_December".split("_"), ordinal: function(u) {
894
+ var l = ["th", "st", "nd", "rd"], a = u % 100;
895
+ return "[" + u + (l[(a - 20) % 10] || l[a] || l[0]) + "]";
896
+ } }, W = function(u, l, a) {
897
+ var p = String(u);
898
+ return !p || p.length >= l ? u : "" + Array(l + 1 - p.length).join(a) + u;
899
+ }, ne = { s: W, z: function(u) {
900
+ var l = -u.utcOffset(), a = Math.abs(l), p = Math.floor(a / 60), d = a % 60;
901
+ return (l <= 0 ? "+" : "-") + W(p, 2, "0") + ":" + W(d, 2, "0");
902
+ }, m: function u(l, a) {
903
+ if (l.date() < a.date())
904
+ return -u(a, l);
905
+ var p = 12 * (a.year() - l.year()) + (a.month() - l.month()), d = l.clone().add(p, x), E = a - d < 0, o = l.clone().add(p + (E ? -1 : 1), x);
906
+ return +(-(p + (a - d) / (E ? d - o : o - d)) || 0);
907
+ }, a: function(u) {
908
+ return u < 0 ? Math.ceil(u) || 0 : Math.floor(u);
909
+ }, p: function(u) {
910
+ return { M: x, y: g, w: C, d: y, D: b, h: f, m, s, ms: c, Q: S }[u] || String(u || "").toLowerCase().replace(/s$/, "");
911
+ }, u: function(u) {
912
+ return u === void 0;
913
+ } }, Q = "en", q = {};
914
+ q[Q] = Y;
915
+ var re = "$isDayjsObject", Z = function(u) {
916
+ return u instanceof O || !(!u || !u[re]);
917
+ }, ee = function u(l, a, p) {
918
+ var d;
919
+ if (!l)
920
+ return Q;
921
+ if (typeof l == "string") {
922
+ var E = l.toLowerCase();
923
+ q[E] && (d = E), a && (q[E] = a, d = E);
924
+ var o = l.split("-");
925
+ if (!d && o.length > 1)
926
+ return u(o[0]);
927
+ } else {
928
+ var v = l.name;
929
+ q[v] = l, d = v;
930
+ }
931
+ return !p && d && (Q = d), d || !p && Q;
932
+ }, X = function(u, l) {
933
+ if (Z(u))
934
+ return u.clone();
935
+ var a = typeof l == "object" ? l : {};
936
+ return a.date = u, a.args = arguments, new O(a);
937
+ }, j = ne;
938
+ j.l = ee, j.i = Z, j.w = function(u, l) {
939
+ return X(u, { locale: l.$L, utc: l.$u, x: l.$x, $offset: l.$offset });
940
+ };
941
+ var O = function() {
942
+ function u(a) {
943
+ this.$L = ee(a.locale, null, !0), this.parse(a), this.$x = this.$x || a.x || {}, this[re] = !0;
944
+ }
945
+ var l = u.prototype;
946
+ return l.parse = function(a) {
947
+ this.$d = function(p) {
948
+ var d = p.date, E = p.utc;
949
+ if (d === null)
950
+ return /* @__PURE__ */ new Date(NaN);
951
+ if (j.u(d))
952
+ return /* @__PURE__ */ new Date();
953
+ if (d instanceof Date)
954
+ return new Date(d);
955
+ if (typeof d == "string" && !/Z$/i.test(d)) {
956
+ var o = d.match(P);
957
+ if (o) {
958
+ var v = o[2] - 1 || 0, A = (o[7] || "0").substring(0, 3);
959
+ return E ? new Date(Date.UTC(o[1], v, o[3] || 1, o[4] || 0, o[5] || 0, o[6] || 0, A)) : new Date(o[1], v, o[3] || 1, o[4] || 0, o[5] || 0, o[6] || 0, A);
960
+ }
961
+ }
962
+ return new Date(d);
963
+ }(a), this.init();
964
+ }, l.init = function() {
965
+ var a = this.$d;
966
+ this.$y = a.getFullYear(), this.$M = a.getMonth(), this.$D = a.getDate(), this.$W = a.getDay(), this.$H = a.getHours(), this.$m = a.getMinutes(), this.$s = a.getSeconds(), this.$ms = a.getMilliseconds();
967
+ }, l.$utils = function() {
968
+ return j;
969
+ }, l.isValid = function() {
970
+ return this.$d.toString() !== N;
971
+ }, l.isSame = function(a, p) {
972
+ var d = X(a);
973
+ return this.startOf(p) <= d && d <= this.endOf(p);
974
+ }, l.isAfter = function(a, p) {
975
+ return X(a) < this.startOf(p);
976
+ }, l.isBefore = function(a, p) {
977
+ return this.endOf(p) < X(a);
978
+ }, l.$g = function(a, p, d) {
979
+ return j.u(a) ? this[p] : this.set(d, a);
980
+ }, l.unix = function() {
981
+ return Math.floor(this.valueOf() / 1e3);
982
+ }, l.valueOf = function() {
983
+ return this.$d.getTime();
984
+ }, l.startOf = function(a, p) {
985
+ var d = this, E = !!j.u(p) || p, o = j.p(a), v = function(R, k) {
986
+ var $ = j.w(d.$u ? Date.UTC(d.$y, k, R) : new Date(d.$y, k, R), d);
987
+ return E ? $ : $.endOf(y);
988
+ }, A = function(R, k) {
989
+ return j.w(d.toDate()[R].apply(d.toDate("s"), (E ? [0, 0, 0, 0] : [23, 59, 59, 999]).slice(k)), d);
990
+ }, U = this.$W, F = this.$M, L = this.$D, M = "set" + (this.$u ? "UTC" : "");
991
+ switch (o) {
992
+ case g:
993
+ return E ? v(1, 0) : v(31, 11);
994
+ case x:
995
+ return E ? v(1, F) : v(0, F + 1);
996
+ case C:
997
+ var z = this.$locale().weekStart || 0, D = (U < z ? U + 7 : U) - z;
998
+ return v(E ? L - D : L + (6 - D), F);
999
+ case y:
1000
+ case b:
1001
+ return A(M + "Hours", 0);
1002
+ case f:
1003
+ return A(M + "Minutes", 1);
1004
+ case m:
1005
+ return A(M + "Seconds", 2);
1006
+ case s:
1007
+ return A(M + "Milliseconds", 3);
1008
+ default:
1009
+ return this.clone();
1010
+ }
1011
+ }, l.endOf = function(a) {
1012
+ return this.startOf(a, !1);
1013
+ }, l.$set = function(a, p) {
1014
+ var d, E = j.p(a), o = "set" + (this.$u ? "UTC" : ""), v = (d = {}, d[y] = o + "Date", d[b] = o + "Date", d[x] = o + "Month", d[g] = o + "FullYear", d[f] = o + "Hours", d[m] = o + "Minutes", d[s] = o + "Seconds", d[c] = o + "Milliseconds", d)[E], A = E === y ? this.$D + (p - this.$W) : p;
1015
+ if (E === x || E === g) {
1016
+ var U = this.clone().set(b, 1);
1017
+ U.$d[v](A), U.init(), this.$d = U.set(b, Math.min(this.$D, U.daysInMonth())).$d;
1018
+ } else
1019
+ v && this.$d[v](A);
1020
+ return this.init(), this;
1021
+ }, l.set = function(a, p) {
1022
+ return this.clone().$set(a, p);
1023
+ }, l.get = function(a) {
1024
+ return this[j.p(a)]();
1025
+ }, l.add = function(a, p) {
1026
+ var d, E = this;
1027
+ a = Number(a);
1028
+ var o = j.p(p), v = function(F) {
1029
+ var L = X(E);
1030
+ return j.w(L.date(L.date() + Math.round(F * a)), E);
1031
+ };
1032
+ if (o === x)
1033
+ return this.set(x, this.$M + a);
1034
+ if (o === g)
1035
+ return this.set(g, this.$y + a);
1036
+ if (o === y)
1037
+ return v(1);
1038
+ if (o === C)
1039
+ return v(7);
1040
+ var A = (d = {}, d[m] = n, d[f] = i, d[s] = r, d)[o] || 1, U = this.$d.getTime() + a * A;
1041
+ return j.w(U, this);
1042
+ }, l.subtract = function(a, p) {
1043
+ return this.add(-1 * a, p);
1044
+ }, l.format = function(a) {
1045
+ var p = this, d = this.$locale();
1046
+ if (!this.isValid())
1047
+ return d.invalidDate || N;
1048
+ var E = a || "YYYY-MM-DDTHH:mm:ssZ", o = j.z(this), v = this.$H, A = this.$m, U = this.$M, F = d.weekdays, L = d.months, M = d.meridiem, z = function(k, $, _, I) {
1049
+ return k && (k[$] || k(p, E)) || _[$].slice(0, I);
1050
+ }, D = function(k) {
1051
+ return j.s(v % 12 || 12, k, "0");
1052
+ }, R = M || function(k, $, _) {
1053
+ var I = k < 12 ? "AM" : "PM";
1054
+ return _ ? I.toLowerCase() : I;
1055
+ };
1056
+ return E.replace(J, function(k, $) {
1057
+ return $ || function(_) {
1058
+ switch (_) {
1059
+ case "YY":
1060
+ return String(p.$y).slice(-2);
1061
+ case "YYYY":
1062
+ return j.s(p.$y, 4, "0");
1063
+ case "M":
1064
+ return U + 1;
1065
+ case "MM":
1066
+ return j.s(U + 1, 2, "0");
1067
+ case "MMM":
1068
+ return z(d.monthsShort, U, L, 3);
1069
+ case "MMMM":
1070
+ return z(L, U);
1071
+ case "D":
1072
+ return p.$D;
1073
+ case "DD":
1074
+ return j.s(p.$D, 2, "0");
1075
+ case "d":
1076
+ return String(p.$W);
1077
+ case "dd":
1078
+ return z(d.weekdaysMin, p.$W, F, 2);
1079
+ case "ddd":
1080
+ return z(d.weekdaysShort, p.$W, F, 3);
1081
+ case "dddd":
1082
+ return F[p.$W];
1083
+ case "H":
1084
+ return String(v);
1085
+ case "HH":
1086
+ return j.s(v, 2, "0");
1087
+ case "h":
1088
+ return D(1);
1089
+ case "hh":
1090
+ return D(2);
1091
+ case "a":
1092
+ return R(v, A, !0);
1093
+ case "A":
1094
+ return R(v, A, !1);
1095
+ case "m":
1096
+ return String(A);
1097
+ case "mm":
1098
+ return j.s(A, 2, "0");
1099
+ case "s":
1100
+ return String(p.$s);
1101
+ case "ss":
1102
+ return j.s(p.$s, 2, "0");
1103
+ case "SSS":
1104
+ return j.s(p.$ms, 3, "0");
1105
+ case "Z":
1106
+ return o;
1107
+ }
1108
+ return null;
1109
+ }(k) || o.replace(":", "");
1110
+ });
1111
+ }, l.utcOffset = function() {
1112
+ return 15 * -Math.round(this.$d.getTimezoneOffset() / 15);
1113
+ }, l.diff = function(a, p, d) {
1114
+ var E, o = this, v = j.p(p), A = X(a), U = (A.utcOffset() - this.utcOffset()) * n, F = this - A, L = function() {
1115
+ return j.m(o, A);
1116
+ };
1117
+ switch (v) {
1118
+ case g:
1119
+ E = L() / 12;
1120
+ break;
1121
+ case x:
1122
+ E = L();
1123
+ break;
1124
+ case S:
1125
+ E = L() / 3;
1126
+ break;
1127
+ case C:
1128
+ E = (F - U) / 6048e5;
1129
+ break;
1130
+ case y:
1131
+ E = (F - U) / 864e5;
1132
+ break;
1133
+ case f:
1134
+ E = F / i;
1135
+ break;
1136
+ case m:
1137
+ E = F / n;
1138
+ break;
1139
+ case s:
1140
+ E = F / r;
1141
+ break;
1142
+ default:
1143
+ E = F;
1144
+ }
1145
+ return d ? E : j.a(E);
1146
+ }, l.daysInMonth = function() {
1147
+ return this.endOf(x).$D;
1148
+ }, l.$locale = function() {
1149
+ return q[this.$L];
1150
+ }, l.locale = function(a, p) {
1151
+ if (!a)
1152
+ return this.$L;
1153
+ var d = this.clone(), E = ee(a, p, !0);
1154
+ return E && (d.$L = E), d;
1155
+ }, l.clone = function() {
1156
+ return j.w(this.$d, this);
1157
+ }, l.toDate = function() {
1158
+ return new Date(this.valueOf());
1159
+ }, l.toJSON = function() {
1160
+ return this.isValid() ? this.toISOString() : null;
1161
+ }, l.toISOString = function() {
1162
+ return this.$d.toISOString();
1163
+ }, l.toString = function() {
1164
+ return this.$d.toUTCString();
1165
+ }, u;
1166
+ }(), w = O.prototype;
1167
+ return X.prototype = w, [["$ms", c], ["$s", s], ["$m", m], ["$H", f], ["$W", y], ["$M", x], ["$y", g], ["$D", b]].forEach(function(u) {
1168
+ w[u[1]] = function(l) {
1169
+ return this.$g(l, u[0], u[1]);
1170
+ };
1171
+ }), X.extend = function(u, l) {
1172
+ return u.$i || (u(l, O, X), u.$i = !0), X;
1173
+ }, X.locale = ee, X.isDayjs = Z, X.unix = function(u) {
1174
+ return X(1e3 * u);
1175
+ }, X.en = q[Q], X.Ls = q, X.p = {}, X;
1176
+ });
1177
+ })(dayjs_min);
1178
+ var dayjs_minExports = dayjs_min.exports;
1179
+ const dayjs = /* @__PURE__ */ getDefaultExportFromCjs(dayjs_minExports);
1180
+ function copyString(e) {
1181
+ if (navigator.clipboard && window.isSecureContext)
1182
+ return navigator.clipboard.writeText(e), Promise.resolve();
1183
+ {
1184
+ let t = document.createElement("textarea");
1185
+ t.value = e, t.style.position = "absolute", t.style.opacity = "0", t.style.left = "-200%", t.style.top = "-200%", document.body.appendChild(t), t.focus(), t.select();
1186
+ let r = document.execCommand("copy");
1187
+ return t.remove(), r ? Promise.resolve() : Promise.reject(new Error("copy error"));
1188
+ }
1189
+ }
1190
+ function componentTransition(e, t = "date") {
1191
+ let r = "ElInput", n = "筛选", i = "";
1192
+ switch (e) {
1193
+ case "STRING":
1194
+ r = "ElInput", n = "筛选", i = "text";
1195
+ break;
1196
+ case "LIST":
1197
+ r = "ElSelect", n = "请选择";
1198
+ break;
1199
+ case "TABLE":
1200
+ r = "ElSelect", n = "请选择";
1201
+ break;
1202
+ case "TREE":
1203
+ r = "ElTreeSelect", n = "请选择";
1204
+ break;
1205
+ case "EDITOR":
1206
+ r = "ElInput", n = "筛选", i = "textarea";
1207
+ break;
1208
+ case "BOOL":
1209
+ r = "ElSwitch", n = "请选择";
1210
+ break;
1211
+ case "LONG":
1212
+ r = "ElInputNumber", n = "筛选";
1213
+ break;
1214
+ case "PLONG":
1215
+ r = "ElInputNumber", n = "筛选";
1216
+ break;
1217
+ case "DOUBLE":
1218
+ r = "ElInputNumber", n = "筛选";
1219
+ break;
1220
+ case "DATE":
1221
+ r = "ElDatePicker", n = "请选择", i = t;
1222
+ break;
1223
+ case "DATETIME":
1224
+ r = "ElDatePicker", n = "请选择", i = t;
1225
+ break;
1226
+ case "TIME":
1227
+ r = "ElTimePicker", n = "请选择", i = "time";
1228
+ break;
1229
+ case "TEXT":
1230
+ r = "ElInput", n = "筛选", i = "text";
1231
+ break;
1232
+ case "COLOR":
1233
+ r = "ElColorPicker", n = "请选择";
1234
+ break;
1235
+ default:
1236
+ r = "ElInput", n = "筛选", i = "text";
1237
+ break;
1238
+ }
1239
+ return { componentName: r, placeholerPrefix: n, type: i };
1240
+ }
1241
+ const _hoisted_1$1 = { class: "yh-statement-view-conditions" }, _sfc_main$4 = /* @__PURE__ */ defineComponent({
1242
+ __name: "report-conditions",
1243
+ props: {
1244
+ config: null
1245
+ },
1246
+ emits: ["change"],
1247
+ setup(e, { emit: t }) {
1248
+ const r = e, n = dayjs().startOf("day").format("YYYY-MM-DD HH:mm:ss"), i = dayjs().endOf("day").format("YYYY-MM-DD HH:mm:ss"), c = dayjs().startOf("month").format("YYYY-MM-DD HH:mm:ss"), s = dayjs().endOf("month").format("YYYY-MM-DD HH:mm:ss"), m = dayjs().add(-2, "month").startOf("month").format("YYYY-MM-DD HH:mm:ss"), f = dayjs().endOf("month").format("YYYY-MM-DD HH:mm:ss"), y = dayjs().startOf("year").format("YYYY-MM-DD HH:mm:ss"), C = dayjs().endOf("year").format("YYYY-MM-DD HH:mm:ss"), x = ref([]), S = ref([]);
1249
+ watch(
1250
+ () => r.config,
1251
+ () => {
1252
+ g();
1253
+ },
1254
+ {
1255
+ immediate: !0,
1256
+ deep: !0
1257
+ }
1258
+ );
1259
+ function g() {
1260
+ let P = [];
1261
+ if (x.value = [], r.config && r.config.length) {
1262
+ for (let J = 0; J < r.config.length; J++) {
1263
+ const Y = cloneDeep(r.config[J]);
1264
+ let { dataType: W, dateType: ne, type: Q, selectorId: q, name: re, columnName: Z, defaultValue: ee, isNull: X } = Y, j = [DataSourceColumnDataType.DATE, DataSourceColumnDataType.DATETIME].includes(W);
1265
+ const { componentName: O, placeholerPrefix: w, type: u } = componentTransition(W, ne);
1266
+ Y.formItemType = O, Y.placeholder = w + re || Z, u && (Y.type = u), Y.optionData = [];
1267
+ let l = ee || "";
1268
+ if (j)
1269
+ switch (ee) {
1270
+ case "today":
1271
+ l = n;
1272
+ break;
1273
+ case "thisMonth":
1274
+ l = c;
1275
+ break;
1276
+ case "threeMonth":
1277
+ l = m;
1278
+ break;
1279
+ case "thisYear":
1280
+ l = y;
1281
+ break;
1282
+ }
1283
+ if (Y.value = l, x.value.push({
1284
+ name: Z,
1285
+ value: l,
1286
+ type: Q,
1287
+ isNull: X
1288
+ }), q && axios.request({
1289
+ url: `/windowDesign/getSelectorList?selectorId=${q}`,
1290
+ method: "POST"
1291
+ }).then((a) => {
1292
+ a.data && a.data.data && (Y.optionData = a.data.data.map(({ name: p, value: d }) => ({
1293
+ label: p,
1294
+ value: d
1295
+ })));
1296
+ }), P.push(Y), Q === "LT_GT_EQ") {
1297
+ Y.placeholder = w + "开始";
1298
+ const a = cloneDeep(Y);
1299
+ a.name = "-", a.columnName = `end_${Z}`, a.placeholder = w + "结束";
1300
+ let p = ee || "";
1301
+ if (j)
1302
+ switch (ee) {
1303
+ case "today":
1304
+ p = i;
1305
+ break;
1306
+ case "thisMonth":
1307
+ p = s;
1308
+ break;
1309
+ case "threeMonth":
1310
+ p = f;
1311
+ break;
1312
+ case "thisYear":
1313
+ p = C;
1314
+ break;
1315
+ }
1316
+ x.value.push({
1317
+ name: `end_${Z}`,
1318
+ value: p,
1319
+ type: Q,
1320
+ isNull: X
1321
+ }), q && axios.request({
1322
+ url: `/windowDesign/getSelectorList?selectorId=${q}`,
1323
+ method: "POST"
1324
+ }).then((d) => {
1325
+ d.data && d.data.data && (a.optionData = d.data.data.map(({ name: E, value: o }) => ({
1326
+ label: E,
1327
+ value: o
1328
+ })));
1329
+ }), P.push(a);
1330
+ }
1331
+ }
1332
+ r.config.map((J) => J.isNull).includes(!0) && nextTick(() => {
1333
+ t("change", x.value);
1334
+ });
1335
+ }
1336
+ S.value = P;
1337
+ }
1338
+ function b(P, J) {
1339
+ let Y = x.value.findIndex((W) => W.name === J.columnName);
1340
+ J.value = P, x.value[Y].value = P, ["ElSelect", "ElTreeSelect", "ElSwitch", "ElDatePicker", "ElTimePicker", "ElColorPicker"].includes(J.formItemType) && t("change", x.value);
1341
+ }
1342
+ function N(P) {
1343
+ ["ElInput", "ElInputNumber"].includes(P.formItemType) && t("change", x.value);
1344
+ }
1345
+ return (P, J) => (openBlock(), createElementBlock("div", _hoisted_1$1, [
1346
+ createVNode(unref(ElForm), { inline: "" }, {
1347
+ default: withCtx(() => [
1348
+ (openBlock(!0), createElementBlock(Fragment, null, renderList(S.value, (Y) => withDirectives((openBlock(), createBlock(unref(ElFormItem), {
1349
+ label: Y.name,
1350
+ style: normalizeStyle(Y.columnName.indexOf("end_") > -1 ? { marginLeft: "-22px" } : {})
1351
+ }, {
1352
+ default: withCtx(() => [
1353
+ Y.formItemType === "ElSelect" ? (openBlock(), createBlock(resolveDynamicComponent(Y.formItemType), {
1354
+ key: 0,
1355
+ "model-value": Y.value,
1356
+ type: Y.type,
1357
+ clearable: "",
1358
+ placeholder: Y.placeholder,
1359
+ "onUpdate:modelValue": (W) => b(W, Y)
1360
+ }, {
1361
+ default: withCtx(() => [
1362
+ createElementVNode("template", null, [
1363
+ (openBlock(!0), createElementBlock(Fragment, null, renderList(Y.optionData, (W) => (openBlock(), createBlock(unref(ElOption), {
1364
+ label: W.label,
1365
+ value: W.value
1366
+ }, null, 8, ["label", "value"]))), 256))
1367
+ ])
1368
+ ]),
1369
+ _: 2
1370
+ }, 1032, ["model-value", "type", "placeholder", "onUpdate:modelValue"])) : (openBlock(), createBlock(resolveDynamicComponent(Y.formItemType), {
1371
+ key: 1,
1372
+ "model-value": Y.value,
1373
+ type: Y.type,
1374
+ clearable: "",
1375
+ "value-format": "YYYY-MM-DD HH:mm:ss",
1376
+ placeholder: Y.placeholder,
1377
+ onBlur: (W) => N(Y),
1378
+ onKeyup: withKeys((W) => N(Y), ["enter"]),
1379
+ "onUpdate:modelValue": (W) => b(W, Y)
1380
+ }, null, 40, ["model-value", "type", "placeholder", "onBlur", "onKeyup", "onUpdate:modelValue"]))
1381
+ ]),
1382
+ _: 2
1383
+ }, 1032, ["label", "style"])), [
1384
+ [vShow, Y.isShow]
1385
+ ])), 256))
1386
+ ]),
1387
+ _: 1
1388
+ }),
1389
+ renderSlot(P.$slots, "search")
1390
+ ]));
1391
+ }
1392
+ }), reportConditions_vue_vue_type_style_index_0_lang = "";
1393
+ function getDateSourceList() {
1394
+ return axios.request({
1395
+ url: "/windowDesign/getDatasourceList",
1396
+ method: "POST"
1397
+ });
1398
+ }
1399
+ function getDateSourceColumns(e) {
1400
+ return axios.request({
1401
+ url: "/windowDesign/getColumns",
1402
+ method: "POST",
1403
+ data: {
1404
+ datasourceId: e
1405
+ }
1406
+ }).then((t) => t.data && t.data.data ? Promise.resolve(t.data.data) : Promise.resolve([]));
1407
+ }
1408
+ function getDateSourceData(e, t = {
1409
+ pageNumber: 1,
1410
+ pageSize: 100
1411
+ }) {
1412
+ return axios.request({
1413
+ url: `/report/data/${e}`,
1414
+ type: "json",
1415
+ method: "POST",
1416
+ data: t
1417
+ }).then((r) => {
1418
+ var n;
1419
+ return r != null && r.data && ((n = r.data) != null && n.data) ? Promise.resolve(r.data) : Promise.resolve([]);
1420
+ });
1421
+ }
1422
+ function renderCellStyle(e) {
1423
+ let t = "";
1424
+ return Object.keys(e).forEach((r) => {
1425
+ if (e[r])
1426
+ switch (r) {
1427
+ case "color":
1428
+ t += `color:${e[r]};`;
1429
+ break;
1430
+ case "backgroundColor":
1431
+ t += `background-color:${e[r]};`;
1432
+ break;
1433
+ case "fontWeight":
1434
+ t += `font-weight:${e[r]};`;
1435
+ break;
1436
+ case "fontSize":
1437
+ t += `font-size:${e[r]}px;`;
1438
+ break;
1439
+ case "textAlign":
1440
+ t += `text-align:${e[r]};`;
1441
+ break;
1442
+ case "verticalAlign":
1443
+ t += `vertical-align:${e[r]};`;
1444
+ break;
1445
+ case "fontFamily":
1446
+ t += `font-family:${e[r]};`;
1447
+ break;
1448
+ }
1449
+ }), t;
1450
+ }
1451
+ function formatNumber(e, { numberDecimal: t, numberUseGrouping: r } = {}) {
1452
+ typeof e == "string" && (e = e.replace(/,/g, "")), e = parseFloat(e), isNaN(e) && (e = 0);
1453
+ const n = t === 0 ? Math.round(e) : e.toFixed(t);
1454
+ if (r) {
1455
+ const i = n.toString().split(".");
1456
+ return i[0] = i[0].replace(/\B(?=(\d{3})+(?!\d))/g, ","), i.join(".");
1457
+ } else
1458
+ return n;
1459
+ }
1460
+ function formatCurrency(e, { numberDecimal: t, currencySymbol: r, numberUseGrouping: n } = {}) {
1461
+ if (typeof e == "string" && (e = e.replace(/,/g, "")), e = parseFloat(e), isNaN(e))
1462
+ throw new Error("Invalid number input");
1463
+ const i = t === 0 ? Math.round(e) : parseFloat(e.toFixed(t));
1464
+ let [c, s] = i.toString().split(".");
1465
+ n && (c = c.replace(/\B(?=(\d{3})+(?!\d))/g, ","));
1466
+ let m = `${r}${c}`;
1467
+ return t > 0 && (m += `.${s}`), m;
1468
+ }
1469
+ function formatPercentage(e, { numberDecimal: t } = {}, r = !1) {
1470
+ if (typeof e == "string" && (e = e.replace(/,/g, "")), e = parseFloat(e), isNaN(e))
1471
+ return e;
1472
+ const n = t === 0 ? Math.round(e) : e.toFixed(t);
1473
+ return r ? `${n}‰` : `${n}%`;
1474
+ }
1475
+ function formatScientific(e, { scientificNotation: t = "e", digits: r = 6 } = {}) {
1476
+ return typeof e == "string" && (e = e.replace(/,/g, "")), e = parseFloat(e), isNaN(e) ? e : e.toExponential(r).replace(/e/, t);
1477
+ }
1478
+ function formatDatetime(e, { date: t = "YYYY-MM-DD HH:mm:ss" } = {}) {
1479
+ if (e == null)
1480
+ return e;
1481
+ let r;
1482
+ if (typeof e == "number") {
1483
+ const n = e < 1e10 ? e * 1e3 : e;
1484
+ r = dayjs(n);
1485
+ } else if (typeof e == "string") {
1486
+ const n = Number(e);
1487
+ if (isNaN(n))
1488
+ r = dayjs(e);
1489
+ else {
1490
+ const i = n < 1e10 ? n * 1e3 : n;
1491
+ r = dayjs(i);
1492
+ }
1493
+ } else
1494
+ return e;
1495
+ return r.isValid() ? r.format(t) : e;
1496
+ }
1497
+ function formatCellValue(e, t, r) {
1498
+ switch (t) {
1499
+ case "number":
1500
+ return formatNumber(e, r);
1501
+ case "currency":
1502
+ return formatCurrency(e, r);
1503
+ case "percent":
1504
+ return formatPercentage(e, r, !1);
1505
+ case "promille":
1506
+ return formatPercentage(e, r, !0);
1507
+ case "scientific":
1508
+ return formatScientific(e, r);
1509
+ case "datetime":
1510
+ return formatDatetime(e, r);
1511
+ default:
1512
+ return e;
1513
+ }
1514
+ }
1515
+ var zhCn$1 = { exports: {} };
1516
+ (function(e, t) {
1517
+ (function(r, n) {
1518
+ e.exports = n(dayjs_minExports);
1519
+ })(commonjsGlobal, function(r) {
1520
+ function n(s) {
1521
+ return s && typeof s == "object" && "default" in s ? s : { default: s };
1522
+ }
1523
+ var i = n(r), c = { name: "zh-cn", weekdays: "星期日_星期一_星期二_星期三_星期四_星期五_星期六".split("_"), weekdaysShort: "周日_周一_周二_周三_周四_周五_周六".split("_"), weekdaysMin: "日_一_二_三_四_五_六".split("_"), months: "一月_二月_三月_四月_五月_六月_七月_八月_九月_十月_十一月_十二月".split("_"), monthsShort: "1月_2月_3月_4月_5月_6月_7月_8月_9月_10月_11月_12月".split("_"), ordinal: function(s, m) {
1524
+ return m === "W" ? s + "周" : s + "日";
1525
+ }, weekStart: 1, yearStart: 4, formats: { LT: "HH:mm", LTS: "HH:mm:ss", L: "YYYY/MM/DD", LL: "YYYY年M月D日", LLL: "YYYY年M月D日Ah点mm分", LLLL: "YYYY年M月D日ddddAh点mm分", l: "YYYY/M/D", ll: "YYYY年M月D日", lll: "YYYY年M月D日 HH:mm", llll: "YYYY年M月D日dddd HH:mm" }, relativeTime: { future: "%s内", past: "%s前", s: "几秒", m: "1 分钟", mm: "%d 分钟", h: "1 小时", hh: "%d 小时", d: "1 天", dd: "%d 天", M: "1 个月", MM: "%d 个月", y: "1 年", yy: "%d 年" }, meridiem: function(s, m) {
1526
+ var f = 100 * s + m;
1527
+ return f < 600 ? "凌晨" : f < 900 ? "早上" : f < 1100 ? "上午" : f < 1300 ? "中午" : f < 1800 ? "下午" : "晚上";
1528
+ } };
1529
+ return i.default.locale(c, null, !0), c;
1530
+ });
1531
+ })(zhCn$1);
1532
+ var zhCnExports = zhCn$1.exports;
1533
+ const zhCn = /* @__PURE__ */ getDefaultExportFromCjs(zhCnExports);
1534
+ dayjs.locale(zhCn);
1535
+ async function getProcessData(processData, data, params) {
1536
+ try {
1537
+ const fun = function(axios, dayjs) {
1538
+ return eval(
1539
+ `async (allData, params) => {
1540
+ ${processData}
1541
+ }`
1542
+ );
1543
+ }(axios, dayjs);
1544
+ return await fun.call(this, data, params);
1545
+ } catch (e) {
1546
+ return console.error(e), data;
1547
+ }
1548
+ }
1549
+ class Hooks {
1550
+ /**
1551
+ * @callback HookCallback
1552
+ * @this {*|Jsep} this
1553
+ * @param {Jsep} env
1554
+ * @returns: void
1555
+ */
1556
+ /**
1557
+ * Adds the given callback to the list of callbacks for the given hook.
1558
+ *
1559
+ * The callback will be invoked when the hook it is registered for is run.
1560
+ *
1561
+ * One callback function can be registered to multiple hooks and the same hook multiple times.
1562
+ *
1563
+ * @param {string|object} name The name of the hook, or an object of callbacks keyed by name
1564
+ * @param {HookCallback|boolean} callback The callback function which is given environment variables.
1565
+ * @param {?boolean} [first=false] Will add the hook to the top of the list (defaults to the bottom)
1566
+ * @public
1567
+ */
1568
+ add(t, r, n) {
1569
+ if (typeof arguments[0] != "string")
1570
+ for (let i in arguments[0])
1571
+ this.add(i, arguments[0][i], arguments[1]);
1572
+ else
1573
+ (Array.isArray(t) ? t : [t]).forEach(function(i) {
1574
+ this[i] = this[i] || [], r && this[i][n ? "unshift" : "push"](r);
1575
+ }, this);
1576
+ }
1577
+ /**
1578
+ * Runs a hook invoking all registered callbacks with the given environment variables.
1579
+ *
1580
+ * Callbacks will be invoked synchronously and in the order in which they were registered.
1581
+ *
1582
+ * @param {string} name The name of the hook.
1583
+ * @param {Object<string, any>} env The environment variables of the hook passed to all callbacks registered.
1584
+ * @public
1585
+ */
1586
+ run(t, r) {
1587
+ this[t] = this[t] || [], this[t].forEach(function(n) {
1588
+ n.call(r && r.context ? r.context : r, r);
1589
+ });
1590
+ }
1591
+ }
1592
+ class Plugins {
1593
+ constructor(t) {
1594
+ this.jsep = t, this.registered = {};
1595
+ }
1596
+ /**
1597
+ * @callback PluginSetup
1598
+ * @this {Jsep} jsep
1599
+ * @returns: void
1600
+ */
1601
+ /**
1602
+ * Adds the given plugin(s) to the registry
1603
+ *
1604
+ * @param {object} plugins
1605
+ * @param {string} plugins.name The name of the plugin
1606
+ * @param {PluginSetup} plugins.init The init function
1607
+ * @public
1608
+ */
1609
+ register(...t) {
1610
+ t.forEach((r) => {
1611
+ if (typeof r != "object" || !r.name || !r.init)
1612
+ throw new Error("Invalid JSEP plugin format");
1613
+ this.registered[r.name] || (r.init(this.jsep), this.registered[r.name] = r);
1614
+ });
1615
+ }
1616
+ }
1617
+ class Jsep {
1618
+ /**
1619
+ * @returns {string}
1620
+ */
1621
+ static get version() {
1622
+ return "1.4.0";
1623
+ }
1624
+ /**
1625
+ * @returns {string}
1626
+ */
1627
+ static toString() {
1628
+ return "JavaScript Expression Parser (JSEP) v" + Jsep.version;
1629
+ }
1630
+ // ==================== CONFIG ================================
1631
+ /**
1632
+ * @method addUnaryOp
1633
+ * @param {string} op_name The name of the unary op to add
1634
+ * @returns {Jsep}
1635
+ */
1636
+ static addUnaryOp(t) {
1637
+ return Jsep.max_unop_len = Math.max(t.length, Jsep.max_unop_len), Jsep.unary_ops[t] = 1, Jsep;
1638
+ }
1639
+ /**
1640
+ * @method jsep.addBinaryOp
1641
+ * @param {string} op_name The name of the binary op to add
1642
+ * @param {number} precedence The precedence of the binary op (can be a float). Higher number = higher precedence
1643
+ * @param {boolean} [isRightAssociative=false] whether operator is right-associative
1644
+ * @returns {Jsep}
1645
+ */
1646
+ static addBinaryOp(t, r, n) {
1647
+ return Jsep.max_binop_len = Math.max(t.length, Jsep.max_binop_len), Jsep.binary_ops[t] = r, n ? Jsep.right_associative.add(t) : Jsep.right_associative.delete(t), Jsep;
1648
+ }
1649
+ /**
1650
+ * @method addIdentifierChar
1651
+ * @param {string} char The additional character to treat as a valid part of an identifier
1652
+ * @returns {Jsep}
1653
+ */
1654
+ static addIdentifierChar(t) {
1655
+ return Jsep.additional_identifier_chars.add(t), Jsep;
1656
+ }
1657
+ /**
1658
+ * @method addLiteral
1659
+ * @param {string} literal_name The name of the literal to add
1660
+ * @param {*} literal_value The value of the literal
1661
+ * @returns {Jsep}
1662
+ */
1663
+ static addLiteral(t, r) {
1664
+ return Jsep.literals[t] = r, Jsep;
1665
+ }
1666
+ /**
1667
+ * @method removeUnaryOp
1668
+ * @param {string} op_name The name of the unary op to remove
1669
+ * @returns {Jsep}
1670
+ */
1671
+ static removeUnaryOp(t) {
1672
+ return delete Jsep.unary_ops[t], t.length === Jsep.max_unop_len && (Jsep.max_unop_len = Jsep.getMaxKeyLen(Jsep.unary_ops)), Jsep;
1673
+ }
1674
+ /**
1675
+ * @method removeAllUnaryOps
1676
+ * @returns {Jsep}
1677
+ */
1678
+ static removeAllUnaryOps() {
1679
+ return Jsep.unary_ops = {}, Jsep.max_unop_len = 0, Jsep;
1680
+ }
1681
+ /**
1682
+ * @method removeIdentifierChar
1683
+ * @param {string} char The additional character to stop treating as a valid part of an identifier
1684
+ * @returns {Jsep}
1685
+ */
1686
+ static removeIdentifierChar(t) {
1687
+ return Jsep.additional_identifier_chars.delete(t), Jsep;
1688
+ }
1689
+ /**
1690
+ * @method removeBinaryOp
1691
+ * @param {string} op_name The name of the binary op to remove
1692
+ * @returns {Jsep}
1693
+ */
1694
+ static removeBinaryOp(t) {
1695
+ return delete Jsep.binary_ops[t], t.length === Jsep.max_binop_len && (Jsep.max_binop_len = Jsep.getMaxKeyLen(Jsep.binary_ops)), Jsep.right_associative.delete(t), Jsep;
1696
+ }
1697
+ /**
1698
+ * @method removeAllBinaryOps
1699
+ * @returns {Jsep}
1700
+ */
1701
+ static removeAllBinaryOps() {
1702
+ return Jsep.binary_ops = {}, Jsep.max_binop_len = 0, Jsep;
1703
+ }
1704
+ /**
1705
+ * @method removeLiteral
1706
+ * @param {string} literal_name The name of the literal to remove
1707
+ * @returns {Jsep}
1708
+ */
1709
+ static removeLiteral(t) {
1710
+ return delete Jsep.literals[t], Jsep;
1711
+ }
1712
+ /**
1713
+ * @method removeAllLiterals
1714
+ * @returns {Jsep}
1715
+ */
1716
+ static removeAllLiterals() {
1717
+ return Jsep.literals = {}, Jsep;
1718
+ }
1719
+ // ==================== END CONFIG ============================
1720
+ /**
1721
+ * @returns {string}
1722
+ */
1723
+ get char() {
1724
+ return this.expr.charAt(this.index);
1725
+ }
1726
+ /**
1727
+ * @returns {number}
1728
+ */
1729
+ get code() {
1730
+ return this.expr.charCodeAt(this.index);
1731
+ }
1732
+ /**
1733
+ * @param {string} expr a string with the passed in express
1734
+ * @returns Jsep
1735
+ */
1736
+ constructor(t) {
1737
+ this.expr = t, this.index = 0;
1738
+ }
1739
+ /**
1740
+ * static top-level parser
1741
+ * @returns {jsep.Expression}
1742
+ */
1743
+ static parse(t) {
1744
+ return new Jsep(t).parse();
1745
+ }
1746
+ /**
1747
+ * Get the longest key length of any object
1748
+ * @param {object} obj
1749
+ * @returns {number}
1750
+ */
1751
+ static getMaxKeyLen(t) {
1752
+ return Math.max(0, ...Object.keys(t).map((r) => r.length));
1753
+ }
1754
+ /**
1755
+ * `ch` is a character code in the next three functions
1756
+ * @param {number} ch
1757
+ * @returns {boolean}
1758
+ */
1759
+ static isDecimalDigit(t) {
1760
+ return t >= 48 && t <= 57;
1761
+ }
1762
+ /**
1763
+ * Returns the precedence of a binary operator or `0` if it isn't a binary operator. Can be float.
1764
+ * @param {string} op_val
1765
+ * @returns {number}
1766
+ */
1767
+ static binaryPrecedence(t) {
1768
+ return Jsep.binary_ops[t] || 0;
1769
+ }
1770
+ /**
1771
+ * Looks for start of identifier
1772
+ * @param {number} ch
1773
+ * @returns {boolean}
1774
+ */
1775
+ static isIdentifierStart(t) {
1776
+ return t >= 65 && t <= 90 || // A...Z
1777
+ t >= 97 && t <= 122 || // a...z
1778
+ t >= 128 && !Jsep.binary_ops[String.fromCharCode(t)] || // any non-ASCII that is not an operator
1779
+ Jsep.additional_identifier_chars.has(String.fromCharCode(t));
1780
+ }
1781
+ /**
1782
+ * @param {number} ch
1783
+ * @returns {boolean}
1784
+ */
1785
+ static isIdentifierPart(t) {
1786
+ return Jsep.isIdentifierStart(t) || Jsep.isDecimalDigit(t);
1787
+ }
1788
+ /**
1789
+ * throw error at index of the expression
1790
+ * @param {string} message
1791
+ * @throws
1792
+ */
1793
+ throwError(t) {
1794
+ const r = new Error(t + " at character " + this.index);
1795
+ throw r.index = this.index, r.description = t, r;
1796
+ }
1797
+ /**
1798
+ * Run a given hook
1799
+ * @param {string} name
1800
+ * @param {jsep.Expression|false} [node]
1801
+ * @returns {?jsep.Expression}
1802
+ */
1803
+ runHook(t, r) {
1804
+ if (Jsep.hooks[t]) {
1805
+ const n = { context: this, node: r };
1806
+ return Jsep.hooks.run(t, n), n.node;
1807
+ }
1808
+ return r;
1809
+ }
1810
+ /**
1811
+ * Runs a given hook until one returns a node
1812
+ * @param {string} name
1813
+ * @returns {?jsep.Expression}
1814
+ */
1815
+ searchHook(t) {
1816
+ if (Jsep.hooks[t]) {
1817
+ const r = { context: this };
1818
+ return Jsep.hooks[t].find(function(n) {
1819
+ return n.call(r.context, r), r.node;
1820
+ }), r.node;
1821
+ }
1822
+ }
1823
+ /**
1824
+ * Push `index` up to the next non-space character
1825
+ */
1826
+ gobbleSpaces() {
1827
+ let t = this.code;
1828
+ for (; t === Jsep.SPACE_CODE || t === Jsep.TAB_CODE || t === Jsep.LF_CODE || t === Jsep.CR_CODE; )
1829
+ t = this.expr.charCodeAt(++this.index);
1830
+ this.runHook("gobble-spaces");
1831
+ }
1832
+ /**
1833
+ * Top-level method to parse all expressions and returns compound or single node
1834
+ * @returns {jsep.Expression}
1835
+ */
1836
+ parse() {
1837
+ this.runHook("before-all");
1838
+ const t = this.gobbleExpressions(), r = t.length === 1 ? t[0] : {
1839
+ type: Jsep.COMPOUND,
1840
+ body: t
1841
+ };
1842
+ return this.runHook("after-all", r);
1843
+ }
1844
+ /**
1845
+ * top-level parser (but can be reused within as well)
1846
+ * @param {number} [untilICode]
1847
+ * @returns {jsep.Expression[]}
1848
+ */
1849
+ gobbleExpressions(t) {
1850
+ let r = [], n, i;
1851
+ for (; this.index < this.expr.length; )
1852
+ if (n = this.code, n === Jsep.SEMCOL_CODE || n === Jsep.COMMA_CODE)
1853
+ this.index++;
1854
+ else if (i = this.gobbleExpression())
1855
+ r.push(i);
1856
+ else if (this.index < this.expr.length) {
1857
+ if (n === t)
1858
+ break;
1859
+ this.throwError('Unexpected "' + this.char + '"');
1860
+ }
1861
+ return r;
1862
+ }
1863
+ /**
1864
+ * The main parsing function.
1865
+ * @returns {?jsep.Expression}
1866
+ */
1867
+ gobbleExpression() {
1868
+ const t = this.searchHook("gobble-expression") || this.gobbleBinaryExpression();
1869
+ return this.gobbleSpaces(), this.runHook("after-expression", t);
1870
+ }
1871
+ /**
1872
+ * Search for the operation portion of the string (e.g. `+`, `===`)
1873
+ * Start by taking the longest possible binary operations (3 characters: `===`, `!==`, `>>>`)
1874
+ * and move down from 3 to 2 to 1 character until a matching binary operation is found
1875
+ * then, return that binary operation
1876
+ * @returns {string|boolean}
1877
+ */
1878
+ gobbleBinaryOp() {
1879
+ this.gobbleSpaces();
1880
+ let t = this.expr.substr(this.index, Jsep.max_binop_len), r = t.length;
1881
+ for (; r > 0; ) {
1882
+ if (Jsep.binary_ops.hasOwnProperty(t) && (!Jsep.isIdentifierStart(this.code) || this.index + t.length < this.expr.length && !Jsep.isIdentifierPart(this.expr.charCodeAt(this.index + t.length))))
1883
+ return this.index += r, t;
1884
+ t = t.substr(0, --r);
1885
+ }
1886
+ return !1;
1887
+ }
1888
+ /**
1889
+ * This function is responsible for gobbling an individual expression,
1890
+ * e.g. `1`, `1+2`, `a+(b*2)-Math.sqrt(2)`
1891
+ * @returns {?jsep.BinaryExpression}
1892
+ */
1893
+ gobbleBinaryExpression() {
1894
+ let t, r, n, i, c, s, m, f, y;
1895
+ if (s = this.gobbleToken(), !s || (r = this.gobbleBinaryOp(), !r))
1896
+ return s;
1897
+ for (c = { value: r, prec: Jsep.binaryPrecedence(r), right_a: Jsep.right_associative.has(r) }, m = this.gobbleToken(), m || this.throwError("Expected expression after " + r), i = [s, c, m]; r = this.gobbleBinaryOp(); ) {
1898
+ if (n = Jsep.binaryPrecedence(r), n === 0) {
1899
+ this.index -= r.length;
1900
+ break;
1901
+ }
1902
+ c = { value: r, prec: n, right_a: Jsep.right_associative.has(r) }, y = r;
1903
+ const C = (x) => c.right_a && x.right_a ? n > x.prec : n <= x.prec;
1904
+ for (; i.length > 2 && C(i[i.length - 2]); )
1905
+ m = i.pop(), r = i.pop().value, s = i.pop(), t = {
1906
+ type: Jsep.BINARY_EXP,
1907
+ operator: r,
1908
+ left: s,
1909
+ right: m
1910
+ }, i.push(t);
1911
+ t = this.gobbleToken(), t || this.throwError("Expected expression after " + y), i.push(c, t);
1912
+ }
1913
+ for (f = i.length - 1, t = i[f]; f > 1; )
1914
+ t = {
1915
+ type: Jsep.BINARY_EXP,
1916
+ operator: i[f - 1].value,
1917
+ left: i[f - 2],
1918
+ right: t
1919
+ }, f -= 2;
1920
+ return t;
1921
+ }
1922
+ /**
1923
+ * An individual part of a binary expression:
1924
+ * e.g. `foo.bar(baz)`, `1`, `"abc"`, `(a % 2)` (because it's in parenthesis)
1925
+ * @returns {boolean|jsep.Expression}
1926
+ */
1927
+ gobbleToken() {
1928
+ let t, r, n, i;
1929
+ if (this.gobbleSpaces(), i = this.searchHook("gobble-token"), i)
1930
+ return this.runHook("after-token", i);
1931
+ if (t = this.code, Jsep.isDecimalDigit(t) || t === Jsep.PERIOD_CODE)
1932
+ return this.gobbleNumericLiteral();
1933
+ if (t === Jsep.SQUOTE_CODE || t === Jsep.DQUOTE_CODE)
1934
+ i = this.gobbleStringLiteral();
1935
+ else if (t === Jsep.OBRACK_CODE)
1936
+ i = this.gobbleArray();
1937
+ else {
1938
+ for (r = this.expr.substr(this.index, Jsep.max_unop_len), n = r.length; n > 0; ) {
1939
+ if (Jsep.unary_ops.hasOwnProperty(r) && (!Jsep.isIdentifierStart(this.code) || this.index + r.length < this.expr.length && !Jsep.isIdentifierPart(this.expr.charCodeAt(this.index + r.length)))) {
1940
+ this.index += n;
1941
+ const c = this.gobbleToken();
1942
+ return c || this.throwError("missing unaryOp argument"), this.runHook("after-token", {
1943
+ type: Jsep.UNARY_EXP,
1944
+ operator: r,
1945
+ argument: c,
1946
+ prefix: !0
1947
+ });
1948
+ }
1949
+ r = r.substr(0, --n);
1950
+ }
1951
+ Jsep.isIdentifierStart(t) ? (i = this.gobbleIdentifier(), Jsep.literals.hasOwnProperty(i.name) ? i = {
1952
+ type: Jsep.LITERAL,
1953
+ value: Jsep.literals[i.name],
1954
+ raw: i.name
1955
+ } : i.name === Jsep.this_str && (i = { type: Jsep.THIS_EXP })) : t === Jsep.OPAREN_CODE && (i = this.gobbleGroup());
1956
+ }
1957
+ return i ? (i = this.gobbleTokenProperty(i), this.runHook("after-token", i)) : this.runHook("after-token", !1);
1958
+ }
1959
+ /**
1960
+ * Gobble properties of of identifiers/strings/arrays/groups.
1961
+ * e.g. `foo`, `bar.baz`, `foo['bar'].baz`
1962
+ * It also gobbles function calls:
1963
+ * e.g. `Math.acos(obj.angle)`
1964
+ * @param {jsep.Expression} node
1965
+ * @returns {jsep.Expression}
1966
+ */
1967
+ gobbleTokenProperty(t) {
1968
+ this.gobbleSpaces();
1969
+ let r = this.code;
1970
+ for (; r === Jsep.PERIOD_CODE || r === Jsep.OBRACK_CODE || r === Jsep.OPAREN_CODE || r === Jsep.QUMARK_CODE; ) {
1971
+ let n;
1972
+ if (r === Jsep.QUMARK_CODE) {
1973
+ if (this.expr.charCodeAt(this.index + 1) !== Jsep.PERIOD_CODE)
1974
+ break;
1975
+ n = !0, this.index += 2, this.gobbleSpaces(), r = this.code;
1976
+ }
1977
+ this.index++, r === Jsep.OBRACK_CODE ? (t = {
1978
+ type: Jsep.MEMBER_EXP,
1979
+ computed: !0,
1980
+ object: t,
1981
+ property: this.gobbleExpression()
1982
+ }, t.property || this.throwError('Unexpected "' + this.char + '"'), this.gobbleSpaces(), r = this.code, r !== Jsep.CBRACK_CODE && this.throwError("Unclosed ["), this.index++) : r === Jsep.OPAREN_CODE ? t = {
1983
+ type: Jsep.CALL_EXP,
1984
+ arguments: this.gobbleArguments(Jsep.CPAREN_CODE),
1985
+ callee: t
1986
+ } : (r === Jsep.PERIOD_CODE || n) && (n && this.index--, this.gobbleSpaces(), t = {
1987
+ type: Jsep.MEMBER_EXP,
1988
+ computed: !1,
1989
+ object: t,
1990
+ property: this.gobbleIdentifier()
1991
+ }), n && (t.optional = !0), this.gobbleSpaces(), r = this.code;
1992
+ }
1993
+ return t;
1994
+ }
1995
+ /**
1996
+ * Parse simple numeric literals: `12`, `3.4`, `.5`. Do this by using a string to
1997
+ * keep track of everything in the numeric literal and then calling `parseFloat` on that string
1998
+ * @returns {jsep.Literal}
1999
+ */
2000
+ gobbleNumericLiteral() {
2001
+ let t = "", r, n;
2002
+ for (; Jsep.isDecimalDigit(this.code); )
2003
+ t += this.expr.charAt(this.index++);
2004
+ if (this.code === Jsep.PERIOD_CODE)
2005
+ for (t += this.expr.charAt(this.index++); Jsep.isDecimalDigit(this.code); )
2006
+ t += this.expr.charAt(this.index++);
2007
+ if (r = this.char, r === "e" || r === "E") {
2008
+ for (t += this.expr.charAt(this.index++), r = this.char, (r === "+" || r === "-") && (t += this.expr.charAt(this.index++)); Jsep.isDecimalDigit(this.code); )
2009
+ t += this.expr.charAt(this.index++);
2010
+ Jsep.isDecimalDigit(this.expr.charCodeAt(this.index - 1)) || this.throwError("Expected exponent (" + t + this.char + ")");
2011
+ }
2012
+ return n = this.code, Jsep.isIdentifierStart(n) ? this.throwError("Variable names cannot start with a number (" + t + this.char + ")") : (n === Jsep.PERIOD_CODE || t.length === 1 && t.charCodeAt(0) === Jsep.PERIOD_CODE) && this.throwError("Unexpected period"), {
2013
+ type: Jsep.LITERAL,
2014
+ value: parseFloat(t),
2015
+ raw: t
2016
+ };
2017
+ }
2018
+ /**
2019
+ * Parses a string literal, staring with single or double quotes with basic support for escape codes
2020
+ * e.g. `"hello world"`, `'this is\nJSEP'`
2021
+ * @returns {jsep.Literal}
2022
+ */
2023
+ gobbleStringLiteral() {
2024
+ let t = "";
2025
+ const r = this.index, n = this.expr.charAt(this.index++);
2026
+ let i = !1;
2027
+ for (; this.index < this.expr.length; ) {
2028
+ let c = this.expr.charAt(this.index++);
2029
+ if (c === n) {
2030
+ i = !0;
2031
+ break;
2032
+ } else if (c === "\\")
2033
+ switch (c = this.expr.charAt(this.index++), c) {
2034
+ case "n":
2035
+ t += `
2036
+ `;
2037
+ break;
2038
+ case "r":
2039
+ t += "\r";
2040
+ break;
2041
+ case "t":
2042
+ t += " ";
2043
+ break;
2044
+ case "b":
2045
+ t += "\b";
2046
+ break;
2047
+ case "f":
2048
+ t += "\f";
2049
+ break;
2050
+ case "v":
2051
+ t += "\v";
2052
+ break;
2053
+ default:
2054
+ t += c;
2055
+ }
2056
+ else
2057
+ t += c;
2058
+ }
2059
+ return i || this.throwError('Unclosed quote after "' + t + '"'), {
2060
+ type: Jsep.LITERAL,
2061
+ value: t,
2062
+ raw: this.expr.substring(r, this.index)
2063
+ };
2064
+ }
2065
+ /**
2066
+ * Gobbles only identifiers
2067
+ * e.g.: `foo`, `_value`, `$x1`
2068
+ * Also, this function checks if that identifier is a literal:
2069
+ * (e.g. `true`, `false`, `null`) or `this`
2070
+ * @returns {jsep.Identifier}
2071
+ */
2072
+ gobbleIdentifier() {
2073
+ let t = this.code, r = this.index;
2074
+ for (Jsep.isIdentifierStart(t) ? this.index++ : this.throwError("Unexpected " + this.char); this.index < this.expr.length && (t = this.code, Jsep.isIdentifierPart(t)); )
2075
+ this.index++;
2076
+ return {
2077
+ type: Jsep.IDENTIFIER,
2078
+ name: this.expr.slice(r, this.index)
2079
+ };
2080
+ }
2081
+ /**
2082
+ * Gobbles a list of arguments within the context of a function call
2083
+ * or array literal. This function also assumes that the opening character
2084
+ * `(` or `[` has already been gobbled, and gobbles expressions and commas
2085
+ * until the terminator character `)` or `]` is encountered.
2086
+ * e.g. `foo(bar, baz)`, `my_func()`, or `[bar, baz]`
2087
+ * @param {number} termination
2088
+ * @returns {jsep.Expression[]}
2089
+ */
2090
+ gobbleArguments(t) {
2091
+ const r = [];
2092
+ let n = !1, i = 0;
2093
+ for (; this.index < this.expr.length; ) {
2094
+ this.gobbleSpaces();
2095
+ let c = this.code;
2096
+ if (c === t) {
2097
+ n = !0, this.index++, t === Jsep.CPAREN_CODE && i && i >= r.length && this.throwError("Unexpected token " + String.fromCharCode(t));
2098
+ break;
2099
+ } else if (c === Jsep.COMMA_CODE) {
2100
+ if (this.index++, i++, i !== r.length) {
2101
+ if (t === Jsep.CPAREN_CODE)
2102
+ this.throwError("Unexpected token ,");
2103
+ else if (t === Jsep.CBRACK_CODE)
2104
+ for (let s = r.length; s < i; s++)
2105
+ r.push(null);
2106
+ }
2107
+ } else if (r.length !== i && i !== 0)
2108
+ this.throwError("Expected comma");
2109
+ else {
2110
+ const s = this.gobbleExpression();
2111
+ (!s || s.type === Jsep.COMPOUND) && this.throwError("Expected comma"), r.push(s);
2112
+ }
2113
+ }
2114
+ return n || this.throwError("Expected " + String.fromCharCode(t)), r;
2115
+ }
2116
+ /**
2117
+ * Responsible for parsing a group of things within parentheses `()`
2118
+ * that have no identifier in front (so not a function call)
2119
+ * This function assumes that it needs to gobble the opening parenthesis
2120
+ * and then tries to gobble everything within that parenthesis, assuming
2121
+ * that the next thing it should see is the close parenthesis. If not,
2122
+ * then the expression probably doesn't have a `)`
2123
+ * @returns {boolean|jsep.Expression}
2124
+ */
2125
+ gobbleGroup() {
2126
+ this.index++;
2127
+ let t = this.gobbleExpressions(Jsep.CPAREN_CODE);
2128
+ if (this.code === Jsep.CPAREN_CODE)
2129
+ return this.index++, t.length === 1 ? t[0] : t.length ? {
2130
+ type: Jsep.SEQUENCE_EXP,
2131
+ expressions: t
2132
+ } : !1;
2133
+ this.throwError("Unclosed (");
2134
+ }
2135
+ /**
2136
+ * Responsible for parsing Array literals `[1, 2, 3]`
2137
+ * This function assumes that it needs to gobble the opening bracket
2138
+ * and then tries to gobble the expressions as arguments.
2139
+ * @returns {jsep.ArrayExpression}
2140
+ */
2141
+ gobbleArray() {
2142
+ return this.index++, {
2143
+ type: Jsep.ARRAY_EXP,
2144
+ elements: this.gobbleArguments(Jsep.CBRACK_CODE)
2145
+ };
2146
+ }
2147
+ }
2148
+ const hooks = new Hooks();
2149
+ Object.assign(Jsep, {
2150
+ hooks,
2151
+ plugins: new Plugins(Jsep),
2152
+ // Node Types
2153
+ // ----------
2154
+ // This is the full set of types that any JSEP node can be.
2155
+ // Store them here to save space when minified
2156
+ COMPOUND: "Compound",
2157
+ SEQUENCE_EXP: "SequenceExpression",
2158
+ IDENTIFIER: "Identifier",
2159
+ MEMBER_EXP: "MemberExpression",
2160
+ LITERAL: "Literal",
2161
+ THIS_EXP: "ThisExpression",
2162
+ CALL_EXP: "CallExpression",
2163
+ UNARY_EXP: "UnaryExpression",
2164
+ BINARY_EXP: "BinaryExpression",
2165
+ ARRAY_EXP: "ArrayExpression",
2166
+ TAB_CODE: 9,
2167
+ LF_CODE: 10,
2168
+ CR_CODE: 13,
2169
+ SPACE_CODE: 32,
2170
+ PERIOD_CODE: 46,
2171
+ // '.'
2172
+ COMMA_CODE: 44,
2173
+ // ','
2174
+ SQUOTE_CODE: 39,
2175
+ // single quote
2176
+ DQUOTE_CODE: 34,
2177
+ // double quotes
2178
+ OPAREN_CODE: 40,
2179
+ // (
2180
+ CPAREN_CODE: 41,
2181
+ // )
2182
+ OBRACK_CODE: 91,
2183
+ // [
2184
+ CBRACK_CODE: 93,
2185
+ // ]
2186
+ QUMARK_CODE: 63,
2187
+ // ?
2188
+ SEMCOL_CODE: 59,
2189
+ // ;
2190
+ COLON_CODE: 58,
2191
+ // :
2192
+ // Operations
2193
+ // ----------
2194
+ // Use a quickly-accessible map to store all of the unary operators
2195
+ // Values are set to `1` (it really doesn't matter)
2196
+ unary_ops: {
2197
+ "-": 1,
2198
+ "!": 1,
2199
+ "~": 1,
2200
+ "+": 1
2201
+ },
2202
+ // Also use a map for the binary operations but set their values to their
2203
+ // binary precedence for quick reference (higher number = higher precedence)
2204
+ // see [Order of operations](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Operator_Precedence)
2205
+ binary_ops: {
2206
+ "||": 1,
2207
+ "??": 1,
2208
+ "&&": 2,
2209
+ "|": 3,
2210
+ "^": 4,
2211
+ "&": 5,
2212
+ "==": 6,
2213
+ "!=": 6,
2214
+ "===": 6,
2215
+ "!==": 6,
2216
+ "<": 7,
2217
+ ">": 7,
2218
+ "<=": 7,
2219
+ ">=": 7,
2220
+ "<<": 8,
2221
+ ">>": 8,
2222
+ ">>>": 8,
2223
+ "+": 9,
2224
+ "-": 9,
2225
+ "*": 10,
2226
+ "/": 10,
2227
+ "%": 10,
2228
+ "**": 11
2229
+ },
2230
+ // sets specific binary_ops as right-associative
2231
+ right_associative: /* @__PURE__ */ new Set(["**"]),
2232
+ // Additional valid identifier chars, apart from a-z, A-Z and 0-9 (except on the starting char)
2233
+ additional_identifier_chars: /* @__PURE__ */ new Set(["$", "_"]),
2234
+ // Literals
2235
+ // ----------
2236
+ // Store the values to return for the various literals we may encounter
2237
+ literals: {
2238
+ true: !0,
2239
+ false: !1,
2240
+ null: null
2241
+ },
2242
+ // Except for `this`, which is special. This could be changed to something like `'self'` as well
2243
+ this_str: "this"
2244
+ });
2245
+ Jsep.max_unop_len = Jsep.getMaxKeyLen(Jsep.unary_ops);
2246
+ Jsep.max_binop_len = Jsep.getMaxKeyLen(Jsep.binary_ops);
2247
+ const jsep = (e) => new Jsep(e).parse(), stdClassProps = Object.getOwnPropertyNames(class {
2248
+ });
2249
+ Object.getOwnPropertyNames(Jsep).filter((e) => !stdClassProps.includes(e) && jsep[e] === void 0).forEach((e) => {
2250
+ jsep[e] = Jsep[e];
2251
+ });
2252
+ jsep.Jsep = Jsep;
2253
+ const CONDITIONAL_EXP = "ConditionalExpression";
2254
+ var ternary = {
2255
+ name: "ternary",
2256
+ init(e) {
2257
+ e.hooks.add("after-expression", function(r) {
2258
+ if (r.node && this.code === e.QUMARK_CODE) {
2259
+ this.index++;
2260
+ const n = r.node, i = this.gobbleExpression();
2261
+ if (i || this.throwError("Expected expression"), this.gobbleSpaces(), this.code === e.COLON_CODE) {
2262
+ this.index++;
2263
+ const c = this.gobbleExpression();
2264
+ if (c || this.throwError("Expected expression"), r.node = {
2265
+ type: CONDITIONAL_EXP,
2266
+ test: n,
2267
+ consequent: i,
2268
+ alternate: c
2269
+ }, n.operator && e.binary_ops[n.operator] <= 0.9) {
2270
+ let s = n;
2271
+ for (; s.right.operator && e.binary_ops[s.right.operator] <= 0.9; )
2272
+ s = s.right;
2273
+ r.node.test = s.right, s.right = r.node, r.node = n;
2274
+ }
2275
+ } else
2276
+ this.throwError("Expected :");
2277
+ }
2278
+ });
2279
+ }
2280
+ };
2281
+ jsep.plugins.register(ternary);
2282
+ jsep.addBinaryOp("=", 0, (e, t) => e === t);
2283
+ jsep.addBinaryOp("<>", 0, (e, t) => e !== t);
2284
+ jsep.addBinaryOp(">", 0, (e, t) => e > t);
2285
+ jsep.addBinaryOp("<", 0, (e, t) => e < t);
2286
+ jsep.addBinaryOp(">=", 0, (e, t) => e >= t);
2287
+ jsep.addBinaryOp("<=", 0, (e, t) => e <= t);
2288
+ let innerConfig = {}, needComputedCell = /* @__PURE__ */ new Map();
2289
+ function changeConfig(config) {
2290
+ config.flat().forEach((cell) => {
2291
+ let key = `${cell.row}:${cell.col}`;
2292
+ if (cell.type === CellType.FUN && needComputedCell.set(key, cell), cell.colSpan !== 0 && cell.rowSpan !== 0) {
2293
+ if (cell.type === CellType.FIELD && cell.format === FormatType.STRING && cell.fun && (cell.colData || cell.rowData)) {
2294
+ let e = {
2295
+ ...cell.colData,
2296
+ ...cell.rowData
2297
+ };
2298
+ cell.text = cell.fun.replace(/\$\{([a-zA-Z0-9\_\-]+)\}/g, (t, r) => (r = r.toUpperCase(), e[r] ?? t));
2299
+ }
2300
+ if (cell.format && (cell.text = formatCellValue(cell.text || "", cell.format, cell.formatType)), cell.customRender) {
2301
+ let data = {
2302
+ ...cell.colData,
2303
+ ...cell.rowData
2304
+ };
2305
+ const fun = function() {
2306
+ return eval(
2307
+ `async (cell,data) => {
2308
+ ${cell.customRender}
2309
+ }`
2310
+ );
2311
+ }();
2312
+ cell = fun.call(this, cell, data);
2313
+ }
2314
+ }
2315
+ innerConfig[key] ? innerConfig[key].push(cell) : innerConfig[key] = [cell];
2316
+ });
2317
+ }
2318
+ function computeCell(e) {
2319
+ changeConfig(e), Array.from(needComputedCell.values()).forEach((t) => {
2320
+ if (t.type === CellType.FUN && t.fun) {
2321
+ const { isError: r, result: n } = parseExpression(t.fun, !0);
2322
+ r || (t.text = n, t.type = CellType.TEXT);
2323
+ }
2324
+ }), innerConfig = {}, needComputedCell = /* @__PURE__ */ new Map();
2325
+ }
2326
+ function parseExpression(e, t = !1) {
2327
+ try {
2328
+ const r = e.trim();
2329
+ if (!r)
2330
+ throw new Error("请输入一个表达式");
2331
+ const n = r.startsWith("=") ? r.slice(1) : r, i = jsep(n);
2332
+ let c = null;
2333
+ return t && (c = evaluateExpression(i)), {
2334
+ isError: !1,
2335
+ result: c
2336
+ };
2337
+ } catch (r) {
2338
+ return console.error(r), {
2339
+ isError: !0,
2340
+ result: r.message
2341
+ };
2342
+ }
2343
+ }
2344
+ function evaluateExpression(e) {
2345
+ if (!e)
2346
+ throw new Error("空节点");
2347
+ switch (e.type) {
2348
+ case "Literal":
2349
+ if (typeof e.value == "string") {
2350
+ const c = e.value.match(/^(['"]?)([A-Z]+\d+):([A-Z]+\d+)\1$/i);
2351
+ if (c)
2352
+ return getRangeValues(c[2], c[3]);
2353
+ }
2354
+ return e.value;
2355
+ case "Identifier":
2356
+ if (/^[A-Z]+\d+$/.test(e.name))
2357
+ return getCellValue(e.name);
2358
+ throw new Error(`未定义的标识符: ${e.name}`);
2359
+ case "BinaryExpression":
2360
+ const t = evaluateExpression(e.left), r = evaluateExpression(e.right);
2361
+ switch (e.operator) {
2362
+ case "+":
2363
+ return t + r;
2364
+ case "-":
2365
+ return t - r;
2366
+ case "*":
2367
+ return t * r;
2368
+ case "/":
2369
+ return t / r;
2370
+ case "^":
2371
+ return Math.pow(t, r);
2372
+ case "=":
2373
+ return t === r ? 1 : 0;
2374
+ case "<>":
2375
+ return t !== r ? 1 : 0;
2376
+ case ">":
2377
+ return t > r ? 1 : 0;
2378
+ case "<":
2379
+ return t < r ? 1 : 0;
2380
+ case ">=":
2381
+ return t >= r ? 1 : 0;
2382
+ case "<=":
2383
+ return t <= r ? 1 : 0;
2384
+ default:
2385
+ throw new Error(`不支持的操作符: ${e.operator}`);
2386
+ }
2387
+ case "CallExpression":
2388
+ return evaluateFunction(e.callee.name, e.arguments);
2389
+ case "MemberExpression":
2390
+ if (e.computed && e.property && e.property.type === "Literal") {
2391
+ const s = e.property.value.match(/^(['"]?)([A-Z]+\d+):([A-Z]+\d+)\1$/i);
2392
+ if (s)
2393
+ return getRangeValues(s[2], s[3]);
2394
+ }
2395
+ const n = evaluateExpression(e.object), i = e.computed ? evaluateExpression(e.property) : e.property.name;
2396
+ if (typeof n == "object" && n !== null)
2397
+ return n[i];
2398
+ throw new Error(`无法获取非对象值的属性: ${i}`);
2399
+ default:
2400
+ throw new Error(`不支持的节点类型: ${e.type}`);
2401
+ }
2402
+ }
2403
+ function getRangeValues(e, t) {
2404
+ let r = -1;
2405
+ const n = e.match(/[A-Z]+/);
2406
+ n && (r = columnToNumber(n[0]));
2407
+ let i = -1;
2408
+ const c = e.match(/\d+/);
2409
+ c && (i = parseInt(c[0]) - 1);
2410
+ let s = -1;
2411
+ const m = t.match(/[A-Z]+/);
2412
+ m && (s = columnToNumber(m[0]));
2413
+ let f = -1;
2414
+ const y = t.match(/\d+/);
2415
+ y && (f = parseInt(y[0]) - 1);
2416
+ const C = [];
2417
+ for (let x = i; x <= f; x++)
2418
+ for (let S = r; S <= s; S++) {
2419
+ const g = `${x}:${S}`;
2420
+ C.push(...getCellValue(g));
2421
+ }
2422
+ return C;
2423
+ }
2424
+ function evaluateFunction(e, t) {
2425
+ const r = t.map((n) => evaluateExpression(n));
2426
+ switch (e.toUpperCase()) {
2427
+ case "SUM":
2428
+ return r.flat().reduce((s, m) => {
2429
+ const f = parseFloat(m);
2430
+ return s + (isNaN(f) ? 0 : f);
2431
+ }, 0);
2432
+ case "AVERAGE":
2433
+ case "AVG":
2434
+ const i = r.flat().filter((s) => !isNaN(parseFloat(s)));
2435
+ return i.length > 0 ? i.reduce((s, m) => s + parseFloat(m), 0) / i.length : 0;
2436
+ case "IF":
2437
+ if (r.length !== 3)
2438
+ throw new Error(`IF函数需要3个参数,但提供了${r.length}个`);
2439
+ return r[0] ? r[1] : r[2];
2440
+ case "NOW":
2441
+ return (/* @__PURE__ */ new Date()).toLocaleString();
2442
+ case "TODAY":
2443
+ const c = /* @__PURE__ */ new Date();
2444
+ return `${c.getFullYear()}-${String(c.getMonth() + 1).padStart(2, "0")}-${String(c.getDate()).padStart(2, "0")}`;
2445
+ case "MAX":
2446
+ return Math.max(
2447
+ ...r.flat().map(Number).filter((s) => !isNaN(s))
2448
+ );
2449
+ case "MIN":
2450
+ return Math.min(
2451
+ ...r.flat().map(Number).filter((s) => !isNaN(s))
2452
+ );
2453
+ case "COUNT":
2454
+ return r.flat().length;
2455
+ case "CONCATENATE":
2456
+ case "TEXTJOIN":
2457
+ return r.map(String).join("");
2458
+ default:
2459
+ throw new Error(`不支持的函数: ${e}`);
2460
+ }
2461
+ }
2462
+ function getCellValue(e) {
2463
+ try {
2464
+ return innerConfig[e].map((t) => t.text);
2465
+ } catch (t) {
2466
+ console.warn(`无法解析单元格: ${e}`, t);
2467
+ }
2468
+ return [];
2469
+ }
2470
+ function columnToNumber(e) {
2471
+ let t = 0;
2472
+ for (let r = 0; r < e.length; r++)
2473
+ t = t * 26 + (e.charCodeAt(r) - 64) - 1;
2474
+ return t;
2475
+ }
2476
+ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
2477
+ __name: "report-view-item",
2478
+ props: {
2479
+ config: null,
2480
+ index: null
2481
+ },
2482
+ emits: ["updateData"],
2483
+ setup(e, { emit: t }) {
2484
+ const r = e, n = ref(), i = ref(), c = computed(() => ({
2485
+ width: r.config.widthType === "%" ? `calc(${r.config.width}% - 10px)` : `${r.config.width - 10}px`,
2486
+ height: r.config.fullHeight ? "calc(100% - 8px)" : `${r.config.height}px`
2487
+ })), s = computed(() => r.config && r.config.data ? !!r.config.data.pagination : !1), m = computed(() => r.config.params && Array.isArray(r.config.params) && r.config.params.length > 0), f = reactive({
2488
+ pageSize: 100,
2489
+ pageSizes: [10, 20, 50, 100, 200, 1e4],
2490
+ pageIndex: 1,
2491
+ total: 0
2492
+ }), y = ref([]);
2493
+ function C(O) {
2494
+ y.value = O, f.pageIndex = 1, Z();
2495
+ }
2496
+ let x = !1;
2497
+ watch(
2498
+ () => [f.pageSize, f.pageIndex],
2499
+ (O, w) => {
2500
+ if (O && w) {
2501
+ let [u, l] = O, [a, p] = O;
2502
+ u !== a && (f.pageIndex = 1), x && Z();
2503
+ }
2504
+ },
2505
+ {
2506
+ immediate: !0,
2507
+ deep: !0
2508
+ }
2509
+ );
2510
+ function S() {
2511
+ f.pageIndex = 1, Z();
2512
+ }
2513
+ const g = ref(!1);
2514
+ function b(O) {
2515
+ return O.reduce((u, l) => (l.loop && u.push(l), u), []);
2516
+ }
2517
+ function N(O) {
2518
+ const w = O.length, u = O[0].length, l = [];
2519
+ for (let a = 0; a < u; a++) {
2520
+ l[a] = [];
2521
+ for (let p = 0; p < w; p++)
2522
+ l[a][p] = O[p][a];
2523
+ }
2524
+ return l;
2525
+ }
2526
+ function P(O, w, u, l, a) {
2527
+ if (l) {
2528
+ let o = a.findIndex((v) => v === u);
2529
+ u = a[o - 1];
2530
+ }
2531
+ let p = O[w], d = `${u}-${p.join("-")}`;
2532
+ return Object.keys(O).filter((o) => o.indexOf(d) > -1).map((o) => O[o]).reduce((o, v) => o + v.length, 0);
2533
+ }
2534
+ function J(O, w) {
2535
+ const u = O.filter((l) => l < w);
2536
+ return u.length === 0 ? null : Math.max(...u);
2537
+ }
2538
+ function Y(O, w, u, l) {
2539
+ w.forEach((a) => {
2540
+ let p = l[a.data], d = u[a.index], E = [];
2541
+ d.forEach((D, R) => {
2542
+ D.type === CellType.FIELD && D.data && D.isGroup && E.push(R);
2543
+ });
2544
+ let o = {};
2545
+ E.forEach((D, R) => {
2546
+ o[D] || (o[D] = /* @__PURE__ */ new Set());
2547
+ let $ = d[D].data.replace("row:", "").toUpperCase();
2548
+ if (R === 0)
2549
+ p.forEach((_) => {
2550
+ if ($) {
2551
+ let I = _[$];
2552
+ if (I) {
2553
+ const B = `${D}-${I}`;
2554
+ o[B] ? o[B].push(_) : o[B] = [_], o[D].add(I), o[I] = [I];
2555
+ }
2556
+ }
2557
+ });
2558
+ else {
2559
+ let _ = D - 1;
2560
+ Array.from(o[_]).forEach((B) => {
2561
+ const H = `${_}-${B}`;
2562
+ let V = o[H].map((G) => {
2563
+ if ($) {
2564
+ let K = G[$];
2565
+ if (K) {
2566
+ let te = !1;
2567
+ const ie = `${D}-${B}-${K}`, ae = `${B}-${K}`;
2568
+ return o[ie] ? o[ie].push(G) : o[ie] = [G], o[D].has(ae) || (te = !0), o[D].add(ae), o[ae] = o[B].concat([K]), te ? K : null;
2569
+ }
2570
+ }
2571
+ }).filter((G) => !!G);
2572
+ o[H] = V;
2573
+ });
2574
+ }
2575
+ });
2576
+ let v = 1, A = Math.max(...E);
2577
+ const U = d.some((D) => D.isRowColCombine);
2578
+ E.length > 0 ? U ? v = o[A].size : v = Array.from(o[A]).reduce((D, R) => {
2579
+ let k = o[`${A}-${R}`];
2580
+ return D + k.length;
2581
+ }, 0) : v = p.length;
2582
+ const F = {
2583
+ ...a,
2584
+ loop: !1
2585
+ }, L = Array.from({ length: v }, () => cloneDeep(F));
2586
+ O.splice(a.index, 1, ...L);
2587
+ const M = Array.from({ length: d.length }, () => []);
2588
+ d.forEach((D, R) => {
2589
+ let k = M[R];
2590
+ if (E.includes(R))
2591
+ Array.from(o[D.col]).forEach((_, I) => {
2592
+ let B = U && R === A ? 1 : P(o, _, A, U, E), H = o[_], T = H[o[_].length - 1], V = {
2593
+ ...D,
2594
+ text: T,
2595
+ rowSpan: B,
2596
+ rowData: H
2597
+ };
2598
+ k.push(V);
2599
+ let G = {
2600
+ ...D,
2601
+ text: T,
2602
+ type: "",
2603
+ colSpan: 0,
2604
+ rowSpan: 0
2605
+ };
2606
+ for (let K = 0; K < B - 1; K++)
2607
+ k.push(G);
2608
+ });
2609
+ else if (D.data) {
2610
+ let $ = o[A] ? Array.from(o[A]) : [], _ = D.data.replace("row:", "").toUpperCase();
2611
+ D.isRowColCombine ? $.length ? $.forEach((I, B) => {
2612
+ let H = o[`${A}-${I}`], T = D.combineKeys.map((K, te) => {
2613
+ const ie = D.combineValues[te];
2614
+ return {
2615
+ key: K,
2616
+ val: ie
2617
+ };
2618
+ });
2619
+ const V = H.filter((K) => T.every((te) => K[te.key] === te.val));
2620
+ let G = {
2621
+ ...D
2622
+ };
2623
+ if (delete G.combineKeys, delete G.combineValues, delete G.isRowColCombine, V && V.length) {
2624
+ const K = V[0];
2625
+ G.text = K[_], G.rowData = K;
2626
+ } else
2627
+ G.text = "", G.rowData = {};
2628
+ k.push(G);
2629
+ }) : p.forEach((I) => {
2630
+ let H = D.combineKeys.map((V, G) => {
2631
+ const K = D.combineValues[G];
2632
+ return {
2633
+ key: V,
2634
+ val: K
2635
+ };
2636
+ }).every((V) => I[V.key] === V.val), T = {
2637
+ ...D
2638
+ };
2639
+ delete T.combineKeys, delete T.combineValues, delete T.isRowColCombine, H ? (T.text = I[_], T.rowData = I) : T.text = "", k.push(T);
2640
+ }) : $.length ? $.forEach((I, B) => {
2641
+ o[`${A}-${I}`].forEach((T) => {
2642
+ let V = {
2643
+ ...D
2644
+ };
2645
+ delete V.combineKeys, delete V.combineValues, delete V.isRowColCombine, T[_] ? (V.text = T[_], V.rowData = T) : V.text = "", k.push(V);
2646
+ });
2647
+ }) : p.forEach((I) => {
2648
+ let B = {
2649
+ ...D
2650
+ };
2651
+ delete B.combineKeys, delete B.combineValues, delete B.isRowColCombine, I[_] ? (B.text = I[_], B.rowData = I) : B.text = "", k.push(B);
2652
+ });
2653
+ } else {
2654
+ const $ = {
2655
+ ...D,
2656
+ rowData: p[0]
2657
+ };
2658
+ if (D.rowSpan === 0 && D.mergeTarget && D.mergeTarget.length === 2) {
2659
+ let [B, H] = D.mergeTarget, T = u.reduce((V, G) => V.concat(G), []).filter((V) => V.row === B && V.col === H)[0];
2660
+ T && (T.rowSpan += v - 1);
2661
+ } else
2662
+ $.rowSpan += v - 1;
2663
+ const _ = {
2664
+ ...D,
2665
+ type: "",
2666
+ colSpan: 0,
2667
+ rowSpan: 0
2668
+ };
2669
+ delete $.isRowColCombine;
2670
+ let I = Array.from({ length: v - 1 }, () => cloneDeep(_));
2671
+ k.push($, ...I);
2672
+ }
2673
+ });
2674
+ const z = N(M);
2675
+ u.splice(a.index, 1, ...z);
2676
+ });
2677
+ }
2678
+ function W(O, w, u, l) {
2679
+ w.forEach((a) => {
2680
+ let p = l[a.data], d = [], E = [];
2681
+ u.forEach((L, M) => {
2682
+ let z = L[a.index];
2683
+ z.type === CellType.FIELD && z.data && z.isGroup && E.push(M), d.push(z);
2684
+ });
2685
+ let o = {};
2686
+ E.forEach((L, M) => {
2687
+ o[L] || (o[L] = /* @__PURE__ */ new Set());
2688
+ let D = d[L].data.replace("col:", "").toUpperCase();
2689
+ if (M === 0)
2690
+ p.forEach((R) => {
2691
+ if (D) {
2692
+ let k = R[D];
2693
+ if (k) {
2694
+ const $ = `${L}-${k}`;
2695
+ o[$] ? o[$].push(R) : o[$] = [R], o[L].add(k), o[k] = [k], o[`${k}-data`] = [R];
2696
+ }
2697
+ }
2698
+ });
2699
+ else {
2700
+ let R = E[M - 1];
2701
+ Array.from(o[R]).forEach(($) => {
2702
+ const _ = `${R}-${$}`;
2703
+ let B = o[_].map((H) => {
2704
+ if (D) {
2705
+ let T = H[D];
2706
+ if (T) {
2707
+ let V = !1;
2708
+ const G = `${L}-${$}-${T}`, K = `${$}-${T}`;
2709
+ return o[G] ? o[G].push(H) : o[G] = [H], o[K + "-data"] ? o[K + "-data"].push(H) : o[K + "-data"] = [H], o[L].has(K) || (V = !0), o[L].add(K), o[K] = o[$].concat([T]), V ? T : null;
2710
+ }
2711
+ }
2712
+ }).filter((H) => !!H);
2713
+ o[_] = B;
2714
+ });
2715
+ }
2716
+ });
2717
+ let v = 1, A = Math.max(...E), U = Math.min(...E);
2718
+ const F = d.some((L) => L.isRowColCombine);
2719
+ E.length > 0 ? F ? v = o[A].size : v = Array.from(o[A]).reduce((L, M) => {
2720
+ let z = o[`${A}-${M}`];
2721
+ return L + z.length;
2722
+ }, 0) : v = p.length;
2723
+ for (let L = 0; L < d.length; L++) {
2724
+ const M = d[L];
2725
+ if (L === 0) {
2726
+ const D = {
2727
+ ...a,
2728
+ loop: !1
2729
+ }, R = Array.from({ length: v }, () => cloneDeep(D));
2730
+ O.splice(a.index, 1, ...R);
2731
+ }
2732
+ let z = u[M.row];
2733
+ if (z && Array.isArray(z)) {
2734
+ let D = [];
2735
+ if (E.includes(L))
2736
+ Array.from(o[M.row]).forEach((k, $) => {
2737
+ let _ = F && L === A ? 1 : P(o, k, A, F, E), I = o[k][o[k].length - 1], B = {
2738
+ ...M,
2739
+ text: I,
2740
+ colSpan: _,
2741
+ colData: o[k + "-data"]
2742
+ };
2743
+ if (D.push(B), _ > 1) {
2744
+ let H = {
2745
+ ...M,
2746
+ text: I,
2747
+ type: "",
2748
+ colSpan: 0,
2749
+ rowSpan: 0
2750
+ };
2751
+ for (let T = 0; T < _ - 1; T++)
2752
+ D.push(H);
2753
+ }
2754
+ }), z.splice(M.col, 1, ...D);
2755
+ else {
2756
+ if (L > U && L < A) {
2757
+ let R = J(E, L);
2758
+ if (R !== null) {
2759
+ let k = u[R].slice(a.index, a.index + v);
2760
+ k = k.map(($) => {
2761
+ let _ = $.colData;
2762
+ return Array.isArray(_) && (_ = _[0]), {
2763
+ ...M,
2764
+ colData: _,
2765
+ colSpan: $.colSpan,
2766
+ rowSpan: $.rowSpan
2767
+ };
2768
+ }), z.splice(a.index, 1, ...k);
2769
+ continue;
2770
+ }
2771
+ }
2772
+ if (M.data) {
2773
+ let R = o[A] ? Array.from(o[A]) : [], k = M.data.replace("col:", "").toUpperCase();
2774
+ if (M.isRowColCombine) {
2775
+ let $ = E.map((I) => d[I].data.replace("col:", "").toUpperCase()), _ = [];
2776
+ R.forEach((I, B) => {
2777
+ let H = {
2778
+ ...M,
2779
+ combineKeys: $,
2780
+ combineValues: o[I]
2781
+ };
2782
+ _.push(H);
2783
+ }), z.splice(M.col, 1, ..._);
2784
+ } else if (R.length)
2785
+ R.forEach(($, _) => {
2786
+ let I = o[`${A}-${$}`], B = [];
2787
+ I.forEach((H) => {
2788
+ let T = {
2789
+ ...M
2790
+ };
2791
+ delete T.combineKeys, delete T.combineValues, delete T.isRowColCombine, H[k] ? (T.text = H[k], T.colData = H) : T.text = "", B.push(T);
2792
+ }), z.splice(M.col, 1, ...B);
2793
+ });
2794
+ else {
2795
+ let $ = [];
2796
+ p.forEach((_) => {
2797
+ let I = {
2798
+ ...M
2799
+ };
2800
+ delete I.combineKeys, delete I.combineValues, delete I.isRowColCombine, _[k] ? (I.text = _[k], I.colData = _) : I.text = "", $.push(I);
2801
+ }), z.splice(M.col, 1, ...$);
2802
+ }
2803
+ } else {
2804
+ const R = {
2805
+ ...M,
2806
+ colData: p[0]
2807
+ };
2808
+ if (M.colSpan === 0 && M.mergeTarget && M.mergeTarget.length === 2 && M.row === M.mergeTarget[0]) {
2809
+ let [_, I] = M.mergeTarget, B = u.reduce((H, T) => H.concat(T), []).filter((H) => H.row === _ && H.col === I)[0];
2810
+ B && (B.colSpan += v - 1);
2811
+ } else
2812
+ (!Array.isArray(M.mergeTarget) || M.mergeTarget.length !== 2) && (R.colSpan = v);
2813
+ const k = {
2814
+ ...M,
2815
+ colSpan: 0,
2816
+ rowSpan: 0
2817
+ };
2818
+ let $ = Array.from({ length: v - 1 }, () => cloneDeep(k));
2819
+ z.splice(M.col, 1, R, ...$);
2820
+ }
2821
+ }
2822
+ }
2823
+ }
2824
+ });
2825
+ }
2826
+ function ne(O) {
2827
+ if (r.config && i.value) {
2828
+ i.value.innerHTML = "", console.time("transformConfig");
2829
+ let { rowConfig: w, colConfig: u, config: l } = cloneDeep(r.config), a = b(u), p = b(w);
2830
+ a && W(u, a, l, O), p && Y(w, p, l, O), computeCell(l), console.timeEnd("transformConfig"), console.time("renderReportByDom"), re(w, u, l, i), console.timeEnd("renderReportByDom");
2831
+ }
2832
+ }
2833
+ function Q(O) {
2834
+ const w = document.createElement("colgroup");
2835
+ let u = 0;
2836
+ return O.forEach((l) => {
2837
+ const a = document.createElement("col");
2838
+ u += l.size, a.style.width = `${l.size}px`, w.appendChild(a);
2839
+ }), i.value && (i.value.style.width = `${u}px`), w;
2840
+ }
2841
+ function q(O, w) {
2842
+ const u = document.createElement("td");
2843
+ u.setAttribute("data-cell-config", `${w.row}-${w.col}`), u.setAttribute("rowspan", w.rowSpan), u.setAttribute("colspan", w.colSpan);
2844
+ let l = "";
2845
+ switch (w.type) {
2846
+ case "icon":
2847
+ u.innerHTML = `<i class="iconfont ${w.data}"></i>`;
2848
+ break;
2849
+ case "image":
2850
+ u.innerHTML = `<img src="${w.data}" alt="">`;
2851
+ break;
2852
+ default:
2853
+ l = w.text !== void 0 && w.text !== null ? w.text : "";
2854
+ break;
2855
+ }
2856
+ return [CellType.TEXT, CellType.FIELD, CellType.ICON, CellType.FUN].includes(w.type) && w.style && u.setAttribute("style", renderCellStyle(w.style)), u.innerText = l, u;
2857
+ }
2858
+ function re(O, w, u, l) {
2859
+ const a = Q(w);
2860
+ l.value.appendChild(a);
2861
+ let p = 0;
2862
+ const d = document.createDocumentFragment();
2863
+ for (let E = 0; E < O.length; E++) {
2864
+ const o = O[E], v = document.createElement("tr");
2865
+ o.isFixed && (v.style.top = `${p - 1}px`, v.classList.add("fixed-row")), p += o.size, v.style.height = `${o.size}px`;
2866
+ for (let A = 0; A < w.length; A++) {
2867
+ const U = u[E][A];
2868
+ if (o && U) {
2869
+ const F = q(o, U);
2870
+ F.setAttribute("data-cell-data", `${E}-${A}`), U.rowSpan === 0 || U.colSpan === 0 || v.appendChild(F);
2871
+ }
2872
+ }
2873
+ d.appendChild(v);
2874
+ }
2875
+ l.value.appendChild(d);
2876
+ }
2877
+ async function Z() {
2878
+ g.value = !0;
2879
+ let O = await X(), w = ee(O);
2880
+ r.config.data.processData && (w = await getProcessData(r.config.data.processData, w, y.value)), ne(w), g.value = !1;
2881
+ }
2882
+ function ee(O) {
2883
+ let w = {};
2884
+ return Array.isArray(O) || (O = [O]), O.map(({ key: u, data: l }) => {
2885
+ let a = l.filter((p) => p);
2886
+ w[u] = a;
2887
+ }), t("updateData", {
2888
+ key: r.config.id,
2889
+ data: w
2890
+ }), w;
2891
+ }
2892
+ async function X() {
2893
+ if (r.config.data.source) {
2894
+ let O = {};
2895
+ m.value && (O.params = cloneDeep(y.value)), s.value && (O.pageSize = f.pageSize, O.pageNumber = f.pageIndex);
2896
+ let w = [];
2897
+ for (let u = 0; u < r.config.data.source.length; u++) {
2898
+ const { key: l, url: a } = r.config.data.source[u];
2899
+ if (a) {
2900
+ const p = await getDateSourceData(a, O);
2901
+ w.push({ key: l, data: p.data }), s.value && (f.total = p.count || p.data.length);
2902
+ }
2903
+ }
2904
+ return w;
2905
+ } else
2906
+ return [];
2907
+ }
2908
+ async function j() {
2909
+ if (r.config.data.pagination && (r.config.data.pageSize !== void 0 && (f.pageSize = isNaN(r.config.data.pageSize) ? 10 : r.config.data.pageSize), r.config.data.pageSizes !== void 0)) {
2910
+ let O = r.config.data.pageSizes.split(",").map((w) => parseInt(w));
2911
+ f.pageSizes = Array.isArray(O) ? O : [10, 20, 50, 100, 200];
2912
+ }
2913
+ x = !0;
2914
+ }
2915
+ return onMounted(async () => {
2916
+ j();
2917
+ }), (O, w) => {
2918
+ const u = resolveComponent("el-button"), l = resolveComponent("el-pagination"), a = resolveDirective("loading");
2919
+ return openBlock(), createElementBlock("div", {
2920
+ class: "yh-report-view-container",
2921
+ style: normalizeStyle(unref(c))
2922
+ }, [
2923
+ createVNode(_sfc_main$4, {
2924
+ config: r.config.params,
2925
+ onChange: C
2926
+ }, {
2927
+ search: withCtx(() => [
2928
+ unref(m) ? (openBlock(), createBlock(u, {
2929
+ key: 0,
2930
+ type: "primary",
2931
+ onClick: S
2932
+ }, {
2933
+ default: withCtx(() => [
2934
+ createTextVNode(" 搜索 ")
2935
+ ]),
2936
+ _: 1
2937
+ })) : createCommentVNode("", !0)
2938
+ ]),
2939
+ _: 1
2940
+ }, 8, ["config"]),
2941
+ withDirectives((openBlock(), createElementBlock("div", {
2942
+ class: "yh-statement-table-container",
2943
+ ref_key: "statementTableRef",
2944
+ ref: n
2945
+ }, [
2946
+ createElementVNode("table", {
2947
+ ref_key: "tableBodyRef",
2948
+ ref: i
2949
+ }, null, 512)
2950
+ ])), [
2951
+ [a, g.value]
2952
+ ]),
2953
+ unref(s) ? (openBlock(), createBlock(l, {
2954
+ key: 0,
2955
+ pageSize: f.pageSize,
2956
+ "onUpdate:pageSize": w[0] || (w[0] = (p) => f.pageSize = p),
2957
+ "current-page": f.pageIndex,
2958
+ "onUpdate:currentPage": w[1] || (w[1] = (p) => f.pageIndex = p),
2959
+ "page-sizes": f.pageSizes,
2960
+ total: f.total,
2961
+ layout: "total, jumper, prev, pager, next, sizes"
2962
+ }, null, 8, ["pageSize", "current-page", "page-sizes", "total"])) : createCommentVNode("", !0)
2963
+ ], 4);
2964
+ };
2965
+ }
2966
+ }), chartsTypeList = ["line", "rowBar", "bar", "scatter", "treemap", "label"], getChartData = async (e, t) => {
2967
+ const {
2968
+ data: { source: r },
2969
+ seriesData: n,
2970
+ xAisData: i,
2971
+ yAisData: c,
2972
+ type: s
2973
+ } = e;
2974
+ let m = {
2975
+ ...t
2976
+ };
2977
+ for (let f = 0; f < r.length; f++) {
2978
+ const { key: y, url: C } = r[f], x = (await getDateSourceData(C, {})).data;
2979
+ m[y] = x;
2980
+ }
2981
+ if (Object.keys(m).length === 0)
2982
+ return !1;
2983
+ if (n) {
2984
+ const y = new Function("allData", n)(m);
2985
+ e.option.series.forEach((C) => {
2986
+ C.data = y;
2987
+ });
2988
+ } else
2989
+ e.option = setYAxisData(e, m);
2990
+ if (chartsTypeList.includes(s)) {
2991
+ if (i) {
2992
+ const f = new Function("allData", i);
2993
+ e.option.xAxis.data = f(m);
2994
+ } else
2995
+ e.option = setXAxisData(e, m);
2996
+ if (c) {
2997
+ const y = new Function("allData", c)(m);
2998
+ e.option.yAxis.data = y;
2999
+ }
3000
+ }
3001
+ }, chartItem_vue_vue_type_style_index_0_scoped_5bbf4c7d_lang = "", _export_sfc = (e, t) => {
3002
+ const r = e.__vccOpts || e;
3003
+ for (const [n, i] of t)
3004
+ r[n] = i;
3005
+ return r;
3006
+ }, _sfc_main$2 = {
3007
+ __name: "chart-item",
3008
+ props: {
3009
+ chartData: {
3010
+ type: Object,
3011
+ require: !0
3012
+ },
3013
+ isView: {
3014
+ type: Boolean,
3015
+ default: !1
3016
+ }
3017
+ },
3018
+ setup(e, { expose: t }) {
3019
+ const r = e, n = ref(), i = ref(null);
3020
+ let c = null;
3021
+ watch(
3022
+ () => r.chartData.option,
3023
+ (x) => {
3024
+ c && c.setOption(x, {
3025
+ notMerge: !0
3026
+ });
3027
+ },
3028
+ { deep: !0 }
3029
+ ), watch(
3030
+ () => r.chartData.isSuspend,
3031
+ (x) => {
3032
+ x && C();
3033
+ },
3034
+ { deep: !0 }
3035
+ );
3036
+ const s = ref(!1), m = (x) => {
3037
+ if (i.value = x, x && Object.keys(x).length > 0) {
3038
+ const S = cloneDeep(r.chartData);
3039
+ f(S);
3040
+ }
3041
+ }, f = async (x) => {
3042
+ r.isView && await getChartData(x, i.value), x.type === "label" && x.option.series.forEach((S) => {
3043
+ S.renderItem = renderItem;
3044
+ }), c.setOption(x.option), s.value = !1;
3045
+ }, y = async () => {
3046
+ s.value = !0, c = echarts.init(n.value);
3047
+ let x = cloneDeep(r.chartData);
3048
+ await f(x);
3049
+ }, C = () => {
3050
+ nextTick(() => {
3051
+ c.resize();
3052
+ });
3053
+ };
3054
+ return t({
3055
+ setOutData: m
3056
+ }), onMounted(() => {
3057
+ y(), window.addEventListener("resize", C);
3058
+ }), onUnmounted(() => {
3059
+ window.removeEventListener("resize", C);
3060
+ }), (x, S) => {
3061
+ const g = resolveDirective("loading");
3062
+ return withDirectives((openBlock(), createElementBlock("div", {
3063
+ ref_key: "chartRef",
3064
+ ref: n,
3065
+ "element-loading-text": "正在加载数据......",
3066
+ class: "chart chart-common"
3067
+ }, null, 512)), [
3068
+ [g, s.value]
3069
+ ]);
3070
+ };
3071
+ }
3072
+ }, chartItem = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["__scopeId", "data-v-5bbf4c7d"]]), _sfc_main$1 = /* @__PURE__ */ defineComponent({
3073
+ __name: "chart-view-item",
3074
+ props: {
3075
+ index: null,
3076
+ config: null,
3077
+ outData: null
3078
+ },
3079
+ setup(e, { expose: t }) {
3080
+ const r = e, n = ref();
3081
+ watch(
3082
+ () => r.outData,
3083
+ (s) => {
3084
+ console.log("chart-view-item:", s);
3085
+ },
3086
+ { deep: !0 }
3087
+ );
3088
+ const i = computed(() => {
3089
+ let s = r.config.widthUnit || "px", m = r.config.heightUnit || "px";
3090
+ if (r.config.isSuspend) {
3091
+ let f = {
3092
+ position: "absolute",
3093
+ left: r.config.left + "px",
3094
+ top: r.config.top + "px",
3095
+ zIndex: 100,
3096
+ height: r.config.height + m
3097
+ };
3098
+ return s === "%" ? f.width = `calc( ${r.config.width}${s} - 10px)` : f.width = `${r.config.width - 10}${s}`, f;
3099
+ } else {
3100
+ let f = {
3101
+ height: r.config.height + m
3102
+ };
3103
+ return s === "%" ? f.width = `calc( ${r.config.width}${s} - 10px)` : f.width = `${r.config.width - 10}${s}`, f;
3104
+ }
3105
+ });
3106
+ return t({
3107
+ setOutData: (s) => {
3108
+ var m;
3109
+ (m = n.value) == null || m.setOutData(s);
3110
+ }
3111
+ }), (s, m) => (openBlock(), createElementBlock("div", {
3112
+ class: "yh-report-view-container chart-view-item",
3113
+ style: normalizeStyle(unref(i))
3114
+ }, [
3115
+ createVNode(chartItem, {
3116
+ "is-view": "",
3117
+ ref_key: "chartItemRef",
3118
+ ref: n,
3119
+ "chart-data": r.config
3120
+ }, null, 8, ["chart-data"])
3121
+ ], 4));
3122
+ }
3123
+ }), _hoisted_1 = { class: "yh-statement-table-title" }, _hoisted_2 = { class: "back-top" }, _hoisted_3 = /* @__PURE__ */ createElementVNode("i", { class: "iconfont icon-backtop" }, null, -1), _hoisted_4 = [
3124
+ _hoisted_3
3125
+ ], _sfc_main = /* @__PURE__ */ defineComponent({
3126
+ __name: "report-run",
3127
+ props: {
3128
+ id: null
3129
+ },
3130
+ emits: ["updateData"],
3131
+ setup(e, { emit: t }) {
3132
+ const r = e;
3133
+ ref();
3134
+ const n = ref(!1), i = ref(!1), c = ref(""), s = ref(), m = ref(), f = ref([]), y = {};
3135
+ watch(
3136
+ () => r.id,
3137
+ (g) => {
3138
+ C(g);
3139
+ }
3140
+ );
3141
+ function C(g) {
3142
+ g ? (i.value = !1, n.value = !0, getConfig(g).then(async ({ name: b, remoteOptions: N }) => {
3143
+ c.value = b, f.value = N;
3144
+ }).finally(() => {
3145
+ n.value = !1;
3146
+ })) : i.value = !0;
3147
+ }
3148
+ const x = ref(!1);
3149
+ function S(g) {
3150
+ var b;
3151
+ y[g.key] = g.data, (b = m.value) == null || b.forEach((N) => {
3152
+ N.setOutData(y);
3153
+ });
3154
+ }
3155
+ return onMounted(() => {
3156
+ C(r.id);
3157
+ }), (g, b) => {
3158
+ const N = resolveDirective("loading");
3159
+ return openBlock(), createElementBlock(Fragment, null, [
3160
+ createElementVNode("div", _hoisted_1, toDisplayString(c.value), 1),
3161
+ i.value ? (openBlock(), createBlock(unref(ElEmpty), {
3162
+ key: 1,
3163
+ class: "yh-statement-table-viewer-container",
3164
+ description: "获取配置时出现错误"
3165
+ }, {
3166
+ default: withCtx(() => [
3167
+ createVNode(unref(ElButton), {
3168
+ type: "primary",
3169
+ onClick: b[0] || (b[0] = (P) => g.$router.back())
3170
+ }, {
3171
+ default: withCtx(() => [
3172
+ createTextVNode(" 返回 ")
3173
+ ]),
3174
+ _: 1
3175
+ })
3176
+ ]),
3177
+ _: 1
3178
+ })) : withDirectives((openBlock(), createElementBlock("section", {
3179
+ key: 0,
3180
+ class: "yh-report-viewer-wrapper",
3181
+ ref_key: "viewWrapper",
3182
+ ref: s
3183
+ }, [
3184
+ (openBlock(!0), createElementBlock(Fragment, null, renderList(f.value, (P, J) => (openBlock(), createElementBlock(Fragment, null, [
3185
+ P.type === "report" ? (openBlock(), createBlock(_sfc_main$3, {
3186
+ key: 0,
3187
+ index: J,
3188
+ config: P,
3189
+ onUpdateData: S
3190
+ }, null, 8, ["index", "config"])) : (openBlock(), createBlock(_sfc_main$1, {
3191
+ key: 1,
3192
+ config: P,
3193
+ ref_for: !0,
3194
+ ref_key: "chartViewItemRef",
3195
+ ref: m,
3196
+ index: J
3197
+ }, null, 8, ["config", "index"]))
3198
+ ], 64))), 256)),
3199
+ withDirectives(createElementVNode("div", _hoisted_2, _hoisted_4, 512), [
3200
+ [vShow, x.value]
3201
+ ])
3202
+ ])), [
3203
+ [N, n.value]
3204
+ ])
3205
+ ], 64);
3206
+ };
3207
+ }
3208
+ }), reportRun_vue_vue_type_style_index_0_lang = "", index = {
3209
+ install(e, t) {
3210
+ let { router: r, pinia: n, isAdmin: i = !1 } = t;
3211
+ i && (r.addRoute("Index", {
3212
+ path: "statement/list",
3213
+ name: "报表列表",
3214
+ meta: {
3215
+ id: "Statement",
3216
+ title: "报表列表",
3217
+ icon: "iconfont icon-s-grid"
3218
+ },
3219
+ component: () => import("./StatementList-33bfb81d.mjs")
3220
+ }), r.addRoute("Index", {
3221
+ path: "statement/design/:id",
3222
+ name: "报表设计",
3223
+ meta: {
3224
+ id: "StatementDesign",
3225
+ title: "报表设计",
3226
+ icon: "iconfont icon-s-grid"
3227
+ },
3228
+ component: () => import("./StatementDesign-1bbd443e.mjs")
3229
+ })), r.addRoute("Index", {
3230
+ path: "statement/detail/:id",
3231
+ name: "后台报表查看",
3232
+ meta: {
3233
+ id: "StatementDetail",
3234
+ title: "后台报表查看",
3235
+ icon: "iconfont icon-s-grid"
3236
+ },
3237
+ component: () => import("./StatementDetail-78ad54fa.mjs")
3238
+ }), r.addRoute({
3239
+ path: "/statementdetail/:id",
3240
+ name: "报表查看",
3241
+ meta: {
3242
+ id: "StatementDetail",
3243
+ title: "报表查看",
3244
+ icon: "iconfont icon-s-grid"
3245
+ },
3246
+ component: () => import("./StatementDetail-78ad54fa.mjs")
3247
+ });
3248
+ }
3249
+ };
3250
+ let dynamicReportIndex = 0;
3251
+ function dynamicReportView(e) {
3252
+ return dynamicReportIndex++, async () => Promise.resolve(
3253
+ defineComponent({
3254
+ name: e || `report${dynamicReportIndex}`,
3255
+ data() {
3256
+ return {
3257
+ id: ""
3258
+ };
3259
+ },
3260
+ activated() {
3261
+ var t;
3262
+ (t = document.querySelector(".main-container")) == null || t.classList.add("statement-design-main");
3263
+ },
3264
+ deactivated() {
3265
+ var t;
3266
+ (t = document.querySelector(".main-container")) == null || t.classList.add("statement-design-main");
3267
+ },
3268
+ render(t) {
3269
+ return h("section", { class: "statement-detail-container" }, [h(_sfc_main, { id: this.id })]);
3270
+ },
3271
+ mounted() {
3272
+ this.id = this.$route.fullPath.replace("/innerStatementdetail/", "");
3273
+ }
3274
+ })
3275
+ );
3276
+ }
3277
+ export {
3278
+ CellType as C,
3279
+ DataSourceColumnDataType as D,
3280
+ FormatType as F,
3281
+ ItemTypes as I,
3282
+ TypeItems as T,
3283
+ _export_sfc as _,
3284
+ del as a,
3285
+ getConfig as b,
3286
+ copyString as c,
3287
+ dayjs as d,
3288
+ componentTransition as e,
3289
+ chartItem as f,
3290
+ getList as g,
3291
+ chartsTypeList as h,
3292
+ getDateSourceColumns as i,
3293
+ getDateSourceList as j,
3294
+ _sfc_main as k,
3295
+ getReportDefaultOption as l,
3296
+ index as m,
3297
+ dynamicReportView as n,
3298
+ parseExpression as p,
3299
+ renderCellStyle as r,
3300
+ save as s,
3301
+ validateAndCompleteOptions as v
3302
+ };
3303
+ //# sourceMappingURL=index-eaaf292b.mjs.map