diff --git a/application/libraries/dashboard/DashboardLib.php b/application/libraries/dashboard/DashboardLib.php index 7aab6b949..f6d7d6599 100644 --- a/application/libraries/dashboard/DashboardLib.php +++ b/application/libraries/dashboard/DashboardLib.php @@ -107,7 +107,7 @@ class DashboardLib $emptyoverride = new stdClass(); $emptyoverride->dashboard_id = $dashboard->dashboard_id; $emptyoverride->uid = $uid; - $emptyoverride->override = '{"' . self::USEROVERRIDE_SECTION . '": {"widgets":{}}}}'; + $emptyoverride->override = '{"' . self::USEROVERRIDE_SECTION . '": {"widgets":{}}, "custom": { "widgets" : {}}}'; return $emptyoverride; } diff --git a/public/css/components/dashboard.css b/public/css/components/dashboard.css index ddb5aff14..b4c82254f 100644 --- a/public/css/components/dashboard.css +++ b/public/css/components/dashboard.css @@ -16,6 +16,18 @@ color: var(--fhc-link); } +@media (max-width: 576px){ + .widget-icon { + max-height: 250px; + object-fit: cover; + } + .widget-icon-container{ + max-width: 250px; + margin-left: auto; + margin-right: auto; + } +} + .empty-tile-hover { height: 100%; width: 100%; @@ -30,6 +42,23 @@ height: 100%; width: 100%; background-color:white; + position:relative; +} + +.dashboard-section > .newGridRow{ + position:absolute; + width:20px; + height:20px; + padding:0; + bottom:0; + left:50%; + transform:translate(-50%, 50%); + background-color:white; +} + +.newGridRow:hover { + color:white; + background-color:#6c757d; } .empty-tile-hover:hover { diff --git a/public/js/apps/Dashboard/Fhc.js b/public/js/apps/Dashboard/Fhc.js index e38cd7d6d..a7c88874e 100644 --- a/public/js/apps/Dashboard/Fhc.js +++ b/public/js/apps/Dashboard/Fhc.js @@ -300,6 +300,7 @@ app.use(primevue.config.default, { tooltip: 8000 } }) +app.directive('tooltip', primevue.tooltip); app.use(PluginsPhrasen); app.use(Theme); app.directive('contrast', contrast); diff --git a/public/js/components/Dashboard/Dashboard.js b/public/js/components/Dashboard/Dashboard.js index a463ff20b..825bad3f7 100644 --- a/public/js/components/Dashboard/Dashboard.js +++ b/public/js/components/Dashboard/Dashboard.js @@ -177,7 +177,13 @@ export default { }); remove.forEach(wid => this.widgetRemove(name, wid)); } - this.sections = this.sections.sort((section1, section2) => section2.widgets.length - section1.widgets.length); + this.sections = this.sections.sort((section1, section2) => { + if(section1.name == 'custom') + return 1; + if (section2.name == 'custom') + return -1; + return section2.widgets.length - section1.widgets.length; + }); }).catch(err => console.error('ERROR:', err)); }, async beforeMount() { diff --git a/public/js/components/Dashboard/Item.js b/public/js/components/Dashboard/Item.js index b7a334b92..68a92e701 100644 --- a/public/js/components/Dashboard/Item.js +++ b/public/js/components/Dashboard/Item.js @@ -41,6 +41,9 @@ export default { "item_data", "place", "setup", + "dragstate", + "resizeOverlay", + "additionalRow" ], computed: { maxHeight(){ @@ -153,7 +156,8 @@ export default { -
{{ widget.beschreibung }}
diff --git a/public/js/components/Drop/Grid.js b/public/js/components/Drop/Grid.js index 44ca0a603..55b9b1bbd 100644 --- a/public/js/components/Drop/Grid.js +++ b/public/js/components/Drop/Grid.js @@ -26,6 +26,10 @@ export default { type: Number, default: 0 }, + additionalRow:{ + type: Boolean, + default: false, + } }, emits: [ "rearrangeItems", @@ -48,7 +52,6 @@ export default { draggedOffset: [0,0], draggedItem: null, draggedNode: null, - additionalRow: null, reorderedItems:[], clonedWidget:null, } @@ -60,6 +63,14 @@ export default { }, }, computed: { + additionalRowComputed: { + get() { + return this.additionalRow; + }, + set(value) { + this.$emit('update:additionalRow', value); + } + }, items_hashmap() { let items = {}; this.items.forEach(item => { @@ -117,10 +128,19 @@ export default { return [...this.placedItems, ...this.items_placeholders]; }, rows() { - if ((this.mode == MODE_MOVE || this.mode == MODE_RESIZE) && this.dragGrid){ - return this.dragGrid.h; + if (this.additionalRowComputed) { + return this.grid ? (this.grid.h+1) : 1; } return this.grid ? this.grid.h : 1; + /* if ((this.mode == MODE_MOVE || this.mode == MODE_RESIZE) && this.dragGrid){ + return this.dragGrid.h; + } + if (this.mode == MODE_IDLE) { + if (this.additionalRowComputed) { + return this.grid ? (this.grid.h+1) : 1; + } + } + return this.grid ? this.grid.h : 1; */ }, gridStyle() { const addH = this.active ? this.marginForExtraRow : 0; @@ -347,17 +367,12 @@ export default { }); }, mouseLeave() { - if (this.mode == MODE_IDLE) { + /* if (this.mode == MODE_IDLE) { this.x = -1; this.y = -1; - if (this.additionalRow !== null) { - let gridHeight = this.grid.getMaxY() + 1; - if(this.grid.h>gridHeight){ - this.grid.h = gridHeight; - } - this.additionalRow = null; - } - } + this.additionalRowComputed = false; + + } */ }, updateCursor(evt) { if (!this.active) { @@ -380,18 +395,6 @@ export default { if (this.x == gridX && this.y == gridY) return false; - if (this.mode == MODE_IDLE) { - if (this.additionalRow === null && this.y == this.rows-1 && gridY == this.rows) { - this.additionalRow = this.grid.h; - this.grid.h += 1; - } else if (this.additionalRow !== null && gridY != this.rows - 1) { - let gridHeight = this.grid.getMaxY() + 1; - if(this.grid.h > gridHeight){ - this.grid.h = gridHeight; - } - this.additionalRow = null; - } - } this.x = gridX; this.y = gridY; @@ -405,6 +408,7 @@ export default { } }, startMove(evt, item) { + if (!this.active) return; @@ -413,14 +417,15 @@ export default { this.grid.h += 1; this.draggedItem = item; this.$emit('draggedItem',item); - this.draggedNode = evt.target; + + this.draggedNode = evt.target.closest(".drop-grid-item"); //clones the widget for the drag Image - let clone = evt.target.cloneNode(true); + let clone = evt.target.closest(".drop-grid-item")?.cloneNode(true); + clone.style.zIndex = 5; clone.classList.add("widgetClone"); this.$refs.container.appendChild(clone); this.clonedWidget = clone; - this.draggedOffset = [item.x - this.x, item.y - this.y]; this._dragStart(evt, item); }, @@ -480,6 +485,7 @@ export default { } }, dragCancel() { + this.additionalRowComputed = false; this.toggleDraggedItemOverlay(false); this.mode = MODE_IDLE; this.positionUpdates = null; @@ -498,9 +504,10 @@ export default { Array.from(document.getElementsByClassName("denied-dragging-animation"))?.forEach(ele => { ele.classList.remove("denied-dragging-animation"); }) + let widgetClones = document.getElementsByClassName("widgetClone"); - for(let widget of widgetClones){ - this.$refs.container.removeChild(widget); + for (let i=0; i