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/MudBlazorExpandEx.cs |   48 ++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 48 insertions(+), 0 deletions(-)

diff --git a/HotelPms.Client.Blazor/Util/MudBlazorExpandEx.cs b/HotelPms.Client.Blazor/Util/MudBlazorExpandEx.cs
new file mode 100644
index 0000000..3c20160
--- /dev/null
+++ b/HotelPms.Client.Blazor/Util/MudBlazorExpandEx.cs
@@ -0,0 +1,48 @@
+using Microsoft.AspNetCore.Components;
+using Microsoft.JSInterop;
+using MudBlazor;
+using System.Reflection;
+
+namespace HotelPms.Client.Blazor.Util
+{
+    public static class MudBlazorExpandEx
+    {
+        internal static ElementReference GetRef<T>(this MudTextField<T> source)
+        {
+            Type type = source.GetType();
+            BindingFlags flag = BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public;
+            FieldInfo ff = type.GetField("_elementReference", flag);
+            object mudInput = ff.GetValue(source);
+            type = mudInput.GetType();
+            ff = type.GetField("_elementReference", flag);
+            object _elementReference = ff.GetValue(mudInput);  //input or textarea
+            return (ElementReference)_elementReference;
+        }
+
+        public static ValueTask<string> GetInputValue<T>(this MudTextField<T> source, IJSRuntime JSRuntime)
+        {
+            try
+            {
+                ElementReference e = source.InputReference.ElementReference;
+                return JSRuntime.InvokeAsync<string>("NetCallJs.getInputValue", e);
+            }
+            catch
+            {
+                return ValueTask.FromResult(string.Empty);
+            }
+        }
+
+        public static ValueTask SetInputValue<T>(this MudTextField<T> source, IJSRuntime JSRuntime, string value)
+        {
+            try
+            {
+                ElementReference e = source.InputReference.ElementReference;
+                return JSRuntime.InvokeVoidAsync("NetCallJs.setInputValue", e, value);
+            }
+            catch
+            {
+                return ValueTask.CompletedTask;
+            }
+        }
+    }
+}

--
Gitblit v1.10.0