@xiee/utils 1.14.111 → 1.14.113
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/css/lt-input.css +11 -0
- package/css/lt-input.min.css +2 -0
- package/css/lt-input.min.css.map +1 -0
- package/css/lt.css +1 -1
- package/css/lt.min.css +1 -1
- package/css/lt.min.css.map +1 -1
- package/js/lt-input.js +3 -2
- package/js/lt-input.min.js +1 -1
- package/js/lt-input.min.js.map +1 -1
- package/package.json +1 -1
package/css/lt-input.css
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/* lt-input.css — an editable table looks like a spreadsheet (see lt-input.js).
|
|
2
|
+
lt.css draws the frame and header gaps from --bd/--bg, so redefining them
|
|
3
|
+
(the row separator color, #ddd) leaves one uniform grid. The `tr` in the
|
|
4
|
+
selector outranks lt.css's cell rules regardless of stylesheet order. */
|
|
5
|
+
.lt-table.lt-edit {
|
|
6
|
+
--bd: 1px solid #ddd;
|
|
7
|
+
--bg: var(--bd);
|
|
8
|
+
border-collapse: collapse;
|
|
9
|
+
:is(thead, tbody) tr :is(td, th) { border: var(--bd); }
|
|
10
|
+
[contenteditable] { cursor: pointer; &:focus { outline: 2px solid #217346; outline-offset: -1px; } }
|
|
11
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"mappings":"AAIA,8EAIE,kDACA,mCAAqC","sources":["lt-input.css"],"sourcesContent":["/* lt-input.css — an editable table looks like a spreadsheet (see lt-input.js).\n lt.css draws the frame and header gaps from --bd/--bg, so redefining them\n (the row separator color, #ddd) leaves one uniform grid. The `tr` in the\n selector outranks lt.css's cell rules regardless of stylesheet order. */\n.lt-table.lt-edit {\n --bd: 1px solid #ddd;\n --bg: var(--bd);\n border-collapse: collapse;\n :is(thead, tbody) tr :is(td, th) { border: var(--bd); }\n [contenteditable] { cursor: pointer; &:focus { outline: 2px solid #217346; outline-offset: -1px; } }\n}\n"],"names":[]}
|
package/css/lt.css
CHANGED
package/css/lt.min.css
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
.lt-wrap{overflow-x:auto}.lt-table{--bg:4px solid transparent;--bd:1.5px solid #888;& th,& td{padding:5px}border-collapse:separate;caption-side:top;border-spacing:0;border-top:var(--bd);border-bottom:var(--bd);margin:1em auto;& caption{text-align:center;border-top:var(--bd);padding:.5em;& .lt-title{font-size:1.2em}& .lt-subtitle{font-size:.9em}}& th{font-weight:400}& tbody{& :not(:last-child) :is(td,th){border-bottom:1px solid #ddd}& .lt-row-group :is(td,th){border-bottom:1.5px solid #ddd}& .lt-row-group{text-align:left;&.lt-row-open{border-bottom-color:#0000}}}& thead th{border-bottom:1px solid #888;&:not(:first-child){border-left:var(--bg)}&:not(:last-child){border-right:var(--bg)}}& .lt-indent{padding-left:1em}& .lt-spanner-row{& .lt-spanner{text-align:center;border-bottom:1px solid #bbb}& .lt-spanner-empty{border-bottom:none}}& .lt-footer{font-size:.85em;& .lt-footnote:first-child td{border-top:1px solid #aaa}& .lt-source-note:first-child td{border-top:1px dashed #aaa}& .lt-source-note td{font-style:italic}}& .al-r{text-align:right}& .al-c{text-align:center}& .lt-fnref{color:#06c;&:before{content:" ["}&:after{content:"]"}}}.lt-raw [title]:after{content:" (" attr(title) ")";background:#ffffe0;font-size:.85em}
|
|
2
2
|
/*# sourceMappingURL=lt.min.css.map */
|
package/css/lt.min.css.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"mappings":"AAAA,
|
|
1
|
+
{"version":3,"mappings":"AAAA,yBACA,2DAIE,sBACgB,wHAOhB,8DAEE,4BACA,+BAGF,qBACA,QACE,4DACA,0DACA,gCAEE,0CAGJ,wCAEE,0CACA,2CAEF,8BACA,kBACE,6DACA,wCAGF,6BAEE,wDACA,4DACA,wCAGF,yBACA,0BAEA,uBAEE,uBACA,sBAGJ","sources":["lt.css"],"sourcesContent":[".lt-wrap { overflow-x: auto; }\n.lt-table {\n --bg: 4px solid transparent;\n --bd: 1.5px solid #888;\n\n th, td{ padding: 5px; }\n border-collapse: separate;\n caption-side: top;\n margin: 1em auto;\n border-spacing: 0;\n border-top: var(--bd);\n border-bottom: var(--bd);\n\n caption {\n padding: .5em; text-align: center; border-top: var(--bd);\n .lt-title { font-size: 1.2em; }\n .lt-subtitle { font-size: 0.9em; }\n }\n\n th { font-weight: normal; }\n tbody {\n :not(:last-child) :is(td, th) { border-bottom: 1px solid #ddd; }\n .lt-row-group :is(td, th) { border-bottom: 1.5px solid #ddd; }\n .lt-row-group {\n text-align: left;\n &.lt-row-open { border-bottom-color: transparent; }\n }\n }\n thead th {\n border-bottom: 1px solid #888;\n &:not(:first-child) { border-left: var(--bg); }\n &:not(:last-child) { border-right: var(--bg); }\n }\n .lt-indent { padding-left: 1em; }\n .lt-spanner-row {\n .lt-spanner { border-bottom: 1px solid #bbb; text-align: center; }\n .lt-spanner-empty { border-bottom: none; }\n }\n\n .lt-footer {\n font-size: 0.85em;\n .lt-footnote:first-child td { border-top: 1px solid #aaa; }\n .lt-source-note:first-child td { border-top: 1px dashed #aaa; }\n .lt-source-note td { font-style: italic; }\n }\n\n .al-r { text-align: right; }\n .al-c { text-align: center; }\n\n .lt-fnref {\n color: #06c;\n &::before { content: \"\\00a0[\"; }\n &::after { content: \"]\"; }\n }\n}\n.lt-raw [title]::after {\n content: \" (\" attr(title) \")\";\n background: lightyellow;\n font-size: 0.85em;\n}\n"],"names":[]}
|
package/js/lt-input.js
CHANGED
|
@@ -20,6 +20,7 @@
|
|
|
20
20
|
const td = e.target.closest?.("td[contenteditable]");
|
|
21
21
|
return td && [td, cols[td.cellIndex], rows.indexOf(td.parentNode)];
|
|
22
22
|
};
|
|
23
|
+
tbl.classList.add("lt-edit");
|
|
23
24
|
rows.forEach(tr => cols.forEach((c, i) => {
|
|
24
25
|
if (spec.input.includes(c)) tr.cells[i].contentEditable = "plaintext-only";
|
|
25
26
|
}));
|
|
@@ -57,9 +58,9 @@
|
|
|
57
58
|
find: scope => $(scope).find(".lt-input"),
|
|
58
59
|
initialize: el => draw(el, JSON.parse(el.dataset.spec)),
|
|
59
60
|
getType: () => "lt.table",
|
|
60
|
-
getValue: el => el._tbl._ltSpec.data,
|
|
61
|
+
getValue: el => { const s = el._tbl._ltSpec; return { data: s.data, matrix: s.matrix }; },
|
|
61
62
|
subscribe: (el, cb) => $(el).on("lt-edit.lt", () => cb(true)),
|
|
62
63
|
unsubscribe: el => $(el).off(".lt"),
|
|
63
|
-
receiveMessage: (el, msg) => { draw(el, msg.spec); $(el).trigger("lt-edit"); }
|
|
64
|
+
receiveMessage: (el, msg) => { draw(el, { input: el._tbl._ltSpec.input, ...msg.spec }); $(el).trigger("lt-edit"); }
|
|
64
65
|
}), "lt.input");
|
|
65
66
|
})(typeof window !== "undefined" ? window : globalThis);
|
package/js/lt-input.min.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
(t=>{"use strict";const
|
|
1
|
+
(t=>{"use strict";const n=t.LT;if(!n?.onMount||n.plugins.input)return;const{$$:e,on:i,numCol:o}=n,s=(t,n)=>{if(!n?.input||n._rowspan||n.interactive)return;const s=[...e(t.tBodies[0],"tr:not(.lt-row-group)")],l=n._cols,u=t=>{const n=t.target.closest?.("td[contenteditable]");return n&&[n,l[n.cellIndex],s.indexOf(n.parentNode)]};t.classList.add("lt-edit"),s.forEach(t=>l.forEach((e,i)=>{n.input.includes(e)&&(t.cells[i].contentEditable="plaintext-only")})),i(t,"focusin",t=>{const[e,i,o]=u(t)||[];e&&(e.textContent=n.data[i][o]??"")}),i(t,"focusout",e=>{const[i,s,l]=u(e)||[];if(!i)return;const c=n.data[s],r=i.textContent.trim();o(c)?isNaN(r)?i.textContent=c[l]??"":c[l]=""===r?null:+r:c[l]=i.textContent,t.dispatchEvent(new CustomEvent("lt-edit",{bubbles:!0}))}),i(t,"keydown",t=>{const[n,,e]=u(t)||[];n&&"Enter"===t.key&&(t.preventDefault(),(s[e+1]?.cells[n.cellIndex]||n).focus(),n.blur())})};if(n.plugins.input=1,n.onMount.push(s),"undefined"!=typeof document&&e(document,".lt-table").forEach(t=>s(t,t._ltSpec)),!t.Shiny)return;const l=(t,e)=>t._tbl=n.render(t,e);Shiny.inputBindings.register(Object.assign(new Shiny.InputBinding,{find:t=>$(t).find(".lt-input"),initialize:t=>l(t,JSON.parse(t.dataset.spec)),getType:()=>"lt.table",getValue:t=>{const n=t._tbl._ltSpec;return{data:n.data,matrix:n.matrix}},subscribe:(t,n)=>$(t).on("lt-edit.lt",()=>n(!0)),unsubscribe:t=>$(t).off(".lt"),receiveMessage:(t,n)=>{l(t,{input:t._tbl._ltSpec.input,...n.spec}),$(t).trigger("lt-edit")}}),"lt.input")})("undefined"!=typeof window?window:globalThis);
|
|
2
2
|
//# sourceMappingURL=lt-input.min.js.map
|
package/js/lt-input.min.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["root","LT","onMount","plugins","input","$$","on","numCol","tbl","spec","_rowspan","interactive","rows","tBodies","cols","_cols","hit","e","td","target","closest","cellIndex","indexOf","parentNode","forEach","tr","c","i","includes","cells","contentEditable","r","textContent","data","col","v","trim","isNaN","dispatchEvent","CustomEvent","bubbles","key","preventDefault","focus","blur","push","document","t","_ltSpec","Shiny","draw","el","_tbl","render","inputBindings","register","Object","assign","InputBinding","find","scope","$","initialize","JSON","parse","dataset","getType","getValue","subscribe","cb","unsubscribe","off","receiveMessage","msg","trigger","window","globalThis"],"sources":["lt-input.js"],"mappings":"AAOA,CAACA,IACC,aACA,MAAMC,EAAKD,EAAKC,GAChB,IAAKA,GAAIC,SAAWD,EAAGE,QAAQC,MAAO,OACtC,MAAMC,GAAEA,EAAEC,GAAEA,EAAEC,OAAEA,GAAWN,EAErBC,EAAU,CAACM,EAAKC,KACpB,IAAKA,GAAML,OAASK,EAAKC,UAAYD,EAAKE,YAAa,OACvD,MAAMC,EAAO,IAAIP,EAAGG,EAAIK,QAAQ,GAAI,0BAC9BC,EAAOL,EAAKM,MAEZC,EAAMC,IACJ,MAAMC,EAAKD,EAAEE,OAAOC,UAAU,uBAC9B,OAAOF,GAAM,CAACA,EAAIJ,EAAKI,EAAGG,WAAYT,EAAKU,QAAQJ,EAAGK,
|
|
1
|
+
{"version":3,"names":["root","LT","onMount","plugins","input","$$","on","numCol","tbl","spec","_rowspan","interactive","rows","tBodies","cols","_cols","hit","e","td","target","closest","cellIndex","indexOf","parentNode","classList","add","forEach","tr","c","i","includes","cells","contentEditable","r","textContent","data","col","v","trim","isNaN","dispatchEvent","CustomEvent","bubbles","key","preventDefault","focus","blur","push","document","t","_ltSpec","Shiny","draw","el","_tbl","render","inputBindings","register","Object","assign","InputBinding","find","scope","$","initialize","JSON","parse","dataset","getType","getValue","s","matrix","subscribe","cb","unsubscribe","off","receiveMessage","msg","trigger","window","globalThis"],"sources":["lt-input.js"],"mappings":"AAOA,CAACA,IACC,aACA,MAAMC,EAAKD,EAAKC,GAChB,IAAKA,GAAIC,SAAWD,EAAGE,QAAQC,MAAO,OACtC,MAAMC,GAAEA,EAAEC,GAAEA,EAAEC,OAAEA,GAAWN,EAErBC,EAAU,CAACM,EAAKC,KACpB,IAAKA,GAAML,OAASK,EAAKC,UAAYD,EAAKE,YAAa,OACvD,MAAMC,EAAO,IAAIP,EAAGG,EAAIK,QAAQ,GAAI,0BAC9BC,EAAOL,EAAKM,MAEZC,EAAMC,IACJ,MAAMC,EAAKD,EAAEE,OAAOC,UAAU,uBAC9B,OAAOF,GAAM,CAACA,EAAIJ,EAAKI,EAAGG,WAAYT,EAAKU,QAAQJ,EAAGK,cAE9Df,EAAIgB,UAAUC,IAAI,WAClBb,EAAKc,QAAQC,GAAMb,EAAKY,QAAQ,CAACE,EAAGC,KAC9BpB,EAAKL,MAAM0B,SAASF,KAAID,EAAGI,MAAMF,GAAGG,gBAAkB,qBAE5D1B,EAAGE,EAAK,UAAWS,IACjB,MAAOC,EAAIU,EAAGK,GAAKjB,EAAIC,IAAM,GACzBC,IAAIA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