@mixd-id/web-scaffold 0.2.240701 → 0.2.240703
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/docs/schema/user-action.json +266 -0
- package/package.json +6 -2
- package/public/assets/dashboard/bar.png +0 -0
- package/public/assets/dashboard/doughnut.png +0 -0
- package/public/assets/dashboard/metric.png +0 -0
- package/public/assets/dashboard/pie.png +0 -0
- package/public/assets/dashboard/polar-area.png +0 -0
- package/public/assets/dashboard/virtual-table.png +0 -0
- package/public/static/dashboard/bar.png +0 -0
- package/public/static/dashboard/doughnut.png +0 -0
- package/public/static/dashboard/metric.png +0 -0
- package/public/static/dashboard/pie.png +0 -0
- package/public/static/dashboard/polar-area.png +0 -0
- package/public/static/dashboard/virtual-table.png +0 -0
- package/src/components/Button.vue +179 -160
- package/src/components/Checkbox.vue +0 -1
- package/src/components/Datepicker.vue +8 -6
- package/src/components/GHeatMaps.vue +317 -0
- package/src/components/GmapsDirection.vue +191 -0
- package/src/components/Grid.vue +2 -0
- package/src/components/HTMLEditor.vue +2 -2
- package/src/components/List.vue +384 -308
- package/src/components/Modal.vue +2 -3
- package/src/components/PresetSelectorFilterItem.vue +15 -2
- package/src/components/Switch.vue +3 -0
- package/src/components/Tabs.vue +1 -1
- package/src/components/TextWithTag.vue +67 -25
- package/src/components/Textbox.vue +5 -0
- package/src/components/VirtualGrid.vue +224 -228
- package/src/components/VirtualTable.vue +46 -28
- package/src/configs/dashboard/bar.js +10 -0
- package/src/configs/dashboard/collection-1.js +5 -0
- package/src/configs/dashboard/doughnut.js +7 -0
- package/src/configs/dashboard/gheatmaps.js +9 -0
- package/src/configs/dashboard/grid-2.js +34 -0
- package/src/configs/dashboard/grid-3.js +34 -0
- package/src/configs/dashboard/grid-4.js +34 -0
- package/src/configs/dashboard/grid.js +15 -0
- package/src/configs/dashboard/metric.js +10 -0
- package/src/configs/dashboard/pie.js +7 -0
- package/src/configs/dashboard/polar-area.js +7 -0
- package/src/configs/dashboard/virtual-table.js +9 -0
- package/src/defs/dashboard-preset.js +22 -0
- package/src/index.js +35 -23
- package/src/mixin/ready-state.js +37 -0
- package/src/stores/datasource.js +11 -0
- package/src/themes/default/index.js +1 -1
- package/src/utils/dashboard.js +1080 -0
- package/src/utils/event-bus.js +8 -0
- package/src/utils/helpers.js +56 -10
- package/src/utils/helpers.mjs +35 -1
- package/src/utils/preset-selector.js +5 -2
- package/src/utils/preset-selector.mjs +23 -13
- package/src/widgets/Dashboard/BarChart.vue +330 -0
- package/src/widgets/Dashboard/BarChartSetting.vue +317 -0
- package/src/widgets/Dashboard/DatasourceFilterSharing.vue +93 -0
- package/src/widgets/Dashboard/DatasourcePreview.vue +93 -0
- package/src/widgets/Dashboard/DatasourceSelector.vue +122 -0
- package/src/widgets/Dashboard/Doughnut.vue +157 -0
- package/src/widgets/Dashboard/DoughnutSetting.vue +196 -0
- package/src/widgets/Dashboard/GHeatMapsSetting.vue +108 -0
- package/src/widgets/Dashboard/InteractionEdit.vue +228 -0
- package/src/widgets/Dashboard/Metric.vue +76 -0
- package/src/widgets/Dashboard/MetricSetting.vue +174 -0
- package/src/widgets/Dashboard/Pie.vue +139 -0
- package/src/widgets/Dashboard/PieSetting.vue +247 -0
- package/src/widgets/Dashboard/PolarArea.vue +159 -0
- package/src/widgets/Dashboard/PolarAreaSetting.vue +195 -0
- package/src/widgets/Dashboard/SharingModal.vue +116 -0
- package/src/widgets/Dashboard/ViewSelector.vue +183 -0
- package/src/widgets/Dashboard/VirtualColumnEdit.vue +97 -0
- package/src/widgets/Dashboard/VirtualTableSetting.vue +234 -0
- package/src/widgets/Dashboard.vue +1773 -0
- package/src/widgets/PresetBar.vue +136 -175
- package/src/widgets/PresetBarPivot.vue +186 -0
- package/src/widgets/UserActionBuilder/UserActionCondition.vue +97 -0
- package/src/widgets/UserActionBuilder/UserActionConsole.vue +77 -0
- package/src/widgets/UserActionBuilder/UserActionItem.vue +163 -58
- package/src/widgets/UserActionBuilder/UserActionOutput.vue +35 -9
- package/src/widgets/UserActionBuilder/UserActionOutputDelay.vue +27 -0
- package/src/widgets/UserActionBuilder/UserActionOutputLog.vue +28 -0
- package/src/widgets/UserActionBuilder/UserActionOutputReply.vue +135 -0
- package/src/widgets/UserActionBuilder/UserActionProps.vue +211 -0
- package/src/widgets/UserActionBuilder.vue +68 -199
- package/src/widgets/WebPageBuilder4/GridSetting.vue +123 -73
- package/src/widgets/WebPageBuilder4/HeightSetting.vue +14 -11
- package/src/widgets/WebPageBuilder4/MarginSetting.vue +4 -1
- package/src/widgets/WebPageBuilder4/MultiValueSetting.vue +12 -4
- package/src/widgets/WebPageBuilder4/PaddingSetting.vue +4 -0
- package/src/widgets/WebPageBuilder4/TreeView.vue +6 -3
- package/src/widgets/WebPageBuilder4/TreeViewItem.vue +32 -58
- package/tailwind.config.js +2 -2
|
@@ -17,19 +17,48 @@
|
|
|
17
17
|
<div class="px-2">
|
|
18
18
|
<label class="text-text-300">Presets</label>
|
|
19
19
|
</div>
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
<
|
|
25
|
-
|
|
20
|
+
|
|
21
|
+
<div class="mt-1 flex flex-col divide-y divide-text-50 bg-base-500 border-[1px] border-text-50 overflow-hidden rounded-lg">
|
|
22
|
+
<div v-for="(_preset, idx) in presets" type="button"
|
|
23
|
+
class="px-3 p-2 text-left hover:bg-primary-100 flex flex-row gap-2 items-center group">
|
|
24
|
+
<Radio :checked="config.presetIdx === _preset.uid"
|
|
25
|
+
@click="config.presetIdx = _preset.uid" />
|
|
26
|
+
<button type="button"
|
|
27
|
+
class="flex-1 py-1 text-left overflow-hidden text-ellipsis whitespace-nowrap"
|
|
28
|
+
@click="config.presetIdx = _preset.uid"
|
|
29
|
+
@click.shift="select(_preset.uid)">
|
|
26
30
|
{{ _preset.name }}
|
|
27
31
|
</button>
|
|
28
|
-
<button
|
|
29
|
-
|
|
30
|
-
class="pl-2"
|
|
32
|
+
<button type="button"
|
|
33
|
+
class="pl-2 hidden group-hover:block"
|
|
31
34
|
ref="btn"
|
|
32
|
-
@click="$refs.contextMenu.open($refs.btn[
|
|
35
|
+
@click="$refs.contextMenu.open($refs.btn[idx], { preset:_preset, idx })">
|
|
36
|
+
<svg width="16" height="16" class="fill-text-300 hover:fill-primary" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 128 512"><path d="M64 208c26.5 0 48 21.5 48 48s-21.5 48-48 48-48-21.5-48-48 21.5-48 48-48zM16 104c0 26.5 21.5 48 48 48s48-21.5 48-48-21.5-48-48-48-48 21.5-48 48zm0 304c0 26.5 21.5 48 48 48s48-21.5 48-48-21.5-48-48-48-48 21.5-48 48z"/></svg>
|
|
37
|
+
</button>
|
|
38
|
+
</div>
|
|
39
|
+
</div>
|
|
40
|
+
</div>
|
|
41
|
+
|
|
42
|
+
<div v-if="sharedPresets?.length > 0" class="p-3">
|
|
43
|
+
<div class="px-2">
|
|
44
|
+
<label class="text-text-300">Shared Presets</label>
|
|
45
|
+
</div>
|
|
46
|
+
|
|
47
|
+
<div class="mt-1 flex flex-col divide-y divide-text-50 bg-base-500 border-[1px] border-text-50 overflow-hidden rounded-lg">
|
|
48
|
+
<div v-for="(_preset, idx) in sharedPresets" type="button"
|
|
49
|
+
class="px-3 p-2 text-left hover:bg-primary-100 flex flex-row gap-2 items-center group">
|
|
50
|
+
<Radio :checked="config.presetIdx === _preset.uid"
|
|
51
|
+
@click="config.presetIdx = _preset.uid" />
|
|
52
|
+
<button type="button"
|
|
53
|
+
class="flex-1 py-1 text-left overflow-hidden text-ellipsis whitespace-nowrap"
|
|
54
|
+
@click="config.presetIdx = _preset.uid"
|
|
55
|
+
@click.shift="select(_preset.uid)">
|
|
56
|
+
{{ _preset.name }}
|
|
57
|
+
</button>
|
|
58
|
+
<button type="button"
|
|
59
|
+
class="pl-2 hidden group-hover:block"
|
|
60
|
+
ref="sharedBtn"
|
|
61
|
+
@click="$refs.contextMenu.open($refs.sharedBtn[idx], { preset:_preset, idx, sharing:true })">
|
|
33
62
|
<svg width="16" height="16" class="fill-text-300 hover:fill-primary" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 128 512"><path d="M64 208c26.5 0 48 21.5 48 48s-21.5 48-48 48-48-21.5-48-48 21.5-48 48-48zM16 104c0 26.5 21.5 48 48 48s48-21.5 48-48-21.5-48-48-48-48 21.5-48 48zm0 304c0 26.5 21.5 48 48 48s48-21.5 48-48-21.5-48-48-48-48 21.5-48 48z"/></svg>
|
|
34
63
|
</button>
|
|
35
64
|
</div>
|
|
@@ -40,8 +69,8 @@
|
|
|
40
69
|
<template #default="{ context }">
|
|
41
70
|
<div class="flex flex-col min-w-[200px] divide-y divide-text-50">
|
|
42
71
|
|
|
43
|
-
<button class="w-full p-3 text-left flex flex-row gap-3" :class="appStyle.menuItem"
|
|
44
|
-
@click="select(context.
|
|
72
|
+
<button v-if="!context.sharing" class="w-full p-3 text-left flex flex-row gap-3" :class="appStyle.menuItem"
|
|
73
|
+
@click="select(context.preset.uid)">
|
|
45
74
|
<div class="w-[24px]">
|
|
46
75
|
<svg width="16" height="16" class="mx-auto fill-text-300" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 576 512"><path d="M402.3 344.9l32-32c5-5 13.7-1.5 13.7 5.7V464c0 26.5-21.5 48-48 48H48c-26.5 0-48-21.5-48-48V112c0-26.5 21.5-48 48-48h273.5c7.1 0 10.7 8.6 5.7 13.7l-32 32c-1.5 1.5-3.5 2.3-5.7 2.3H48v352h352V350.5c0-2.1.8-4.1 2.3-5.6zm156.6-201.8L296.3 405.7l-90.4 10c-26.2 2.9-48.5-19.2-45.6-45.6l10-90.4L432.9 17.1c22.9-22.9 59.9-22.9 82.7 0l43.2 43.2c22.9 22.9 22.9 60 .1 82.8zM460.1 174L402 115.9 216.2 301.8l-7.3 65.3 65.3-7.3L460.1 174zm64.8-79.7l-43.2-43.2c-4.1-4.1-10.8-4.1-14.8 0L436 82l58.1 58.1 30.9-30.9c4-4.2 4-10.8-.1-14.9z"/></svg>
|
|
47
76
|
</div>
|
|
@@ -49,15 +78,23 @@
|
|
|
49
78
|
</button>
|
|
50
79
|
|
|
51
80
|
<button class="w-full p-3 text-left flex flex-row gap-3" :class="appStyle.menuItem"
|
|
52
|
-
@click="duplicate(context.
|
|
81
|
+
@click="duplicate(context.preset)">
|
|
53
82
|
<div class="w-[24px]">
|
|
54
83
|
<svg width="16" height="16" class="mx-auto fill-text-300" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><path d="M433.941 65.941l-51.882-51.882A48 48 0 0 0 348.118 0H176c-26.51 0-48 21.49-48 48v48H48c-26.51 0-48 21.49-48 48v320c0 26.51 21.49 48 48 48h224c26.51 0 48-21.49 48-48v-48h80c26.51 0 48-21.49 48-48V99.882a48 48 0 0 0-14.059-33.941zM266 464H54a6 6 0 0 1-6-6V150a6 6 0 0 1 6-6h74v224c0 26.51 21.49 48 48 48h96v42a6 6 0 0 1-6 6zm128-96H182a6 6 0 0 1-6-6V54a6 6 0 0 1 6-6h106v88c0 13.255 10.745 24 24 24h88v202a6 6 0 0 1-6 6zm6-256h-64V48h9.632c1.591 0 3.117.632 4.243 1.757l48.368 48.368a6 6 0 0 1 1.757 4.243V112z"/></svg>
|
|
55
84
|
</div>
|
|
56
85
|
Duplicate
|
|
57
86
|
</button>
|
|
58
87
|
|
|
59
|
-
<button v-if="
|
|
60
|
-
@click="remove(context.
|
|
88
|
+
<button v-if="presets.length > 1 && !context.sharing" class="w-full p-3 text-left flex flex-row gap-3 text-red-500" :class="appStyle.menuItem"
|
|
89
|
+
@click="remove(context.preset.uid)">
|
|
90
|
+
<div class="w-[24px]">
|
|
91
|
+
<svg width="19" height="19" class="mx-auto fill-text-300" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 640 512"><path d="M469.65 181.65l-11.31-11.31c-6.25-6.25-16.38-6.25-22.63 0L384 222.06l-51.72-51.72c-6.25-6.25-16.38-6.25-22.63 0l-11.31 11.31c-6.25 6.25-6.25 16.38 0 22.63L350.06 256l-51.72 51.72c-6.25 6.25-6.25 16.38 0 22.63l11.31 11.31c6.25 6.25 16.38 6.25 22.63 0L384 289.94l51.72 51.72c6.25 6.25 16.38 6.25 22.63 0l11.31-11.31c6.25-6.25 6.25-16.38 0-22.63L417.94 256l51.72-51.72c6.24-6.25 6.24-16.38-.01-22.63zM576 64H205.26C188.28 64 172 70.74 160 82.74L9.37 233.37c-12.5 12.5-12.5 32.76 0 45.25L160 429.25c12 12 28.28 18.75 45.25 18.75H576c35.35 0 64-28.65 64-64V128c0-35.35-28.65-64-64-64zm16 320c0 8.82-7.18 16-16 16H205.26c-4.27 0-8.29-1.66-11.31-4.69L54.63 256l139.31-139.31c3.02-3.02 7.04-4.69 11.31-4.69H576c8.82 0 16 7.18 16 16v256z"/></svg>
|
|
92
|
+
</div>
|
|
93
|
+
Remove
|
|
94
|
+
</button>
|
|
95
|
+
|
|
96
|
+
<button v-else class="w-full p-3 text-left flex flex-row gap-3 text-red-500" :class="appStyle.menuItem"
|
|
97
|
+
@click="removeShared(context.preset.uid)">
|
|
61
98
|
<div class="w-[24px]">
|
|
62
99
|
<svg width="19" height="19" class="mx-auto fill-text-300" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 640 512"><path d="M469.65 181.65l-11.31-11.31c-6.25-6.25-16.38-6.25-22.63 0L384 222.06l-51.72-51.72c-6.25-6.25-16.38-6.25-22.63 0l-11.31 11.31c-6.25 6.25-6.25 16.38 0 22.63L350.06 256l-51.72 51.72c-6.25 6.25-6.25 16.38 0 22.63l11.31 11.31c6.25 6.25 16.38 6.25 22.63 0L384 289.94l51.72 51.72c6.25 6.25 16.38 6.25 22.63 0l11.31-11.31c6.25-6.25 6.25-16.38 0-22.63L417.94 256l51.72-51.72c6.24-6.25 6.24-16.38-.01-22.63zM576 64H205.26C188.28 64 172 70.74 160 82.74L9.37 233.37c-12.5 12.5-12.5 32.76 0 45.25L160 429.25c12 12 28.28 18.75 45.25 18.75H576c35.35 0 64-28.65 64-64V128c0-35.35-28.65-64-64-64zm16 320c0 8.82-7.18 16-16 16H205.26c-4.27 0-8.29-1.66-11.31-4.69L54.63 256l139.31-139.31c3.02-3.02 7.04-4.69 11.31-4.69H576c8.82 0 16 7.18 16 16v256z"/></svg>
|
|
63
100
|
</div>
|
|
@@ -454,157 +491,36 @@
|
|
|
454
491
|
|
|
455
492
|
</div>
|
|
456
493
|
|
|
457
|
-
<div v-else-if="config.presetBarTabIndex === 5" class="flex-1
|
|
458
|
-
|
|
459
|
-
<div>
|
|
460
|
-
<Checkbox v-model="presetPivot.enabled"
|
|
461
|
-
@change="apply()">
|
|
462
|
-
Pivot Enabled
|
|
463
|
-
</Checkbox>
|
|
464
|
-
</div>
|
|
494
|
+
<div v-else-if="config.presetBarTabIndex === 5" class="flex-1 p-6">
|
|
465
495
|
|
|
466
|
-
<
|
|
496
|
+
<PresetBarPivot :pivot="presetPivot" :columns="pivotColumns" @apply="apply"/>
|
|
467
497
|
|
|
468
|
-
|
|
469
|
-
<div class="flex flex-row items-center gap-2">
|
|
470
|
-
<label>Groups</label>
|
|
471
|
-
<button type="button" @click="$refs.columnSelector.open(obj => addPivot('rows', obj), pivotColumns)">
|
|
472
|
-
<svg width="16" height="16" class="fill-primary" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><!--! Font Awesome Pro 6.0.0-alpha3 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) --><path d="M432 256C432 269.3 421.3 280 408 280h-160v160c0 13.25-10.75 24.01-24 24.01S200 453.3 200 440v-160h-160c-13.25 0-24-10.74-24-23.99C16 242.8 26.75 232 40 232h160v-160c0-13.25 10.75-23.99 24-23.99S248 58.75 248 72v160h160C421.3 232 432 242.8 432 256z"/></svg>
|
|
473
|
-
</button>
|
|
474
|
-
</div>
|
|
475
|
-
<ListItem :items="presetPivot.rows"
|
|
476
|
-
@reorder="(from, to) => { presetPivot.rows.splice(to, 0, presetPivot.rows.splice(from, 1)[0]); apply() }"
|
|
477
|
-
class="mt-2 h-[25vh] overflow-y-auto border-[1px] border-text-200 bg-base-400 rounded-lg p-0.5"
|
|
478
|
-
container-class="divide-y divide-text-50">
|
|
479
|
-
<template v-slot="{ item, index }">
|
|
480
|
-
<div class="flex flex-row items-center gap-3 p-2 bg-base-500 hover:bg-primary-100 first:rounded-t-md last:rounded-b-md">
|
|
481
|
-
<div data-reorder v-if="(presetPivot.rows ?? []).length > 1">
|
|
482
|
-
<svg width="14" height="14" class="fill-text-300" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path d="M496 288H16c-8.8 0-16 7.2-16 16v32c0 8.8 7.2 16 16 16h480c8.8 0 16-7.2 16-16v-32c0-8.8-7.2-16-16-16zm0-128H16c-8.8 0-16 7.2-16 16v32c0 8.8 7.2 16 16 16h480c8.8 0 16-7.2 16-16v-32c0-8.8-7.2-16-16-16z"/></svg>
|
|
483
|
-
</div>
|
|
484
|
-
<div class="flex-1 flex flex-row gap-3">
|
|
485
|
-
<strong class="flex-1 cursor-pointer text-ellipsis overflow-hidden whitespace-nowrap"
|
|
486
|
-
@click="$refs.columnSelector.open(obj => { Object.assign(item, obj); apply() }, pivotColumns);">
|
|
487
|
-
{{ item.label ? item.label : item.key }}
|
|
488
|
-
</strong>
|
|
489
|
-
<select v-if="item.type === 'date'"
|
|
490
|
-
v-model="item.aggregrate"
|
|
491
|
-
class="px-1 appearance-none bg-base-300 rounded-md border-[1px] border-text-50 outline-none"
|
|
492
|
-
@change="apply()">
|
|
493
|
-
<option value="hour">Hour</option>
|
|
494
|
-
<option value="date">Date</option>
|
|
495
|
-
<option value="month">Month</option>
|
|
496
|
-
<option value="year">Year</option>
|
|
497
|
-
</select>
|
|
498
|
-
</div>
|
|
499
|
-
<button type="button" @click="presetPivot.rows.splice(index, 1); apply()">
|
|
500
|
-
<svg width="16" height="16" class="fill-text-300 hover:fill-red-500" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 320 512"><path d="M207.6 256l107.72-107.72c6.23-6.23 6.23-16.34 0-22.58l-25.03-25.03c-6.23-6.23-16.34-6.23-22.58 0L160 208.4 52.28 100.68c-6.23-6.23-16.34-6.23-22.58 0L4.68 125.7c-6.23 6.23-6.23 16.34 0 22.58L112.4 256 4.68 363.72c-6.23 6.23-6.23 16.34 0 22.58l25.03 25.03c6.23 6.23 16.34 6.23 22.58 0L160 303.6l107.72 107.72c6.23 6.23 16.34 6.23 22.58 0l25.03-25.03c6.23-6.23 6.23-16.34 0-22.58L207.6 256z"/></svg>
|
|
501
|
-
</button>
|
|
502
|
-
</div>
|
|
503
|
-
</template>
|
|
504
|
-
</ListItem>
|
|
505
|
-
</div>
|
|
498
|
+
</div>
|
|
506
499
|
|
|
507
|
-
|
|
508
|
-
<div class="flex flex-row items-center gap-2">
|
|
509
|
-
<label>Aggregrates</label>
|
|
510
|
-
<button type="button" @click="$refs.columnSelector.open(obj => addPivot('values', obj), pivotColumns)">
|
|
511
|
-
<svg width="16" height="16" class="fill-primary" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><!--! Font Awesome Pro 6.0.0-alpha3 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) --><path d="M432 256C432 269.3 421.3 280 408 280h-160v160c0 13.25-10.75 24.01-24 24.01S200 453.3 200 440v-160h-160c-13.25 0-24-10.74-24-23.99C16 242.8 26.75 232 40 232h160v-160c0-13.25 10.75-23.99 24-23.99S248 58.75 248 72v160h160C421.3 232 432 242.8 432 256z"/></svg>
|
|
512
|
-
</button>
|
|
513
|
-
</div>
|
|
514
|
-
<ListItem :items="presetPivot.values"
|
|
515
|
-
@reorder="(from, to) => { presetPivot.values.splice(to, 0, presetPivot.values.splice(from, 1)[0]); }"
|
|
516
|
-
class="mt-2 h-[25vh] overflow-y-auto border-[1px] border-text-200 bg-base-400 rounded-lg p-0.5"
|
|
517
|
-
container-class="divide-y divide-text-50">
|
|
518
|
-
<template v-slot="{ item, index }">
|
|
519
|
-
<div class="flex flex-row items-center gap-3 p-2 bg-base-500 hover:bg-primary-100 first:rounded-t-md last:rounded-b-md">
|
|
520
|
-
<div data-reorder v-if="(presetPivot.values ?? []).length > 1">
|
|
521
|
-
<svg width="14" height="14" class="fill-text-300" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path d="M496 288H16c-8.8 0-16 7.2-16 16v32c0 8.8 7.2 16 16 16h480c8.8 0 16-7.2 16-16v-32c0-8.8-7.2-16-16-16zm0-128H16c-8.8 0-16 7.2-16 16v32c0 8.8 7.2 16 16 16h480c8.8 0 16-7.2 16-16v-32c0-8.8-7.2-16-16-16z"/></svg>
|
|
522
|
-
</div>
|
|
523
|
-
<div class="flex-1 flex flex-row gap-3">
|
|
524
|
-
<strong class="flex-1 cursor-pointer text-ellipsis overflow-hidden whitespace-nowrap"
|
|
525
|
-
@click="$refs.columnSelector.open(obj => { Object.assign(item, obj); apply() }, pivotColumns);">
|
|
526
|
-
{{ item.label ? item.label : item.key }}
|
|
527
|
-
</strong>
|
|
528
|
-
<select v-model="item.aggregrate"
|
|
529
|
-
class="px-1 appearance-none bg-base-300 w-[80px] rounded-md border-[1px] border-text-50 outline-none"
|
|
530
|
-
@change="apply()">
|
|
531
|
-
<option value="">Default</option>
|
|
532
|
-
<option value="count">Count</option>
|
|
533
|
-
<option value="countDistinct">Distinct Count</option>
|
|
534
|
-
<option v-if="[ 'number' ].includes(item.type)" value="sum">Sum</option>
|
|
535
|
-
<option v-if="[ 'number' ].includes(item.type)" value="avg">Average</option>
|
|
536
|
-
<option v-if="[ 'number' ].includes(item.type)" value="min">Min</option>
|
|
537
|
-
<option v-if="[ 'number' ].includes(item.type)" value="max">Max</option>
|
|
538
|
-
</select>
|
|
539
|
-
</div>
|
|
540
|
-
<button type="button" @click="presetPivot.values.splice(index, 1); apply()">
|
|
541
|
-
<svg width="16" height="16" class="fill-text-300 hover:fill-red-500" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 320 512"><path d="M207.6 256l107.72-107.72c6.23-6.23 6.23-16.34 0-22.58l-25.03-25.03c-6.23-6.23-16.34-6.23-22.58 0L160 208.4 52.28 100.68c-6.23-6.23-16.34-6.23-22.58 0L4.68 125.7c-6.23 6.23-6.23 16.34 0 22.58L112.4 256 4.68 363.72c-6.23 6.23-6.23 16.34 0 22.58l25.03 25.03c6.23 6.23 16.34 6.23 22.58 0L160 303.6l107.72 107.72c6.23 6.23 16.34 6.23 22.58 0l25.03-25.03c6.23-6.23 6.23-16.34 0-22.58L207.6 256z"/></svg>
|
|
542
|
-
</button>
|
|
543
|
-
</div>
|
|
544
|
-
</template>
|
|
545
|
-
</ListItem>
|
|
546
|
-
</div>
|
|
500
|
+
<div v-else-if="config.presetBarTabIndex === 6" class="flex-1 p-6">
|
|
547
501
|
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
@click="delete presetPivot.manualColumns; apply()">Reset</button>
|
|
502
|
+
<div class="flex flex-col gap-1 mt-2">
|
|
503
|
+
<div v-for="(user, index) in preset.sharing"
|
|
504
|
+
class="bg-base-500 hover:bg-text-50 p-3 rounded-lg flex flex-row gap-2 items-center gap-1">
|
|
505
|
+
<div class="flex-1 flex flex-row items-center cursor-default gap-2">
|
|
506
|
+
<svg width="14" height="14" class="fill-text-200" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><!--! Font Awesome Pro 6.0.0-alpha3 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) --><path d="M224 256c70.7 0 128-57.31 128-128s-57.3-128-128-128C153.3 0 96 57.31 96 128S153.3 256 224 256zM274.7 304H173.3C77.61 304 0 381.6 0 477.3c0 19.14 15.52 34.67 34.66 34.67h378.7C432.5 512 448 496.5 448 477.3C448 381.6 370.4 304 274.7 304z"/></svg>
|
|
507
|
+
{{ user.name }}
|
|
555
508
|
</div>
|
|
556
|
-
<
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
container-class="divide-y divide-text-50">
|
|
560
|
-
<template v-slot="{ item, index }">
|
|
561
|
-
<div class="flex flex-row gap-2 items-center px-2 bg-base-500">
|
|
562
|
-
<div data-reorder>
|
|
563
|
-
<svg width="14" height="14" class="fill-text-300" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path d="M496 288H16c-8.8 0-16 7.2-16 16v32c0 8.8 7.2 16 16 16h480c8.8 0 16-7.2 16-16v-32c0-8.8-7.2-16-16-16zm0-128H16c-8.8 0-16 7.2-16 16v32c0 8.8 7.2 16 16 16h480c8.8 0 16-7.2 16-16v-32c0-8.8-7.2-16-16-16z"/></svg>
|
|
564
|
-
</div>
|
|
565
|
-
<Textbox class="flex-1 border-none" :class="$style.columnTextbox" v-model="item.label2" :placeholder="item.label"
|
|
566
|
-
item-class="p-1"/>
|
|
567
|
-
<button type="button" v-if="[ 'number' ].includes(item.type)" @click="">
|
|
568
|
-
<svg width="13" height="13" :class="(item.appearances ?? []).length > 0 ? 'fill-primary' : 'fill-text-300 hover:fill-primary'"
|
|
569
|
-
@click="$refs.presetBarPivotColumnEdit.open(item, next => { Object.assign(item, next); apply() })"
|
|
570
|
-
xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><!--! Font Awesome Pro 6.0.0-alpha3 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) --><path d="M176 0h-128C21.49 0 0 21.49 0 48v128C0 202.5 21.49 224 48 224h128C202.5 224 224 202.5 224 176v-128C224 21.49 202.5 0 176 0zM176 288h-128C21.49 288 0 309.5 0 336v128C0 490.5 21.49 512 48 512h128C202.5 512 224 490.5 224 464v-128C224 309.5 202.5 288 176 288zM464 0h-128C309.5 0 288 21.49 288 48v128C288 202.5 309.5 224 336 224h128C490.5 224 512 202.5 512 176v-128C512 21.49 490.5 0 464 0zM488 376h-64v-64C424 298.8 413.3 288 400 288s-24 10.75-24 24v64h-64c-13.25 0-24 10.75-24 24s10.75 24 24 24h64v64c0 13.25 10.75 24 24 24s24-10.75 24-24v-64h64c13.25 0 24-10.75 24-24S501.3 376 488 376z"/></svg>
|
|
571
|
-
</button>
|
|
572
|
-
<button type="button" @click="presetPivot.columns.splice(index, 1); presetPivot.manualColumns = true; apply()">
|
|
573
|
-
<svg width="16" height="16" class="fill-text-300 hover:fill-red-500" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 320 512"><path d="M207.6 256l107.72-107.72c6.23-6.23 6.23-16.34 0-22.58l-25.03-25.03c-6.23-6.23-16.34-6.23-22.58 0L160 208.4 52.28 100.68c-6.23-6.23-16.34-6.23-22.58 0L4.68 125.7c-6.23 6.23-6.23 16.34 0 22.58L112.4 256 4.68 363.72c-6.23 6.23-6.23 16.34 0 22.58l25.03 25.03c6.23 6.23 16.34 6.23 22.58 0L160 303.6l107.72 107.72c6.23 6.23 16.34 6.23 22.58 0l25.03-25.03c6.23-6.23 6.23-16.34 0-22.58L207.6 256z"/></svg>
|
|
574
|
-
</button>
|
|
575
|
-
</div>
|
|
576
|
-
</template>
|
|
577
|
-
</ListItem>
|
|
578
|
-
|
|
579
|
-
<PresetBarPivotColumnEdit ref="presetBarPivotColumnEdit" />
|
|
509
|
+
<button type="button" @click="removeSharing(index)">
|
|
510
|
+
<svg width="14" height="14" class="fill-text-300 hover:fill-red-600" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 320 512"><!--! Font Awesome Pro 6.0.0-alpha3 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) --><path d="M310.6 361.4c12.5 12.5 12.5 32.75 0 45.25C304.4 412.9 296.2 416 288 416s-16.38-3.125-22.62-9.375L160 301.3L54.63 406.6C48.38 412.9 40.19 416 32 416S15.63 412.9 9.375 406.6c-12.5-12.5-12.5-32.75 0-45.25l105.4-105.4L9.375 150.6c-12.5-12.5-12.5-32.75 0-45.25s32.75-12.5 45.25 0L160 210.8l105.4-105.4c12.5-12.5 32.75-12.5 45.25 0s12.5 32.75 0 45.25l-105.4 105.4L310.6 361.4z"/></svg>
|
|
511
|
+
</button>
|
|
580
512
|
</div>
|
|
581
|
-
|
|
582
|
-
<div class="flex flex-row items-center gap-3">
|
|
583
|
-
<label>Total</label>
|
|
584
|
-
<Switch v-model="presetPivot.useTotal" @change="apply()"/>
|
|
585
|
-
</div>
|
|
586
|
-
|
|
587
513
|
</div>
|
|
588
514
|
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
<strong class="flex-1">Preset</strong>
|
|
596
|
-
<button type="button" class="text-primary" @click="log(preset)">console.log</button>
|
|
597
|
-
</div>
|
|
598
|
-
<ObjectTree :value="preset" />
|
|
515
|
+
<div class="flex justify-center p-5">
|
|
516
|
+
<button type="button" class="text-primary flex flex-row items-center"
|
|
517
|
+
@click="$refs.sharingModal.open([], { callback:addSharing })">
|
|
518
|
+
<svg width="14" height="14" class="fill-primary inline mr-1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><!--! Font Awesome Pro 6.0.0-alpha3 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) --><path d="M432 256c0 17.69-14.33 32.01-32 32.01H256v144c0 17.69-14.33 31.99-32 31.99s-32-14.3-32-31.99v-144H48c-17.67 0-32-14.32-32-32.01s14.33-31.99 32-31.99H192v-144c0-17.69 14.33-32.01 32-32.01s32 14.32 32 32.01v144h144C417.7 224 432 238.3 432 256z"/></svg>
|
|
519
|
+
Share...
|
|
520
|
+
</button>
|
|
599
521
|
</div>
|
|
600
522
|
|
|
601
|
-
<
|
|
602
|
-
<div class="flex flex-row">
|
|
603
|
-
<strong class="flex-1">Config</strong>
|
|
604
|
-
<button type="button" class="text-primary" @click="log(config)">console.log</button>
|
|
605
|
-
</div>
|
|
606
|
-
<ObjectTree :value="config" />
|
|
607
|
-
</div>
|
|
523
|
+
<SharingModal ref="sharingModal" :src="sharingSrc" />
|
|
608
524
|
|
|
609
525
|
</div>
|
|
610
526
|
|
|
@@ -622,19 +538,31 @@
|
|
|
622
538
|
<script>
|
|
623
539
|
|
|
624
540
|
import PresetSelectorFilterItem from "../components/PresetSelectorFilterItem.vue";
|
|
541
|
+
import PresetBarPivot from "./PresetBarPivot.vue";
|
|
542
|
+
import {getPresetUid} from "../utils/preset-selector.mjs";
|
|
543
|
+
import SharingModal from "./Dashboard/SharingModal.vue";
|
|
625
544
|
|
|
626
545
|
export default{
|
|
627
546
|
|
|
628
|
-
components: {PresetSelectorFilterItem},
|
|
547
|
+
components: {SharingModal, PresetBarPivot, PresetSelectorFilterItem},
|
|
629
548
|
|
|
630
|
-
emits: [ 'apply' ],
|
|
549
|
+
emits: [ 'apply', 'duplicate', 'remove', 'remove-shared' ],
|
|
631
550
|
|
|
632
551
|
inject: [ 'appStyle', 'confirm' ],
|
|
633
552
|
|
|
634
553
|
props: {
|
|
635
554
|
|
|
555
|
+
canShare: Boolean,
|
|
556
|
+
|
|
636
557
|
config: Object,
|
|
637
558
|
|
|
559
|
+
presets: Array,
|
|
560
|
+
|
|
561
|
+
sharedPresets: Array,
|
|
562
|
+
|
|
563
|
+
sharingSrc: String,
|
|
564
|
+
removeSharingSrc: String,
|
|
565
|
+
|
|
638
566
|
enumCache: Object
|
|
639
567
|
|
|
640
568
|
},
|
|
@@ -648,11 +576,6 @@ export default{
|
|
|
648
576
|
this.apply()
|
|
649
577
|
},
|
|
650
578
|
|
|
651
|
-
addPivot(type, obj){
|
|
652
|
-
this.presetPivot[type].push(Object.assign({}, obj))
|
|
653
|
-
this.apply()
|
|
654
|
-
},
|
|
655
|
-
|
|
656
579
|
addSort(obj){
|
|
657
580
|
if(!Array.isArray(this.preset.sorts))
|
|
658
581
|
this.preset.sorts = []
|
|
@@ -706,23 +629,61 @@ export default{
|
|
|
706
629
|
return this.preset.columns.filter(_ => _.key === key).pop() ?? {}
|
|
707
630
|
},
|
|
708
631
|
|
|
709
|
-
duplicate(
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
632
|
+
duplicate(preset){
|
|
633
|
+
const uid = getPresetUid()
|
|
634
|
+
|
|
635
|
+
let name = preset.name.substring(0, preset.name.indexOf(' (Copy') > -1 ? preset.name.indexOf(' (Copy') : preset.name.length)
|
|
636
|
+
for(let i = 1 ; i < 100 ; i++){
|
|
637
|
+
const curName = `${name} (Copy${i > 1 ? ' ' + i : ''})`
|
|
638
|
+
if(this.presets.findIndex(_ => _.name === curName) < 0){
|
|
639
|
+
name = curName
|
|
640
|
+
break
|
|
641
|
+
}
|
|
642
|
+
}
|
|
643
|
+
|
|
644
|
+
const newPreset = {
|
|
645
|
+
...JSON.parse(JSON.stringify(preset)),
|
|
646
|
+
name,
|
|
647
|
+
uid
|
|
648
|
+
}
|
|
649
|
+
|
|
650
|
+
this.presets.push(newPreset)
|
|
651
|
+
|
|
652
|
+
this.$emit('duplicate', preset)
|
|
653
|
+
|
|
654
|
+
this.$nextTick(() => this.select(newPreset.uid))
|
|
714
655
|
},
|
|
715
656
|
|
|
716
|
-
remove(
|
|
717
|
-
if(this.
|
|
657
|
+
remove(uid){
|
|
658
|
+
if(this.presets.length > 1){
|
|
718
659
|
this.confirm('Remove this preset?', () => {
|
|
719
|
-
this.
|
|
660
|
+
const index = this.presets.findIndex(_ => _.uid === uid)
|
|
661
|
+
const [ removed ] = this.presets.splice(index, 1)
|
|
662
|
+
this.$emit('remove', removed)
|
|
663
|
+
|
|
664
|
+
const nextIndex = index - 1 >= 0 ? index - 1 : 0
|
|
665
|
+
this.config.presetIdx = this.presets[nextIndex].uid
|
|
720
666
|
})
|
|
721
667
|
}
|
|
722
668
|
},
|
|
723
669
|
|
|
724
|
-
|
|
725
|
-
this
|
|
670
|
+
removeShared(uid){
|
|
671
|
+
this.$emit('remove-shared', uid)
|
|
672
|
+
},
|
|
673
|
+
|
|
674
|
+
addSharing(item){
|
|
675
|
+
if(!Array.isArray(this.preset.sharing))
|
|
676
|
+
this.preset.sharing = []
|
|
677
|
+
|
|
678
|
+
this.$util.push(this.preset.sharing, item, { key:"id" })
|
|
679
|
+
},
|
|
680
|
+
|
|
681
|
+
removeSharing(index){
|
|
682
|
+
this.preset.sharing.splice(index, 1)
|
|
683
|
+
},
|
|
684
|
+
|
|
685
|
+
select(uid){
|
|
686
|
+
this.config.presetIdx = uid
|
|
726
687
|
this.presetBar.view = 2
|
|
727
688
|
this.apply()
|
|
728
689
|
},
|
|
@@ -784,7 +745,7 @@ export default{
|
|
|
784
745
|
},
|
|
785
746
|
|
|
786
747
|
preset(){
|
|
787
|
-
return this.
|
|
748
|
+
return this.presets.find(_ => _.uid === this.config.presetIdx)
|
|
788
749
|
},
|
|
789
750
|
|
|
790
751
|
presetChart(){
|
|
@@ -847,7 +808,7 @@ export default{
|
|
|
847
808
|
...((this.config ?? {}).filters !== false ? [{ text:'Filters', value:2 }] : []),
|
|
848
809
|
...((this.config ?? {}).sorts !== false ? [{ text:'Sorts', value:3 }] : []),
|
|
849
810
|
...((this.config ?? {}).pivot !== false ? [{ text:'Pivot', value:5 }] : []),
|
|
850
|
-
...(
|
|
811
|
+
...(this.canShare ? [{ text:'Sharing', value:6 }] : [])
|
|
851
812
|
],
|
|
852
813
|
chart: [
|
|
853
814
|
...((this.config ?? {}).filters !== false ? [{ text:'Filters', value:2 }] : []),
|
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="flex flex-col gap-6">
|
|
3
|
+
|
|
4
|
+
<div>
|
|
5
|
+
<Checkbox v-model="pivot.enabled"
|
|
6
|
+
@change="apply()">
|
|
7
|
+
Pivot Enabled
|
|
8
|
+
</Checkbox>
|
|
9
|
+
</div>
|
|
10
|
+
|
|
11
|
+
<div class="grid grid-cols-1 gap-6">
|
|
12
|
+
|
|
13
|
+
<div>
|
|
14
|
+
<div class="flex flex-row items-center gap-2">
|
|
15
|
+
<label>Groups</label>
|
|
16
|
+
<button type="button" @click="$refs.columnSelector.open(obj => addPivot('rows', obj), columns)">
|
|
17
|
+
<svg width="16" height="16" class="fill-primary" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><!--! Font Awesome Pro 6.0.0-alpha3 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) --><path d="M432 256C432 269.3 421.3 280 408 280h-160v160c0 13.25-10.75 24.01-24 24.01S200 453.3 200 440v-160h-160c-13.25 0-24-10.74-24-23.99C16 242.8 26.75 232 40 232h160v-160c0-13.25 10.75-23.99 24-23.99S248 58.75 248 72v160h160C421.3 232 432 242.8 432 256z"/></svg>
|
|
18
|
+
</button>
|
|
19
|
+
</div>
|
|
20
|
+
<ListItem :items="pivot.rows"
|
|
21
|
+
@reorder="(from, to) => { pivot.rows.splice(to, 0, pivot.rows.splice(from, 1)[0]); apply() }"
|
|
22
|
+
class="mt-2 h-[25vh] overflow-y-auto border-[1px] border-text-200 bg-base-400 rounded-lg p-0.5"
|
|
23
|
+
container-class="divide-y divide-text-50">
|
|
24
|
+
<template v-slot="{ item, index }">
|
|
25
|
+
<div class="flex flex-row items-center gap-3 p-2 bg-base-500 hover:bg-primary-100 first:rounded-t-md last:rounded-b-md">
|
|
26
|
+
<div data-reorder v-if="(pivot.rows ?? []).length > 1">
|
|
27
|
+
<svg width="14" height="14" class="fill-text-300" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path d="M496 288H16c-8.8 0-16 7.2-16 16v32c0 8.8 7.2 16 16 16h480c8.8 0 16-7.2 16-16v-32c0-8.8-7.2-16-16-16zm0-128H16c-8.8 0-16 7.2-16 16v32c0 8.8 7.2 16 16 16h480c8.8 0 16-7.2 16-16v-32c0-8.8-7.2-16-16-16z"/></svg>
|
|
28
|
+
</div>
|
|
29
|
+
<div class="flex-1 flex flex-row gap-3">
|
|
30
|
+
<strong class="flex-1 cursor-pointer text-ellipsis overflow-hidden whitespace-nowrap"
|
|
31
|
+
@click="$refs.columnSelector.open(obj => { Object.assign(item, obj); apply() }, columns);">
|
|
32
|
+
{{ item.label ? item.label : item.key }}
|
|
33
|
+
</strong>
|
|
34
|
+
<select v-if="item.type === 'date'"
|
|
35
|
+
v-model="item.aggregrate"
|
|
36
|
+
class="px-1 appearance-none bg-base-300 rounded-md border-[1px] border-text-50 outline-none"
|
|
37
|
+
@change="apply()">
|
|
38
|
+
<option value="hour">Hour</option>
|
|
39
|
+
<option value="date">Date</option>
|
|
40
|
+
<option value="month">Month</option>
|
|
41
|
+
<option value="year">Year</option>
|
|
42
|
+
</select>
|
|
43
|
+
</div>
|
|
44
|
+
<button type="button" @click="pivot.rows.splice(index, 1); apply()">
|
|
45
|
+
<svg width="16" height="16" class="fill-text-300 hover:fill-red-500" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 320 512"><path d="M207.6 256l107.72-107.72c6.23-6.23 6.23-16.34 0-22.58l-25.03-25.03c-6.23-6.23-16.34-6.23-22.58 0L160 208.4 52.28 100.68c-6.23-6.23-16.34-6.23-22.58 0L4.68 125.7c-6.23 6.23-6.23 16.34 0 22.58L112.4 256 4.68 363.72c-6.23 6.23-6.23 16.34 0 22.58l25.03 25.03c6.23 6.23 16.34 6.23 22.58 0L160 303.6l107.72 107.72c6.23 6.23 16.34 6.23 22.58 0l25.03-25.03c6.23-6.23 6.23-16.34 0-22.58L207.6 256z"/></svg>
|
|
46
|
+
</button>
|
|
47
|
+
</div>
|
|
48
|
+
</template>
|
|
49
|
+
</ListItem>
|
|
50
|
+
</div>
|
|
51
|
+
|
|
52
|
+
<div>
|
|
53
|
+
<div class="flex flex-row items-center gap-2">
|
|
54
|
+
<label>Aggregrates</label>
|
|
55
|
+
<button type="button" @click="$refs.columnSelector.open(obj => addPivot('values', obj), columns)">
|
|
56
|
+
<svg width="16" height="16" class="fill-primary" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><!--! Font Awesome Pro 6.0.0-alpha3 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) --><path d="M432 256C432 269.3 421.3 280 408 280h-160v160c0 13.25-10.75 24.01-24 24.01S200 453.3 200 440v-160h-160c-13.25 0-24-10.74-24-23.99C16 242.8 26.75 232 40 232h160v-160c0-13.25 10.75-23.99 24-23.99S248 58.75 248 72v160h160C421.3 232 432 242.8 432 256z"/></svg>
|
|
57
|
+
</button>
|
|
58
|
+
</div>
|
|
59
|
+
<ListItem :items="pivot.values"
|
|
60
|
+
@reorder="(from, to) => { pivot.values.splice(to, 0, pivot.values.splice(from, 1)[0]); }"
|
|
61
|
+
class="mt-2 h-[25vh] overflow-y-auto border-[1px] border-text-200 bg-base-400 rounded-lg p-0.5"
|
|
62
|
+
container-class="divide-y divide-text-50">
|
|
63
|
+
<template v-slot="{ item, index }">
|
|
64
|
+
<div class="flex flex-row items-center gap-3 p-2 bg-base-500 hover:bg-primary-100 first:rounded-t-md last:rounded-b-md">
|
|
65
|
+
<div data-reorder v-if="(pivot.values ?? []).length > 1">
|
|
66
|
+
<svg width="14" height="14" class="fill-text-300" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path d="M496 288H16c-8.8 0-16 7.2-16 16v32c0 8.8 7.2 16 16 16h480c8.8 0 16-7.2 16-16v-32c0-8.8-7.2-16-16-16zm0-128H16c-8.8 0-16 7.2-16 16v32c0 8.8 7.2 16 16 16h480c8.8 0 16-7.2 16-16v-32c0-8.8-7.2-16-16-16z"/></svg>
|
|
67
|
+
</div>
|
|
68
|
+
<div class="flex-1 flex flex-row gap-3">
|
|
69
|
+
<strong class="flex-1 cursor-pointer text-ellipsis overflow-hidden whitespace-nowrap"
|
|
70
|
+
@click="$refs.columnSelector.open(obj => { Object.assign(item, obj); apply() }, columns);">
|
|
71
|
+
{{ item.label ? item.label : item.key }}
|
|
72
|
+
</strong>
|
|
73
|
+
<select v-model="item.aggregrate"
|
|
74
|
+
class="px-1 appearance-none bg-base-300 w-[80px] rounded-md border-[1px] border-text-50 outline-none"
|
|
75
|
+
@change="apply()">
|
|
76
|
+
<option value="">Default</option>
|
|
77
|
+
<option value="count">Count</option>
|
|
78
|
+
<option value="countDistinct">Distinct Count</option>
|
|
79
|
+
<option v-if="[ 'number' ].includes(item.type)" value="sum">Sum</option>
|
|
80
|
+
<option v-if="[ 'number' ].includes(item.type)" value="avg">Average</option>
|
|
81
|
+
<option v-if="[ 'number' ].includes(item.type)" value="min">Min</option>
|
|
82
|
+
<option v-if="[ 'number' ].includes(item.type)" value="max">Max</option>
|
|
83
|
+
</select>
|
|
84
|
+
</div>
|
|
85
|
+
<button type="button" @click="pivot.values.splice(index, 1); apply()">
|
|
86
|
+
<svg width="16" height="16" class="fill-text-300 hover:fill-red-500" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 320 512"><path d="M207.6 256l107.72-107.72c6.23-6.23 6.23-16.34 0-22.58l-25.03-25.03c-6.23-6.23-16.34-6.23-22.58 0L160 208.4 52.28 100.68c-6.23-6.23-16.34-6.23-22.58 0L4.68 125.7c-6.23 6.23-6.23 16.34 0 22.58L112.4 256 4.68 363.72c-6.23 6.23-6.23 16.34 0 22.58l25.03 25.03c6.23 6.23 16.34 6.23 22.58 0L160 303.6l107.72 107.72c6.23 6.23 16.34 6.23 22.58 0l25.03-25.03c6.23-6.23 6.23-16.34 0-22.58L207.6 256z"/></svg>
|
|
87
|
+
</button>
|
|
88
|
+
</div>
|
|
89
|
+
</template>
|
|
90
|
+
</ListItem>
|
|
91
|
+
</div>
|
|
92
|
+
|
|
93
|
+
<div>
|
|
94
|
+
<div class="flex flex-row items-center gap-2">
|
|
95
|
+
<label class="flex-1">Columns</label>
|
|
96
|
+
<button v-if="pivot.manualColumns"
|
|
97
|
+
type="button"
|
|
98
|
+
class="text-primary"
|
|
99
|
+
@click="delete pivot.manualColumns; apply()">Reset</button>
|
|
100
|
+
</div>
|
|
101
|
+
<ListItem :items="pivot.columns"
|
|
102
|
+
@reorder="(from, to) => { pivot.columns.splice(to, 0, pivot.columns.splice(from, 1)[0]); pivot.manualColumns = true; apply() }"
|
|
103
|
+
class="mt-2 h-[25vh] overflow-y-auto border-[1px] border-text-200 bg-base-400 rounded-lg p-0.5"
|
|
104
|
+
container-class="divide-y divide-text-50">
|
|
105
|
+
<template v-slot="{ item, index }">
|
|
106
|
+
<div class="flex flex-row gap-2 items-center px-2 bg-base-500">
|
|
107
|
+
<div data-reorder>
|
|
108
|
+
<svg width="14" height="14" class="fill-text-300" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path d="M496 288H16c-8.8 0-16 7.2-16 16v32c0 8.8 7.2 16 16 16h480c8.8 0 16-7.2 16-16v-32c0-8.8-7.2-16-16-16zm0-128H16c-8.8 0-16 7.2-16 16v32c0 8.8 7.2 16 16 16h480c8.8 0 16-7.2 16-16v-32c0-8.8-7.2-16-16-16z"/></svg>
|
|
109
|
+
</div>
|
|
110
|
+
<Textbox class="flex-1 border-none" :class="$style.columnTextbox" v-model="item.label2" :placeholder="item.label"
|
|
111
|
+
item-class="p-1"/>
|
|
112
|
+
<button type="button" v-if="[ 'number' ].includes(item.type)" @click="">
|
|
113
|
+
<svg width="13" height="13" :class="(item.appearances ?? []).length > 0 ? 'fill-primary' : 'fill-text-300 hover:fill-primary'"
|
|
114
|
+
@click="$refs.presetBarPivotColumnEdit.open(item, next => { Object.assign(item, next); apply() })"
|
|
115
|
+
xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><!--! Font Awesome Pro 6.0.0-alpha3 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) --><path d="M176 0h-128C21.49 0 0 21.49 0 48v128C0 202.5 21.49 224 48 224h128C202.5 224 224 202.5 224 176v-128C224 21.49 202.5 0 176 0zM176 288h-128C21.49 288 0 309.5 0 336v128C0 490.5 21.49 512 48 512h128C202.5 512 224 490.5 224 464v-128C224 309.5 202.5 288 176 288zM464 0h-128C309.5 0 288 21.49 288 48v128C288 202.5 309.5 224 336 224h128C490.5 224 512 202.5 512 176v-128C512 21.49 490.5 0 464 0zM488 376h-64v-64C424 298.8 413.3 288 400 288s-24 10.75-24 24v64h-64c-13.25 0-24 10.75-24 24s10.75 24 24 24h64v64c0 13.25 10.75 24 24 24s24-10.75 24-24v-64h64c13.25 0 24-10.75 24-24S501.3 376 488 376z"/></svg>
|
|
116
|
+
</button>
|
|
117
|
+
<button type="button" @click="pivot.columns.splice(index, 1); pivot.manualColumns = true; apply()">
|
|
118
|
+
<svg width="16" height="16" class="fill-text-300 hover:fill-red-500" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 320 512"><path d="M207.6 256l107.72-107.72c6.23-6.23 6.23-16.34 0-22.58l-25.03-25.03c-6.23-6.23-16.34-6.23-22.58 0L160 208.4 52.28 100.68c-6.23-6.23-16.34-6.23-22.58 0L4.68 125.7c-6.23 6.23-6.23 16.34 0 22.58L112.4 256 4.68 363.72c-6.23 6.23-6.23 16.34 0 22.58l25.03 25.03c6.23 6.23 16.34 6.23 22.58 0L160 303.6l107.72 107.72c6.23 6.23 16.34 6.23 22.58 0l25.03-25.03c6.23-6.23 6.23-16.34 0-22.58L207.6 256z"/></svg>
|
|
119
|
+
</button>
|
|
120
|
+
</div>
|
|
121
|
+
</template>
|
|
122
|
+
</ListItem>
|
|
123
|
+
|
|
124
|
+
</div>
|
|
125
|
+
|
|
126
|
+
<div class="flex flex-row items-center gap-3">
|
|
127
|
+
<label>Total</label>
|
|
128
|
+
<Switch v-model="pivot.useTotal" @change="apply()"/>
|
|
129
|
+
</div>
|
|
130
|
+
|
|
131
|
+
</div>
|
|
132
|
+
|
|
133
|
+
<ColumnSelector ref="columnSelector" />
|
|
134
|
+
|
|
135
|
+
<PresetBarPivotColumnEdit ref="presetBarPivotColumnEdit" />
|
|
136
|
+
|
|
137
|
+
</div>
|
|
138
|
+
</template>
|
|
139
|
+
|
|
140
|
+
<script>
|
|
141
|
+
|
|
142
|
+
import PresetBarPivotColumnEdit from "./PresetBarPivotColumnEdit.vue";
|
|
143
|
+
import ColumnSelector from "./ColumnSelector.vue";
|
|
144
|
+
|
|
145
|
+
export default{
|
|
146
|
+
components: {ColumnSelector, PresetBarPivotColumnEdit},
|
|
147
|
+
|
|
148
|
+
emits: [ 'apply' ],
|
|
149
|
+
|
|
150
|
+
methods: {
|
|
151
|
+
|
|
152
|
+
apply(){
|
|
153
|
+
this.$emit('apply')
|
|
154
|
+
},
|
|
155
|
+
|
|
156
|
+
addPivot(type, obj){
|
|
157
|
+
console.log(this.pivot, type)
|
|
158
|
+
this.pivot[type].push(Object.assign({}, obj))
|
|
159
|
+
this.apply()
|
|
160
|
+
},
|
|
161
|
+
|
|
162
|
+
},
|
|
163
|
+
|
|
164
|
+
props:{
|
|
165
|
+
|
|
166
|
+
columns: Array,
|
|
167
|
+
|
|
168
|
+
pivot: Object
|
|
169
|
+
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
</script>
|
|
175
|
+
|
|
176
|
+
<style module>
|
|
177
|
+
|
|
178
|
+
.comp{
|
|
179
|
+
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
.columnTextbox input::placeholder{
|
|
183
|
+
@apply text-text;
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
</style>
|