From 1a1c8e71fcd14858f595029f089b2d4a00202b32 Mon Sep 17 00:00:00 2001
From: ogi <Administrator@S-OGI-PC>
Date: Fri, 05 Dec 2025 09:24:16 +0900
Subject: [PATCH] プロジェクトファイルを追加。

---
 HotelPms.Client.Blazor/Util/JSInteropEx.cs |   62 +++++++++++++++++++++++++++++++
 1 files changed, 62 insertions(+), 0 deletions(-)

diff --git a/HotelPms.Client.Blazor/Util/JSInteropEx.cs b/HotelPms.Client.Blazor/Util/JSInteropEx.cs
new file mode 100644
index 0000000..7e7e326
--- /dev/null
+++ b/HotelPms.Client.Blazor/Util/JSInteropEx.cs
@@ -0,0 +1,62 @@
+using Microsoft.JSInterop;
+
+namespace HotelPms.Client.Blazor.Util
+{
+    public static class JSInteropEx
+    {
+        public static async Task SaveAsFileAsync(this IJSRuntime js, string fileName, byte[] data, string type = "application/octet-stream", bool useBom = false)
+        {
+            await js.InvokeAsync<object>("NetCallJs.saveAsFile", fileName, type, Convert.ToBase64String(data), useBom);
+        }
+
+        public static async Task SetTRTop(this IJSRuntime js, string ownerID, int rowIndex)
+        {
+            await js.InvokeAsync<object>("NetCallJs.setTRTop", ownerID, rowIndex);
+        }
+
+        public static async Task SetGridWidth(this IJSRuntime js, string ownerID, string width)
+        {
+            await js.InvokeAsync<object>("NetCallJs.setTableWidth", ownerID, width);
+        }
+
+        public static async Task DelGridCol(this IJSRuntime js, string ownerID, int colIndex)
+        {
+            await js.InvokeAsync<object>("NetCallJs.delTableCol", ownerID, colIndex);
+        }
+
+        public static async Task SetGridStyle(this IJSRuntime js, string ownerID, string style)
+        {
+            await js.InvokeAsync<object>("NetCallJs.setTableStyle", ownerID, style);
+        }
+
+        public static async Task RemoveGridClass(this IJSRuntime js, string ownerID, string className)
+        {
+            await js.InvokeAsync<object>("NetCallJs.removeTableClass", ownerID, className);
+        }
+
+        public static async Task<BoundingClientRect> GetClientRectByID(this IJSRuntime js, string id)
+        {
+            return await js.InvokeAsync<BoundingClientRect>("NetCallJs.getClientRectByID", id);
+        }
+
+        /// <summary>
+        /// 注意:約0.8秒かかる
+        /// </summary>
+        /// <param name="js"></param>
+        /// <returns></returns>
+        public static async Task<WindowDimensions> GetWindowSize(this IJSRuntime js)
+        {
+            return await js.InvokeAsync<WindowDimensions>("NetCallJs.getWindowSize");
+        }
+
+        public static async Task<ElementBase> GetActiveElement(this IJSRuntime js)
+        {
+            return await js.InvokeAsync<ElementBase>("NetCallJs.getActiveElement");
+        }
+
+        public static async Task SetFocusByKey(this IJSRuntime js, string key)
+        {
+            await js.InvokeAsync<object>("NetCallJs.setFocusByKey", key);
+        }
+    }
+}

--
Gitblit v1.10.0