pivotkit-element 0.3.0 → 0.5.0
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/CHANGELOG.md +131 -1
- package/dist/THIRD_PARTY_LICENSES.txt +2 -2
- package/dist/chunks/chunk-4PHDW2LB.js +1 -0
- package/dist/chunks/chunk-5QXN3X2Q.js +1 -0
- package/dist/chunks/chunk-65G326ME.js +1 -0
- package/dist/chunks/chunk-65O4Z5GI.js +1 -0
- package/dist/chunks/chunk-CCL5TDLA.js +6 -0
- package/dist/chunks/chunk-NSPPM3IJ.js +16 -0
- package/dist/chunks/chunk-PJA6QZ4Y.js +2 -0
- package/dist/chunks/chunk-QOKB5RDG.js +6 -0
- package/dist/chunks/chunk-SB3L4HHW.js +1 -0
- package/dist/chunks/chunk-WKVC2RPA.js +1 -0
- package/dist/chunks/chunk-XETFD6GR.js +1 -0
- package/dist/chunks/chunk-XR4CMFGN.js +1 -0
- package/dist/chunks/chunk-YUY4D5MF.js +8 -0
- package/dist/chunks/echarts-4DC3BQOK.js +5 -0
- package/dist/chunks/export-YHS47KGK.js +1 -0
- package/dist/chunks/import-csv-UCA275TR.js +1 -0
- package/dist/chunks/import-json-W4GCIW36.js +1 -0
- package/dist/chunks/import-ui-7XVUBL2H.js +1 -0
- package/dist/chunks/link-45LOEA7H.js +1 -0
- package/dist/chunks/menu-texts-de-74DWTJDI.js +1 -0
- package/dist/chunks/menus-XBN5D32E.js +2 -0
- package/dist/chunks/report-run-BZBFOMPF-4M6ACMUF.js +60 -0
- package/dist/chunks/unused-texts-Y4R67XSN-VYGDYJND.js +1 -0
- package/dist/chunks/unused-texts-de-6YVPTNVS-FL6CDBZX.js +1 -0
- package/dist/element.js +1 -1
- package/dist/import-worker.js +1 -0
- package/dist/index.js +1 -1
- package/package.json +11 -5
- package/types/element.d.ts +80 -93
- package/types/events.d.ts +1 -0
- package/types/global.d.ts +3 -1
- package/types/jsx.d.ts +1 -1
- package/dist/chunks/chunk-FW54TETI.js +0 -9
- package/dist/chunks/chunk-J3NYMXAT.js +0 -6
- package/dist/chunks/chunk-MB64GADT.js +0 -1
- package/dist/chunks/chunk-RXM4LLDS.js +0 -1
- package/dist/chunks/echarts-42T6EZ6B.js +0 -18
- package/dist/chunks/export-GKVGFFWM.js +0 -6
- package/dist/chunks/link-52SWRX4P.js +0 -1
- package/dist/chunks/menu-texts-de-X4IUO7W5.js +0 -1
- package/dist/chunks/menus-SYPZC2NE.js +0 -1
- package/dist/chunks/unused-texts-K3VFH65P-5EAURTYC.js +0 -1
- package/dist/chunks/unused-texts-de-OW4TGIVX-GHETGXFE.js +0 -1
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import{c as yt,d as Ct,e as Nt}from"./chunk-QOKB5RDG.js";import"./chunk-UTPKLCNX.js";import{b as kt,c as wt,d as xt,e as bt,f as Tt,h as Et}from"./chunk-65O4Z5GI.js";import{b as mt,f as X,k as ut,m as gt}from"./chunk-XETFD6GR.js";import{h as Ot}from"./chunk-PJA6QZ4Y.js";import{I as B,da as dt}from"./chunk-4PHDW2LB.js";import{a as _,h as ft}from"./chunk-XR4CMFGN.js";import{Zd as St,ce as $t,ee as vt}from"./chunk-NSPPM3IJ.js";import{a as H}from"./chunk-5QXN3X2Q.js";import"./chunk-DCANE7XH.js";var qt="default-src 'none'; style-src 'unsafe-inline'; img-src data:; base-uri 'none'; form-action 'none'",Rt=`<!doctype html>
|
|
2
|
+
<html lang="{{lang}}" dir="{{dir}}">
|
|
3
|
+
<head>
|
|
4
|
+
<meta http-equiv="Content-Security-Policy" content="${qt}">
|
|
5
|
+
<meta charset="utf-8">
|
|
6
|
+
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
7
|
+
<meta name="generator" content="pivotkit">
|
|
8
|
+
<meta name="description" content="{{summary}}">
|
|
9
|
+
<title>{{title}}</title>
|
|
10
|
+
{{style}}
|
|
11
|
+
</head>
|
|
12
|
+
<body>
|
|
13
|
+
<main class="pk-report">
|
|
14
|
+
<header>
|
|
15
|
+
<h1>{{title}}</h1>
|
|
16
|
+
<p class="pk-report-description">{{description}}</p>
|
|
17
|
+
</header>
|
|
18
|
+
{{chart}}
|
|
19
|
+
{{table}}
|
|
20
|
+
{{details}}
|
|
21
|
+
</main>
|
|
22
|
+
</body>
|
|
23
|
+
</html>
|
|
24
|
+
`;var I=/[\u061c\u200e\u200f\u202a-\u202e\u2066-\u2069]/g,tt=Object.freeze({en:Object.freeze({untitled:"Report",source:"Source",rows:"Rows",rowsCount:"{count} rows",generated:"Generated",filters:"Filters",noFilters:"None",chart:"Chart",tableCut:"The table shows the first {shown} of {count} rows. Export it as Excel or CSV for all of them.",chartCut:"The chart shows the first {shown} of {count} categories.",chartUnavailable:"The chart is left out: ECharts is not available."}),de:Object.freeze({untitled:"Bericht",source:"Quelle",rows:"Zeilen",rowsCount:"{count} Zeilen",generated:"Erstellt",filters:"Filter",noFilters:"Keine",chart:"Diagramm",tableCut:"Die Tabelle zeigt die ersten {shown} von {count} Zeilen. F\xFCr alle als Excel oder CSV exportieren.",chartCut:"Das Diagramm zeigt die ersten {shown} von {count} Kategorien.",chartUnavailable:"Das Diagramm fehlt: ECharts ist nicht verf\xFCgbar."})});function et(t,a={}){let e=String(t).split("-")[0].toLowerCase(),n=Object.hasOwn(tt,e)?tt[e]:tt.en,r={...n};for(let[m,h]of Object.entries(a??{}))Object.hasOwn(n,m)&&typeof h=="string"&&(r[m]=h);return r}var L=(t,a)=>t.replace(/\{(\w+)\}/g,(e,n)=>Object.hasOwn(a,n)?String(a[n]):e);var K=262144,rt=Object.freeze({title:"text",description:"text",source:"text",generated:"text",rows:"text",filters:"text",summary:"text",lang:"text",dir:"text",style:"markup",chart:"markup",table:"markup",details:"markup"}),_t=Object.freeze(["lang","dir","title","alt","class","aria-label","aria-description"]),At=new Set(["script","style","xmp","iframe","noembed","noframes","noscript","plaintext","template"]),Bt=new Set(["title","textarea"]),P="\\t\\n\\f\\r ",Xt=new RegExp(`^<(/?)([a-zA-Z][^${P}/>]*)`),Jt=new RegExp(`[${P}/]`),Qt=new RegExp(`^[^${P}/>=]+`),jt=new RegExp(`^[${P}]*`),Yt=new RegExp(`^[^${P}>]*`);function v(t){return String(t).replace(I,"").replace(/[&<>"']/g,a=>({"&":"&","<":"<",">":">",'"':""","'":"'"})[a])}function z(t,a,e={}){return new _("INVALID_TEMPLATE",`template: ${a}`,{reason:t,...e})}var C=(t,a)=>t.slice(0,a).split(`
|
|
25
|
+
`).length;function It(t){if(typeof t!="string")throw new _("INVALID_ARGUMENT","parseTemplate(source): source must be a string");if(t.length>K)throw new _("LIMIT_EXCEEDED",`the template has ${t.length.toLocaleString("en-US")} characters, more than the limit of ${K.toLocaleString("en-US")}`,{limit:"template",value:t.length,max:K});if(t.includes("\0"))throw z("nul","the template holds a NUL character");let a=[],e=new Set,n="",r=0,m=t.length,h=(i,S,d,u)=>{let O=t.indexOf("{{",i);if(O!==-1&&O<S){let o=/^\{\{\s*([^}\s]*)/.exec(t.slice(O,O+64))?.[1]??"";throw z(d,`a placeholder ${o?`{{${o}}} `:""}is not allowed ${u} (line ${C(t,O)})`,{placeholder:o,line:C(t,O)})}},x=(i,S,d)=>{let u=t.indexOf("}}",i+2),O=t.indexOf("{{",i+2);if(u===-1||O!==-1&&O<u)throw z("unclosed",`"{{" without "}}" (line ${C(t,i)})`,{line:C(t,i)});let o=t.slice(i+2,u).trim();if(!Object.hasOwn(rt,o)){let p=/^[\w-]{1,64}$/.test(o)?B(o,Object.keys(rt)):null;throw z("unknownPlaceholder",`unknown placeholder {{${o.slice(0,64)}}} (line ${C(t,i)})${p?`; did you mean {{${p}}}?`:""}`,{placeholder:o.slice(0,64),line:C(t,i),...p?{suggestion:p}:{}})}let c=rt[o];if(c==="markup"&&!S)throw z("markupInText",`{{${o}}} is markup and is allowed in the document's text only, not ${d} (line ${C(t,i)})`,{placeholder:o,line:C(t,i)});return{slot:{name:o,kind:c},end:u+2}},k=()=>{n&&(a.push(n),n="")},b=i=>{k(),a.push(i),e.add(i.name)};for(;r<m;){if(t.startsWith("{{",r)){if(/<\/?$/.test(t.slice(Math.max(0,r-2),r)))throw z("tagName",`a placeholder is not allowed where a tag's name starts (line ${C(t,r)})`,{line:C(t,r)});let{slot:s,end:g}=x(r,!0,"here");b(s),r=g;continue}if(t[r]!=="<"){n+=t[r++];continue}if(t.startsWith("<!--",r)){let s=t.indexOf("-->",r+4),g=s===-1?m:s+3;h(r,g,"comment","in a comment"),n+=t.slice(r,g),r=g;continue}if(t[r+1]==="!"||t[r+1]==="?"){let s=t.indexOf(">",r),g=s===-1?m:s+1;h(r,g,"markup","in a doctype or declaration"),n+=t.slice(r,g),r=g;continue}let i=Xt.exec(t.slice(r,r+256));if(!i){n+=t[r++];continue}let S=i[1]==="/",d=i[2].toLowerCase();k(),h(r,r+i[0].length,"tagName","in a tag's name"),n+=i[0],r+=i[0].length;let u=[],O=[];for(;r<m&&t[r]!==">";){if(Jt.test(t[r])){n+=t[r++];continue}let s=Qt.exec(t.slice(r,r+1024))?.[0]??t[r];h(r,r+s.length,"attributeName","in an attribute's name"),n+=s,r+=s.length;let g=jt.exec(t.slice(r))?.[0]??"";if(t[r+g.length]!=="="){u.push({name:s.toLowerCase(),value:null});continue}n+=g+"=",r+=g.length+1,g=jt.exec(t.slice(r))?.[0]??"",n+=g,r+=g.length;let T=t[r];if(T==='"'||T==="'"){let l=t.indexOf(T,r+1),E=l===-1?m:l;O.push({attr:s.toLowerCase(),start:r+1,end:E,quote:T}),u.push({name:s.toLowerCase(),value:t.slice(r+1,E)}),r=Math.min(m,E+1),n+="\0"+(O.length-1)+"\0";continue}let $=Yt.exec(t.slice(r))?.[0]??"";h(r,r+$.length,"unquoted",`in an unquoted attribute value (${s})`),u.push({name:s.toLowerCase(),value:$}),n+=$,r+=$.length}let o=d==="meta"&&u.some(s=>s.name==="name"&&(s.value??"").trim().toLowerCase()==="description")&&!u.some(s=>s.name==="http-equiv"),c=n;n="";let p=/\u0000(\d+)\u0000/g,f=0,w;for(;w=p.exec(c);){n+=c.slice(f,w.index),f=w.index+w[0].length;let s=O[Number(w[1])];_t.includes(s.attr)||o&&s.attr==="content"||h(s.start,s.end,"attribute",`in the attribute "${s.attr}" (only ${_t.join(", ")} and the content of <meta name="description"> without http-equiv)`),n+=s.quote;let T=s.start;for(;T<s.end;)if(t.startsWith("{{",T)){let{slot:$,end:l}=x(T,!1,"in an attribute");b($),T=l}else n+=t[T++];n+=s.quote}if(n+=c.slice(f),r<m&&(n+=">",r++),!S&&(At.has(d)||Bt.has(d))){let s=new RegExp(`</${d}[${P}/>]`,"i"),g=t.slice(r),T=s.exec(g),$=T&&d!=="plaintext"?r+T.index:m;if(d==="script"&&t.slice(r,$).includes("<!--")&&h(r,m,"scriptComment",'after a <script> that holds "<!--"'),At.has(d))h(r,$,"rawText",`inside <${d}>`),n+=t.slice(r,$);else{let l=r;for(;l<$;)if(t.startsWith("{{",l)){let{slot:E,end:A}=x(l,!1,`inside <${d}>`);b(E),l=A}else n+=t[l++]}r=$}}return k(),{parts:a,names:[...e]}}function Lt(t,a){return t.parts.map(e=>{if(typeof e=="string")return e;let n=Object.hasOwn(a,e.name)?a[e.name]??"":"";return e.kind==="text"?v(n):n}).join("")}var G=/^#(?:[0-9a-fA-F]{3}|[0-9a-fA-F]{6})$/,nt=t=>t===2?" pk-grand":t===1?" pk-sub":"";function zt(t,{maxCells:a,caption:e,colorScale:n=[...H.colorScale],dataBar:r=H.dataBar}){let m=Math.max(1,t.columnCount),h=t.rows.length-t.headerRows,x=Math.max(0,Math.min(h,Math.floor(a/m)-t.headerRows)),k=[],b=0,i=o=>{if(!o)return"";if(o.bar!==void 0){let c=o.color&&G.test(o.color)?o.color:r,p=Math.round(Math.max(0,Math.min(1,o.bar))*1e3)/10,f=`pk-c${b++}`;return k.push(`.${f}{--pk-bar:${p}%;--pk-bar-color:${G.test(c)?c:H.dataBar}}`),` pk-has-bar ${f}`}if(o.scale!==void 0){let c=Math.max(0,Math.min(1,o.scale)),p=o.color&&G.test(o.color)?o.color:ut(n.filter(w=>G.test(w)).length>=2?n.filter(w=>G.test(w)):[...H.colorScale],c),f=`pk-c${b++}`;return k.push(`.${f}{--pk-cell-bg:${p}}`),` pk-has-scale ${f}`}return""},S=o=>`${(o.colSpan??1)>1?` colspan="${o.colSpan}"`:""}${(o.rowSpan??1)>1?` rowspan="${o.rowSpan}"`:""}`,d=[];for(let o=0;o<t.headerRows;o++){let c=t.rows[o].map(p=>p?`<th scope="col" class="pk-th${p.kind==="corner"?" pk-corner":""}${nt(p.total)}"${S(p)}>${v(p.text)}</th>`:"").join("");d.push(`<tr>${c}</tr>`)}let u=[];for(let o=t.headerRows;o<t.headerRows+x;o++){let c=t.rows[o].map(p=>{if(!p)return"";let f=Math.min(p.rowSpan??1,t.headerRows+x-o),w=S({...p,rowSpan:f});if(p.kind==="rowHeader"){let g=p.toggle?.collapsed?" pk-collapsed":"";return`<th scope="row" class="pk-th pk-row${nt(p.total)}${g}"${w}>${v(p.text)}</th>`}return`<td class="pk-td${p.valueType==="text"?" pk-text":" pk-num"}${nt(p.total)}${i(p.style)}"${w}>${v(p.text)}</td>`}).join("");u.push(`<tr>${c}</tr>`)}return{html:`<table class="pk-table">${e?`<caption>${v(e)}</caption>`:""}<thead>${d.join("")}</thead><tbody>${u.join("")}</tbody></table>`,css:k.join(`
|
|
26
|
+
`),cut:x<h?{rows:x,of:h}:null}}var N=Object.freeze({"--pk-surface":"#ffffff","--pk-surface-2":"#f6f7f9","--pk-surface-raised":"#ffffff","--pk-text":"#1a1d23","--pk-muted":"#5a6270","--pk-border":"#dde1e7","--pk-border-strong":"#c3c9d2","--pk-grid":"#edf0f3","--pk-total":"#eef1f5","--pk-total-strong":"#e9edf3","--pk-shadow":"0 1px 2px rgb(16 24 40 / 0.06), 0 4px 12px rgb(16 24 40 / 0.08)","--pk-heat-low":"#eaf1fb","--pk-heat-high":"#2a78d6","--pk-scale-low":"var(--pk-heat-low)","--pk-scale-high":"var(--pk-heat-high)","--pk-chart-1":"#2a78d6","--pk-chart-2":"#eb6834","--pk-chart-3":"#1baf7a","--pk-chart-4":"#eda100","--pk-chart-5":"#e87ba4","--pk-chart-6":"#008300","--pk-chart-7":"#6250d6","--pk-chart-8":"#e34948"}),at=Object.freeze({"--pk-surface":"#16181d","--pk-surface-2":"#1c1f25","--pk-surface-raised":"#22262d","--pk-text":"#e8eaef","--pk-muted":"#a3aab7","--pk-border":"#2f343e","--pk-border-strong":"#454c58","--pk-grid":"#23272e","--pk-total":"#21252d","--pk-total-strong":"#252a33","--pk-shadow":"0 1px 2px rgb(0 0 0 / 0.4), 0 4px 12px rgb(0 0 0 / 0.3)","--pk-heat-low":"#1d2735","--pk-heat-high":"#3987e5","--pk-scale-low":"var(--pk-heat-low)","--pk-scale-high":"var(--pk-heat-high)","--pk-chart-1":"#3987e5","--pk-chart-2":"#d95926","--pk-chart-3":"#199e70","--pk-chart-4":"#c98500","--pk-chart-5":"#d55181","--pk-chart-6":"#008300","--pk-chart-7":"#9085e9","--pk-chart-8":"#e66767"}),D=Object.freeze({"--pk-weight-normal":"400","--pk-weight-medium":"500","--pk-weight-strong":"600","--pk-weight-bold":"700"}),M=Object.freeze({"--pk-radius-card":"8px"}),U=Object.freeze({"--pk-font-size":"14px","--pk-small":"max(14px, 0.93em)","--pk-report-title-size":"calc(var(--pk-font-size) * 10 / 7)","--pk-print-size":"10pt","--pk-print-small":"7pt"}),ot="system-ui, -apple-system, Segoe UI, Roboto, Helvetica Neue, Arial, sans-serif",te=/^(?![\s\S]*(\/\*|\*\/))[#\w\s.,%()/*+-]*$/,ee=new Set(["rgb","rgba","hsl","hsla","hwb","lab","lch","oklab","oklch","color","color-mix","light-dark","calc","min","max","clamp","var"]);function re(t){if(/[\n\r\f]|url\(/i.test(t))return!1;let a=t.replace(/"[^"\\<>{};]*"/g,"");return te.test(a)&&[...a.matchAll(/([\w-]*)\(/g)].every(e=>ee.has(e[1].toLowerCase()))}function Pt(t={}){let a={...N,...D,...M,...U,"font-family":ot,...J(t)};return a["font-family"]=a["font-family"].replace(/["']/g,""),{getPropertyValue:e=>Object.hasOwn(a,e)?a[e]:""}}function J(t){let a={};for(let[e,n]of Object.entries(t??{}))(/^--pk-[a-z0-9-]+$/.test(e)||e==="font-family")&&typeof n=="string"&&n.length<=200&&re(n)&&(a[e]=n.trim());return a}var ne=/^#(?:[0-9a-f]{3}|[0-9a-f]{6})$/i;function st(t={}){let a={...N,...J(t)},e=(x,k=0)=>{let b=Object.hasOwn(a,x)?a[x]:"",i=/^var\((--pk-[a-z0-9-]+)\)$/.exec(b);return i&&k<4?e(i[1],k+1):ne.test(b)?b:null},[n,r,m,h]=["--pk-scale-low","--pk-scale-mid","--pk-scale-high","--pk-chart-1"].map(x=>e(x));return{...n&&m?{colorScale:r?[n,r,m]:[n,m]}:{},...h?{dataBar:h}:{}}}var it=t=>Object.entries(t).filter(([a])=>a.startsWith("--pk-")).map(([a,e])=>`${a}:${e}`).join(";");var Dt=Object.freeze({landscape:8,small:16});function Mt({columns:t,tokens:a={},extra:e=""}){let n=a["font-family"]??ot,r=it({...N,...D,...M,...U,...a}),m={...N,...a}["--pk-surface"],h=t>Dt.landscape?"size:landscape;":"";return`:root{${r};color-scheme:light dark}
|
|
27
|
+
@media screen and (prefers-color-scheme:dark){:root{${it(at)}}}
|
|
28
|
+
*{box-sizing:border-box}
|
|
29
|
+
body{margin:0;background:var(--pk-surface);color:var(--pk-text);font:var(--pk-font-size)/1.45 ${n}}
|
|
30
|
+
.pk-report{padding:24px}
|
|
31
|
+
.pk-report h1{font-size:var(--pk-report-title-size);font-weight:var(--pk-weight-bold);line-height:1.3;margin:0 0 4px}
|
|
32
|
+
.pk-report-description{margin:0 0 12px;color:var(--pk-muted)}
|
|
33
|
+
.pk-report-description:empty{display:none}
|
|
34
|
+
.pk-report-chart{margin:12px 0 16px;padding:8px;background:${m};border:1px solid var(--pk-border);border-radius:var(--pk-radius-card);break-inside:avoid;width:max-content;max-width:100%}
|
|
35
|
+
.pk-report-chart img,.pk-report-chart svg{display:block;max-width:100%;height:auto}
|
|
36
|
+
.pk-table{border-collapse:collapse;font-variant-numeric:tabular-nums;margin:12px 0 0}
|
|
37
|
+
.pk-table th,.pk-table td{border:1px solid var(--pk-border);padding:4px 8px;vertical-align:top}
|
|
38
|
+
.pk-th{background:var(--pk-surface-2);text-align:left;font-weight:var(--pk-weight-strong)}
|
|
39
|
+
.pk-th.pk-row{font-weight:var(--pk-weight-normal);background:var(--pk-surface)}
|
|
40
|
+
.pk-num{text-align:right;white-space:nowrap}
|
|
41
|
+
.pk-table .pk-sub{background:var(--pk-total);font-weight:var(--pk-weight-strong)}
|
|
42
|
+
.pk-table .pk-grand{background:var(--pk-total-strong);font-weight:var(--pk-weight-bold)}
|
|
43
|
+
.pk-collapsed::before{content:"+ ";color:var(--pk-muted)}
|
|
44
|
+
.pk-td.pk-has-scale{background:color-mix(in srgb,var(--pk-cell-bg) 48%,var(--pk-surface))}
|
|
45
|
+
.pk-td.pk-has-bar{background-image:linear-gradient(90deg,color-mix(in srgb,var(--pk-bar-color,var(--pk-chart-1)) 32%,transparent) var(--pk-bar),transparent var(--pk-bar));background-repeat:no-repeat;background-size:100% 64%;background-position:left center}
|
|
46
|
+
.pk-report-note{color:var(--pk-muted);margin:8px 0}
|
|
47
|
+
.pk-report-details{display:grid;grid-template-columns:max-content 1fr;gap:2px 12px;margin:16px 0 0;color:var(--pk-muted);font-size:var(--pk-small)}
|
|
48
|
+
.pk-report-details dt{font-weight:var(--pk-weight-strong)}
|
|
49
|
+
.pk-report-details dd{margin:0}
|
|
50
|
+
@page{margin:12mm;${h}}
|
|
51
|
+
@media print{
|
|
52
|
+
body{font-size:var(--pk-print-size);-webkit-print-color-adjust:exact;print-color-adjust:exact}
|
|
53
|
+
.pk-report{padding:0}
|
|
54
|
+
.pk-report-chart{border:none;padding:0}
|
|
55
|
+
thead{display:table-header-group}
|
|
56
|
+
tr{break-inside:avoid}
|
|
57
|
+
.pk-table th,.pk-table td{padding:2px 6px}
|
|
58
|
+
${t>Dt.small?".pk-table{font-size:var(--pk-print-small)}":""}
|
|
59
|
+
}
|
|
60
|
+
${e}`}var ae=new Set(["fill","fill-opacity","fill-rule","stroke","stroke-width","stroke-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","opacity","font-size","font-family","font-weight","font-style","text-anchor","dominant-baseline","paint-order","visibility"]),oe=new Set(["svg","g","rect","path","text","tspan","circle","ellipse","line","polyline","polygon","defs","clipPath","linearGradient","radialGradient","stop","pattern","image","title","desc"]),Ut=/[\u0000-\u0008\u000B\u000C\u000E-\u001F\u007F]/g,se=t=>t===9||t===10||t===13||t>=32&&t<=55295&&t!==127||t>=57344&&t<=65533||t>=65536&&t<=1114111,ie=t=>se(t)&&!Number.isNaN(t)&&!String.fromCodePoint(t).match(I),le=/^[A-Za-z_][\w:.-]*$/,ce=Object.freeze({xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink"}),pe=t=>t.replace(/&(quot|#39|apos|lt|gt|amp);/g,(a,e)=>({quot:'"',"#39":"'",apos:"'",lt:"<",gt:">",amp:"&"})[e]),Ft=t=>t.replace(/[&<>"]/g,a=>({"&":"&","<":"<",">":">",'"':"""})[a]),R=t=>new _("INVALID_ARGUMENT",`the chart's SVG was refused: ${t}`,{reason:t});function he(t){let a=[],e=/<(\/?)([a-zA-Z][\w:-]*)((?:\s+[^\s=>/]+(?:\s*=\s*(?:"[^"]*"|'[^']*'))?)*)\s*(\/?)>/y,n=/\s+([^\s=>/]+)(?:\s*=\s*(?:"([^"]*)"|'([^']*)'))?/g,r=t.startsWith("<?xml")?t.indexOf("?>")+2:0,m=0;for(;r<t.length;){let h=t.indexOf("<",r),x=t.slice(r,h===-1?t.length:h);if(/[<>]/.test(x)||/&(?!(?:amp|lt|gt|quot|apos|#\d+|#x[0-9a-fA-F]+);)/.test(x))throw R("text that is not escaped");if(a.push(x.replace(Ut,"").replace(I,"").replace(/&#(x[0-9a-fA-F]+|\d+);/g,(o,c)=>ie(c[0]==="x"?parseInt(c.slice(1),16):Number(c))?o:"")),h===-1)break;if(/^<style[\s>]/i.test(t.slice(h,h+7))){let o=t.search(/<\/style\s*>/i);if(o===-1||o<h)throw R("a <style> element that is not closed");r=t.indexOf(">",o)+1;continue}if(t.startsWith("<!--",h)){let o=t.indexOf("-->",h);r=o===-1?t.length:o+3;continue}e.lastIndex=h;let k=e.exec(t);if(!k)throw R("markup that is not a plain element");let[,b,i,S,d]=k;if(!oe.has(i))throw R(`the element <${i}>`);let u=`<${b}${i}`,O=new Map;for(let[,o,c,p]of S.matchAll(n)){let f=pe(c??p??"").replace(Ut,"").replace(I,""),w=o.toLowerCase();if(!le.test(o))throw R("an attribute name that is not a plain name");if((w==="xmlns"||w.startsWith("xmlns:"))&&ce[w]!==f)throw R(`the namespace ${o}`);if(w.startsWith("on"))throw R(`the event attribute ${o}`);if((w==="href"||w==="xlink:href"||w==="src")&&!(/^#[\w-]+$/.test(f)||/^data:image\/(?:png|jpeg|gif|webp);base64,[A-Za-z0-9+/=]*$/.test(f)))throw R(`a link in ${o}`);if(w==="style"){for(let s of f.split(";")){let g=s.indexOf(":"),T=s.slice(0,g).trim().toLowerCase(),$=s.slice(g+1).trim();g>0&&ae.has(T)&&!/url\s*\(|expression\s*\(/i.test($)&&O.set(T,$)}continue}if(/url\s*\(\s*['"]?\s*(?!#)/i.test(f))throw R(`an address in ${o}`);u+=` ${o}="${Ft(f)}"`}for(let[o,c]of O)new RegExp(`\\s${o}=`).test(u)||(u+=` ${o}="${Ft(c)}"`);u+=`${d}>`,a.push(u),i==="svg"&&(m+=b?-1:d?0:1),r=e.lastIndex}if(m!==0)throw R("an <svg> element that is not closed");return a.join("")}function Ht(t,{echarts:a,style:e,width:n,height:r,locale:m,labels:h,limits:x,now:k,maxCategories:b}){let i=t.view,S=xt(i,t.encoded),d=S.swap?X(t.encoded,bt(i),{locale:m,limits:x,...k!==void 0?{now:k}:{}}):t,u=kt(d,{labels:h,limits:x,maxCategories:b}),O=wt(d,{theme:Tt(e),locale:m,labels:h,limits:x,maxCategories:b,series:u,chart:S.chart}),o=vt(O,e,{width:n,height:r,categoryNames:u.categories,axisLabels:i.chart.axisLabels}),c=e.getPropertyValue("--pk-surface").trim()||N["--pk-surface"],p=a.init(null,null,{renderer:"svg",ssr:!0,width:n,height:r}),f;try{let{axisEvery:w,...s}=o;p.setOption({...s,backgroundColor:c,animation:!1}),f=p.renderToSVGString()}finally{p.dispose()}return{svg:he(f),categories:u.categories.length,of:u.categoryCount}}var fe="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",Q=Object.freeze({json:Object.freeze({mediaType:"application/json",extension:"json",text:!0}),csv:Object.freeze({mediaType:"text/csv;charset=utf-8",extension:"csv",text:!0}),xlsx:Object.freeze({mediaType:fe,extension:"xlsx",text:!1}),svg:Object.freeze({mediaType:"image/svg+xml",extension:"svg",text:!0}),html:Object.freeze({mediaType:"text/html;charset=utf-8",extension:"html",text:!0})}),V=Object.freeze({template:K,chartWidth:8e3,chartHeight:8e3,tableCells:2e5,categories:50}),pt=Object.freeze({width:800,height:480}),me=Object.freeze(["chartUnavailable","tableCut","chartCut","viewFile"]),de=new Set(["ar","he","fa","ur","ps","sd","ug","yi","dv","ckb"]),ue=Object.freeze({chart:[!0,!1,"auto"],chartEmbed:["image","inline"],bom:[!0,!1],strict:[!0,!1],trusted:[!0,!1]}),Kt=Object.freeze(["format","locale","timeZone","now","limits","trusted","strict","labels","texts","tokens","title","description","source","template","chart","chartEmbed","echarts","size","tableCells","bom"]),j=(t,a)=>new _("INVALID_OPTION",`render: ${a}`,{option:t}),lt=(t,a,e={})=>({path:"",code:t,message:a,severity:"warning",params:e});function ge(t,a){if(Array.isArray(t)||t&&typeof t=="object"&&Array.isArray(t.columns)&&Array.isArray(t.data)){let e=t;return mt(Array.isArray(t)?t:{columns:e.columns,types:e.types,data:e.data},{timeZone:a.timeZone??"UTC",...a.limits?{limits:a.limits}:{}})}if(t&&typeof t=="object"&&typeof t.column=="function")return t;throw new _("INVALID_ARGUMENT","render(view, data): data must be rows, columnar data ({ columns, types, data }) or encode()'s result")}function ke(t){let a=t?.width??pt.width,e=t?.height??pt.height;for(let[n,r,m]of[["width",a,V.chartWidth],["height",e,V.chartHeight]])if(!Number.isInteger(r)||r<100||r>m)throw j("size",`size.${n} must be a whole number from 100 to ${m}`);return{width:a,height:e}}function Gt(t,a,e){let n=t===void 0?new Date:new Date(t);if(Number.isNaN(n.getTime()))throw j("now","now must be a date, a time in ms or an ISO text");return new Intl.DateTimeFormat(a,{dateStyle:"medium",timeStyle:"short",timeZone:e}).format(n)}async function Vt(t,a,e={}){if(e===null||typeof e!="object"||Array.isArray(e))throw j("options","options must be an object");for(let l of Object.keys(e))if(!Kt.includes(l)){let E=B(l,Kt);throw j(l,`unknown option ${JSON.stringify(l.slice(0,40))}${E?`; did you mean ${JSON.stringify(E)}?`:""}`)}let n=e.format??"html";if(!Object.hasOwn(Q,n))throw j("format",`unknown format ${JSON.stringify(String(n)).slice(0,40)}; one of ${Object.keys(Q).join(", ")}`);let r=Q[n],m={format:n,mediaType:r.mediaType,extension:r.extension},h=n==="html"?It(e.template??Rt):null,x=n==="svg"||n==="html"?ke(e.size):null;for(let[l,E]of Object.entries(ue)){let A=e[l];if(A!==void 0&&!E.includes(A))throw j(l,`${l} takes ${E.map(W=>JSON.stringify(W)).join(", ")}, not ${JSON.stringify(String(A)).slice(0,40)}`)}if((n==="svg"||n==="html"&&e.chart===!0)&&typeof e.echarts?.init!="function")throw j("echarts",`${n==="svg"?"an SVG":"a report with chart: true"} needs ECharts: pass the echarts module (with its SVG renderer) as options.echarts`);e.now!==void 0&&Gt(e.now,"en-US","UTC");let k=[],b=Ot(typeof t=="string"?t:JSON.stringify(t??null));b.failed&&k.push({path:"",code:"viewFile",message:`not a view: ${b.issues.at(-1)?.message??b.failed}`,severity:"error",params:{value:b.failed}});let i=ge(a,e),S=e.trusted?e.limits:ft(e.limits),d=dt(b.view??{},i,{...S?{limits:S}:{}});k.push(...d.issues);let u={locale:e.locale??"en-US",...e.limits?{limits:e.limits}:{},...e.now!==void 0?{now:e.now}:{}},O=X(i,d.view,u);for(let l of O.issues)k.some(E=>E.code===l.code&&E.path===l.path)||k.push(l);let o=!k.some(l=>l.severity==="error");if(!o&&e.strict)return{...m,body:null,issues:k,ok:o,summary:null,view:d.view};let c=gt(O,{...e.labels?{labels:e.labels}:{},...e.limits?{limits:e.limits}:{}}),p={rows:c.bodyRows.length,columns:c.columnCount,sourceRows:i.length,truncated:!1},f=et(c.locale,e.texts),w=(e.title??(b.name||d.view.chart.title||f.untitled)).trim()||f.untitled,s=()=>Ht(O,{echarts:e.echarts,style:Pt(e.tokens),...x,locale:c.locale,labels:e.labels,limits:e.limits,now:e.now,maxCategories:V.categories}),g=l=>{l.categories<l.of&&(p.truncated=!0,k.push(lt("chartCut",L(ct.chartCut,{shown:l.categories,count:l.of}),{value:String(l.categories),max:l.of})))},T;if(n==="json")T=new TextEncoder().encode(yt(c));else if(n==="csv")T=Ct(c,{bom:e.bom!==!1});else if(n==="xlsx")T=Nt(c,{sheetName:w,theme:st(e.tokens)});else if(n==="svg"){let l=s();g(l),T=new TextEncoder().encode(l.svg)}else{let l=new Intl.NumberFormat(c.locale),E=zt(c,{maxCells:e.tableCells??V.tableCells,...st(e.tokens)}),A="";E.cut&&(p.truncated=!0,k.push(lt("tableCut",L(ct.tableCut,{shown:E.cut.rows,count:E.cut.of}),{value:String(E.cut.rows),max:E.cut.of})),A=`<p class="pk-report-note">${v(L(f.tableCut,{shown:l.format(E.cut.rows),count:l.format(E.cut.of)}))}</p>`);let W=e.chart===!0||(e.chart??"auto")==="auto"&&d.view.display==="chart",ht="";if(W&&typeof e.echarts?.init!="function")k.push(lt("chartUnavailable",ct.chartUnavailable));else if(W){let y=s();g(y);let q=y.categories<y.of?`<figcaption class="pk-report-note">${v(L(f.chartCut,{shown:l.format(y.categories),count:l.format(y.of)}))}</figcaption>`:"";ht=`<figure class="pk-report-chart">${e.chartEmbed==="inline"?y.svg:`<img alt="${v(`${f.chart}: ${w}`)}" width="${x?.width}" height="${x?.height}" src="data:image/svg+xml;base64,${we(new TextEncoder().encode(y.svg))}">`}${q}</figure>`}let Y=Et(d.view,i,{...S?{limits:S}:{}}),Wt=e.timeZone??c.timeZone??"UTC",F={title:w,description:e.description??b.description??"",source:e.source??"",generated:Gt(e.now,c.locale,Wt),rows:L(f.rowsCount,{count:l.format(i.length)}),filters:Y.filters.length?Y.filters.map(y=>y.text).join("; "):f.noFilters,summary:Y.text,lang:c.locale,dir:de.has(c.locale.split("-")[0].toLowerCase())?"rtl":"ltr"},Z=(y,q)=>q?`<dt>${v(y)}</dt><dd>${v(q)}</dd>`:"",Zt={style:`<style>${Mt({columns:c.columnCount,tokens:J(e.tokens??{}),extra:E.css})}</style>`,chart:ht,table:E.html+A,details:`<dl class="pk-report-details">${Z(f.source,F.source)}${Z(f.rows,F.rows)}${Z(f.filters,F.filters)}${Z(f.generated,F.generated)}</dl>`};T=new TextEncoder().encode(Lt(h,{...F,...Zt}))}let $={...m,body:T,issues:k,ok:o,summary:p,view:d.view};return r.text?{...$,text:new TextDecoder().decode(T)}:$}var ct=et("en");function we(t){let a="";for(let e=0;e<t.length;e+=32768)a+=String.fromCharCode(...t.subarray(e,e+32768));return btoa(a)}St([$t]);var Ye=Object.freeze([...Object.keys(D),...Object.keys(M),...Object.keys(N),"--pk-scale-mid"]),tr=Object.freeze(Object.keys(U));export{tr as REPORT_LENGTHS,Ye as REPORT_TOKENS,Vt as render};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import"./chunk-DCANE7XH.js";var k={item:"{subject}: {text}",quote:"\u201C{key}\u201D",position:"{subject} (no. {n} in {part})",view:"The view",sections:{sort:"Sorting",derived:"Groupings",totals:"Totals",collapsed:"Collapsed groups",display:"Table or chart",chart:"Chart",formatting:"Formatting"},settings:{display:"display",type:"chart type",valueLabels:"value labels",legend:"legend position",axisLabels:"axis labels",groupLabels:"group labels",labelPosition:"label position",other:"setting"},dropped:{rows:"it is left out of Rows",cols:"it is left out of Columns",values:"this value is left out",filters:"this filter is left out",sort:"the usual order is used",derived:"this grouping is left out",other:"it is left out"},codes:{notView:"this is not a pivotkit view - the report starts empty",notJson:"this is not valid JSON - the report starts empty",tooLarge:"the view is too large - the report starts empty",badVersion:"the view has an unknown version - the report starts empty",newerVersion:"the view comes from a newer pivotkit - the report starts empty; update pivotkit to open it",noMigration:"the view cannot be brought to this version - the report starts empty",unknownKey:"this setting is unknown here - it is ignored",notList:"this is not a list - nothing of it is used",tooMany:"more than {max} entries - only the first {max} are used",tooManyItems:"more than {max} items - only the first {max} are used",itemType:"the item \u201C{value}\u201D does not fit a {type} field - it is left out",itemTooLong:"an item is longer than {max} characters - it is left out",itemCase:"the data has no item \u201C{value}\u201D, but \u201C{suggestion}\u201D - the filter keeps the item as written",unknownField:"the data has no field \u201C{field}\u201D - {dropped}",unknownFieldHere:"the data has no field of this name - {dropped}",placedTwice:"the field is in Rows or Columns twice - only its first place is used",groupingNoName:"the grouping has no name - it is left out",groupingNameTaken:"the data already has a field of this name - the grouping is left out",groupingNoSource:"the data has no field \u201C{field}\u201D to group - the grouping is left out",groupingUnknown:"the grouping \u201C{value}\u201D is unknown - it is left out",binsNeedNumber:"ranges need a number field, \u201C{field}\u201D is not one - the grouping is left out",groupingNeedsDate:"a date grouping needs a date field, \u201C{field}\u201D is not one - the grouping is left out",binSize:"ranges need a size above zero - the grouping is left out",notValueRef:"this is not a value - {dropped}",unknownAggregator:"the calculation \u201C{value}\u201D is unknown - {dropped}",aggregatorNeedsField:"{agg} needs a field - {dropped}",aggregatorType:"{agg} does not work on \u201C{field}\u201D ({type}) - {dropped}",unknownFormat:"the number format \u201C{value}\u201D is unknown - the usual format is used",badLabel:"the name is empty or longer than {max} characters - the usual name is used",unknownShowAs:"\u201CShow as\u201D \u201C{value}\u201D is unknown - the plain value is shown",showAsNotAdditive:"this \u201CShow as\u201D needs a sum or a count, not {agg} - the plain value is shown",showAsNotNumber:"{agg} gives no number to show as a share - the plain value is shown",unknownConditional:"the colour format \u201C{value}\u201D is unknown - the value is shown without colours",conditionalNotNumber:"colours need a number value - the value is shown without colours",colorScaleColors:"the colour scale needs two or three colours - the default colours are used",dataBarColor:"the bar colour is not a colour - the default colour is used",unknownFilterType:"the filter type \u201C{value}\u201D is unknown - this filter is left out",filterNoItems:"the filter lists no items - it is left out",filterFieldType:"a filter of the type \u201C{value}\u201D does not work on \u201C{field}\u201D ({type}) - this filter is left out",filterTextOp:"the text condition \u201C{value}\u201D is unknown - this filter is left out",filterMatch:"the text matching is unknown - case and spaces are ignored",filterNot:"\u201Cnot\u201D must be true or false - the filter is not inverted",filterBlanks:"what happens to blank items is unknown (\u201C{value}\u201D) - blank items are left out",blanksUnspecified:"the filter does not say what happens to blank items - they are left out",filterEmpty:"the filter lists no items and keeps no blanks - it keeps nothing",filterText:"the text condition has no text, or more than {max} characters - this filter is left out",filterNotNumber:"{agg} gives no number to filter by - this filter is left out",filterTies:"the ties \u201C{value}\u201D are unknown (first or all) - the first in the data are kept",filterPrecision:"the precision \u201C{value}\u201D is unknown or not for this field (year, quarter, month, day or hour of a date) - days are compared",filterCount:"Top needs a whole number from 1 to {max} - this filter is left out",filterValue:"the condition needs a comparison and a number - this filter is left out",filterValue2:"\u201C{value}\u201D needs a second number - this filter is left out",filterCompareValue:"the comparison needs an operator and a number or a date (2022-03-01) that fits the field - this filter is left out",filterRelativeDirection:"the direction \u201C{value}\u201D is unknown (last, next, this or before) - this filter is left out",filterRelativeUnit:"the unit \u201C{value}\u201D is unknown (hours, days, weeks, months, quarters or years) - this filter is left out",filterRelativeCount:"the range needs a whole number from 1 to {max} - this filter is left out",filterRelativeAnchor:"the range can count from \u201Ctoday\u201D, \u201Clatest\u201D (the latest record), \u201Cfirst\u201D (the first record) or a date, not from \u201C{value}\u201D - this filter is left out",sortNoItems:"the custom order lists no items - the usual order is used",sortedTwice:"the field is sorted twice - only its first sort is used",badTotals:"the totals cannot be read - the usual totals are shown",collapsedPath:"a collapsed group does not fit the fields - it is shown expanded",unknownSetting:"the {setting} \u201C{value}\u201D is unknown - the default is used",badTitle:"the title is empty or longer than {max} characters - the chart has no title",unknownLocale:"the language \u201C{value}\u201D is unknown - the report's language is used",unknownTimeZone:"the time zone \u201C{value}\u201D is unknown - the data's time zone is used",timeZoneMismatch:"the view was made for the time zone {value}, the data is in {zone} - times are read in {zone}",tooManyIssues:"{value} more problems are not listed - fix the ones above and load the view again to see them"},other:"this part could not be used - it is left out"},f=e=>e!==null&&typeof e=="object"&&!Array.isArray(e),s=(e,r)=>f(e)&&Object.hasOwn(e,r)?e[r]:void 0,p=e=>typeof e=="string"&&e.trim()!==""?e.trim():null,g=/^(rows|cols|values|filters|sort|derived)\[(\d+)\]/;function C(e,r){let i=p(s(e,"label"));if(i)return i;let n=s(e,"agg");if(typeof n!="string")return null;let o=s(e,"field");return r.value({field:typeof o=="string"?o:null,agg:n,label:null,showAs:null})}function D(e,r,i,n){if(e.code==="unknownKey")return n.fill(i.quote,{key:e.path.split(".").pop()??e.path});let o=g.exec(e.path);if(o){let u=s(r,o[1]),l=Array.isArray(u)?u[Number(o[2])]:void 0,h=o[1]==="values"?C(l,n):p(o[1]==="rows"||o[1]==="cols"?l:o[1]==="derived"?s(l,"name"):s(l,"field"));if(h)return o[1]==="values"||o[1]==="derived"?h:n.field(h)}let t=/^[a-z]*/i.exec(e.path)?.[0]??"";return s(n.labels.zones,t)??s(i.sections,t)??i.view}function m(e,r,i,n){let{labels:o,fill:t}=n,u=/^[a-z]*/i.exec(e.path)?.[0]??"",l=typeof e.code=="string"?e.code:"",h=l==="unknownField"&&/^(rows|cols|filters|sort)\[\d+\]$/.test(e.path)?"unknownFieldHere":l,c=l?s(i.codes,h)??i.other:"{message}",a=f(e.params)?e.params:{},w=o.core,v={dropped:s(i.dropped,u)??i.dropped.other,setting:s(i.settings,e.path.split(".").pop()??"")??i.settings.other,field:typeof a.field=="string"?n.field(a.field):"",value:a.value??"",agg:typeof a.agg=="string"?s(w.aggregators,a.agg)??a.agg:"",type:typeof a.type=="string"?s(o.types,a.type)??a.type:"",max:typeof a.max=="number"?a.max.toLocaleString(o.lang):"",zone:a.zone??"",suggestion:a.suggestion??"",message:e.message},[b,y=""]=i.item.split("{subject}"),d={text:t(c,v)};return{pre:t(b,d),subject:D(e,r,i,n),post:t(y,d)}}function N(e,r,i){let n=e.map(t=>({...m(t.issue,t.raw,r,i),at:g.exec(t.issue.path)})),o=new Map;for(let t of n){let u=o.get(t.subject)??new Set;u.add(t.at?t.at[0]:""),o.set(t.subject,u)}return n.map(({at:t,...u})=>{if(!t||o.get(u.subject).size<2)return u;let l=s(i.labels.zones,t[1])??s(r.sections,t[1])??t[1];return{...u,subject:i.fill(r.position,{subject:u.subject,n:Number(t[2])+1,part:l})}})}export{k as en,m as unusedItem,N as unusedItems};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import"./chunk-DCANE7XH.js";var e={item:"{subject}: {text}",quote:"\u201E{key}\u201C",position:"{subject} (Nr. {n}, {part})",view:"Die Ansicht",sections:{sort:"Sortierung",derived:"Gruppierungen",totals:"Summen",collapsed:"Zugeklappte Gruppen",display:"Tabelle oder Diagramm",chart:"Diagramm",formatting:"Formatierung"},settings:{display:"Darstellung",type:"Diagrammtyp",valueLabels:"Wertbeschriftung",legend:"Legendenposition",axisLabels:"Achsenbeschriftung",groupLabels:"Gruppenbeschriftung",labelPosition:"Beschriftungsposition",other:"Einstellung"},dropped:{rows:"es wird in Zeilen weggelassen",cols:"es wird in Spalten weggelassen",values:"dieser Wert wird weggelassen",filters:"dieser Filter wird weggelassen",sort:"die \xFCbliche Reihenfolge gilt",derived:"diese Gruppierung wird weggelassen",other:"es wird weggelassen"},codes:{notView:"das ist keine pivotkit-Ansicht - der Bericht beginnt leer",notJson:"das ist kein g\xFCltiges JSON - der Bericht beginnt leer",tooLarge:"die Ansicht ist zu gro\xDF - der Bericht beginnt leer",badVersion:"die Ansicht hat eine unbekannte Version - der Bericht beginnt leer",newerVersion:"die Ansicht stammt aus einem neueren pivotkit - der Bericht beginnt leer; aktualisieren Sie pivotkit, um sie zu \xF6ffnen",noMigration:"die Ansicht l\xE4sst sich nicht auf diese Version bringen - der Bericht beginnt leer",unknownKey:"diese Einstellung ist hier unbekannt - sie wird ignoriert",notList:"das ist keine Liste - nichts davon wird verwendet",tooMany:"mehr als {max} Eintr\xE4ge - nur die ersten {max} werden verwendet",tooManyItems:"mehr als {max} Eintr\xE4ge - nur die ersten {max} werden verwendet",itemType:"der Eintrag \u201E{value}\u201C passt nicht zu einem Feld vom Typ {type} - er wird weggelassen",itemTooLong:"ein Eintrag ist l\xE4nger als {max} Zeichen - er wird weggelassen",itemCase:"die Daten haben keinen Eintrag \u201E{value}\u201C, aber \u201E{suggestion}\u201C - der Filter beh\xE4lt den Eintrag, wie er geschrieben ist",unknownField:"die Daten haben kein Feld \u201E{field}\u201C - {dropped}",unknownFieldHere:"die Daten haben kein Feld mit diesem Namen - {dropped}",placedTwice:"das Feld steht zweimal in Zeilen oder Spalten - nur sein erster Platz gilt",groupingNoName:"die Gruppierung hat keinen Namen - sie wird weggelassen",groupingNameTaken:"die Daten haben schon ein Feld mit diesem Namen - die Gruppierung wird weggelassen",groupingNoSource:"die Daten haben kein Feld \u201E{field}\u201C zum Gruppieren - die Gruppierung wird weggelassen",groupingUnknown:"die Gruppierung \u201E{value}\u201C ist unbekannt - sie wird weggelassen",binsNeedNumber:"Bereiche brauchen ein Zahlenfeld, \u201E{field}\u201C ist keines - die Gruppierung wird weggelassen",groupingNeedsDate:"eine Datumsgruppierung braucht ein Datumsfeld, \u201E{field}\u201C ist keines - die Gruppierung wird weggelassen",binSize:"Bereiche brauchen eine Gr\xF6\xDFe \xFCber null - die Gruppierung wird weggelassen",notValueRef:"das ist kein Wert - {dropped}",unknownAggregator:"die Berechnung \u201E{value}\u201C ist unbekannt - {dropped}",aggregatorNeedsField:"{agg} braucht ein Feld - {dropped}",aggregatorType:"{agg} geht nicht mit \u201E{field}\u201C ({type}) - {dropped}",unknownFormat:"das Zahlenformat \u201E{value}\u201C ist unbekannt - das \xFCbliche Format gilt",badLabel:"der Name ist leer oder l\xE4nger als {max} Zeichen - der \xFCbliche Name gilt",unknownShowAs:"\u201EAnzeigen als\u201C \u201E{value}\u201C ist unbekannt - der Wert wird ohne Berechnung gezeigt",showAsNotAdditive:"dieses \u201EAnzeigen als\u201C braucht eine Summe oder Anzahl, nicht {agg} - der Wert wird ohne Berechnung gezeigt",showAsNotNumber:"{agg} ergibt keine Zahl f\xFCr einen Anteil - der Wert wird ohne Berechnung gezeigt",unknownConditional:"die Farbformatierung \u201E{value}\u201C ist unbekannt - der Wert wird ohne Farben gezeigt",conditionalNotNumber:"Farben brauchen einen Zahlenwert - der Wert wird ohne Farben gezeigt",colorScaleColors:"die Farbskala braucht zwei oder drei Farben - die Standardfarben werden verwendet",dataBarColor:"die Balkenfarbe ist keine Farbe - die Standardfarbe wird verwendet",unknownFilterType:"die Filterart \u201E{value}\u201C ist unbekannt - dieser Filter wird weggelassen",filterNoItems:"der Filter nennt keine Eintr\xE4ge - er wird weggelassen",filterFieldType:"ein Filter vom Typ \u201E{value}\u201C funktioniert nicht mit \u201E{field}\u201C ({type}) - dieser Filter wird weggelassen",filterTextOp:"die Textbedingung \u201E{value}\u201C ist unbekannt - dieser Filter wird weggelassen",filterMatch:"der Textvergleich ist unbekannt - Gro\xDF- und Kleinschreibung und Leerzeichen z\xE4hlen nicht",filterNot:"\u201Enot\u201C muss true oder false sein - der Filter wird nicht umgekehrt",filterBlanks:"was mit leeren Eintr\xE4gen geschieht, ist unbekannt (\u201E{value}\u201C) - leere Eintr\xE4ge werden weggelassen",blanksUnspecified:"der Filter sagt nicht, was mit leeren Eintr\xE4gen geschieht - sie werden weggelassen",filterEmpty:"der Filter nennt keine Eintr\xE4ge und beh\xE4lt keine leeren - er beh\xE4lt nichts",filterText:"die Textbedingung hat keinen Text oder mehr als {max} Zeichen - dieser Filter wird weggelassen",filterNotNumber:"{agg} ergibt keine Zahl zum Filtern - dieser Filter wird weggelassen",filterTies:"die Gleichst\xE4nde \u201E{value}\u201C sind unbekannt (first oder all) - die ersten in den Daten werden behalten",filterPrecision:"die Genauigkeit \u201E{value}\u201C ist unbekannt oder passt nicht zum Feld (Jahr, Quartal, Monat, Tag oder Stunde eines Datums) - Tage werden verglichen",filterCount:"\u201EOberste\u201C braucht eine ganze Zahl von 1 bis {max} - dieser Filter wird weggelassen",filterValue:"die Bedingung braucht einen Vergleich und eine Zahl - dieser Filter wird weggelassen",filterValue2:"\u201E{value}\u201C braucht eine zweite Zahl - dieser Filter wird weggelassen",filterCompareValue:"der Vergleich braucht einen Operator und eine Zahl oder ein Datum (2022-03-01), das zum Feld passt - dieser Filter wird weggelassen",filterRelativeDirection:"die Richtung \u201E{value}\u201C ist unbekannt (last, next, this oder before) - dieser Filter wird weggelassen",filterRelativeUnit:"die Einheit \u201E{value}\u201C ist unbekannt (Stunden, Tage, Wochen, Monate, Quartale oder Jahre) - dieser Filter wird weggelassen",filterRelativeCount:"der Zeitraum braucht eine ganze Zahl von 1 bis {max} - dieser Filter wird weggelassen",filterRelativeAnchor:"der Zeitraum kann ab \u201Etoday\u201C (heute), \u201Elatest\u201C (letzter Eintrag), \u201Efirst\u201C (erster Eintrag) oder einem Datum z\xE4hlen, nicht ab \u201E{value}\u201C - dieser Filter wird weggelassen",sortNoItems:"die eigene Reihenfolge nennt keine Eintr\xE4ge - die \xFCbliche Reihenfolge gilt",sortedTwice:"das Feld wird zweimal sortiert - nur seine erste Sortierung gilt",badTotals:"die Summen lassen sich nicht lesen - die \xFCblichen Summen werden gezeigt",collapsedPath:"eine zugeklappte Gruppe passt nicht zu den Feldern - sie wird aufgeklappt gezeigt",unknownSetting:"{setting} \u201E{value}\u201C ist unbekannt - die Voreinstellung gilt",badTitle:"der Titel ist leer oder l\xE4nger als {max} Zeichen - das Diagramm hat keinen Titel",unknownLocale:"die Sprache \u201E{value}\u201C ist unbekannt - die Sprache des Berichts gilt",unknownTimeZone:"die Zeitzone \u201E{value}\u201C ist unbekannt - die Zeitzone der Daten gilt",timeZoneMismatch:"die Ansicht wurde f\xFCr die Zeitzone {value} gemacht, die Daten sind in {zone} - Zeiten gelten in {zone}",tooManyIssues:"{value} weitere Probleme sind nicht aufgef\xFChrt - beheben Sie die obigen und laden Sie die Ansicht erneut, um sie zu sehen"},other:"dieser Teil konnte nicht verwendet werden - er wird weggelassen"};export{e as de};
|
package/dist/element.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a,b,c,d}from"./chunks/chunk-
|
|
1
|
+
import{a,b,c,d}from"./chunks/chunk-CCL5TDLA.js";import"./chunks/chunk-SB3L4HHW.js";import"./chunks/chunk-YUY4D5MF.js";import"./chunks/chunk-65O4Z5GI.js";import"./chunks/chunk-XETFD6GR.js";import"./chunks/chunk-PJA6QZ4Y.js";import"./chunks/chunk-4PHDW2LB.js";import"./chunks/chunk-XR4CMFGN.js";import"./chunks/chunk-5QXN3X2Q.js";import"./chunks/chunk-DCANE7XH.js";export{a as EVENTS,c as PivotReportElement,b as TAG,d as define};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var Ie=Object.defineProperty;var _=(e,t,n)=>()=>{if(n)throw n[0];try{return e&&(t=e(e=0)),t}catch(r){throw n=[r],r}};var ae=(e,t)=>{for(var n in t)Ie(e,n,{get:t[n],enumerable:!0})};var E,$=_(()=>{E=class extends Error{constructor(t,n,r={}){super(n),this.name="PivotkitError",this.code=t,this.details=r}}});function P(e){let t=e&&e.limits;if(t==null)return K;if(typeof t!="object"||Array.isArray(t))throw new E("INVALID_OPTION","options.limits must be an object");let n={...K};for(let r of Object.keys(t)){let o=t[r];if(!Object.hasOwn(K,r))throw new E("INVALID_OPTION",`unknown limit "${r}"`);if(!Number.isInteger(o)||o<1)throw new E("INVALID_OPTION",`limits.${r} must be a whole number of 1 or more`);if(Object.hasOwn(Q,r)&&o>Q[r])throw new E("INVALID_OPTION",`limits.${r} must be at most ${Q[r]}`);n[r]=o}return Object.freeze(n)}var K,Q,Ot,_t,q=_(()=>{$();K=Object.freeze({json:5e6,name:256,axisFields:8,values:16,filters:128,items:1e5,derived:64,sort:64,collapsed:1e4,topCount:1e6,textValue:1e3,srcParams:16,srcParamLength:256,rows:1e6,groups:5e5,pivotCells:2e6,work:1e8,cells:2e6,cacheEntries:16,fileBytes:104857600,columns:1e3,importCells:1e7,textLength:32767,archiveEntries:1e4,unpackedBytes:524288e3}),Q=Object.freeze({groups:2**27}),Ot=Object.freeze({filters:50,json:1e6}),_t=Object.freeze({perCode:100,total:1e3})});function Le(e,t,n,r=0,o=0,a=0,l=0){if(e>=100)return Date.UTC(e,t-1,n,r,o,a,l);let s=new Date(Date.UTC(2e3,t-1,n,r,o,a,l));return s.setUTCFullYear(e),s.getTime()}function R(e){let t=Ce.exec(e.trim());if(!t)return null;let n=t[8],r=+t[1],o=+t[2],a=+t[3],l=t[4]===void 0?0:+t[4],s=t[5]===void 0?0:+t[5],i=t[6]===void 0?0:+t[6],f=t[7];if(o<1||o>12||a<1||l>23||s>59||i>59)return null;let c=Le(r,o,a,l,s,i,f?Math.round(+`0.${f}`*1e3):0);if(new Date(c).getUTCDate()!==a)return null;let m=null;if(n)if(n==="Z")m=0;else{let w=n.slice(1).replace(":",""),g=Number(w.slice(0,2)),d=Number(w.slice(2)||0);if(g>23||d>59)return null;m=(n[0]==="-"?-1:1)*(g*60+d)}return{ms:c,offsetMinutes:m}}var Ce,le=_(()=>{Ce=/^(\d{4})-(\d{2})-(\d{2})(?:[T ](\d{2}):(\d{2})(?::(\d{2})(?:\.(\d{1,9}))?)?(Z|[+-]\d{2}(?::?\d{2})?)?)?$/});function T(e,t,n,r={}){return new E("INVALID_FILE",`"${t}": ${n}`,{reason:e,file:t,...r})}function C(e,t,n,r,o){let a=l=>l.toLocaleString("en-US");return new E("LIMIT_EXCEEDED",`"${r}" has more than ${a(n)} ${o} (limits.${e}): load a smaller extract of it, or a host can raise this limit`,{limit:e,value:t,max:n,file:r})}function A(e,t,n,r,o){if(t>n)throw C(e,t,n,r,o)}function x(e,t){let n=e&&typeof e=="object"&&typeof e.name=="string"?e.name:"",r=ke(String(t?.name??n??"")).slice(0,256);return(new RegExp("\\p{Surrogate}$","u").test(r)?r.slice(0,-1):r)||"file"}async function F(e,t,n){if(e instanceof Uint8Array)return A("fileBytes",e.byteLength,t.fileBytes,n,"bytes"),e;if(e instanceof ArrayBuffer)return A("fileBytes",e.byteLength,t.fileBytes,n,"bytes"),new Uint8Array(e);if(typeof Blob<"u"&&e instanceof Blob)return A("fileBytes",e.size,t.fileBytes,n,"bytes"),new Uint8Array(await e.arrayBuffer());throw new E("INVALID_ARGUMENT","read(file): file must be a File, a Blob, an ArrayBuffer or a Uint8Array")}function z(e){let t=e??{};if(typeof t!="object")throw new E("INVALID_OPTION","read(file, options): options must be an object");return{...t,limits:P(t)}}function Pe(e,t){let n=r=>typeof r=="number"?r.toLocaleString("en-US"):r;switch(e){case"ENCODING":return`Read as ${t.encoding}.`;case"SEPARATOR":return`Values separated by ${t.name}.`;case"LINES_SKIPPED":return`${n(t.count)} line(s) above the column names were skipped (a title block).`;case"COLUMN_RENAMED":return t.from===""?`Column ${n(t.position)} has no name; it is named "${t.to}".`:`Column "${t.from}" is named "${t.to}".`;case"COLUMNS_RENAMED_MORE":return`${n(t.count)} more columns were renamed.`;case"COLUMN_DROPPED":return`Column ${n(t.position)} has no name and no values and was left out.`;case"COLUMNS_ADDED":return`${n(t.rows)} row(s) have more values than there are column names; the extra values are in ${n(t.count)} column(s) named "Column \u2026".`;case"ROWS_EMPTY":return`${n(t.count)} empty row(s) were left out.`;case"TEXT_CUT":return`${n(t.count)} value(s) longer than ${n(t.max)} characters were cut.`;case"CHARACTERS_REMOVED":return`Control or text direction characters were removed from ${n(t.count)} value(s).`;case"DATE_ORDER":return`Dates in "${t.column}" were read as ${t.order==="mdy"?"month/day/year":"day/month/year"}; the values fit both.`;case"VALUES_NOT_CONVERTED":return`${n(t.count)} value(s) in "${t.column}" are no ${t.type} and are empty.`;case"JSON_PROPERTY":return`The rows were read from "${t.property}".`;case"JSON_FLATTENED":return`Nested values became columns named with a dot ("${t.example}").`;case"SHEET":return Number(t.count)>1?`Read sheet "${t.sheet}" of ${n(t.count)} sheets.`:`Read sheet "${t.sheet}".`;case"USED_RANGE":return`The sheet's used range reaches row ${n(t.usedRow)}; values end at row ${n(t.lastRow)}, the empty rows below were skipped.`;case"ERROR_CELLS":return`${n(t.count)} cell(s) hold an Excel error (such as #N/A) and are empty.`;default:return e}}function N(e,t={}){let n={};for(let[r,o]of Object.entries(t))n[r]=typeof o=="string"?o.replace(v,"").slice(0,256):o;return{code:e,params:n,message:Pe(e,n)}}function ke(e){return e.replace(v,"").replace(fe," ").trim()}function ee(e,t,n,r,o,a){if(t<1||t>12||n<1||r>23||o>59||a>59)return null;let l=new Date(Date.UTC(2e3,t-1,n));if(l.setUTCFullYear(e),l.getUTCDate()!==n)return null;let s=`${String(e).padStart(4,"0")}-${I(t)}-${I(n)}`;return r===0&&o===0&&a===0?s:`${s}T${I(r)}:${I(o)}:${I(a)}`}function ce(e){return[+e[1],+e[2],+e[3],e[4]===void 0?0:+e[4],e[5]===void 0?0:+e[5],e[6]===void 0?0:+e[6]]}function ne(e,t){if(e.length>40)return null;if(R(e)!==null)return e;let n=de.exec(e);if(n){let[r,o,a,l,s,i]=ce(n);return ee(a,o,r,l,s,i)}if(n=me.exec(e),n){let[r,o,a,l,s,i]=ce(n);return t==="mdy"?ee(a,r,o,l,s,i):ee(a,o,r,l,s,i)}return null}function Be(e){let t=0;for(let n=0;n<e.length;n++){let r=e.charCodeAt(n);r>=48&&r<=57&&t++}return t}function j(e,t){if(e.length>40||!(t===","?je:Ue).test(e))return null;let n=Number(t===","?e.replaceAll(".","").replace(",","."):e);return Number.isFinite(n)?n:null}function Ge(e){return Ve.test(e)?!0:/^[+-]?\d+$/.test(e)&&Be(e)>ve}function pe(e){let t=e.toLowerCase();return Fe.has(t)?!0:ze.has(t)?!1:null}function k(e){let t=e.getTime();if(!Number.isFinite(t)||Math.abs(t)>864e13)return null;let n=Math.round(t/1e3)*1e3;Math.abs(t-n)<=2&&(t=n);let r=new Date(t).toISOString();return t%he===0?r.slice(0,10):t%1e3===0?r.slice(0,19):r.slice(0,23)}function He(e,t,n){if(t==="string"&&e.every(l=>l===null||typeof l=="string"))return{values:e,failed:0};let r=Je[t],o=new Array(e.length),a=0;for(let l=0;l<e.length;l++){let s=e[l];if(s===null){o[l]=null;continue}let i=r(s,n);i===void 0?(o[l]=null,a++):o[l]=i}return{values:o,failed:a}}function We(e,t){let n=0,r=0,o=0,a=0;for(let s of e)s!==null&&(typeof s=="number"?n++:typeof s=="boolean"?r++:s instanceof Date?o++:a++);let l=n+r+o+a;return l===0?{type:"string"}:a===0?n===l?{type:"number"}:r===l?{type:"boolean"}:o===l?{type:"date"}:{type:"string"}:a!==l?n===0&&r===0&&e.every(s=>s===null||s instanceof Date||typeof s=="string"&&R(s)!==null)?{type:"date"}:{type:"string"}:t.textNumbers===!1?{type:e.every(s=>s===null||R(s)!==null)?"date":"string"}:Xe(e,t)}function Xe(e,t){let n=!0,r=!0,o=!0,a=!0,l=!1,s=!1,i=!0,f=!0;for(let c of e)if(c!==null){if(n&&pe(c)===null&&(n=!1),r&&R(c)===null&&(r=!1),o&&(!de.test(c)||ne(c,"dmy")===null)&&(o=!1),a){let m=c.length<=40?me.exec(c):null;m?(+m[1]>12&&(l=!0),+m[2]>12&&(s=!0)):a=!1}if((i||f)&&(Ge(c)?(i=!1,f=!1):(i&&j(c,".")===null&&(i=!1),f&&j(c,",")===null&&(f=!1))),!n&&!r&&!o&&!a&&!i&&!f)return{type:"string"}}if(n)return{type:"boolean"};if(r||o)return{type:"date"};if(a&&!(l&&s)){let c=l?"dmy":s?"mdy":t.dateOrder;if(e.every(w=>w===null||ne(w,c)!==null))return{type:"date",dateOrder:c,ambiguousOrder:!l&&!s}}return i&&f?{type:"number",decimal:t.decimal}:i?{type:"number",decimal:"."}:f?{type:"number",decimal:","}:{type:"string"}}function te(e,t,n){if(e==null)return null;switch(typeof e){case"string":return ue(e,t,n);case"number":return Number.isFinite(e)?e:null;case"boolean":return e;case"bigint":return Number.isSafeInteger(Number(e))?Number(e):String(e);case"object":if(e instanceof Date)return Number.isNaN(e.getTime())?null:e;try{return ue(JSON.stringify(e)??"",t,n)}catch{return null}default:return null}}function ue(e,t,n){let r=e;return $e.test(r)&&(r=r.replace(v,""),n.removed++),r=r.replace(fe," ").trim(),r.length>t&&(r=r.slice(0,t),n.cut++),r===""?null:r}function G(e){let{file:t,limits:n}=e,r={decimal:e.hints?.decimal??".",dateOrder:e.hints?.dateOrder??(!e.locale||/^en-US$/i.test(e.locale)?"mdy":"dmy"),...e.hints?.serialDates?{serialDates:!0}:{},...e.hints?.textNumbers===!1?{textNumbers:!1}:{}},o=[],a={removed:0,cut:0,empty:0,extraRows:0},l=[],s=null,i=0,f=0,c=[],m=()=>{A("columns",l.length+1,n.columns,t,"columns"),l.push(new Array(f).fill(null))},w=u=>{let p=0,y=new Array(u.length);for(let h=0;h<u.length;h++){let b=te(u[h],n.textLength,a);y[h]=b,b!==null&&(p=h+1)}if(p===0){a.empty++;return}for(p>i&&a.extraRows++,p>l.length&&(A("columns",p,n.columns,t,"columns"),A("importCells",(f+1)*p,n.importCells,t,"values (rows x columns)"));l.length<p;)m();f++,A("rows",f,n.rows,t,"rows"),A("importCells",f*l.length,n.importCells,t,"values (rows x columns)");for(let h=0;h<l.length;h++)l[h].push(h<p?y[h]:null)},g=u=>{s=u.map(p=>{let y=te(p,n.name,{removed:0,cut:0});return y===null?null:y instanceof Date?k(y):String(y)}),i=s.length,A("columns",i,n.columns,t,"columns");for(let p=0;p<i;p++)l.push([])},d=()=>{let u=c??[];if(c=null,s===null){let p=0,y=u.map(O=>{let ie=0;for(let Re of O)te(Re,n.textLength,{removed:0,cut:0})!==null&&ie++;return ie});for(let O of y)p=Math.max(p,O);let h=y.findIndex(O=>O>0&&O*2>=p);h<0&&(h=u.length),y.slice(0,h).filter(O=>O>0).length>0&&o.push(N("LINES_SKIPPED",{count:h})),g(h<u.length?u[h]:[]),u.splice(0,h+1)}for(let p of u)w(p)};return{header(u){g(u)},row(u){if(c!==null&&s===null){c.push(u),c.length>=Me&&d();return}c!==null&&d(),w(u)},get rowCount(){return f+(c?.length??0)},note(u,p){o.push(N(u,p))},finish(u){return c!==null&&d(),Qe({header:s??[],columns:l,rowCount:f,notes:o,counts:a,hints:r,limits:n,types:u})}}}function Ke(e,t,n){let r=[],o=new Set,a=0,l=(i,f,c)=>{a++,a<=Z&&n.push(N("COLUMN_RENAMED",{position:i,from:f,to:c}))},s=i=>{let f=i;for(let c=2;o.has(f.toLowerCase());c++)f=`${i} (${c})`;return f};for(let i=0;i<t;i++){let f=i<e.length?e[i]:null,c;f===null||f===""?(c=s(`Column ${i+1}`),i<e.length&&l(i+1,"",c)):(c=s(f),c!==f&&l(i+1,f,c)),o.add(c.toLowerCase()),r.push(c)}return a>Z&&n.push(N("COLUMNS_RENAMED_MORE",{count:a-Z})),r}function Qe({header:e,columns:t,rowCount:n,notes:r,counts:o,hints:a,limits:l,types:s}){let i=[];for(let u=0;u<t.length;u++){if(!(u<e.length&&e[u]!==null&&e[u]!=="")&&t[u].every(y=>y===null)){u<e.length&&r.push(N("COLUMN_DROPPED",{position:u+1}));continue}i.push(u)}let f=i.map(u=>u<e.length?e[u]:null),c=Ke(f,i.length,r),m=i.map(u=>t[u]),w=i.filter(u=>u>=e.length).length;o.extraRows>0&&w>0&&r.push(N("COLUMNS_ADDED",{rows:o.extraRows,count:w})),o.empty>0&&r.push(N("ROWS_EMPTY",{count:o.empty})),o.cut>0&&r.push(N("TEXT_CUT",{count:o.cut,max:l.textLength})),o.removed>0&&r.push(N("CHARACTERS_REMOVED",{count:o.removed}));let g={columns:c,types:[],data:[],raw:m,detected:[],rowCount:n,notes:r,hints:a},d=m.map(u=>We(u,a));return g.detected=d.map(u=>u.type),d.forEach((u,p)=>{u.ambiguousOrder&&r.push(N("DATE_ORDER",{column:c[p],order:u.dateOrder}))}),qe(g,s,d)}function qe(e,t,n){let r=Ze(e.columns,t),o=e.notes.filter(s=>s.code!=="VALUES_NOT_CONVERTED"),a=[],l=[];for(let s=0;s<e.columns.length;s++){let i=n?.[s],f=r[s]??e.detected[s],c=i&&i.type===f?{...e.hints,...i.decimal?{decimal:i.decimal}:{},...i.dateOrder?{dateOrder:i.dateOrder}:{}}:e.hints;if(e.types[s]===f&&e.data[s]!==void 0){a.push(f),l.push(e.data[s]);let g=e.notes.find(d=>d.code==="VALUES_NOT_CONVERTED"&&d.params.column===e.columns[s]);g&&o.push(g);continue}let{values:m,failed:w}=He(e.raw[s],f,c);w>0&&o.push(N("VALUES_NOT_CONVERTED",{column:e.columns[s],type:f,count:w})),a.push(f),l.push(m)}return{...e,types:a,data:l,notes:o}}function Ze(e,t){let n=new Array(e.length).fill(void 0);if(Array.isArray(t))for(let r=0;r<e.length;r++)U.includes(t[r])&&(n[r]=t[r]);else if(t&&typeof t=="object"){let r=new Map;for(let o of Object.keys(t))U.includes(t[o])&&r.set(o.toLowerCase(),t[o]);e.forEach((o,a)=>{n[a]=r.get(o.toLowerCase())})}return n}var U,It,Z,Me,V,v,$e,fe,B,Ue,je,Ve,ve,de,me,Fe,ze,I,he,Ye,Je,L=_(()=>{$();q();le();U=Object.freeze(["string","number","date","boolean"]),It=Object.freeze(["ENCODING","SEPARATOR","LINES_SKIPPED","COLUMN_RENAMED","COLUMNS_RENAMED_MORE","COLUMN_DROPPED","COLUMNS_ADDED","ROWS_EMPTY","TEXT_CUT","CHARACTERS_REMOVED","DATE_ORDER","VALUES_NOT_CONVERTED","JSON_PROPERTY","JSON_FLATTENED","SHEET","USED_RANGE","ERROR_CELLS"]),Z=20,Me=50,V=16384,v=/[\u0000-\u0008\u000b\u000c\u000e-\u001f\u007f-\u009f\u00ad\u061c\u180e\u200b\u200e-\u200f\u202a-\u202e\u2060-\u2064\u2066-\u206f\ufeff\u{E0000}-\u{E007F}]|[\ud800-\udbff](?![\udc00-\udfff])|(?<![\ud800-\udbff])[\udc00-\udfff]/gu,$e=new RegExp(v.source,"u"),fe=/[\t\r\n\u2028\u2029]+/g;B=()=>new Promise(e=>setTimeout(e,0));Ue=/^[+-]?(?:\d+(?:\.\d+)?|\.\d+)(?:[eE][+-]?\d+)?$/,je=/^[+-]?(?:\d{1,3}(?:\.\d{3})+|\d+)(?:,\d+)?$/,Ve=/^[+-]?0\d/,ve=15,de=/^(\d{1,2})\.(\d{1,2})\.(\d{4})(?:[ T,]+(\d{1,2}):(\d{2})(?::(\d{2}))?)?$/,me=/^(\d{1,2})\/(\d{1,2})\/(\d{4})(?:[ T,]+(\d{1,2}):(\d{2})(?::(\d{2}))?)?$/,Fe=new Set(["true","wahr"]),ze=new Set(["false","falsch"]),I=e=>String(e).padStart(2,"0");he=864e5,Ye=Date.UTC(1899,11,30);Je={string(e){return typeof e=="string"?e:e instanceof Date?k(e)??void 0:String(e)},number(e,t){if(typeof e=="number")return e;if(typeof e=="boolean")return e?1:0;if(typeof e=="string")return j(e,t.decimal)??j(e,t.decimal===","?".":",")??void 0},date(e,t){if(e instanceof Date)return k(e)??void 0;if(typeof e=="string")return ne(e,t.dateOrder)??void 0;if(typeof e=="number"&&t.serialDates&&e>0&&e<2958466)return k(new Date(Math.round((Ye+e*he)/1e3)*1e3))??void 0},boolean(e){if(typeof e=="boolean")return e;if(typeof e=="number")return e===1?!0:e===0?!1:void 0;if(typeof e=="string"){let t=pe(e);if(t!==null)return t;let n=e.toLowerCase();if(n==="yes"||n==="1")return!0;if(n==="no"||n==="0")return!1}}}});function tt(e){let t=Math.min(e.length,4096)&-2;if(t<8)return!1;let n=0;for(let r=1;r<t;r+=2)e[r]===0&&e[r-1]!==0&&n++;return n>t/2*.9}function J(e,t){for(let s of et)if(Y(e,s.bytes))throw T("WRONG_TYPE",t,`this is ${s.what}, not text.`);let n,r=0;Y(e,[239,187,191])?(n="utf-8",r=3):Y(e,[255,254])?(n="utf-16le",r=2):Y(e,[254,255])?(n="utf-16be",r=2):tt(e)&&(n="utf-16le");let o=e.subarray(r),a;if(n)a=new TextDecoder(n,{fatal:!1,ignoreBOM:!0}).decode(o);else try{a=new TextDecoder("utf-8",{fatal:!0,ignoreBOM:!0}).decode(o),n="utf-8"}catch{a=new TextDecoder("windows-1252",{ignoreBOM:!0}).decode(o),n="windows-1252"}let l=a.indexOf("\0");if(l!==-1&&l<a.length-1)throw T("BINARY",t,"this file holds binary data, not text.");return{text:l===-1?a:a.slice(0,l),encoding:nt[n]}}var et,Y,nt,re=_(()=>{L();et=[{bytes:[80,75,3,4],what:"a ZIP archive (an Excel workbook .xlsx is one); load it with a spreadsheet reader, or save it as CSV"},{bytes:[208,207,17,224,161,177,26,225],what:"an old Excel workbook (.xls) or a password-protected file; save it as .xlsx or CSV"},{bytes:[37,80,68,70],what:"a PDF document"},{bytes:[31,139],what:"a gzip archive; unpack it first"}],Y=(e,t)=>t.every((n,r)=>e[r]===n);nt={"utf-8":"UTF-8","utf-16le":"UTF-16 (little endian)","utf-16be":"UTF-16 (big endian)","windows-1252":"Windows-1252"}});var Ee={};ae(Ee,{detectSeparator:()=>ge,read:()=>lt,splitRows:()=>oe});function oe(e,t,n,r,o={}){let a=t.charCodeAt(0),l=e.length,s=n,i=o.line??1;for(;s<l;){let f=i,c=[];for(;;){let m;if(e.charCodeAt(s)===we){let g=i,d=s+1,u="";for(;;){let y=e.indexOf('"',d);if(y===-1){if(o.sample)return l;throw T("UNCLOSED_QUOTE",o.file??"file",`the quote that opens a value in line ${g} is never closed.`,{line:g})}if(i+=it(e,d,y),u+=e.slice(d,y),e.charCodeAt(y+1)===we){u+='"',d=y+2;continue}s=y+1;break}let p=s;for(;p<l;){let y=e.charCodeAt(p);if(y===a||y===D||y===H)break;p++}m=p>s?u+e.slice(s,p):u,s=p}else{let g=s;for(;g<l;){let d=e.charCodeAt(g);if(d===a||d===D||d===H)break;g++}m=e.slice(s,g),s=g}if(c.push(m),o.maxFields!==void 0&&c.length>o.maxFields)throw C("columns",c.length,o.maxFields,o.file??"file","columns");let w=s<l?e.charCodeAt(s):-1;if(w===a){s++;continue}w===H?(s+=e.charCodeAt(s+1)===D?2:1,i++):w===D&&(s++,i++);break}if(r(c,f))break}return o.line=i,s}function it(e,t,n){let r=0;for(let o=t;o<n;o++){let a=e.charCodeAt(o);(a===D||a===H&&e.charCodeAt(o+1)!==D)&&r++}return r}function ge(e,t,n){let r=e.slice(t,t+ot),o={sep:n??",",score:-1,width:1},a=n?[n,...ye.filter(l=>l!==n)]:ye;for(let l of a){let s=new Map,i=0;oe(r,l,0,m=>(m.length===1&&m[0]===""||(s.set(m.length,(s.get(m.length)??0)+1),i++),i>=st),{sample:!0});let f=1,c=0;for(let[m,w]of s)m>1&&(w>c||w===c&&m>f)&&(f=m,c=w);f>1&&(c>o.score||c===o.score&&f>o.width)&&(o={sep:l,score:c,width:f})}return o.sep}function at(e){if(!e)return".";try{return new Intl.NumberFormat(e).formatToParts(1.5).find(n=>n.type==="decimal")?.value===","?",":"."}catch{return"."}}async function lt(e,t){let n=z(t),r=x(e,n);n.signal?.throwIfAborted();let o=await F(e,n.limits,r);n.onProgress?.({phase:"read",done:o.length,total:o.length});let{text:a,encoding:l}=J(o,r);n.signal?.throwIfAborted();let s=0,i=typeof n.separator=="string"&&n.separator.length===1?n.separator:null,f=/^sep=(.)\r?\n/i.exec(a.slice(0,8));f&&(s=f[0].length,i??=f[1]),i??=ge(a,s,/\.tsv$/i.test(r)?" ":void 0);let c=G({file:r,limits:n.limits,locale:n.locale,hints:{decimal:i===";"?",":at(n.locale)}});c.note("ENCODING",{encoding:l}),c.note("SEPARATOR",{separator:i,name:rt[i]??`"${i}"`});let m=s,w={file:r,line:s>0?2:1,maxFields:n.limits.columns};for(;m<a.length;){let g=0;m=oe(a,i,m,d=>(c.row(d),++g>=V),w),n.onProgress?.({phase:"parse",done:m,total:a.length}),m<a.length&&(await B(),n.signal?.throwIfAborted())}return n.signal?.throwIfAborted(),c.finish(n.types)}var ye,rt,ot,st,we,D,H,Ae=_(()=>{L();re();ye=[",",";"," ","|"],rt={",":"commas",";":"semicolons"," ":"tabs","|":"vertical bars"},ot=65536,st=100,we=34,D=10,H=13});var be={};ae(be,{read:()=>ut});function Te(e){if(Array.isArray(e)){let t=e.find(n=>n!=null);return t===void 0?{kind:"objects",rows:[]}:Array.isArray(t)&&e.every(n=>n===null||Array.isArray(n))?{kind:"arrays",rows:e}:S(t)&&e.every(n=>n===null||S(n))?{kind:"objects",rows:e}:null}return S(e)?Array.isArray(e.columns)&&Array.isArray(e.data)&&e.data.every(t=>Array.isArray(t))?{kind:"columnar",columns:e.columns,data:e.data}:Array.isArray(e.columns)&&Array.isArray(e.rows)?{kind:e.rows.every(t=>t===null||Array.isArray(t))?"header":"objects",columns:e.columns,rows:e.rows}:null:null}function ct(e){let t=Te(e);if(t)return{shape:t,property:null};if(!S(e))return null;let n=null;for(let r of Object.keys(e)){let o=Te(e[r]);if(o&&(o.kind!=="objects"||o.rows.length>0)){let a=o.rows?.length??o.data?.[0]?.length??0;(!n||a>n.size)&&(n={shape:o,property:r,size:a})}}return n}function Oe(e,t,n,r,o,a){for(let l of Object.keys(e)){let s=t+l,i=e[l];S(i)&&n<Ne&&Object.keys(i).length>0?Oe(i,`${s}.`,n+1,r,o,a):r.has(s)||(n>0&&(a.nested??=s),o(),r.set(s,r.size))}}function _e(e,t,n,r,o){for(let a of Object.keys(e)){let l=t+a,s=e[a];if(S(s)&&n<Ne&&Object.keys(s).length>0)_e(s,`${l}.`,n+1,r,o);else{let i=r.get(l);i!==void 0&&(o[i]=s)}}}async function ut(e,t){let n=z(t),r=x(e,n);n.signal?.throwIfAborted();let o=await F(e,n.limits,r);n.onProgress?.({phase:"read",done:o.length,total:o.length});let{text:a}=J(o,r),l;try{l=JSON.parse(a)}catch(d){throw T("INVALID_JSON",r,`this is no valid JSON (${String(d.message).slice(0,200)}).`)}n.signal?.throwIfAborted();let s=ct(l);if(!s)throw T("NO_TABLE",r,"no table found: the JSON must be an array of objects, an array of arrays, { columns, rows } or { columns, data }, or an object with one of these under a property.");let{shape:i,property:f}=s,c=G({file:r,limits:n.limits,locale:n.locale,hints:{textNumbers:!1}});f!==null&&c.note("JSON_PROPERTY",{property:f});let m=n.limits,w=0,g=async d=>{++w%V===0&&(n.onProgress?.({phase:"parse",done:w,total:d}),await B(),n.signal?.throwIfAborted())};if(i.kind==="columnar"){let d=i.data[0]?.length??0;if(i.columns.length!==i.data.length)throw T("NO_TABLE",r,`"columns" names ${i.columns.length} columns, but "data" holds ${i.data.length} arrays.`);if(!i.data.every(u=>u.length===d))throw T("NO_TABLE",r,'the arrays in "data" have different lengths.');A("columns",i.columns.length,m.columns,r,"columns"),A("rows",d,m.rows,r,"rows"),c.header(i.columns);for(let u=0;u<d;u++)c.row(i.data.map(p=>p[u])),await g(d)}else if(i.kind==="arrays"||i.kind==="header"){let d=i.rows;A("rows",d.length,m.rows+1,r,"rows");let u=0;for(i.kind==="header"?c.header(i.columns):(c.header(d[0]??[]),u=1);u<d.length;u++)c.row(d[u]??[]),await g(d.length)}else{let d=i.rows;A("rows",d.length,m.rows,r,"rows");let u=new Map;if(Array.isArray(i.columns))for(let h of i.columns)typeof h=="string"&&!u.has(h)&&u.set(h,u.size);let p=()=>A("columns",u.size+1,m.columns,r,"columns"),y={nested:null};for(let h of d)h&&Oe(h,"",0,u,p,y);y.nested&&c.note("JSON_FLATTENED",{example:y.nested}),c.header([...u.keys()]);for(let h of d){let b=new Array(u.size).fill(null);h&&_e(h,"",0,u,b),c.row(b),await g(d.length)}}return n.signal?.throwIfAborted(),c.finish(n.types)}var Ne,S,xe=_(()=>{L();re();Ne=4,S=e=>e!==null&&typeof e=="object"&&!Array.isArray(e)});$();q();L();var W=1,ft=/^[a-z0-9][a-z0-9-]{0,63}$/,dt=/^\.[a-z0-9]{1,16}$/,mt=/^[a-z0-9][a-z0-9!#$&^_.+-]*\/[a-z0-9][a-z0-9!#$&^_.+-]*$/,De=["reader"];function X(e){let t=e,n=r=>{throw new E("INVALID_ARGUMENT",`plugin ${typeof t?.name=="string"?`"${t.name.slice(0,64)}" `:""}${r}`)};return(t===null||typeof t!="object"||Array.isArray(t))&&n("must be an object"),t.apiVersion!==W&&n(`uses plugin API version ${JSON.stringify(t.apiVersion)}; this pivotkit-core supports version ${W}. Use a version of the plugin made for API ${W}, or update pivotkit.`),De.includes(t.kind)||n(`has kind ${JSON.stringify(t.kind)}; API ${W} knows ${De.map(r=>`"${r}"`).join(", ")}`),(typeof t.name!="string"||!ft.test(t.name))&&n('needs a name of lower-case letters, digits and "-"'),(typeof t.label!="string"||t.label.trim()===""||t.label.length>100)&&n("needs a label of 1 to 100 characters"),(!Array.isArray(t.accept)||t.accept.length===0||!t.accept.every(r=>typeof r=="string"&&(dt.test(r)||mt.test(r))))&&n('needs accept: file name extensions (".xlsx") and media types ("text/csv"), in lower case'),typeof t.load!="function"&&n("needs load(): a function that imports the reader"),Object.freeze({apiVersion:t.apiVersion,kind:t.kind,name:t.name,label:t.label,accept:[...t.accept],load:t.load})}var pt=X({apiVersion:1,kind:"reader",name:"csv",label:"CSV or text",accept:[".csv",".tsv",".txt",".tab","text/csv","text/tab-separated-values","text/plain"],load:()=>Promise.resolve().then(()=>(Ae(),Ee))}),ht=X({apiVersion:1,kind:"reader",name:"json",label:"JSON",accept:[".json","application/json"],load:()=>Promise.resolve().then(()=>(xe(),be))}),yt=Object.freeze([pt,ht]);function wt(e,t=[]){for(let s of t)X(s);let n=[...t,...yt],r=typeof e?.name=="string"?e.name.toLowerCase():"",o=r.lastIndexOf("."),a=o===-1?"":r.slice(o);if(a){let s=n.find(i=>i.accept.includes(a));if(s)return s}let l=typeof e?.type=="string"?e.type.toLowerCase().split(";")[0].trim():"";return l?n.find(s=>s.accept.includes(l)):void 0}var se=new WeakMap;async function gt(e){let t=X(e),n=se.get(e);return n||(n=Promise.resolve(t.load()).then(r=>{let o=r,a=o?.default&&typeof o.read!="function"?o.default:o;if(!a||typeof a.read!="function")throw new E("INVALID_ARGUMENT",`plugin "${t.name}": its load() must give a module with read(file, options)`);if(a.sheets!==void 0&&typeof a.sheets!="function")throw new E("INVALID_ARGUMENT",`plugin "${t.name}": sheets must be a function when given`);return a}),n.catch(()=>se.delete(e)),se.set(e,n)),n}async function Se(e,t={}){let n=x(e,t),r=P(t);if(e&&typeof e=="object"&&typeof e.size=="number"&&e.size>r.fileBytes)throw C("fileBytes",e.size,r.fileBytes,n,"bytes");let o=t.reader??wt(e,t.plugins);if(!o)throw T("NO_READER",n,"no reader for this kind of file.");let a=await gt(o),l={...t};return delete l.plugins,delete l.reader,Et(await a.read(e,l),o.name)}function Et(e,t){let n=o=>{throw new E("INVALID_ARGUMENT",`plugin "${t}": read() must return a table of pivotkit-core/import (createTable().finish()); ${o}`)};(!e||typeof e!="object"||!Array.isArray(e.columns)||!Array.isArray(e.types)||!Array.isArray(e.data)||!Array.isArray(e.notes))&&n("it needs columns, types, data and notes");let r=e.data[0]?.length??0;return(e.types.length!==e.columns.length||e.data.length!==e.columns.length)&&n("columns, types and data differ in length"),e.columns.every(o=>typeof o=="string")||n("a column name is no string"),e.types.every(o=>U.includes(o))||n("a type is none of string, number, date, boolean"),e.data.every(o=>Array.isArray(o)&&o.length===r)||n("the columns differ in length"),e}var M=globalThis;M.onmessage=async e=>{let{file:t,options:n}=e.data??{};try{let r=await Se(t,{...n,plugins:[],onProgress:o=>M.postMessage({type:"progress",progress:o})});M.postMessage({type:"done",table:r})}catch(r){let o=r;M.postMessage({type:"error",error:{code:typeof o?.code=="string"?o.code:void 0,message:String(o?.message??o),details:o?.details&&typeof o.details=="object"?{...o.details}:{}}})}};M.postMessage({type:"ready"});
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as o,b as r,c as t,d as e}from"./chunks/chunk-
|
|
1
|
+
import{a as o,b as r,c as t,d as e}from"./chunks/chunk-CCL5TDLA.js";import"./chunks/chunk-SB3L4HHW.js";import"./chunks/chunk-YUY4D5MF.js";import"./chunks/chunk-65O4Z5GI.js";import"./chunks/chunk-XETFD6GR.js";import"./chunks/chunk-PJA6QZ4Y.js";import"./chunks/chunk-4PHDW2LB.js";import"./chunks/chunk-XR4CMFGN.js";import"./chunks/chunk-5QXN3X2Q.js";import"./chunks/chunk-DCANE7XH.js";e();export{o as EVENTS,t as PivotReportElement,r as TAG,e as define};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pivotkit-element",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.0",
|
|
4
4
|
"description": "The pivot report builder of pivotkit as the web component <pivot-report>, with its own React: for Angular, PHP and plain HTML pages without React.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "eizedev <oss@eize.dev>",
|
|
@@ -18,11 +18,16 @@
|
|
|
18
18
|
"custom-element",
|
|
19
19
|
"reporting",
|
|
20
20
|
"echarts",
|
|
21
|
-
"self-service-bi"
|
|
21
|
+
"self-service-bi",
|
|
22
|
+
"pivot-grid",
|
|
23
|
+
"pivottable",
|
|
24
|
+
"angular",
|
|
25
|
+
"excel-export"
|
|
22
26
|
],
|
|
23
27
|
"type": "module",
|
|
24
28
|
"sideEffects": [
|
|
25
|
-
"./dist/index.js"
|
|
29
|
+
"./dist/index.js",
|
|
30
|
+
"./dist/chunks/*.js"
|
|
26
31
|
],
|
|
27
32
|
"exports": {
|
|
28
33
|
".": {
|
|
@@ -62,8 +67,9 @@
|
|
|
62
67
|
"@dnd-kit/core": "6.3.1",
|
|
63
68
|
"@dnd-kit/sortable": "10.0.0",
|
|
64
69
|
"echarts": "6.1.0",
|
|
65
|
-
"pivotkit-core": "0.
|
|
66
|
-
"pivotkit-react": "0.
|
|
70
|
+
"pivotkit-core": "0.5.0",
|
|
71
|
+
"pivotkit-react": "0.5.0",
|
|
72
|
+
"pivotkit-report": "0.1.0",
|
|
67
73
|
"react": "18.3.1",
|
|
68
74
|
"react-dom": "18.3.1"
|
|
69
75
|
},
|
package/types/element.d.ts
CHANGED
|
@@ -106,10 +106,11 @@ export type CellClick = {
|
|
|
106
106
|
};
|
|
107
107
|
export type ExportFile = {
|
|
108
108
|
/**
|
|
109
|
-
* "
|
|
110
|
-
*
|
|
109
|
+
* "html": the HTML report; "svg": the chart as SVG; "print": the HTML report before it is printed
|
|
110
|
+
* (respondWith(false) prints nothing); "json": the view file (Views, "Download view"); "copy-table",
|
|
111
|
+
* "copy-json": Export → Copy table, Copy data as JSON; "drill-*": the drill-down panel's Export menu
|
|
111
112
|
*/
|
|
112
|
-
kind: "xlsx" | "csv" | "png" | "json" | "copy-table" | "copy-json" | "drill-copy" | "drill-json" | "drill-csv" | "drill-xlsx";
|
|
113
|
+
kind: "xlsx" | "csv" | "png" | "html" | "svg" | "print" | "json" | "copy-table" | "copy-json" | "drill-copy" | "drill-json" | "drill-csv" | "drill-xlsx";
|
|
113
114
|
/**
|
|
114
115
|
* with the extension ("pivot.xlsx"); for a copy the name it would have as a file
|
|
115
116
|
*/
|
|
@@ -171,6 +172,57 @@ export type SourceEntry = {
|
|
|
171
172
|
id: string;
|
|
172
173
|
name?: string;
|
|
173
174
|
};
|
|
175
|
+
export type DataLoad = {
|
|
176
|
+
/**
|
|
177
|
+
* a file loaded ("load": preventDefault()
|
|
178
|
+
* refuses it, the data stays), the page's data shown again, one of those undone or redone, or the
|
|
179
|
+
* file shown again by an element with storage-key put back into the page ("restore")
|
|
180
|
+
*/
|
|
181
|
+
cause: "load" | "original" | "undo" | "redo" | "restore";
|
|
182
|
+
/**
|
|
183
|
+
* the data shown now: the file's (its id names
|
|
184
|
+
* the views kept for it), or the element's source-id and source-name
|
|
185
|
+
*/
|
|
186
|
+
source: {
|
|
187
|
+
id?: string;
|
|
188
|
+
name?: string;
|
|
189
|
+
} | null;
|
|
190
|
+
file: {
|
|
191
|
+
name: string;
|
|
192
|
+
size: number;
|
|
193
|
+
type: string;
|
|
194
|
+
} | null;
|
|
195
|
+
/**
|
|
196
|
+
* the sheet of a workbook
|
|
197
|
+
*/
|
|
198
|
+
sheet: string | null;
|
|
199
|
+
rows: number;
|
|
200
|
+
columns: Array<{
|
|
201
|
+
name: string;
|
|
202
|
+
type: string;
|
|
203
|
+
}>;
|
|
204
|
+
/**
|
|
205
|
+
* the readers' notes ("load")
|
|
206
|
+
*/
|
|
207
|
+
notes: Array<{
|
|
208
|
+
code: string;
|
|
209
|
+
params: Record<string, unknown>;
|
|
210
|
+
message: string;
|
|
211
|
+
}>;
|
|
212
|
+
};
|
|
213
|
+
export type ReaderPlugin = {
|
|
214
|
+
apiVersion: 1;
|
|
215
|
+
kind: "reader";
|
|
216
|
+
name: string;
|
|
217
|
+
label: string;
|
|
218
|
+
accept: readonly string[];
|
|
219
|
+
load: () => Promise<unknown>;
|
|
220
|
+
};
|
|
221
|
+
export type ColumnarData = {
|
|
222
|
+
columns: string[];
|
|
223
|
+
types?: Array<"string" | "number" | "date" | "boolean" | null>;
|
|
224
|
+
data: unknown[][];
|
|
225
|
+
};
|
|
174
226
|
export type SourceSwitch = {
|
|
175
227
|
/**
|
|
176
228
|
* the entry of `sources`
|
|
@@ -185,92 +237,6 @@ export type SourceSwitch = {
|
|
|
185
237
|
*/
|
|
186
238
|
name?: string;
|
|
187
239
|
};
|
|
188
|
-
/**
|
|
189
|
-
* A view of pivotkit-core (the report template): plain JSON with field names only, normalized against
|
|
190
|
-
* the data by the report; anything unknown is dropped. The full type is pivotkit-core's `View`.
|
|
191
|
-
* @typedef {{ rows?: string[], cols?: string[], values?: Array<{ field?: string | null, agg?: string, format?: string | null, [key: string]: unknown }>, [key: string]: unknown }} PivotView
|
|
192
|
-
*/
|
|
193
|
-
/**
|
|
194
|
-
* @typedef {object} Template a saved view of the Views menu: a view, or a view file (its text or object)
|
|
195
|
-
* @property {string} [name] shown in the menu; default the view file's name
|
|
196
|
-
* @property {PivotView} [view]
|
|
197
|
-
* @property {Record<string, unknown> | string} [file] a view file ("pivotkit-view") instead of `view`
|
|
198
|
-
* @property {"shared" | "user"} [scope] the group: "Shared views" or "My views"; default "user"
|
|
199
|
-
* for a deletable entry, else "shared"
|
|
200
|
-
* @property {boolean} [deletable] offers a delete button (pivot-template-delete)
|
|
201
|
-
*/
|
|
202
|
-
/**
|
|
203
|
-
* @typedef {object} FieldDefaults the host's settings for a field, as pivotkit-react's
|
|
204
|
-
* @property {string} [agg] aggregator of a new value, when it fits the field's type ("average" for durations)
|
|
205
|
-
* @property {string} [format] a format of pivotkit-core ("duration:h", "currency:EUR") for a new value,
|
|
206
|
-
* and for the field's own numbers in the drill-down unless `drillFormat` is set
|
|
207
|
-
* @property {string} [drillFormat] the format of the field's values in the drill-down ("text": an identifier as it is)
|
|
208
|
-
* @property {Array<string | number | boolean | null>} [order] the field's own order of items on Rows or Columns
|
|
209
|
-
* @property {string} [label] the name shown for the field; views keep the field's own name
|
|
210
|
-
* @property {string} [description] plain text shown with an "i" next to the field, in its menu and on its headers
|
|
211
|
-
* @property {string} [href] an https link shown as "Learn more" with the description
|
|
212
|
-
* @property {"string" | "number" | "date" | "boolean"} [type] the type the field's column is read as
|
|
213
|
-
*/
|
|
214
|
-
/**
|
|
215
|
-
* @typedef {object} TipDismiss the detail of pivot-tip-dismiss
|
|
216
|
-
* @property {string | null} id the tip dismissed, "*" when every tip was switched off, null when tips came back
|
|
217
|
-
* @property {string[]} dismissed every dismissed id now: set it as `dismissedTips` next time
|
|
218
|
-
*/
|
|
219
|
-
/**
|
|
220
|
-
* @typedef {object} CellClick the detail of pivot-cell-click
|
|
221
|
-
* @property {any[]} row key path of the row ([] is the grand total)
|
|
222
|
-
* @property {any[]} col key path of the column
|
|
223
|
-
* @property {unknown} value the raw value of the cell
|
|
224
|
-
* @property {number | undefined} valueIndex
|
|
225
|
-
* @property {string | undefined} text the value as shown
|
|
226
|
-
* @property {number} count source rows behind the cell
|
|
227
|
-
* @property {object[]} rows the first `drillDownLimit` of them: the host's row objects
|
|
228
|
-
*/
|
|
229
|
-
/**
|
|
230
|
-
* @typedef {object} ExportFile the detail of pivot-export: a file before its download, or a text
|
|
231
|
-
* before it goes on the clipboard
|
|
232
|
-
* @property {"xlsx" | "csv" | "png" | "json" | "copy-table" | "copy-json" | "drill-copy" | "drill-json" | "drill-csv" | "drill-xlsx"} kind
|
|
233
|
-
* "json": the view file (Views, "Download view"); "copy-table", "copy-json": Export → Copy table,
|
|
234
|
-
* Copy data as JSON; "drill-*": the drill-down panel's Export menu
|
|
235
|
-
* @property {string} fileName with the extension ("pivot.xlsx"); for a copy the name it would have as a file
|
|
236
|
-
* @property {Blob} blob
|
|
237
|
-
* @property {string} [text] a copy's text
|
|
238
|
-
* @property {{ shown: number, count: number }} [rows] a drill-down export: the rows it holds and the rows behind the value
|
|
239
|
-
*/
|
|
240
|
-
/**
|
|
241
|
-
* @typedef {object} TemplateSave the detail of pivot-template-save
|
|
242
|
-
* @property {string} name
|
|
243
|
-
* @property {PivotView} view the normalized view to store
|
|
244
|
-
* @property {"shared" | "user"} scope where it goes: "user", the user's own views
|
|
245
|
-
* @property {(result: unknown) => void} respondWith call it in the listener with the promise of the
|
|
246
|
-
* host's save: "Saved" shows when it resolves, the error's message when it rejects
|
|
247
|
-
*/
|
|
248
|
-
/**
|
|
249
|
-
* @typedef {object} TemplateDelete the detail of pivot-template-delete
|
|
250
|
-
* @property {string} name
|
|
251
|
-
* @property {"shared" | "user"} scope the entry's group
|
|
252
|
-
* @property {(result: unknown) => void} respondWith as for pivot-template-save: the entry goes when
|
|
253
|
-
* the promise resolves (the host then sets `templates` without it)
|
|
254
|
-
*/
|
|
255
|
-
/**
|
|
256
|
-
* @typedef {object} TemplatePublish the detail of pivot-template-publish (with `can-publish`)
|
|
257
|
-
* @property {string} name
|
|
258
|
-
* @property {PivotView} view the user's view to publish as a shared view
|
|
259
|
-
* @property {(result: unknown) => void} respondWith as for pivot-template-save: "Published" shows
|
|
260
|
-
* when the promise resolves (the host then sets `templates` with the new shared entry)
|
|
261
|
-
*/
|
|
262
|
-
/**
|
|
263
|
-
* @typedef {object} SourceEntry data the page can show (`sources`), as the report names it
|
|
264
|
-
* @property {string} id
|
|
265
|
-
* @property {string} [name]
|
|
266
|
-
*/
|
|
267
|
-
/**
|
|
268
|
-
* @typedef {object} SourceSwitch the detail of pivot-source-switch: the user chose to switch to the
|
|
269
|
-
* data a loaded view was made for; show that data and set `defaultView` to `view`
|
|
270
|
-
* @property {SourceEntry} source the entry of `sources`
|
|
271
|
-
* @property {PivotView} view the view as the file has it (made for that data, not normalized here)
|
|
272
|
-
* @property {string} [name] the view's name in the file
|
|
273
|
-
*/
|
|
274
240
|
/** The tag the package defines. */
|
|
275
241
|
export declare const TAG = "pivot-report";
|
|
276
242
|
declare const Base: typeof HTMLElement;
|
|
@@ -372,6 +338,12 @@ export declare class PivotReportElement extends Base {
|
|
|
372
338
|
/** The name of the data shown, for people ("Sales 2026"); with source-id. */
|
|
373
339
|
get sourceName(): string | undefined;
|
|
374
340
|
set sourceName(value: string | undefined);
|
|
341
|
+
/**
|
|
342
|
+
* People may load a file into the report (attribute allow-import): a Data button with "Load
|
|
343
|
+
* data…", a file dropped onto the report, a preview first. Read in the browser, nothing uploaded.
|
|
344
|
+
*/
|
|
345
|
+
get allowImport(): boolean;
|
|
346
|
+
set allowImport(value: boolean);
|
|
375
347
|
/** The page is loading the data: the report shows its skeleton (attribute loading). */
|
|
376
348
|
get loading(): boolean;
|
|
377
349
|
set loading(value: boolean);
|
|
@@ -384,9 +356,12 @@ export declare class PivotReportElement extends Base {
|
|
|
384
356
|
*/
|
|
385
357
|
get defaultView(): PivotView | undefined;
|
|
386
358
|
set defaultView(value: PivotView | undefined);
|
|
387
|
-
/**
|
|
388
|
-
|
|
389
|
-
|
|
359
|
+
/**
|
|
360
|
+
* The rows: an array of objects, or columnar data ({ columns, types, data }, one array per column);
|
|
361
|
+
* encoded once per array or object, or once per `dataKey`.
|
|
362
|
+
*/
|
|
363
|
+
get data(): object[] | ColumnarData | undefined;
|
|
364
|
+
set data(value: object[] | ColumnarData | undefined);
|
|
390
365
|
/** The identity of `data`: a new array with the same key is not encoded again. */
|
|
391
366
|
get dataKey(): string | number | undefined;
|
|
392
367
|
set dataKey(value: string | number | undefined);
|
|
@@ -414,9 +389,21 @@ export declare class PivotReportElement extends Base {
|
|
|
414
389
|
*/
|
|
415
390
|
get sources(): SourceEntry[] | undefined;
|
|
416
391
|
set sources(value: SourceEntry[] | undefined);
|
|
417
|
-
/**
|
|
392
|
+
/**
|
|
393
|
+
* Reader plugins for more formats with allow-import (pivotkit-xlsx for Excel workbooks); CSV, TSV,
|
|
394
|
+
* text and JSON are built in.
|
|
395
|
+
*/
|
|
396
|
+
get plugins(): ReaderPlugin[] | undefined;
|
|
397
|
+
set plugins(value: ReaderPlugin[] | undefined);
|
|
398
|
+
/** pivotkit-core's limits (rows, cells, ...) for the host's data. */
|
|
418
399
|
get limits(): Record<string, number> | undefined;
|
|
419
400
|
set limits(value: Record<string, number> | undefined);
|
|
401
|
+
/**
|
|
402
|
+
* The limits a file loaded with allow-import is read and shown with, merged key by key over
|
|
403
|
+
* `limits` (default: `limits`), so uploads can be kept small without capping the host's data.
|
|
404
|
+
*/
|
|
405
|
+
get importLimits(): Record<string, number> | undefined;
|
|
406
|
+
set importLimits(value: Record<string, number> | undefined);
|
|
420
407
|
}
|
|
421
408
|
/**
|
|
422
409
|
* Defines the element under a tag name (default "pivot-report"). A name that is already defined is
|
package/types/events.d.ts
CHANGED
package/types/global.d.ts
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// PivotReportElement, and addEventListener("pivot-view-change", ...) on it (or on a parent: the events
|
|
3
3
|
// bubble and are composed) knows the event's detail. Copied next to the generated declarations by
|
|
4
4
|
// types.js; written by hand because JSDoc cannot augment global interfaces.
|
|
5
|
-
import type { CellClick, ExportFile, PivotReportElement, PivotView, SourceSwitch, TemplateDelete, TemplatePublish, TemplateSave, TipDismiss } from "./element.js";
|
|
5
|
+
import type { CellClick, DataLoad, ExportFile, PivotReportElement, PivotView, SourceSwitch, TemplateDelete, TemplatePublish, TemplateSave, TipDismiss } from "./element.js";
|
|
6
6
|
|
|
7
7
|
/** The events of <pivot-report>. */
|
|
8
8
|
export interface PivotReportEventMap {
|
|
@@ -22,6 +22,8 @@ export interface PivotReportEventMap {
|
|
|
22
22
|
"pivot-tip-dismiss": CustomEvent<TipDismiss>;
|
|
23
23
|
/** "Switch to <name> and load" for a view made for other data (one of `sources`): show that data with `detail.view`. */
|
|
24
24
|
"pivot-source-switch": CustomEvent<SourceSwitch>;
|
|
25
|
+
/** The data shown changed (with `allow-import`): a file loaded (`preventDefault()` refuses it), the page's data again, or one of those undone or redone. */
|
|
26
|
+
"pivot-data-load": CustomEvent<DataLoad>;
|
|
25
27
|
}
|
|
26
28
|
|
|
27
29
|
declare global {
|
package/types/jsx.d.ts
CHANGED
|
@@ -8,7 +8,7 @@ import type { DetailedHTMLProps, HTMLAttributes } from "react";
|
|
|
8
8
|
import type { PivotReportElement } from "./element.js";
|
|
9
9
|
import type { PivotReportEventMap } from "./global.js";
|
|
10
10
|
|
|
11
|
-
type Settable = "data" | "dataKey" | "view" | "defaultView" | "templates" | "labels" | "fieldDefaults" | "limits" | "locale" | "theme" | "height" | "timeZone" | "fileName" | "label" | "drillDown" | "drillDownLimit" | "saveTemplates" | "templateStore" | "canPublish" | "tips" | "storageKey" | "dismissedTips" | "chartOptions" | "shareLink" | "persistView" | "loading" | "fieldInfo" | "zoneInfo" | "settingInfo" | "sourceId" | "sourceName" | "sources" | "schemaUrl" | "grow" | "fieldList";
|
|
11
|
+
type Settable = "data" | "dataKey" | "view" | "defaultView" | "templates" | "labels" | "fieldDefaults" | "limits" | "importLimits" | "locale" | "theme" | "height" | "timeZone" | "fileName" | "label" | "drillDown" | "drillDownLimit" | "saveTemplates" | "templateStore" | "canPublish" | "tips" | "storageKey" | "dismissedTips" | "chartOptions" | "shareLink" | "persistView" | "loading" | "fieldInfo" | "zoneInfo" | "settingInfo" | "sourceId" | "sourceName" | "sources" | "schemaUrl" | "grow" | "fieldList" | "allowImport" | "plugins";
|
|
12
12
|
|
|
13
13
|
/** The props of <pivot-report> in JSX. */
|
|
14
14
|
export type PivotReportJsxProps = DetailedHTMLProps<HTMLAttributes<PivotReportElement>, PivotReportElement> &
|