From 9b9b8b1532e0ebde6f87805939ee102e9bfcec8f Mon Sep 17 00:00:00 2001 From: SimonGschnell Date: Wed, 9 Apr 2025 10:50:19 +0200 Subject: [PATCH] feature(CIS Dashboard gridsystem): allows to pin widgets in the grid and changes how widgets are positioned in different viewports --- public/css/components/dashboard.css | 12 +-- public/js/components/Dashboard/Item.js | 39 ++++++- public/js/components/Dashboard/Section.js | 85 ++++----------- public/js/components/Drop/Grid.js | 126 +++++++++++++++++++--- public/js/composables/GridLogic.js | 65 ++++++++++- 5 files changed, 233 insertions(+), 94 deletions(-) diff --git a/public/css/components/dashboard.css b/public/css/components/dashboard.css index 1a9808e0c..47ce239ee 100644 --- a/public/css/components/dashboard.css +++ b/public/css/components/dashboard.css @@ -77,12 +77,10 @@ z-index: 2; } -.dragged-widget-icon{ - position: absolute; - height: 250px; - width: 200px; - top: -999px; - left: -999px; - z-index: 3; +.pin:hover{ + cursor: pointer; } +.pin[pinned]:hover{ + color:rgb(153, 116, 116); +} diff --git a/public/js/components/Dashboard/Item.js b/public/js/components/Dashboard/Item.js index b78659a96..33e614531 100644 --- a/public/js/components/Dashboard/Item.js +++ b/public/js/components/Dashboard/Item.js @@ -24,7 +24,9 @@ export default { "dragstart", "resizestart", "configOpened", - "configClosed" + "configClosed", + "pinItem", + "unPinItem" ], props: [ "id", @@ -36,8 +38,13 @@ export default { "hidden", "editMode", "loading", + "item_data", + "place", ], computed: { + isPinned(){ + return this.place?.pinned ? true : false; + }, isResizeable() { if (!this.widget) return false; return this.widget.setup.width.max || this.widget.setup.height.max; @@ -47,6 +54,17 @@ export default { }, }, methods: { + unpin(){ + // Unpinning is only possible in edit mode + if(!this.editMode) + return; + let result = { item: this.item_data, x: this.item_data.x, y: this.item_data.y }; + this.$emit('unPinItem', [result]); + }, + pinItem(){ + let result = { item: this.item_data, x: this.item_data.x, y: this.item_data.y}; + this.$emit('pinItem',[result]); + }, getWidgetC4Link(widget) { return (FHC_JS_DATA_STORAGE_OBJECT.app_root + FHC_JS_DATA_STORAGE_OBJECT.ci_router + widget.setup.cis4link) @@ -120,12 +138,25 @@ export default { -
+
- + {{ widget.setup.name }} + + @@ -157,7 +188,7 @@ export default { -