From 267ada6ae58d7e30cae4486bb1d7b0649b90965c Mon Sep 17 00:00:00 2001 From: kujirahand Date: Sun, 24 Nov 2024 16:11:50 +0900 Subject: [PATCH] =?UTF-8?q?=E3=80=8C=E3=83=95=E3=82=A9=E3=83=BC=E3=83=A0?= =?UTF-8?q?=E4=BD=9C=E6=88=90=E3=80=8D=E5=91=BD=E4=BB=A4=E3=81=AE=E5=BC=B7?= =?UTF-8?q?=E5=8C=96=20=3Fdate=20=3Ftime=20=3Ffile=20=E3=81=AA=E3=81=A9?= =?UTF-8?q?=E3=82=92=E8=BF=BD=E5=8A=A0=20#1829?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/plugin_browser_dom_parts.mts | 57 ++++++++++++++++++++++++++++++-- 1 file changed, 55 insertions(+), 2 deletions(-) diff --git a/src/plugin_browser_dom_parts.mts b/src/plugin_browser_dom_parts.mts index 714e2f5a..9026ee84 100644 --- a/src/plugin_browser_dom_parts.mts +++ b/src/plugin_browser_dom_parts.mts @@ -297,10 +297,13 @@ export default { const val = cols[1] const opt1 = cols[2] const opt2 = cols[3] + let isHidden = false if (key === '' && val === '') { continue } // 空行は無視 // key const th = document.createElement('th') - th.innerHTML = sys.__tohtmlQ(key) + const lbl = document.createElement('label') + lbl.innerHTML = sys.__tohtmlQ(key) + th.appendChild(lbl) // val const td = document.createElement('td') if (val.substring(0, 2) === '?(') { @@ -325,7 +328,10 @@ export default { // input element const inp = document.createElement('input') td.appendChild(inp) + const lbl2 = document.createElement('label') + td.appendChild(lbl2) inp.id = 'nako3form_' + key + lbl.htmlFor = inp.id // check type v3.6.37 if (val === '?text') { inp.type = 'text' @@ -345,17 +351,63 @@ export default { inp.placeholder = opt2 inp.name = key } + else if (val === '?email') { + inp.type = 'email' + inp.value = opt1 + inp.placeholder = opt2 + inp.name = key + } + else if (val === '?tel') { + inp.type = 'tel' + inp.value = opt1 + inp.placeholder = opt2 + inp.name = key + } + else if (val === '?file') { + inp.type = 'file' + inp.name = key + } + else if (val === '?date') { + inp.type = 'date' + inp.value = opt1.replace(/\//g, '-') + inp.name = key + } + else if (val === '?month') { + inp.type = 'month' + inp.value = opt1.replace(/\//g, '-') + inp.name = key + } + else if (val === '?time') { + inp.type = 'time' + inp.value = opt1 + inp.name = key + } else if (val === '?color') { inp.type = 'color' inp.value = opt1 inp.name = key } + else if (val === '?hidden') { + inp.type = 'hidden' + inp.value = opt1 + inp.name = key + isHidden = true + frm.appendChild(inp) + } + else if (val === '?checkbox') { + inp.type = 'checkbox' + inp.value = opt1 + inp.name = key + lbl2.innerHTML = ' ' + sys.__tohtmlQ(opt2) + lbl2.htmlFor = inp.id + } // v3.2.33での拡張 else if (val === '?送信' || val === '?submit') { inp.type = 'submit' inp.value = val.substring(1) if (key !== '') { inp.name = key } - } else if (val.substring(0, 2) === '?c') { + } + else if (val.substring(0, 3) === '?c#') { inp.type = 'color' inp.value = val.substring(2) inp.name = key @@ -365,6 +417,7 @@ export default { inp.name = key } } + if (isHidden) { continue } const tr = document.createElement('tr') tr.appendChild(th) tr.appendChild(td)