From 2354746d4f224283c2ba6531577876aa8eca9b42 Mon Sep 17 00:00:00 2001 From: chfhtw Date: Mon, 30 Mar 2026 13:34:34 +0200 Subject: [PATCH] more cleanup of dropgrid code & cleanup of dashboard item code --- public/js/components/Dashboard/Item.js | 230 ++++++++++++++----------- public/js/components/Drop/Grid.js | 29 ++-- public/js/components/Drop/Grid/Item.js | 2 +- 3 files changed, 139 insertions(+), 122 deletions(-) diff --git a/public/js/components/Dashboard/Item.js b/public/js/components/Dashboard/Item.js index 79e61293d..956ff5ddf 100644 --- a/public/js/components/Dashboard/Item.js +++ b/public/js/components/Dashboard/Item.js @@ -11,18 +11,15 @@ export default { data: () => ({ component: "", arguments: null, - target: false, widget: null, tmpConfig: {}, isLoading: false, hasConfig: false, - sharedData: null, + sharedData: null }), emits: [ "change", "remove", - "dragstart", - "resizestart", "configOpened", "configClosed", "pinItem", @@ -42,29 +39,25 @@ export default { "place", "setup", "dragstate", - "resizeOverlay", - "additionalRow" + "resizeOverlay" ], computed: { - maxHeight(){ + maxHeight() { + if (Object.prototype.toString.call(this.setup?.height) == "[object Number]") { + return this.setup?.height; + } return this.setup?.height?.max; }, - maxWidth(){ - if (Object.prototype.toString.call(this.setup?.width) == "[object Number]"){ + maxWidth() { + if (Object.prototype.toString.call(this.setup?.width) == "[object Number]") { return this.setup?.width; } return this.setup?.width?.max; }, - minHeight() { - return this.setup?.height?.min; + isResizeable() { + return this.maxWidth > 1 || this.maxHeight > 1; }, - minWidth() { - return this.setup?.width?.min; - }, - isResizeable(){ - return this.maxWidth >1 || this.maxHeight >1; - }, - isPinned(){ + isPinned() { return this.place?.pinned ? true : false; }, ready() { @@ -80,16 +73,16 @@ export default { } }, methods: { - unpin(){ + unpin() { // Unpinning is only possible in edit mode - if(!this.editMode) + 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]); + 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 + @@ -101,22 +94,6 @@ export default { handleHideBsModal() { this.$emit('configClosed') }, - mouseDown(e) { - this.target = e.target; - }, - startDrag(e) { - if (this.$refs.dragHandle.contains(this.target)) { - this.$emit("dragstart", e); - } else if ( - this.isResizeable && - this.$refs.resizeHandle.contains(this.target) - ) { - if (this.isResizeable) this.$emit("resizestart", e); - else e.preventDefault(); - } else { - e.preventDefault(); - } - }, openConfig() { this.tmpConfig = { ...this.arguments }; this.$refs.config.show(); @@ -136,11 +113,11 @@ export default { sendChangeConfig(config) { for (var k in config) { if (this.widget.arguments[k] == config[k]) { - delete config[k]; + delete config[k]; } } this.$emit("change", config); - }, + } }, watch: { config() { @@ -170,75 +147,118 @@ export default { -
-
-
- - - - {{ widget.setup.name }} - - - - - - - - - - -
- -
-
-
-
- -
-
- - - - - - -