Skip to content

Commit 9865b68

Browse files
committed
Fix - VueUiTable - Fix resize issue on chart modal click
1 parent f894b22 commit 9865b68

File tree

2 files changed

+19
-6
lines changed

2 files changed

+19
-6
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,4 +110,4 @@
110110
"vitest": "^3.1.1",
111111
"vue": "^3.5.14"
112112
}
113-
}
113+
}

src/components/vue-ui-table.vue

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -457,6 +457,11 @@
457457
<!-- CHART MODAL -->
458458
<div class="vue-ui-table-chart-modal" v-if="showChart && canChart"
459459
:style="`width: ${modalWidth}px;top:${clientY}px; left:${clientX}px;background:${FINAL_CONFIG.style.chart.modal.backgroundColor};color:${FINAL_CONFIG.style.chart.modal.color}`">
460+
<div class="modal-drag-handle" @mousedown="dragMouseDown">
461+
<!-- Your modal title or drag icon here -->
462+
<span v-html="icons.grip"/>
463+
<button class="close-chart-modal" @click="showChart = false">✖</button>
464+
</div>
460465
<button style="z-index: 1" class="close-chart-modal" @click="showChart = false"
461466
:style="`background:${FINAL_CONFIG.style.closeButtons.backgroundColor};color:${FINAL_CONFIG.style.closeButtons.color};border-radius:${FINAL_CONFIG.style.closeButtons.borderRadius}`">
462467
@@ -474,7 +479,7 @@
474479
:style="`background:${chart.type === constants.BAR && !showDonutOptions ? FINAL_CONFIG.style.chart.modal.buttons.selected.backgroundColor : FINAL_CONFIG.style.chart.modal.buttons.unselected.backgroundColor};color:${chart.type === constants.BAR && !showDonutOptions ? FINAL_CONFIG.style.chart.modal.buttons.selected.color : FINAL_CONFIG.style.chart.modal.buttons.unselected.color}`" />
475480
</div>
476481

477-
<div style="width:100%; height: fit-content; cursor:move" ref="chartModal">
482+
<div style="width:100%; height: fit-content" ref="chartModal">
478483
<!-- DONUT OPTIONS -->
479484
<div v-if="showDonutOptions && availableDonutCategories.length"
480485
:style="`background:${FINAL_CONFIG.style.chart.modal.backgroundColor};color:${FINAL_CONFIG.style.chart.modal.color}`">
@@ -685,8 +690,6 @@ export default {
685690
if (hasChart) {
686691
this.$nextTick(() => {
687692
this.closeDragElement();
688-
const chart = this.$refs.chartModal;
689-
chart.onmousedown = this.dragMouseDown;
690693
})
691694
}
692695
},
@@ -817,6 +820,7 @@ export default {
817820
grid: {
818821
stroke: lightenHexColor(textColor, 0.5),
819822
labels: {
823+
color: textColor,
820824
xAxisLabels: { show: false },
821825
}
822826
},
@@ -1009,7 +1013,8 @@ export default {
10091013
sortZA: `<svg xmlns="http://www.w3.org/2000/svg" width="${this.iconSize}" height="${this.iconSize}" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"/><path d="M15 21v-5c0 -1.38 .62 -2 2 -2s2 .62 2 2v5m0 -3h-4" /><path d="M19 10h-4l4 -7h-4" /><path d="M4 15l3 3l3 -3" /><path d="M7 6v12" /></svg>`,
10101014
sum: `<svg xmlns="http://www.w3.org/2000/svg" width="${this.iconSize}" height="${this.iconSize}" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"/><path d="M18 16v2a1 1 0 0 1 -1 1h-11l6 -7l-6 -7h11a1 1 0 0 1 1 1v2" /></svg>`,
10111015
table: `<svg xmlns="http://www.w3.org/2000/svg" width="${this.iconSize}" height="${this.iconSize}" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" fill="white" d="M 10 2, 21 2, 21 21, 10 21Z"/><path stroke="none" d="M0 0h24v24H0z" fill="none"/><path d="M3 5a2 2 0 0 1 2 -2h14a2 2 0 0 1 2 2v14a2 2 0 0 1 -2 2h-14a2 2 0 0 1 -2 -2v-14z" /><path d="M3 10h18" /><path d="M10 3v18" /></svg>`,
1012-
warning: `<svg xmlns="http://www.w3.org/2000/svg" width="${this.iconSize * 0.8}" height="${this.iconSize * 0.8}" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"/><path d="M10.24 3.957l-8.422 14.06a1.989 1.989 0 0 0 1.7 2.983h16.845a1.989 1.989 0 0 0 1.7 -2.983l-8.423 -14.06a1.989 1.989 0 0 0 -3.4 0z" /><path d="M12 9v4" /><path d="M12 17h.01" /></svg>`
1016+
warning: `<svg xmlns="http://www.w3.org/2000/svg" width="${this.iconSize * 0.8}" height="${this.iconSize * 0.8}" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"/><path d="M10.24 3.957l-8.422 14.06a1.989 1.989 0 0 0 1.7 2.983h16.845a1.989 1.989 0 0 0 1.7 -2.983l-8.423 -14.06a1.989 1.989 0 0 0 -3.4 0z" /><path d="M12 9v4" /><path d="M12 17h.01" /></svg>`,
1017+
grip: `<svg xmlns="http://www.w3.org/2000/svg" width="${this.iconSize}" height="${this.iconSize}" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1" stroke-linecap="round" stroke-linejoin="round"><path d="M5 9m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0" /><path d="M5 15m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0" /><path d="M12 9m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0" /><path d="M12 15m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0" /><path d="M19 9m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0" /><path d="M19 15m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0" /></svg>`
10131018
}
10141019
},
10151020
pages() {
@@ -1750,7 +1755,7 @@ export default {
17501755
const chartModal = this.$refs.chartModal;
17511756
const rect = chartModal.getBoundingClientRect();
17521757
this.clientX = e.clientX - this.dragOffsetX;
1753-
this.clientY = e.clientY - this.dragOffsetY;
1758+
this.clientY = e.clientY - this.dragOffsetY - 40;
17541759
if (this.clientX < 0) this.clientX = 0;
17551760
if (this.clientX + rect.width > window.innerWidth) this.clientX = window.innerWidth - rect.width - 48
17561761
if (this.clientY < 0) this.clientY = 0;
@@ -2376,6 +2381,14 @@ button.th-reset:not(:disabled) {
23762381
color: white;
23772382
}
23782383
2384+
.vue-ui-table-chart-modal .modal-drag-handle {
2385+
cursor: move;
2386+
user-select: none;
2387+
display: flex;
2388+
align-items: center;
2389+
justify-content: space-between;
2390+
}
2391+
23792392
@keyframes open-dropdown {
23802393
0% {
23812394
transform: scale(1, 0.9);

0 commit comments

Comments
 (0)