對「容器」執行 「截斷 (Clipping)」,只允許內部滑動。
Browse files核心修正策略:
最外層 (#booking_table):overflow: hidden (絕對禁止溢出,殺死外層捲軸)。
中間層 (.wrap):width: 100% (強制跟隨螢幕寬度,不准被內容撐大)。
捲動層 (tbody-wrap / table-wrap):overflow-x: auto (唯一允許捲動的地方)。
內容層 (table):width: 1470px (這是您所有欄位寬度的總和,強制撐開)。
app.py
CHANGED
|
@@ -38,7 +38,6 @@ def send_confirmation_hybrid(booking_id):
|
|
| 38 |
email, user_id = booking.get('email'), booking.get('user_id')
|
| 39 |
log_msg = ""
|
| 40 |
|
| 41 |
-
confirm_link = f"{PUBLIC_SPACE_URL}/?id={booking_id}&action=confirm"
|
| 42 |
confirm_link = f"{PUBLIC_SPACE_URL}/?id={booking_id}&action=confirm"
|
| 43 |
cancel_link = f"{PUBLIC_SPACE_URL}/?id={booking_id}&action=cancel"
|
| 44 |
|
|
@@ -132,38 +131,28 @@ def check_login(user, password):
|
|
| 132 |
error_msg: "<span style='color: red'>❌ 帳號或密碼錯誤</span>"
|
| 133 |
}
|
| 134 |
|
| 135 |
-
# --- 🔥 [
|
| 136 |
custom_css = """
|
| 137 |
-
/* 1.
|
| 138 |
-
|
| 139 |
-
overflow: hidden
|
| 140 |
-
display: block -> 確保它以區塊顯示
|
| 141 |
*/
|
| 142 |
-
#booking_table
|
| 143 |
-
|
| 144 |
-
|
| 145 |
-
max-width: 100vw !important;
|
| 146 |
-
overflow: hidden !important;
|
| 147 |
-
padding: 0 !important;
|
| 148 |
-
margin: 0 !important;
|
| 149 |
-
border: none !important;
|
| 150 |
-
}
|
| 151 |
-
|
| 152 |
-
/* 2. 鎖定中間層 (Gradio 的包裝層):
|
| 153 |
-
這些通常是產生外層捲軸的元兇,全部隱藏 overflow
|
| 154 |
-
*/
|
| 155 |
-
#booking_table .wrap,
|
| 156 |
-
#booking_table .svelte-12cmxck {
|
| 157 |
width: 100% !important;
|
| 158 |
max-width: 100vw !important;
|
| 159 |
overflow: hidden !important;
|
|
|
|
| 160 |
}
|
| 161 |
|
| 162 |
-
/*
|
| 163 |
-
|
| 164 |
-
|
| 165 |
*/
|
| 166 |
-
#booking_table .table-wrap
|
|
|
|
|
|
|
| 167 |
width: 100% !important;
|
| 168 |
overflow-x: auto !important;
|
| 169 |
overflow-y: hidden !important;
|
|
@@ -171,21 +160,21 @@ custom_css = """
|
|
| 171 |
display: block !important;
|
| 172 |
}
|
| 173 |
|
| 174 |
-
/*
|
| 175 |
-
width:
|
| 176 |
-
table-layout: fixed ->
|
| 177 |
*/
|
| 178 |
#booking_table table {
|
| 179 |
table-layout: fixed !important;
|
| 180 |
-
width:
|
| 181 |
-
min-width:
|
| 182 |
border-collapse: collapse !important;
|
| 183 |
margin: 0 !important;
|
| 184 |
}
|
| 185 |
|
| 186 |
-
/*
|
| 187 |
white-space: normal -> 允許換行
|
| 188 |
-
word-break: break-all -> 強制換行
|
| 189 |
*/
|
| 190 |
#booking_table th, #booking_table td {
|
| 191 |
display: table-cell !important;
|
|
@@ -201,7 +190,7 @@ custom_css = """
|
|
| 201 |
line-height: 1.4 !important;
|
| 202 |
}
|
| 203 |
|
| 204 |
-
/*
|
| 205 |
#booking_table th:nth-child(1), #booking_table td:nth-child(1) { width: 60px !important; }
|
| 206 |
#booking_table th:nth-child(2), #booking_table td:nth-child(2) { width: 170px !important; }
|
| 207 |
#booking_table th:nth-child(3), #booking_table td:nth-child(3) { width: 80px !important; }
|
|
|
|
| 38 |
email, user_id = booking.get('email'), booking.get('user_id')
|
| 39 |
log_msg = ""
|
| 40 |
|
|
|
|
| 41 |
confirm_link = f"{PUBLIC_SPACE_URL}/?id={booking_id}&action=confirm"
|
| 42 |
cancel_link = f"{PUBLIC_SPACE_URL}/?id={booking_id}&action=cancel"
|
| 43 |
|
|
|
|
| 131 |
error_msg: "<span style='color: red'>❌ 帳號或密碼錯誤</span>"
|
| 132 |
}
|
| 133 |
|
| 134 |
+
# --- 🔥 [雙重捲軸修正 CSS] 🔥 ---
|
| 135 |
custom_css = """
|
| 136 |
+
/* 1. 【鎖死外層】
|
| 137 |
+
將 #booking_table 及其直接包裝層 (.wrap) 的寬度鎖死在 100%。
|
| 138 |
+
並且 overflow: hidden 強制切斷超出部分。這會消滅外層捲軸。
|
|
|
|
| 139 |
*/
|
| 140 |
+
#booking_table,
|
| 141 |
+
#booking_table > .wrap,
|
| 142 |
+
#booking_table .gradio-container {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 143 |
width: 100% !important;
|
| 144 |
max-width: 100vw !important;
|
| 145 |
overflow: hidden !important;
|
| 146 |
+
display: block !important;
|
| 147 |
}
|
| 148 |
|
| 149 |
+
/* 2. 【開啟內層】
|
| 150 |
+
找到真正包含表格的容器 (通常是 table-wrap 或 tbody-wrap),
|
| 151 |
+
只讓它擁有 overflow-x: auto。
|
| 152 |
*/
|
| 153 |
+
#booking_table .table-wrap,
|
| 154 |
+
#booking_table div[class*="table"],
|
| 155 |
+
#booking_table .tbody-wrap {
|
| 156 |
width: 100% !important;
|
| 157 |
overflow-x: auto !important;
|
| 158 |
overflow-y: hidden !important;
|
|
|
|
| 160 |
display: block !important;
|
| 161 |
}
|
| 162 |
|
| 163 |
+
/* 3. 【撐開內容】
|
| 164 |
+
width: 1470px -> 將表格寬度設定為您所有欄位寬度的總和。
|
| 165 |
+
table-layout: fixed -> 強制每個欄位遵守寬度設定。
|
| 166 |
*/
|
| 167 |
#booking_table table {
|
| 168 |
table-layout: fixed !important;
|
| 169 |
+
width: 1470px !important; /* 60+170+80+120+120+250+50+180+120+320 = 1470 */
|
| 170 |
+
min-width: 1470px !important;
|
| 171 |
border-collapse: collapse !important;
|
| 172 |
margin: 0 !important;
|
| 173 |
}
|
| 174 |
|
| 175 |
+
/* 4. 【欄位行為】
|
| 176 |
white-space: normal -> 允許換行
|
| 177 |
+
word-break: break-all -> 強制換行
|
| 178 |
*/
|
| 179 |
#booking_table th, #booking_table td {
|
| 180 |
display: table-cell !important;
|
|
|
|
| 190 |
line-height: 1.4 !important;
|
| 191 |
}
|
| 192 |
|
| 193 |
+
/* 5. 🔥【絕對欄寬】(依照您的指定) */
|
| 194 |
#booking_table th:nth-child(1), #booking_table td:nth-child(1) { width: 60px !important; }
|
| 195 |
#booking_table th:nth-child(2), #booking_table td:nth-child(2) { width: 170px !important; }
|
| 196 |
#booking_table th:nth-child(3), #booking_table td:nth-child(3) { width: 80px !important; }
|