Parcourir la source

fix(env): fit object info tabs to dialog viewport

apple il y a 11 heures
Parent
commit
818d72cab2
1 fichiers modifiés avec 36 ajouts et 0 suppressions
  1. 36 0
      web/page/env/objInfo.ss.jsp

+ 36 - 0
web/page/env/objInfo.ss.jsp

@@ -1,5 +1,16 @@
 <html>
 <head>
+<style>
+	html,
+	body,
+	#objInfoApp {
+		height: 100%;
+	}
+
+	#objInfoApp {
+		overflow: hidden;
+	}
+</style>
 </head>
 <body>
 
@@ -40,6 +51,28 @@
 	window.objInfoNextTabIndex = Number("<txt.ss val='${ssNextTabNo}'/>");
 	window.objInfoTabHeight = <txt.ss val="${tabHeight}"/> || {};
 
+	function objInfoFitDialogToViewport() {
+		if (!wd || !wd.display || typeof wd.display.getwdDialogWindows !== "function")
+			return;
+
+		const dialog = wd.display.getwdDialogWindows();
+		if (!dialog || typeof dialog.getDimension !== "function")
+			return;
+
+		const dimension = dialog.getDimension();
+		const maxWidth = Math.max(320, wd.topWindow.innerWidth - 20);
+		const maxHeight = Math.max(320, wd.topWindow.innerHeight - 20);
+		const width = Math.min(dimension[0], maxWidth);
+		const height = Math.min(dimension[1], maxHeight);
+
+		if (width === dimension[0] && height === dimension[1])
+			return;
+
+		dialog.setDimension(width, height);
+		dialog.keepInViewport(true);
+		dialog.center();
+	}
+
 	function objInfoFitHeight() {
 		const iframe = document.querySelector("#sub-tab-iframe");
 		const param = window.objInfoTabHeight || {};
@@ -131,6 +164,7 @@
 				}
 			},
 			mounted() {
+				setTimeout(objInfoFitDialogToViewport, 0);
 				setTimeout(objInfoFitHeight, 0);
 				this.showTagState("<varServ.ss name='wrTabState' parm='{ssObjName:\"${ssObjName}\",ssObjId:\"${ssObjId}\",\"${ssObjIdName}\":\"${ssObjId}\",dataType:\"${dataType}\"}'/>");
 			}
@@ -152,6 +186,8 @@
 
 		setTimeout(objInfoFitHeight, 200);
 		setTimeout(objInfoFitHeight, 800);
+		setTimeout(objInfoFitDialogToViewport, 200);
+		setTimeout(objInfoFitDialogToViewport, 800);
 	});
 </script>