@svgrid/enterprise 3.1.24 → 3.1.26
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/dist/cdn/svgrid-enterprise.svelte-external.js +13664 -13646
- package/dist/designer/assets/{GridMenus-DWDghydL.js → GridMenus-C8WqB-To.js} +2 -2
- package/dist/designer/assets/{SvDateRangeInput-DbfmXqJj.js → SvDateRangeInput-y8PkioQk.js} +1 -1
- package/dist/designer/assets/SvGridCellEditor-CC9UMdVq.js +4 -0
- package/dist/designer/assets/{SvGridChart-DYtGHM3F.js → SvGridChart-DzCeEdlb.js} +3 -3
- package/dist/designer/assets/{SvGridChartBuilder-BjdQrnz5.js → SvGridChartBuilder-CsXVVKvA.js} +1 -1
- package/dist/designer/assets/SvGridChartPanel-Dj3IxTS2.js +4 -0
- package/dist/designer/assets/{SvGridChartView-Bfs0bvDb.js → SvGridChartView-Dwm4hxbW.js} +1 -1
- package/dist/designer/assets/{chart-export-B6bkQ3X8.js → chart-export-Dqq_eHRq.js} +4 -4
- package/dist/designer/assets/{chart-export-pdf-BbA28-gt.js → chart-export-pdf-Gw22jkxa.js} +1 -1
- package/dist/designer/assets/csv-injection-C4a0uulO.js +1 -0
- package/dist/designer/assets/export-format-NYxEY-0Y.js +6 -0
- package/dist/designer/assets/index-BU3ieI05.css +1 -0
- package/dist/designer/assets/{index-BB1G1RTR.js → index-PEFkd-5C.js} +341 -331
- package/dist/designer/assets/src-D23PPsK1.js +1 -0
- package/dist/designer/assets/{src-fddEt37f.js → src-DC5nN4Q7.js} +3 -3
- package/dist/designer/index.html +9 -8
- package/dist/import.js +11 -1
- package/dist/node/studio.js +20 -12
- package/dist/review/model.svelte.d.ts +65 -140
- package/dist/sheet/xlsx-document.js +15 -0
- package/dist/studio/emit-schema.js +18 -10
- package/dist/version.d.ts +2 -2
- package/dist/version.js +2 -2
- package/dist/wc/{GridMenus-h7RsvcmI.js → GridMenus-BIQXB6a7.js} +1 -1
- package/dist/wc/{SvDateRangeInput-CJZohgBe.js → SvDateRangeInput-DHYuAJeY.js} +1 -0
- package/dist/wc/SvGridCellEditor-CZwhQx0a.js +584 -0
- package/dist/wc/{SvGridChart-DWRqlhCV.js → SvGridChart-DcfmVvzB.js} +3 -3
- package/dist/wc/{SvGridChartBuilder-BXW3yUR0.js → SvGridChartBuilder-1Z69mxbM.js} +2 -2
- package/dist/wc/{SvGridChartPanel-28n4tomx.js → SvGridChartPanel-BaVsa-T-.js} +5 -5
- package/dist/wc/{SvGridChartView-CbG_WrU-.js → SvGridChartView-LEC8ZNeU.js} +1 -1
- package/dist/wc/{chart-export-CeSADGfi.js → chart-export-C1KSVdMU.js} +29 -28
- package/dist/wc/{chart-export-pdf-BGko7MER.js → chart-export-pdf-CmEd365D.js} +1 -1
- package/dist/wc/csv-injection-Ce26_TOb.js +8 -0
- package/dist/wc/sv-sheet-element.js +6234 -6211
- package/dist/xlsx-limits.d.ts +17 -0
- package/dist/xlsx-limits.js +21 -0
- package/package.json +3 -3
- package/dist/designer/assets/SvGridCellEditor-od4VbndV.js +0 -4
- package/dist/designer/assets/SvGridChartPanel-Cm9_K7BV.js +0 -4
- package/dist/designer/assets/export-format-BCuqcexA.js +0 -6
- package/dist/designer/assets/index-CHx3F4Ij.css +0 -1
- package/dist/designer/assets/src-CITpcm6b.js +0 -1
- package/dist/wc/SvGridCellEditor-C7ios4i_.js +0 -582
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{n as e}from"./rolldown-runtime-Dd_uD5pT.js";import{n as t}from"./chart-export-Dqq_eHRq.js";var n=e({chartToPngBlob:()=>t});export{n as t};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./jszip.min-CX2fPs3O.js","./rolldown-runtime-Dd_uD5pT.js","./pdfmake-BpIYFHoG.js","./vfs_fonts-BV-Ul9v2.js","./src-
|
|
2
|
-
import{i as e,n as t}from"./rolldown-runtime-Dd_uD5pT.js";import{i as n,r,t as i}from"./conditional-formatting-MDWbF8_Y.js";import{a,c as o,d as s,i as c,l,n as u,o as d,s as f,t as p,u as m}from"./export-format-
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./jszip.min-CX2fPs3O.js","./rolldown-runtime-Dd_uD5pT.js","./pdfmake-BpIYFHoG.js","./vfs_fonts-BV-Ul9v2.js","./src-D23PPsK1.js","./chart-export-Dqq_eHRq.js","./csv-injection-C4a0uulO.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{i as e,n as t}from"./rolldown-runtime-Dd_uD5pT.js";import{i as n,r,t as i}from"./conditional-formatting-MDWbF8_Y.js";import{a,c as o,d as s,i as c,l,n as u,o as d,s as f,t as p,u as m}from"./export-format-NYxEY-0Y.js";import{t as h}from"./preload-helper-HclGiUj8.js";var g=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),_=(e,t)=>e>>>t|e<<32-t;function v(e){let t=new TextEncoder().encode(e),n=t.length*8,r=Math.ceil((t.length+9)/64)*64,i=new Uint8Array(r);i.set(t),i[t.length]=128;let a=new DataView(i.buffer);a.setUint32(r-8,Math.floor(n/4294967296)),a.setUint32(r-4,n>>>0);let o=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),s=new Uint32Array(64);for(let e=0;e<r;e+=64){for(let t=0;t<16;t++)s[t]=a.getUint32(e+t*4);for(let e=16;e<64;e++){let t=_(s[e-15],7)^_(s[e-15],18)^s[e-15]>>>3,n=_(s[e-2],17)^_(s[e-2],19)^s[e-2]>>>10;s[e]=s[e-16]+t+s[e-7]+n>>>0}let t=o[0],n=o[1],r=o[2],i=o[3],c=o[4],l=o[5],u=o[6],d=o[7];for(let e=0;e<64;e++){let a=_(c,6)^_(c,11)^_(c,25),o=c&l^~c&u,f=d+a+o+g[e]+s[e]>>>0,p=(_(t,2)^_(t,13)^_(t,22))+(t&n^t&r^n&r)>>>0;d=u,u=l,l=c,c=i+f>>>0,i=r,r=n,n=t,t=f+p>>>0}o[0]=o[0]+t>>>0,o[1]=o[1]+n>>>0,o[2]=o[2]+r>>>0,o[3]=o[3]+i>>>0,o[4]=o[4]+c>>>0,o[5]=o[5]+l>>>0,o[6]=o[6]+u>>>0,o[7]=o[7]+d>>>0}let c=``;for(let e of o)c+=e.toString(16).padStart(8,`0`);return c}function y(e,t){return e===`suite`||t===`grid`}function b(e,t=new Date){return e==null||e.trim()===``?{status:`unset`,valid:!1,edition:`suite`}:v(e.trim().toLowerCase())===`dabe98638cdc5760637bb2a741e65680a6ff0fb590d8b1018c9597650486cb10`?{status:`licensed`,valid:!0,edition:`suite`}:{status:`invalid`,valid:!1,edition:`suite`}}var x=new Set([`svgrid.com`,`www.svgrid.com`]);function S(){let e=globalThis.location?.hostname;return typeof e==`string`&&x.has(e.toLowerCase())}var C=`data-svgrid-enterprise-watermark`,w=`data-svgrid-enterprise-nudged`,ee=`https://svgrid.com/pricing/?utm_source=svgrid-enterprise&utm_medium=watermark`,te=`www.svgrid.com`,ne=5e3,T=700,E=!1,D=null;function O(){S()||(ie(),!(typeof document>`u`||typeof window>`u`)&&(queueMicrotask(()=>j()),D||(D=new MutationObserver(A),D.observe(document.body,{childList:!0,subtree:!0}))))}var k=!1;function A(e){for(let t of e){let e=t.target;if(!(e.nodeType===1&&e.closest?.(`.sv-grid-root[${w}]`))){re();return}}}function re(){if(k)return;k=!0;let e=()=>{k=!1,j()};typeof requestAnimationFrame==`function`?requestAnimationFrame(e):setTimeout(e,16)}function ie(){E||(E=!0,!(typeof console>`u`)&&console.log(`%c @svgrid/enterprise %c User is using a Commercial version which requires a license.
|
|
3
3
|
Contact sales@jqwidgets.com for details or visit the license page: https://svgrid.com/pricing/?utm_source=svgrid-enterprise&utm_medium=console`,`background:#4f46e5;color:#fff;padding:2px 6px;border-radius:3px;font-weight:600`,`color:inherit`))}function j(){if(typeof document>`u`)return;let e=document.querySelectorAll(`.sv-grid-root, [role="grid"]`);if(e.length===0){ae();return}document.querySelectorAll(`[${C}="fixed"]`).forEach(e=>e.remove());let t=new Set;e.forEach(e=>{let n=M(e);n&&t.add(n)}),t.forEach(N)}function M(e){let t=e.closest(`.sv-grid-root`);if(t)return t;let n=e;for(;n&&/^(TABLE|THEAD|TBODY|TFOOT|TR|COLGROUP)$/.test(n.tagName);)n=n.parentElement;return n}function N(e){if(e.hasAttribute(w))return;e.setAttribute(w,`1`),getComputedStyle(e).position===`static`&&(e.style.position=`relative`);let t=oe(`grid`);ce(t,!1),e.appendChild(t),se(t)}function ae(){if(typeof document>`u`||document.querySelector(`[${C}="fixed"]`))return;let e=oe(`fixed`);ce(e,!0),document.body.appendChild(e),se(e)}function oe(e){let t=document.createElement(`a`);return t.setAttribute(C,e),t.href=ee,t.target=`_blank`,t.rel=`noopener noreferrer`,t.textContent=te,t.title=`Unlicensed @svgrid/enterprise. Contact sales@jqwidgets.com or visit www.svgrid.com.`,t}function se(e){if(typeof window>`u`){e.remove();return}window.setTimeout(()=>{if(typeof window>`u`){e.remove();return}e.style.opacity=`0`,window.setTimeout(()=>e.remove(),T)},ne)}function ce(e,t){Object.assign(e.style,{position:t?`fixed`:`absolute`,bottom:t?`12px`:`6px`,right:t?`12px`:`8px`,zIndex:`2147483647`,background:`rgba(15,23,42,0.85)`,color:`#fff`,padding:t?`6px 10px`:`4px 8px`,borderRadius:t?`4px`:`3px`,fontFamily:`-apple-system, "Segoe UI", Roboto, sans-serif`,fontSize:t?`11px`:`10px`,lineHeight:`1.2`,textDecoration:`none`,boxShadow:t?`0 2px 12px rgba(0,0,0,0.35)`:`0 1px 4px rgba(0,0,0,0.3)`,border:`1px solid rgba(255,255,255,0.18)`,pointerEvents:`auto`,letterSpacing:`0.02em`,opacity:`1`,transition:`opacity ${T}ms ease`})}var le=`data-svgrid-enterprise-upgrade`,ue=`https://svgrid.com/pricing?ref=in-app&utm_source=svgrid-enterprise&utm_medium=upgrade-prompt`,de=`https://svgrid.com/docs/enterprise/evaluation/?utm_source=svgrid-enterprise&utm_medium=upgrade-prompt`,fe=!1;function P(e,t){if(fe||typeof document>`u`||typeof window>`u`||S()||document.querySelector(`[${le}]`))return;fe=!0;let n=pe(e,t?.expired===!0);document.body.appendChild(n),requestAnimationFrame(()=>{n.style.opacity=`1`,n.style.transform=`translateY(0)`})}function F(e){e.style.opacity=`0`,e.style.transform=`translateY(8px)`,window.setTimeout(()=>e.remove(),220)}function pe(e,t=!1){let n=document.createElement(`div`);n.setAttribute(le,`1`),n.setAttribute(`role`,`dialog`),n.setAttribute(`aria-label`,t?`Your evaluation has ended`:`SvGrid Enterprise`),Object.assign(n.style,{position:`fixed`,bottom:`16px`,right:`16px`,zIndex:`2147483646`,width:`320px`,maxWidth:`calc(100vw - 32px)`,boxSizing:`border-box`,padding:`16px 16px 14px`,background:`#0f172a`,color:`#e2e8f0`,borderRadius:`12px`,border:`1px solid rgba(99,102,241,0.4)`,boxShadow:`0 12px 40px rgba(0,0,0,0.45)`,fontFamily:`-apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif`,fontSize:`13px`,lineHeight:`1.45`,opacity:`0`,transform:`translateY(8px)`,transition:`opacity 220ms ease, transform 220ms ease`});let r=e?`<strong style="color:#fff">${me(e?String(e):`This`)}</strong> is part of SvGrid Enterprise.`:`You just used a <strong style="color:#fff">SvGrid Enterprise</strong> feature.`,i=t?`EVALUATION ENDED`:`ENTERPRISE`,a=t?`Your evaluation has ended`:`SvGrid Enterprise`,o=t?`${r} Everything still works, but this notice stays until a
|
|
4
4
|
license key is set.`:`${r} It keeps working as it is, here and in production. A
|
|
5
5
|
license key removes the watermark and this notice.`;return n.innerHTML=`
|
|
@@ -35,7 +35,7 @@ Contact sales@jqwidgets.com for details or visit the license page: https://svgri
|
|
|
35
35
|
<styleSheet xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main">`+(n.size>0?`<numFmts count="${n.size}">${[...n.entries()].map(([e,t])=>`<numFmt numFmtId="${t}" formatCode="${B(e)}"/>`).join(``)}</numFmts>`:``)+`<fonts count="${a.length}">${a.join(``)}</fonts><fills count="${c.length}">${c.join(``)}</fills><borders count="1"><border><left/><right/><top/><bottom/><diagonal/></border></borders><cellStyleXfs count="1"><xf numFmtId="0" fontId="0" fillId="0" borderId="0"/></cellStyleXfs><cellXfs count="${d.length}">${d.join(``)}</cellXfs><cellStyles count="1"><cellStyle name="Normal" xfId="0" builtinId="0"/></cellStyles></styleSheet>`}}function Ve(e){let{header:t,rows:n}=e,r=Be(t,n),i=[],a=[`<row r="1">${t.map((e,t)=>`<c r="${V(t)}1" s="1" t="inlineStr"><is><t xml:space="preserve">${B(e)}</t></is></c>`).join(``)}</row>`];for(let e=0;e<n.length;e++){let t=e+2,o=n[e],s=[];for(let e=0;e<o.length;e++){let n=o[e],a=`${V(e)}${t}`,c=r.styleIndexOf(n),l=c?` s="${c}"`:``;if(n.link&&i.push({ref:a,url:n.link,id:`rId${i.length+1}`}),n.value==null||n.value===``)s.push(`<c r="${a}"${l}/>`);else if(n.t===`n`)s.push(`<c r="${a}"${l}><v>${Number(n.value)}</v></c>`);else if(n.t===`d`){let e=Pe(n.value);s.push(`<c r="${a}"${l}><v>${Ne(e)}</v></c>`)}else n.t===`b`?s.push(`<c r="${a}"${l} t="b"><v>${+!!n.value}</v></c>`):s.push(`<c r="${a}"${l} t="inlineStr"><is><t xml:space="preserve">${B(String(n.value))}</t></is></c>`)}a.push(`<row r="${t}">${s.join(``)}</row>`)}let o=e.widths?`<cols>${e.widths.map((e,t)=>`<col min="${t+1}" max="${t+1}" width="${Math.max(4,Math.round(e/7*100)/100)}" customWidth="1"/>`).join(``)}</cols>`:``,s=Math.max(0,Math.floor(e.freezeColumns??0)),c=+!!e.freezeHeader,l=`<sheetView workbookViewId="0"/>`;if(c>0||s>0){let e=`${V(s)}${c+1}`,t=s>0&&c>0?`bottomRight`:s>0?`topRight`:`bottomLeft`;l=`<sheetView workbookViewId="0"><pane${s>0?` xSplit="${s}"`:``}${c>0?` ySplit="${c}"`:``} topLeftCell="${e}" activePane="${t}" state="frozen"/><selection pane="${t}" activeCell="${e}" sqref="${e}"/></sheetView>`}let u=n.length>0?(e.condFormats??[]).map((e,t)=>{let r=V(e.colIdx),i=`${r}2:${r}${n.length+1}`;if(e.kind===`dataBar`){let n=H(e.color)??`FF638EC6`;return`<conditionalFormatting sqref="${i}"><cfRule type="dataBar" priority="${t+1}"><dataBar><cfvo type="min"/><cfvo type="max"/><color rgb="${n}"/></dataBar></cfRule></conditionalFormatting>`}let a=e.colors.map(e=>H(e)??`FFFFFFFF`),o=a.length>=3?`<cfvo type="min"/><cfvo type="percentile" val="50"/><cfvo type="max"/>`:`<cfvo type="min"/><cfvo type="max"/>`,s=a.map(e=>`<color rgb="${e}"/>`).join(``);return`<conditionalFormatting sqref="${i}"><cfRule type="colorScale" priority="${t+1}"><colorScale>${o}${s}</colorScale></cfRule></conditionalFormatting>`}).join(``):``,d=i.length?`<hyperlinks>${i.map(e=>`<hyperlink ref="${e.ref}" r:id="${e.id}"/>`).join(``)}</hyperlinks>`:``,f=``,p=``,m=``;if(e.table&&t.length>0){let o=e.table,s=new Set,c=t.map((e,t)=>{let n=(e??``).trim()||`Column${t+1}`,r=n,i=1;for(;s.has(r.toLowerCase());)r=`${n}${++i}`;return s.add(r.toLowerCase()),r}),l=V(t.length-1),u=n.length+1,d=u+1,h=o.totalsRow&&n.length>0,g=o.totalsFns.findIndex(e=>!e);if(h){let e=t.map((e,t)=>{let i=`${V(t)}${d}`,a=o.totalsFns[t];if(a){let e=0;for(let r of n){let n=r[t];n?.t===`n`&&typeof n.value==`number`&&(e+=n.value)}let s=n.find(e=>e[t]?.t===`n`)?.[t]?.numFmt,l=r.styleIndexOf({t:`n`,value:e,numFmt:s,bold:!0}),u=a===`average`?101:a===`count`?103:109,d=a===`count`?n.length:e;return`<c r="${i}"${l?` s="${l}"`:``}><f>SUBTOTAL(${u},${o.name}[${B(c[t])}])</f><v>${d}</v></c>`}if(t===g){let e=r.styleIndexOf({t:`s`,value:`Total`,bold:!0});return`<c r="${i}"${e?` s="${e}"`:``} t="inlineStr"><is><t>Total</t></is></c>`}return`<c r="${i}"/>`});a.push(`<row r="${d}">${e.join(``)}</row>`)}let _=c.map((e,t)=>{let n=h?o.totalsFns[t]:void 0,r=h?n?` totalsRowFunction="${n}"`:t===g?` totalsRowLabel="Total"`:``:``;return`<tableColumn id="${t+1}" name="${B(e)}"${r}/>`}).join(``);f=`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
|
36
36
|
<table xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main" id="1" name="${B(o.name)}" displayName="${B(o.name)}" ref="A1:${l}${h?d:u}"${h?` totalsRowCount="1"`:` totalsRowShown="0"`}><autoFilter ref="A1:${l}${u}"/><tableColumns count="${t.length}">${_}</tableColumns><tableStyleInfo name="${B(o.style??`TableStyleMedium2`)}" showFirstColumn="0" showLastColumn="0" showRowStripes="1" showColumnStripes="0"/></table>`,m=`rId${i.length+1}`,p=`<tableParts count="1"><tablePart r:id="${m}"/></tableParts>`}let h=`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
|
37
37
|
<worksheet xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships"><sheetViews>${l}</sheetViews><sheetFormatPr defaultRowHeight="15"/>`+o+`<sheetData>${a.join(``)}</sheetData>`+u+d+p+`</worksheet>`,g={"[Content_Types].xml":f?Fe.replace(`</Types>`,`<Override PartName="/xl/tables/table1.xml" ContentType="application/vnd.openxmlformats-officedocument.spreadsheetml.table+xml"/></Types>`):Fe,"_rels/.rels":Ie,"xl/workbook.xml":Re(e.sheetName),"xl/_rels/workbook.xml.rels":ze,"xl/styles.xml":r.build(),"xl/worksheets/sheet1.xml":h};if(f&&(g[`xl/tables/table1.xml`]=f),i.length||m){let e=i.map(e=>`<Relationship Id="${e.id}" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink" Target="${B(e.url)}" TargetMode="External"/>`);m&&e.push(`<Relationship Id="${m}" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/table" Target="../tables/table1.xml"/>`),g[`xl/worksheets/_rels/sheet1.xml.rels`]=`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
|
38
|
-
<Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships">`+e.join(``)+`</Relationships>`}return g}async function He(e,t){let n=new t;for(let[t,r]of Object.entries(e))n.file(t,r);return n.generateAsync({type:`blob`,mimeType:`application/vnd.openxmlformats-officedocument.spreadsheetml.sheet`})}function Ue(e){let t=e=>!!e&&typeof e==`object`&&Object.keys(e).some(e=>/\.(ttf|otf)$/i.test(e))&&Object.values(e).every(e=>typeof e==`string`),n=new Set,r=e=>{if(!e||typeof e!=`object`||n.has(e))return null;if(n.add(e),t(e))return e;let i=e;return r(i.pdfMake?.vfs)??r(i.vfs)??r(i.default)};return r(e)}function We(e){return new Promise((t,n)=>{let r=e.getBlob(t);r&&typeof r.then==`function`&&r.then(t,n)})}function Ge(e,t){let n=Ue(t);return n?(typeof e.addVirtualFileSystem==`function`&&e.addVirtualFileSystem(n),e.vfs=n,!0):!1}function Ke(e){if(!e)return null;let t=e.trim(),n=/^#([0-9a-f]{3}|[0-9a-f]{6})$/i.exec(t);if(n){let e=n[1];return`#`+(e.length===3?e.split(``).map(e=>e+e).join(``):e).toLowerCase()}let r=/^rgba?\(\s*([\d.]+)[\s,]+([\d.]+)[\s,]+([\d.]+)(?:[\s,/]+([\d.]+%?))?\s*\)$/i.exec(t);if(!r||!((r[4]===void 0?1:r[4].endsWith(`%`)?Number(r[4].slice(0,-1))/100:Number(r[4]))>.05))return null;let i=e=>Math.max(0,Math.min(255,Math.round(Number(e)))).toString(16).padStart(2,`0`);return`#`+i(r[1])+i(r[2])+i(r[3])}function qe(e){let t=parseInt(e.slice(1),16),n=e=>{let t=e/255;return t<=.03928?t/12.92:((t+.055)/1.055)**2.4};return .2126*n(t>>16&255)+.7152*n(t>>8&255)+.0722*n(t&255)}function Je(e){if(!e||typeof getComputedStyle!=`function`)return{};let t=t=>e.querySelector(t),n=(e,t)=>e?Ke(getComputedStyle(e).getPropertyValue(t)):null,r=e=>{for(let t=e;t;t=t.parentElement){let e=n(t,`background-color`);if(e)return e}return null},i=`:not([class*="row-number"]):not([class*="selection"])`,a=t(`.sv-grid-head .sv-grid-column${i}`)??t(`.sv-grid-header-cell`)??t(`thead th`),o=t(`.sv-grid-body .sv-grid-row:not(.sv-grid-row-alt):not(.sv-grid-header-row) .sv-grid-cell${i}`)??t(`tbody td`),s=t(`.sv-grid-body .sv-grid-row-alt .sv-grid-cell${i}`),c=t(`.sv-grid-group-row .sv-grid-cell`),l={},u=r(a),d=n(a,`color`);u&&(l.headerColor=u),d&&(l.headerTextColor=d);let f=r(o?o.parentElement:t(`.sv-grid-container`)??e),p=n(o,`color`);if(f&&qe(f)<.4||p&&qe(p)>.5)return l;p&&(l.textColor=p);let m=n(o,`border-bottom-color`)??n(a,`border-bottom-color`);m&&(l.borderColor=m);let h=n(s,`background-color`);h&&h!==f&&(l.zebraColor=h);let g=n(c,`background-color`),_=n(c,`color`);return g&&g!==f&&(l.groupColor=g),_&&(l.groupTextColor=_),l}var Ye={A4:[595.28,841.89],A3:[841.89,1190.55],A5:[419.53,595.28],LETTER:[612,792],LEGAL:[612,1008]};async function Xe(e,t){if(!e?.length)return[];let n=[];for(let r of e){if(`image`in r){n.push(r);continue}let e=await t(r.element),i=await new Promise((t,n)=>{let r=new FileReader;r.onload=()=>t(String(r.result)),r.onerror=()=>n(r.error??Error(`could not read the chart image`)),r.readAsDataURL(e)});n.push({image:i,title:r.title,caption:r.caption,width:r.width})}return n}function Ze(e){let{columns:t}=e,n=e.opts??{},r=e.styles??{},i=e.theme??{},a=e.now??new Date(0),o=n.fontSize??8,s=n.headerColor??r.headerRow?.backgroundColor??i.headerColor??`#334155`,c=n.headerTextColor??r.headerRow?.color??i.headerTextColor??`#ffffff`,l=n.zebra??!0,u=n.zebraColor??r.rowAlternate?.backgroundColor??i.zebraColor??`#f1f5f9`,d=n.groupColor??i.groupColor??`#e2e8f0`,f=n.groupTextColor??i.groupTextColor??`#0f172a`,p=n.subtotalColor??i.subtotalColor??`#f8fafc`,m=n.textColor??r.rows?.color??i.textColor,h=n.borderColor??i.borderColor??`#e2e8f0`,g=n.repeatHeader??!0,_=e=>e===`bold`||typeof e==`number`&&e>=600,v=e=>{if(e===void 0)return;let t=typeof e==`number`?e:parseFloat(e);return Number.isFinite(t)&&t>0?t:void 0},y=(e,t)=>{if(!t)return;t.backgroundColor&&(e.fillColor=t.backgroundColor),t.color&&(e.color=t.color),_(t.fontWeight)?e.bold=!0:t.fontWeight===`normal`&&(e.bold=!1),t.fontStyle===`italic`&&(e.italics=!0);let n=v(t.fontSize);n&&(e.fontSize=n),t.textAlign&&(e.alignment=t.textAlign)},b=new Map;for(let[e,t]of Object.entries(r.cells??{})){let n=/^([A-Z]+)(\d+)$/i.exec(e.trim());if(!n)continue;let r=0;for(let e of n[1].toUpperCase())r=r*26+(e.charCodeAt(0)-64);b.set(`${Number(n[2])-1}:${r-1}`,t)}let x=n.pageOrientation??(t.length>(n.autoLandscapeThreshold??8)?`landscape`:`portrait`),S=Array.isArray(n.columnWidths)?n.columnWidths:t.map(()=>n.columnWidths===`auto`?`auto`:`*`),C=t.map((e,t)=>{let n={text:e.header,bold:!0,alignment:e.align??`left`,color:c,fillColor:s};return y(n,r.headerRow?{...r.headerRow,backgroundColor:void 0,color:void 0}:void 0),y(n,b.get(`0:${t}`)),n}),w=e.body??(e.rows??[]).map(e=>({kind:`data`,cells:e})),ee=e.dataCellStyle,te=e.dataCellLink,ne=0,T=new Set,E=[C];if(w.forEach((e,n)=>{let i=n+1;if(e.kind===`group`){let n={text:e.label,bold:!0,color:f,fillColor:d,colSpan:t.length,margin:[(e.level??0)*12,2,0,2]},r=Array.from({length:Math.max(0,t.length-1)},()=>({text:``}));E.push([n,...r])}else if(e.kind===`subtotal`)E.push(t.map((t,n)=>({text:e.cells[n]??``,bold:!0,alignment:t.align??`left`,fillColor:p})));else{T.add(i);let n=ne++;E.push(t.map((t,i)=>{let a={text:e.cells[i]??``,alignment:t.align??`left`};m&&(a.color=m),y(a,r.rows?{...r.rows,backgroundColor:void 0}:void 0),l&&n%2==1&&r.rowAlternate?.color&&(a.color=r.rowAlternate.color),y(a,b.get(`${n+1}:${i}`));let o=ee?.(n,i);o&&(o.fill&&(a.fillColor=o.fill),o.color&&(a.color=o.color),o.bold&&(a.bold=!0));let s=te?.(n,i);return s&&(a.link=s,a.decoration=`underline`,o?.color||(a.color=`#2563eb`)),a}))}}),e.merges?.length&&!e.body){let n=[...T].sort((e,t)=>e-t);for(let r of e.merges){let e=Math.max(1,Math.floor(r.rowSpan??1)),i=Math.max(1,Math.floor(r.colSpan??1));if(e===1&&i===1)continue;let a=n[r.row];if(a===void 0||r.col<0||r.col>=t.length)continue;let o=E[a]?.[r.col];if(o){e>1&&(o.rowSpan=Math.min(e,E.length-a)),i>1&&(o.colSpan=Math.min(i,t.length-r.col));for(let e=0;e<(o.rowSpan??1);e+=1)for(let t=0;t<(o.colSpan??1);t+=1){if(e===0&&t===0)continue;let n=E[a+e]?.[r.col+t];n&&(n.text=``)}}}}let D={table:{headerRows:+!!g,dontBreakRows:!0,widths:S,body:E},layout:{fillColor:e=>l&&e>0&&e%2==0&&T.has(e)?u:null,hLineWidth:()=>.5,vLineWidth:()=>.5,hLineColor:()=>h,vLineColor:()=>h,paddingTop:()=>3,paddingBottom:()=>3,paddingLeft:()=>5,paddingRight:()=>5}},O=(e,t)=>(e??[]).map(e=>{if(`image`in e)return{image:e.image,...e.width?{width:e.width}:{},...e.height?{height:e.height}:{},margin:t};if(`text`in e){let n={text:e.text};return y(n,e.style),{...n,margin:t}}return{columns:[{text:e.left??``,alignment:`left`},{text:e.center??``,alignment:`center`},{text:e.right??``,alignment:`right`}],margin:t}}),k=[];if(k.push(...O(e.headerLines,[0,0,0,4])),n.logo&&k.push({image:n.logo,width:n.logoWidth??90,margin:[0,0,0,8]}),n.title&&k.push({text:n.title,fontSize:o+8,bold:!0,margin:[0,0,0,2]}),n.subtitle&&k.push({text:n.subtitle,fontSize:o+1,color:`#64748b`,margin:[0,0,0,8]}),n.kpis?.length){let e=n.kpiColor??`#f8fafc`;k.push({table:{widths:n.kpis.map(()=>`*`),body:[n.kpis.map(t=>({fillColor:e,margin:[8,6,8,6],stack:[{text:t.label,fontSize:o,color:`#64748b`},{text:t.value,fontSize:o+10,bold:!0,margin:[0,2,0,0]},...t.delta?[{text:t.delta,fontSize:o,color:t.color??`#64748b`,margin:[0,2,0,0]}]:[]]}))]},layout:{hLineWidth:()=>0,vLineWidth:()=>4,vLineColor:()=>`#ffffff`,paddingLeft:()=>0,paddingRight:()=>0,paddingTop:()=>0,paddingBottom:()=>0},margin:[0,0,0,10]})}let A=n.margins??[28,34,28,34],[re,ie]=Ye[n.pageSize??`A4`],j=(x===`landscape`?ie:re)-A[0]-A[2],M=(e.charts??(n.charts??[]).filter(e=>`image`in e)).map(e=>({stack:[...e.title?[{text:e.title,fontSize:o+3,bold:!0,margin:[0,0,0,4]}]:[],{image:e.image,width:Math.min(e.width??j,j)},...e.caption?[{text:e.caption,fontSize:o,color:`#64748b`,margin:[0,3,0,0]}]:[]],margin:[0,0,0,12],unbreakable:!0}));n.chartsPosition!==`below`&&k.push(...M),k.push(D),n.chartsPosition===`below`&&(M.length&&k.push({text:``,margin:[0,0,0,12]}),k.push(...M)),k.push(...O(e.footerLines,[0,4,0,0]));let N={pageSize:n.pageSize??`A4`,pageOrientation:x,pageMargins:n.margins??[28,34,28,34],defaultStyle:{fontSize:o},content:k};if(n.showPageNumbers??!0){let e=a.toISOString().slice(0,10);N.footer=(t,n)=>({margin:[28,6,28,0],columns:[{text:e,alignment:`left`,fontSize:7,color:`#94a3b8`},{text:`Page ${t} of ${n}`,alignment:`right`,fontSize:7,color:`#94a3b8`}]})}return N}function Qe(e,t){let n=/^#?([0-9a-f]{6})$/i.exec(e.trim());if(!n)return e;let r=parseInt(n[1],16);return`#`+[r>>16&255,r>>8&255,r&255].map(e=>Math.round(e+(255-e)*t).toString(16).padStart(2,`0`)).join(``)}function $e(e){let t={};return e.background&&(t.fill=e.background),!t.fill&&e.dataBar&&(t.fill=Qe(e.dataBar.color,.72)),e.color&&e.color!==`transparent`&&(t.color=e.color),(e.fontWeight===`bold`||typeof e.fontWeight==`number`&&e.fontWeight>=600)&&(t.bold=!0),e.icon&&(t.icon=e.icon),Object.keys(t).length>0?t:void 0}function U(e,t,a){if(!a||a.length===0)return()=>void 0;let o=new Map;if(r(a))for(let n of e)o.set(n.field,i(t.map(e=>e[n.field])));return(r,i)=>{let s=e[i],c=t[r];if(!s||!c)return;let l=c[s.field];return $e(n(l,c,s.field,a,o.get(s.field)??null))}}var et=[`csv`,`tsv`,`html`,`json`,`xml`,`md`],tt=null;async function nt(){if(typeof window>`u`)throw Error(`@svgrid/enterprise: export requires a browser environment`);return tt||=(async()=>{De(),await h(()=>import(`./smart.export-CDCwbFH4.js`),[],import.meta.url);let e=window.Smart?.Utilities?.DataExporter;if(!e)throw Error(`@svgrid/enterprise: failed to load Smart.Utilities.DataExporter`);return e})(),tt}async function W(t){let n=globalThis;if(t===`xlsx`&&n.JSZip==null){let t;try{t=await h(()=>import(`./jszip.min-CX2fPs3O.js`).then(t=>e(t.default,1)),__vite__mapDeps([0,1]),import.meta.url)}catch{throw Error(`@svgrid/enterprise: xlsx export requires the "jszip" peer dependency. Install it with: pnpm add jszip`)}n.JSZip=t.default??t}if(t===`pdf`&&n.pdfMake==null){let t,r;try{t=await h(()=>import(`./pdfmake-BpIYFHoG.js`).then(t=>e(t.default,1)),__vite__mapDeps([2,1]),import.meta.url),r=await h(()=>import(`./vfs_fonts-BV-Ul9v2.js`).then(t=>e(t.default,1)),__vite__mapDeps([3,1]),import.meta.url)}catch{throw Error(`@svgrid/enterprise: pdf export requires the "pdfmake" peer dependency. Install it with: pnpm add pdfmake`)}let i=t.default??t;if(!Ge(i,r))throw Error(`@svgrid/enterprise: "pdfmake/build/vfs_fonts" did not contain a font map; the installed pdfmake is not one this export knows.`);n.pdfMake=i}}function G(e,t){if(Array.isArray(t))return t;switch(t){case`selected`:return e.getSelectedRows();case`all`:return e.getData();case`displayed`:case void 0:default:return e.getDisplayedRows()}}function K(e,t,n){if(t.columns&&t.columns.length>0)return t.columns;let r=e.getColumns().filter(e=>e.visible&&e.field);return r.length>0?r.map(e=>({field:e.field,header:e.header,format:e.format,align:e.align})):n.length>0?Object.keys(n[0]).filter(e=>!e.startsWith(`_`)).map(e=>({field:e})):[]}function q(e,t,n){if(e.exportValue)return e.exportValue(t)??``;let r=t[e.field];return n?r:c(r,e.format)}async function J(e,t,n){let r=n.rawValues===!0,i={};for(let e of t)i[e.field]=e.header??e.field;let a=[i],o=e.length;for(let i=0;i<o;i++){if(n.signal?.aborted)throw new DOMException(`Export aborted`,`AbortError`);let s=e[i],c={};for(let e of t)c[e.field]=q(e,s,r);a.push(c),i>0&&i%5e3==0&&(n.onProgress?.({phase:`project`,ratio:i/o,row:i,total:o}),await new Promise(e=>setTimeout(e,0)))}return n.onProgress?.({phase:`project`,ratio:1,row:o,total:o}),a}function rt(e){if(!e)return;let t={};e.headerRow&&(t.header={...e.headerRow});let n=e.rows?{...e.rows}:{};return e.rowAlternate&&(n.alternationCount=2,n.alternationStart=0,e.rowAlternate.backgroundColor&&(n.alternationIndex1BackgroundColor=e.rowAlternate.backgroundColor),e.rowAlternate.color&&(n.alternationIndex1Color=e.rowAlternate.color)),Object.keys(n).length>0&&(t.rows=n),e.cells&&(t.cells=e.cells),t}var it=0,at=new Map;function ot(e){let t=at.get(e);if(t)return t;let n=`img${++it}`;return at.set(e,n),n}function st(e,t=64,n=64){let r=/^data:image\/([a-zA-Z0-9+]+);/i.exec(e)?.[1]?.toLowerCase()??`png`,i=r===`jpg`?`jpeg`:r===`svg+xml`?`svg`:r;return{id:ot(e),base64:e,imageType:i,width:t,height:n}}function ct(e,t){if(!e||e.length===0||t.length===0)return;let n=t[0],r=[];for(let i of e){let e={},a;if(`image`in i)e[n]=i.image,a={mergeAcross:!0,textAlign:`left`};else if(`text`in i)e[n]=i.text,a={mergeAcross:!0,...i.style??{}};else{let r=t[Math.floor(t.length/2)],o=t[t.length-1];i.left!==void 0&&(e[n]=i.left),i.center!==void 0&&(e[r]=i.center),i.right!==void 0&&(e[o]=i.right),a={textAlign:`left`}}r.push({cells:e,style:a})}return r}function lt(e,t){let n=e&&e.length>0?new Set(e):null;return(e,r,i)=>typeof i!=`string`||!/^data:image\//i.test(i)?null:n&&!n.has(r)?{image:st(i,96,96),value:``}:{image:st(i,t.width,t.height),value:``}}function ut(e){let t={exportHeader:!0,pageOrientation:e.pageOrientation??`portrait`};e.freezeHeader!==!1&&(t.freezeHeader=!0),e.freezeColumns&&e.freezeColumns>0&&(t.freezeColumnsCount=Math.floor(e.freezeColumns));let n=rt(e.styles);if(n&&(t.style=n),e.hierarchical&&(t.hierarchical=!0),e.merges?.length&&!e.groupBy?.length&&!e.hierarchical){let n=e.merges.map(e=>({cell:[e.row,e.col],rowspan:Math.max(1,Math.floor(e.rowSpan??1)),colspan:Math.max(1,Math.floor(e.colSpan??1))})).filter(e=>e.rowspan>1||e.colspan>1);n.length&&(t.mergedCells=n)}return t}function dt(e,t,n){let r=ct(t.header,n),i=ct(t.footer,n);r&&(e.headerContent=r),i&&(e.footerContent=i);let a=(t.header?.some(e=>`image`in e)??!1)||(t.footer?.some(e=>`image`in e)??!1);if(t.imageFields?.length||a){let n=t.imageSize??{width:32,height:32};e.addImageToCell=lt(t.imageFields,n)}return e}function Y(e,t){return e.toLowerCase().endsWith(`.`+t)?e:`${e}.${t}`}function ft(e,t,n,r,i){return i!==!1&&p(e,t),{blob:e,filename:t,mime:n,rowCount:r,byteSize:e.size}}function pt(e,t,n,r,i){i!==!1&&u(e,t,n);let a=new Blob([e],{type:n});return{blob:a,filename:t,mime:n,rowCount:r,byteSize:a.size}}function X(e,t,n){let r=Math.min(t.length,200);return e.map(e=>{if(typeof e.width==`number`)return e.width;let i=String(e.header??e.field).length;for(let a=0;a<r;a++){let r=q(e,t[a],n),o=r==null?0:String(r).length;o>i&&(i=o)}return Math.max(48,Math.min(400,i*7+14))})}function mt(e,t,n){if(typeof t.freezeColumns==`number`)return t.freezeColumns;let r=e.getColumnPinning().left;if(!r||r.length===0)return;let i=new Set(r),a=0;for(let e of n)if(i.has(e.field))a++;else break;return a>0?a:void 0}function ht(e){let t=e,n=``;do n=String.fromCharCode(65+t%26)+n,t=Math.floor(t/26)-1;while(t>=0);return n}function Z(e,t){if(e.some(e=>e.link))return(n,r)=>{let i=e[r],a=t[n];if(!(!i?.link||!a))return i.link(a)||void 0}}function gt(e){let t={};for(let n of e)n.align&&(t[n.field]=n.align);return t}async function _t(e,t,n,r,i,s){let c=n.map(e=>e.field),u={onProgress:r.onProgress,signal:r.signal};switch(e){case`html`:return{text:await d(t,c,{...u,title:(r.filename??`grid`).trim()||`grid`,align:gt(n),cellStyle:i,cellLink:s}),mime:`text/html;charset=utf-8`,ext:`html`};case`json`:return{text:await f(t,c,u),mime:`application/json;charset=utf-8`,ext:`json`};case`xml`:return{text:await l(t,c,u),mime:`application/xml;charset=utf-8`,ext:`xml`};case`md`:return{text:await o(t,c,{...u,align:gt(n)}),mime:`text/markdown;charset=utf-8`,ext:`md`};case`tsv`:return{text:await a(t,c,{...u,csv:{...r.csv,delimiter:` `}}),mime:`text/tab-separated-values;charset=utf-8`,ext:`tsv`};default:{let e=r.csv?.delimiter??`,`;return{text:await a(t,c,{...u,csv:{...r.csv,delimiter:e}}),mime:`text/csv;charset=utf-8`,ext:`csv`}}}}async function vt(e,t){if(t.sheets&&t.sheets.length>0)throw Error(`@svgrid/enterprise: multi-sheet export requires format 'xlsx', got '${t.format}'`);let n=G(e,t.rows);if(n.length===0)throw Error(`@svgrid/enterprise: nothing to export - the grid has no rows`);let r=K(e,t,n),i=await J(n,r,t.format===`json`?{...t,rawValues:t.rawValues??!0}:t),a=(t.filename??`grid`).trim()||`grid`,o=t.format===`html`?U(r,n,t.conditionalFormats):void 0,s=t.format===`html`?Z(r,n):void 0,{text:c,mime:l,ext:u}=await _t(t.format,i,r,t,o,s);return pt(c,Y(a,u),l,n.length,t.download)}async function yt(e,t){if(t.sheets&&t.sheets.length>0)throw Error(`@svgrid/enterprise: multi-sheet export requires format 'xlsx'. Use 'xls' for a single legacy sheet.`);let n=G(e,t.rows);if(n.length===0)throw Error(`@svgrid/enterprise: nothing to export - the grid has no rows`);let r=K(e,t,n),i=(t.filename??`grid`).trim()||`grid`,a=U(r,n,t.conditionalFormats);return pt(await Ae(i,r,n,{rawValues:t.rawValues,onProgress:t.onProgress,signal:t.signal,freezeHeader:t.freezeHeader!==!1,freezeColumns:mt(e,t,r),widths:t.autoFitColumns===!1?void 0:X(r,n,t.rawValues===!0),cellVisual:t.conditionalFormats?.length?a:void 0,precisionSafe:t.precisionSafe}),Y(i,`xls`),`application/vnd.ms-excel;charset=utf-8`,n.length,t.download)}function Q(e){return e.format?.type===`number`||e.format?.type===`currency`}function bt(e,t,n){let r=[],i=t=>e.find(e=>e.field===t)?.header??t,a=e.findIndex(e=>!Q(e)),o=(t,s)=>{if(s>=n.length){for(let n of t)r.push({kind:`data`,cells:e.map(e=>String(q(e,n,!1)??``))});return}let l=n[s],u=new Map;for(let e of t){let t=String(e[l]??``),n=u.get(t);n?n.push(e):u.set(t,[e])}for(let[t,n]of u)if(r.push({kind:`group`,label:`${i(l)}: ${t} (${n.length})`,level:s}),o(n,s+1),e.some(Q)){let i=e.map(e=>{if(!Q(e))return``;let t=n.reduce((t,n)=>t+(Number(n[e.field])||0),0);return c(t,e.format)});a>=0&&(i[a]=`Subtotal (${t})`),r.push({kind:`subtotal`,cells:i})}};return o(t,0),r}async function xt(e,t){await W(`pdf`);let n=globalThis.pdfMake;if(!n)throw Error(`@svgrid/enterprise: pdf export requires the "pdfmake" peer dependency.`);let r=G(e,t.rows);if(r.length===0)throw Error(`@svgrid/enterprise: nothing to export - the grid has no rows`);let i=K(e,t,r),a=i.map(e=>e.field),o=i.map(e=>({header:e.header??e.field,align:e.align})),s=t.autoGroup!==!1&&!t.groupBy?.length&&!t.hierarchical?(e.getState().grouping??[]).filter(e=>!!e).map(e=>String(e)):[],c=t.groupBy?.length?t.groupBy:s.length>0?s:void 0;if(t.signal?.aborted)throw new DOMException(`Export aborted`,`AbortError`);t.onProgress?.({phase:`write`,ratio:0,total:r.length});let l={...t.pdf,pageOrientation:t.pdf?.pageOrientation??t.pageOrientation},u=l.matchTheme===!1?{}:Je(e.getElement?.()??null),d={headerLines:t.header,footerLines:t.footer},f=await Xe(l.charts,async e=>{let{chartToPngBlob:t}=await h(async()=>{let{chartToPngBlob:e}=await import(`./src-CITpcm6b.js`).then(e=>e.t);return{chartToPngBlob:e}},__vite__mapDeps([4,1,5]),import.meta.url);return t(e,{scale:2})}),p=new Date,m;if(c?.length)m=Ze({columns:o,body:bt(i,r,c),opts:l,styles:t.styles,theme:u,...d,charts:f,now:p});else{let e=(await J(r,i,t)).slice(1).map(e=>a.map(t=>String(e[t]??``))),n=U(i,r,t.conditionalFormats);for(let t=0;t<e.length;t++)for(let r=0;r<i.length;r++){let i=n(t,r)?.icon;i&&(e[t][r]=`${i} ${e[t][r]??``}`)}m=Ze({columns:o,rows:e,dataCellStyle:(e,t)=>{let r=n(e,t);return r?{fill:r.fill,color:r.color,bold:r.bold}:void 0},dataCellLink:Z(i,r),opts:l,styles:t.styles,theme:u,...d,merges:t.merges,charts:f,now:p})}let g=(t.filename??`grid`).trim()||`grid`,_=await We(n.createPdf(m));return t.onProgress?.({phase:`write`,ratio:1,total:r.length}),ft(_,Y(g,`pdf`),`application/pdf`,r.length,t.download)}async function St(e,t,n,r,i,a){let o=e.map(e=>e.header??e.field),l=a?.precisionSafe===!0,u=(e,t,n)=>l&&Math.abs(e)>=0x38d7ea4c68000?{t:`s`,value:String(e),...t}:{t:`n`,value:e,numFmt:n,...t},d=(t,a,o)=>{let l=e[o],d=r(a,o),f={align:l.align,fill:d?.fill,color:d?.color,bold:d?.bold,link:i?.(a,o)};if(l.exportValue){let e=l.exportValue(t);return typeof e==`number`&&Number.isFinite(e)?u(e,f,m(l.format)):e instanceof Date?{t:`d`,value:e,numFmt:m(l.format)??`yyyy-mm-dd`,...f}:{t:`s`,value:e==null?``:String(e),...f}}let p=t[l.field];if(d?.icon){let e=n?String(p??``):c(p,l.format);return{t:`s`,value:`${d.icon} ${e}`,...f}}if(n)return typeof p==`number`&&Number.isFinite(p)?u(p,f):{t:`s`,value:p==null?``:String(p),...f};let h=s(p,l.format);return h.ok?h.value instanceof Date?{t:`d`,value:h.value,numFmt:m(l.format)??`yyyy-mm-dd`,...f}:u(h.value,f,m(l.format)):{t:`s`,value:c(p,l.format),...f}},f=[],p=t.length;for(let n=0;n<p;n++){if(a?.signal?.aborted)throw new DOMException(`Export aborted`,`AbortError`);let r=t[n];f.push(e.map((e,t)=>d(r,n,t))),n>0&&n%2e3==0&&(a?.onProgress?.({phase:`project`,ratio:n/p,row:n,total:p}),await new Promise(e=>setTimeout(e,0)))}return{header:o,cells:f}}async function Ct(e,t){await W(`xlsx`);let n=globalThis.JSZip;if(!n)throw Error(`@svgrid/enterprise: xlsx export requires the "jszip" peer dependency.`);let r=G(e,t.rows);if(r.length===0)throw Error(`@svgrid/enterprise: nothing to export - the grid has no rows`);let i=K(e,t,r),a=t.rawValues===!0,o=t.conditionalFormats??[],s=U(i,r,o.filter(e=>e.type===`rule`||e.type===`iconSet`)),c=Z(i,r),l=[];for(let e of o){if(e.type!==`colorScale`&&e.type!==`dataBar`)continue;let t=e.columns&&e.columns.length>0?i.map((t,n)=>e.columns.includes(t.field)?n:-1).filter(e=>e>=0):i.map((e,t)=>t);for(let n of t)if(e.type===`dataBar`)l.push({kind:`dataBar`,colIdx:n,color:e.color});else{let t=e.min??`#ffffff`,r=e.max??`#000000`;l.push({kind:`colorScale`,colIdx:n,colors:e.mid?[t,e.mid,r]:[t,r]})}}if(t.signal?.aborted)throw new DOMException(`Export aborted`,`AbortError`);t.onProgress?.({phase:`write`,ratio:0,total:r.length});let{header:u,cells:d}=await St(i,r,a,s,c,{onProgress:t.onProgress,signal:t.signal,precisionSafe:t.precisionSafe}),f=t.autoFitColumns===!1?void 0:X(i,r,a),p=(t.filename??`grid`).trim()||`grid`,m;t.excelTable&&(m={name:`Table1`,totalsRow:typeof t.excelTable==`object`&&t.excelTable.totalsRow===!0,style:typeof t.excelTable==`object`?t.excelTable.style:void 0,totalsFns:i.map(e=>Q(e)?`sum`:void 0)});let h=await He(Ve({sheetName:p,header:u,rows:d,widths:f,freezeHeader:t.freezeHeader!==!1,freezeColumns:mt(e,t,i),condFormats:l,table:m}),n);return t.onProgress?.({phase:`write`,ratio:1,total:r.length}),ft(h,Y(p,`xlsx`),`application/vnd.openxmlformats-officedocument.spreadsheetml.sheet`,r.length,t.download)}async function wt(e,t){if(Te(`Export`),et.includes(t.format))return vt(e,t);if(t.format===`xls`)return yt(e,t);if(t.format===`pdf`)return xt(e,t);if(t.format===`xlsx`){let n=t.autoGroup===!1?[]:(e.getState().grouping??[]).filter(e=>!!e),r=(t.groupBy?.length??0)>0||n.length>0,i=!!t.styles&&!t.conditionalFormats?.length;if(!t.sheets?.length&&!r&&!t.hierarchical&&!t.merges?.length&&!t.header?.length&&!t.footer?.length&&!t.imageFields?.length&&!i)return Ct(e,t)}await W(t.format);let n=await nt();if(t.sheets&&t.sheets.length>0){if(t.format!==`xlsx`)throw Error(`@svgrid/enterprise: multi-sheet export requires format 'xlsx', got '${t.format}'`);let r=t.rawValues===!0,i=t.sheets.map(n=>{let i=K(e,{columns:n.columns??t.columns},n.rows),a=n.rows.map(e=>{let t={};for(let n of i)t[n.field]=q(n,e,r);return t}),o=t.autoFitColumns===!1?null:X(i,n.rows,r);return{label:n.label,dataSource:a,columns:i.map((e,t)=>o?{dataField:e.field,label:e.header??e.field,width:o[t]}:{dataField:e.field,label:e.header??e.field}),dataFields:i.map(e=>e.field),style:rt(n.styles??t.styles)}}),a=(t.filename??`grid`).trim()||`grid`,o=ut(t),s=i[0],c=new n(o);c.spreadsheets=i,dt(c,t,s.dataFields);let l={};for(let e of s.columns)l[e.dataField]=e.label;let u=[l,...s.dataSource];if(t.download===!1)throw Error(`@svgrid/enterprise: download:false is not supported for multi-sheet xlsx.`);c.exportData(u,t.format,a);return}let r=G(e,t.rows);if(r.length===0)throw Error(`@svgrid/enterprise: nothing to export - the grid has no rows`);let i=K(e,t,r),a=await J(r,i,t),o=(t.filename??`grid`).trim()||`grid`,s=i.map(e=>e.field),c=t.autoGroup!==!1&&!t.groupBy?.length&&!t.hierarchical?(e.getState().grouping??[]).filter(e=>!!e).map(e=>String(e)):[],l=t.groupBy?.length?t.groupBy:c.length>0?c:void 0,u=!t.hierarchical&&l?.length?l:void 0,d=ut(t);if(t.conditionalFormats?.length){let e=U(i,r,t.conditionalFormats),n={};for(let t=0;t<r.length;t++)for(let r=0;r<i.length;r++){let o=e(t,r);if(!o)continue;let s={};if(o.fill&&(s.backgroundColor=o.fill),o.color&&(s.color=o.color),o.bold&&(s.fontWeight=`bold`),Object.keys(s).length&&(n[ht(r)+(t+2)]=s),o.icon){let e=a[t+1],n=i[r].field;e&&(e[n]=`${o.icon} ${e[n]??``}`)}}if(Object.keys(n).length){let e=d.style??{};d.style={...e,cells:{...e.cells??{},...n}}}}if(t.download===!1)throw Error(`@svgrid/enterprise: download:false is not supported for this xlsx export (grouped / merges / header / footer / images). Use a plain xlsx, xls, pdf, or a text format.`);if(t.signal?.aborted)throw new DOMException(`Export aborted`,`AbortError`);t.onProgress?.({phase:`write`,ratio:0,total:a.length-1});let f=new n(d,u);dt(f,t,s),f.exportData(a,t.format,o),t.onProgress?.({phase:`write`,ratio:1,total:a.length-1})}var Tt={"&":`&`,"<":`<`,">":`>`,'"':`"`,"'":`'`};function $(e){return(e==null?``:String(e)).replace(/[&<>"']/g,e=>Tt[e])}function Et(e){let{columns:t,rows:n}=e,r=e.cellStyle,i=e.cellLink,a=e.opts??{},o=a.orientation??`portrait`,s=a.pageSize?`${a.pageSize} ${o}`:o,c=a.margin??`14mm`,l=a.zebra??!0,u=a.zebraColor??`#f6f8fa`,d=a.headerColor??`#f1f5f9`,f=a.headerTextColor??`#0f172a`,p=a.fontSize??9,m=e=>e&&e!==`left`?` style="text-align:${e}"`:``,h=`<thead><tr>`+t.map(e=>`<th${m(e.align)}>${$(e.header)}</th>`).join(``)+`</tr></thead>`,g=(e,t,n,a)=>{let o=[];e.align&&e.align!==`left`&&o.push(`text-align:${e.align}`);let s=r?.(n,a);s?.fill&&o.push(`background:${s.fill}`),s?.color&&o.push(`color:${s.color}`),s?.bold&&o.push(`font-weight:700`);let c=o.length?` style="${o.join(`;`)}"`:``,l=s?.icon?`${$(s.icon)} ${$(t)}`:$(t),u=i?.(n,a);return u&&(l=`<a href="${$(u)}">${l}</a>`),`<td${c}>${l}</td>`},_=`<tbody>`+n.map((e,n)=>`<tr>`+t.map((t,r)=>g(t,e[r]??``,n,r)).join(``)+`</tr>`).join(``)+`</tbody>`,v=[];return a.logo&&v.push(`<img class="logo" src="${$(a.logo)}" alt="" />`),a.title&&v.push(`<h1>${$(a.title)}</h1>`),a.subtitle&&v.push(`<p class="subtitle">${$(a.subtitle)}</p>`),`<!DOCTYPE html>
|
|
38
|
+
<Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships">`+e.join(``)+`</Relationships>`}return g}async function He(e,t){let n=new t;for(let[t,r]of Object.entries(e))n.file(t,r);return n.generateAsync({type:`blob`,mimeType:`application/vnd.openxmlformats-officedocument.spreadsheetml.sheet`})}function Ue(e){let t=e=>!!e&&typeof e==`object`&&Object.keys(e).some(e=>/\.(ttf|otf)$/i.test(e))&&Object.values(e).every(e=>typeof e==`string`),n=new Set,r=e=>{if(!e||typeof e!=`object`||n.has(e))return null;if(n.add(e),t(e))return e;let i=e;return r(i.pdfMake?.vfs)??r(i.vfs)??r(i.default)};return r(e)}function We(e){return new Promise((t,n)=>{let r=e.getBlob(t);r&&typeof r.then==`function`&&r.then(t,n)})}function Ge(e,t){let n=Ue(t);return n?(typeof e.addVirtualFileSystem==`function`&&e.addVirtualFileSystem(n),e.vfs=n,!0):!1}function Ke(e){if(!e)return null;let t=e.trim(),n=/^#([0-9a-f]{3}|[0-9a-f]{6})$/i.exec(t);if(n){let e=n[1];return`#`+(e.length===3?e.split(``).map(e=>e+e).join(``):e).toLowerCase()}let r=/^rgba?\(\s*([\d.]+)[\s,]+([\d.]+)[\s,]+([\d.]+)(?:[\s,/]+([\d.]+%?))?\s*\)$/i.exec(t);if(!r||!((r[4]===void 0?1:r[4].endsWith(`%`)?Number(r[4].slice(0,-1))/100:Number(r[4]))>.05))return null;let i=e=>Math.max(0,Math.min(255,Math.round(Number(e)))).toString(16).padStart(2,`0`);return`#`+i(r[1])+i(r[2])+i(r[3])}function qe(e){let t=parseInt(e.slice(1),16),n=e=>{let t=e/255;return t<=.03928?t/12.92:((t+.055)/1.055)**2.4};return .2126*n(t>>16&255)+.7152*n(t>>8&255)+.0722*n(t&255)}function Je(e){if(!e||typeof getComputedStyle!=`function`)return{};let t=t=>e.querySelector(t),n=(e,t)=>e?Ke(getComputedStyle(e).getPropertyValue(t)):null,r=e=>{for(let t=e;t;t=t.parentElement){let e=n(t,`background-color`);if(e)return e}return null},i=`:not([class*="row-number"]):not([class*="selection"])`,a=t(`.sv-grid-head .sv-grid-column${i}`)??t(`.sv-grid-header-cell`)??t(`thead th`),o=t(`.sv-grid-body .sv-grid-row:not(.sv-grid-row-alt):not(.sv-grid-header-row) .sv-grid-cell${i}`)??t(`tbody td`),s=t(`.sv-grid-body .sv-grid-row-alt .sv-grid-cell${i}`),c=t(`.sv-grid-group-row .sv-grid-cell`),l={},u=r(a),d=n(a,`color`);u&&(l.headerColor=u),d&&(l.headerTextColor=d);let f=r(o?o.parentElement:t(`.sv-grid-container`)??e),p=n(o,`color`);if(f&&qe(f)<.4||p&&qe(p)>.5)return l;p&&(l.textColor=p);let m=n(o,`border-bottom-color`)??n(a,`border-bottom-color`);m&&(l.borderColor=m);let h=n(s,`background-color`);h&&h!==f&&(l.zebraColor=h);let g=n(c,`background-color`),_=n(c,`color`);return g&&g!==f&&(l.groupColor=g),_&&(l.groupTextColor=_),l}var Ye={A4:[595.28,841.89],A3:[841.89,1190.55],A5:[419.53,595.28],LETTER:[612,792],LEGAL:[612,1008]};async function Xe(e,t){if(!e?.length)return[];let n=[];for(let r of e){if(`image`in r){n.push(r);continue}let e=await t(r.element),i=await new Promise((t,n)=>{let r=new FileReader;r.onload=()=>t(String(r.result)),r.onerror=()=>n(r.error??Error(`could not read the chart image`)),r.readAsDataURL(e)});n.push({image:i,title:r.title,caption:r.caption,width:r.width})}return n}function Ze(e){let{columns:t}=e,n=e.opts??{},r=e.styles??{},i=e.theme??{},a=e.now??new Date(0),o=n.fontSize??8,s=n.headerColor??r.headerRow?.backgroundColor??i.headerColor??`#334155`,c=n.headerTextColor??r.headerRow?.color??i.headerTextColor??`#ffffff`,l=n.zebra??!0,u=n.zebraColor??r.rowAlternate?.backgroundColor??i.zebraColor??`#f1f5f9`,d=n.groupColor??i.groupColor??`#e2e8f0`,f=n.groupTextColor??i.groupTextColor??`#0f172a`,p=n.subtotalColor??i.subtotalColor??`#f8fafc`,m=n.textColor??r.rows?.color??i.textColor,h=n.borderColor??i.borderColor??`#e2e8f0`,g=n.repeatHeader??!0,_=e=>e===`bold`||typeof e==`number`&&e>=600,v=e=>{if(e===void 0)return;let t=typeof e==`number`?e:parseFloat(e);return Number.isFinite(t)&&t>0?t:void 0},y=(e,t)=>{if(!t)return;t.backgroundColor&&(e.fillColor=t.backgroundColor),t.color&&(e.color=t.color),_(t.fontWeight)?e.bold=!0:t.fontWeight===`normal`&&(e.bold=!1),t.fontStyle===`italic`&&(e.italics=!0);let n=v(t.fontSize);n&&(e.fontSize=n),t.textAlign&&(e.alignment=t.textAlign)},b=new Map;for(let[e,t]of Object.entries(r.cells??{})){let n=/^([A-Z]+)(\d+)$/i.exec(e.trim());if(!n)continue;let r=0;for(let e of n[1].toUpperCase())r=r*26+(e.charCodeAt(0)-64);b.set(`${Number(n[2])-1}:${r-1}`,t)}let x=n.pageOrientation??(t.length>(n.autoLandscapeThreshold??8)?`landscape`:`portrait`),S=Array.isArray(n.columnWidths)?n.columnWidths:t.map(()=>n.columnWidths===`auto`?`auto`:`*`),C=t.map((e,t)=>{let n={text:e.header,bold:!0,alignment:e.align??`left`,color:c,fillColor:s};return y(n,r.headerRow?{...r.headerRow,backgroundColor:void 0,color:void 0}:void 0),y(n,b.get(`0:${t}`)),n}),w=e.body??(e.rows??[]).map(e=>({kind:`data`,cells:e})),ee=e.dataCellStyle,te=e.dataCellLink,ne=0,T=new Set,E=[C];if(w.forEach((e,n)=>{let i=n+1;if(e.kind===`group`){let n={text:e.label,bold:!0,color:f,fillColor:d,colSpan:t.length,margin:[(e.level??0)*12,2,0,2]},r=Array.from({length:Math.max(0,t.length-1)},()=>({text:``}));E.push([n,...r])}else if(e.kind===`subtotal`)E.push(t.map((t,n)=>({text:e.cells[n]??``,bold:!0,alignment:t.align??`left`,fillColor:p})));else{T.add(i);let n=ne++;E.push(t.map((t,i)=>{let a={text:e.cells[i]??``,alignment:t.align??`left`};m&&(a.color=m),y(a,r.rows?{...r.rows,backgroundColor:void 0}:void 0),l&&n%2==1&&r.rowAlternate?.color&&(a.color=r.rowAlternate.color),y(a,b.get(`${n+1}:${i}`));let o=ee?.(n,i);o&&(o.fill&&(a.fillColor=o.fill),o.color&&(a.color=o.color),o.bold&&(a.bold=!0));let s=te?.(n,i);return s&&(a.link=s,a.decoration=`underline`,o?.color||(a.color=`#2563eb`)),a}))}}),e.merges?.length&&!e.body){let n=[...T].sort((e,t)=>e-t);for(let r of e.merges){let e=Math.max(1,Math.floor(r.rowSpan??1)),i=Math.max(1,Math.floor(r.colSpan??1));if(e===1&&i===1)continue;let a=n[r.row];if(a===void 0||r.col<0||r.col>=t.length)continue;let o=E[a]?.[r.col];if(o){e>1&&(o.rowSpan=Math.min(e,E.length-a)),i>1&&(o.colSpan=Math.min(i,t.length-r.col));for(let e=0;e<(o.rowSpan??1);e+=1)for(let t=0;t<(o.colSpan??1);t+=1){if(e===0&&t===0)continue;let n=E[a+e]?.[r.col+t];n&&(n.text=``)}}}}let D={table:{headerRows:+!!g,dontBreakRows:!0,widths:S,body:E},layout:{fillColor:e=>l&&e>0&&e%2==0&&T.has(e)?u:null,hLineWidth:()=>.5,vLineWidth:()=>.5,hLineColor:()=>h,vLineColor:()=>h,paddingTop:()=>3,paddingBottom:()=>3,paddingLeft:()=>5,paddingRight:()=>5}},O=(e,t)=>(e??[]).map(e=>{if(`image`in e)return{image:e.image,...e.width?{width:e.width}:{},...e.height?{height:e.height}:{},margin:t};if(`text`in e){let n={text:e.text};return y(n,e.style),{...n,margin:t}}return{columns:[{text:e.left??``,alignment:`left`},{text:e.center??``,alignment:`center`},{text:e.right??``,alignment:`right`}],margin:t}}),k=[];if(k.push(...O(e.headerLines,[0,0,0,4])),n.logo&&k.push({image:n.logo,width:n.logoWidth??90,margin:[0,0,0,8]}),n.title&&k.push({text:n.title,fontSize:o+8,bold:!0,margin:[0,0,0,2]}),n.subtitle&&k.push({text:n.subtitle,fontSize:o+1,color:`#64748b`,margin:[0,0,0,8]}),n.kpis?.length){let e=n.kpiColor??`#f8fafc`;k.push({table:{widths:n.kpis.map(()=>`*`),body:[n.kpis.map(t=>({fillColor:e,margin:[8,6,8,6],stack:[{text:t.label,fontSize:o,color:`#64748b`},{text:t.value,fontSize:o+10,bold:!0,margin:[0,2,0,0]},...t.delta?[{text:t.delta,fontSize:o,color:t.color??`#64748b`,margin:[0,2,0,0]}]:[]]}))]},layout:{hLineWidth:()=>0,vLineWidth:()=>4,vLineColor:()=>`#ffffff`,paddingLeft:()=>0,paddingRight:()=>0,paddingTop:()=>0,paddingBottom:()=>0},margin:[0,0,0,10]})}let A=n.margins??[28,34,28,34],[re,ie]=Ye[n.pageSize??`A4`],j=(x===`landscape`?ie:re)-A[0]-A[2],M=(e.charts??(n.charts??[]).filter(e=>`image`in e)).map(e=>({stack:[...e.title?[{text:e.title,fontSize:o+3,bold:!0,margin:[0,0,0,4]}]:[],{image:e.image,width:Math.min(e.width??j,j)},...e.caption?[{text:e.caption,fontSize:o,color:`#64748b`,margin:[0,3,0,0]}]:[]],margin:[0,0,0,12],unbreakable:!0}));n.chartsPosition!==`below`&&k.push(...M),k.push(D),n.chartsPosition===`below`&&(M.length&&k.push({text:``,margin:[0,0,0,12]}),k.push(...M)),k.push(...O(e.footerLines,[0,4,0,0]));let N={pageSize:n.pageSize??`A4`,pageOrientation:x,pageMargins:n.margins??[28,34,28,34],defaultStyle:{fontSize:o},content:k};if(n.showPageNumbers??!0){let e=a.toISOString().slice(0,10);N.footer=(t,n)=>({margin:[28,6,28,0],columns:[{text:e,alignment:`left`,fontSize:7,color:`#94a3b8`},{text:`Page ${t} of ${n}`,alignment:`right`,fontSize:7,color:`#94a3b8`}]})}return N}function Qe(e,t){let n=/^#?([0-9a-f]{6})$/i.exec(e.trim());if(!n)return e;let r=parseInt(n[1],16);return`#`+[r>>16&255,r>>8&255,r&255].map(e=>Math.round(e+(255-e)*t).toString(16).padStart(2,`0`)).join(``)}function $e(e){let t={};return e.background&&(t.fill=e.background),!t.fill&&e.dataBar&&(t.fill=Qe(e.dataBar.color,.72)),e.color&&e.color!==`transparent`&&(t.color=e.color),(e.fontWeight===`bold`||typeof e.fontWeight==`number`&&e.fontWeight>=600)&&(t.bold=!0),e.icon&&(t.icon=e.icon),Object.keys(t).length>0?t:void 0}function U(e,t,a){if(!a||a.length===0)return()=>void 0;let o=new Map;if(r(a))for(let n of e)o.set(n.field,i(t.map(e=>e[n.field])));return(r,i)=>{let s=e[i],c=t[r];if(!s||!c)return;let l=c[s.field];return $e(n(l,c,s.field,a,o.get(s.field)??null))}}var et=[`csv`,`tsv`,`html`,`json`,`xml`,`md`],tt=null;async function nt(){if(typeof window>`u`)throw Error(`@svgrid/enterprise: export requires a browser environment`);return tt||=(async()=>{De(),await h(()=>import(`./smart.export-CDCwbFH4.js`),[],import.meta.url);let e=window.Smart?.Utilities?.DataExporter;if(!e)throw Error(`@svgrid/enterprise: failed to load Smart.Utilities.DataExporter`);return e})(),tt}async function W(t){let n=globalThis;if(t===`xlsx`&&n.JSZip==null){let t;try{t=await h(()=>import(`./jszip.min-CX2fPs3O.js`).then(t=>e(t.default,1)),__vite__mapDeps([0,1]),import.meta.url)}catch{throw Error(`@svgrid/enterprise: xlsx export requires the "jszip" peer dependency. Install it with: pnpm add jszip`)}n.JSZip=t.default??t}if(t===`pdf`&&n.pdfMake==null){let t,r;try{t=await h(()=>import(`./pdfmake-BpIYFHoG.js`).then(t=>e(t.default,1)),__vite__mapDeps([2,1]),import.meta.url),r=await h(()=>import(`./vfs_fonts-BV-Ul9v2.js`).then(t=>e(t.default,1)),__vite__mapDeps([3,1]),import.meta.url)}catch{throw Error(`@svgrid/enterprise: pdf export requires the "pdfmake" peer dependency. Install it with: pnpm add pdfmake`)}let i=t.default??t;if(!Ge(i,r))throw Error(`@svgrid/enterprise: "pdfmake/build/vfs_fonts" did not contain a font map; the installed pdfmake is not one this export knows.`);n.pdfMake=i}}function G(e,t){if(Array.isArray(t))return t;switch(t){case`selected`:return e.getSelectedRows();case`all`:return e.getData();case`displayed`:case void 0:default:return e.getDisplayedRows()}}function K(e,t,n){if(t.columns&&t.columns.length>0)return t.columns;let r=e.getColumns().filter(e=>e.visible&&e.field);return r.length>0?r.map(e=>({field:e.field,header:e.header,format:e.format,align:e.align})):n.length>0?Object.keys(n[0]).filter(e=>!e.startsWith(`_`)).map(e=>({field:e})):[]}function q(e,t,n){if(e.exportValue)return e.exportValue(t)??``;let r=t[e.field];return n?r:c(r,e.format)}async function J(e,t,n){let r=n.rawValues===!0,i={};for(let e of t)i[e.field]=e.header??e.field;let a=[i],o=e.length;for(let i=0;i<o;i++){if(n.signal?.aborted)throw new DOMException(`Export aborted`,`AbortError`);let s=e[i],c={};for(let e of t)c[e.field]=q(e,s,r);a.push(c),i>0&&i%5e3==0&&(n.onProgress?.({phase:`project`,ratio:i/o,row:i,total:o}),await new Promise(e=>setTimeout(e,0)))}return n.onProgress?.({phase:`project`,ratio:1,row:o,total:o}),a}function rt(e){if(!e)return;let t={};e.headerRow&&(t.header={...e.headerRow});let n=e.rows?{...e.rows}:{};return e.rowAlternate&&(n.alternationCount=2,n.alternationStart=0,e.rowAlternate.backgroundColor&&(n.alternationIndex1BackgroundColor=e.rowAlternate.backgroundColor),e.rowAlternate.color&&(n.alternationIndex1Color=e.rowAlternate.color)),Object.keys(n).length>0&&(t.rows=n),e.cells&&(t.cells=e.cells),t}var it=0,at=new Map;function ot(e){let t=at.get(e);if(t)return t;let n=`img${++it}`;return at.set(e,n),n}function st(e,t=64,n=64){let r=/^data:image\/([a-zA-Z0-9+]+);/i.exec(e)?.[1]?.toLowerCase()??`png`,i=r===`jpg`?`jpeg`:r===`svg+xml`?`svg`:r;return{id:ot(e),base64:e,imageType:i,width:t,height:n}}function ct(e,t){if(!e||e.length===0||t.length===0)return;let n=t[0],r=[];for(let i of e){let e={},a;if(`image`in i)e[n]=i.image,a={mergeAcross:!0,textAlign:`left`};else if(`text`in i)e[n]=i.text,a={mergeAcross:!0,...i.style??{}};else{let r=t[Math.floor(t.length/2)],o=t[t.length-1];i.left!==void 0&&(e[n]=i.left),i.center!==void 0&&(e[r]=i.center),i.right!==void 0&&(e[o]=i.right),a={textAlign:`left`}}r.push({cells:e,style:a})}return r}function lt(e,t){let n=e&&e.length>0?new Set(e):null;return(e,r,i)=>typeof i!=`string`||!/^data:image\//i.test(i)?null:n&&!n.has(r)?{image:st(i,96,96),value:``}:{image:st(i,t.width,t.height),value:``}}function ut(e){let t={exportHeader:!0,pageOrientation:e.pageOrientation??`portrait`};e.freezeHeader!==!1&&(t.freezeHeader=!0),e.freezeColumns&&e.freezeColumns>0&&(t.freezeColumnsCount=Math.floor(e.freezeColumns));let n=rt(e.styles);if(n&&(t.style=n),e.hierarchical&&(t.hierarchical=!0),e.merges?.length&&!e.groupBy?.length&&!e.hierarchical){let n=e.merges.map(e=>({cell:[e.row,e.col],rowspan:Math.max(1,Math.floor(e.rowSpan??1)),colspan:Math.max(1,Math.floor(e.colSpan??1))})).filter(e=>e.rowspan>1||e.colspan>1);n.length&&(t.mergedCells=n)}return t}function dt(e,t,n){let r=ct(t.header,n),i=ct(t.footer,n);r&&(e.headerContent=r),i&&(e.footerContent=i);let a=(t.header?.some(e=>`image`in e)??!1)||(t.footer?.some(e=>`image`in e)??!1);if(t.imageFields?.length||a){let n=t.imageSize??{width:32,height:32};e.addImageToCell=lt(t.imageFields,n)}return e}function Y(e,t){return e.toLowerCase().endsWith(`.`+t)?e:`${e}.${t}`}function ft(e,t,n,r,i){return i!==!1&&p(e,t),{blob:e,filename:t,mime:n,rowCount:r,byteSize:e.size}}function pt(e,t,n,r,i){i!==!1&&u(e,t,n);let a=new Blob([e],{type:n});return{blob:a,filename:t,mime:n,rowCount:r,byteSize:a.size}}function X(e,t,n){let r=Math.min(t.length,200);return e.map(e=>{if(typeof e.width==`number`)return e.width;let i=String(e.header??e.field).length;for(let a=0;a<r;a++){let r=q(e,t[a],n),o=r==null?0:String(r).length;o>i&&(i=o)}return Math.max(48,Math.min(400,i*7+14))})}function mt(e,t,n){if(typeof t.freezeColumns==`number`)return t.freezeColumns;let r=e.getColumnPinning().left;if(!r||r.length===0)return;let i=new Set(r),a=0;for(let e of n)if(i.has(e.field))a++;else break;return a>0?a:void 0}function ht(e){let t=e,n=``;do n=String.fromCharCode(65+t%26)+n,t=Math.floor(t/26)-1;while(t>=0);return n}function Z(e,t){if(e.some(e=>e.link))return(n,r)=>{let i=e[r],a=t[n];if(!(!i?.link||!a))return i.link(a)||void 0}}function gt(e){let t={};for(let n of e)n.align&&(t[n.field]=n.align);return t}async function _t(e,t,n,r,i,s){let c=n.map(e=>e.field),u={onProgress:r.onProgress,signal:r.signal};switch(e){case`html`:return{text:await d(t,c,{...u,title:(r.filename??`grid`).trim()||`grid`,align:gt(n),cellStyle:i,cellLink:s}),mime:`text/html;charset=utf-8`,ext:`html`};case`json`:return{text:await f(t,c,u),mime:`application/json;charset=utf-8`,ext:`json`};case`xml`:return{text:await l(t,c,u),mime:`application/xml;charset=utf-8`,ext:`xml`};case`md`:return{text:await o(t,c,{...u,align:gt(n)}),mime:`text/markdown;charset=utf-8`,ext:`md`};case`tsv`:return{text:await a(t,c,{...u,csv:{...r.csv,delimiter:` `}}),mime:`text/tab-separated-values;charset=utf-8`,ext:`tsv`};default:{let e=r.csv?.delimiter??`,`;return{text:await a(t,c,{...u,csv:{...r.csv,delimiter:e}}),mime:`text/csv;charset=utf-8`,ext:`csv`}}}}async function vt(e,t){if(t.sheets&&t.sheets.length>0)throw Error(`@svgrid/enterprise: multi-sheet export requires format 'xlsx', got '${t.format}'`);let n=G(e,t.rows);if(n.length===0)throw Error(`@svgrid/enterprise: nothing to export - the grid has no rows`);let r=K(e,t,n),i=await J(n,r,t.format===`json`?{...t,rawValues:t.rawValues??!0}:t),a=(t.filename??`grid`).trim()||`grid`,o=t.format===`html`?U(r,n,t.conditionalFormats):void 0,s=t.format===`html`?Z(r,n):void 0,{text:c,mime:l,ext:u}=await _t(t.format,i,r,t,o,s);return pt(c,Y(a,u),l,n.length,t.download)}async function yt(e,t){if(t.sheets&&t.sheets.length>0)throw Error(`@svgrid/enterprise: multi-sheet export requires format 'xlsx'. Use 'xls' for a single legacy sheet.`);let n=G(e,t.rows);if(n.length===0)throw Error(`@svgrid/enterprise: nothing to export - the grid has no rows`);let r=K(e,t,n),i=(t.filename??`grid`).trim()||`grid`,a=U(r,n,t.conditionalFormats);return pt(await Ae(i,r,n,{rawValues:t.rawValues,onProgress:t.onProgress,signal:t.signal,freezeHeader:t.freezeHeader!==!1,freezeColumns:mt(e,t,r),widths:t.autoFitColumns===!1?void 0:X(r,n,t.rawValues===!0),cellVisual:t.conditionalFormats?.length?a:void 0,precisionSafe:t.precisionSafe}),Y(i,`xls`),`application/vnd.ms-excel;charset=utf-8`,n.length,t.download)}function Q(e){return e.format?.type===`number`||e.format?.type===`currency`}function bt(e,t,n){let r=[],i=t=>e.find(e=>e.field===t)?.header??t,a=e.findIndex(e=>!Q(e)),o=(t,s)=>{if(s>=n.length){for(let n of t)r.push({kind:`data`,cells:e.map(e=>String(q(e,n,!1)??``))});return}let l=n[s],u=new Map;for(let e of t){let t=String(e[l]??``),n=u.get(t);n?n.push(e):u.set(t,[e])}for(let[t,n]of u)if(r.push({kind:`group`,label:`${i(l)}: ${t} (${n.length})`,level:s}),o(n,s+1),e.some(Q)){let i=e.map(e=>{if(!Q(e))return``;let t=n.reduce((t,n)=>t+(Number(n[e.field])||0),0);return c(t,e.format)});a>=0&&(i[a]=`Subtotal (${t})`),r.push({kind:`subtotal`,cells:i})}};return o(t,0),r}async function xt(e,t){await W(`pdf`);let n=globalThis.pdfMake;if(!n)throw Error(`@svgrid/enterprise: pdf export requires the "pdfmake" peer dependency.`);let r=G(e,t.rows);if(r.length===0)throw Error(`@svgrid/enterprise: nothing to export - the grid has no rows`);let i=K(e,t,r),a=i.map(e=>e.field),o=i.map(e=>({header:e.header??e.field,align:e.align})),s=t.autoGroup!==!1&&!t.groupBy?.length&&!t.hierarchical?(e.getState().grouping??[]).filter(e=>!!e).map(e=>String(e)):[],c=t.groupBy?.length?t.groupBy:s.length>0?s:void 0;if(t.signal?.aborted)throw new DOMException(`Export aborted`,`AbortError`);t.onProgress?.({phase:`write`,ratio:0,total:r.length});let l={...t.pdf,pageOrientation:t.pdf?.pageOrientation??t.pageOrientation},u=l.matchTheme===!1?{}:Je(e.getElement?.()??null),d={headerLines:t.header,footerLines:t.footer},f=await Xe(l.charts,async e=>{let{chartToPngBlob:t}=await h(async()=>{let{chartToPngBlob:e}=await import(`./src-D23PPsK1.js`).then(e=>e.t);return{chartToPngBlob:e}},__vite__mapDeps([4,1,5,6]),import.meta.url);return t(e,{scale:2})}),p=new Date,m;if(c?.length)m=Ze({columns:o,body:bt(i,r,c),opts:l,styles:t.styles,theme:u,...d,charts:f,now:p});else{let e=(await J(r,i,t)).slice(1).map(e=>a.map(t=>String(e[t]??``))),n=U(i,r,t.conditionalFormats);for(let t=0;t<e.length;t++)for(let r=0;r<i.length;r++){let i=n(t,r)?.icon;i&&(e[t][r]=`${i} ${e[t][r]??``}`)}m=Ze({columns:o,rows:e,dataCellStyle:(e,t)=>{let r=n(e,t);return r?{fill:r.fill,color:r.color,bold:r.bold}:void 0},dataCellLink:Z(i,r),opts:l,styles:t.styles,theme:u,...d,merges:t.merges,charts:f,now:p})}let g=(t.filename??`grid`).trim()||`grid`,_=await We(n.createPdf(m));return t.onProgress?.({phase:`write`,ratio:1,total:r.length}),ft(_,Y(g,`pdf`),`application/pdf`,r.length,t.download)}async function St(e,t,n,r,i,a){let o=e.map(e=>e.header??e.field),l=a?.precisionSafe===!0,u=(e,t,n)=>l&&Math.abs(e)>=0x38d7ea4c68000?{t:`s`,value:String(e),...t}:{t:`n`,value:e,numFmt:n,...t},d=(t,a,o)=>{let l=e[o],d=r(a,o),f={align:l.align,fill:d?.fill,color:d?.color,bold:d?.bold,link:i?.(a,o)};if(l.exportValue){let e=l.exportValue(t);return typeof e==`number`&&Number.isFinite(e)?u(e,f,m(l.format)):e instanceof Date?{t:`d`,value:e,numFmt:m(l.format)??`yyyy-mm-dd`,...f}:{t:`s`,value:e==null?``:String(e),...f}}let p=t[l.field];if(d?.icon){let e=n?String(p??``):c(p,l.format);return{t:`s`,value:`${d.icon} ${e}`,...f}}if(n)return typeof p==`number`&&Number.isFinite(p)?u(p,f):{t:`s`,value:p==null?``:String(p),...f};let h=s(p,l.format);return h.ok?h.value instanceof Date?{t:`d`,value:h.value,numFmt:m(l.format)??`yyyy-mm-dd`,...f}:u(h.value,f,m(l.format)):{t:`s`,value:c(p,l.format),...f}},f=[],p=t.length;for(let n=0;n<p;n++){if(a?.signal?.aborted)throw new DOMException(`Export aborted`,`AbortError`);let r=t[n];f.push(e.map((e,t)=>d(r,n,t))),n>0&&n%2e3==0&&(a?.onProgress?.({phase:`project`,ratio:n/p,row:n,total:p}),await new Promise(e=>setTimeout(e,0)))}return{header:o,cells:f}}async function Ct(e,t){await W(`xlsx`);let n=globalThis.JSZip;if(!n)throw Error(`@svgrid/enterprise: xlsx export requires the "jszip" peer dependency.`);let r=G(e,t.rows);if(r.length===0)throw Error(`@svgrid/enterprise: nothing to export - the grid has no rows`);let i=K(e,t,r),a=t.rawValues===!0,o=t.conditionalFormats??[],s=U(i,r,o.filter(e=>e.type===`rule`||e.type===`iconSet`)),c=Z(i,r),l=[];for(let e of o){if(e.type!==`colorScale`&&e.type!==`dataBar`)continue;let t=e.columns&&e.columns.length>0?i.map((t,n)=>e.columns.includes(t.field)?n:-1).filter(e=>e>=0):i.map((e,t)=>t);for(let n of t)if(e.type===`dataBar`)l.push({kind:`dataBar`,colIdx:n,color:e.color});else{let t=e.min??`#ffffff`,r=e.max??`#000000`;l.push({kind:`colorScale`,colIdx:n,colors:e.mid?[t,e.mid,r]:[t,r]})}}if(t.signal?.aborted)throw new DOMException(`Export aborted`,`AbortError`);t.onProgress?.({phase:`write`,ratio:0,total:r.length});let{header:u,cells:d}=await St(i,r,a,s,c,{onProgress:t.onProgress,signal:t.signal,precisionSafe:t.precisionSafe}),f=t.autoFitColumns===!1?void 0:X(i,r,a),p=(t.filename??`grid`).trim()||`grid`,m;t.excelTable&&(m={name:`Table1`,totalsRow:typeof t.excelTable==`object`&&t.excelTable.totalsRow===!0,style:typeof t.excelTable==`object`?t.excelTable.style:void 0,totalsFns:i.map(e=>Q(e)?`sum`:void 0)});let h=await He(Ve({sheetName:p,header:u,rows:d,widths:f,freezeHeader:t.freezeHeader!==!1,freezeColumns:mt(e,t,i),condFormats:l,table:m}),n);return t.onProgress?.({phase:`write`,ratio:1,total:r.length}),ft(h,Y(p,`xlsx`),`application/vnd.openxmlformats-officedocument.spreadsheetml.sheet`,r.length,t.download)}async function wt(e,t){if(Te(`Export`),et.includes(t.format))return vt(e,t);if(t.format===`xls`)return yt(e,t);if(t.format===`pdf`)return xt(e,t);if(t.format===`xlsx`){let n=t.autoGroup===!1?[]:(e.getState().grouping??[]).filter(e=>!!e),r=(t.groupBy?.length??0)>0||n.length>0,i=!!t.styles&&!t.conditionalFormats?.length;if(!t.sheets?.length&&!r&&!t.hierarchical&&!t.merges?.length&&!t.header?.length&&!t.footer?.length&&!t.imageFields?.length&&!i)return Ct(e,t)}await W(t.format);let n=await nt();if(t.sheets&&t.sheets.length>0){if(t.format!==`xlsx`)throw Error(`@svgrid/enterprise: multi-sheet export requires format 'xlsx', got '${t.format}'`);let r=t.rawValues===!0,i=t.sheets.map(n=>{let i=K(e,{columns:n.columns??t.columns},n.rows),a=n.rows.map(e=>{let t={};for(let n of i)t[n.field]=q(n,e,r);return t}),o=t.autoFitColumns===!1?null:X(i,n.rows,r);return{label:n.label,dataSource:a,columns:i.map((e,t)=>o?{dataField:e.field,label:e.header??e.field,width:o[t]}:{dataField:e.field,label:e.header??e.field}),dataFields:i.map(e=>e.field),style:rt(n.styles??t.styles)}}),a=(t.filename??`grid`).trim()||`grid`,o=ut(t),s=i[0],c=new n(o);c.spreadsheets=i,dt(c,t,s.dataFields);let l={};for(let e of s.columns)l[e.dataField]=e.label;let u=[l,...s.dataSource];if(t.download===!1)throw Error(`@svgrid/enterprise: download:false is not supported for multi-sheet xlsx.`);c.exportData(u,t.format,a);return}let r=G(e,t.rows);if(r.length===0)throw Error(`@svgrid/enterprise: nothing to export - the grid has no rows`);let i=K(e,t,r),a=await J(r,i,t),o=(t.filename??`grid`).trim()||`grid`,s=i.map(e=>e.field),c=t.autoGroup!==!1&&!t.groupBy?.length&&!t.hierarchical?(e.getState().grouping??[]).filter(e=>!!e).map(e=>String(e)):[],l=t.groupBy?.length?t.groupBy:c.length>0?c:void 0,u=!t.hierarchical&&l?.length?l:void 0,d=ut(t);if(t.conditionalFormats?.length){let e=U(i,r,t.conditionalFormats),n={};for(let t=0;t<r.length;t++)for(let r=0;r<i.length;r++){let o=e(t,r);if(!o)continue;let s={};if(o.fill&&(s.backgroundColor=o.fill),o.color&&(s.color=o.color),o.bold&&(s.fontWeight=`bold`),Object.keys(s).length&&(n[ht(r)+(t+2)]=s),o.icon){let e=a[t+1],n=i[r].field;e&&(e[n]=`${o.icon} ${e[n]??``}`)}}if(Object.keys(n).length){let e=d.style??{};d.style={...e,cells:{...e.cells??{},...n}}}}if(t.download===!1)throw Error(`@svgrid/enterprise: download:false is not supported for this xlsx export (grouped / merges / header / footer / images). Use a plain xlsx, xls, pdf, or a text format.`);if(t.signal?.aborted)throw new DOMException(`Export aborted`,`AbortError`);t.onProgress?.({phase:`write`,ratio:0,total:a.length-1});let f=new n(d,u);dt(f,t,s),f.exportData(a,t.format,o),t.onProgress?.({phase:`write`,ratio:1,total:a.length-1})}var Tt={"&":`&`,"<":`<`,">":`>`,'"':`"`,"'":`'`};function $(e){return(e==null?``:String(e)).replace(/[&<>"']/g,e=>Tt[e])}function Et(e){let{columns:t,rows:n}=e,r=e.cellStyle,i=e.cellLink,a=e.opts??{},o=a.orientation??`portrait`,s=a.pageSize?`${a.pageSize} ${o}`:o,c=a.margin??`14mm`,l=a.zebra??!0,u=a.zebraColor??`#f6f8fa`,d=a.headerColor??`#f1f5f9`,f=a.headerTextColor??`#0f172a`,p=a.fontSize??9,m=e=>e&&e!==`left`?` style="text-align:${e}"`:``,h=`<thead><tr>`+t.map(e=>`<th${m(e.align)}>${$(e.header)}</th>`).join(``)+`</tr></thead>`,g=(e,t,n,a)=>{let o=[];e.align&&e.align!==`left`&&o.push(`text-align:${e.align}`);let s=r?.(n,a);s?.fill&&o.push(`background:${s.fill}`),s?.color&&o.push(`color:${s.color}`),s?.bold&&o.push(`font-weight:700`);let c=o.length?` style="${o.join(`;`)}"`:``,l=s?.icon?`${$(s.icon)} ${$(t)}`:$(t),u=i?.(n,a);return u&&(l=`<a href="${$(u)}">${l}</a>`),`<td${c}>${l}</td>`},_=`<tbody>`+n.map((e,n)=>`<tr>`+t.map((t,r)=>g(t,e[r]??``,n,r)).join(``)+`</tr>`).join(``)+`</tbody>`,v=[];return a.logo&&v.push(`<img class="logo" src="${$(a.logo)}" alt="" />`),a.title&&v.push(`<h1>${$(a.title)}</h1>`),a.subtitle&&v.push(`<p class="subtitle">${$(a.subtitle)}</p>`),`<!DOCTYPE html>
|
|
39
39
|
<html><head><meta charset="utf-8"><title>${$(a.title??`Grid`)}</title>
|
|
40
40
|
<style>
|
|
41
41
|
@page { size: ${s}; margin: ${c}; }
|
package/dist/designer/index.html
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
<meta charset="UTF-8" />
|
|
5
5
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
6
6
|
<title>SvGrid Studio - Designer</title>
|
|
7
|
-
<script type="module" crossorigin src="./assets/index-
|
|
7
|
+
<script type="module" crossorigin src="./assets/index-PEFkd-5C.js"></script>
|
|
8
8
|
<link rel="modulepreload" crossorigin href="./assets/rolldown-runtime-Dd_uD5pT.js">
|
|
9
9
|
<link rel="modulepreload" crossorigin href="./assets/disclose-version-CIm4S9xS.js">
|
|
10
10
|
<link rel="modulepreload" crossorigin href="./assets/cell-formatting-JoxA0t65.js">
|
|
@@ -21,21 +21,22 @@
|
|
|
21
21
|
<link rel="modulepreload" crossorigin href="./assets/SvGridDropdown-Cjz0H-fI.js">
|
|
22
22
|
<link rel="modulepreload" crossorigin href="./assets/dismissable-ChWRPkoa.js">
|
|
23
23
|
<link rel="modulepreload" crossorigin href="./assets/SvDateTimePicker-r4FqmR6R.js">
|
|
24
|
-
<link rel="modulepreload" crossorigin href="./assets/SvDateRangeInput-
|
|
24
|
+
<link rel="modulepreload" crossorigin href="./assets/SvDateRangeInput-y8PkioQk.js">
|
|
25
25
|
<link rel="modulepreload" crossorigin href="./assets/focus-trap-V2-6Fy9I.js">
|
|
26
26
|
<link rel="modulepreload" crossorigin href="./assets/SvTabs-2mHC6oaz.js">
|
|
27
27
|
<link rel="modulepreload" crossorigin href="./assets/SvMenuList-Dgq2D5VN.js">
|
|
28
28
|
<link rel="modulepreload" crossorigin href="./assets/chart-trend-_gDVw3bP.js">
|
|
29
29
|
<link rel="modulepreload" crossorigin href="./assets/chart-Bmu-KAet.js">
|
|
30
|
-
<link rel="modulepreload" crossorigin href="./assets/
|
|
31
|
-
<link rel="modulepreload" crossorigin href="./assets/
|
|
30
|
+
<link rel="modulepreload" crossorigin href="./assets/csv-injection-C4a0uulO.js">
|
|
31
|
+
<link rel="modulepreload" crossorigin href="./assets/chart-export-Dqq_eHRq.js">
|
|
32
|
+
<link rel="modulepreload" crossorigin href="./assets/SvGridChart-DzCeEdlb.js">
|
|
32
33
|
<link rel="modulepreload" crossorigin href="./assets/chart-panel-messages-B3y8y3kL.js">
|
|
33
|
-
<link rel="modulepreload" crossorigin href="./assets/SvGridChartPanel-
|
|
34
|
+
<link rel="modulepreload" crossorigin href="./assets/SvGridChartPanel-Dj3IxTS2.js">
|
|
34
35
|
<link rel="modulepreload" crossorigin href="./assets/sparkline-C-NcnB2i.js">
|
|
35
36
|
<link rel="modulepreload" crossorigin href="./assets/server-block-cache-CXJKkJpy.js">
|
|
36
37
|
<link rel="modulepreload" crossorigin href="./assets/conditional-formatting-MDWbF8_Y.js">
|
|
37
|
-
<link rel="modulepreload" crossorigin href="./assets/export-format-
|
|
38
|
-
<link rel="modulepreload" crossorigin href="./assets/src-
|
|
38
|
+
<link rel="modulepreload" crossorigin href="./assets/export-format-NYxEY-0Y.js">
|
|
39
|
+
<link rel="modulepreload" crossorigin href="./assets/src-DC5nN4Q7.js">
|
|
39
40
|
<link rel="stylesheet" crossorigin href="./assets/date-format-DKS-z0xS.css">
|
|
40
41
|
<link rel="stylesheet" crossorigin href="./assets/SvListBox-BXfyqy4a.css">
|
|
41
42
|
<link rel="stylesheet" crossorigin href="./assets/SvGridDropdown-CcidB3rm.css">
|
|
@@ -45,7 +46,7 @@
|
|
|
45
46
|
<link rel="stylesheet" crossorigin href="./assets/SvMenuList-DJ47ba1h.css">
|
|
46
47
|
<link rel="stylesheet" crossorigin href="./assets/SvGridChart-BgLuPO7I.css">
|
|
47
48
|
<link rel="stylesheet" crossorigin href="./assets/SvGridChartPanel-4Pc8y5yO.css">
|
|
48
|
-
<link rel="stylesheet" crossorigin href="./assets/index-
|
|
49
|
+
<link rel="stylesheet" crossorigin href="./assets/index-BU3ieI05.css">
|
|
49
50
|
</head>
|
|
50
51
|
<body>
|
|
51
52
|
<div id="app"></div>
|
package/dist/import.js
CHANGED
|
@@ -24,6 +24,7 @@
|
|
|
24
24
|
* `print`, so unlicensed evaluation works but emits a one-time nudge.
|
|
25
25
|
*/
|
|
26
26
|
import { assertEnterpriseLicensed } from './license.js';
|
|
27
|
+
import { XLSX_MAX_COLS, XLSX_MAX_FILL, xlsxFillError, xlsxRangeError } from './xlsx-limits.js';
|
|
27
28
|
// ---------------------------------------------------------------------------
|
|
28
29
|
// Lazy peer dependency: jszip (xlsx only)
|
|
29
30
|
// ---------------------------------------------------------------------------
|
|
@@ -242,6 +243,7 @@ function parseSheetXml(xml, sharedStrings) {
|
|
|
242
243
|
const tRe = /<t\b[^>]*>([\s\S]*?)<\/t>/g;
|
|
243
244
|
const vRe = /<v>([\s\S]*?)<\/v>/;
|
|
244
245
|
let rowMatch;
|
|
246
|
+
let filled = 0;
|
|
245
247
|
while ((rowMatch = rowRe.exec(xml)) !== null) {
|
|
246
248
|
const rowBody = rowMatch[1] ?? '';
|
|
247
249
|
const cells = [];
|
|
@@ -253,7 +255,15 @@ function parseSheetXml(xml, sharedStrings) {
|
|
|
253
255
|
const ref = /r="([A-Z]+)\d+"/.exec(attrs)?.[1] ?? '';
|
|
254
256
|
const colIndex = colRefToIndex(ref);
|
|
255
257
|
const type = /t="([^"]+)"/.exec(attrs)?.[1] ?? 'n';
|
|
256
|
-
// Pad holes with empty strings so column alignment survives
|
|
258
|
+
// Pad holes with empty strings so column alignment survives, within
|
|
259
|
+
// the sheet's real width and the blank budget (see xlsx-limits.ts).
|
|
260
|
+
if (colIndex >= XLSX_MAX_COLS)
|
|
261
|
+
throw xlsxRangeError(/r="([^"]*)"/.exec(attrs)?.[1] ?? ref);
|
|
262
|
+
if (colIndex > cells.length) {
|
|
263
|
+
filled += colIndex - cells.length;
|
|
264
|
+
if (filled > XLSX_MAX_FILL)
|
|
265
|
+
throw xlsxFillError();
|
|
266
|
+
}
|
|
257
267
|
while (cells.length < colIndex)
|
|
258
268
|
cells.push('');
|
|
259
269
|
let value = '';
|
package/dist/node/studio.js
CHANGED
|
@@ -16124,8 +16124,8 @@ function layoutFile(nav, opts = {}) {
|
|
|
16124
16124
|
${toolbarOn ? `<div class="sv-app__toolbar">
|
|
16125
16125
|
<div class="sv-app__search">
|
|
16126
16126
|
<svg class="sv-app__search-ic" viewBox="0 0 24 24" width="16" height="16" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"><circle cx="11" cy="11" r="7"/><path d="M21 21l-4.35-4.35"/></svg>
|
|
16127
|
-
<input class="sv-app__search-in" type="search" placeholder="Search {brand}…" bind:value={q}
|
|
16128
|
-
<
|
|
16127
|
+
<input class="sv-app__search-in" type="search" placeholder="Search {brand}…" bind:value={q} aria-label="Search screens" />
|
|
16128
|
+
<button type="button" class="sv-app__kbd" title="Command palette (⌘K / Ctrl+K)" aria-label="Open the command palette" onclick={() => (paletteOpen = true)}>⌘K</button>
|
|
16129
16129
|
{#if results.length}
|
|
16130
16130
|
<div class="sv-app__results">
|
|
16131
16131
|
{#each results as r (r.href)}
|
|
@@ -16165,6 +16165,7 @@ function layoutFile(nav, opts = {}) {
|
|
|
16165
16165
|
</div>
|
|
16166
16166
|
</div>
|
|
16167
16167
|
{#if bellOpen || menuOpen}<button type="button" class="sv-app__scrim" tabindex="-1" aria-label="Close menus" onclick={() => { bellOpen = false; menuOpen = false }}></button>{/if}
|
|
16168
|
+
<SvCommand bind:open={paletteOpen} {commands} placeholder="Go to a screen or run an action…" emptyText="No matching screen" />
|
|
16168
16169
|
</div>\n ` : ""}<div class="sv-app__content">
|
|
16169
16170
|
${opts.supabaseAuth ? `<SvAuthGate client={supabaseClient as unknown as SupabaseAuthClientLike} title={\`Sign in to \${brand}\`}>
|
|
16170
16171
|
{@render children()}
|
|
@@ -16254,7 +16255,7 @@ function layoutFile(nav, opts = {}) {
|
|
|
16254
16255
|
import '../app.css'
|
|
16255
16256
|
import '../custom.css'
|
|
16256
16257
|
import { page } from '$app/state'
|
|
16257
|
-
import { setLicenseKey } from '@svgrid/enterprise'${opts.access ? `\n import { currentRole, canScreen } from '$lib/access'` : ""}${opts.i18n ? `\n import { t, currentLocale, locales } from '$lib/i18n'` : ""}${opts.auth ? `\n import type { LayoutData } from './$types'` : ""}${opts.supabaseAuth ? `\n import { SvAuthGate, type SupabaseAuthClientLike } from '@svgrid/enterprise'\n import { supabaseClient } from '$lib/connections'` : ""}
|
|
16258
|
+
import { setLicenseKey } from '@svgrid/enterprise'${toolbarOn ? `\n import { goto } from '$app/navigation'\n import { SvCommand, type CommandItem } from '@svgrid/grid'` : ""}${opts.access ? `\n import { currentRole, canScreen } from '$lib/access'` : ""}${opts.i18n ? `\n import { t, currentLocale, locales } from '$lib/i18n'` : ""}${opts.auth ? `\n import type { LayoutData } from './$types'` : ""}${opts.supabaseAuth ? `\n import { SvAuthGate, type SupabaseAuthClientLike } from '@svgrid/enterprise'\n import { supabaseClient } from '$lib/connections'` : ""}
|
|
16258
16259
|
|
|
16259
16260
|
// VITE_SVPRO_KEY in .env is your SvGrid license key; it removes the unlicensed watermark.
|
|
16260
16261
|
if (import.meta.env.VITE_SVPRO_KEY) setLicenseKey(import.meta.env.VITE_SVPRO_KEY)
|
|
@@ -16280,24 +16281,30 @@ function layoutFile(nav, opts = {}) {
|
|
|
16280
16281
|
try { const s = localStorage.getItem('svapp:theme'); if (s === 'light' || s === 'dark') t = s } catch (_) { /* storage blocked */ }
|
|
16281
16282
|
applyTheme(t)
|
|
16282
16283
|
})` : ""}${sideState}${toolbarOn ? `
|
|
16283
|
-
// App-chrome quick-search: filter the screens by label as you type.
|
|
16284
|
+
// App-chrome quick-search: filter the screens by label as you type. Only the
|
|
16285
|
+
// screens the sidebar would show${opts.access ? " to this role" : ""}.
|
|
16284
16286
|
const initials = ${JSON.stringify(initials)}
|
|
16285
16287
|
const acctEmail = ${JSON.stringify(`admin@${brandSlug}.com`)}
|
|
16288
|
+
const visibleNav = ${opts.access ? "$derived(nav.filter((n) => !n.id || canScreen($currentRole, n.id)))" : "nav"}
|
|
16286
16289
|
let q = $state('')
|
|
16287
|
-
const results = $derived(q.trim() ?
|
|
16290
|
+
const results = $derived(q.trim() ? visibleNav.filter((n) => n.label.toLowerCase().includes(q.trim().toLowerCase())).slice(0, 6) : [])
|
|
16291
|
+
// Cmd/Ctrl+K: a palette over the same screens. SvCommand binds the key itself.
|
|
16292
|
+
let paletteOpen = $state(false)
|
|
16293
|
+
const commands: CommandItem[] = $derived([
|
|
16294
|
+
...visibleNav.map((n) => ({ id: 'go:' + n.href, label: ${opts.i18n ? "n.id ? $t('nav.' + n.id, n.label) : n.label" : "n.label"}, group: 'Go to', onRun: () => goto(n.href) })),${hasSwitch ? `
|
|
16295
|
+
{ id: 'theme', label: theme === 'dark' ? 'Switch to light mode' : 'Switch to dark mode', group: 'Actions', onRun: toggleTheme },` : ""}
|
|
16296
|
+
])
|
|
16288
16297
|
let bellOpen = $state(false)
|
|
16289
16298
|
let menuOpen = $state(false)
|
|
16290
|
-
let searchEl: HTMLInputElement | null = $state(null)
|
|
16291
16299
|
const notifications = [
|
|
16292
16300
|
{ title: 'Welcome to ' + brand, time: 'just now', color: 'var(--sg-accent, #6366f1)' },
|
|
16293
16301
|
{ title: 'Your workspace is ready', time: '2m ago', color: '#10b981' },
|
|
16294
16302
|
{ title: 'Sample data loaded', time: '5m ago', color: '#f59e0b' },
|
|
16295
16303
|
]
|
|
16296
|
-
//
|
|
16304
|
+
// Escape closes the menus.
|
|
16297
16305
|
$effect(() => {
|
|
16298
16306
|
function onKey(e: KeyboardEvent) {
|
|
16299
|
-
if (
|
|
16300
|
-
else if (e.key === 'Escape') { bellOpen = false; menuOpen = false }
|
|
16307
|
+
if (e.key === 'Escape') { bellOpen = false; menuOpen = false }
|
|
16301
16308
|
}
|
|
16302
16309
|
window.addEventListener('keydown', onKey)
|
|
16303
16310
|
return () => window.removeEventListener('keydown', onKey)
|
|
@@ -16336,7 +16343,8 @@ ${styles}
|
|
|
16336
16343
|
.sv-app__tool:hover { color: var(--sg-fg, #0f172a); border-color: color-mix(in srgb, var(--sg-fg, #0f172a) 20%, var(--sg-border, #e6e8ec)); }
|
|
16337
16344
|
.sv-app__dot { position: absolute; top: 5px; right: 5px; width: 6px; height: 6px; border-radius: 50%; background: var(--sg-accent, #6366f1); box-shadow: 0 0 0 2px var(--sg-bg, #fff); }
|
|
16338
16345
|
.sv-app__avatar { display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; padding: 0; border: none; border-radius: 50%; font: inherit; font-size: 12px; font-weight: 700; color: #fff; background: var(--sg-accent, #6366f1); letter-spacing: 0.02em; cursor: pointer; }
|
|
16339
|
-
.sv-app__kbd { position: absolute; right: 8px; font-size: 10.5px; font-weight: 600; color: var(--sg-muted, #94a3b8); background: color-mix(in srgb, var(--sg-fg, #0f172a) 6%, transparent); border: 1px solid var(--sg-border, #e6e8ec); border-radius: 5px; padding: 1px 5px;
|
|
16346
|
+
.sv-app__kbd { position: absolute; right: 8px; font-size: 10.5px; font-weight: 600; color: var(--sg-muted, #94a3b8); background: color-mix(in srgb, var(--sg-fg, #0f172a) 6%, transparent); border: 1px solid var(--sg-border, #e6e8ec); border-radius: 5px; padding: 1px 5px; font-family: inherit; line-height: inherit; cursor: pointer; }
|
|
16347
|
+
.sv-app__kbd:hover { color: var(--sg-fg, #0f172a); }
|
|
16340
16348
|
.sv-app__pop { position: relative; }
|
|
16341
16349
|
.sv-app__scrim { position: fixed; inset: 0; z-index: 44; border: 0; padding: 0; background: transparent; cursor: default; }
|
|
16342
16350
|
.sv-app__menu { position: absolute; top: calc(100% + 8px); right: 0; z-index: 46; min-width: 232px; padding: 6px; background: var(--sg-bg, #fff); border: 1px solid var(--sg-border, #e6e8ec); border-radius: 11px; box-shadow: 0 16px 40px -10px rgba(15, 23, 42, 0.3); }
|
|
@@ -16506,7 +16514,7 @@ function hasFieldConditions(schema) {
|
|
|
16506
16514
|
*
|
|
16507
16515
|
* `version.test.ts` asserts this matches `package.json`, so the two cannot drift.
|
|
16508
16516
|
*/
|
|
16509
|
-
var SVGRID_VERSION = "3.1.
|
|
16517
|
+
var SVGRID_VERSION = "3.1.26";
|
|
16510
16518
|
/**
|
|
16511
16519
|
* The version of `@svgrid/grid`, which releases on its own line: enterprise is
|
|
16512
16520
|
* on 3.1.x while the grid is on 3.0.x.
|
|
@@ -16519,7 +16527,7 @@ var SVGRID_VERSION = "3.1.24";
|
|
|
16519
16527
|
*
|
|
16520
16528
|
* `version.test.ts` asserts this matches packages/grid/package.json.
|
|
16521
16529
|
*/
|
|
16522
|
-
var GRID_VERSION = "3.0.
|
|
16530
|
+
var GRID_VERSION = "3.0.23";
|
|
16523
16531
|
//#endregion
|
|
16524
16532
|
//#region src/studio/emit-project.ts
|
|
16525
16533
|
var has = (blocks, kind) => blocks.some((b) => b.config.kind === kind);
|
|
@@ -131,164 +131,89 @@ export type ReviewJSON = {
|
|
|
131
131
|
sets: ChangeSet[];
|
|
132
132
|
};
|
|
133
133
|
/**
|
|
134
|
-
* What `createReview` returns
|
|
134
|
+
* What `createReview` returns: the proposals, their groups, the decisions,
|
|
135
|
+
* and what the grid takes (`columns`, `formats`). Every read is reactive.
|
|
135
136
|
*/
|
|
136
|
-
export
|
|
137
|
-
/**
|
|
138
|
-
* Hold writes nobody typed (an agent's edits, an import, an AI helper's
|
|
139
|
-
* output) as proposals, grouped by the change they make, and write them only
|
|
140
|
-
* when a person accepts them. Give the grid `review.columns(columns)` and
|
|
141
|
-
* `review.formats`, and render `<SvReviewPanel {review} />` beside it. Each
|
|
142
|
-
* decision is one Ctrl+Z in the grid.
|
|
143
|
-
*/
|
|
144
|
-
export declare function createReview<TData = unknown>(opts: ReviewOptions<TData>): {
|
|
137
|
+
export interface Review<TData = unknown> {
|
|
138
|
+
/** Bumped on every change, for code that caches what it reads. */
|
|
145
139
|
readonly version: number;
|
|
146
140
|
/** The wording in effect: English with `messages` laid over it. */
|
|
147
|
-
messages:
|
|
148
|
-
title: string;
|
|
149
|
-
decided: string;
|
|
150
|
-
pendingInGroups: string;
|
|
151
|
-
pendingInOneGroup: string;
|
|
152
|
-
nothingPending: string;
|
|
153
|
-
inConflict: string;
|
|
154
|
-
acceptAll: string;
|
|
155
|
-
rejectAll: string;
|
|
156
|
-
acceptRuleGroups: string;
|
|
157
|
-
resolveFirst: string;
|
|
158
|
-
onlyRowsWithChanges: string;
|
|
159
|
-
confirmAcceptGroup: string;
|
|
160
|
-
confirmRejectGroup: string;
|
|
161
|
-
confirmAcceptAll: string;
|
|
162
|
-
confirmRejectAll: string;
|
|
163
|
-
confirmAcceptRules: string;
|
|
164
|
-
confirmYes: string;
|
|
165
|
-
cancel: string;
|
|
166
|
-
conflictsTitle: string;
|
|
167
|
-
conflictCell: string;
|
|
168
|
-
keep: string;
|
|
169
|
-
badgeRule: string;
|
|
170
|
-
hintRule: string;
|
|
171
|
-
hintMapping: string;
|
|
172
|
-
hintFill: string;
|
|
173
|
-
hintConstant: string;
|
|
174
|
-
hintEach: string;
|
|
175
|
-
oneChange: string;
|
|
176
|
-
changes: string;
|
|
177
|
-
sure: string;
|
|
178
|
-
sureRange: string;
|
|
179
|
-
accept: string;
|
|
180
|
-
reject: string;
|
|
181
|
-
acceptGroupLabel: string;
|
|
182
|
-
rejectGroupLabel: string;
|
|
183
|
-
from: string;
|
|
184
|
-
otherValues: string;
|
|
185
|
-
sampleOf: string;
|
|
186
|
-
everyChange: string;
|
|
187
|
-
firstN: string;
|
|
188
|
-
showRow: string;
|
|
189
|
-
rowId: string;
|
|
190
|
-
acceptOne: string;
|
|
191
|
-
rejectOne: string;
|
|
192
|
-
showAll: string;
|
|
193
|
-
keysHint: string;
|
|
194
|
-
showInGrid: string;
|
|
195
|
-
nextInGrid: string;
|
|
196
|
-
hiddenRows: string;
|
|
197
|
-
allReviewed: string;
|
|
198
|
-
reviewedSummary: string;
|
|
199
|
-
reviewedStale: string;
|
|
200
|
-
noProposals: string;
|
|
201
|
-
noProposalsHint: string;
|
|
202
|
-
notWritten: string;
|
|
203
|
-
rowField: string;
|
|
204
|
-
decidedLabel: string;
|
|
205
|
-
noteCellChanged: string;
|
|
206
|
-
noteRowGone: string;
|
|
207
|
-
noteRowEditing: string;
|
|
208
|
-
noteGridNotReady: string;
|
|
209
|
-
noteSavedStale: string;
|
|
210
|
-
noteConflict: string;
|
|
211
|
-
undoHint: string;
|
|
212
|
-
announceAccepted: string;
|
|
213
|
-
announceRejected: string;
|
|
214
|
-
announceStale: string;
|
|
215
|
-
announceSkipped: string;
|
|
216
|
-
announceCommittedStale: string;
|
|
217
|
-
announceNotSaved: string;
|
|
218
|
-
announceNothing: string;
|
|
219
|
-
undoFailed: string;
|
|
220
|
-
redoFailed: string;
|
|
221
|
-
cardProposed: string;
|
|
222
|
-
proposes: string;
|
|
223
|
-
nowValue: string;
|
|
224
|
-
empty: string;
|
|
225
|
-
labelWhitespace: string;
|
|
226
|
-
labelCase: string;
|
|
227
|
-
caseUpper: string;
|
|
228
|
-
caseLower: string;
|
|
229
|
-
caseTitle: string;
|
|
230
|
-
caseMixed: string;
|
|
231
|
-
labelToNumber: string;
|
|
232
|
-
labelDates: string;
|
|
233
|
-
datesAsDates: string;
|
|
234
|
-
labelShape: string;
|
|
235
|
-
labelPunct: string;
|
|
236
|
-
punctRemove: string;
|
|
237
|
-
punctAdd: string;
|
|
238
|
-
punctSpaces: string;
|
|
239
|
-
labelDivide: string;
|
|
240
|
-
labelMultiply: string;
|
|
241
|
-
labelMapping: string;
|
|
242
|
-
mappingValues: string;
|
|
243
|
-
labelFill: string;
|
|
244
|
-
labelFillVarious: string;
|
|
245
|
-
labelConstant: string;
|
|
246
|
-
labelUnpatterned: string;
|
|
247
|
-
};
|
|
141
|
+
readonly messages: ReviewMessages;
|
|
248
142
|
/** The last undo or redo whose save failed, or null. */
|
|
249
143
|
readonly lastError: {
|
|
250
144
|
error: unknown;
|
|
251
|
-
during:
|
|
145
|
+
during: 'undo' | 'redo';
|
|
252
146
|
at: number;
|
|
253
147
|
} | null;
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
148
|
+
/** Add a change set; a cell that already has a live proposal from another source becomes a conflict. */
|
|
149
|
+
add(input: AddInput): ChangeSet;
|
|
150
|
+
/** One proposal by id. */
|
|
151
|
+
get(id: string): Proposal | undefined;
|
|
152
|
+
/** Every proposal of the session, whatever its status. */
|
|
153
|
+
proposals(): Proposal[];
|
|
154
|
+
/** What names a proposal's row (`rowLabel`), or null. */
|
|
155
|
+
rowLabel(p: Proposal): string | null;
|
|
259
156
|
/** A field's column header, as the group labels show it. */
|
|
260
|
-
fieldLabel
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
157
|
+
fieldLabel(field: string): string;
|
|
158
|
+
/** The proposals waiting for a decision. */
|
|
159
|
+
pending(): Proposal[];
|
|
160
|
+
/** The proposals two sources disagree on, to settle with `resolveConflict`. */
|
|
161
|
+
conflicts(): Proposal[];
|
|
162
|
+
/** The pending proposals grouped by the change they make, the groups that need a person first. */
|
|
163
|
+
groups(): ProposalGroup[];
|
|
164
|
+
/** The pending proposal for one cell, if there is one. */
|
|
165
|
+
pendingFor(rowId: string, field: string): Proposal | undefined;
|
|
166
|
+
/** Write these proposals: checks each cell still holds `before`, before and after `onCommit`. One undo step. */
|
|
167
|
+
accept(ids: ReadonlyArray<string>): Promise<ReviewOutcome>;
|
|
168
|
+
/** Decide against these proposals; nothing is written. One undo step. */
|
|
169
|
+
reject(ids: ReadonlyArray<string>): ReviewOutcome;
|
|
170
|
+
/** Accept a group, limited to the ids the person was shown, so a proposal added since is not decided unseen. */
|
|
171
|
+
acceptGroup(key: string, shownIds: ReadonlyArray<string>): Promise<ReviewOutcome>;
|
|
172
|
+
/** Reject a group, limited to the ids the person was shown. */
|
|
173
|
+
rejectGroup(key: string, shownIds: ReadonlyArray<string>): ReviewOutcome;
|
|
174
|
+
/** Keep one of a cell's conflicting proposals (it becomes pending) and reject the rest, as one undo step. */
|
|
175
|
+
resolveConflict(keepId: string): void;
|
|
176
|
+
/** `conditionalFormats` for the grid: pending cells tinted, conflicting cells marked, the row "Show in grid" lands on lit. */
|
|
270
177
|
readonly formats: ConditionalFormat<any>[];
|
|
271
|
-
columns
|
|
272
|
-
|
|
178
|
+
/** The grid's columns with the proposed value drawn in each pending cell. */
|
|
179
|
+
columns<C extends ReadonlyArray<any>>(cols: C): C;
|
|
180
|
+
/** Show the next proposal of `ids` after `fromId` in the grid, on whatever page it is. */
|
|
181
|
+
reveal(ids: ReadonlyArray<string>, fromId?: string): {
|
|
273
182
|
id: string | null;
|
|
274
183
|
hidden: number;
|
|
275
184
|
};
|
|
276
|
-
|
|
277
|
-
|
|
185
|
+
/** Show only rows with a pending or conflicting proposal, on top of the user's own filters. */
|
|
186
|
+
showPendingOnly(on: boolean): void;
|
|
187
|
+
/** Whether `showPendingOnly` is on (the grid's own Clear turns it off too). */
|
|
278
188
|
readonly pendingOnly: boolean;
|
|
279
|
-
|
|
189
|
+
/** Every set with its proposals and their status, as plain JSON; `setIds` exports only some. */
|
|
190
|
+
toJSON(opts?: {
|
|
280
191
|
setIds?: ReadonlyArray<string>;
|
|
281
|
-
})
|
|
282
|
-
|
|
192
|
+
}): ReviewJSON;
|
|
193
|
+
/** Replace everything with an export; returns how many malformed proposals were dropped. */
|
|
194
|
+
load(json: ReviewJSON): {
|
|
283
195
|
dropped: number;
|
|
284
196
|
};
|
|
285
|
-
|
|
197
|
+
/** Add the sets of an export, keeping what is here; returns how many were dropped. */
|
|
198
|
+
merge(json: ReviewJSON): {
|
|
286
199
|
dropped: number;
|
|
287
200
|
};
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
201
|
+
/** Every decided proposal (accepted, rejected or stale), oldest decision first. */
|
|
202
|
+
log(): Proposal[];
|
|
203
|
+
/** Propose undoing what a set wrote, as a new set to review; null when nothing of it was accepted. */
|
|
204
|
+
revertSet(setId: string): ChangeSet | null;
|
|
205
|
+
/** The sets in this review, newest last, without their proposals. */
|
|
206
|
+
sets(): Array<Omit<ChangeSet, 'proposals'> & {
|
|
291
207
|
count: number;
|
|
292
208
|
}>;
|
|
293
|
-
|
|
294
|
-
|
|
209
|
+
/** Forget every proposal and set. */
|
|
210
|
+
clear(): void;
|
|
211
|
+
}
|
|
212
|
+
/**
|
|
213
|
+
* Hold writes nobody typed (an agent's edits, an import, an AI helper's
|
|
214
|
+
* output) as proposals, grouped by the change they make, and write them only
|
|
215
|
+
* when a person accepts them. Give the grid `review.columns(columns)` and
|
|
216
|
+
* `review.formats`, and render `<SvReviewPanel {review} />` beside it. Each
|
|
217
|
+
* decision is one Ctrl+Z in the grid.
|
|
218
|
+
*/
|
|
219
|
+
export declare function createReview<TData = unknown>(opts: ReviewOptions<TData>): Review<TData>;
|