@poadio/app-vue 0.3.0 → 0.4.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 +10 -0
- package/app-vue.css +14 -0
- package/dist/items.d.ts.map +1 -1
- package/dist/items.js +344 -85
- package/dist/items.js.map +1 -1
- package/dist/sections/grid.d.ts.map +1 -1
- package/dist/sections/grid.js +11 -2
- package/dist/sections/grid.js.map +1 -1
- package/package.json +2 -2
- package/runtime-dist/app.css +14 -0
- package/runtime-dist/app.js +2 -2
- package/runtime-dist/c-008ty6rk.js +2 -0
- package/runtime-dist/c-05mfa190.js +1 -0
- package/runtime-dist/c-0j0qq16x.js +1 -0
- package/runtime-dist/c-0q89m260.js +1 -0
- package/runtime-dist/{c-4mqnegk0.js → c-0s78cd21.js} +1 -1
- package/runtime-dist/{c-770ysy0b.js → c-1ceh9z6n.js} +1 -1
- package/runtime-dist/c-1hv05jxf.js +2 -0
- package/runtime-dist/c-2ad7era6.js +1 -0
- package/runtime-dist/c-2d4zg49c.js +1 -0
- package/runtime-dist/c-2e4pej9y.js +1 -0
- package/runtime-dist/c-2jaeb7hb.js +1 -0
- package/runtime-dist/{c-t31wwv0j.js → c-31k4h9e3.js} +1 -1
- package/runtime-dist/{c-6pfxp4ca.js → c-323cmvmr.js} +2 -2
- package/runtime-dist/{c-aebecc6a.js → c-38mbqn1q.js} +1 -1
- package/runtime-dist/{c-mb798tvv.js → c-3at1wc60.js} +2 -2
- package/runtime-dist/{c-0arc0hg5.js → c-3cbct4j0.js} +1 -1
- package/runtime-dist/c-4c6bp5ge.js +1 -0
- package/runtime-dist/c-4h6g9784.js +1 -0
- package/runtime-dist/{c-632d3gvm.js → c-4qan80kf.js} +1 -1
- package/runtime-dist/{c-z6dbvc3p.js → c-4xcsa9sp.js} +2 -2
- package/runtime-dist/c-5a6mxded.js +1 -0
- package/runtime-dist/c-5kyzr3hv.js +2 -0
- package/runtime-dist/{c-0x2e39ve.js → c-5vtfap6v.js} +2 -2
- package/runtime-dist/{c-hwgt6amh.js → c-5xrh3qmz.js} +2 -2
- package/runtime-dist/c-5zfmt59k.js +2 -0
- package/runtime-dist/c-6jjary0p.js +1 -0
- package/runtime-dist/c-6w1r241j.js +1 -0
- package/runtime-dist/{c-00cvgnxc.js → c-770qn5gr.js} +1 -1
- package/runtime-dist/{c-dzp10g67.js → c-7dq4rx1n.js} +3 -3
- package/runtime-dist/{c-nm6tjep8.js → c-80vaq27v.js} +1 -1
- package/runtime-dist/{c-ytpw5gj2.js → c-81zrdysm.js} +1 -1
- package/runtime-dist/c-8jrmqdq1.js +1 -0
- package/runtime-dist/c-8wdrb81n.js +1 -0
- package/runtime-dist/{c-ejgrzqe3.js → c-8wf8b0sr.js} +1 -1
- package/runtime-dist/{c-gty08djr.js → c-8zmpdrm5.js} +2 -2
- package/runtime-dist/{c-zbts8rvw.js → c-8zzjexhj.js} +2 -2
- package/runtime-dist/c-900h0yca.js +1 -0
- package/runtime-dist/{c-8cydj5g6.js → c-908e6t37.js} +3 -3
- package/runtime-dist/{c-170fz4v2.js → c-90cnzxxw.js} +1 -1
- package/runtime-dist/c-996zhc7v.js +1 -0
- package/runtime-dist/{c-an1sk7z5.js → c-9q0awp0g.js} +2 -2
- package/runtime-dist/c-afwe6e7h.js +1 -0
- package/runtime-dist/{c-tjk566f2.js → c-akbde6sp.js} +2 -2
- package/runtime-dist/c-bbkx8ha0.js +2 -0
- package/runtime-dist/{c-v73qt5av.js → c-bezqdzja.js} +1 -1
- package/runtime-dist/c-c6t3xp1f.js +1 -0
- package/runtime-dist/{c-m4wr50z4.js → c-d0w2v0ry.js} +1 -1
- package/runtime-dist/{c-6nx9xkc1.js → c-d10mvt3y.js} +1 -1
- package/runtime-dist/c-d15cp8ae.js +7 -0
- package/runtime-dist/{c-xyqqhx8j.js → c-darzv9dx.js} +7 -7
- package/runtime-dist/c-dfmaz8kq.js +1 -0
- package/runtime-dist/{c-8xc3fha3.js → c-e4eywyqm.js} +2 -2
- package/runtime-dist/{c-pager3te.js → c-e71rhzgd.js} +1 -1
- package/runtime-dist/{c-93kndqea.js → c-ehvh73gz.js} +1 -1
- package/runtime-dist/{c-2z768p0x.js → c-fgymwk56.js} +2 -2
- package/runtime-dist/{c-stez1fhk.js → c-fj70dzwc.js} +2 -2
- package/runtime-dist/c-fn3ddac2.js +1 -0
- package/runtime-dist/{c-zhvsa0wq.js → c-fye4ktyb.js} +2 -2
- package/runtime-dist/c-g1sapcjb.js +1 -0
- package/runtime-dist/{c-9pzq231t.js → c-gcp7pgzj.js} +1 -1
- package/runtime-dist/c-hga6v8y5.js +2 -0
- package/runtime-dist/{c-znyeph7c.js → c-hkqab6a9.js} +1 -1
- package/runtime-dist/{c-8v7c8j85.js → c-hqcvt3z9.js} +2 -2
- package/runtime-dist/{c-kt8hnx3r.js → c-htmgkvv5.js} +1 -1
- package/runtime-dist/{c-r539tr5f.js → c-htx6kd3m.js} +1 -1
- package/runtime-dist/c-hwv8e548.js +1 -0
- package/runtime-dist/{c-f4fpjjsk.js → c-j18jra7n.js} +1 -1
- package/runtime-dist/{c-fq9wga43.js → c-j2m0kaz5.js} +1 -1
- package/runtime-dist/c-jcnz4p9h.js +1 -0
- package/runtime-dist/c-jeke4j5f.js +1 -0
- package/runtime-dist/{c-5bxybf9g.js → c-jfhd21m0.js} +2 -2
- package/runtime-dist/{c-4w8c01x6.js → c-jgq8c478.js} +2 -2
- package/runtime-dist/{c-bbgsrr8m.js → c-jtbbtv7w.js} +1 -1
- package/runtime-dist/{c-x0evjwqg.js → c-jz0pz4sa.js} +2 -2
- package/runtime-dist/c-k473g4p1.js +1 -0
- package/runtime-dist/{c-76450e09.js → c-kge0a8jt.js} +1 -1
- package/runtime-dist/{c-n5896ck3.js → c-kkgxaaxx.js} +2 -2
- package/runtime-dist/{c-afjwwspe.js → c-kvaqyz6q.js} +1 -1
- package/runtime-dist/c-m1a3vb0b.js +1 -0
- package/runtime-dist/{c-q9h7pf4v.js → c-m61eyj12.js} +1 -1
- package/runtime-dist/c-mc9sevgd.js +1 -0
- package/runtime-dist/{c-ckkpv1ab.js → c-mttkd1hb.js} +1 -1
- package/runtime-dist/{c-v43kzdgm.js → c-mzfdqh06.js} +1 -1
- package/runtime-dist/{c-272dwppe.js → c-n6ngg2xw.js} +1 -1
- package/runtime-dist/{c-0x2jfka0.js → c-n77b13je.js} +1 -1
- package/runtime-dist/c-nc4950dr.js +1 -0
- package/runtime-dist/{c-bbqq1fmz.js → c-ndjpabjd.js} +2 -2
- package/runtime-dist/{c-bypwvtv5.js → c-ndqn9k3b.js} +1 -1
- package/runtime-dist/{c-hddfmemr.js → c-nh1crnme.js} +2 -2
- package/runtime-dist/{c-z00nq4vy.js → c-p1knyfjp.js} +2 -2
- package/runtime-dist/{c-d9eczdnp.js → c-p7exw6x4.js} +1 -1
- package/runtime-dist/c-p8gmqk2c.js +2 -0
- package/runtime-dist/{c-hcd75fdn.js → c-peqr6b73.js} +1 -1
- package/runtime-dist/c-pf0hf4z0.js +1 -0
- package/runtime-dist/{c-09vj399g.js → c-pwb1zdth.js} +1 -1
- package/runtime-dist/{c-22qerref.js → c-q9sz4140.js} +2 -2
- package/runtime-dist/c-qancp7fv.js +1 -0
- package/runtime-dist/{c-cyvq3zhq.js → c-r8caw0b4.js} +1 -1
- package/runtime-dist/{c-ncw09fhf.js → c-ra8vp32m.js} +1 -1
- package/runtime-dist/{c-ah4kckw8.js → c-rpantxdv.js} +2 -2
- package/runtime-dist/{c-b9npcc8v.js → c-sen28fd3.js} +1 -1
- package/runtime-dist/{c-9hk02377.js → c-t3at1w4r.js} +1 -1
- package/runtime-dist/c-t77hdys1.js +2 -0
- package/runtime-dist/{c-aetcxxs5.js → c-td669s77.js} +2 -2
- package/runtime-dist/{c-g0s6z8fh.js → c-tfkx1ms2.js} +1 -1
- package/runtime-dist/c-traxh6dd.js +2 -0
- package/runtime-dist/c-v13nz4jj.js +1 -0
- package/runtime-dist/c-v59gffnx.js +7 -0
- package/runtime-dist/c-wcm09eer.js +1 -0
- package/runtime-dist/c-wfexgh4m.js +2 -0
- package/runtime-dist/{c-sgr6dj0y.js → c-x7f6s1vz.js} +1 -1
- package/runtime-dist/{c-jpgfd99h.js → c-y0qqtc02.js} +1 -1
- package/runtime-dist/c-ydb0jv9k.js +1 -0
- package/runtime-dist/{c-1j1xssd8.js → c-yg69d4wg.js} +2 -2
- package/runtime-dist/c-yrfjn186.js +2 -0
- package/runtime-dist/{c-pca88tas.js → c-yz4h2z4n.js} +1 -1
- package/runtime-dist/{c-nacvp4ca.js → c-z9ry29gh.js} +1 -1
- package/runtime-dist/{c-jhscxp68.js → c-zbjpj2yd.js} +1 -1
- package/runtime-dist/version.json +1 -1
- package/src/items.ts +446 -95
- package/src/sections/grid.ts +10 -2
- package/runtime-dist/c-1aa5pzps.js +0 -1
- package/runtime-dist/c-1h3k0kb8.js +0 -1
- package/runtime-dist/c-1n6fcyf0.js +0 -1
- package/runtime-dist/c-38nmw75x.js +0 -1
- package/runtime-dist/c-3gqmyt95.js +0 -1
- package/runtime-dist/c-4s1xdsjj.js +0 -2
- package/runtime-dist/c-5crndmh8.js +0 -1
- package/runtime-dist/c-7eh8g4bg.js +0 -1
- package/runtime-dist/c-8g74gqn9.js +0 -2
- package/runtime-dist/c-96a9b7ys.js +0 -1
- package/runtime-dist/c-a3jhm7jm.js +0 -1
- package/runtime-dist/c-aenj05yt.js +0 -2
- package/runtime-dist/c-bemne227.js +0 -1
- package/runtime-dist/c-d3jg3nhc.js +0 -1
- package/runtime-dist/c-d68hg40s.js +0 -1
- package/runtime-dist/c-d8ba6h4e.js +0 -1
- package/runtime-dist/c-e5eq2szv.js +0 -2
- package/runtime-dist/c-e7rb0mk1.js +0 -1
- package/runtime-dist/c-ezj4yg2q.js +0 -1
- package/runtime-dist/c-f23v2025.js +0 -2
- package/runtime-dist/c-fps4599a.js +0 -1
- package/runtime-dist/c-g06g8vzv.js +0 -1
- package/runtime-dist/c-g0ncg08s.js +0 -7
- package/runtime-dist/c-hqtxax0h.js +0 -1
- package/runtime-dist/c-mpvzhygt.js +0 -1
- package/runtime-dist/c-mqwew5y8.js +0 -1
- package/runtime-dist/c-p1cbp7e1.js +0 -1
- package/runtime-dist/c-pp0qxmbz.js +0 -2
- package/runtime-dist/c-pttdwpdd.js +0 -1
- package/runtime-dist/c-qcz7q5fj.js +0 -2
- package/runtime-dist/c-qhv2qby2.js +0 -2
- package/runtime-dist/c-r7qgrz3b.js +0 -2
- package/runtime-dist/c-ra7b526a.js +0 -1
- package/runtime-dist/c-rm3pkjj7.js +0 -1
- package/runtime-dist/c-srccgg45.js +0 -2
- package/runtime-dist/c-tc2bxsyc.js +0 -1
- package/runtime-dist/c-tjqjxwfa.js +0 -1
- package/runtime-dist/c-tpa4vh9k.js +0 -1
- package/runtime-dist/c-w1cb3r8h.js +0 -1
- package/runtime-dist/c-wcha6k7x.js +0 -1
- package/runtime-dist/c-x2jj49ts.js +0 -1
- package/runtime-dist/c-xhyafw4q.js +0 -1
- package/runtime-dist/c-y7f2tjg6.js +0 -7
- package/runtime-dist/c-yf86vgtz.js +0 -2
- package/runtime-dist/c-yhzkcpdp.js +0 -1
- package/runtime-dist/c-zhwr1x02.js +0 -1
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{_}from"./c-t8hew4h2.js";import{t,r,d,l,e}from"./c-d15cp8ae.js";var h=(a)=>a.min??0,k=(a)=>a.max??100,I=(a)=>a.step===void 0?1:a.step;function B(a,n={}){let i=h(n),s=k(n),u=Math.min(s,Math.max(i,a)),m=I(n);if(m&&m>0)u=i+Math.round((u-i)/m)*m,u=Math.min(s,Math.max(i,+u.toFixed(10)));return u}function J(a,n={}){let i=h(n),s=k(n);if(n.range){let m=Array.isArray(a)?a:[i,typeof a==="number"?a:s],y=B(Number(m[0]??i),n),A=B(Number(m[1]??s),n);return[Math.min(y,A),Math.max(y,A)]}let u=Array.isArray(a)?a[0]:a;return[B(u==null||Number.isNaN(Number(u))?i:Number(u),n)]}var K=(a,n={})=>n.range?[a[0],a[1]]:a[0];function L(a,n={}){let i=k(n)-h(n);return i<=0?0:(a-h(n))/i*100}function Q(a,n={}){return n.range?{start:L(a[0],n),size:L(a[1],n)-L(a[0],n)}:{start:0,size:L(a[0],n)}}function W(a,n={}){if(!a)return[];let i=h(n),s=k(n);if(a==="steps"){let u=I(n)||1,m=[];for(let y=i;y<=s+0.000000001&&m.length<200;y=+(y+u).toFixed(10))m.push({value:y});return m}return a.map((u)=>typeof u==="number"?{value:u}:{...u}).filter((u)=>u.value>=i&&u.value<=s)}function R(a,n={}){return{property:n.orientation==="vertical"?"bottom":"inset-inline-start",value:`${a}%`}}function Z(a,n={}){return{property:n.orientation==="vertical"?"height":"width",value:`${a}%`}}function ee(a,n,i={},s=!1){let u;if(i.orientation==="vertical")u=n.height?1-(a.y-n.top)/n.height:0;else if(!n.width)u=0;else u=s?(n.left+n.width-a.x)/n.width:(a.x-n.left)/n.width;return h(i)+Math.min(1,Math.max(0,u))*(k(i)-h(i))}function ae(a,n,i={}){if(!i.range)return 0;let s=n[0],u=n[1];if(s===u)return a>u?1:0;return Math.abs(a-s)<=Math.abs(a-u)?0:1}function D(a,n,i,s={}){let u=B(n,s);if(!s.range)return u;return a===0?[Math.min(u,i[1]),i[1]]:[i[0],Math.max(u,i[0])]}function G(a,n){if(Array.isArray(a)&&Array.isArray(n))return a[0]===n[0]&&a[1]===n[1];return a===n}var re=["ArrowRight","ArrowUp","ArrowLeft","ArrowDown","PageUp","PageDown","Home","End"];function le(a,n,i={}){let s=(I(i)||(k(i)-h(i))/100)*(i.shiftKey?10:1),u=i.rtl&&i.orientation!=="vertical";switch(n){case"ArrowRight":return u?a-s:a+s;case"ArrowLeft":return u?a+s:a-s;case"ArrowUp":return a+s;case"ArrowDown":return a-s;case"PageUp":return a+s*10;case"PageDown":return a-s*10;case"Home":return h(i);case"End":return k(i);default:return null}}function te(a,n,i){if(a==="never")return!1;if(a==="always")return!0;if(a==="drag")return i.dragging===n||i.focused===n;return i.hovered===n||i.dragging===n||i.focused===n}var C=(a,n)=>n?n(a):String(a);function ne(a,n,i){if(a.lazy&&!i)return{draft:n,commit:null,changed:null,sliding:n};let s=G(n,a.value)?null:n,u=a.start===void 0?a.value:a.start,m=i&&!G(n,u)?n:null;return{draft:i?null:a.draft,commit:s,changed:m,sliding:n}}var H=(a)=>`${a}-l`,T=(a,n)=>`${a}-h${n}`;function ie(a,n,i){let s=!!i.label;return{id:T(i.id,a),role:"slider",tabindex:i.disabled?-1:0,"aria-valuemin":i.range&&a===1?n[0]:h(i),"aria-valuemax":i.range&&a===0?n[1]:k(i),"aria-valuenow":n[a],"aria-valuetext":C(n[a],i.formatValue),"aria-orientation":i.orientation??"horizontal","aria-label":s?null:i.ariaLabel||null,"aria-labelledby":s?H(i.id):null,"aria-disabled":i.disabled?"true":null,"aria-invalid":i.invalid?"true":null}}function de(a){return{"is-vertical":a.orientation==="vertical","is-disabled":!!a.disabled,"is-readonly":!!a.readonly,"is-invalid":!!a.invalid,"is-range":!!a.range,"is-dragging":!!a.dragging,"size-sm":a.size==="sm",[`sev-${a.severity??"primary"}`]:!0,"has-marks":!!a.hasMarks}}var Er=r({name:"PoadSlider",props:{modelValue:{type:[Number,Array],default:void 0},min:{type:Number,default:0},max:{type:Number,default:100},step:{type:Number,default:1},range:Boolean,orientation:{type:String,default:"horizontal"},lazy:Boolean,showValue:{type:[String,Boolean],default:"drag"},formatValue:Function,marks:[Array,String],showTicks:Boolean,disabled:Boolean,readonly:Boolean,invalid:Boolean,size:{type:String,default:"md"},severity:{type:String,default:"primary"},label:String,ariaLabel:String,id:String},emits:{"update:modelValue":(a)=>!0,change:(a)=>!0,sliding:(a)=>!0,slideStart:(a)=>!0,slideEnd:(a)=>!0},setup(a,{emit:n}){let i=l(a,"modelValue"),s=d(),u=t(null),m=t(null),y=t(null),A=t(null),V=t(null),F=t(null),E=null,x=()=>({min:a.min,max:a.max,step:a.step,range:a.range,orientation:a.orientation}),P=()=>J(y.value??i.value,x()),p=(S,c)=>{let v=ne({value:i.value??null,draft:y.value,lazy:a.lazy,start:E??void 0},S,c);if(y.value=v.draft,n("sliding",v.sliding),v.commit!=null)i.value=v.commit;if(v.changed!=null)n("change",v.changed)},U=(S,c)=>ee({x:S,y:c},m.value.getBoundingClientRect(),x(),_(u.value)),Y=(S,c,v)=>{S.preventDefault(),A.value=c;let b=u.value.ownerDocument;if(E=K(P(),x()),b.getElementById(T(a.id??s,c))?.focus({preventScroll:!0}),n("slideStart",E),v!=null)p(D(c,v,P(),x()),!1);let M=(w)=>p(D(c,U(w.clientX,w.clientY),P(),x()),!1),z=()=>{b.removeEventListener("pointermove",M),b.removeEventListener("pointerup",z),b.removeEventListener("pointercancel",z);let w=K(P(),x());p(w,!0),E=null,A.value=null,n("slideEnd",w)};b.addEventListener("pointermove",M),b.addEventListener("pointerup",z),b.addEventListener("pointercancel",z)};return()=>{let S=a.id??s,c=x(),v=P(),b=!a.disabled&&!a.readonly,M=W(a.marks,c),z={...c,id:S,label:a.label,ariaLabel:a.ariaLabel,invalid:a.invalid,disabled:a.disabled,formatValue:a.formatValue},w=(o)=>{let f=R(L(o,c),c);return{[f.property]:f.value}},O=Q(v,c),X=R(O.start,c),j=Z(O.size,c),q=(o)=>C(o,a.formatValue),ue=(o,f)=>{if(!b||!re.includes(o.key))return;let g=le(v[f],o.key,{...c,shiftKey:o.shiftKey,rtl:_(u.value)});if(g==null)return;o.preventDefault(),p(D(f,g,v,c),!0)};return e("div",{ref:u,class:["poad-slider",de({...c,disabled:a.disabled,readonly:a.readonly,invalid:a.invalid,dragging:A.value!==null,size:a.size,severity:a.severity,hasMarks:M.length>0})]},[a.label&&e("span",{class:"poad-slider__label",id:H(S)},a.label),e("div",{class:"poad-slider__wrap"},[e("div",{ref:m,class:"poad-slider__track",onPointerdown:(o)=>{if(!b)return;let f=U(o.clientX,o.clientY);Y(o,ae(f,v,c),f)}},[e("div",{class:"poad-slider__fill",style:{[X.property]:X.value,[j.property]:j.value}}),a.showTicks&&M.map((o)=>e("i",{key:o.value,class:"poad-slider__tick",style:w(o.value)})),v.map((o,f)=>{let g=ie(f,v,z);return e("button",{key:f,type:"button",class:["poad-slider__handle",{"is-active":A.value===f||V.value===f}],role:g.role,id:g.id,tabindex:g.tabindex,"aria-valuemin":g["aria-valuemin"],"aria-valuemax":g["aria-valuemax"],"aria-valuenow":g["aria-valuenow"],"aria-valuetext":g["aria-valuetext"],"aria-orientation":g["aria-orientation"],"aria-label":g["aria-label"]??void 0,"aria-labelledby":g["aria-labelledby"]??void 0,"aria-disabled":g["aria-disabled"]??void 0,"aria-invalid":g["aria-invalid"]??void 0,style:w(o),onPointerdown:(N)=>{if(!b)return;N.stopPropagation(),Y(N,f,null)},onKeydown:(N)=>ue(N,f),onFocus:()=>V.value=f,onBlur:()=>V.value=null,onPointerenter:()=>F.value=f,onPointerleave:()=>F.value=null},te(a.showValue,f,{dragging:A.value,focused:V.value,hovered:F.value})?[e("span",{class:"poad-slider__bubble"},q(o))]:void 0)})]),M.length>0&&e("div",{class:"poad-slider__marks"},M.map((o)=>e("span",{key:o.value,class:"poad-slider__mark",style:w(o.value)},o.label??q(o.value))))])])}}});
|
|
2
|
+
export{Er};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{n}from"./c-81zrdysm.js";import{Bt,Rs,Yn,Ns,mo,Bs,Xn,zs,Fs,js,Jn,Qn,$s}from"./c-1hv05jxf.js";import{De}from"./c-gqaaq5xd.js";import{A,Z}from"./c-4xcsa9sp.js";import{le}from"./c-yg69d4wg.js";import{x}from"./c-akbde6sp.js";import{o}from"./c-t3at1w4r.js";import{t,c,s,r,d,u,l,e}from"./c-d15cp8ae.js";var me=r({name:"PoadCombo",props:{data:{type:Object,default:null},store:{type:[Object,String],default:null},field:{type:String,default:null},modelValue:{type:null},suggestions:{type:[Array,Function],default:()=>[]},optionLabel:{type:String,default:"label"},minLength:{type:Number,default:1},delay:{type:Number,default:250},dropdown:Boolean,forceSelection:Boolean,multiple:Boolean,clearable:Boolean,readonly:Boolean,disabled:Boolean,invalid:Boolean,placeholder:{type:String,default:""},emptyMessage:String,size:{type:String,default:"md"},panelMaxHeight:{type:Number,default:260},ariaLabel:String,id:String},emits:{"update:modelValue":(a)=>!0,search:(a)=>!0,openChange:(a)=>!0},setup(a,{emit:F,slots:H}){let{t:E,text:Q}=o(),X=d(),M=()=>`${a.id??`poad-combo-${X}`}-list`,C=le(()=>x(a.data,a.store,a.field),"combo",()=>a.multiple),I=C.model(l(a,"modelValue")),T=()=>!!C.choice.value?.options,h=()=>T()?"label":a.optionLabel,j=()=>a.forceSelection||T(),Y=()=>T()?(i)=>C.choice.value.suggest(i):a.suggestions,P=()=>I.value??(a.multiple?[]:null),b=t(a.multiple?"":mo(I.value,h())),g=t(!1),L=t(!1),S=c([]),y=t(-1),K=t(0),U=t(null),z=t(null),W=t(null),O=t(null),B=null,D=0;s(()=>a.multiple?null:I.value,(i)=>{if(!a.multiple)b.value=mo(i,h())}),u(()=>{if(B)clearTimeout(B)});let w=(i)=>{I.value=i},G=(i)=>{if(g.value=i,i)K.value=z.value?.getBoundingClientRect().width??0;F("openChange",i)},k=()=>{if(!g.value)return;y.value=-1,G(!1)},N=async(i)=>{F("search",i);let v=++D,f=[],m=Y();if(typeof m==="function"){L.value=!0;try{f=await m(i)}catch{f=[]}finally{if(v===D)L.value=!1}}else f=Rs(m,i,h());if(v!==D)return;if(S.value=f,y.value=zs(f.length).active,!g.value)G(!0)},q=(i)=>{if(b.value=i,!a.multiple&&!j())w(i||null);if(Bs(i,a.minLength)==="close"){k();return}if(B)clearTimeout(B);B=setTimeout(()=>void N(i),a.delay)},J=(i)=>{let v=Fs(P(),i,{multiple:a.multiple,labelPath:h()});if(v.changed)w(v.value);b.value=v.text,k()},ee=()=>{let i=js(P(),b.value,{forceSelection:j(),multiple:a.multiple,labelPath:h()});if(!i)return;if(i.text!==void 0)b.value=i.text;if("value"in i)w(i.value)},te=(i)=>{i.stopPropagation(),b.value="",w(a.multiple?[]:null),k()},ae=(i)=>{let v=Yn(P(),a.multiple),f=Xn({open:g.value,active:y.value,count:S.value.length,multiple:a.multiple,text:b.value,valuesCount:v.length},i.key);if(f.preventDefault)i.preventDefault();let m=f.action;if(m.type==="search")N(b.value);else if(m.type==="move")y.value=m.active;else if(m.type==="pick")J(S.value[m.index]);else if(m.type==="close")k();else if(m.type==="remove-last")w(v.slice(0,-1))},{style:ne}=A({open:()=>g.value,anchor:z,floating:W,candidates:()=>De,offset:4,shift:!0,deps:()=>S.value});return Z(()=>g.value,[U],()=>k()),()=>{let i=Yn(P(),a.multiple),v=Jn({open:g.value,listId:M(),active:y.value,invalid:C.invalid(a.invalid)}),f=e("input",{ref:O,class:"st__input",role:v.role,placeholder:a.multiple&&i.length?"":a.placeholder,value:b.value,disabled:a.disabled,readonly:!a.multiple&&a.readonly,autocomplete:"off",spellcheck:!1,"aria-autocomplete":v["aria-autocomplete"],"aria-expanded":v["aria-expanded"],"aria-controls":v["aria-controls"],"aria-activedescendant":v["aria-activedescendant"]??void 0,"aria-invalid":a.multiple?void 0:v["aria-invalid"]??void 0,"aria-label":a.ariaLabel,onInput:(m)=>q(m.target.value),onKeydown:ae,onBlur:ee});return e("div",{ref:U,class:["poad-combo",$s({...a,invalid:C.invalid(a.invalid),open:g.value}),C.bound.view.value?.classes]},[e("div",{ref:z,class:["st",{"st--multi":a.multiple}],onClick:()=>O.value?.focus()},[a.multiple?e("span",{class:"st__chips"},[...i.map((m,p)=>e("span",{key:p,class:"st__chip"},[Bt(m,h()),e("button",{type:"button",tabindex:-1,"aria-label":E("common.remove"),onClick:(_)=>{if(_.stopPropagation(),!a.disabled)w(i.filter((R,V)=>V!==p))}},[e(n,{name:"x",size:10})])])),f]):f,L.value&&e(n,{name:"loader",size:14,spin:!0,class:"st__spin"}),a.clearable&&(b.value||i.length>0)&&!a.disabled&&e("button",{type:"button",class:"st__clear",tabindex:-1,"aria-label":E("common.clear"),onClick:te},[e(n,{name:"x",size:12})]),a.dropdown&&e("button",{type:"button",class:"st__dd",tabindex:-1,"aria-label":E("select.showSuggestions"),onClick:(m)=>{if(m.stopPropagation(),a.disabled)return;if(g.value){k();return}O.value?.focus(),N("")}},[e(n,{name:"chevron-down",size:13,class:"st__chev"})])]),g.value&&e("div",{ref:W,class:"poad-floating poad-combo-pane",style:ne()},[e("div",{class:"sp",style:{minWidth:`${K.value}px`}},[e("ul",{class:"cb__list",role:"listbox",id:M(),style:{maxHeight:`${a.panelMaxHeight}px`}},S.value.length?S.value.map((m,p)=>{let _=Qn(M(),p,p===y.value,Ns(P(),m,a.multiple)),R=Bt(m,h());return e("li",{key:p,role:_.role,id:_.id,class:_.classes,"aria-selected":_["aria-selected"],onMousedown:(V)=>V.preventDefault(),onMouseenter:()=>{y.value=p},onClick:()=>J(m)},H.option?H.option({option:m,selected:_.classes["is-on"],index:p,label:R}):R)}):!L.value?[e("li",{class:"sp__empty"},Q(a.emptyMessage,"select.noSuggestions"))]:[])])])])}}});export{me as PoadCombo};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import{g}from"./c-90cnzxxw.js";import{n}from"./c-81zrdysm.js";import{Ie}from"./c-ehvh73gz.js";import{o}from"./c-t3at1w4r.js";import{t,c,s,r,d,u,e}from"./c-d15cp8ae.js";var G=/("(?:\\.|[^"\\\n])*")(\s*:)?|\b(true|false|null)\b|(-?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)|([{}[\],:])/g;function U(l){let a=[],f=0,m=(p)=>{if(p>f)a.push({text:l.slice(f,p),kind:"text"})};for(let p of l.matchAll(G)){let x=p.index;if(m(x),p[1]){if(a.push({text:p[1],kind:p[2]?"key":"str"}),p[2])a.push({text:p[2],kind:"pun"})}else if(p[3])a.push({text:p[3],kind:"kw"});else if(p[4])a.push({text:p[4],kind:"num"});else a.push({text:p[5],kind:"pun"});f=x+p[0].length}return m(l.length),a}function Q(l,a){let f=l.slice(0,a);return{line:f.split(`
|
|
2
|
+
`).length,column:a-f.lastIndexOf(`
|
|
3
|
+
`)}}function X(l){let a=0,f=l.length;class m{p;constructor(i){this.p=i}}let p=(i,k=a,I)=>{let j=Q(l,k);throw new m({offset:k,...j,key:i,...I!==void 0?{token:I}:{}})},x=()=>{while(a<f&&(l[a]===" "||l[a]==="\t"||l[a]===`
|
|
4
|
+
`||l[a]==="\r"))a++},E=()=>a>=f?p("map.jsonUnexpectedEnd"):p("map.jsonUnexpectedToken",a,l[a]),S=()=>{let i=a;a++;for(;;){if(a>=f)p("map.jsonUnterminatedString",i);let k=l.charCodeAt(a);if(k===34){a++;return}if(k<32)p(k===10?"map.jsonUnterminatedString":"map.jsonControlChar",k===10?i:a);if(k===92){let I=l[a+1];if(I===void 0)p("map.jsonUnterminatedString",i);if(I==="u"){if(!/^[0-9a-fA-F]{4}$/.test(l.slice(a+2,a+6)))p("map.jsonBadEscape");a+=6;continue}if(!'"\\/bfnrt'.includes(I))p("map.jsonBadEscape");a+=2;continue}a++}},y=()=>{let i=/^-?(?:0|[1-9]\d*)(?:\.\d+)?(?:[eE][+-]?\d+)?/.exec(l.slice(a,a+400));if(!i)p("map.jsonBadNumber");if(a+=i[0].length,a<f&&/[\d.eE+-]/.test(l[a]))p("map.jsonBadNumber")},h=()=>{for(let i of["true","false","null"])if(l.startsWith(i,a)){a+=i.length;return}E()},v=[],T=()=>{if(x(),a>=f)p("map.jsonUnexpectedEnd");let i=l[a];if(i==='"'){S();return}if(i==="-"||i>="0"&&i<="9"){y();return}if(i==="{"||i==="["){a++,v.push({kind:i,first:!0});return}h()};try{if(x(),a>=f)return null;T();while(v.length){let i=v[v.length-1];x();let k=i.kind==="{"?"}":"]";if(l[a]===k&&i.first){a++,v.pop();continue}if(!i.first){if(l[a]===k){a++,v.pop();continue}if(l[a]!==",")E();a++,x()}if(i.first=!1,i.kind==="{"){if(l[a]!=='"')E();if(S(),x(),l[a]!==":")E();a++}T()}if(x(),a<f)p("map.jsonTrailing");return null}catch(i){if(i instanceof m)return i.p;throw i}}function B(l,a,f){if(l.trim()==="")return{value:null,empty:!0,error:null,errorLine:null};let m=X(l);if(m){let E=f(m.key,m.token!==void 0?{token:m.token}:{});return{value:null,empty:!1,error:f("map.jsonInvalidAt",{line:m.line,column:m.column,message:E}),errorLine:m.line}}let p=JSON.parse(l),x=a?a(p):null;if(x?.length)return{value:p,empty:!1,error:f("map.jsonErrors",{n:x.length,first:x[0]}),errorLine:null};return{value:p,empty:!1,error:null,errorLine:null}}var K=(l)=>l===null||l===void 0?"":typeof l==="string"?l:JSON.stringify(l,null,2);function C(l){try{return JSON.stringify(JSON.parse(l))}catch{return l}}function M(l,a){try{let f=JSON.parse(l);return a?JSON.stringify(f,null,a):JSON.stringify(f)}catch{return null}}function R(l,a,f){let m=new Intl.NumberFormat(a);return f("map.jsonStatus",{lines:m.format(F(l)),chars:m.format(l.length)})}var F=(l)=>Math.max(1,l.split(`
|
|
5
|
+
`).length);function V(l,a,f){return{text:l.slice(0,a)+" "+l.slice(f),caret:a+2}}function A(l,a){if((l.key==="m"||l.key==="M")&&l.ctrlKey&&!l.altKey&&!l.metaKey)return"toggleTab";if(l.key==="Tab"&&!l.shiftKey&&!l.ctrlKey&&!l.altKey&&!l.metaKey&&!a.readonly&&!a.tabMovesFocus)return"indent";return null}function P(l){return["poad-json-editor",l.invalid&&"is-invalid",l.readonly&&"is-readonly",l.className].filter(Boolean).join(" ")}var z=(l)=>({"--poad-je-h":l||"280px"}),D=(l)=>l==="text"?null:`poad-json-editor__t--${l}`;var J={text:"",error:null,errorLine:null,lines:1,announce:"",tabMovesFocus:!1},Y=700;function H(l){let a={mode:"object",t:(y)=>y},f=J,m=null,p=globalThis,x=(y)=>{f={...f,...y},l.onState(f)},E=(y)=>{if(m!==null)p.clearTimeout(m);if(m=null,!y){if(f.announce)x({announce:""});return}m=p.setTimeout(()=>{m=null,x({announce:y})},Y)},S=(y,h)=>{let v=B(y,a.validator,a.t);if(x({text:y,error:v.error,errorLine:v.errorLine,lines:F(y)}),E(v.error),l.onInvalid?.(v.error),!h)return;if(a.mode==="string")l.onValue?.(y);else if(!v.error)l.onValue?.(v.empty?null:v.value),l.onParsed?.(v.value)};return{set(y){a=y},setValue(y){let h=K(y);if(h===f.text)return;if(!f.error&&C(f.text)===C(h)&&f.text!=="")return;S(h,!1)},input:(y)=>S(y,!0),keydown(y,h){let v=A(y,{readonly:!!a.readonly,tabMovesFocus:f.tabMovesFocus});if(v==="toggleTab"){let i=!f.tabMovesFocus;return x({tabMovesFocus:i,announce:a.t(i?"code.tabMovesFocusOn":"code.tabMovesFocusOff")}),!0}if(v!=="indent")return!1;let T=V(h.value,h.selectionStart??h.value.length,h.selectionEnd??h.value.length);return h.value=T.text,h.selectionStart=h.selectionEnd=T.caret,S(T.text,!0),!0},format(y){let h=M(f.text,y);if(h!==null)S(h,!0)},revalidate:()=>S(f.text,!1),state:()=>f,destroy(){if(m!==null)p.clearTimeout(m);m=null}}}function W(l,a="data.json"){let f=document.createElement("a");f.href=URL.createObjectURL(new Blob([l],{type:"application/json"})),f.download=a,f.click(),URL.revokeObjectURL(f.href)}var ro=r({name:"PoadJsonEditor",props:{modelValue:{type:[Object,Array,String,Number,Boolean],default:null},mode:{type:String,default:"object"},height:{type:String,default:"280px"},placeholder:{type:String,default:"{ }"},readonly:Boolean,toolbar:{type:Boolean,default:!0},ariaLabel:String,validator:{type:Function,default:null}},emits:{"update:modelValue":(l)=>!0,invalid:(l)=>!0,parsed:(l)=>!0},setup(l,{emit:a,expose:f}){let m=o(),p=d(),x=`poad-je-msg-${p}`,E=`poad-je-hint-${p}`,S=c(J),y=t(null),h=t(null),v=t(null),T=t(null),i=H({onState:(j)=>{S.value=j},onValue:(j)=>a("update:modelValue",j),onParsed:(j)=>a("parsed",j),onInvalid:(j)=>a("invalid",j)}),k=()=>i.set({mode:l.mode,validator:l.validator,readonly:l.readonly,t:(j,_)=>m.t(j,_)});k(),i.setValue(l.modelValue),s(()=>l.modelValue,(j)=>i.setValue(j)),s(()=>[l.mode,l.validator,l.readonly,m.locale],()=>{k(),i.revalidate()}),u(()=>i.destroy()),f({format:(j)=>i.format(j),setText:(j)=>i.input(j),download:(j)=>W(i.state().text,j),focus:()=>y.value?.focus()});let I=()=>{let j=y.value;if(!j||!h.value||!v.value)return;h.value.scrollTop=j.scrollTop,h.value.scrollLeft=j.scrollLeft,v.value.scrollTop=j.scrollTop};return()=>{let{t:j}=m,_=S.value,O=(b,w,L,N=!1)=>e(Ie,{content:b},()=>e(g,{type:"button",size:"sm",severity:"ghost",icon:!0,"aria-label":b,disabled:N,onClick:L},()=>e(n,{name:w,size:13}))),q=Array.from({length:_.lines},(b,w)=>w+1);return e("div",{class:P({invalid:!!_.error,readonly:l.readonly}),style:z(l.height)},[l.toolbar?e("div",{class:"poad-json-editor__bar"},[e("span",{class:_.error?"poad-json-editor__status is-error":"poad-json-editor__status"},_.error??R(_.text,m.locale,j)),e("div",{class:"poad-json-editor__tools"},[O(j("map.jsonFormat"),"list",()=>i.format(2),l.readonly||!!_.error),O(j("map.jsonCompact"),"minimize",()=>i.format(0),l.readonly||!!_.error),O(j("common.copy"),"copy",()=>{navigator.clipboard?.writeText(_.text).catch(()=>{})}),l.readonly?null:O(j("common.paste"),"inbox",()=>{navigator.clipboard?.readText().then((b)=>i.input(b),()=>{})}),l.readonly?null:O(j("map.importFile"),"upload",()=>T.value?.click()),l.readonly?null:e("input",{ref:T,type:"file",accept:".json,.geojson,application/json",hidden:!0,onChange:(b)=>{let w=b.target,L=w.files?.[0];if(L)L.text().then((N)=>i.input(N));w.value=""}}),O(j("common.download"),"download",()=>W(_.text))])]):null,e("div",{class:"poad-json-editor__ed"},[e("div",{ref:v,class:"poad-json-editor__gutter","aria-hidden":"true"},q.map((b)=>e("i",{key:b,class:b===_.errorLine?"is-error":void 0},String(b)))),e("div",{class:"poad-json-editor__area"},[e("pre",{ref:h,class:"poad-json-editor__hl","aria-hidden":"true"},[...U(_.text).map((b)=>{let w=D(b.kind);return w?e("span",{class:w},b.text):b.text}),`
|
|
6
|
+
`]),e("textarea",{ref:y,spellcheck:!1,autocapitalize:"off",autocomplete:"off",wrap:"off",value:_.text,readonly:l.readonly,placeholder:l.placeholder,"aria-invalid":String(!!_.error),"aria-label":m.text(l.ariaLabel,"map.jsonEditor"),"aria-describedby":`${x} ${E}`,onInput:(b)=>i.input(b.target.value),onScroll:I,onKeydown:(b)=>{if(i.keydown(b,b.target))b.preventDefault()}})])]),e("p",{class:"poad-json-editor__msg",id:x},_.error??""),e("p",{class:"poad-json-editor__hint",id:E},j("code.tabHint")),e("div",{class:"poad-json-editor__live","aria-live":"polite"},_.announce)])}}});
|
|
7
|
+
export{ro};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{se}from"./c-yrfjn186.js";import"./c-8zzjexhj.js";import"./c-4xcsa9sp.js";import"./c-81zrdysm.js";export{se as PoadSelect};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{g}from"./c-90cnzxxw.js";import{vo,Te}from"./c-yg69d4wg.js";import{x}from"./c-akbde6sp.js";import{C}from"./c-dzx0rg0g.js";import{o}from"./c-t3at1w4r.js";import{Fe,w,r,d,fr,i,e}from"./c-d15cp8ae.js";var _=(l)=>`${l}-msg`,h=(l)=>!!l.error;function y(l){if(l.error)return{id:_(l.id),text:l.error,error:!0,role:"alert",className:"poad-field__msg is-error"};if(l.hint)return{id:_(l.id),text:l.hint,error:!1,role:null,className:"poad-field__msg"};return null}function z(l){return{"aria-describedby":y(l)?.id??null,"aria-invalid":h(l)?"true":null}}function I(l){return{"is-invalid":h(l),"is-disabled":!!l.disabled,"is-inline":!!l.inline,"size-sm":l.size==="sm","size-lg":l.size==="lg","is-plain":!!l.plain}}function B(l){return{"size-sm":l.size==="sm","size-lg":l.size==="lg","is-invalid":!!l.invalid,"is-mono":!!l.mono}}function S(l,t){return{"aria-invalid":l.invalid||t?.["aria-invalid"]==="true"?"true":null,"aria-describedby":t?.["aria-describedby"]??null}}var P=(l)=>`${l+2}px`;var N=Symbol("poad-field-binding"),q=Symbol("poad-field"),yo=r({name:"PoadField",props:{label:String,hint:String,error:String,required:Boolean,disabled:Boolean,inline:Boolean,size:{type:String,default:"md"},plain:Boolean,optionalText:String,optional:Boolean,id:String,data:{type:Object,default:null},store:{type:[Object,String],default:null},field:{type:String,default:null}},setup(l,{slots:t}){let{text:u,t:v}=o(),c=d(),n=Te(()=>x(l.data,l.store,l.field),!1);Fe(vo,()=>x(l.data,l.store,l.field)),Fe(N,n);let s=i(()=>{let a=n.view.value;return{...l,id:c,error:a?.message??l.error,required:l.required||!!a?.required}});return Fe(q,i(()=>({controlId:l.id??c,control:z(s.value)}))),()=>{let a=y(s.value),b=l.optionalText??(l.optional?u(null,"field.optional"):""),f=n.state.value,m=!!f?.conflict;return e("div",{class:C("poad-field",{...I(s.value),"is-dirty":!!f?.dirty,"is-saving":!!f?.saving,"is-conflict":m})},[l.label&&e("label",{class:"poad-field__label",for:l.id??c},[l.label,s.value.required&&e("span",{class:"poad-field__req","aria-hidden":"true"},"*"),b&&e("span",{class:"poad-field__opt"},b),f?.dirty&&e("span",{class:"poad-field__mod"},v("data.modified"))]),e("div",{class:"poad-field__box"},t.default?.()),a&&e("div",{class:a.className+(m?" is-conflict":""),id:a.id,role:a.role??void 0},a.text),m&&e("div",{class:"poad-field__actions"},[e(g,{size:"sm",variant:"outline",severity:"secondary",type:"button","data-choice":"mine",onClick:()=>n.binding.value?.resolve("mine")},()=>v("data.keep_mine")),e(g,{size:"sm",variant:"outline",severity:"secondary",type:"button","data-choice":"theirs",onClick:()=>n.binding.value?.resolve("theirs")},()=>v("data.take_theirs"))])])}}}),F=(l)=>r({name:l==="input"?"PoadInput":"PoadTextarea",inheritAttrs:!1,props:{modelValue:{type:[String,Number],default:void 0},size:String,invalid:Boolean,mono:Boolean,autosize:Boolean},emits:{"update:modelValue":(t)=>!0},setup(t,{attrs:u,emit:v}){let c=w(q,null),n=w(N,null);return()=>{let s=!!n?.binding.value,a=s?n.value():void 0,b=S({invalid:t.invalid},c?.value.control),f=[u["aria-describedby"],b["aria-describedby"]].filter(Boolean).join(" ")||void 0;return e(l,fr(u,{id:u.id??c?.value.controlId,class:["poad-input",B(t)],"aria-invalid":b["aria-invalid"]??u["aria-invalid"],"aria-describedby":f,...s?{value:a==null?"":String(a)}:t.modelValue!==void 0?{value:t.modelValue}:{},onInput:(m)=>{if(s)n.input(m.target.value);let p=m.target;if(t.autosize&&l==="textarea")p.style.height="auto",p.style.height=P(p.scrollHeight);v("update:modelValue",p.value)}}))}}}),rn=F("input"),bo=F("textarea");
|
|
2
|
+
export{yo,rn,bo};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{hr}from"./c-
|
|
1
|
+
import{hr}from"./c-d15cp8ae.js";var D=hr(function(C,O){/*! For license information please see bundle.js.LICENSE.txt */(function(P,S){typeof C=="object"&&typeof O=="object"?O.exports=S():typeof define=="function"&&define.amd?define([],S):typeof C=="object"?C.Alert=S():P.Alert=S()})(self,()=>(()=>{var P={800:(n,r,e)=>{e.d(r,{Z:()=>c});var s=e(81),g=e.n(s),l=e(645),o=e.n(l)()(g());o.push([n.id,".cdx-alert{position:relative;padding:10px;border-radius:5px;margin-bottom:10px}.cdx-alert-primary{background-color:#ebf8ff;border:1px solid #4299e1;color:#2b6cb0}.cdx-alert-secondary{background-color:#f7fafc;border:1px solid #cbd5e0;color:#222731}.cdx-alert-info{background-color:#e6fdff;border:1px solid #4cd4ce;color:#00727c}.cdx-alert-success{background-color:#f0fff4;border:1px solid #68d391;color:#2f855a}.cdx-alert-warning{background-color:#fffaf0;border:1px solid #ed8936;color:#c05621}.cdx-alert-danger{background-color:#fff5f5;border:1px solid #fc8181;color:#c53030}.cdx-alert-light{background-color:#fff;border:1px solid #edf2f7;color:#1a202c}.cdx-alert-dark{background-color:#2d3748;border:1px solid #1a202c;color:#d3d3d3}.cdx-alert-align-left{text-align:left}.cdx-alert-align-center{text-align:center}.cdx-alert-align-right{text-align:right}.cdx-alert__message{outline:none}.cdx-alert [contentEditable=true][data-placeholder]::before{position:absolute;content:attr(data-placeholder);color:#707684;font-weight:normal;opacity:0}.cdx-alert [contentEditable=true][data-placeholder]:empty::before{opacity:1}.cdx-alert [contentEditable=true][data-placeholder]:empty:focus::before{opacity:0}.ce-popover__item[data-item-name=alert-primary] .ce-popover__item-icon svg #background{fill:#ebf8ff;stroke:#4299e1}.ce-popover__item[data-item-name=alert-primary] .ce-popover__item-icon svg #content{fill:#2b6cb0}.ce-popover__item[data-item-name=alert-secondary] .ce-popover__item-icon svg #background{fill:#f7fafc;stroke:#cbd5e0}.ce-popover__item[data-item-name=alert-secondary] .ce-popover__item-icon svg #content{fill:#222731}.ce-popover__item[data-item-name=alert-info] .ce-popover__item-icon svg #background{fill:#e6fdff;stroke:#4cd4ce}.ce-popover__item[data-item-name=alert-info] .ce-popover__item-icon svg #content{fill:#00727c}.ce-popover__item[data-item-name=alert-success] .ce-popover__item-icon svg #background{fill:#f0fff4;stroke:#68d391}.ce-popover__item[data-item-name=alert-success] .ce-popover__item-icon svg #content{fill:#2f855a}.ce-popover__item[data-item-name=alert-warning] .ce-popover__item-icon svg #background{fill:#fffaf0;stroke:#ed8936}.ce-popover__item[data-item-name=alert-warning] .ce-popover__item-icon svg #content{fill:#c05621}.ce-popover__item[data-item-name=alert-danger] .ce-popover__item-icon svg #background{fill:#fff5f5;stroke:#fc8181}.ce-popover__item[data-item-name=alert-danger] .ce-popover__item-icon svg #content{fill:#c53030}.ce-popover__item[data-item-name=alert-light] .ce-popover__item-icon svg #background{fill:#fff;stroke:#edf2f7}.ce-popover__item[data-item-name=alert-light] .ce-popover__item-icon svg #content{fill:#1a202c}.ce-popover__item[data-item-name=alert-dark] .ce-popover__item-icon svg #background{fill:#2d3748;stroke:#1a202c}.ce-popover__item[data-item-name=alert-dark] .ce-popover__item-icon svg #content{fill:#d3d3d3}",""]);let c=o},645:(n)=>{n.exports=function(r){var e=[];return e.toString=function(){return this.map(function(s){var g="",l=s[5]!==void 0;return s[4]&&(g+="@supports (".concat(s[4],") {")),s[2]&&(g+="@media ".concat(s[2]," {")),l&&(g+="@layer".concat(s[5].length>0?" ".concat(s[5]):""," {")),g+=r(s),l&&(g+="}"),s[2]&&(g+="}"),s[4]&&(g+="}"),g}).join("")},e.i=function(s,g,l,o,c){typeof s=="string"&&(s=[[null,s,void 0]]);var m={};if(l)for(var y=0;y<this.length;y++){var b=this[y][0];b!=null&&(m[b]=!0)}for(var k=0;k<s.length;k++){var d=[].concat(s[k]);l&&m[d[0]]||(c!==void 0&&(d[5]===void 0||(d[1]="@layer".concat(d[5].length>0?" ".concat(d[5]):""," {").concat(d[1],"}")),d[5]=c),g&&(d[2]?(d[1]="@media ".concat(d[2]," {").concat(d[1],"}"),d[2]=g):d[2]=g),o&&(d[4]?(d[1]="@supports (".concat(d[4],") {").concat(d[1],"}"),d[4]=o):d[4]="".concat(o)),e.push(d))}},e}},81:(n)=>{n.exports=function(r){return r[1]}},620:(n,r,e)=>{var s=e(379),g=e.n(s),l=e(795),o=e.n(l),c=e(569),m=e.n(c),y=e(565),b=e.n(y),k=e(216),d=e.n(k),w=e(589),A=e.n(w),x=e(800),T={};T.styleTagTransform=A(),T.setAttributes=b(),T.insert=m().bind(null,"head"),T.domAPI=o(),T.insertStyleElement=d(),g()(x.Z,T),x.Z&&x.Z.locals&&x.Z.locals},379:(n)=>{var r=[];function e(l){for(var o=-1,c=0;c<r.length;c++)if(r[c].identifier===l){o=c;break}return o}function s(l,o){for(var c={},m=[],y=0;y<l.length;y++){var b=l[y],k=o.base?b[0]+o.base:b[0],d=c[k]||0,w="".concat(k," ").concat(d);c[k]=d+1;var A=e(w),x={css:b[1],media:b[2],sourceMap:b[3],supports:b[4],layer:b[5]};if(A!==-1)r[A].references++,r[A].updater(x);else{var T=g(x,o);o.byIndex=y,r.splice(y,0,{identifier:w,updater:T,references:1})}m.push(w)}return m}function g(l,o){var c=o.domAPI(o);return c.update(l),function(m){if(m){if(m.css===l.css&&m.media===l.media&&m.sourceMap===l.sourceMap&&m.supports===l.supports&&m.layer===l.layer)return;c.update(l=m)}else c.remove()}}n.exports=function(l,o){var c=s(l=l||[],o=o||{});return function(m){m=m||[];for(var y=0;y<c.length;y++){var b=e(c[y]);r[b].references--}for(var k=s(m,o),d=0;d<c.length;d++){var w=e(c[d]);r[w].references===0&&(r[w].updater(),r.splice(w,1))}c=k}}},569:(n)=>{var r={};n.exports=function(e,s){var g=function(l){if(r[l]===void 0){var o=document.querySelector(l);if(window.HTMLIFrameElement&&o instanceof window.HTMLIFrameElement)try{o=o.contentDocument.head}catch(c){o=null}r[l]=o}return r[l]}(e);if(!g)throw Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");g.appendChild(s)}},216:(n)=>{n.exports=function(r){var e=document.createElement("style");return r.setAttributes(e,r.attributes),r.insert(e,r.options),e}},565:(n,r,e)=>{n.exports=function(s){var g=e.nc;g&&s.setAttribute("nonce",g)}},795:(n)=>{n.exports=function(r){if(typeof document>"u")return{update:function(){},remove:function(){}};var e=r.insertStyleElement(r);return{update:function(s){(function(g,l,o){var c="";o.supports&&(c+="@supports (".concat(o.supports,") {")),o.media&&(c+="@media ".concat(o.media," {"));var m=o.layer!==void 0;m&&(c+="@layer".concat(o.layer.length>0?" ".concat(o.layer):""," {")),c+=o.css,m&&(c+="}"),o.media&&(c+="}"),o.supports&&(c+="}");var y=o.sourceMap;y&&typeof btoa<"u"&&(c+=`
|
|
2
2
|
/*# sourceMappingURL=data:application/json;base64,`.concat(btoa(unescape(encodeURIComponent(JSON.stringify(y))))," */")),l.styleTagTransform(c,g,l.options)})(e,r,s)},remove:function(){(function(s){if(s.parentNode===null)return!1;s.parentNode.removeChild(s)})(e)}}}},589:(n)=>{n.exports=function(r,e){if(e.styleSheet)e.styleSheet.cssText=r;else{for(;e.firstChild;)e.removeChild(e.firstChild);e.appendChild(document.createTextNode(r))}}},749:(n)=>{n.exports='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M18 7L6 7"></path><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M18 17H6"></path><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M16 12L8 12"></path></svg>'},454:(n)=>{n.exports='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M17 7L5 7"></path><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M17 17H5"></path><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M13 12L5 12"></path></svg>'},431:(n)=>{n.exports='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M19 7L7 7"></path><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M19 17H7"></path><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M19 12L11 12"></path></svg>'},654:(n)=>{n.exports='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M5 12a7 7 90 0 1 14 0 7 7 90 0 1-14 0zM12 9.02v-.01M12 12v3"></path></svg>'},338:(n)=>{n.exports='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><rect id="background" width="18" height="18" x="3" y="3" fill="none" stroke="currentColor" stroke-width="1" rx="4"></rect><path id="content" fill="currentColor" stroke-width="0" d="m15.579 16.9-1.042-2.25H10.15L9.11 16.9H7.113L11.697 7h1.266l4.612 9.9h-1.998Zm-4.613-4.05h2.755l-1.377-2.953-1.379 2.953Z"></path></svg>'}},S={};function h(n){var r=S[n];if(r!==void 0)return r.exports;var e=S[n]={id:n,exports:{}};return P[n](e,e.exports,h),e.exports}h.n=(n)=>{var r=n&&n.__esModule?()=>n.default:()=>n;return h.d(r,{a:r}),r},h.d=(n,r)=>{for(var e in r)h.o(r,e)&&!h.o(n,e)&&Object.defineProperty(n,e,{enumerable:!0,get:r[e]})},h.o=(n,r)=>Object.prototype.hasOwnProperty.call(n,r),h.nc=void 0;var j={};return(()=>{h.d(j,{default:()=>F});var n=h(654),r=h.n(n),e=h(338),s=h.n(e),g=h(454),l=h.n(g),o=h(749),c=h.n(o),m=h(431),y=h.n(m);function b(i){return b=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},b(i)}function k(i,t){var u=Object.keys(i);if(Object.getOwnPropertySymbols){var p=Object.getOwnPropertySymbols(i);t&&(p=p.filter(function(a){return Object.getOwnPropertyDescriptor(i,a).enumerable})),u.push.apply(u,p)}return u}function d(i){for(var t=1;t<arguments.length;t++){var u=arguments[t]!=null?arguments[t]:{};t%2?k(Object(u),!0).forEach(function(p){w(i,p,u[p])}):Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(u)):k(Object(u)).forEach(function(p){Object.defineProperty(i,p,Object.getOwnPropertyDescriptor(u,p))})}return i}function w(i,t,u){return(t=M(t))in i?Object.defineProperty(i,t,{value:u,enumerable:!0,configurable:!0,writable:!0}):i[t]=u,i}function A(i){return function(t){if(Array.isArray(t))return x(t)}(i)||function(t){if(typeof Symbol<"u"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}(i)||function(t,u){if(t){if(typeof t=="string")return x(t,u);var p=Object.prototype.toString.call(t).slice(8,-1);return p==="Object"&&t.constructor&&(p=t.constructor.name),p==="Map"||p==="Set"?Array.from(t):p==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(p)?x(t,u):void 0}}(i)||function(){throw TypeError(`Invalid attempt to spread non-iterable instance.
|
|
3
3
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}()}function x(i,t){(t==null||t>i.length)&&(t=i.length);for(var u=0,p=Array(t);u<t;u++)p[u]=i[u];return p}function T(i,t){for(var u=0;u<t.length;u++){var p=t[u];p.enumerable=p.enumerable||!1,p.configurable=!0,"value"in p&&(p.writable=!0),Object.defineProperty(i,M(p.key),p)}}function M(i){var t=function(u,p){if(b(u)!=="object"||u===null)return u;var a=u[Symbol.toPrimitive];if(a!==void 0){var f=a.call(u,"string");if(b(f)!=="object")return f;throw TypeError("@@toPrimitive must return a primitive value.")}return String(u)}(i);return b(t)==="symbol"?t:String(t)}h(620).toString();var F=function(){function i(a){var{data:f,config:_,api:v,readOnly:E}=a;(function(L,I){if(!(L instanceof I))throw TypeError("Cannot call a class as a function")})(this,i),this.api=v,this.alertTypes=_.alertTypes||i.ALERT_TYPES,this.defaultType=_.defaultType||i.DEFAULT_TYPE,this.defaultAlign=_.defaultAlign||i.DEFAULT_ALIGN_TYPE,this.messagePlaceholder=_.messagePlaceholder||i.DEFAULT_MESSAGE_PLACEHOLDER,this.data={type:this.alertTypes.includes(f.type)?f.type:this.defaultType,align:i.ALIGN_TYPES.includes(f.align)?f.align:this.defaultAlign,message:f.message||""},this.container=void 0,this.readOnly=E}var t,u,p;return t=i,u=[{key:"CSS",get:function(){return{wrapper:"cdx-alert",wrapperForType:function(a){return"cdx-alert-".concat(a)},wrapperForAlignType:function(a){return"cdx-alert-align-".concat(a)},message:"cdx-alert__message"}}},{key:"render",value:function(){var a=[this.CSS.wrapper,this.CSS.wrapperForType(this.data.type),this.CSS.wrapperForAlignType(this.data.align)];this.container=this._make("div",a);var f=this._make("div",[this.CSS.message],{contentEditable:!this.readOnly,innerHTML:this.data.message});return f.dataset.placeholder=this.messagePlaceholder,this.container.appendChild(f),this.container}},{key:"renderSettings",value:function(){var a=this,f=this.alertTypes.map(function(v){return{icon:s(),name:"alert-".concat(v),label:a._getFormattedName(v),toggle:"alert",isActive:a.data.type===v,onActivate:function(){a._changeAlertType(v)}}}),_=i.ALIGN_TYPES.map(function(v){return{icon:v=="left"?l():v=="center"?c():v=="right"?y():IconAlign_left,name:"align-".concat(v),label:a._getFormattedName(v),toggle:"align",isActive:a.data.align===v,onActivate:function(){a._changeAlignType(v)}}});return[].concat(A(f),A(_))}},{key:"_getFormattedName",value:function(a){return this.api.i18n.t(a.charAt(0).toUpperCase()+a.slice(1))}},{key:"_changeAlertType",value:function(a){var f=this;this.data.type=a,this.alertTypes.forEach(function(_){var v=f.CSS.wrapperForType(_);f.container.classList.remove(v),a===_&&f.container.classList.add(v)})}},{key:"_changeAlignType",value:function(a){var f=this;this.data.align=a,i.ALIGN_TYPES.forEach(function(_){var v=f.CSS.wrapperForAlignType(_);f.container.classList.remove(v),a===_&&f.container.classList.add(v)})}},{key:"save",value:function(a){var f=a.querySelector(".".concat(this.CSS.message));return d(d({},this.data),{},{message:f.innerHTML})}},{key:"_make",value:function(a){var f,_=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null,v=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},E=document.createElement(a);for(var L in Array.isArray(_)?(f=E.classList).add.apply(f,A(_)):_&&E.classList.add(_),v)E[L]=v[L];return E}},{key:"onPaste",value:function(a){var f=a.detail.data;this.data={type:this.defaultType,message:f.innerHTML||""}}}],p=[{key:"toolbox",get:function(){return{icon:r(),title:"Alert"}}},{key:"enableLineBreaks",get:function(){return!0}},{key:"DEFAULT_TYPE",get:function(){return"info"}},{key:"DEFAULT_ALIGN_TYPE",get:function(){return"left"}},{key:"DEFAULT_MESSAGE_PLACEHOLDER",get:function(){return"Type here..."}},{key:"ALERT_TYPES",get:function(){return["primary","secondary","info","success","warning","danger","light","dark"]}},{key:"ALIGN_TYPES",get:function(){return["left","center","right"]}},{key:"isReadOnlySupported",get:function(){return!0}},{key:"conversionConfig",get:function(){var a=this;return{export:function(f){return f.message},import:function(f){return{message:f,type:a.DEFAULT_TYPE,alignType:a.DEFAULT_ALIGN_TYPE}}}}},{key:"sanitize",get:function(){return{message:!0,type:!1,alignType:!1}}}],u&&T(t.prototype,u),p&&T(t,p),Object.defineProperty(t,"prototype",{writable:!1}),i}()})(),j.default})())});export default D();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{g}from"./c-170fz4v2.js";import{n}from"./c-ytpw5gj2.js";import{ve}from"./c-zhvsa0wq.js";import{lt}from"./c-spzfyqjp.js";import{Ie}from"./c-93kndqea.js";import"./c-z6dbvc3p.js";import{o}from"./c-9hk02377.js";import{t,s,r,h,f,u,e}from"./c-g0ncg08s.js";class q extends Error{code;url;ms;detail;constructor(a,i,l="",d=0){super(`poad-code-editor: Monaco ${a} (${i})${l?` ${l}`:""}`);this.name="PoadMonacoLoadError",this.code=a,this.url=i,this.ms=d,this.detail=l}}var fe={loaderMissing:"code.loadLoaderMissing",noAmd:"code.loadNoAmd",mainFailed:"code.loadMainFailed",notFound:"code.loadNotFound",timeout:"code.loadTimeout"};function Z(a,i){if(a instanceof q)return i(fe[a.code],{url:a.url,ms:a.ms,detail:a.detail});if(a instanceof lt)return i("engine.missing",{pkg:a.pkg});return a instanceof Error?a.message:String(a)}var z={baseUrl:"assets/monaco/min/vs"},ee=z;function oe(a){ee={...z,...a}}function me(a,i){let l=globalThis.document,d=i??l?.baseURI??"http://localhost/",m=(a??"").trim().replace(/\/loader\.js$/,"").replace(/\/+$/,"");if(!m||m==="assets"||m==="./assets")m="assets/monaco/min/vs";else if(/(^|\/)min$/.test(m))m+="/vs";else if(/(^|\/)monaco(-editor)?$/.test(m))m+="/min/vs";else if(!/(^|\/)vs$/.test(m))m+="/vs";return new(W()).URL(m,d).href.replace(/\/+$/,"")}var W=()=>globalThis,D=null,G=new WeakSet;function P(a,i){let l=a.onLoad;if(!l||G.has(l))return;G.add(l);try{l(i)}catch(d){W().console.error("[poad-code-editor] onLoad failed",d)}}var X=(a)=>!!a&&typeof a.editor?.create==="function";function pe(a){return a().then((i)=>{let l=X(i)?i:i?.default;if(!X(l))throw Error("monaco-editor: the module has no `editor` namespace.");return l}).catch((i)=>{throw i instanceof lt?i:new lt("poad-code-editor","monaco-editor",i)})}function ge(a){let i=globalThis,l=globalThis.document,d=me(a.baseUrl??z.baseUrl),m=a.timeout??30000;return new Promise((p,y)=>{let b=!1,M=W(),T=M.setTimeout(()=>C(new q("timeout",d,"",m)),m),w=(x)=>{if(b)return;b=!0,M.clearTimeout(T),p(x)},C=(x)=>{if(b)return;b=!0,M.clearTimeout(T),y(x)},v=()=>{try{let x=i.require;x.config({paths:{vs:d}}),x(["vs/editor/editor.main"],()=>{if(i.monaco?.editor)w(i.monaco);else C(new q("notFound",d))},(O)=>C(new q("mainFailed",d,O?.message??"")))}catch(x){C(x instanceof Error?x:Error(String(x)))}};if(typeof i.require==="function"&&typeof i.require.config==="function"){v();return}if(!l){C(new q("loaderMissing",d));return}let L=l.createElement("script");L.src=`${d}/loader.js`,L.async=!0,L.dataset.poadMonaco="loader",L.onload=()=>{if(typeof i.require==="function"&&typeof i.require.config==="function")v();else C(new q("noAmd",d))},L.onerror=()=>{L.remove(),C(new q("loaderMissing",d))},l.head.appendChild(L)})}function te(a=ee){let i=globalThis;if(i.monaco?.editor)return P(a,i.monaco),Promise.resolve(i.monaco);if(D)return D.then((l)=>(P(a,l),l));return D=(a.load?pe(a.load):ge(a)).then((l)=>(P(a,l),l)).catch((l)=>{throw D=null,l}),D}var he={typescript:"ts",javascript:"js",json:"json",sql:"sql",pgsql:"sql",mysql:"sql",python:"py",java:"java",html:"html",css:"css",scss:"scss",yaml:"yaml",markdown:"md",xml:"xml",shell:"sh",dockerfile:"dockerfile",plaintext:"txt"},ye={typescript:"TypeScript",javascript:"JavaScript",json:"JSON",sql:"SQL",pgsql:"PostgreSQL",mysql:"MySQL",python:"Python",java:"Java",html:"HTML",css:"CSS",scss:"SCSS",yaml:"YAML",markdown:"Markdown",xml:"XML",shell:"Shell",dockerfile:"Dockerfile"};function ne(a){return a==="plaintext"||!a?null:ye[a]??a}function re(a,i,l){if(l)return l.includes("://")?l:`poad:///${l.replace(/^\/+/,"")}`;return`poad:///editeur-${i}.${he[a]??"txt"}`}function ae(a,i){let l=a;for(let d=2;i(l);d++)l=/\.[\w-]+$/.test(a)?a.replace(/(\.[\w-]+)$/,`-${d}$1`):`${a}-${d}`;return l}function be(a){let i=(a??"").trim(),l=/^#([0-9a-f]{3}|[0-9a-f]{6}|[0-9a-f]{8})$/i.exec(i);if(l){let y=l[1];return"#"+(y.length===3?y.split("").map((b)=>b+b).join(""):y).toLowerCase()}let d=/^rgba?\(\s*(\d+)[\s,]+(\d+)[\s,]+(\d+)(?:[\s,/]+([\d.]+)(%?))?\s*\)$/i.exec(i);if(!d)return null;let m=(y)=>Math.max(0,Math.min(255,Math.round(y))).toString(16).padStart(2,"0"),p="#"+m(+d[1])+m(+d[2])+m(+d[3]);if(d[4]!==void 0){let y=d[5]?+d[4]/100:+d[4];if(y<1)p+=m(y*255)}return p}function Ee(a){if(!a||!/^#[0-9a-f]{6}/.test(a))return null;let i=[1,3,5].map((l)=>parseInt(a.slice(l,l+2),16)/255).map((l)=>l<=0.03928?l/12.92:((l+0.055)/1.055)**2.4);return 0.2126*i[0]+0.7152*i[1]+0.0722*i[2]<0.5}function se(a,i){let l=(b)=>be(a(b)),d=l("--poad-input-bg"),m=Ee(d)??i,p={},y=(b,M)=>{if(M)p[b]=M};return y("editor.background",d),y("editor.foreground",l("--poad-fg")),y("editorLineNumber.foreground",l("--poad-fg-muted")),y("editorLineNumber.activeForeground",l("--poad-fg")),y("editor.lineHighlightBackground",l("--poad-bg-subtle")),y("editorGutter.background",d),y("editorCursor.foreground",l("--poad-accent")),{name:m?"poad-dark":"poad-light",base:m?"vs-dark":"vs",colors:p}}function le(a){return["poad-code-editor",a.fullscreen&&"is-fullscreen",a.invalid&&"is-invalid",a.readonly&&"is-readonly",a.className].filter(Boolean).join(" ")}var ie=(a)=>({"--poad-ce-h":a||"280px"}),de=(a,i)=>a&&!i;function xe(){let a=new Map;return{acquire(i,l){let d=a.get(l.key);if(!d)d={count:0,disposables:l.setup(i)??[]},a.set(l.key,d);d.count++;let m=d,p=!1;return()=>{if(p)return;if(p=!0,m.count--,m.count>0)return;for(let y of m.disposables)try{y.dispose()}catch(b){globalThis.console.error("[poad-code-editor] dispose failed",b)}if(a.get(l.key)===m)a.delete(l.key)}},count:(i)=>a.get(i)?.count??0}}var ce=xe();var Se=0,Ce=9,Le="!suggestWidgetVisible && !findWidgetVisible && !parameterHintsVisible && !renameInputVisible && !inSnippetMode && !referenceSearchVisible && !markersNavigationVisible && !accessibilityHelpWidgetVisible && !editorHasMultipleSelections";function ue(a){let i=++Se,l=a.registry??ce,d={value:"",language:"plaintext",ariaLabel:""},m=null,p=null,y=null,b=[],M=[],T=null,w=null,C=null,v=!1,L=!1,x=!1,O=null,B=!1,N=null,E=()=>{let c=a.host.ownerDocument,k=c?.defaultView?c.defaultView.getComputedStyle(a.host):null;return se((_)=>k?.getPropertyValue(_)??"",!!c?.documentElement?.classList?.contains("theme-dark"))},S=()=>{if(!m||d.themed===!1)return;let c=E();m.editor.defineTheme(c.name,{base:c.base,inherit:!0,rules:[],colors:{...c.colors}}),m.editor.setTheme(c.name)},A=()=>{let c=a.host.ownerDocument;return(c?.defaultView?c.defaultView.getComputedStyle(a.host):null)?.getPropertyValue("--poad-font-mono").trim()||void 0},V=(c)=>{if(!m||c===T)return;T=c;let k=M;M=c.map((_)=>l.acquire(m,_));for(let _ of k)_()},U=()=>{if(!a.hintId||!p?.getDomNode)return;p.getDomNode()?.querySelector("textarea")?.setAttribute("aria-describedby",a.hintId)},R=(c)=>{m=c,S();let k=re(d.language,i,d.path),_=ae(k,(F)=>!!c.editor.getModel(c.Uri.parse(F)));y=c.editor.createModel(d.value??"",d.language,c.Uri.parse(_));let H=d.themed===!1?null:E();p=c.editor.create(a.container(),{automaticLayout:!1,minimap:{enabled:!1},scrollBeyondLastLine:!1,fixedOverflowWidgets:!0,fontSize:13,tabSize:2,fontFamily:A(),ariaLabel:d.ariaLabel,...d.options??{},model:y,readOnly:!!d.readOnly,...H?{theme:H.name}:{}});let K=y;if(b.push(K.onDidChangeContent(()=>{if(!v)a.onValue?.(K.getValue())}),p.onDidChangeCursorPosition((F)=>a.onCursor?.({line:F.position.lineNumber,column:F.position.column})),p.onDidBlurEditorWidget(()=>a.onBlur?.())),p.onDidFocusEditorWidget)b.push(p.onDidFocusEditorWidget(()=>a.onFocus?.()));V(d.extensions??[]),U();let J=`poadCodeEditorFullscreen${i}`;N=p.createContextKey?.(J,B)??null,p.addCommand?.(Ce,()=>a.onEscape?.(),`${J} && ${Le}`);let I=globalThis,Q=a.container();if(I.ResizeObserver&&Q){let F=new I.ResizeObserver(()=>p?.layout());F.observe(Q),w=F}let Y=a.host.ownerDocument?.documentElement;if(d.themed!==!1&&I.MutationObserver&&Y){let F=new I.MutationObserver(()=>S());F.observe(Y,{attributes:!0,attributeFilter:["class","data-theme","style"]}),C=F}O=d,a.onState({state:"ready",error:null}),a.onReady?.(p)},j=()=>{if(p||L||x)return;x=!0,a.onState({state:"loading",error:null}),(a.load??(()=>te()))().then((c)=>{if(x=!1,L||p)return;R(c)},(c)=>{if(x=!1,L)return;a.onState({state:"error",error:c})})};return{set(c){if(d=c,!m||!p||!y||L)return;let k=O??c;O=c;let _=c.value??"";if(y.getValue()!==_){v=!0;try{y.setValue(_)}finally{v=!1}}if(c.language!==k.language)m.editor.setModelLanguage(y,c.language);if(c.readOnly!==k.readOnly||c.options!==k.options||c.ariaLabel!==k.ariaLabel)p.updateOptions({...c.options??{},readOnly:!!c.readOnly,ariaLabel:c.ariaLabel});if(c.themed!==k.themed)S();V(c.extensions??[])},mount:j,retry:j,destroy(){L=!0,w?.disconnect(),C?.disconnect(),w=C=null;for(let c of b)c.dispose();b=[];for(let c of M)c();M=[],p?.dispose(),y?.dispose(),p=null,y=null},editor:()=>p,model:()=>y,monaco:()=>m,format:()=>{p?.getAction("editor.action.formatDocument")?.run()},text:()=>y?.getValue()??"",layout:()=>p?.layout(),focus:()=>p?.focus(),hasTextFocus:()=>!!p?.hasTextFocus(),setFullscreen:(c)=>{B=c,N?.set(c)}}}function Be(a){oe(a)}var De=r({name:"PoadCodeEditor",props:{modelValue:{type:String,default:null},language:{type:String,default:"plaintext"},height:{type:String,default:"280px"},readonly:Boolean,disabled:Boolean,invalid:Boolean,toolbar:{type:Boolean,default:!0},themed:{type:Boolean,default:!0},options:{type:Object,default:void 0},path:{type:String,default:null},extensions:{type:Array,default:void 0},ariaLabel:String},emits:{"update:modelValue":(a)=>!0,ready:(a)=>!0,error:(a)=>!0,blur:()=>!0},setup(a,{emit:i,expose:l}){let d=o(),m=`poad-ce-hint-${h()}`,p=t(null),y=t(null),b=t("loading"),M=t(null),T=t(null),w=t(!1),C=t(a.modelValue??"");s(()=>a.modelValue,(E)=>{if(E!==null)C.value=E});let v=null,L=()=>d.text(a.ariaLabel,"code.label"),x=()=>a.readonly||a.disabled,O=()=>({value:C.value,language:a.language,readOnly:x(),options:a.options,path:a.path,themed:a.themed,ariaLabel:L(),extensions:a.extensions}),B=(E)=>{if(E.key==="Escape"&&de(w.value,!!v?.hasTextFocus()))N()};function N(){w.value=!w.value,v?.setFullscreen(w.value),requestAnimationFrame(()=>{v?.layout(),v?.focus()})}return f(()=>{let E=ue({host:p.value,container:()=>y.value,hintId:m,onState:(S)=>{b.value=S.state;let A=S.error?Z(S.error,(V,U)=>d.t(V,U)):null;if(M.value=A,A)i("error",A)},onValue:(S)=>{C.value=S,i("update:modelValue",S)},onCursor:(S)=>{T.value=S},onBlur:()=>i("blur"),onReady:(S)=>{requestAnimationFrame(()=>E.layout()),i("ready",S)},onEscape:N});v=E,E.set(O()),E.mount(),document.addEventListener("keydown",B)}),s(()=>[C.value,a.language,a.readonly,a.disabled,a.options,a.path,a.themed,a.ariaLabel,a.extensions,d.locale],()=>v?.set(O())),u(()=>{document.removeEventListener("keydown",B),v?.destroy(),v=null}),l({getEditor:()=>v?.editor()??null,getModel:()=>v?.model()??null,format:()=>v?.format(),focus:()=>v?.focus()}),()=>{let{t:E}=d,S=b.value==="ready",A=E(w.value?"common.exitFullscreen":"common.fullscreen"),V=(U,R,j)=>e(Ie,{content:U},()=>e(g,{type:"button",size:"sm",severity:"ghost",icon:!0,"aria-label":U,...R},()=>e(n,{name:j,size:13})));return e("div",{ref:p,class:le({fullscreen:w.value,invalid:a.invalid,readonly:x()}),style:ie(a.height)},[a.toolbar?e("div",{class:"poad-code-editor__bar"},[e("span",{class:"poad-code-editor__lang"},ne(a.language)??E("code.plainText")),S&&T.value?e("span",{class:"poad-code-editor__status"},E("code.cursor",T.value)):null,e("span",{class:"poad-code-editor__grow"}),V(E("code.format"),{disabled:!S||x(),onClick:()=>v?.format()},"wand"),V(E("common.copy"),{disabled:!S,onClick:()=>{navigator.clipboard?.writeText(v?.text()??"")}},"copy"),V(A,{pressed:w.value,onClick:N},w.value?"minimize":"maximize")]):null,e("div",{class:"poad-code-editor__box"},[e("div",{ref:y,class:S?"poad-code-editor__host":"poad-code-editor__host is-hidden",role:"group","aria-label":L()}),e("p",{class:"poad-code-editor__hint",id:m},E("code.tabHint")),b.value==="loading"?e("div",{class:"poad-code-editor__state"},[e(ve),e("span",E("common.editorLoading"))]):null,b.value==="error"?e("div",{class:"poad-code-editor__state is-error",role:"alert"},[e("b",E("common.editorLoadFailed")),e("span",M.value??""),e(g,{type:"button",size:"sm",severity:"secondary",onClick:()=>v?.retry()},()=>E("common.retry"))]):null])])}}});export{De as PoadCodeEditor,Be as providePoadMonaco};
|
|
1
|
+
import{g}from"./c-90cnzxxw.js";import{n}from"./c-81zrdysm.js";import{ve}from"./c-fye4ktyb.js";import{lt}from"./c-spzfyqjp.js";import{Ie}from"./c-ehvh73gz.js";import"./c-4xcsa9sp.js";import{o}from"./c-t3at1w4r.js";import{t,s,r,d,f,u,e}from"./c-d15cp8ae.js";class q extends Error{code;url;ms;detail;constructor(a,i,l="",c=0){super(`poad-code-editor: Monaco ${a} (${i})${l?` ${l}`:""}`);this.name="PoadMonacoLoadError",this.code=a,this.url=i,this.ms=c,this.detail=l}}var fe={loaderMissing:"code.loadLoaderMissing",noAmd:"code.loadNoAmd",mainFailed:"code.loadMainFailed",notFound:"code.loadNotFound",timeout:"code.loadTimeout"};function Z(a,i){if(a instanceof q)return i(fe[a.code],{url:a.url,ms:a.ms,detail:a.detail});if(a instanceof lt)return i("engine.missing",{pkg:a.pkg});return a instanceof Error?a.message:String(a)}var z={baseUrl:"assets/monaco/min/vs"},ee=z;function oe(a){ee={...z,...a}}function me(a,i){let l=globalThis.document,c=i??l?.baseURI??"http://localhost/",p=(a??"").trim().replace(/\/loader\.js$/,"").replace(/\/+$/,"");if(!p||p==="assets"||p==="./assets")p="assets/monaco/min/vs";else if(/(^|\/)min$/.test(p))p+="/vs";else if(/(^|\/)monaco(-editor)?$/.test(p))p+="/min/vs";else if(!/(^|\/)vs$/.test(p))p+="/vs";return new(W()).URL(p,c).href.replace(/\/+$/,"")}var W=()=>globalThis,D=null,G=new WeakSet;function P(a,i){let l=a.onLoad;if(!l||G.has(l))return;G.add(l);try{l(i)}catch(c){W().console.error("[poad-code-editor] onLoad failed",c)}}var X=(a)=>!!a&&typeof a.editor?.create==="function";function pe(a){return a().then((i)=>{let l=X(i)?i:i?.default;if(!X(l))throw Error("monaco-editor: the module has no `editor` namespace.");return l}).catch((i)=>{throw i instanceof lt?i:new lt("poad-code-editor","monaco-editor",i)})}function ge(a){let i=globalThis,l=globalThis.document,c=me(a.baseUrl??z.baseUrl),p=a.timeout??30000;return new Promise((h,y)=>{let b=!1,M=W(),T=M.setTimeout(()=>C(new q("timeout",c,"",p)),p),w=(x)=>{if(b)return;b=!0,M.clearTimeout(T),h(x)},C=(x)=>{if(b)return;b=!0,M.clearTimeout(T),y(x)},v=()=>{try{let x=i.require;x.config({paths:{vs:c}}),x(["vs/editor/editor.main"],()=>{if(i.monaco?.editor)w(i.monaco);else C(new q("notFound",c))},(O)=>C(new q("mainFailed",c,O?.message??"")))}catch(x){C(x instanceof Error?x:Error(String(x)))}};if(typeof i.require==="function"&&typeof i.require.config==="function"){v();return}if(!l){C(new q("loaderMissing",c));return}let L=l.createElement("script");L.src=`${c}/loader.js`,L.async=!0,L.dataset.poadMonaco="loader",L.onload=()=>{if(typeof i.require==="function"&&typeof i.require.config==="function")v();else C(new q("noAmd",c))},L.onerror=()=>{L.remove(),C(new q("loaderMissing",c))},l.head.appendChild(L)})}function te(a=ee){let i=globalThis;if(i.monaco?.editor)return P(a,i.monaco),Promise.resolve(i.monaco);if(D)return D.then((l)=>(P(a,l),l));return D=(a.load?pe(a.load):ge(a)).then((l)=>(P(a,l),l)).catch((l)=>{throw D=null,l}),D}var he={typescript:"ts",javascript:"js",json:"json",sql:"sql",pgsql:"sql",mysql:"sql",python:"py",java:"java",html:"html",css:"css",scss:"scss",yaml:"yaml",markdown:"md",xml:"xml",shell:"sh",dockerfile:"dockerfile",plaintext:"txt"},ye={typescript:"TypeScript",javascript:"JavaScript",json:"JSON",sql:"SQL",pgsql:"PostgreSQL",mysql:"MySQL",python:"Python",java:"Java",html:"HTML",css:"CSS",scss:"SCSS",yaml:"YAML",markdown:"Markdown",xml:"XML",shell:"Shell",dockerfile:"Dockerfile"};function ne(a){return a==="plaintext"||!a?null:ye[a]??a}function re(a,i,l){if(l)return l.includes("://")?l:`poad:///${l.replace(/^\/+/,"")}`;return`poad:///editeur-${i}.${he[a]??"txt"}`}function ae(a,i){let l=a;for(let c=2;i(l);c++)l=/\.[\w-]+$/.test(a)?a.replace(/(\.[\w-]+)$/,`-${c}$1`):`${a}-${c}`;return l}function be(a){let i=(a??"").trim(),l=/^#([0-9a-f]{3}|[0-9a-f]{6}|[0-9a-f]{8})$/i.exec(i);if(l){let y=l[1];return"#"+(y.length===3?y.split("").map((b)=>b+b).join(""):y).toLowerCase()}let c=/^rgba?\(\s*(\d+)[\s,]+(\d+)[\s,]+(\d+)(?:[\s,/]+([\d.]+)(%?))?\s*\)$/i.exec(i);if(!c)return null;let p=(y)=>Math.max(0,Math.min(255,Math.round(y))).toString(16).padStart(2,"0"),h="#"+p(+c[1])+p(+c[2])+p(+c[3]);if(c[4]!==void 0){let y=c[5]?+c[4]/100:+c[4];if(y<1)h+=p(y*255)}return h}function Ee(a){if(!a||!/^#[0-9a-f]{6}/.test(a))return null;let i=[1,3,5].map((l)=>parseInt(a.slice(l,l+2),16)/255).map((l)=>l<=0.03928?l/12.92:((l+0.055)/1.055)**2.4);return 0.2126*i[0]+0.7152*i[1]+0.0722*i[2]<0.5}function se(a,i){let l=(b)=>be(a(b)),c=l("--poad-input-bg"),p=Ee(c)??i,h={},y=(b,M)=>{if(M)h[b]=M};return y("editor.background",c),y("editor.foreground",l("--poad-fg")),y("editorLineNumber.foreground",l("--poad-fg-muted")),y("editorLineNumber.activeForeground",l("--poad-fg")),y("editor.lineHighlightBackground",l("--poad-bg-subtle")),y("editorGutter.background",c),y("editorCursor.foreground",l("--poad-accent")),{name:p?"poad-dark":"poad-light",base:p?"vs-dark":"vs",colors:h}}function le(a){return["poad-code-editor",a.fullscreen&&"is-fullscreen",a.invalid&&"is-invalid",a.readonly&&"is-readonly",a.className].filter(Boolean).join(" ")}var ie=(a)=>({"--poad-ce-h":a||"280px"}),de=(a,i)=>a&&!i;function xe(){let a=new Map;return{acquire(i,l){let c=a.get(l.key);if(!c)c={count:0,disposables:l.setup(i)??[]},a.set(l.key,c);c.count++;let p=c,h=!1;return()=>{if(h)return;if(h=!0,p.count--,p.count>0)return;for(let y of p.disposables)try{y.dispose()}catch(b){globalThis.console.error("[poad-code-editor] dispose failed",b)}if(a.get(l.key)===p)a.delete(l.key)}},count:(i)=>a.get(i)?.count??0}}var ce=xe();var Se=0,Ce=9,Le="!suggestWidgetVisible && !findWidgetVisible && !parameterHintsVisible && !renameInputVisible && !inSnippetMode && !referenceSearchVisible && !markersNavigationVisible && !accessibilityHelpWidgetVisible && !editorHasMultipleSelections";function ue(a){let i=++Se,l=a.registry??ce,c={value:"",language:"plaintext",ariaLabel:""},p=null,h=null,y=null,b=[],M=[],T=null,w=null,C=null,v=!1,L=!1,x=!1,O=null,B=!1,N=null,E=()=>{let m=a.host.ownerDocument,k=m?.defaultView?m.defaultView.getComputedStyle(a.host):null;return se((_)=>k?.getPropertyValue(_)??"",!!m?.documentElement?.classList?.contains("theme-dark"))},S=()=>{if(!p||c.themed===!1)return;let m=E();p.editor.defineTheme(m.name,{base:m.base,inherit:!0,rules:[],colors:{...m.colors}}),p.editor.setTheme(m.name)},A=()=>{let m=a.host.ownerDocument;return(m?.defaultView?m.defaultView.getComputedStyle(a.host):null)?.getPropertyValue("--poad-font-mono").trim()||void 0},V=(m)=>{if(!p||m===T)return;T=m;let k=M;M=m.map((_)=>l.acquire(p,_));for(let _ of k)_()},U=()=>{if(!a.hintId||!h?.getDomNode)return;h.getDomNode()?.querySelector("textarea")?.setAttribute("aria-describedby",a.hintId)},R=(m)=>{p=m,S();let k=re(c.language,i,c.path),_=ae(k,(F)=>!!m.editor.getModel(m.Uri.parse(F)));y=m.editor.createModel(c.value??"",c.language,m.Uri.parse(_));let H=c.themed===!1?null:E();h=m.editor.create(a.container(),{automaticLayout:!1,minimap:{enabled:!1},scrollBeyondLastLine:!1,fixedOverflowWidgets:!0,fontSize:13,tabSize:2,fontFamily:A(),ariaLabel:c.ariaLabel,...c.options??{},model:y,readOnly:!!c.readOnly,...H?{theme:H.name}:{}});let K=y;if(b.push(K.onDidChangeContent(()=>{if(!v)a.onValue?.(K.getValue())}),h.onDidChangeCursorPosition((F)=>a.onCursor?.({line:F.position.lineNumber,column:F.position.column})),h.onDidBlurEditorWidget(()=>a.onBlur?.())),h.onDidFocusEditorWidget)b.push(h.onDidFocusEditorWidget(()=>a.onFocus?.()));V(c.extensions??[]),U();let J=`poadCodeEditorFullscreen${i}`;N=h.createContextKey?.(J,B)??null,h.addCommand?.(Ce,()=>a.onEscape?.(),`${J} && ${Le}`);let I=globalThis,Q=a.container();if(I.ResizeObserver&&Q){let F=new I.ResizeObserver(()=>h?.layout());F.observe(Q),w=F}let Y=a.host.ownerDocument?.documentElement;if(c.themed!==!1&&I.MutationObserver&&Y){let F=new I.MutationObserver(()=>S());F.observe(Y,{attributes:!0,attributeFilter:["class","data-theme","style"]}),C=F}O=c,a.onState({state:"ready",error:null}),a.onReady?.(h)},j=()=>{if(h||L||x)return;x=!0,a.onState({state:"loading",error:null}),(a.load??(()=>te()))().then((m)=>{if(x=!1,L||h)return;R(m)},(m)=>{if(x=!1,L)return;a.onState({state:"error",error:m})})};return{set(m){if(c=m,!p||!h||!y||L)return;let k=O??m;O=m;let _=m.value??"";if(y.getValue()!==_){v=!0;try{y.setValue(_)}finally{v=!1}}if(m.language!==k.language)p.editor.setModelLanguage(y,m.language);if(m.readOnly!==k.readOnly||m.options!==k.options||m.ariaLabel!==k.ariaLabel)h.updateOptions({...m.options??{},readOnly:!!m.readOnly,ariaLabel:m.ariaLabel});if(m.themed!==k.themed)S();V(m.extensions??[])},mount:j,retry:j,destroy(){L=!0,w?.disconnect(),C?.disconnect(),w=C=null;for(let m of b)m.dispose();b=[];for(let m of M)m();M=[],h?.dispose(),y?.dispose(),h=null,y=null},editor:()=>h,model:()=>y,monaco:()=>p,format:()=>{h?.getAction("editor.action.formatDocument")?.run()},text:()=>y?.getValue()??"",layout:()=>h?.layout(),focus:()=>h?.focus(),hasTextFocus:()=>!!h?.hasTextFocus(),setFullscreen:(m)=>{B=m,N?.set(m)}}}function Be(a){oe(a)}var De=r({name:"PoadCodeEditor",props:{modelValue:{type:String,default:null},language:{type:String,default:"plaintext"},height:{type:String,default:"280px"},readonly:Boolean,disabled:Boolean,invalid:Boolean,toolbar:{type:Boolean,default:!0},themed:{type:Boolean,default:!0},options:{type:Object,default:void 0},path:{type:String,default:null},extensions:{type:Array,default:void 0},ariaLabel:String},emits:{"update:modelValue":(a)=>!0,ready:(a)=>!0,error:(a)=>!0,blur:()=>!0},setup(a,{emit:i,expose:l}){let c=o(),p=`poad-ce-hint-${d()}`,h=t(null),y=t(null),b=t("loading"),M=t(null),T=t(null),w=t(!1),C=t(a.modelValue??"");s(()=>a.modelValue,(E)=>{if(E!==null)C.value=E});let v=null,L=()=>c.text(a.ariaLabel,"code.label"),x=()=>a.readonly||a.disabled,O=()=>({value:C.value,language:a.language,readOnly:x(),options:a.options,path:a.path,themed:a.themed,ariaLabel:L(),extensions:a.extensions}),B=(E)=>{if(E.key==="Escape"&&de(w.value,!!v?.hasTextFocus()))N()};function N(){w.value=!w.value,v?.setFullscreen(w.value),requestAnimationFrame(()=>{v?.layout(),v?.focus()})}return f(()=>{let E=ue({host:h.value,container:()=>y.value,hintId:p,onState:(S)=>{b.value=S.state;let A=S.error?Z(S.error,(V,U)=>c.t(V,U)):null;if(M.value=A,A)i("error",A)},onValue:(S)=>{C.value=S,i("update:modelValue",S)},onCursor:(S)=>{T.value=S},onBlur:()=>i("blur"),onReady:(S)=>{requestAnimationFrame(()=>E.layout()),i("ready",S)},onEscape:N});v=E,E.set(O()),E.mount(),document.addEventListener("keydown",B)}),s(()=>[C.value,a.language,a.readonly,a.disabled,a.options,a.path,a.themed,a.ariaLabel,a.extensions,c.locale],()=>v?.set(O())),u(()=>{document.removeEventListener("keydown",B),v?.destroy(),v=null}),l({getEditor:()=>v?.editor()??null,getModel:()=>v?.model()??null,format:()=>v?.format(),focus:()=>v?.focus()}),()=>{let{t:E}=c,S=b.value==="ready",A=E(w.value?"common.exitFullscreen":"common.fullscreen"),V=(U,R,j)=>e(Ie,{content:U},()=>e(g,{type:"button",size:"sm",severity:"ghost",icon:!0,"aria-label":U,...R},()=>e(n,{name:j,size:13})));return e("div",{ref:h,class:le({fullscreen:w.value,invalid:a.invalid,readonly:x()}),style:ie(a.height)},[a.toolbar?e("div",{class:"poad-code-editor__bar"},[e("span",{class:"poad-code-editor__lang"},ne(a.language)??E("code.plainText")),S&&T.value?e("span",{class:"poad-code-editor__status"},E("code.cursor",T.value)):null,e("span",{class:"poad-code-editor__grow"}),V(E("code.format"),{disabled:!S||x(),onClick:()=>v?.format()},"wand"),V(E("common.copy"),{disabled:!S,onClick:()=>{navigator.clipboard?.writeText(v?.text()??"")}},"copy"),V(A,{pressed:w.value,onClick:N},w.value?"minimize":"maximize")]):null,e("div",{class:"poad-code-editor__box"},[e("div",{ref:y,class:S?"poad-code-editor__host":"poad-code-editor__host is-hidden",role:"group","aria-label":L()}),e("p",{class:"poad-code-editor__hint",id:p},E("code.tabHint")),b.value==="loading"?e("div",{class:"poad-code-editor__state"},[e(ve),e("span",E("common.editorLoading"))]):null,b.value==="error"?e("div",{class:"poad-code-editor__state is-error",role:"alert"},[e("b",E("common.editorLoadFailed")),e("span",M.value??""),e(g,{type:"button",size:"sm",severity:"secondary",onClick:()=>v?.retry()},()=>E("common.retry"))]):null])])}}});export{De as PoadCodeEditor,Be as providePoadMonaco};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{Er}from"./c-traxh6dd.js";export{Er as PoadSlider};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a,E,R,V,ce,sa,N,te,kt,Re,fe,M,Ce,tt,nt,Ne,rt,ot,aa,Ee,_o,zt,ar,rn,la,on}from"./c-tjk566f2.js";import{o}from"./c-9hk02377.js";import{c,w,s,f,u,re,i}from"./c-g0ncg08s.js";var q=new Map;function Y(e,t){let r=q.get(e);if(!r)r=t(),q.set(e,r);return r}var W=/^(\d{4})-(\d{2})-(\d{2})$/;function ve(e){if(e instanceof Date)return Number.isNaN(e.getTime())?null:e;if(typeof e==="number")return Number.isFinite(e)?new Date(e):null;if(typeof e!=="string"||!e)return null;let t=W.exec(e),r=t?new Date(Number(t[1]),Number(t[2])-1,Number(t[3])):/^\d{4}-\d{2}-\d{2}[T ]/.test(e)?new Date(e):null;return r&&!Number.isNaN(r.getTime())?r:null}function k(e,t,r){if(e===null||e===void 0||e==="")return"";let n=t.fieldType??t.type??"text",l=t.format??{},d=r.locale;switch(n){case"number":{let h=typeof e==="number"?e:typeof e==="string"&&e.trim()!==""?Number(e):NaN;if(!Number.isFinite(h))return String(e);let p=`n|${d}|${l.currency??""}|${l.percent?1:0}|${l.decimals??""}`;return Y(p,()=>new Intl.NumberFormat(d,{...l.currency?{style:"currency",currency:l.currency}:l.percent?{style:"percent"}:{},...l.decimals!==void 0?{minimumFractionDigits:l.decimals,maximumFractionDigits:l.decimals}:l.currency?{}:{maximumFractionDigits:2}})).format(h)}case"date":case"datetime":{let h=ve(e);if(!h)return String(e);let p=l.date??"short",m=n==="datetime"&&!(typeof e==="string"&&W.test(e)),y=`d|${d}|${p}|${m?1:0}`;return Y(y,()=>new Intl.DateTimeFormat(d,{...p==="short"?{year:"numeric",month:"2-digit",day:"2-digit"}:{dateStyle:p},...m?p==="short"?{hour:"2-digit",minute:"2-digit"}:{timeStyle:"short"}:{}})).format(h)}case"boolean":return typeof e==="boolean"?r.booleanText?r.booleanText(e):String(e):String(e);case"enum":{let h=(t.filterOptions??t.options)?.find((p)=>p.value===e);return h?String(typeof h.label==="string"?h.label:e):String(e)}default:if(typeof e==="object")try{return JSON.stringify(e)}catch{return String(e)}return String(e)}}var Z=(e)=>typeof e==="object"&&e!==null&&Array.isArray(e.path)&&typeof e.subscribe==="function"&&("store"in e);var U=(e)=>Z(e)||Ne(e)||e instanceof a?e:JSON.stringify(e),I=(e,t=2)=>String(e).padStart(t,"0"),Pe=(e)=>`${I(e.getFullYear(),4)}-${I(e.getMonth()+1)}-${I(e.getDate())}`;function je(e,t){if((t==="date"||t==="datetime")&&typeof e==="string"&&e){let r=/^(\d{4})-(\d{2})-(\d{2})$/.exec(e);if(r)return new Date(Number(r[1]),Number(r[2])-1,Number(r[3]));let n=new Date(e);return Number.isNaN(n.getTime())?e:n}return e}function Me(e,t){if(t==="date")return e instanceof Date?Pe(e):e===""?null:e;if(t==="datetime")return e instanceof Date?e.toISOString():e===""?null:e;if(t==="number"){if(e===""||e===null||e===void 0)return null;if(typeof e==="string"){let r=Number(e.replace(",","."));return Number.isFinite(r)?r:e}return e}return e}function _e(e,t){try{let r=(typeof t==="function"?t():t)??ot();if(e instanceof a)throw e;if(Z(e))return{target:e,binding:null,field:null,error:null,registry:r};let{binding:n,store:l}=rt(Ne(e)?e:nt(e),r);if(!M(l)&&!Ce(l))throw new a("unknown_store",`no store named "${n.store}"`,{params:{name:n.store},path:"store"});let d=kt(l,n.field),h=n.fields?.find((p)=>p.field===n.field||p.key===n.field)??(n.fields?.length===1?n.fields[0]:void 0);return{target:d,binding:n,field:h??null,error:null,registry:r}}catch(r){return{target:null,binding:null,field:null,error:E(r),registry:null}}}var Be=(e)=>{let t=e.path;if(e.store.type==="record")return typeof t[0]==="string"?t[0]:null;return typeof t[1]==="string"?t[1]:null};class G{r;cell;stops=[];constructor(e,t){this.r=_e(e,t),this.cell=new V(this.compute(),{start:()=>this.start(),stop:()=>this.stop()})}get target(){return this.r.target}get binding(){return this.r.binding}get(){if(!this.cell.observed)this.sync();return this.cell.get()}subscribe(e){return this.cell.subscribe(e)}toJSON(){throw new a("not_serializable","a field binding cannot be serialised: pass its JSON description instead")}descriptor(){if(this.r.field)return this.r.field;let e=this.r.target;if(!e)return null;let t=Be(e);return t?e.store.fields.rule(t)??null:null}feed=null;feedFor=null;stopFeed=null;localized=null;optionsFeed(){let e=this.descriptor()?.reference;if(!e)return null;let t=JSON.stringify(e);if(this.feed&&this.feedFor===t)return this.feed;if(this.stopFeed?.(),this.stopFeed=null,this.feed=zt(e,this.r.registry),this.feedFor=t,this.cell?.observed)this.listenFeed();return this.feed}listenFeed(){if(!this.feed||this.stopFeed)return;this.stopFeed=this.feed.subscribe(()=>this.sync()),this.wantValue()}wantValue(){let e=this.r.target?.get();this.feed?.want(Array.isArray(e)?e:e===null||e===void 0?[]:[e])}options(e){let t=this.descriptor();if(!t)return null;if(t.reference)return this.optionsFeed()?.get().options??null;if(!t.options)return null;let r=this.localized;if(r&&r.locale===e&&r.source===t.options)return r.out;let n=aa(t.options,e);return this.localized={locale:e,source:t.options,out:n},n}searchOptions(e){this.optionsFeed()?.search(e)}suggest(e,t){let r=this.optionsFeed();if(r)return r.suggest(e);return Promise.resolve(_o(this.options(t)??[],e))}optionOf(e,t){let r=this.optionsFeed();if(r)return r.find(e);return(this.options(t)??[]).find((n)=>Ee(n.value,e))}set(e){let t=this.r.target;if(!t||!t.writable)return;if(R(e,t.get()))return;t.set(e)}setFromControl(e){this.set(Me(e,this.descriptor()?.type))}controlValue(){return je(this.get().value,this.descriptor()?.type)}resolve(e){this.r.target?.resolve(e)}revert(){this.r.target?.revert()}format(e,t){let r=this.descriptor();if(!r)return k(e,{},t);let n=r.options?.map((l)=>({value:l.value,label:ce(l.label,t.locale)}));return k(e,{fieldType:r.type,...r.format?{format:r.format}:{},...n?{options:n}:{}},t)}start(){let e=this.r.target;if(!e)return;if(this.r.field)this.stops.push(e.store.fields.use([this.r.field]));if(this.stops.push(e.subscribe(()=>{this.wantValue(),this.sync()})),this.stops.push(e.status.subscribe(()=>this.sync())),this.stops.push(e.store.subscribe(()=>this.sync())),this.optionsFeed())this.listenFeed();this.sync()}stop(){let e=this.stops;this.stops=[];for(let t of e)t();this.stopFeed?.(),this.stopFeed=null}sync(){let e=this.compute(),t=this.cell.get();if(t.value===e.value&&t.writable===e.writable&&t.dirty===e.dirty&&t.saving===e.saving&&t.error===e.error&&t.conflict===e.conflict&&t.loading===e.loading&&t.field===e.field&&$e(t.choice,e.choice))return;this.cell.set(e)}compute(){let e=this.r.target,t=this.descriptor();if(!e){let d=this.r.error;return{value:void 0,writable:!1,dirty:!1,saving:!1,error:d,conflict:null,loading:!1,field:null,required:!1,errorKey:d?.messageKey??null,...d?.params?{errorParams:d.params}:{},choice:null}}let r=e.status.get(),n=e.store.get(),l=r.error??(n.status==="error"?n.error:null);return{value:e.get(),writable:r.writable,dirty:r.dirty,saving:r.saving,error:l,conflict:r.conflict,loading:n.status==="loading",field:t,required:!!t?.rules?.required,errorKey:l?.messageKey??null,...l?.params?{errorParams:l.params}:{},choice:this.choiceState(t)}}choiceState(e){if(e?.reference){let t=this.feed&&this.feedFor===JSON.stringify(e.reference)?this.feed:null,r=t?t.get():null;return{source:"reference",loading:r?.loading??!1,complete:r?.complete??!1,error:r?.error??null,options:r?.options??null}}if(e?.options)return Ie;return null}}var Ie=Object.freeze({source:"static",loading:!1,complete:!0,error:null,options:null}),$e=(e,t)=>e===t||!!e&&!!t&&e.source===t.source&&e.loading===t.loading&&e.complete===t.complete&&e.error===t.error&&e.options===t.options;function H(e,t={}){return new G(e,t.registry)}function X(e,t,r,n){let l=!!t.conflict,d=l?r("data.conflict_field",{theirs:e.format(t.conflict.theirs,n)||"—"}):t.errorKey?r(t.errorKey,t.errorParams):null,h=[t.dirty?"is-dirty":"",t.saving?"is-saving":"",l?"is-conflict":""].filter(Boolean).join(" ");return{invalid:!!t.error||l,classes:h,message:d,conflict:l,required:t.required}}var z=(e)=>Array.isArray(e)?e:e===null||e===void 0||e===""?[]:[e];function Q(e,t,r,n){let l=[];for(let d of e){let h=r.find((p)=>Ee(p.value,d))??t.optionOf(d,n);if(h)l.push(h)}return l}function ee(e,t,r,n,l={}){let d=e.options(n),h=d??[],p=r==="multiselect"||r==="picklist"||!!l.multiple,m=t.value,y;if(r==="picklist")y=Q(z(m),e,h,n);else if(r==="combo")y=p?Q(z(m),e,h,n):m===null||m===void 0?null:h.find((b)=>Ee(b.value,m))??e.optionOf(m,n)??null;else if(p)y=[...z(m)];else y=m??null;if(!p&&r!=="combo"&&y!==null)y=h.find((b)=>Ee(b.value,y))?.value??y;if(p&&Array.isArray(y)&&r!=="picklist"&&r!=="combo")y=y.map((b)=>h.find((S)=>Ee(S.value,b))?.value??b);let g=t.choice;return{options:d,value:y,loading:!!g?.loading,remote:g?.source==="reference"&&!g.complete,set(b){if(r==="picklist"||r==="combo"&&p){e.setFromControl(z(b).map((S)=>S!==null&&typeof S==="object"?S.value:S));return}if(r==="combo"){if(b===null||b===void 0||b==="")e.setFromControl(null);else if(typeof b==="object")e.setFromControl(b.value);return}e.setFromControl(p?[...z(b)]:b??null)},filter(b){if(g?.source==="reference")e.searchOptions(b)},suggest:(b)=>e.suggest(b,n)}}var ne=/^[A-Za-z_][A-Za-z0-9_]{0,62}$/,Je=/^[A-Za-z_][A-Za-z0-9_]{0,62}(\.[A-Za-z0-9_]{1,63})+$/,K=(e)=>e===null||e===void 0||e==="",Le=(e)=>K(e)||Array.isArray(e)&&e.length===0,se=(e)=>String(e).padStart(2,"0"),_=(e)=>`${e.getFullYear()}-${se(e.getMonth()+1)}-${se(e.getDate())}`;function j(e){let t=null;if(e instanceof Date)t=new Date(e.getTime());else if(typeof e==="number"&&Number.isFinite(e))t=new Date(e);else if(typeof e==="string"){let r=/^(\d{4})-(\d{2})-(\d{2})/.exec(e.trim());if(r)t=e.trim().length>10?new Date(e.trim()):new Date(Number(r[1]),Number(r[2])-1,Number(r[3]))}if(!t||Number.isNaN(t.getTime()))return null;return new Date(t.getFullYear(),t.getMonth(),t.getDate())}var Ve=(e)=>new Date(e.getFullYear(),e.getMonth(),e.getDate()+1),T=(e)=>e===null||typeof e==="string"||typeof e==="boolean"||typeof e==="number"&&Number.isFinite(e)?e:e instanceof Date?e.toISOString():void 0;function qe(e,t){if(e)return e.type;if(typeof t==="number")return"number";if(typeof t==="boolean")return"boolean";if(t instanceof Date)return"date";return"text"}var x=(e,t,r=!1)=>{let n=r?Ve(t):t;return e==="datetime"?n.toISOString():_(n)},v=(e,t)=>({or:[t,{[e]:{is:null}}]});function Ye(e,t,r){if(!ne.test(e)&&!Je.test(e))return;let n=t.matchMode??"contains",l=t.value,d=qe(r,Array.isArray(l)?l.find((g)=>!K(g)):l),h=d==="text"||d==="enum"||d==="json"||d==="geometry",p=d==="date"||d==="datetime",m=(g)=>({[e]:g});if(n==="isEmpty")return h&&d==="text"?{or:[m({is:null}),m({eq:""})]}:m({is:null});if(n==="isNotEmpty")return h&&d==="text"?{and:[m({not:null}),m({ne:""})]}:m({not:null});if(Le(l))return;let y=(g)=>g instanceof Date?_(g):String(g);switch(n){case"contains":return m({ilike:`%${tt(y(l))}%`});case"notContains":return v(e,m({notIlike:`%${tt(y(l))}%`}));case"startsWith":return m({ilike:`${tt(y(l))}%`});case"endsWith":return m({ilike:`%${tt(y(l))}`});case"eq":case"neq":{let g;if(d==="boolean"){let b=l===!0||l==="true"?!0:l===!1||l==="false"?!1:void 0;if(b===void 0)return;g=m({is:b})}else if(p)return ie(e,d,l,n==="eq"?"dateIs":"dateIsNot");else if(d==="text")g=m({ilike:tt(y(l))});else{let b=T(d==="number"?A(l):l);if(b===void 0||b===null)return;g=m({eq:b})}if(n==="eq")return g;return d==="text"?v(e,m({notIlike:tt(y(l))})):v(e,{not:g})}case"lt":case"lte":case"gt":case"gte":{if(p){let b=j(l);if(!b)return;if(n==="lt")return m({lt:x(d,b)});if(n==="lte")return m({lt:x(d,b,!0)});if(n==="gt")return m({gte:x(d,b,!0)});return m({gte:x(d,b)})}let g=T(d==="number"?A(l):l);if(g===void 0||g===null)return;return m({[n]:g})}case"in":case"notIn":{let g=(Array.isArray(l)?l:[l]).map((F)=>T(d==="number"?A(F)??F:F)).filter((F)=>F!==void 0);if(g.length===0)return;let b=g.includes(null),S=g.filter((F)=>F!==null);if(n==="in"){if(!b)return m({in:S});return S.length?{or:[m({in:S}),m({is:null})]}:m({is:null})}if(b)return S.length?{and:[m({notIn:S}),m({not:null})]}:m({not:null});return v(e,m({notIn:S}))}case"between":{let[g,b]=Array.isArray(l)?l:[l,null],S=[];if(p){let F=K(g)?null:j(g),O=K(b)?null:j(b);if(F)S.push(m({gte:x(d,F)}));if(O)S.push(m({lt:x(d,O,!0)}))}else{let F=K(g)?void 0:T(d==="number"?A(g):g),O=K(b)?void 0:T(d==="number"?A(b):b);if(F!==void 0&&F!==null)S.push(m({gte:F}));if(O!==void 0&&O!==null)S.push(m({lte:O}))}if(S.length===0)return;return S.length===1?S[0]:{and:S}}case"dateIs":case"dateIsNot":case"dateBefore":case"dateAfter":return ie(e,p?d:"date",l,n);default:return}}function ie(e,t,r,n){let l=j(r);if(!l)return;let d=(p)=>({[e]:p});if(n==="dateBefore")return d({lt:x(t,l)});if(n==="dateAfter")return d({gte:x(t,l,!0)});let h=t==="datetime"?{and:[d({gte:x(t,l)}),d({lt:x(t,l,!0)})]}:d({eq:_(l)});if(n==="dateIs")return h;return t==="datetime"?{or:[d({lt:x(t,l)}),d({gte:x(t,l,!0)}),d({is:null})]}:v(e,d({ne:_(l)}))}function A(e){if(typeof e==="number")return Number.isFinite(e)?e:void 0;if(typeof e!=="string"||e.trim()==="")return;let t=Number(e.trim().replace(/\s/g,"").replace(",","."));return Number.isFinite(t)?t:void 0}function oe(e,t=[]){let r=[];for(let[n,l]of Object.entries(e??{})){if(!l)continue;let d=t.find((p)=>p.field===n||p.key===n),h=Ye(d?.field??n,l,d);if(h)r.push(h)}if(r.length===0)return;return r.length===1?r[0]:{and:r}}function ae(e){return(e??[]).filter((t)=>(t.order===1||t.order===-1)&&ne.test(t.field)).map((t)=>({column:t.field,direction:t.order===-1?"desc":"asc"}))}var ue=(e)=>e.map((t)=>({field:t.column,order:t.direction==="desc"?-1:1}));var de=Object.freeze([]),he=new Set,pe=Object.freeze({});function me(e){return!!e?.fields&&N(e.fields,"parent").length>0}var P=(e)=>JSON.stringify(e??null);class ge{binding=null;store=null;error=null;dataKey="id";parentKey="parent_id";labelField="label";template=null;roots=null;levels=new Map;cell;stopNamed=null;constructor(e,t){try{let{binding:r,store:n}=rt(e,t);if(!M(n)||r.field!=="")throw new a("invalid_binding",'a tree is bound to a list store (no "field")',{path:"store"});let l=r.fields??[],d=N(l,"parent")[0];if(!d)throw new a("invalid_binding",'a tree needs a field with the role "parent"',{path:"fields"});this.binding=r,this.store=n,this.parentKey=d.field,this.dataKey=N(l,"key")[0]?.field??n.keyColumn,this.labelField=N(l,"label")[0]?.field??l.find((p)=>p.type==="text"&&p.field!==this.dataKey&&p.field!==d.field)?.field??"label";let h=n.description;this.template={table:h.table,...h.select?{select:h.select}:{},...h.where?{where:h.where}:{},...h.order?{order:h.order}:{},...h.include?{include:h.include}:{},...h.version?{version:h.version}:{},...h.fields?{fields:h.fields}:{},...h.realtime!==void 0?{realtime:h.realtime}:{},...h.save?{save:h.save}:{},keyColumn:this.dataKey,pageSize:Re}}catch(r){this.error=E(r)}this.cell=new V(this.compute(),{start:()=>this.start(),stop:()=>this.stop()})}get(){if(!this.cell.observed)this.sync();return this.cell.get()}subscribe(e){return this.cell.subscribe(e)}toJSON(){throw new a("not_serializable","a tree binding cannot be serialised: pass its JSON description instead")}keyOf(e){return e!==null&&typeof e==="object"?e[this.dataKey]:void 0}level(e){let t=this.template,r=t.where?{and:[t.where,{[this.parentKey]:e??null}]}:{[this.parentKey]:e??null},n=fe(this.store.transport,{...t,where:r}),l={store:n,stop:null,stopWrite:null,waiters:[]};return l.stopWrite=n.onWrite((d)=>this.relay(n,d)),l}relay(e,t){for(let r of this.allLevels())if(r.store!==e)r.store.receive(t);if(this.store&&e!==this.store)this.store.receive(t)}allLevels(){return[...this.roots?[this.roots]:[],...this.levels.values()]}listen(e){if(e.stop)return;e.stop=e.store.subscribe(()=>{if(e.store.get().status!=="loading"&&e.waiters.length)for(let t of e.waiters.splice(0))t();this.sync()})}loadChildren(e){let t=this.keyOf(e);if(!this.template||t===void 0||t===null)return Promise.resolve([]);let r=P(t),n=this.levels.get(r);if(!n)n=this.level(t),this.levels.set(r,n);let l=n,d=new Promise((h)=>l.waiters.push(()=>h([])));if(this.cell.observed)this.listen(l);if(this.sync(),l.stop&&l.store.get().status==="ready")for(let h of l.waiters.splice(0))h();return d}hasChildren(e){let t=this.levels.get(P(this.keyOf(e)));if(!t)return!0;let r=t.store.get();return!(r.status==="ready"&&r.rows.length===0)}storeOf(e){for(let r of this.allLevels())if(r.store.get().rows.includes(e))return r.store;let t=P(this.keyOf(e));for(let r of this.allLevels())if(r.store.get().rows.some((n)=>P(this.keyOf(n))===t))return r.store;return null}async retry(){await Promise.all(this.allLevels().map((e)=>e.store.refresh()))}start(){if(!this.template)return;this.roots??=this.level(null),this.listen(this.roots);for(let e of this.levels.values())this.listen(e);this.stopNamed=this.store.onWrite((e)=>{for(let t of this.allLevels())t.store.receive(e)}),this.sync()}stop(){for(let e of this.allLevels())e.stop?.(),e.stop=null;this.stopNamed?.(),this.stopNamed=null}sync(){let e=this.compute(),t=this.cell?.get();if(t&&t.rows===e.rows&&t.status===e.status&&t.error===e.error&&t.edits===e.edits&&We(t.loadingKeys,e.loadingKeys))return;if(this.cell)this.cell.set(e)}lastParts=[];lastRows=de;lastEditsParts=[];lastEdits=pe;compute(){let e={dataKey:this.dataKey,parentKey:this.parentKey,labelField:this.labelField};if(!this.template)return{...e,rows:de,status:"error",loading:!1,error:this.error,loadingKeys:he,edits:pe};let t=this.roots?this.roots.store.get():null,r=[...this.levels.entries()].map(([m,y])=>[m,y.store.get()]),n=[t?.rows,...r.map(([,m])=>m.rows)];if(n.length!==this.lastParts.length||n.some((m,y)=>m!==this.lastParts[y])){this.lastParts=n;let m=new Set,y=[];for(let g of n)for(let b of g??[]){let S=P(this.keyOf(b));if(m.has(S))continue;m.add(S),y.push(b)}this.lastRows=y}let l=[t?.edits,...r.map(([,m])=>m.edits)];if(l.length!==this.lastEditsParts.length||l.some((m,y)=>m!==this.lastEditsParts[y]))this.lastEditsParts=l,this.lastEdits=Object.freeze(Object.assign({},...l.filter(Boolean)));let d=new Set;for(let[m,y]of r)if(y.status==="loading"||y.status==="idle")d.add(JSON.parse(m));let h=t?.error??r.find(([,m])=>m.error)?.[1].error??null,p=t?t.status==="error"||h?"error":t.status:"idle";return{...e,rows:this.lastRows,status:p,loading:t?.status==="loading",error:h,loadingKeys:d.size?d:he,edits:this.lastEdits}}}var We=(e,t)=>e===t||e.size===t.size&&[...e].every((r)=>t.has(r));function ye(e,t={}){let r=(typeof t.registry==="function"?t.registry():t.registry)??ot();return new ge(e,r)}var B=(e)=>typeof e==="object"&&e!==null&&!Array.isArray(e)&&(Object.getPrototypeOf(e)===Object.prototype||Object.getPrototypeOf(e)===null),Fe=(e)=>typeof e==="object"&&e!==null&&Array.isArray(e.path)&&typeof e.subscribe==="function"&&("store"in e);var xe=(e)=>M(e)||Fe(e)||Ne(e)||e instanceof a?e:JSON.stringify(e),be=/^[A-Za-z_][A-Za-z0-9_]{0,62}$/,C=[],we=Object.freeze({}),J=(e,t=2)=>String(e).padStart(t,"0");function Se(e,t){if(e instanceof Date){if(t==="date")return`${J(e.getFullYear(),4)}-${J(e.getMonth()+1)}-${J(e.getDate())}`;return e.toISOString()}return e}function Oe(e,t){let r=null;try{if(r=(typeof t==="function"?t():t)??ot(),e instanceof a)throw e;let n={tree:null,registry:r};if(M(e))return{store:e,binding:null,list:e,field:null,error:null,...n};if(Fe(e))return{store:e.store,binding:null,list:null,field:e,error:null,...n};let{binding:l,store:d}=rt(Ne(e)?e:nt(e),r);if(M(d)&&l.field===""&&me(l))return{store:d,binding:l,list:null,field:null,error:null,tree:ye(e,{registry:r}),registry:r};if(M(d)&&l.field==="")return{store:d,binding:l,list:d,field:null,error:null,...n};if(!M(d)&&!Ce(d))throw new a("unknown_store",`no store named "${l.store}"`,{params:{name:l.store},path:"store"});return{store:d,binding:l,list:null,field:kt(d,l.field),error:null,...n}}catch(n){return{store:null,binding:null,list:null,field:null,error:E(n),tree:null,registry:r}}}class ke{source;registry;r;cell;stops=[];inferred=C;merged=C;columnCache=new Map;lastRows=null;constructor(e,t){this.source=e,this.registry=t,this.r=Oe(e,t),this.cell=new V(this.compute(),{start:()=>this.start(),stop:()=>this.stop()})}get store(){return this.r.store}get binding(){return this.r.binding}get(){if(!this.cell.observed)this.sync();return this.cell.get()}subscribe(e){return this.cell.subscribe(e)}toJSON(){throw new a("not_serializable","a data binding cannot be serialised: pass its JSON description instead")}load(e){let t=this.r.list;if(!t)return;let r=Math.max(1,Math.floor(e.rows||t.get().pageSize)),n=e.multiSortMeta&&e.multiSortMeta.length?e.multiSortMeta:e.sortField?[{field:e.sortField,order:e.sortOrder??1}]:[],l=(e.globalFilter??"").trim(),d=ae(n),h=oe(e.filters,this.merged)??{},p=t.get(),m=r!==p.pageSize||JSON.stringify(d)!==JSON.stringify(p.order)||JSON.stringify(h)!==JSON.stringify(p.filters)||l!==p.search.trim(),y={pageSize:r,order:d,filters:h,search:l};if(!m)y.page=Math.floor(Math.max(0,e.first)/r)+1;if(l&&t.get().searchColumns.length===0){let g=this.textColumns();if(g.length)y.searchColumns=g}t.update(y)}setPage(e,t){let r=this.r.list;if(!r)return;let n=Math.max(1,Math.floor(t||r.get().pageSize));r.update({page:Math.floor(Math.max(0,e)/n)+1,pageSize:n})}setSearch(e){let t=this.r.list;if(!t)return;let r=e.trim(),n={search:r};if(r&&t.get().searchColumns.length===0){let l=this.textColumns();if(l.length)n.searchColumns=l}t.update(n)}listOf(e){return this.r.tree?this.r.tree.storeOf(e):this.r.list}loadChildren(e){return this.r.tree?this.r.tree.loadChildren(e):Promise.resolve([])}hasChildren(e){return this.r.tree?this.r.tree.hasChildren(e):!1}edit(e,t){let r=this.listOf(e),n=Object.entries(t);if(n.length===0)return;if(r){let g=r.keyOf(e);for(let[b,S]of n)r.set(g,b,Se(S,this.merged.find((F)=>F.field===b)?.type));return}let l=this.r.field;if(!l||!l.writable)return;let d=l.get();if(!Array.isArray(d))return;let p=(this.converted?.rows??d).indexOf(e),m=p>=0?p:d.indexOf(e);if(m<0)return;let y=d.map((g,b)=>b===m&&B(g)?{...g,...Object.fromEntries(n.map(([S,F])=>[S,Se(F,this.merged.find((O)=>O.field===S)?.type)]))}:g);l.set(y)}rowEdit(e){let t=this.listOf(e);if(!t)return te;return t.get().edits[t.keyOf(e)]??te}resolveRow(e,t){let r=this.listOf(e);if(r)r.resolve(r.keyOf(e),null,t)}dismissRow(e){let t=this.listOf(e);if(t)t.dismiss(t.keyOf(e))}makeCurrent(e){let t=this.r.tree?null:this.r.list;return t?t.makeCurrent(e):Promise.resolve(!1)}async retry(){if(!this.r.store){let e=this.cell.observed;if(e)this.stop();if(this.r=Oe(this.source,this.registry),e)this.start();this.sync();return}if(this.r.tree)return this.r.tree.retry();await this.r.store.refresh()}columns(e){this.get();let t=this.columnCache.get(e);if(!t){let r=this.merged.map((n)=>{let l=n.reference?this.feeds.get(JSON.stringify(n.reference)):void 0,d=l?.get().options;return l&&d&&d.length?{...n,options:d.map((h)=>({value:h.value,label:h.label}))}:n});t=sa(r,{locale:e}),this.columnCache.set(e,t)}return t}format(e,t,r){let n=this.merged.find((d)=>t.key!==void 0&&d.key===t.key||t.field!==void 0&&d.field===t.field);if(!n)return k(e,{},r);if(n.reference){let d=e===null||e===void 0?void 0:this.feeds.get(JSON.stringify(n.reference))?.find(e);return d?d.label:k(e,{},r)}let l=n.options?.map((d)=>({value:d.value,label:ce(d.label,r.locale)}));return k(e,{fieldType:n.type,...n.format?{format:n.format}:{},...l?{options:l}:{}},r)}textColumns(){return this.merged.filter((e)=>e.type==="text"&&!e.hidden&&be.test(e.field)).map((e)=>e.field)}feeds=new Map;feedStops=[];syncFeeds(e){for(let t of this.merged){if(!t.reference)continue;let r=JSON.stringify(t.reference),n=this.feeds.get(r);if(!n){if(n=zt(t.reference,this.r.registry),this.feeds.set(r,n),this.cell?.observed)this.feedStops.push(n.subscribe(()=>{this.columnCache=new Map,this.refreshCells()}))}let l=new Set;for(let d of e){let h=B(d)?L(d,t.field):void 0;if(h!==null&&h!==void 0)for(let p of Array.isArray(h)?h:[h])l.add(p)}n.want([...l])}}refreshCells(){let e=this.cell.get();this.cell.set({...e,fields:[...e.fields]})}start(){if(this.r.tree){let l=this.r.tree;if(this.r.store&&this.r.binding?.fields)this.stops.push(this.r.store.fields.use(this.r.binding.fields));this.stops.push(l.subscribe(()=>this.sync())),this.sync(),this.listenFeeds();return}let{list:e,field:t,store:r}=this.r,n=this.r.binding?.fields?N(this.r.binding.fields,"search").map((l)=>l.field).filter((l)=>be.test(l)):[];if(e&&n.length)e.setSearchColumns(n);if(r&&this.r.binding?.fields)this.stops.push(r.fields.use(this.r.binding.fields));if(e)this.stops.push(e.subscribe(()=>this.sync()));else if(t&&r)this.stops.push(t.subscribe(()=>this.sync())),this.stops.push(r.subscribe(()=>this.sync()));this.sync(),this.listenFeeds()}listenFeeds(){for(let e of this.feeds.values())this.feedStops.push(e.subscribe(()=>{this.columnCache=new Map,this.refreshCells()}));this.syncFeeds(this.get().rows)}stop(){let e=this.stops;this.stops=[];for(let r of e)r();let t=this.feedStops;this.feedStops=[];for(let r of t)r()}sync(){let e=this.compute();if(Ue(this.cell.get(),e))return;if(this.cell.set(e),this.cell.observed&&this.merged.some((t)=>t.reference))this.syncFeeds(e.rows)}fieldsFor(e){let t=this.r.binding?.fields,r=this.r.binding?.fieldsOnly??!1;if(e!==this.lastRows){if(this.lastRows=e,!r&&e.length>0&&(this.inferred.length===0||la(e,this.inferred))){let l=ar(e),d=new Set(this.inferred.map((h)=>h.key));this.inferred=[...this.inferred,...l.filter((h)=>!d.has(h.key))]}}let n=rn(this.inferred,t,{only:r});if(!Ze(n,this.merged))this.merged=n,this.columnCache=new Map;return this.merged}converted=null;localRows(e,t){let r=this.converted;if(r&&r.raw===e&&r.fields===t)return r.rows;let n=t.filter((d)=>d.type==="datetime"&&!d.field.includes(".")).map((d)=>d.field),l=e;if(n.length){let d=!1,h=e.map((p)=>{if(!B(p))return p;let m=null;for(let y of n){let g=p[y];if(typeof g==="string"&&/^\d{4}-\d{2}-\d{2}[T ]/.test(g)){let b=new Date(g);if(!Number.isNaN(b.getTime()))(m??={...p})[y]=b}}if(m)d=!0;return m??p});if(d)l=h}return this.converted={raw:e,fields:t,rows:l},l}compute(){let{list:e,field:t,store:r,error:n,tree:l}=this.r;if(l){let g=l.get(),b=this.fieldsFor(g.rows);return{mode:"tree",rows:g.error?C:g.rows,total:g.rows.length,first:0,pageSize:g.rows.length,sort:C,search:"",status:g.status,loading:g.loading,error:g.error,fields:b,searchable:!1,edits:g.edits,editable:b.some((S)=>S.editable),tree:{dataKey:g.dataKey,parentKey:g.parentKey,labelField:g.labelField,loadingKeys:g.loadingKeys}}}if(!r)return{mode:"local",rows:C,total:0,first:0,pageSize:0,sort:C,search:"",status:"error",loading:!1,error:n,fields:this.fieldsFor(C),searchable:!1,edits:we,editable:!1};if(e){let g=e.get(),b=this.r.binding?.fields?N(this.r.binding.fields,"search").length>0:!1,S=this.fieldsFor(g.rows);return{mode:"server",rows:g.rows,total:g.total??g.rows.length,first:(g.page-1)*g.pageSize,pageSize:g.pageSize,sort:ue(g.order),search:g.search,status:g.status,loading:g.status==="loading",error:g.error,fields:S,searchable:b||(e.description.search?.length??0)>0,edits:g.edits,editable:S.some((F)=>F.editable),...g.current.active?{current:g.current.row}:{},...g.totals?{totals:g.totals}:{}}}let d=t.get(),h=Array.isArray(d)?d:C,p=this.fieldsFor(h),m=this.localRows(h,p),y=r.get();return{mode:"local",rows:m,total:m.length,first:0,pageSize:m.length,sort:C,search:"",status:y.status,loading:y.status==="loading",error:y.error,fields:p,searchable:!1,edits:we,editable:p.some((g)=>g.editable)&&t.writable}}}function Ze(e,t){return e===t||e.length===t.length&&JSON.stringify(e)===JSON.stringify(t)}function Ue(e,t){return e.mode===t.mode&&e.rows===t.rows&&e.total===t.total&&e.first===t.first&&e.pageSize===t.pageSize&&e.search===t.search&&e.status===t.status&&e.error===t.error&&e.fields===t.fields&&e.searchable===t.searchable&&e.edits===t.edits&&e.editable===t.editable&&JSON.stringify(e.sort)===JSON.stringify(t.sort)&&e.tree?.loadingKeys===t.tree?.loadingKeys&&e.current===t.current&&e.totals===t.totals}function De(e,t={}){return new ke(e,t.registry)}var Ke=(e,t=[10,25,50,100])=>[...new Set([...t,e])].filter((r)=>r>0).sort((r,n)=>r-n);function Ge(e){if(e===te)return"";return[e.dirty?"is-dirty":"",e.saving?"is-saving":"",e.error&&Object.keys(e.conflicts).length===0?"is-error":"",Object.keys(e.conflicts).length?"is-conflict":""].filter(Boolean).join(" ")}function oa(e,t,r){let n=t.mode==="server",l=t.tree?.dataKey??N(t.fields,"key")[0]?.field??(t.fields.some((h)=>h.field==="id")?"id":void 0),d=t.tree?{parentKey:t.tree.parentKey,lazyChildren:!0,loadChildren:(h)=>e.loadChildren(h),hasChildren:(h)=>e.hasChildren(h)}:{};return{value:t.error?C:t.rows,lazy:n,totalRecords:t.total,loading:t.loading,...n?{first:t.first,rows:t.pageSize,sort:t.sort,rowsPerPageOptions:Ke(t.pageSize,r.rowsPerPageOptions)}:{},columns:e.columns(r.locale),cellFormatter:(h,p)=>e.format(h,p,r),paginator:n,showSearch:n&&t.searchable,...l?{dataKey:l}:{},errorKey:t.error?t.error.messageKey:null,...t.error?.params?{errorParams:t.error.params}:{},...t.editable?{editMode:"cell"}:{},rowClass:(h)=>{let p=Ge(e.rowEdit(h));return t.current!==void 0&&t.current!==null&&He(e,h,t.current)?p?`${p} is-current`:"is-current":p},...n?{rowClick:(h)=>void e.makeCurrent(h)}:{},...t.totals?{totalsRow:Xe(e,t,r)}:{},rowMessage:(h)=>{let p=r.t,m=e.rowEdit(h);if(!p||m===te)return null;if(Object.keys(m.conflicts).length>0)return{severity:"conflict",text:p("data.conflict_row"),actions:[{label:p("data.keep_mine"),run:()=>e.resolveRow(h,"mine")},{label:p("data.take_theirs"),run:()=>e.resolveRow(h,"theirs")}]};let y=m.error??Object.values(m.errors)[0]??null;if(!y)return null;return{severity:"error",text:p(y.messageKey,y.params),actions:[{label:p("data.dismiss"),run:()=>e.dismissRow(h)}]}},...d}}function He(e,t,r){if(t===r)return!0;let n=e.store;return n!==null&&n.type==="list"&&n.keyOf(t)===n.keyOf(r)}function Xe(e,t,r){let n=t.totals??{},l={};for(let d of t.fields)for(let h of["sum","avg","min","max"]){let p=n[h];if(p&&d.field in p){l[d.field]=e.format(p[d.field],{field:d.field,key:d.key},r);break}}if(typeof n.count==="number")l.count=String(n.count);return l}function Qe(e,t,r){let n=B(e)?e:{},l=(y)=>y?k(L(n,y.field),{fieldType:y.type,...y.format?{format:y.format}:{}},r):"",d=N(t,"label")[0]??t.find((y)=>y.type==="text"&&!y.hidden&&y.field!=="id"),h=N(t,"description")[0],p=N(t,"image")[0],m=p?L(n,p.field):null;return{label:l(d),description:l(h),image:typeof m==="string"&&m?m:null}}var L=(e,t)=>{let r=e;for(let n of t.split(".")){if(r===null||typeof r!=="object")return;r=r[n]}return r};function ia(e,t,r){let n=t.mode==="server",l=N(t.fields,"key")[0]?.field??(t.fields.some((d)=>d.field==="id")?"id":void 0);return{value:t.error?C:t.rows,lazy:n,totalRecords:t.total,loading:t.loading&&t.rows.length===0,...n?{first:t.first,rows:t.pageSize,rowsPerPageOptions:Ke(t.pageSize,[6,12,24,48])}:{},paginator:n,...l?{dataKey:l}:{},errorKey:t.error?t.error.messageKey:null,...t.error?.params?{errorParams:t.error.params}:{},parts:(d)=>Qe(d,t.fields,r)}}function xt(e){let t=w(on,null),r=c(null),n=c(null),l=null,d=!1,h=void 0,p=()=>{l?.(),l=null;let y=r.value;if(!y||!d)return;l=y.subscribe((g)=>n.value=g),n.value=y.get()},m=(y)=>{let g=y==null?null:xe(y);if(r.value&&g===h)return;h=g,l?.(),l=null,r.value=y==null?null:De(y,{registry:t}),n.value=r.value?r.value.get():null,p()};if(m(e()),s(e,(y)=>m(y)),re())f(()=>{d=!0,p()}),u(()=>{d=!1,l?.(),l=null});return{binding:r,state:n}}var vo=Symbol("poad-bound-field-source");function Te(e,t=!0){let r=w(on,null),n=t?w(vo,null):null,l=o(),d=c(null),h=c(null),p=null,m=!1,y=void 0,g=()=>e()??n?.()??null,b=()=>{p?.(),p=null;let O=d.value;if(!O||!m)return;p=O.subscribe((D)=>h.value=D),h.value=O.get()},S=(O)=>{let D=O==null?null:U(O);if(d.value&&D===y)return;y=D,p?.(),p=null,d.value=O==null?null:H(O,{registry:r}),h.value=d.value?d.value.get():null,b()};if(S(g()),s(g,(O)=>S(O)),re())f(()=>{m=!0,b()}),u(()=>{m=!1,p?.(),p=null});let F=i(()=>{let O=d.value,D=h.value;if(!O||!D)return null;return X(O,D,(ze,Ae)=>l.t(ze,Ae),{locale:l.locale})});return{binding:d,state:h,view:F,value:()=>(h.value,d.value?.controlValue()),input:(O)=>d.value?.setFromControl(O)}}function wt(e,t,r=(n)=>n){return{get value(){return t.binding.value?r(t.value()):e.value},set value(n){if(t.binding.value)t.input(n);e.value=n}}}function le(e,t,r=()=>!1){let n=Te(e),l=o(),d=i(()=>{let h=n.binding.value,p=n.state.value;if(!h||!p)return null;return ee(h,p,t,l.locale,{multiple:r()})});return{bound:n,choice:d,options:(h)=>d.value?.options??h,paths:(h,p=!0)=>d.value?.options?{...h,optionLabel:"label",...p?{optionValue:"value"}:{}}:h,model(h){return{get value(){return d.value?d.value.value:h.value},set value(p){if(d.value)d.value.set(p);h.value=p}}},invalid:(h)=>!!h||!!n.view.value?.invalid,filter:(h)=>d.value?.filter(h)}}
|
|
2
|
-
export{
|
|
1
|
+
import{a,E,R,U,ce,aa,N,te,kt,Ne,fe,M,Ce,tt,nt,Be,rt,ot,la,Ee,_o,zt,ar,on,ca,sn}from"./c-akbde6sp.js";import{o}from"./c-t3at1w4r.js";import{c,w,s,f,u,re,i}from"./c-d15cp8ae.js";var V=new Map;function q(e,t){let r=V.get(e);if(!r)r=t(),V.set(e,r);return r}var Y=/^(\d{4})-(\d{2})-(\d{2})$/;function ve(e){if(e instanceof Date)return Number.isNaN(e.getTime())?null:e;if(typeof e==="number")return Number.isFinite(e)?new Date(e):null;if(typeof e!=="string"||!e)return null;let t=Y.exec(e),r=t?new Date(Number(t[1]),Number(t[2])-1,Number(t[3])):/^\d{4}-\d{2}-\d{2}[T ]/.test(e)?new Date(e):null;return r&&!Number.isNaN(r.getTime())?r:null}function k(e,t,r){if(e===null||e===void 0||e==="")return"";let n=t.fieldType??t.type??"text",l=t.format??{},d=r.locale;switch(n){case"number":{let h=typeof e==="number"?e:typeof e==="string"&&e.trim()!==""?Number(e):NaN;if(!Number.isFinite(h))return String(e);let p=`n|${d}|${l.currency??""}|${l.percent?1:0}|${l.decimals??""}`;return q(p,()=>new Intl.NumberFormat(d,{...l.currency?{style:"currency",currency:l.currency}:l.percent?{style:"percent"}:{},...l.decimals!==void 0?{minimumFractionDigits:l.decimals,maximumFractionDigits:l.decimals}:l.currency?{}:{maximumFractionDigits:2}})).format(h)}case"date":case"datetime":{let h=ve(e);if(!h)return String(e);let p=l.date??"short",m=n==="datetime"&&!(typeof e==="string"&&Y.test(e)),y=`d|${d}|${p}|${m?1:0}`;return q(y,()=>new Intl.DateTimeFormat(d,{...p==="short"?{year:"numeric",month:"2-digit",day:"2-digit"}:{dateStyle:p},...m?p==="short"?{hour:"2-digit",minute:"2-digit"}:{timeStyle:"short"}:{}})).format(h)}case"boolean":return typeof e==="boolean"?r.booleanText?r.booleanText(e):String(e):String(e);case"enum":{let h=(t.filterOptions??t.options)?.find((p)=>p.value===e);return h?String(typeof h.label==="string"?h.label:e):String(e)}default:if(typeof e==="object")try{return JSON.stringify(e)}catch{return String(e)}return String(e)}}var W=(e)=>typeof e==="object"&&e!==null&&Array.isArray(e.path)&&typeof e.subscribe==="function"&&("store"in e);var Z=(e)=>W(e)||Be(e)||e instanceof a?e:JSON.stringify(e),I=(e,t=2)=>String(e).padStart(t,"0"),Pe=(e)=>`${I(e.getFullYear(),4)}-${I(e.getMonth()+1)}-${I(e.getDate())}`;function je(e,t){if((t==="date"||t==="datetime")&&typeof e==="string"&&e){let r=/^(\d{4})-(\d{2})-(\d{2})$/.exec(e);if(r)return new Date(Number(r[1]),Number(r[2])-1,Number(r[3]));let n=new Date(e);return Number.isNaN(n.getTime())?e:n}return e}function Me(e,t){if(t==="date")return e instanceof Date?Pe(e):e===""?null:e;if(t==="datetime")return e instanceof Date?e.toISOString():e===""?null:e;if(t==="number"){if(e===""||e===null||e===void 0)return null;if(typeof e==="string"){let r=Number(e.replace(",","."));return Number.isFinite(r)?r:e}return e}return e}function Re(e,t){try{let r=(typeof t==="function"?t():t)??ot();if(e instanceof a)throw e;if(W(e))return{target:e,binding:null,field:null,error:null,registry:r};let{binding:n,store:l}=rt(Be(e)?e:nt(e),r);if(!M(l)&&!Ce(l))throw new a("unknown_store",`no store named "${n.store}"`,{params:{name:n.store},path:"store"});let d=kt(l,n.field),h=n.fields?.find((p)=>p.field===n.field||p.key===n.field)??(n.fields?.length===1?n.fields[0]:void 0);return{target:d,binding:n,field:h??null,error:null,registry:r}}catch(r){return{target:null,binding:null,field:null,error:E(r),registry:null}}}var _e=(e)=>{let t=e.path;if(e.store.type==="record")return typeof t[0]==="string"?t[0]:null;return typeof t[1]==="string"?t[1]:null};class G{r;cell;stops=[];constructor(e,t){this.r=Re(e,t),this.cell=new U(this.compute(),{start:()=>this.start(),stop:()=>this.stop()})}get target(){return this.r.target}get binding(){return this.r.binding}get(){if(!this.cell.observed)this.sync();return this.cell.get()}subscribe(e){return this.cell.subscribe(e)}toJSON(){throw new a("not_serializable","a field binding cannot be serialised: pass its JSON description instead")}descriptor(){if(this.r.field)return this.r.field;let e=this.r.target;if(!e)return null;let t=_e(e);return t?e.store.fields.rule(t)??null:null}feed=null;feedFor=null;stopFeed=null;localized=null;optionsFeed(){let e=this.descriptor()?.reference;if(!e)return null;let t=JSON.stringify(e);if(this.feed&&this.feedFor===t)return this.feed;if(this.stopFeed?.(),this.stopFeed=null,this.feed=zt(e,this.r.registry),this.feedFor=t,this.cell?.observed)this.listenFeed();return this.feed}listenFeed(){if(!this.feed||this.stopFeed)return;this.stopFeed=this.feed.subscribe(()=>this.sync()),this.wantValue()}wantValue(){let e=this.r.target?.get();this.feed?.want(Array.isArray(e)?e:e===null||e===void 0?[]:[e])}options(e){let t=this.descriptor();if(!t)return null;if(t.reference)return this.optionsFeed()?.get().options??null;if(!t.options)return null;let r=this.localized;if(r&&r.locale===e&&r.source===t.options)return r.out;let n=la(t.options,e);return this.localized={locale:e,source:t.options,out:n},n}searchOptions(e){this.optionsFeed()?.search(e)}suggest(e,t){let r=this.optionsFeed();if(r)return r.suggest(e);return Promise.resolve(_o(this.options(t)??[],e))}optionOf(e,t){let r=this.optionsFeed();if(r)return r.find(e);return(this.options(t)??[]).find((n)=>Ee(n.value,e))}set(e){let t=this.r.target;if(!t||!t.writable)return;if(R(e,t.get()))return;t.set(e)}setFromControl(e){this.set(Me(e,this.descriptor()?.type))}controlValue(){return je(this.get().value,this.descriptor()?.type)}resolve(e){this.r.target?.resolve(e)}revert(){this.r.target?.revert()}format(e,t){let r=this.descriptor();if(!r)return k(e,{},t);let n=r.options?.map((l)=>({value:l.value,label:ce(l.label,t.locale)}));return k(e,{fieldType:r.type,...r.format?{format:r.format}:{},...n?{options:n}:{}},t)}start(){let e=this.r.target;if(!e)return;if(this.r.field)this.stops.push(e.store.fields.use([this.r.field]));if(this.stops.push(e.subscribe(()=>{this.wantValue(),this.sync()})),this.stops.push(e.status.subscribe(()=>this.sync())),this.stops.push(e.store.subscribe(()=>this.sync())),this.optionsFeed())this.listenFeed();this.sync()}stop(){let e=this.stops;this.stops=[];for(let t of e)t();this.stopFeed?.(),this.stopFeed=null}sync(){let e=this.compute(),t=this.cell.get();if(t.value===e.value&&t.writable===e.writable&&t.dirty===e.dirty&&t.saving===e.saving&&t.error===e.error&&t.conflict===e.conflict&&t.loading===e.loading&&t.field===e.field&&$e(t.choice,e.choice))return;this.cell.set(e)}compute(){let e=this.r.target,t=this.descriptor();if(!e){let d=this.r.error;return{value:void 0,writable:!1,dirty:!1,saving:!1,error:d,conflict:null,loading:!1,field:null,required:!1,errorKey:d?.messageKey??null,...d?.params?{errorParams:d.params}:{},choice:null}}let r=e.status.get(),n=e.store.get(),l=r.error??(n.status==="error"?n.error:null);return{value:e.get(),writable:r.writable,dirty:r.dirty,saving:r.saving,error:l,conflict:r.conflict,loading:n.status==="loading",field:t,required:!!t?.rules?.required,errorKey:l?.messageKey??null,...l?.params?{errorParams:l.params}:{},choice:this.choiceState(t)}}choiceState(e){if(e?.reference){let t=this.feed&&this.feedFor===JSON.stringify(e.reference)?this.feed:null,r=t?t.get():null;return{source:"reference",loading:r?.loading??!1,complete:r?.complete??!1,error:r?.error??null,options:r?.options??null}}if(e?.options)return Ie;return null}}var Ie=Object.freeze({source:"static",loading:!1,complete:!0,error:null,options:null}),$e=(e,t)=>e===t||!!e&&!!t&&e.source===t.source&&e.loading===t.loading&&e.complete===t.complete&&e.error===t.error&&e.options===t.options;function H(e,t={}){return new G(e,t.registry)}function X(e,t,r,n){let l=!!t.conflict,d=l?r("data.conflict_field",{theirs:e.format(t.conflict.theirs,n)||"—"}):t.errorKey?r(t.errorKey,t.errorParams):null,h=[t.dirty?"is-dirty":"",t.saving?"is-saving":"",l?"is-conflict":""].filter(Boolean).join(" ");return{invalid:!!t.error||l,classes:h,message:d,conflict:l,required:t.required}}var z=(e)=>Array.isArray(e)?e:e===null||e===void 0||e===""?[]:[e];function Q(e,t,r,n){let l=[];for(let d of e){let h=r.find((p)=>Ee(p.value,d))??t.optionOf(d,n);if(h)l.push(h)}return l}function ee(e,t,r,n,l={}){let d=e.options(n),h=d??[],p=r==="multiselect"||r==="picklist"||!!l.multiple,m=t.value,y;if(r==="picklist")y=Q(z(m),e,h,n);else if(r==="combo")y=p?Q(z(m),e,h,n):m===null||m===void 0?null:h.find((b)=>Ee(b.value,m))??e.optionOf(m,n)??null;else if(p)y=[...z(m)];else y=m??null;if(!p&&r!=="combo"&&y!==null)y=h.find((b)=>Ee(b.value,y))?.value??y;if(p&&Array.isArray(y)&&r!=="picklist"&&r!=="combo")y=y.map((b)=>h.find((S)=>Ee(S.value,b))?.value??b);let g=t.choice;return{options:d,value:y,loading:!!g?.loading,remote:g?.source==="reference"&&!g.complete,set(b){if(r==="picklist"||r==="combo"&&p){e.setFromControl(z(b).map((S)=>S!==null&&typeof S==="object"?S.value:S));return}if(r==="combo"){if(b===null||b===void 0||b==="")e.setFromControl(null);else if(typeof b==="object")e.setFromControl(b.value);return}e.setFromControl(p?[...z(b)]:b??null)},filter(b){if(g?.source==="reference")e.searchOptions(b)},suggest:(b)=>e.suggest(b,n)}}var ne=/^[A-Za-z_][A-Za-z0-9_]{0,62}$/,Je=/^[A-Za-z_][A-Za-z0-9_]{0,62}(\.[A-Za-z0-9_]{1,63})+$/,K=(e)=>e===null||e===void 0||e==="",Le=(e)=>K(e)||Array.isArray(e)&&e.length===0,se=(e)=>String(e).padStart(2,"0"),_=(e)=>`${e.getFullYear()}-${se(e.getMonth()+1)}-${se(e.getDate())}`;function j(e){let t=null;if(e instanceof Date)t=new Date(e.getTime());else if(typeof e==="number"&&Number.isFinite(e))t=new Date(e);else if(typeof e==="string"){let r=/^(\d{4})-(\d{2})-(\d{2})/.exec(e.trim());if(r)t=e.trim().length>10?new Date(e.trim()):new Date(Number(r[1]),Number(r[2])-1,Number(r[3]))}if(!t||Number.isNaN(t.getTime()))return null;return new Date(t.getFullYear(),t.getMonth(),t.getDate())}var Ve=(e)=>new Date(e.getFullYear(),e.getMonth(),e.getDate()+1),T=(e)=>e===null||typeof e==="string"||typeof e==="boolean"||typeof e==="number"&&Number.isFinite(e)?e:e instanceof Date?e.toISOString():void 0;function qe(e,t){if(e)return e.type;if(typeof t==="number")return"number";if(typeof t==="boolean")return"boolean";if(t instanceof Date)return"date";return"text"}var x=(e,t,r=!1)=>{let n=r?Ve(t):t;return e==="datetime"?n.toISOString():_(n)},v=(e,t)=>({or:[t,{[e]:{is:null}}]});function Ye(e,t,r){if(!ne.test(e)&&!Je.test(e))return;let n=t.matchMode??"contains",l=t.value,d=qe(r,Array.isArray(l)?l.find((g)=>!K(g)):l),h=d==="text"||d==="enum"||d==="json"||d==="geometry",p=d==="date"||d==="datetime",m=(g)=>({[e]:g});if(n==="isEmpty")return h&&d==="text"?{or:[m({is:null}),m({eq:""})]}:m({is:null});if(n==="isNotEmpty")return h&&d==="text"?{and:[m({not:null}),m({ne:""})]}:m({not:null});if(Le(l))return;let y=(g)=>g instanceof Date?_(g):String(g);switch(n){case"contains":return m({ilike:`%${tt(y(l))}%`});case"notContains":return v(e,m({notIlike:`%${tt(y(l))}%`}));case"startsWith":return m({ilike:`${tt(y(l))}%`});case"endsWith":return m({ilike:`%${tt(y(l))}`});case"eq":case"neq":{let g;if(d==="boolean"){let b=l===!0||l==="true"?!0:l===!1||l==="false"?!1:void 0;if(b===void 0)return;g=m({is:b})}else if(p)return ie(e,d,l,n==="eq"?"dateIs":"dateIsNot");else if(d==="text")g=m({ilike:tt(y(l))});else{let b=T(d==="number"?A(l):l);if(b===void 0||b===null)return;g=m({eq:b})}if(n==="eq")return g;return d==="text"?v(e,m({notIlike:tt(y(l))})):v(e,{not:g})}case"lt":case"lte":case"gt":case"gte":{if(p){let b=j(l);if(!b)return;if(n==="lt")return m({lt:x(d,b)});if(n==="lte")return m({lt:x(d,b,!0)});if(n==="gt")return m({gte:x(d,b,!0)});return m({gte:x(d,b)})}let g=T(d==="number"?A(l):l);if(g===void 0||g===null)return;return m({[n]:g})}case"in":case"notIn":{let g=(Array.isArray(l)?l:[l]).map((F)=>T(d==="number"?A(F)??F:F)).filter((F)=>F!==void 0);if(g.length===0)return;let b=g.includes(null),S=g.filter((F)=>F!==null);if(n==="in"){if(!b)return m({in:S});return S.length?{or:[m({in:S}),m({is:null})]}:m({is:null})}if(b)return S.length?{and:[m({notIn:S}),m({not:null})]}:m({not:null});return v(e,m({notIn:S}))}case"between":{let[g,b]=Array.isArray(l)?l:[l,null],S=[];if(p){let F=K(g)?null:j(g),O=K(b)?null:j(b);if(F)S.push(m({gte:x(d,F)}));if(O)S.push(m({lt:x(d,O,!0)}))}else{let F=K(g)?void 0:T(d==="number"?A(g):g),O=K(b)?void 0:T(d==="number"?A(b):b);if(F!==void 0&&F!==null)S.push(m({gte:F}));if(O!==void 0&&O!==null)S.push(m({lte:O}))}if(S.length===0)return;return S.length===1?S[0]:{and:S}}case"dateIs":case"dateIsNot":case"dateBefore":case"dateAfter":return ie(e,p?d:"date",l,n);default:return}}function ie(e,t,r,n){let l=j(r);if(!l)return;let d=(p)=>({[e]:p});if(n==="dateBefore")return d({lt:x(t,l)});if(n==="dateAfter")return d({gte:x(t,l,!0)});let h=t==="datetime"?{and:[d({gte:x(t,l)}),d({lt:x(t,l,!0)})]}:d({eq:_(l)});if(n==="dateIs")return h;return t==="datetime"?{or:[d({lt:x(t,l)}),d({gte:x(t,l,!0)}),d({is:null})]}:v(e,d({ne:_(l)}))}function A(e){if(typeof e==="number")return Number.isFinite(e)?e:void 0;if(typeof e!=="string"||e.trim()==="")return;let t=Number(e.trim().replace(/\s/g,"").replace(",","."));return Number.isFinite(t)?t:void 0}function oe(e,t=[]){let r=[];for(let[n,l]of Object.entries(e??{})){if(!l)continue;let d=t.find((p)=>p.field===n||p.key===n),h=Ye(d?.field??n,l,d);if(h)r.push(h)}if(r.length===0)return;return r.length===1?r[0]:{and:r}}function ae(e){return(e??[]).filter((t)=>(t.order===1||t.order===-1)&&ne.test(t.field)).map((t)=>({column:t.field,direction:t.order===-1?"desc":"asc"}))}var ue=(e)=>e.map((t)=>({field:t.column,order:t.direction==="desc"?-1:1}));var de=Object.freeze([]),he=new Set,pe=Object.freeze({});function me(e){return!!e?.fields&&N(e.fields,"parent").length>0}var P=(e)=>JSON.stringify(e??null);class ge{binding=null;store=null;error=null;dataKey="id";parentKey="parent_id";labelField="label";template=null;roots=null;levels=new Map;cell;stopNamed=null;constructor(e,t){try{let{binding:r,store:n}=rt(e,t);if(!M(n)||r.field!=="")throw new a("invalid_binding",'a tree is bound to a list store (no "field")',{path:"store"});let l=r.fields??[],d=N(l,"parent")[0];if(!d)throw new a("invalid_binding",'a tree needs a field with the role "parent"',{path:"fields"});this.binding=r,this.store=n,this.parentKey=d.field,this.dataKey=N(l,"key")[0]?.field??n.keyColumn,this.labelField=N(l,"label")[0]?.field??l.find((p)=>p.type==="text"&&p.field!==this.dataKey&&p.field!==d.field)?.field??"label";let h=n.description;this.template={table:h.table,...h.select?{select:h.select}:{},...h.where?{where:h.where}:{},...h.order?{order:h.order}:{},...h.include?{include:h.include}:{},...h.version?{version:h.version}:{},...h.fields?{fields:h.fields}:{},...h.realtime!==void 0?{realtime:h.realtime}:{},...h.save?{save:h.save}:{},keyColumn:this.dataKey,pageSize:Ne}}catch(r){this.error=E(r)}this.cell=new U(this.compute(),{start:()=>this.start(),stop:()=>this.stop()})}get(){if(!this.cell.observed)this.sync();return this.cell.get()}subscribe(e){return this.cell.subscribe(e)}toJSON(){throw new a("not_serializable","a tree binding cannot be serialised: pass its JSON description instead")}keyOf(e){return e!==null&&typeof e==="object"?e[this.dataKey]:void 0}level(e){let t=this.template,r=t.where?{and:[t.where,{[this.parentKey]:e??null}]}:{[this.parentKey]:e??null},n=fe(this.store.transport,{...t,where:r}),l={store:n,stop:null,stopWrite:null,waiters:[]};return l.stopWrite=n.onWrite((d)=>this.relay(n,d)),l}relay(e,t){for(let r of this.allLevels())if(r.store!==e)r.store.receive(t);if(this.store&&e!==this.store)this.store.receive(t)}allLevels(){return[...this.roots?[this.roots]:[],...this.levels.values()]}listen(e){if(e.stop)return;e.stop=e.store.subscribe(()=>{if(e.store.get().status!=="loading"&&e.waiters.length)for(let t of e.waiters.splice(0))t();this.sync()})}loadChildren(e){let t=this.keyOf(e);if(!this.template||t===void 0||t===null)return Promise.resolve([]);let r=P(t),n=this.levels.get(r);if(!n)n=this.level(t),this.levels.set(r,n);let l=n,d=new Promise((h)=>l.waiters.push(()=>h([])));if(this.cell.observed)this.listen(l);if(this.sync(),l.stop&&l.store.get().status==="ready")for(let h of l.waiters.splice(0))h();return d}hasChildren(e){let t=this.levels.get(P(this.keyOf(e)));if(!t)return!0;let r=t.store.get();return!(r.status==="ready"&&r.rows.length===0)}storeOf(e){for(let r of this.allLevels())if(r.store.get().rows.includes(e))return r.store;let t=P(this.keyOf(e));for(let r of this.allLevels())if(r.store.get().rows.some((n)=>P(this.keyOf(n))===t))return r.store;return null}async retry(){await Promise.all(this.allLevels().map((e)=>e.store.refresh()))}start(){if(!this.template)return;this.roots??=this.level(null),this.listen(this.roots);for(let e of this.levels.values())this.listen(e);this.stopNamed=this.store.onWrite((e)=>{for(let t of this.allLevels())t.store.receive(e)}),this.sync()}stop(){for(let e of this.allLevels())e.stop?.(),e.stop=null;this.stopNamed?.(),this.stopNamed=null}sync(){let e=this.compute(),t=this.cell?.get();if(t&&t.rows===e.rows&&t.status===e.status&&t.error===e.error&&t.edits===e.edits&&We(t.loadingKeys,e.loadingKeys))return;if(this.cell)this.cell.set(e)}lastParts=[];lastRows=de;lastEditsParts=[];lastEdits=pe;compute(){let e={dataKey:this.dataKey,parentKey:this.parentKey,labelField:this.labelField};if(!this.template)return{...e,rows:de,status:"error",loading:!1,error:this.error,loadingKeys:he,edits:pe};let t=this.roots?this.roots.store.get():null,r=[...this.levels.entries()].map(([m,y])=>[m,y.store.get()]),n=[t?.rows,...r.map(([,m])=>m.rows)];if(n.length!==this.lastParts.length||n.some((m,y)=>m!==this.lastParts[y])){this.lastParts=n;let m=new Set,y=[];for(let g of n)for(let b of g??[]){let S=P(this.keyOf(b));if(m.has(S))continue;m.add(S),y.push(b)}this.lastRows=y}let l=[t?.edits,...r.map(([,m])=>m.edits)];if(l.length!==this.lastEditsParts.length||l.some((m,y)=>m!==this.lastEditsParts[y]))this.lastEditsParts=l,this.lastEdits=Object.freeze(Object.assign({},...l.filter(Boolean)));let d=new Set;for(let[m,y]of r)if(y.status==="loading"||y.status==="idle")d.add(JSON.parse(m));let h=t?.error??r.find(([,m])=>m.error)?.[1].error??null,p=t?t.status==="error"||h?"error":t.status:"idle";return{...e,rows:this.lastRows,status:p,loading:t?.status==="loading",error:h,loadingKeys:d.size?d:he,edits:this.lastEdits}}}var We=(e,t)=>e===t||e.size===t.size&&[...e].every((r)=>t.has(r));function ye(e,t={}){let r=(typeof t.registry==="function"?t.registry():t.registry)??ot();return new ge(e,r)}var B=(e)=>typeof e==="object"&&e!==null&&!Array.isArray(e)&&(Object.getPrototypeOf(e)===Object.prototype||Object.getPrototypeOf(e)===null),Fe=(e)=>typeof e==="object"&&e!==null&&Array.isArray(e.path)&&typeof e.subscribe==="function"&&("store"in e);var xe=(e)=>M(e)||Fe(e)||Be(e)||e instanceof a?e:JSON.stringify(e),be=/^[A-Za-z_][A-Za-z0-9_]{0,62}$/,C=[],we=Object.freeze({}),J=(e,t=2)=>String(e).padStart(t,"0");function Se(e,t){if(e instanceof Date){if(t==="date")return`${J(e.getFullYear(),4)}-${J(e.getMonth()+1)}-${J(e.getDate())}`;return e.toISOString()}return e}function Oe(e,t){let r=null;try{if(r=(typeof t==="function"?t():t)??ot(),e instanceof a)throw e;let n={tree:null,registry:r};if(M(e))return{store:e,binding:null,list:e,field:null,error:null,...n};if(Fe(e))return{store:e.store,binding:null,list:null,field:e,error:null,...n};let{binding:l,store:d}=rt(Be(e)?e:nt(e),r);if(M(d)&&l.field===""&&me(l))return{store:d,binding:l,list:null,field:null,error:null,tree:ye(e,{registry:r}),registry:r};if(M(d)&&l.field==="")return{store:d,binding:l,list:d,field:null,error:null,...n};if(!M(d)&&!Ce(d))throw new a("unknown_store",`no store named "${l.store}"`,{params:{name:l.store},path:"store"});return{store:d,binding:l,list:null,field:kt(d,l.field),error:null,...n}}catch(n){return{store:null,binding:null,list:null,field:null,error:E(n),tree:null,registry:r}}}class ke{source;registry;r;cell;stops=[];inferred=C;merged=C;columnCache=new Map;lastRows=null;constructor(e,t){this.source=e,this.registry=t,this.r=Oe(e,t),this.cell=new U(this.compute(),{start:()=>this.start(),stop:()=>this.stop()})}get store(){return this.r.store}get binding(){return this.r.binding}get(){if(!this.cell.observed)this.sync();return this.cell.get()}subscribe(e){return this.cell.subscribe(e)}toJSON(){throw new a("not_serializable","a data binding cannot be serialised: pass its JSON description instead")}load(e){let t=this.r.list;if(!t)return;let r=Math.max(1,Math.floor(e.rows||t.get().pageSize)),n=e.multiSortMeta&&e.multiSortMeta.length?e.multiSortMeta:e.sortField?[{field:e.sortField,order:e.sortOrder??1}]:[],l=(e.globalFilter??"").trim(),d=ae(n),h=oe(e.filters,this.merged)??{},p=t.get(),m=r!==p.pageSize||JSON.stringify(d)!==JSON.stringify(p.order)||JSON.stringify(h)!==JSON.stringify(p.filters)||l!==p.search.trim(),y={pageSize:r,order:d,filters:h,search:l};if(!m)y.page=Math.floor(Math.max(0,e.first)/r)+1;if(l&&t.get().searchColumns.length===0){let g=this.textColumns();if(g.length)y.searchColumns=g}t.update(y)}setPage(e,t){let r=this.r.list;if(!r)return;let n=Math.max(1,Math.floor(t||r.get().pageSize));r.update({page:Math.floor(Math.max(0,e)/n)+1,pageSize:n})}setSearch(e){let t=this.r.list;if(!t)return;let r=e.trim(),n={search:r};if(r&&t.get().searchColumns.length===0){let l=this.textColumns();if(l.length)n.searchColumns=l}t.update(n)}listOf(e){return this.r.tree?this.r.tree.storeOf(e):this.r.list}loadChildren(e){return this.r.tree?this.r.tree.loadChildren(e):Promise.resolve([])}hasChildren(e){return this.r.tree?this.r.tree.hasChildren(e):!1}edit(e,t){let r=this.listOf(e),n=Object.entries(t);if(n.length===0)return;if(r){let g=r.keyOf(e);for(let[b,S]of n)r.set(g,b,Se(S,this.merged.find((F)=>F.field===b)?.type));return}let l=this.r.field;if(!l||!l.writable)return;let d=l.get();if(!Array.isArray(d))return;let p=(this.converted?.rows??d).indexOf(e),m=p>=0?p:d.indexOf(e);if(m<0)return;let y=d.map((g,b)=>b===m&&B(g)?{...g,...Object.fromEntries(n.map(([S,F])=>[S,Se(F,this.merged.find((O)=>O.field===S)?.type)]))}:g);l.set(y)}rowEdit(e){let t=this.listOf(e);if(!t)return te;return t.get().edits[t.keyOf(e)]??te}resolveRow(e,t){let r=this.listOf(e);if(r)r.resolve(r.keyOf(e),null,t)}dismissRow(e){let t=this.listOf(e);if(t)t.dismiss(t.keyOf(e))}makeCurrent(e){let t=this.r.tree?null:this.r.list;return t?t.makeCurrent(e):Promise.resolve(!1)}async retry(){if(!this.r.store){let e=this.cell.observed;if(e)this.stop();if(this.r=Oe(this.source,this.registry),e)this.start();this.sync();return}if(this.r.tree)return this.r.tree.retry();await this.r.store.refresh()}columns(e){this.get();let t=this.columnCache.get(e);if(!t){let r=this.merged.map((n)=>{let l=n.reference?this.feeds.get(JSON.stringify(n.reference)):void 0,d=l?.get().options;return l&&d&&d.length?{...n,options:d.map((h)=>({value:h.value,label:h.label}))}:n});t=aa(r,{locale:e}),this.columnCache.set(e,t)}return t}format(e,t,r){let n=this.merged.find((d)=>t.key!==void 0&&d.key===t.key||t.field!==void 0&&d.field===t.field);if(!n)return k(e,{},r);if(n.reference){let d=e===null||e===void 0?void 0:this.feeds.get(JSON.stringify(n.reference))?.find(e);return d?d.label:k(e,{},r)}let l=n.options?.map((d)=>({value:d.value,label:ce(d.label,r.locale)}));return k(e,{fieldType:n.type,...n.format?{format:n.format}:{},...l?{options:l}:{}},r)}textColumns(){return this.merged.filter((e)=>e.type==="text"&&!e.hidden&&be.test(e.field)).map((e)=>e.field)}feeds=new Map;feedStops=[];syncFeeds(e){for(let t of this.merged){if(!t.reference)continue;let r=JSON.stringify(t.reference),n=this.feeds.get(r);if(!n){if(n=zt(t.reference,this.r.registry),this.feeds.set(r,n),this.cell?.observed)this.feedStops.push(n.subscribe(()=>{this.columnCache=new Map,this.refreshCells()}))}let l=new Set;for(let d of e){let h=B(d)?L(d,t.field):void 0;if(h!==null&&h!==void 0)for(let p of Array.isArray(h)?h:[h])l.add(p)}n.want([...l])}}refreshCells(){let e=this.cell.get();this.cell.set({...e,fields:[...e.fields]})}start(){if(this.r.tree){let l=this.r.tree;if(this.r.store&&this.r.binding?.fields)this.stops.push(this.r.store.fields.use(this.r.binding.fields));this.stops.push(l.subscribe(()=>this.sync())),this.sync(),this.listenFeeds();return}let{list:e,field:t,store:r}=this.r,n=this.r.binding?.fields?N(this.r.binding.fields,"search").map((l)=>l.field).filter((l)=>be.test(l)):[];if(e&&n.length)e.setSearchColumns(n);if(r&&this.r.binding?.fields)this.stops.push(r.fields.use(this.r.binding.fields));if(e)this.stops.push(e.subscribe(()=>this.sync()));else if(t&&r)this.stops.push(t.subscribe(()=>this.sync())),this.stops.push(r.subscribe(()=>this.sync()));this.sync(),this.listenFeeds()}listenFeeds(){for(let e of this.feeds.values())this.feedStops.push(e.subscribe(()=>{this.columnCache=new Map,this.refreshCells()}));this.syncFeeds(this.get().rows)}stop(){let e=this.stops;this.stops=[];for(let r of e)r();let t=this.feedStops;this.feedStops=[];for(let r of t)r()}sync(){let e=this.compute();if(Ue(this.cell.get(),e))return;if(this.cell.set(e),this.cell.observed&&this.merged.some((t)=>t.reference))this.syncFeeds(e.rows)}fieldsFor(e){let t=this.r.binding?.fields,r=this.r.binding?.fieldsOnly??!1;if(e!==this.lastRows){if(this.lastRows=e,!r&&e.length>0&&(this.inferred.length===0||ca(e,this.inferred))){let l=ar(e),d=new Set(this.inferred.map((h)=>h.key));this.inferred=[...this.inferred,...l.filter((h)=>!d.has(h.key))]}}let n=on(this.inferred,t,{only:r});if(!Ze(n,this.merged))this.merged=n,this.columnCache=new Map;return this.merged}converted=null;localRows(e,t){let r=this.converted;if(r&&r.raw===e&&r.fields===t)return r.rows;let n=t.filter((d)=>d.type==="datetime"&&!d.field.includes(".")).map((d)=>d.field),l=e;if(n.length){let d=!1,h=e.map((p)=>{if(!B(p))return p;let m=null;for(let y of n){let g=p[y];if(typeof g==="string"&&/^\d{4}-\d{2}-\d{2}[T ]/.test(g)){let b=new Date(g);if(!Number.isNaN(b.getTime()))(m??={...p})[y]=b}}if(m)d=!0;return m??p});if(d)l=h}return this.converted={raw:e,fields:t,rows:l},l}compute(){let{list:e,field:t,store:r,error:n,tree:l}=this.r;if(l){let g=l.get(),b=this.fieldsFor(g.rows);return{mode:"tree",rows:g.error?C:g.rows,total:g.rows.length,first:0,pageSize:g.rows.length,sort:C,search:"",status:g.status,loading:g.loading,error:g.error,fields:b,searchable:!1,edits:g.edits,editable:b.some((S)=>S.editable),tree:{dataKey:g.dataKey,parentKey:g.parentKey,labelField:g.labelField,loadingKeys:g.loadingKeys}}}if(!r)return{mode:"local",rows:C,total:0,first:0,pageSize:0,sort:C,search:"",status:"error",loading:!1,error:n,fields:this.fieldsFor(C),searchable:!1,edits:we,editable:!1};if(e){let g=e.get(),b=this.r.binding?.fields?N(this.r.binding.fields,"search").length>0:!1,S=this.fieldsFor(g.rows);return{mode:"server",rows:g.rows,total:g.total??g.rows.length,first:(g.page-1)*g.pageSize,pageSize:g.pageSize,sort:ue(g.order),search:g.search,status:g.status,loading:g.status==="loading",error:g.error,fields:S,searchable:b||(e.description.search?.length??0)>0,edits:g.edits,editable:S.some((F)=>F.editable),...g.current.active?{current:g.current.row}:{},...g.totals?{totals:g.totals}:{}}}let d=t.get(),h=Array.isArray(d)?d:C,p=this.fieldsFor(h),m=this.localRows(h,p),y=r.get();return{mode:"local",rows:m,total:m.length,first:0,pageSize:m.length,sort:C,search:"",status:y.status,loading:y.status==="loading",error:y.error,fields:p,searchable:!1,edits:we,editable:p.some((g)=>g.editable)&&t.writable}}}function Ze(e,t){return e===t||e.length===t.length&&JSON.stringify(e)===JSON.stringify(t)}function Ue(e,t){return e.mode===t.mode&&e.rows===t.rows&&e.total===t.total&&e.first===t.first&&e.pageSize===t.pageSize&&e.search===t.search&&e.status===t.status&&e.error===t.error&&e.fields===t.fields&&e.searchable===t.searchable&&e.edits===t.edits&&e.editable===t.editable&&JSON.stringify(e.sort)===JSON.stringify(t.sort)&&e.tree?.loadingKeys===t.tree?.loadingKeys&&e.current===t.current&&e.totals===t.totals}function De(e,t={}){return new ke(e,t.registry)}var Ke=(e,t=[10,25,50,100])=>[...new Set([...t,e])].filter((r)=>r>0).sort((r,n)=>r-n);function Ge(e){if(e===te)return"";return[e.dirty?"is-dirty":"",e.saving?"is-saving":"",e.error&&Object.keys(e.conflicts).length===0?"is-error":"",Object.keys(e.conflicts).length?"is-conflict":""].filter(Boolean).join(" ")}function ia(e,t,r){let n=t.mode==="server",l=t.tree?.dataKey??N(t.fields,"key")[0]?.field??(t.fields.some((h)=>h.field==="id")?"id":void 0),d=t.tree?{parentKey:t.tree.parentKey,lazyChildren:!0,loadChildren:(h)=>e.loadChildren(h),hasChildren:(h)=>e.hasChildren(h)}:{};return{value:t.error?C:t.rows,lazy:n,totalRecords:t.total,loading:t.loading,...n?{first:t.first,rows:t.pageSize,sort:t.sort,rowsPerPageOptions:Ke(t.pageSize,r.rowsPerPageOptions)}:{},columns:e.columns(r.locale),cellFormatter:(h,p)=>e.format(h,p,r),paginator:n,showSearch:n&&t.searchable,...l?{dataKey:l}:{},errorKey:t.error?t.error.messageKey:null,...t.error?.params?{errorParams:t.error.params}:{},...t.editable?{editMode:"cell"}:{},rowClass:(h)=>{let p=Ge(e.rowEdit(h));return t.current!==void 0&&t.current!==null&&He(e,h,t.current)?p?`${p} is-current`:"is-current":p},...n?{rowClick:(h)=>void e.makeCurrent(h)}:{},...t.totals?{totalsRow:Xe(e,t,r)}:{},rowMessage:(h)=>{let p=r.t,m=e.rowEdit(h);if(!p||m===te)return null;if(Object.keys(m.conflicts).length>0)return{severity:"conflict",text:p("data.conflict_row"),actions:[{label:p("data.keep_mine"),run:()=>e.resolveRow(h,"mine")},{label:p("data.take_theirs"),run:()=>e.resolveRow(h,"theirs")}]};let y=m.error??Object.values(m.errors)[0]??null;if(!y)return null;return{severity:"error",text:p(y.messageKey,y.params),actions:[{label:p("data.dismiss"),run:()=>e.dismissRow(h)}]}},...d}}function He(e,t,r){if(t===r)return!0;let n=e.store;return n!==null&&n.type==="list"&&n.keyOf(t)===n.keyOf(r)}function Xe(e,t,r){let n=t.totals??{},l={};for(let d of t.fields)for(let h of["sum","avg","min","max"]){let p=n[h];if(p&&d.field in p){l[d.field]=e.format(p[d.field],{field:d.field,key:d.key},r);break}}if(typeof n.count==="number")l.count=String(n.count);return l}function Qe(e,t,r){let n=B(e)?e:{},l=(y)=>y?k(L(n,y.field),{fieldType:y.type,...y.format?{format:y.format}:{}},r):"",d=N(t,"label")[0]??t.find((y)=>y.type==="text"&&!y.hidden&&y.field!=="id"),h=N(t,"description")[0],p=N(t,"image")[0],m=p?L(n,p.field):null;return{label:l(d),description:l(h),image:typeof m==="string"&&m?m:null}}var L=(e,t)=>{let r=e;for(let n of t.split(".")){if(r===null||typeof r!=="object")return;r=r[n]}return r};function sa(e,t,r){let n=t.mode==="server",l=N(t.fields,"key")[0]?.field??(t.fields.some((d)=>d.field==="id")?"id":void 0);return{value:t.error?C:t.rows,lazy:n,totalRecords:t.total,loading:t.loading&&t.rows.length===0,...n?{first:t.first,rows:t.pageSize,rowsPerPageOptions:Ke(t.pageSize,[6,12,24,48])}:{},paginator:n,...l?{dataKey:l}:{},errorKey:t.error?t.error.messageKey:null,...t.error?.params?{errorParams:t.error.params}:{},parts:(d)=>Qe(d,t.fields,r)}}function xt(e){let t=w(sn,null),r=c(null),n=c(null),l=null,d=!1,h=void 0,p=()=>{l?.(),l=null;let y=r.value;if(!y||!d)return;l=y.subscribe((g)=>n.value=g),n.value=y.get()},m=(y)=>{let g=y==null?null:xe(y);if(r.value&&g===h)return;h=g,l?.(),l=null,r.value=y==null?null:De(y,{registry:t}),n.value=r.value?r.value.get():null,p()};if(m(e()),s(e,(y)=>m(y)),re())f(()=>{d=!0,p()}),u(()=>{d=!1,l?.(),l=null});return{binding:r,state:n}}var vo=Symbol("poad-bound-field-source");function Te(e,t=!0){let r=w(sn,null),n=t?w(vo,null):null,l=o(),d=c(null),h=c(null),p=null,m=!1,y=void 0,g=()=>e()??n?.()??null,b=()=>{p?.(),p=null;let O=d.value;if(!O||!m)return;p=O.subscribe((D)=>h.value=D),h.value=O.get()},S=(O)=>{let D=O==null?null:Z(O);if(d.value&&D===y)return;y=D,p?.(),p=null,d.value=O==null?null:H(O,{registry:r}),h.value=d.value?d.value.get():null,b()};if(S(g()),s(g,(O)=>S(O)),re())f(()=>{m=!0,b()}),u(()=>{m=!1,p?.(),p=null});let F=i(()=>{let O=d.value,D=h.value;if(!O||!D)return null;return X(O,D,(ze,Ae)=>l.t(ze,Ae),{locale:l.locale})});return{binding:d,state:h,view:F,value:()=>(h.value,d.value?.controlValue()),input:(O)=>d.value?.setFromControl(O)}}function wt(e,t,r=(n)=>n){return{get value(){return t.binding.value?r(t.value()):e.value},set value(n){if(t.binding.value)t.input(n);e.value=n}}}function le(e,t,r=()=>!1){let n=Te(e),l=o(),d=i(()=>{let h=n.binding.value,p=n.state.value;if(!h||!p)return null;return ee(h,p,t,l.locale,{multiple:r()})});return{bound:n,choice:d,options:(h)=>d.value?.options??h,paths:(h,p=!0)=>d.value?.options?{...h,optionLabel:"label",...p?{optionValue:"value"}:{}}:h,model(h){return{get value(){return d.value?d.value.value:h.value},set value(p){if(d.value)d.value.set(p);h.value=p}}},invalid:(h)=>!!h||!!n.view.value?.invalid,filter:(h)=>d.value?.filter(h)}}
|
|
2
|
+
export{ia,sa,xt,vo,Te,wt,le};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{n}from"./c-81zrdysm.js";import{Zn}from"./c-8zzjexhj.js";import{De}from"./c-gqaaq5xd.js";import{pt,ke,A,Z,Le}from"./c-4xcsa9sp.js";import{gt,We,Hs,qs,er,nn,de,tr,nr,Gs,rr,or,ir,sr}from"./c-hqcvt3z9.js";import{ae}from"./c-e312a464.js";import{le}from"./c-yg69d4wg.js";import{x}from"./c-akbde6sp.js";import{o}from"./c-t3at1w4r.js";import{t,c,s,r,d,l,i,e}from"./c-d15cp8ae.js";var W=(a)=>a?{[pt]:""}:{},se=r({name:"PoadSelect",props:{data:{type:Object,default:null},store:{type:[Object,String],default:null},field:{type:String,default:null},modelValue:{type:null},options:Array,optionLabel:String,optionValue:String,optionDisabled:String,optionHint:String,optionIcon:String,optionGroupLabel:String,optionGroupChildren:String,compareWith:Function,dataKey:String,placeholder:{type:String,default:""},filter:Boolean,filterPlaceholder:String,filterBy:String,autofocusFilter:{type:Boolean,default:!0},clearable:Boolean,loading:Boolean,emptyMessage:String,emptyFilterMessage:String,size:{type:String,default:"md"},invalid:Boolean,disabled:Boolean,readonly:Boolean,panelMaxHeight:{type:Number,default:260},ariaLabel:String,mobile:{type:String,default:"auto"},sheetTitle:String,id:String},emits:{"update:modelValue":(a)=>!0,openChange:(a)=>!0,filter:(a)=>!0,clear:()=>!0,focusChange:(a)=>!0},setup(a,{emit:I,slots:h}){let{t:G,text:q}=o(),b=le(()=>x(a.data,a.store,a.field),"select"),S=b.model(l(a,"modelValue")),N=()=>b.invalid(a.invalid),j=d(),E=i(()=>a.id??`poad-select-${j}`),v=c(er),P=t(!1),p=t(!1),H=t(0),K=t(null),L=t(null),w=t(null),O=t(null),V=t(null),B=i(()=>gt(b.options(a.options),b.paths(a),`${E.value}-list`)),M=i(()=>({compareWith:a.compareWith,dataKey:a.dataKey})),T=()=>S.value!=null,R=i(()=>({items:B.value,filter:{enabled:a.filter,by:a.filterBy,grouped:!!a.optionGroupLabel},interactive:!a.disabled&&!a.readonly,clearable:a.clearable,modal:p.value,isSelected:(u)=>T()&&We(u.value,S.value,M.value)})),Q=(u)=>{switch(u.type){case"opened":return H.value=L.value?.getBoundingClientRect().width??0,p.value=or(a.mobile,ke(ae)),I("openChange",!0);case"closed":if(p.value=!1,I("openChange",!1),u.refocus)L.value?.focus();return;case"pick":if(!We(u.item.value,S.value,M.value))S.value=u.item.value;return;case"clear":return S.value=null,I("clear");case"filtered":return b.filter(u.query),I("filter",u.query)}},y=(u)=>{let f=de(v.value,u,R.value);return v.value=f.state,f.effects.forEach(Q),f},U=(u)=>{let f=y({type:"keydown",key:u.key,ctrlKey:u.ctrlKey,metaKey:u.metaKey,altKey:u.altKey,inTextField:u.target instanceof HTMLInputElement,time:Date.now()});if(f.preventDefault)u.preventDefault();if(f.stopPropagation)u.stopPropagation()},z=()=>v.value.open&&!p.value,{style:Y}=A({open:z,anchor:L,floating:w,candidates:()=>De,offset:4,shift:!0,deps:()=>[v.value.query,B.value]});Z(()=>v.value.open,[K],()=>y({type:"close",refocus:!1})),s(()=>v.value.open,(u)=>{if(u&&a.filter&&a.autofocusFilter&&!p.value)V.value?.focus()},{flush:"post"}),s(()=>[v.value.open,v.value.activeIndex],()=>{let u=O.value;if(!v.value.open||v.value.activeIndex<0||!u)return;let f=u.querySelector(`[id="${E.value}-list-opt-${v.value.activeIndex}"]`);if(!f)return;let m=sr({top:f.offsetTop,height:f.offsetHeight},{scrollTop:u.scrollTop,clientHeight:u.clientHeight});if(m!==null)u.scrollTop=m},{flush:"post"});let J=(u,f,m=14)=>h.icon?e("span",{class:f},h.icon({name:u})):e(n,{name:u,size:m,class:f});return()=>{let u=v.value,f=R.value,m=`${E.value}-list`,g=tr(u,f,{id:E.value,listId:m,ariaLabel:a.ariaLabel,invalid:N(),disabled:a.disabled,readonly:a.readonly}),C=T()?Hs(B.value,S.value,M.value):void 0,X=nn(u,f),k=!!u.query,ee=Gs({...a,open:u.open,focused:P.value,hasValue:T()}),te=Zn({listRef:O,listId:m,items:X,activeIndex:u.activeIndex,isSelected:f.isSelected,maxHeight:a.panelMaxHeight,slots:h,onPick:(_)=>y({type:"pick",item:_}),onHover:(_)=>y({type:"hover",index:_}),empty:h.empty?h.empty({filtered:k,query:u.query}):q(k?a.emptyFilterMessage:a.emptyMessage,rr(k))}),F=nr(u,f,{listId:m}),ne=a.filter&&e("div",{class:"poad-select__search"},[e(n,{name:"search",size:13}),e("input",{ref:V,type:"text",...W(p.value),placeholder:q(a.filterPlaceholder,"select.filterPlaceholder"),value:u.query,autocomplete:"off",spellcheck:!1,role:F.role,"aria-autocomplete":F["aria-autocomplete"],"aria-controls":F["aria-controls"],"aria-activedescendant":F["aria-activedescendant"]??void 0,onInput:(_)=>y({type:"filter",query:_.target.value})})]),D=e("div",{class:["poad-select__panel",{"is-sheet":p.value}],style:p.value?void 0:{minWidth:`${H.value}px`},tabindex:p.value?-1:void 0,...W(p.value&&!a.filter),onKeydown:U},[ne,h.header?.(),te,h.footer?.()]),ie=`${E.value}-sheet-title`;return e("div",{ref:K,class:["poad-select",ee,b.bound.view.value?.classes]},[e("div",{ref:L,class:"poad-select__trigger",role:g.role,tabindex:g.tabIndex,id:g.id,"aria-haspopup":g["aria-haspopup"],"aria-expanded":g["aria-expanded"],"aria-controls":g["aria-controls"],"aria-activedescendant":g["aria-activedescendant"]??void 0,"aria-label":g["aria-label"]??void 0,"aria-invalid":g["aria-invalid"]??void 0,"aria-disabled":g["aria-disabled"]??void 0,"aria-readonly":g["aria-readonly"]??void 0,onClick:()=>y({type:"toggle"}),onKeydown:U,onFocus:()=>{P.value=!0,I("focusChange",!0)},onBlur:()=>{P.value=!1,I("focusChange",!1)}},[e("span",{class:["poad-select__value",{"is-placeholder":!T()}]},C?h.value?h.value({option:C.option,label:C.label}):[C.icon&&J(C.icon,"poad-select__icon"),C.label]:T()?qs(S.value):a.placeholder),(a.loading||b.choice.value?.loading)&&e(n,{name:"loader",size:14,spin:!0,class:"poad-select__spin"}),a.clearable&&T()&&f.interactive&&e("button",{type:"button",class:"poad-select__clear",tabindex:-1,"aria-label":G("common.clear"),onClick:(_)=>{_.stopPropagation(),y({type:"clear"})}},[e(n,{name:"x",size:12})]),e(n,{name:"chevron-down",size:13,class:"poad-select__chev"})]),z()&&e("div",{ref:w,class:"poad-floating",style:Y()},[D]),e(Le,{open:u.open&&p.value,onClose:()=>y({type:"close"}),titleId:ie,restoreFocus:!1,title:ir({sheetTitle:a.sheetTitle,ariaLabel:a.ariaLabel,placeholder:a.placeholder})},()=>p.value?[D]:[])])}}});
|
|
2
|
+
export{se};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n}from"./c-
|
|
1
|
+
import{n}from"./c-81zrdysm.js";import{hn}from"./c-wrja8cc7.js";import{jr,pi}from"./c-5zfmt59k.js";import{o}from"./c-t3at1w4r.js";import{t,r,f,u,l,e}from"./c-d15cp8ae.js";function A(a,s){let i=[...a??[]].sort((c,x)=>c.breakpoint-x.breakpoint).find((c)=>s<=c.breakpoint);return i?Math.max(1,i.numVisible):null}var K=(a,s)=>Math.max(1,Math.min(a,s)),O=(a,s,i)=>Math.max(1,Math.ceil(Math.max(0,a-s)/i)+1),U=(a,s,i,c)=>Math.min(a*s,Math.max(0,i-c));function D(a,s,i="horizontal"){let c=a*100/s;return i==="vertical"?`translateY(-${c}%)`:`translateX(-${c}%)`}var V=(a,s,i)=>a>=s&&a<s+i;function L(a,s,i){return i?(a%s+s)%s:Math.max(0,Math.min(s-1,a))}var B=(a,s)=>!s&&a===0,F=(a,s,i)=>!i&&a>=s-1;function X(a,s="horizontal"){let i=s==="vertical";if(a===(i?"ArrowDown":"ArrowRight"))return"next";if(a===(i?"ArrowUp":"ArrowLeft"))return"prev";if(a==="Home")return"first";if(a==="End")return"last";return null}function Y(a,s,i,c){if(a==="first")return 0;if(a==="last")return i-1;return L(s+(a==="next"?1:-1),i,c)}var ae=40,W=(a)=>Math.abs(a)>ae?a<0?"next":"prev":null,I=250,T=(a,s)=>a>0&&!s.hover&&!s.focus&&!s.hidden&&!s.stopped;function G(a,s,i,c=I){if(!T(s,i))return{elapsed:0,advance:!1};let x=a+c;return x>=s?{elapsed:0,advance:!0}:{elapsed:x,advance:!1}}var H=(a="horizontal")=>a==="vertical"?"poad-carousel is-vertical":"poad-carousel",Q=(a,s,i,c)=>({role:"group","aria-roledescription":c,"aria-label":`${a+1} / ${s}`,"aria-hidden":i?"false":"true"}),j=(a)=>a?"off":"polite",J=(a,s)=>a&&!s,Z=(a)=>a?"display.startRotation":"display.stopRotation",q=(a)=>Array.from({length:a},(s,i)=>i);var ie=r({name:"PoadCarousel",props:{items:{type:Array,default:()=>[]},numVisible:{type:[Number,String],default:1},numScroll:{type:Number,default:1},responsive:Array,circular:Boolean,autoplay:{type:Number,default:0},showIndicators:{type:Boolean,default:!0},showNavigators:{type:Boolean,default:!0},orientation:{type:String,default:"horizontal"},ariaLabel:String,page:{type:Number,default:0}},emits:{"update:page":(a)=>!0},setup(a,{slots:s}){let i=o(),c=l(a,"page"),x=t(null),k=t(1e9),M=t(null),P=t(!1),C=t(!1),z=t(!1),g=t(!1),_=null,R=()=>{let d=A(a.responsive,k.value)??Math.max(1,Number(pi(a.numVisible,M.value==null?"xs":jr(M.value))??1)),v=K(a.numScroll,d),m=O(a.items.length,d,v);return{visible:d,step:v,pageCount:m,offset:U(c.value,v,a.items.length,d)}},E=()=>({hover:P.value,focus:C.value,hidden:z.value,stopped:g.value}),y=(d)=>{let v=L(d,R().pageCount,a.circular);if(v!==c.value)c.value=v},N=null;f(()=>{let d=x.value,v=typeof ResizeObserver==="function"?new ResizeObserver(([h])=>{k.value=h.contentRect.width}):null;v?.observe(d);let m=()=>{M.value=window.innerWidth};if(m(),window.addEventListener("resize",m),typeof matchMedia==="function"&&matchMedia(hn).matches)g.value=!0;let w=()=>{z.value=document.hidden};document.addEventListener("visibilitychange",w);let b=0,p=setInterval(()=>{let h=G(b,a.autoplay,E());if(b=h.elapsed,h.advance)y(c.value+1)},I);N=()=>{v?.disconnect(),window.removeEventListener("resize",m),document.removeEventListener("visibilitychange",w),clearInterval(p)}}),u(()=>N?.());let ee=(d)=>{if(d.target!==d.currentTarget)return;let v=X(d.key,a.orientation);if(!v)return;d.preventDefault(),y(Y(v,c.value,R().pageCount,a.circular))},te=(d)=>{if(!_)return;let v=a.orientation==="vertical"?d.clientY-_.y:d.clientX-_.x;_=null;let m=W(v);if(m==="next")y(c.value+1);else if(m==="prev")y(c.value-1)};return()=>{let{visible:d,pageCount:v,offset:m}=R(),w=a.orientation==="vertical",b=c.value;return e("div",{ref:x,class:H(a.orientation),tabindex:0,role:"region","aria-roledescription":i.t("display.carousel"),"aria-label":a.ariaLabel,onMouseenter:()=>{P.value=!0},onMouseleave:()=>{P.value=!1},onKeydown:ee,onFocusin:(p)=>{C.value=J(!0,p.target.classList.contains("poad-carousel__play"))},onFocusout:(p)=>{if(!x.value?.contains(p.relatedTarget))C.value=!1}},[e("div",{class:"poad-carousel__wrap"},[a.showNavigators?e("button",{type:"button",class:"poad-carousel__nav prev",disabled:B(b,a.circular),"aria-label":i.t("common.previous"),onClick:()=>y(b-1)},[e(n,{name:w?"chevron-up":"chevron-left",size:16})]):null,e("div",{class:"poad-carousel__view",onPointerdown:(p)=>{_={x:p.clientX,y:p.clientY}},onPointerup:te,onPointercancel:()=>{_=null}},e("div",{class:"poad-carousel__track","aria-live":j(T(a.autoplay,E())),style:{transform:D(m,d,a.orientation),"--_n":d}},a.items.map((p,h)=>{let S=V(h,m,d);return e("div",{key:h,class:"poad-carousel__item",...Q(h,a.items.length,S,i.t("display.slide")),inert:S?void 0:""},s.item?s.item({item:p,index:h,active:S}):String(p))}))),a.showNavigators?e("button",{type:"button",class:"poad-carousel__nav next",disabled:F(b,v,a.circular),"aria-label":i.t("common.next"),onClick:()=>y(b+1)},[e(n,{name:w?"chevron-down":"chevron-right",size:16})]):null]),e("div",{class:"poad-carousel__foot"},[a.autoplay>0?e("button",{type:"button",class:"poad-carousel__play","aria-label":i.t(Z(g.value)),onClick:()=>{g.value=!g.value}},[e(n,{name:g.value?"play":"pause",size:12})]):null,a.showIndicators&&v>1?e("div",{class:"poad-carousel__dots",role:"tablist"},q(v).map((p)=>e("button",{key:p,type:"button",role:"tab",class:p===b?"is-on":void 0,"aria-selected":p===b?"true":"false","aria-label":i.t("display.page",{page:p+1}),onClick:()=>y(p)}))):null])])}}});export{ie as PoadCarousel};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{o}from"./c-
|
|
1
|
+
import{o}from"./c-t3at1w4r.js";import{r,e}from"./c-d15cp8ae.js";var w={primary:"var(--poad-accent)",success:"var(--poad-success)",warning:"var(--poad-warning)",danger:"var(--poad-danger)",info:"var(--poad-info)",neutral:"var(--poad-border-strong)"},x=["var(--poad-accent)","var(--poad-success)","var(--poad-warning)","var(--poad-danger)","var(--poad-info)","#a371f7"];function f(a,n=0,l=100){let s=Math.max(0.000000001,l-n);return a.map((i,m)=>({...i,percent:Math.max(0,Math.min(100,i.value/s*100)),color:i.color??(i.severity?w[i.severity]:x[m%x.length])}))}var y=(a)=>a.reduce((n,l)=>n+(l.value||0),0),S=(a,n=0,l=100)=>Math.max(0,l-n-y(a));function _(a){return{"is-vertical":a.orientation==="vertical","size-sm":a.size==="sm","size-lg":a.size==="lg","labels-start":a.labelPosition==="start"}}function P(a){return{role:"meter","aria-valuemin":String(a.min??0),"aria-valuemax":String(a.max??100),"aria-valuenow":String(y(a.values??[])),"aria-label":a.ariaLabel||null}}var h=(a,n,l)=>a(n,{maximumFractionDigits:2})+(l?" "+l:""),R=(a,n)=>a(n/100,{style:"percent",maximumFractionDigits:0});var B=r({name:"PoadMeter",props:{values:{type:Array,default:()=>[]},min:{type:Number,default:0},max:{type:Number,default:100},unit:{type:String,default:""},orientation:String,size:String,labelPosition:{type:String,default:"end"},showLabels:{type:Boolean,default:!0},showRemaining:Boolean,remainingLabel:String,ariaLabel:String},setup(a,{slots:n}){let l=o();return()=>{let s=(t,T)=>new Intl.NumberFormat(l.locale,T).format(t),{values:i,min:m,max:u}=a,d=f(i,m,u),g=S(i,m,u),p=P(a),c=(t)=>h(s,t,a.unit),v=(t)=>R(s,t),b=a.showLabels&&e("div",{class:"mt__legend"},[...d.map((t)=>e("div",{class:"mt__li"},n.label?n.label({segment:t,percent:t.percent}):[e("i",{style:{background:t.color}}),e("span",{class:"lb"},t.label),e("span",{class:"v"},[`${c(t.value)} `,e("small",`(${v(t.percent)})`)])])),a.showRemaining&&g>0&&e("div",{class:"mt__li is-rest"},[e("i"),e("span",{class:"lb"},l.text(a.remainingLabel,"display.remaining")),e("span",{class:"v"},c(g))])]);return e("div",{class:["poad-meter",_(a)]},[a.labelPosition==="start"&&b,e("div",{class:"mt__bar",...p,"aria-label":p["aria-label"]??void 0},d.map((t)=>e("div",{class:"mt__seg",style:{flexBasis:`${t.percent}%`,background:t.color},title:l.t("display.meterSegment",{label:t.label,value:c(t.value),percent:v(t.percent)})}))),a.labelPosition==="end"&&b])}}});export{B as PoadMeter};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n}from"./c-
|
|
1
|
+
import{n}from"./c-81zrdysm.js";import{t,r,l,e}from"./c-d15cp8ae.js";function y(o,s,d={}){return d.multiple?Array.isArray(o)&&o.includes(s):o===s}function E(o,s,d={}){if(d.multiple){let a=Array.isArray(o)?[...o]:[],i=a.indexOf(s);if(i>=0)a.splice(i,1);else a.push(s);return a}if(o===s)return d.allowEmpty?null:o;return s}function P(o,s,d,a={}){if(a.disabled)return-1;let i=(f)=>!!s[f]&&!s[f].disabled,c=s.findIndex((f,b)=>i(b)&&y(o,f.value,a));return(c>=0?c:s.findIndex((f,b)=>i(b)))===d?0:-1}var v=["ArrowRight","ArrowDown"],z=["ArrowLeft","ArrowUp"];function w(o,s,d,a={}){if(a.disabled)return null;let i=o.map((f,b)=>f.disabled?-1:b).filter((f)=>f>=0);if(!i.length)return null;if(d==="Home")return i[0];if(d==="End")return i[i.length-1];let c=v.includes(d)?1:z.includes(d)?-1:0;if(!c)return null;if(a.rtl&&(d==="ArrowLeft"||d==="ArrowRight"))c=-c;let m=i.indexOf(s);if(m<0)return c>0?i[0]:i[i.length-1];return i[(m+c+i.length)%i.length]}function S(o){return{"is-disabled":!!o.disabled,"size-sm":o.size==="sm","size-lg":o.size==="lg","is-block":!!o.block,"is-pill":o.shape==="pill"}}function A(o,s,d,a={}){let i=s[d];return{"aria-pressed":i&&y(o,i.value,a)?"true":"false",tabindex:P(o,s,d,a),disabled:!!a.disabled||!!i?.disabled}}var h=(o,s)=>s.split(".").reduce((d,a)=>d==null?d:d[a],o),I=r({name:"PoadSegmented",props:{modelValue:{type:null},options:{type:Array,default:()=>[]},optionLabel:{type:String,default:"label"},optionValue:{type:String,default:"value"},multiple:Boolean,allowEmpty:Boolean,block:Boolean,size:{type:String,default:"md"},shape:{type:String,default:"rounded"},disabled:Boolean,ariaLabel:String},emits:{"update:modelValue":(o)=>!0},setup(o,{slots:s}){let d=l(o,"modelValue"),a=t(null);return()=>{let i={multiple:o.multiple,allowEmpty:o.allowEmpty,disabled:o.disabled},c=o.options.map((u)=>({value:h(u,o.optionValue),disabled:!!u.disabled})),m=d.value??null,f=(u)=>{let p=E(m,c[u].value,i);if(p!==m)d.value=p},b=(u)=>{let p=[...a.value?.querySelectorAll(":scope > button")??[]],g=p.indexOf(u.target);if(g<0)return;let x=w(c,g,u.key,{...i,rtl:getComputedStyle(a.value).direction==="rtl"});if(x===null)return;u.preventDefault(),p[x]?.focus()};return e("div",{ref:a,class:["poad-segmented",S(o)],role:"group","aria-label":o.ariaLabel||void 0,onKeydown:b},o.options.map((u,p)=>{let g=A(m,c,p,i),x=String(h(u,o.optionLabel)??"");return e("button",{type:"button",class:g["aria-pressed"]==="true"?"is-on":void 0,disabled:g.disabled,"aria-pressed":g["aria-pressed"],tabindex:g.tabindex,title:u.title||void 0,onClick:()=>f(p)},s.option?s.option({option:u}):[u.icon&&e(n,{name:u.icon,size:14}),x&&e("span",x)])}))}}});export{I as PoadSegmented};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name":"@poadio/app-vue","version":"0.
|
|
1
|
+
{"name":"@poadio/app-vue","version":"0.4.0"}
|