@shifl-inc/ui 0.2.0 → 0.3.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/dist/shifl-ui.umd
CHANGED
|
@@ -1,4 +1,8 @@
|
|
|
1
|
-
(function(
|
|
2
|
-
`)),p=e.computed(()=>
|
|
3
|
-
`).filter(k=>k.trim().length>0):[]);function y(){if(!a.triggerElement||!s.value)return;const k=a.triggerElement.getBoundingClientRect(),B=s.value.getBoundingClientRect(),m=window.innerWidth,c=window.innerHeight,f=window.scrollX||window.pageXOffset,E=window.scrollY||window.pageYOffset;let h=k.bottom+E+8,M=k.left+f;M+B.width>m+f&&(M=m+f-B.width-16),M<f+16&&(M=f+16),h+B.height>c+E&&(h=k.top+E-B.height-8),g.value={position:"fixed",top:`${h}px`,left:`${M}px`,zIndex:"10000"}}return e.watch(()=>a.visible,async k=>{k&&(await e.nextTick(),y())}),e.onMounted(()=>{a.visible&&e.nextTick(()=>y())}),e.onUnmounted(()=>{}),(k,B)=>(e.openBlock(),e.createBlock(e.Teleport,{to:"body"},[i.visible?(e.openBlock(),e.createElementBlock("div",{key:0,ref_key:"tooltipRef",ref:s,class:"shifl-grid__tooltip",style:e.normalizeStyle(g.value)},[e.createElementVNode("div",Pe,[d.value?(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:0},e.renderList(p.value,(m,c)=>(e.openBlock(),e.createElementBlock("div",{key:c,class:"shifl-grid__tooltip-line"},e.toDisplayString(m),1))),128)):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.createTextVNode(e.toDisplayString(i.content),1)],64))])],4)):e.createCommentVNode("",!0)]))}}),[["__scopeId","data-v-601cf0b0"]]),Ae={},He={width:"14",height:"15",viewBox:"0 0 14 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",class:"shifl-smart-tracking-icon"};function Ge(i,a){return e.openBlock(),e.createElementBlock("svg",He,[...a[0]||(a[0]=[e.createElementVNode("path",{d:"M1.03223 9.27441C1.22778 9.27445 1.40954 9.32951 1.57812 9.43066L3.86523 10.8594C4.1957 11.0618 4.3916 11.4202 4.3916 11.8047C4.39151 12.189 4.19562 12.5467 3.86523 12.749L1.57812 14.1797C1.41642 14.2806 1.22754 14.334 1.03223 14.334V14.3408C0.465713 14.3408 0.000165713 13.8751 0 13.3086V10.3066C0.000236867 9.74022 0.465756 9.27443 1.03223 9.27441ZM1.01172 13.3018L3.3252 11.8916C3.32796 11.8884 3.3728 11.8374 3.37305 11.8047C3.37305 11.771 3.35218 11.737 3.3252 11.7168L1.03906 10.2871L1.01172 13.3018ZM6.07129 3.37305C6.35041 3.37318 6.5771 3.59977 6.57715 3.87891C6.57715 4.15809 6.35044 4.38463 6.07129 4.38477H5.05957C4.03708 4.38477 3.20433 5.06537 3.2041 5.90234C3.2041 6.73947 4.03694 7.4209 5.05957 7.4209H7.08301C8.66344 7.42096 9.95019 8.55525 9.9502 9.9502C9.95009 11.3451 8.66338 12.4794 7.08301 12.4795H6.07129C5.79202 12.4795 5.56543 12.2529 5.56543 11.9736C5.56548 11.6944 5.79205 11.4678 6.07129 11.4678H7.08301C8.10552 11.4677 8.93739 10.7872 8.9375 9.9502C8.93749 9.11311 8.10558 8.43267 7.08301 8.43262H5.05957C3.47908 8.43262 2.19238 7.29733 2.19238 5.90234C2.19259 4.50751 3.4792 3.37305 5.05957 3.37305H6.07129ZM10.7939 0C12.0694 0.000131868 13.2591 0.779675 13.7549 1.94043C14.6093 3.9666 13.0453 5.42741 11.9033 6.49316L11.8818 6.51367C11.7964 6.59308 11.711 6.67193 11.6289 6.75C11.4057 6.96444 11.1095 7.08195 10.7939 7.08203C10.4783 7.08203 10.1803 6.9642 9.95703 6.74902C9.86266 6.65937 9.76511 6.56666 9.66602 6.47363L9.66016 6.46875C8.53029 5.40836 6.98418 3.95585 7.83203 1.94238C8.32854 0.77953 9.51841 6.29203e-06 10.7939 0ZM10.7939 1.01172C9.91775 1.01173 9.10234 1.54537 8.76367 2.33789C8.22961 3.60525 9.04604 4.50453 10.3525 5.73145L10.4229 5.79688C10.5024 5.87104 10.5804 5.94604 10.6572 6.01953C10.7267 6.08617 10.861 6.08446 10.9277 6.02051L10.9307 6.01758C11.0223 5.93066 11.1172 5.84284 11.2129 5.75391C12.5356 4.51951 13.3612 3.61352 12.8223 2.33594C12.4849 1.54493 11.6691 1.0127 10.793 1.0127L10.7939 1.01172ZM10.7998 2.53027C11.1719 2.53041 11.4734 2.83199 11.4736 3.2041C11.4736 3.57637 11.172 3.87877 10.7998 3.87891C10.4275 3.87882 10.1221 3.57641 10.1221 3.2041C10.1223 2.8319 10.4207 2.53027 10.793 2.53027H10.7998Z",fill:"#05963F"},null,-1)])])}const Re=V(Ae,[["render",Ge]]),Fe={},Ie={width:"14",height:"10",viewBox:"0 0 14 10",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function Ze(i,a){return e.openBlock(),e.createElementBlock("svg",Ie,[...a[0]||(a[0]=[e.createElementVNode("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M0 0.666667C0 0.298477 0.314186 2.98023e-08 0.701754 2.98023e-08H4.2807C4.66827 2.98023e-08 4.98246 0.298477 4.98246 0.666667C4.98246 1.03486 4.66827 1.33333 4.2807 1.33333H0.701754C0.314186 1.33333 0 1.03486 0 0.666667ZM10.0301 0.195262C10.3042 -0.0650874 10.7485 -0.0650874 11.0225 0.195262L13.1278 2.19526C13.4018 2.45561 13.4018 2.87772 13.1278 3.13807C12.8537 3.39842 12.4094 3.39842 12.1354 3.13807L11.2281 2.27614V8.66667C11.2281 9.03486 10.9139 9.33333 10.5263 9.33333C10.1387 9.33333 9.82456 9.03486 9.82456 8.66667V2.27614L8.91727 3.13807C8.64322 3.39842 8.19889 3.39842 7.92484 3.13807C7.65079 2.87772 7.65079 2.45561 7.92484 2.19526L10.0301 0.195262ZM0 4.66667C0 4.29848 0.314186 4 0.701754 4H5.61404C6.0016 4 6.31579 4.29848 6.31579 4.66667C6.31579 5.03486 6.0016 5.33333 5.61404 5.33333H0.701754C0.314186 5.33333 0 5.03486 0 4.66667ZM0 8.66667C0 8.29848 0.314186 8 0.701754 8H7.01754C7.40511 8 7.7193 8.29848 7.7193 8.66667C7.7193 9.03486 7.40511 9.33333 7.01754 9.33333H0.701754C0.314186 9.33333 0 9.03486 0 8.66667Z",fill:"#1A6D9E"},null,-1)])])}const Oe=V(Fe,[["render",Ze]]),We={},je={width:"14",height:"10",viewBox:"0 0 14 10",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function Ke(i,a){return e.openBlock(),e.createElementBlock("svg",je,[...a[0]||(a[0]=[e.createElementVNode("path",{d:"M4.28125 8C4.66872 8.00011 4.98242 8.29887 4.98242 8.66699C4.98242 9.03511 4.66872 9.33387 4.28125 9.33398H0.702148C0.314581 9.33398 8.1338e-07 9.03518 0 8.66699C0 8.2988 0.31458 8 0.702148 8H4.28125ZM10.5264 0C10.9139 0 11.2285 0.298802 11.2285 0.666992V7.05762L12.1357 6.19531C12.4097 5.93519 12.8539 5.93524 13.1279 6.19531C13.402 6.45566 13.402 6.87832 13.1279 7.13867L11.0225 9.13867C10.7484 9.39867 10.3042 9.39886 10.0303 9.13867L7.9248 7.13867C7.65082 6.87834 7.65082 6.45565 7.9248 6.19531C8.19886 5.93496 8.64392 5.93496 8.91797 6.19531L9.8252 7.05762V0.666992C9.8252 0.298891 10.1389 0.000143144 10.5264 0ZM5.61426 4C6.00183 4 6.31641 4.2988 6.31641 4.66699C6.31641 5.03518 6.00183 5.33398 5.61426 5.33398H0.702148C0.314581 5.33398 6.77817e-07 5.03518 0 4.66699C0 4.2988 0.31458 4 0.702148 4H5.61426ZM7.01758 0C7.40515 0 7.71973 0.298802 7.71973 0.666992C7.71973 1.03518 7.40515 1.33398 7.01758 1.33398H0.702148C0.31458 1.33398 5.42254e-07 1.03518 0 0.666992C0 0.298802 0.31458 0 0.702148 0H7.01758Z",fill:"#1A6D9E"},null,-1)])])}const Ue=V(We,[["render",Ke]]),Ye={},qe={width:"21",height:"13",viewBox:"0 0 21 13",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function Xe(i,a){return e.openBlock(),e.createElementBlock("svg",qe,[...a[0]||(a[0]=[e.createElementVNode("path",{d:"M19.6426 4.61523C19.9311 4.61524 20.1317 4.90139 20.0342 5.17285L17.499 12.2246C17.4395 12.3899 17.2821 12.5 17.1064 12.5H1.5459C1.35628 12.5 1.19044 12.3719 1.14258 12.1885L0.0136719 7.83887C-0.0548101 7.575 0.14438 7.31738 0.416992 7.31738H12.6016L14.71 4.61523H19.6426ZM3.51465 8.82324C3.11322 8.82324 2.78728 9.15265 2.78711 9.55859C2.78711 9.96468 3.11312 10.2939 3.51465 10.2939C3.9161 10.2938 4.24121 9.96462 4.24121 9.55859C4.24104 9.15271 3.91599 8.82334 3.51465 8.82324ZM7.87695 8.82324C7.47553 8.82324 7.14958 9.15265 7.14941 9.55859C7.14941 9.96468 7.47542 10.2939 7.87695 10.2939C8.27846 10.2939 8.60352 9.96466 8.60352 9.55859C8.60335 9.15267 8.27835 8.82327 7.87695 8.82324ZM12.2393 8.82324C11.8378 8.82324 11.5119 9.15265 11.5117 9.55859C11.5117 9.96468 11.8377 10.2939 12.2393 10.2939C12.6407 10.2938 12.9658 9.96458 12.9658 9.55859C12.9657 9.15275 12.6405 8.82341 12.2393 8.82324ZM10.3291 3.67676C10.5591 3.67679 10.7459 3.86283 10.7461 4.09277V5.46582C10.746 5.69585 10.5591 5.88278 10.3291 5.88281H1.75C1.51993 5.88281 1.33309 5.69587 1.33301 5.46582V4.09277C1.3332 3.86282 1.52 3.67676 1.75 3.67676H10.3291ZM8.91406 0C9.14418 0 9.33105 0.186874 9.33105 0.416992V1.78906C9.33105 2.01918 9.14418 2.20605 8.91406 2.20605H3.2041C2.97398 2.20605 2.78711 2.01918 2.78711 1.78906V0.416992C2.78711 0.186874 2.97398 1.52829e-06 3.2041 0H8.91406Z",fill:"#9CA5B4"},null,-1)])])}const ne=V(Ye,[["render",Xe]]),Je={},Qe={width:"11",height:"11",viewBox:"0 0 11 11",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function ve(i,a){return e.openBlock(),e.createElementBlock("svg",Qe,[...a[0]||(a[0]=[e.createElementVNode("path",{d:"M5.39941 0C8.38169 0 10.7997 2.41717 10.7998 5.39941C10.7998 8.38175 8.38175 10.7998 5.39941 10.7998C2.41717 10.7997 0 8.38169 0 5.39941C0.000106094 2.41723 2.41723 0.000105613 5.39941 0ZM5.39941 0.80957C2.86451 0.809676 0.809676 2.86451 0.80957 5.39941C0.80957 7.93441 2.86445 9.98915 5.39941 9.98926C7.93447 9.98926 9.98926 7.93447 9.98926 5.39941C9.98915 2.86445 7.9344 0.80957 5.39941 0.80957ZM5.39746 4.58887C5.60229 4.58873 5.77167 4.74108 5.79883 4.93848L5.80273 4.99414L5.80469 7.96387C5.80483 8.18742 5.6239 8.36885 5.40039 8.36914C5.19539 8.36927 5.02597 8.21716 4.99902 8.01953L4.99512 7.96484L4.99316 4.99414C4.99317 4.77069 5.174 4.58911 5.39746 4.58887ZM5.39941 2.70117C5.6972 2.70117 5.93945 2.94245 5.93945 3.24023C5.93928 3.53787 5.69709 3.7793 5.39941 3.7793C5.10194 3.77906 4.86053 3.53773 4.86035 3.24023C4.86035 2.94259 5.10183 2.70141 5.39941 2.70117Z",fill:"#69758C"},null,-1)])])}const et=V(Je,[["render",ve]]),tt={class:"shifl-grid relative"},nt={class:"shifl-grid__controls"},ot={class:"shifl-grid__table"},rt=["onClick"],lt={class:"shifl-grid__header-content"},it={key:0,class:"shifl-grid__header-label"},st={key:1,class:"shifl-grid__sort-icon"},at={key:0},ct=["colspan"],dt={key:0,class:"shifl-grid__smart-tracking-icon"},ft=["onClick"],mt={key:0},ut=["innerHTML"],gt={key:2,class:"shifl-grid__type-cell"},pt={key:0,class:"shifl-grid__container-badge"},ht={key:3,class:"shifl-grid__tags-cell"},kt={class:"shifl-grid__tags-wrapper"},_t=["onMouseenter"],Ct={key:4,class:"shifl-grid__truncated-cell"},yt=["onMouseenter"],bt=["onMouseenter"],Bt={key:5,class:"shifl-grid__chips-container"},Et={key:0,class:"shifl-grid__pagination"},wt={class:"shifl-grid__pagination-left"},Mt={class:"shifl-grid__pagination-range"},Vt={class:"shifl-grid__pagination-range-numbers"},Nt={class:"shifl-grid__pagination-right"},Tt={class:"shifl-grid__pagination-rows"},St=["value","disabled"],$t={class:"shifl-grid__pagination-nav"},Lt=["disabled"],xt={class:"shifl-grid__pagination-pages"},zt=["disabled","onClick"],Pt={key:1,class:"shifl-grid__pagination-ellipsis"},Dt=["disabled"],At=["onClick"],Ht=["innerHTML"],oe=e.defineComponent({__name:"ShiflGrid",props:{config:{},search:{},loading:{type:Boolean}},emits:["action-click","search-change","pagination-change"],setup(i,{emit:a}){const s=i,g=a,d=e.computed(()=>ke(s.config)),p=e.computed(()=>d.value.columns.filter(t=>!t.smartTrackingColumn)),{columns:y,visibleColumns:k,toggleColumnVisibility:B,setAllVisible:m,toggleFrozen:c,moveColumn:f,resetColumns:E}=v(p.value),{sort:h,setSort:M,applySort:A}=ee(d.value.sort),{applyGlobalFilter:Yt}=te(),{menuState:N,openMenu:qt,closeMenu:H}=_e(),G=e.ref(!1),ie=e.ref({}),se=e.ref(null),ae=e.ref(null),R=e.ref(null),F=e.ref(!1),ce=e.ref(""),I=e.ref(null),Xt=e.ref({});e.ref({});const Z=e.ref({});e.watch(()=>d.value.columns,t=>{const o=t.filter(n=>!n.smartTrackingColumn);y.value=[...o]},{deep:!0}),e.watch(()=>d.value.sort,t=>{t&&(h.value=t)},{deep:!0}),e.watch(()=>s.search,(t,o)=>{var n;if(d.value.searchMode==="server")g("search-change",t||"");else if(d.value.searchMode==="client"&&t!==o){const r=((n=b.value)==null?void 0:n.perPage)||20;g("pagination-change",1,r)}});const de=e.computed(()=>{if((d.value.searchMode||"client")==="server")return d.value.rows;const o=s.search||"";return Yt(d.value.rows,d.value.search,o)}),O=e.computed(()=>{var o;return(d.value.searchMode||"client")==="client"?de.value.length:((o=b.value)==null?void 0:o.total)||0}),W=e.computed(()=>A(de.value)),fe=e.computed(()=>{if((d.value.searchMode||"client")==="server")return W.value;const o=b.value;if(!o||!o.show)return W.value;const n=o.perPage||20,l=((o.currentPage||1)-1)*n,u=l+n;return W.value.slice(l,u)}),b=e.computed(()=>d.value.paginationMeta),Jt=e.computed(()=>{var t;return((t=b.value)==null?void 0:t.perPage)===100}),Qt=e.computed(()=>{var t;return((t=b.value)==null?void 0:t.perPage)||10}),me=e.computed(()=>{const t=b.value;if(!t||!t.show)return{from:0,to:0};const o=O.value,n=t.perPage||20,r=t.currentPage||1;if((d.value.searchMode||"client")==="server"&&t.from!==void 0&&t.to!==void 0)return{from:t.from,to:t.to};const u=(r-1)*n+1,C=Math.min(r*n,o);return o===0?{from:0,to:0}:{from:u,to:C}}),T=e.computed(()=>{var t;return((t=b.value)==null?void 0:t.currentPage)||1}),j=e.computed(()=>{const t=b.value;if(!t||!t.show)return 1;const o=O.value;if(o===0)return 1;const n=t.perPage||20,r=Math.ceil(o/n);return Math.max(1,r)}),ue=e.computed(()=>T.value<=1),ge=e.computed(()=>T.value>=j.value),vt=e.computed(()=>{const t=j.value,o=T.value,n=[];if(t<=7)for(let r=1;r<=t;r++)n.push(r);else if(o<=4){for(let r=1;r<=5;r++)n.push(r);n.push(-1),n.push(t)}else if(o>=t-3){n.push(1),n.push(-1);for(let r=t-4;r<=t;r++)n.push(r)}else{n.push(1),n.push(-1);for(let r=o-1;r<=o+1;r++)n.push(r);n.push(-1),n.push(t)}return n});function en(t){var n;if(t<1||t>j.value||t===T.value||s.loading)return;const o=((n=b.value)==null?void 0:n.perPage)||20;g("pagination-change",t,o)}function tn(){var o;if(ue.value||s.loading)return;const t=((o=b.value)==null?void 0:o.perPage)||20;g("pagination-change",T.value-1,t)}function nn(){var o;if(ge.value||s.loading)return;const t=((o=b.value)==null?void 0:o.perPage)||20;g("pagination-change",T.value+1,t)}function on(t){var r;if(s.loading)return;const o=t.target,n=parseInt(o.value,10);n&&n!==(((r=b.value)==null?void 0:r.perPage)||20)&&g("pagination-change",1,n)}const rn=e.computed(()=>{const t=d.value.columns.find(n=>n.smartTrackingColumn);if(!(t!=null&&t.smartTrackingColumn))return!1;const o=t.smartTrackingColumn.dataKey;return d.value.rows.some(n=>{const r=n[o];return r===!0||r===1||r==="true"||r==="1"})}),K=e.computed(()=>d.value.columns.find(t=>t.smartTrackingColumn)),S=e.computed(()=>{var n;const t=k.value.filter(r=>!r.smartTrackingColumn);if(rn.value&&K.value){const r={key:"_smart_tracking",label:"",order:-1,frozen:!0,visible:!0,protected:!0,sortable:!1,width:((n=K.value.smartTrackingColumn)==null?void 0:n.width)||"36px",smartTrackingColumn:K.value.smartTrackingColumn},l=t.findIndex(u=>u.key==="ref");l>=0?t.splice(l,0,r):t.unshift(r)}const o=t.find(r=>r.key==="ref");return o&&(o.frozen=!0,o.protected=!0),t}),ln=e.computed(()=>{let t=0;const o={};for(const n of S.value){n.frozen&&(o[n.key]=t);const r=parseInt(n.width??"160",10);Number.isNaN(r)||(t+=r)}return o});function sn(t){const o=y.value.find(n=>n.key===t);!(o!=null&&o.sortable)||x(o)||Q(o)||M(t)}function an(t){return t==null?"":typeof t=="object"?JSON.stringify(t):String(t)}function cn(t){return typeof t=="string"&&t.toLowerCase()==="ocean",ne}function dn(t){const o=t.toLowerCase();return["supplier","suppliers","po","pos","product_description"].includes(o)}function fn(t){if(t==null)return"";if(Array.isArray(t)){if(t.length===0)return"";const o=t.join(", ");return pe(o,45)}return typeof t=="string"?pe(t,45):String(t)}function pe(t,o){return t.length<=o?t:t.substring(0,o)+"..."}function U(t){const o=t.toLowerCase();return["po","pos","supplier","suppliers","tag","tags"].includes(o)}function mn(t,o){return t==null||U(o)?!1:Array.isArray(t)?t.length===0?!1:t.join(", ").length>30:typeof t=="string"?t.length>30:!1}function un(t){return t==null?!1:Array.isArray(t)?t.length===0?!1:t.join(", ").length>45:typeof t=="string"?t.length>45:!1}function gn(t){if(t==null)return 0;if(Array.isArray(t)){if(t.length===0||t.join(", ").length<=45)return 0;let n=0,r=0;for(let l=0;l<t.length;l++){const u=String(t[l]),w=(l>0?", ":"").length+u.length;if(n+w<=45)n+=w,r++;else break}return t.length-r}return typeof t=="string"&&t.length>45?1:0}function Y(t,o,n,r){let l="";Array.isArray(n)?n.length>0&&(l=n.join(`
|
|
4
|
-
`)):n!=null&&(l=String(n)),ce.value=l,I.value=r,F.value=!0}function q(){F.value=!1,I.value=null}function pn(t,o,n){n&&(Xt.value[`${t}-${o}`]=n)}function L(t){return t==null?[]:Array.isArray(t)?t.map(o=>String(o)).filter(o=>o.length>0):typeof t=="string"?t.split(",").map(o=>o.trim()).filter(o=>o.length>0):[String(t)]}function X(t,o,n){const r=L(t);if(r.length===0)return[];const l=`${o}-${n}`;if(Z.value[l])return Z.value[l];const u=S.value.find(P=>P.key===o),w=(u!=null&&u.width?parseInt(u.width):200)-32,$=hn(r,w);return Z.value[l]=$,$}function hn(t,o){if(t.length===0)return[];const n=document.createElement("div");n.style.cssText="position: absolute; visibility: hidden; display: flex; flex-wrap: nowrap; gap: 6px;",n.className="shifl-grid__chips-container",document.body.appendChild(n);let r=0,l=0;const u=40;for(let C=0;C<t.length;C++){const w=document.createElement("span");w.className="shifl-grid__chip shifl-grid__chip--tag",w.textContent=t[C],w.style.cssText="padding: 4px 8px; border-left: 3px solid; border: 1px solid; background: white; white-space: nowrap;",n.appendChild(w);const $=w.offsetWidth,P=C>0?6:0,Nn=C<t.length-1;if(l+P+$+(Nn?u:0)>o&&C>0){n.removeChild(w);break}l+=P+$,r++}return document.body.removeChild(n),t.slice(0,r)}function kn(t,o,n){const r=L(t),l=X(t,o,n);return r.length>l.length}function _n(t,o,n){const r=L(t),l=X(t,o,n);return r.length-l.length}function Cn(t){const o=t.toLowerCase(),n={"high priority":"var(--shifl-color-error-r70)",express:"var(--shifl-color-primary-b80)",fragile:"var(--shifl-color-warning-o70)","temperature controlled":"var(--shifl-color-primary-b70)","customs clearance required":"var(--shifl-color-accent-p80)","insurance required":"var(--shifl-color-primary-b90)","special handling":"var(--shifl-color-warning-o80)","urgent delivery":"var(--shifl-color-error-r80)",normal:"var(--shifl-color-neutral-n60)",low:"var(--shifl-color-neutral-n50)"};if(n[o])return n[o];for(const[r,l]of Object.entries(n))if(o.includes(r)||r.includes(o))return l;return yn(t)}function yn(t){let o=0;for(let r=0;r<t.length;r++)o=t.charCodeAt(r)+((o<<5)-o);const n=["var(--shifl-color-primary-b80)","var(--shifl-color-success-g70)","var(--shifl-color-warning-o70)","var(--shifl-color-error-r70)","var(--shifl-color-accent-p80)","var(--shifl-color-primary-b70)","var(--shifl-color-success-g60)","var(--shifl-color-warning-o60)"];return n[Math.abs(o)%n.length]}function J(t,o=!0){const n={width:t.width??"160px",minWidth:t.width??"160px"};if(!t.frozen)return n;const r=ln.value[t.key]??0;return{...n,position:"sticky",left:`${r}px`,zIndex:o?30:10,background:"var(--shifl-color-surface)"}}const bn=e.computed(()=>y.value.filter(t=>!t.smartTrackingColumn));function x(t){return!!t.actionColumn}function Q(t){return!!t.smartTrackingColumn}function Bn(t,o){if(!t.smartTrackingColumn)return!1;const n=t.smartTrackingColumn.dataKey,r=o[n];if(r===!0||r===1)return!0;if(typeof r=="string"){const l=r.toLowerCase().trim();return l==="true"||l==="1"||l==="yes"}return!1}function z(t,o){if(!t.actionColumn)return null;const n=t.actionColumn.icon;return n?typeof n=="function"?n(o):n:null}function En(t,o,n,r){if(!n.actionColumn)return;const l=r.currentTarget;if(N.value.rowIndex===t){H();return}ae.value=n,R.value=o,qt(t,l)}function wn(t,o){return!(t!=null&&t.actionColumn)||!o?[]:(typeof t.actionColumn.actions=="function"?t.actionColumn.actions(o):t.actionColumn.actions).filter(r=>r.show?r.show(o):!0)}function Mn(t,o,n){g("action-click",t.key,o,n),H()}function Vn(t,o){o&&(ie.value[t]=o)}function he(t){if(N.value.rowIndex===null)return;const o=t.target,n=se.value,r=Object.values(ie.value),l=n==null?void 0:n.contains(o),u=r.some(C=>C.contains(o));!l&&!u&&H()}return e.onMounted(()=>{document.addEventListener("click",he)}),e.onUnmounted(()=>{document.removeEventListener("click",he)}),(t,o)=>(e.openBlock(),e.createElementBlock("div",tt,[e.createElementVNode("div",nt,[e.createElementVNode("button",{type:"button",class:"shifl-grid__pill-button whitespace-nowrap",onClick:o[0]||(o[0]=n=>G.value=!0)}," Edit Columns ")]),e.createElementVNode("div",{class:e.normalizeClass(["shifl-grid__viewport",{"shifl-grid__viewport--scroll":Jt.value}])},[e.createElementVNode("table",ot,[e.createElementVNode("thead",null,[e.createElementVNode("tr",null,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(S.value,n=>{var r;return e.openBlock(),e.createElementBlock("th",{key:n.key,style:e.normalizeStyle(J(n,!0)),onClick:()=>sn(n.key),class:e.normalizeClass(["shifl-grid__header-cell",{"shifl-grid__cell--sticky":n.frozen}])},[e.createElementVNode("div",lt,[n.label?(e.openBlock(),e.createElementBlock("span",it,e.toDisplayString(n.label),1)):e.createCommentVNode("",!0),((r=e.unref(h))==null?void 0:r.key)===n.key&&!x(n)&&!Q(n)?(e.openBlock(),e.createElementBlock("span",st,[e.unref(h).order==="asc"?(e.openBlock(),e.createBlock(Oe,{key:0})):(e.openBlock(),e.createBlock(Ue,{key:1}))])):e.createCommentVNode("",!0)])],14,rt)}),128))])]),e.createElementVNode("tbody",null,[s.loading?(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:0},e.renderList(Qt.value,n=>(e.openBlock(),e.createElementBlock("tr",{key:`skeleton-${n}`,class:"shifl-grid__skeleton-row"},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(S.value,r=>(e.openBlock(),e.createElementBlock("td",{key:r.key,style:e.normalizeStyle(J(r,!1)),class:e.normalizeClass({"shifl-grid__cell--sticky":r.frozen})},[...o[5]||(o[5]=[e.createElementVNode("div",{class:"shifl-grid__skeleton-cell"},null,-1)])],6))),128))]))),128)):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[fe.value.length?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("tr",at,[e.createElementVNode("td",{colspan:S.value.length,class:"text-center text-gray-500 py-6"}," No data ",8,ct)])),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(fe.value,(n,r)=>(e.openBlock(),e.createElementBlock("tr",{key:r},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(S.value,l=>(e.openBlock(),e.createElementBlock("td",{key:l.key,style:e.normalizeStyle(J(l,!1)),class:e.normalizeClass([{"shifl-grid__cell--sticky":l.frozen},{"shifl-grid__cell--action":x(l)}])},[Q(l)?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[Bn(l,n)?(e.openBlock(),e.createElementBlock("div",dt,[e.createVNode(Re)])):e.createCommentVNode("",!0)],64)):x(l)?(e.openBlock(),e.createElementBlock("button",{key:1,type:"button",class:"shifl-grid__action-icon",ref_for:!0,ref:u=>Vn(r,u),onClick:e.withModifiers(u=>En(r,n,l,u),["stop"])},[z(l,n)?typeof z(l,n)=="string"?(e.openBlock(),e.createElementBlock("span",{key:1,innerHTML:z(l,n),class:"w-4 h-4 inline-block"},null,8,ut)):(e.openBlock(),e.createBlock(e.resolveDynamicComponent(z(l,n)),{key:2,class:"w-4 h-4"})):(e.openBlock(),e.createElementBlock("span",mt,"⋯"))],8,ft)):l.key.toLowerCase()==="type"?(e.openBlock(),e.createElementBlock("div",gt,[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(cn(n[l.key])),{class:"shifl-grid__type-icon"})),n.container_count!=null?(e.openBlock(),e.createElementBlock("span",pt," ("+e.toDisplayString(n.container_count)+") ",1)):e.createCommentVNode("",!0)])):l.key.toLowerCase()==="tag"||l.key.toLowerCase()==="tags"?(e.openBlock(),e.createElementBlock("div",ht,[e.createElementVNode("div",kt,[e.createElementVNode("div",{ref_for:!0,ref:"(el) => setTagsRef(col.key, rowIndex, el as HTMLElement)",class:"shifl-grid__chips-container shifl-grid__chips-container--single-line"},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(X(n[l.key],l.key,r),(u,C)=>(e.openBlock(),e.createElementBlock("span",{key:C,class:"shifl-grid__chip shifl-grid__chip--tag",style:e.normalizeStyle({borderLeftColor:Cn(u)})},e.toDisplayString(u),5))),128))],512)]),kn(n[l.key],l.key,r)?(e.openBlock(),e.createElementBlock("button",{key:0,type:"button",class:"shifl-grid__counter-button",onMouseenter:u=>Y(l.key,r,n[l.key],u.currentTarget),onMouseleave:q}," +"+e.toDisplayString(_n(n[l.key],l.key,r)),41,_t)):e.createCommentVNode("",!0)])):dn(l.key)?(e.openBlock(),e.createElementBlock("div",Ct,[e.createElementVNode("span",{class:"shifl-grid__truncated-text",ref_for:!0,ref:u=>pn(l.key,r,u)},e.toDisplayString(fn(n[l.key])),513),U(l.key)&&un(n[l.key])?(e.openBlock(),e.createElementBlock("button",{key:0,type:"button",class:"shifl-grid__counter-button",onMouseenter:u=>Y(l.key,r,n[l.key],u.currentTarget),onMouseleave:q}," +"+e.toDisplayString(gn(n[l.key])),41,yt)):!U(l.key)&&mn(n[l.key],l.key)?(e.openBlock(),e.createElementBlock("button",{key:1,type:"button",class:"shifl-grid__info-icon-button",onMouseenter:u=>Y(l.key,r,n[l.key],u.currentTarget),onMouseleave:q},[e.createVNode(et)],40,bt)):e.createCommentVNode("",!0)])):l.key.toLowerCase()==="status"?(e.openBlock(),e.createElementBlock("div",Bt,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(L(n[l.key]),(u,C)=>(e.openBlock(),e.createElementBlock("span",{key:C,class:"shifl-grid__chip"},e.toDisplayString(u),1))),128))])):(e.openBlock(),e.createElementBlock(e.Fragment,{key:6},[e.createTextVNode(e.toDisplayString(an(n[l.key])),1)],64))],6))),128))]))),128))],64))])])],2),b.value&&b.value.show!==!1?(e.openBlock(),e.createElementBlock("div",Et,[e.createElementVNode("div",wt,[e.createElementVNode("span",Mt,[o[6]||(o[6]=e.createTextVNode(" Showing ",-1)),e.createElementVNode("span",Vt,e.toDisplayString(me.value.from)+"–"+e.toDisplayString(me.value.to),1),e.createTextVNode(" of "+e.toDisplayString(O.value),1)])]),e.createElementVNode("div",Nt,[e.createElementVNode("div",Tt,[o[8]||(o[8]=e.createElementVNode("label",{class:"shifl-grid__pagination-label"},"Rows per page",-1)),e.createElementVNode("select",{value:b.value.perPage||20,disabled:s.loading,onChange:on,class:"shifl-grid__pagination-select"},[...o[7]||(o[7]=[e.createStaticVNode('<option value="20">20</option><option value="30">30</option><option value="50">50</option><option value="75">75</option><option value="100">100</option>',5)])],40,St)]),e.createElementVNode("div",$t,[e.createElementVNode("button",{type:"button",class:"shifl-grid__pagination-button",disabled:ue.value||s.loading,onClick:tn,"aria-label":"Previous page"}," ‹ ",8,Lt),e.createElementVNode("div",xt,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(vt.value,n=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:n},[n!==-1?(e.openBlock(),e.createElementBlock("button",{key:0,type:"button",class:e.normalizeClass(["shifl-grid__pagination-page",{"shifl-grid__pagination-page--active":n===T.value}]),disabled:s.loading,onClick:r=>en(n)},e.toDisplayString(n),11,zt)):(e.openBlock(),e.createElementBlock("span",Pt,"…"))],64))),128))]),e.createElementVNode("button",{type:"button",class:"shifl-grid__pagination-button",disabled:ge.value||s.loading,onClick:nn,"aria-label":"Next page"}," › ",8,Dt)])])])):e.createCommentVNode("",!0),(e.openBlock(),e.createBlock(e.Teleport,{to:"body"},[e.unref(N).rowIndex!==null&&e.unref(N).position?(e.openBlock(),e.createElementBlock("div",{key:0,ref_key:"actionMenuRef",ref:se,class:"shifl-grid__action-menu",style:e.normalizeStyle({position:"fixed",top:`${e.unref(N).position.top}px`,left:`${e.unref(N).position.left}px`,zIndex:1e3}),onClick:o[1]||(o[1]=e.withModifiers(()=>{},["stop"]))},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(wn(ae.value,R.value),n=>(e.openBlock(),e.createElementBlock("div",{key:n.key,class:e.normalizeClass(["shifl-grid__action-menu-item",{"shifl-grid__action-menu-item--danger":n.danger}]),onClick:()=>Mn(n,R.value,e.unref(N).rowIndex)},[n.icon&&typeof n.icon=="string"?(e.openBlock(),e.createElementBlock("span",{key:0,innerHTML:n.icon,class:"w-4 h-4 inline-block"},null,8,Ht)):n.icon?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(typeof n.icon=="function"?n.icon():n.icon),{key:1,class:"w-4 h-4"})):e.createCommentVNode("",!0),e.createElementVNode("span",null,e.toDisplayString(n.label),1)],10,At))),128))],4)):e.createCommentVNode("",!0)])),e.createVNode(De,{content:ce.value,visible:F.value,"trigger-element":I.value},null,8,["content","visible","trigger-element"]),(e.openBlock(),e.createBlock(e.Teleport,{to:"body"},[G.value?(e.openBlock(),e.createBlock(ze,{key:0,"title-prefix":i.config.name,columns:bn.value,onClose:o[2]||(o[2]=n=>G.value=!1),onToggle:e.unref(B),onToggleFrozen:e.unref(c),onMove:e.unref(f),onSelectAll:o[3]||(o[3]=n=>e.unref(m)(!0)),onDeselectAll:o[4]||(o[4]=n=>e.unref(m)(!1)),onRestoreDefault:e.unref(E)},null,8,["title-prefix","columns","onToggle","onToggleFrozen","onMove","onRestoreDefault"])):e.createCommentVNode("",!0)]))]))}}),Gt={install(i){i.component("ShiflGrid",oe)}};function Rt(i){return{rows:i.rows}}function Ft(){const i=e.ref(new Set);function a(s){const g=s.id??JSON.stringify(s),d=new Set(i.value);d.has(g)?d.delete(g):d.add(g),i.value=d}return{selectedKeys:i,toggleRow:a}}function It(){return{}}const re=Symbol("shifl-grid-theme"),le={surface:"var(--shifl-surface)",surfaceAlt:"var(--shifl-surface-alt)",border:"var(--shifl-border)",text:"var(--shifl-text)",textMuted:"var(--shifl-text-muted)",accent:"var(--shifl-accent)",accentStrong:"var(--shifl-accent-strong)",focus:"var(--shifl-focus)"};function Zt(i){const a=e.ref({...le,...i});return e.provide(re,a),a}function Ot(){const i=e.inject(re);return e.computed(()=>(i==null?void 0:i.value)??le)}const D={sm:640,lg:1024};function Wt(){const i=e.ref(typeof window<"u"?window.innerWidth:0);function a(){i.value=window.innerWidth}return e.onMounted(()=>{window.addEventListener("resize",a)}),e.onUnmounted(()=>{window.removeEventListener("resize",a)}),{width:i,isMobile:e.computed(()=>i.value<D.sm),isTablet:e.computed(()=>i.value>=D.sm&&i.value<D.lg)}}function jt(){return{}}function Kt(){return{}}function Ut(){return{}}_.ShiflGrid=oe,_.ShiflGridPlugin=Gt,_.provideGridTheme=Zt,_.useBreakpoints=Wt,_.useGridColumns=v,_.useGridData=Rt,_.useGridEditing=It,_.useGridFilter=te,_.useGridInfiniteScroll=jt,_.useGridSelection=Ft,_.useGridSort=ee,_.useGridTheme=Ot,_.useGridTour=Ut,_.useVirtualScroll=Kt,Object.defineProperty(_,Symbol.toStringTag,{value:"Module"})});
|
|
1
|
+
(function(k,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],e):(k=typeof globalThis<"u"?globalThis:k||self,e(k.ShiflGrid={},k.Vue))})(this,function(k,e){"use strict";function _e(i){const c=(i.columns||[]).map(s=>({...s,frozen:s.frozen??s.fixed??!1,visible:s.visible??!0,protected:s.protected??!1}));return{...i,columns:c,rows:i.rows??[],search:i.search??[],filters:i.filters??[],paginationMeta:i.paginationMeta?{show:i.paginationMeta.show??!0,currentPage:i.paginationMeta.currentPage??1,perPage:i.paginationMeta.perPage??20,total:i.paginationMeta.total??0,from:i.paginationMeta.from,to:i.paginationMeta.to,...i.paginationMeta}:void 0}}function v(i){const c=[...i],s=e.ref([...i]);function g(d){s.value=s.value.map(a=>a.key===d?{...a,visible:!a.visible}:a)}function f(d){s.value=s.value.map(a=>({...a,visible:d}))}function p(d){const a=s.value.map(h=>h.key===d?{...h,frozen:!h.frozen}:h),m=a.filter(h=>h.frozen),E=a.filter(h=>!h.frozen);s.value=[...m,...E]}function _(d,a){if(d===a||a<0||a>=s.value.length)return;const m=s.value.findIndex($=>!$.frozen),E=m===-1?s.value.length:m;if(d<E||a<E)return;const h=[...s.value],[V]=h.splice(d,1);h.splice(a,0,V),s.value=h}function C(){s.value=[...c]}const B=e.computed(()=>s.value.filter(d=>d.visible));return{columns:s,visibleColumns:B,toggleColumnVisibility:g,setAllVisible:f,toggleFrozen:p,moveColumn:_,resetColumns:C}}function ee(i){const c=e.ref(i);function s(f){var p;c.value=((p=c.value)==null?void 0:p.key)===f&&c.value.order==="asc"?{key:f,order:"desc"}:{key:f,order:"asc"}}function g(f){if(!c.value)return f;const{key:p,order:_}=c.value;return[...f].sort((C,B)=>{const d=C[p],a=B[p];if(d===a)return 0;if(d==null)return 1;if(a==null)return-1;const m=String(d).localeCompare(String(a),void 0,{numeric:!0});return _==="asc"?m:-m})}return{sort:c,setSort:s,applySort:g}}function te(){function i(c,s,g){const f=(g||"").trim().toLowerCase();return f?c.filter(p=>(s&&s.length?s.map(C=>p[C]):Object.values(p)).some(C=>String(C??"").toLowerCase().includes(f))):c}return{applyGlobalFilter:i}}function Ce(){const i=e.ref({rowIndex:null,position:null});function c(p,_,C=200){const B=_.getBoundingClientRect();let d=B.left;d+C>window.innerWidth-8&&(d=window.innerWidth-C+8),i.value={rowIndex:p,position:{top:B.bottom,left:d}}}function s(){i.value={rowIndex:null,position:null}}function g(p){return i.value.rowIndex===p}function f(p){p.key==="Escape"&&i.value.rowIndex!==null&&s()}return e.onMounted(()=>{document.addEventListener("keydown",f)}),e.onUnmounted(()=>{document.removeEventListener("keydown",f)}),{menuState:i,openMenu:c,closeMenu:s,isMenuOpen:g}}const ye={class:"shifl-column-manager__header"},be={class:"shifl-column-manager__title-wrapper"},Be={class:"shifl-column-manager__title"},Ee={key:0},we={key:1},Ve={class:"shifl-column-manager__controls"},Me={class:"shifl-column-manager__controls-left"},Ne={class:"shifl-column-manager__content"},Se={class:"shifl-column-manager__list"},Te=["draggable","onDragstart","onDragover","onDrop"],$e=["aria-label","disabled"],Le=["checked","disabled","onChange"],xe={class:"shifl-column-manager__label-text"},ze={class:"shifl-column-manager__footer"},Pe=e.defineComponent({__name:"GridColumnManager",props:{titlePrefix:{},columns:{}},emits:["close","toggle","move","toggleFrozen","selectAll","deselectAll","restoreDefault"],setup(i,{emit:c}){const s=i,g=e.computed(()=>s.columns),f=c,p=e.ref(null);function _(d){var a,m;(a=s.columns[d])!=null&&a.frozen||(m=s.columns[d])!=null&&m.protected||(p.value=d)}function C(d){}function B(d){p.value===null||p.value===d||(f("move",p.value,d),p.value=null)}return(d,a)=>(e.openBlock(),e.createElementBlock("div",{class:"shifl-column-manager__backdrop",onClick:a[7]||(a[7]=e.withModifiers(m=>d.$emit("close"),["self"]))},[e.createElementVNode("div",{class:"shifl-column-manager__dialog",role:"dialog","aria-modal":"true",onClick:a[6]||(a[6]=e.withModifiers(()=>{},["stop"]))},[e.createElementVNode("header",ye,[e.createElementVNode("div",be,[e.createElementVNode("h2",Be,[i.titlePrefix?(e.openBlock(),e.createElementBlock("span",Ee,e.toDisplayString(i.titlePrefix),1)):e.createCommentVNode("",!0),i.titlePrefix?(e.openBlock(),e.createElementBlock("span",we,">")):e.createCommentVNode("",!0),a[8]||(a[8]=e.createTextVNode("Edit Columns ",-1))])]),e.createElementVNode("button",{type:"button",class:"shifl-column-manager__close",onClick:a[0]||(a[0]=m=>d.$emit("close"))},[...a[9]||(a[9]=[e.createElementVNode("span",null,"✕",-1)])])]),e.createElementVNode("div",Ve,[e.createElementVNode("div",Me,[e.createElementVNode("button",{type:"button",class:"shifl-column-manager__link-button",onClick:a[1]||(a[1]=m=>d.$emit("selectAll"))}," Select All "),e.createElementVNode("button",{type:"button",class:"shifl-column-manager__link-button",onClick:a[2]||(a[2]=m=>d.$emit("deselectAll"))}," Deselect All ")]),e.createElementVNode("button",{type:"button",class:"shifl-column-manager__link-button shifl-column-manager__link-button--primary",onClick:a[3]||(a[3]=m=>d.$emit("restoreDefault"))}," Restore Default ")]),e.createElementVNode("div",Ne,[e.createElementVNode("ul",Se,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(g.value,(m,E)=>(e.openBlock(),e.createElementBlock("li",{key:m.key,class:e.normalizeClass(["shifl-column-manager__item",{"shifl-column-manager__item--disabled":m.frozen||m.protected}]),draggable:!m.frozen&&!m.protected,onDragstart:h=>_(E),onDragover:e.withModifiers(h=>void 0,["prevent"]),onDrop:e.withModifiers(h=>B(E),["prevent"])},[e.createElementVNode("button",{type:"button",class:e.normalizeClass(["shifl-column-manager__drag-handle",{"shifl-column-manager__drag-handle--disabled":m.frozen||m.protected}]),"aria-label":`Move ${m.label}`,disabled:m.frozen||m.protected},[...a[10]||(a[10]=[e.createElementVNode("span",null,"⋮⋮",-1)])],10,$e),e.createElementVNode("label",{class:e.normalizeClass(["shifl-column-manager__checkbox-label",{"shifl-column-manager__checkbox-label--disabled":m.frozen||m.protected}])},[e.createElementVNode("input",{type:"checkbox",class:"shifl-column-manager__checkbox",checked:m.visible,disabled:m.frozen||m.protected,onChange:h=>d.$emit("toggle",m.key)},null,40,Le),a[11]||(a[11]=e.createElementVNode("span",{class:"shifl-column-manager__checkbox-custom"},null,-1)),e.createElementVNode("span",xe,e.toDisplayString(m.label),1)],2)],42,Te))),128))])]),e.createElementVNode("footer",ze,[e.createElementVNode("button",{type:"button",class:"shifl-column-manager__button shifl-column-manager__button--primary",onClick:a[4]||(a[4]=m=>d.$emit("close"))}," Update "),e.createElementVNode("button",{type:"button",class:"shifl-column-manager__button shifl-column-manager__button--secondary",onClick:a[5]||(a[5]=m=>d.$emit("close"))}," Cancel ")])])]))}}),M=(i,c)=>{const s=i.__vccOpts||i;for(const[g,f]of c)s[g]=f;return s},De=M(Pe,[["__scopeId","data-v-e57fe743"]]),Ae={class:"shifl-grid__tooltip-content"},Ge=M(e.defineComponent({__name:"GridTooltip",props:{content:{},visible:{type:Boolean},triggerElement:{}},setup(i){const c=i,s=e.ref(null),g=e.ref({}),f=e.computed(()=>c.content.includes(`
|
|
2
|
+
`)),p=e.computed(()=>f.value?c.content.split(`
|
|
3
|
+
`).filter(d=>d.trim().length>0):[]),_=e.ref("top"),C=e.ref({});function B(){if(!c.triggerElement||!s.value)return;const d=c.triggerElement.getBoundingClientRect(),a=s.value.getBoundingClientRect(),m=window.innerWidth,E=window.innerHeight;let h=d.bottom+8,V=d.left+scrollX;V+a.width>m-16&&(V=m-a.width-16),V<16&&(V=16),h+a.height>E-16?(h=d.top-a.height-8,_.value="bottom"):_.value="top",g.value={position:"fixed",top:`${h}px`,left:`${V}px`,zIndex:"10000"};const $=d.left+d.width/2-V;C.value={left:`${$}px`}}return e.watch(()=>c.visible,async d=>{d&&(await e.nextTick(),B())}),e.onMounted(()=>{c.visible&&e.nextTick(()=>B())}),e.onUnmounted(()=>{}),(d,a)=>(e.openBlock(),e.createBlock(e.Teleport,{to:"body"},[i.visible?(e.openBlock(),e.createElementBlock("div",{key:0,ref_key:"tooltipRef",ref:s,class:"shifl-grid__tooltip",style:e.normalizeStyle(g.value)},[e.createElementVNode("div",{class:e.normalizeClass(["shifl-grid__tooltip-arrow",_.value]),style:e.normalizeStyle(C.value)},null,6),e.createElementVNode("div",Ae,[f.value?(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:0},e.renderList(p.value,(m,E)=>(e.openBlock(),e.createElementBlock("div",{key:E,class:"shifl-grid__tooltip-line"},e.toDisplayString(m),1))),128)):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.createTextVNode(e.toDisplayString(i.content),1)],64))])],4)):e.createCommentVNode("",!0)]))}}),[["__scopeId","data-v-44347dc9"]]),He={},Re={width:"14",height:"15",viewBox:"0 0 14 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",class:"shifl-smart-tracking-icon"};function Fe(i,c){return e.openBlock(),e.createElementBlock("svg",Re,[...c[0]||(c[0]=[e.createElementVNode("path",{d:"M1.03223 9.27441C1.22778 9.27445 1.40954 9.32951 1.57812 9.43066L3.86523 10.8594C4.1957 11.0618 4.3916 11.4202 4.3916 11.8047C4.39151 12.189 4.19562 12.5467 3.86523 12.749L1.57812 14.1797C1.41642 14.2806 1.22754 14.334 1.03223 14.334V14.3408C0.465713 14.3408 0.000165713 13.8751 0 13.3086V10.3066C0.000236867 9.74022 0.465756 9.27443 1.03223 9.27441ZM1.01172 13.3018L3.3252 11.8916C3.32796 11.8884 3.3728 11.8374 3.37305 11.8047C3.37305 11.771 3.35218 11.737 3.3252 11.7168L1.03906 10.2871L1.01172 13.3018ZM6.07129 3.37305C6.35041 3.37318 6.5771 3.59977 6.57715 3.87891C6.57715 4.15809 6.35044 4.38463 6.07129 4.38477H5.05957C4.03708 4.38477 3.20433 5.06537 3.2041 5.90234C3.2041 6.73947 4.03694 7.4209 5.05957 7.4209H7.08301C8.66344 7.42096 9.95019 8.55525 9.9502 9.9502C9.95009 11.3451 8.66338 12.4794 7.08301 12.4795H6.07129C5.79202 12.4795 5.56543 12.2529 5.56543 11.9736C5.56548 11.6944 5.79205 11.4678 6.07129 11.4678H7.08301C8.10552 11.4677 8.93739 10.7872 8.9375 9.9502C8.93749 9.11311 8.10558 8.43267 7.08301 8.43262H5.05957C3.47908 8.43262 2.19238 7.29733 2.19238 5.90234C2.19259 4.50751 3.4792 3.37305 5.05957 3.37305H6.07129ZM10.7939 0C12.0694 0.000131868 13.2591 0.779675 13.7549 1.94043C14.6093 3.9666 13.0453 5.42741 11.9033 6.49316L11.8818 6.51367C11.7964 6.59308 11.711 6.67193 11.6289 6.75C11.4057 6.96444 11.1095 7.08195 10.7939 7.08203C10.4783 7.08203 10.1803 6.9642 9.95703 6.74902C9.86266 6.65937 9.76511 6.56666 9.66602 6.47363L9.66016 6.46875C8.53029 5.40836 6.98418 3.95585 7.83203 1.94238C8.32854 0.77953 9.51841 6.29203e-06 10.7939 0ZM10.7939 1.01172C9.91775 1.01173 9.10234 1.54537 8.76367 2.33789C8.22961 3.60525 9.04604 4.50453 10.3525 5.73145L10.4229 5.79688C10.5024 5.87104 10.5804 5.94604 10.6572 6.01953C10.7267 6.08617 10.861 6.08446 10.9277 6.02051L10.9307 6.01758C11.0223 5.93066 11.1172 5.84284 11.2129 5.75391C12.5356 4.51951 13.3612 3.61352 12.8223 2.33594C12.4849 1.54493 11.6691 1.0127 10.793 1.0127L10.7939 1.01172ZM10.7998 2.53027C11.1719 2.53041 11.4734 2.83199 11.4736 3.2041C11.4736 3.57637 11.172 3.87877 10.7998 3.87891C10.4275 3.87882 10.1221 3.57641 10.1221 3.2041C10.1223 2.8319 10.4207 2.53027 10.793 2.53027H10.7998Z",fill:"#05963F"},null,-1)])])}const Ie=M(He,[["render",Fe]]),Ze={},We={width:"14",height:"10",viewBox:"0 0 14 10",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function Oe(i,c){return e.openBlock(),e.createElementBlock("svg",We,[...c[0]||(c[0]=[e.createElementVNode("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M0 0.666667C0 0.298477 0.314186 2.98023e-08 0.701754 2.98023e-08H4.2807C4.66827 2.98023e-08 4.98246 0.298477 4.98246 0.666667C4.98246 1.03486 4.66827 1.33333 4.2807 1.33333H0.701754C0.314186 1.33333 0 1.03486 0 0.666667ZM10.0301 0.195262C10.3042 -0.0650874 10.7485 -0.0650874 11.0225 0.195262L13.1278 2.19526C13.4018 2.45561 13.4018 2.87772 13.1278 3.13807C12.8537 3.39842 12.4094 3.39842 12.1354 3.13807L11.2281 2.27614V8.66667C11.2281 9.03486 10.9139 9.33333 10.5263 9.33333C10.1387 9.33333 9.82456 9.03486 9.82456 8.66667V2.27614L8.91727 3.13807C8.64322 3.39842 8.19889 3.39842 7.92484 3.13807C7.65079 2.87772 7.65079 2.45561 7.92484 2.19526L10.0301 0.195262ZM0 4.66667C0 4.29848 0.314186 4 0.701754 4H5.61404C6.0016 4 6.31579 4.29848 6.31579 4.66667C6.31579 5.03486 6.0016 5.33333 5.61404 5.33333H0.701754C0.314186 5.33333 0 5.03486 0 4.66667ZM0 8.66667C0 8.29848 0.314186 8 0.701754 8H7.01754C7.40511 8 7.7193 8.29848 7.7193 8.66667C7.7193 9.03486 7.40511 9.33333 7.01754 9.33333H0.701754C0.314186 9.33333 0 9.03486 0 8.66667Z",fill:"#1A6D9E"},null,-1)])])}const je=M(Ze,[["render",Oe]]),Ke={},Ue={width:"14",height:"10",viewBox:"0 0 14 10",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function qe(i,c){return e.openBlock(),e.createElementBlock("svg",Ue,[...c[0]||(c[0]=[e.createElementVNode("path",{d:"M4.28125 8C4.66872 8.00011 4.98242 8.29887 4.98242 8.66699C4.98242 9.03511 4.66872 9.33387 4.28125 9.33398H0.702148C0.314581 9.33398 8.1338e-07 9.03518 0 8.66699C0 8.2988 0.31458 8 0.702148 8H4.28125ZM10.5264 0C10.9139 0 11.2285 0.298802 11.2285 0.666992V7.05762L12.1357 6.19531C12.4097 5.93519 12.8539 5.93524 13.1279 6.19531C13.402 6.45566 13.402 6.87832 13.1279 7.13867L11.0225 9.13867C10.7484 9.39867 10.3042 9.39886 10.0303 9.13867L7.9248 7.13867C7.65082 6.87834 7.65082 6.45565 7.9248 6.19531C8.19886 5.93496 8.64392 5.93496 8.91797 6.19531L9.8252 7.05762V0.666992C9.8252 0.298891 10.1389 0.000143144 10.5264 0ZM5.61426 4C6.00183 4 6.31641 4.2988 6.31641 4.66699C6.31641 5.03518 6.00183 5.33398 5.61426 5.33398H0.702148C0.314581 5.33398 6.77817e-07 5.03518 0 4.66699C0 4.2988 0.31458 4 0.702148 4H5.61426ZM7.01758 0C7.40515 0 7.71973 0.298802 7.71973 0.666992C7.71973 1.03518 7.40515 1.33398 7.01758 1.33398H0.702148C0.31458 1.33398 5.42254e-07 1.03518 0 0.666992C0 0.298802 0.31458 0 0.702148 0H7.01758Z",fill:"#1A6D9E"},null,-1)])])}const Je=M(Ke,[["render",qe]]),Xe={},Ye={width:"21",height:"13",viewBox:"0 0 21 13",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function Qe(i,c){return e.openBlock(),e.createElementBlock("svg",Ye,[...c[0]||(c[0]=[e.createElementVNode("path",{d:"M19.6426 4.61523C19.9311 4.61524 20.1317 4.90139 20.0342 5.17285L17.499 12.2246C17.4395 12.3899 17.2821 12.5 17.1064 12.5H1.5459C1.35628 12.5 1.19044 12.3719 1.14258 12.1885L0.0136719 7.83887C-0.0548101 7.575 0.14438 7.31738 0.416992 7.31738H12.6016L14.71 4.61523H19.6426ZM3.51465 8.82324C3.11322 8.82324 2.78728 9.15265 2.78711 9.55859C2.78711 9.96468 3.11312 10.2939 3.51465 10.2939C3.9161 10.2938 4.24121 9.96462 4.24121 9.55859C4.24104 9.15271 3.91599 8.82334 3.51465 8.82324ZM7.87695 8.82324C7.47553 8.82324 7.14958 9.15265 7.14941 9.55859C7.14941 9.96468 7.47542 10.2939 7.87695 10.2939C8.27846 10.2939 8.60352 9.96466 8.60352 9.55859C8.60335 9.15267 8.27835 8.82327 7.87695 8.82324ZM12.2393 8.82324C11.8378 8.82324 11.5119 9.15265 11.5117 9.55859C11.5117 9.96468 11.8377 10.2939 12.2393 10.2939C12.6407 10.2938 12.9658 9.96458 12.9658 9.55859C12.9657 9.15275 12.6405 8.82341 12.2393 8.82324ZM10.3291 3.67676C10.5591 3.67679 10.7459 3.86283 10.7461 4.09277V5.46582C10.746 5.69585 10.5591 5.88278 10.3291 5.88281H1.75C1.51993 5.88281 1.33309 5.69587 1.33301 5.46582V4.09277C1.3332 3.86282 1.52 3.67676 1.75 3.67676H10.3291ZM8.91406 0C9.14418 0 9.33105 0.186874 9.33105 0.416992V1.78906C9.33105 2.01918 9.14418 2.20605 8.91406 2.20605H3.2041C2.97398 2.20605 2.78711 2.01918 2.78711 1.78906V0.416992C2.78711 0.186874 2.97398 1.52829e-06 3.2041 0H8.91406Z",fill:"#9CA5B4"},null,-1)])])}const ne=M(Xe,[["render",Qe]]),ve={},et={width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function tt(i,c){return e.openBlock(),e.createElementBlock("svg",et,[...c[0]||(c[0]=[e.createElementVNode("path",{d:"M7.99976 0.799561C11.9761 0.799561 15.1998 4.0234 15.2 7.99976C15.2 11.9762 11.9762 15.2 7.99976 15.2C4.0234 15.1998 0.799561 11.9761 0.799561 7.99976C0.799666 4.02346 4.02346 0.799666 7.99976 0.799561ZM7.99976 1.87964C4.61984 1.87974 1.87974 4.61984 1.87964 7.99976C1.87964 11.3798 4.61977 14.1198 7.99976 14.1199C11.3798 14.1199 14.1199 11.3798 14.1199 7.99976C14.1198 4.61977 11.3798 1.87964 7.99976 1.87964ZM7.9978 6.91968C8.27087 6.91973 8.49698 7.12223 8.53296 7.3855L8.53784 7.45874L8.53979 11.4197C8.5399 11.7178 8.29882 11.9595 8.00073 11.9597C7.72754 11.9599 7.50169 11.7572 7.46558 11.4939L7.46069 11.4207L7.45776 7.45972C7.45757 7.16153 7.69962 6.91987 7.9978 6.91968ZM8.00073 4.40112C8.39742 4.40137 8.71923 4.72319 8.71948 5.11987C8.71948 5.51677 8.39757 5.83935 8.00073 5.8396C7.60368 5.8396 7.28101 5.51692 7.28101 5.11987C7.28126 4.72304 7.60384 4.40112 8.00073 4.40112Z",fill:"#69758C"},null,-1)])])}const nt=M(ve,[["render",tt]]),ot={class:"shifl-grid relative"},rt={class:"shifl-grid__controls"},lt={class:"shifl-grid__table"},it=["onClick"],st={class:"shifl-grid__header-content"},at={key:0,class:"shifl-grid__header-label"},ct={key:1,class:"shifl-grid__sort-icon"},dt={key:0},ft=["colspan"],mt={key:0,class:"shifl-grid__smart-tracking-icon"},ut=["onClick"],gt={key:0},pt=["innerHTML"],ht={key:2,class:"shifl-grid__type-cell"},kt={key:0,class:"shifl-grid__container-badge"},_t={key:3,class:"shifl-grid__tags-cell"},Ct={class:"shifl-grid__tags-wrapper"},yt=["onMouseenter"],bt={key:4,class:"shifl-grid__truncated-cell"},Bt=["onMouseenter"],Et=["onMouseenter"],wt={key:5,class:"shifl-grid__chips-container"},Vt={key:0,class:"shifl-grid__pagination"},Mt={class:"shifl-grid__pagination-left"},Nt={class:"shifl-grid__pagination-range"},St={class:"shifl-grid__pagination-range-numbers"},Tt={class:"shifl-grid__pagination-right"},$t={class:"shifl-grid__pagination-rows"},Lt=["value","disabled"],xt={class:"shifl-grid__pagination-nav"},zt=["disabled"],Pt={class:"shifl-grid__pagination-pages"},Dt=["disabled","onClick"],At={key:1,class:"shifl-grid__pagination-ellipsis"},Gt=["disabled"],Ht=["onClick"],Rt=["innerHTML"],Ft=8,oe=e.defineComponent({__name:"ShiflGrid",props:{config:{},search:{},loading:{type:Boolean}},emits:["action-click","search-change","pagination-change"],setup(i,{emit:c}){const s=i,g=c,f=e.computed(()=>_e(s.config)),p=e.computed(()=>f.value.columns.filter(t=>!t.smartTrackingColumn)),{columns:_,visibleColumns:C,toggleColumnVisibility:B,setAllVisible:d,toggleFrozen:a,moveColumn:m,resetColumns:E}=v(p.value),{sort:h,setSort:V,applySort:$}=ee(f.value.sort),{applyGlobalFilter:Yt}=te(),{menuState:N,openMenu:Qt,closeMenu:G}=Ce(),H=e.ref(!1),ie=e.ref({}),se=e.ref(null),ae=e.ref(null),R=e.ref(null),F=e.ref(!1),ce=e.ref(""),I=e.ref(null),vt=e.ref({});e.ref({});const Z=e.ref({});e.watch(()=>f.value.columns,t=>{const o=t.filter(n=>!n.smartTrackingColumn);_.value=[...o]},{deep:!0}),e.watch(()=>f.value.sort,t=>{t&&(h.value=t)},{deep:!0}),e.watch(()=>s.search,(t,o)=>{var n;if(f.value.searchMode==="server")g("search-change",t||"");else if(f.value.searchMode==="client"&&t!==o){const r=((n=b.value)==null?void 0:n.perPage)||20;g("pagination-change",1,r)}});const de=e.computed(()=>{if((f.value.searchMode||"client")==="server")return f.value.rows;const o=s.search||"";return Yt(f.value.rows,f.value.search,o)}),W=e.computed(()=>{var o;return(f.value.searchMode||"client")==="client"?de.value.length:((o=b.value)==null?void 0:o.total)||0}),O=e.computed(()=>$(de.value)),fe=e.computed(()=>{if((f.value.searchMode||"client")==="server")return O.value;const o=b.value;if(!o||!o.show)return O.value;const n=o.perPage||20,l=((o.currentPage||1)-1)*n,u=l+n;return O.value.slice(l,u)}),b=e.computed(()=>f.value.paginationMeta),en=e.computed(()=>{var t;return((t=b.value)==null?void 0:t.perPage)===100}),tn=e.computed(()=>{var t;return((t=b.value)==null?void 0:t.perPage)||10}),me=e.computed(()=>{const t=b.value;if(!t||!t.show)return{from:0,to:0};const o=W.value,n=t.perPage||20,r=t.currentPage||1;if((f.value.searchMode||"client")==="server"&&t.from!==void 0&&t.to!==void 0)return{from:t.from,to:t.to};const u=(r-1)*n+1,y=Math.min(r*n,o);return o===0?{from:0,to:0}:{from:u,to:y}}),S=e.computed(()=>{var t;return((t=b.value)==null?void 0:t.currentPage)||1}),j=e.computed(()=>{const t=b.value;if(!t||!t.show)return 1;const o=W.value;if(o===0)return 1;const n=t.perPage||20,r=Math.ceil(o/n);return Math.max(1,r)}),ue=e.computed(()=>S.value<=1),ge=e.computed(()=>S.value>=j.value),nn=e.computed(()=>{const t=j.value,o=S.value,n=[];if(t<=7)for(let r=1;r<=t;r++)n.push(r);else if(o<=4){for(let r=1;r<=5;r++)n.push(r);n.push(-1),n.push(t)}else if(o>=t-3){n.push(1),n.push(-1);for(let r=t-4;r<=t;r++)n.push(r)}else{n.push(1),n.push(-1);for(let r=o-1;r<=o+1;r++)n.push(r);n.push(-1),n.push(t)}return n});function on(t){var n;if(t<1||t>j.value||t===S.value||s.loading)return;const o=((n=b.value)==null?void 0:n.perPage)||20;g("pagination-change",t,o)}function rn(){var o;if(ue.value||s.loading)return;const t=((o=b.value)==null?void 0:o.perPage)||20;g("pagination-change",S.value-1,t)}function ln(){var o;if(ge.value||s.loading)return;const t=((o=b.value)==null?void 0:o.perPage)||20;g("pagination-change",S.value+1,t)}function sn(t){var r;if(s.loading)return;const o=t.target,n=parseInt(o.value,10);n&&n!==(((r=b.value)==null?void 0:r.perPage)||20)&&g("pagination-change",1,n)}const an=e.computed(()=>{const t=f.value.columns.find(n=>n.smartTrackingColumn);if(!(t!=null&&t.smartTrackingColumn))return!1;const o=t.smartTrackingColumn.dataKey;return f.value.rows.some(n=>{const r=n[o];return r===!0||r===1||r==="true"||r==="1"})}),K=e.computed(()=>f.value.columns.find(t=>t.smartTrackingColumn)),T=e.computed(()=>{var n;const t=C.value.filter(r=>!r.smartTrackingColumn);if(an.value&&K.value){const r={key:"_smart_tracking",label:"",order:-1,frozen:!0,visible:!0,protected:!0,sortable:!1,width:((n=K.value.smartTrackingColumn)==null?void 0:n.width)||"36px",smartTrackingColumn:K.value.smartTrackingColumn},l=t.findIndex(u=>u.key==="ref");l>=0?t.splice(l,0,r):t.unshift(r)}const o=t.find(r=>r.key==="ref");return o&&(o.frozen=!0,o.protected=!0),t}),cn=e.computed(()=>{let t=0;const o={};for(const n of T.value){n.frozen&&(o[n.key]=t);const r=parseInt(n.width??"160",10);Number.isNaN(r)||(t+=r+Ft*2)}return o}),pe=e.ref(0);function dn(t){const o=t.target;pe.value=o.scrollLeft}function fn(t){const o=_.value.find(n=>n.key===t);!(o!=null&&o.sortable)||z(o)||Q(o)||V(t)}function mn(t){return t==null?"":typeof t=="object"?JSON.stringify(t):String(t)}function un(t){return typeof t=="string"&&t.toLowerCase()==="ocean",ne}function gn(t){const o=t.toLowerCase();return["supplier","suppliers","po","pos","product_description"].includes(o)}function pn(t){if(t==null)return"";if(Array.isArray(t)){if(t.length===0)return"";const o=t.join(", ");return he(o,45)}return typeof t=="string"?he(t,45):String(t)}function he(t,o){return t.length<=o?t:t.substring(0,o)+"..."}function U(t){const o=t.toLowerCase();return["po","pos","supplier","suppliers","tag","tags"].includes(o)}function hn(t,o){return t==null||U(o)?!1:Array.isArray(t)?t.length===0?!1:t.join(", ").length>30:typeof t=="string"?t.length>30:!1}function kn(t){return t==null?!1:Array.isArray(t)?t.length===0?!1:t.join(", ").length>45:typeof t=="string"?t.length>45:!1}function _n(t){if(t==null)return 0;if(Array.isArray(t)){if(t.length===0||t.join(", ").length<=45)return 0;let n=0,r=0;for(let l=0;l<t.length;l++){const u=String(t[l]),w=(l>0?", ":"").length+u.length;if(n+w<=45)n+=w,r++;else break}return t.length-r}return typeof t=="string"&&t.length>45?1:0}function q(t,o,n,r){let l="";Array.isArray(n)?n.length>0&&(l=n.join(`
|
|
4
|
+
`)):n!=null&&(l=String(n)),ce.value=l,I.value=r,F.value=!0}function J(){F.value=!1,I.value=null}function Cn(t,o,n){n&&(vt.value[`${t}-${o}`]=n)}function x(t){return t==null?[]:Array.isArray(t)?t.map(o=>String(o)).filter(o=>o.length>0):typeof t=="string"?t.split(",").map(o=>o.trim()).filter(o=>o.length>0):[String(t)]}function X(t,o,n){const r=x(t);if(r.length===0)return[];const l=`${o}-${n}`;if(Z.value[l])return Z.value[l];const u=T.value.find(D=>D.key===o),w=(u!=null&&u.width?parseInt(u.width):200)-32,L=yn(r,w);return Z.value[l]=L,L}function yn(t,o){if(t.length===0)return[];const n=document.createElement("div");n.style.cssText="position: absolute; visibility: hidden; display: flex; flex-wrap: nowrap; gap: 6px;",n.className="shifl-grid__chips-container",document.body.appendChild(n);let r=0,l=0;const u=40;for(let y=0;y<t.length;y++){const w=document.createElement("span");w.className="shifl-grid__chip shifl-grid__chip--tag",w.textContent=t[y],w.style.cssText="padding: 4px 8px; border-left: 3px solid; border: 1px solid; background: white; white-space: nowrap;",n.appendChild(w);const L=w.offsetWidth,D=y>0?6:0,Ln=y<t.length-1;if(l+D+L+(Ln?u:0)>o&&y>0){n.removeChild(w);break}l+=D+L,r++}return document.body.removeChild(n),t.slice(0,r)}function bn(t,o,n){const r=x(t),l=X(t,o,n);return r.length>l.length}function Bn(t,o,n){const r=x(t),l=X(t,o,n);return r.length-l.length}function En(t){const o=t.toLowerCase(),n={"high priority":"var(--shifl-color-error-r70)",express:"var(--shifl-color-primary-b80)",fragile:"var(--shifl-color-warning-o70)","temperature controlled":"var(--shifl-color-primary-b70)","customs clearance required":"var(--shifl-color-accent-p80)","insurance required":"var(--shifl-color-primary-b90)","special handling":"var(--shifl-color-warning-o80)","urgent delivery":"var(--shifl-color-error-r80)",normal:"var(--shifl-color-neutral-n60)",low:"var(--shifl-color-neutral-n50)"};if(n[o])return n[o];for(const[r,l]of Object.entries(n))if(o.includes(r)||r.includes(o))return l;return wn(t)}function wn(t){let o=0;for(let r=0;r<t.length;r++)o=t.charCodeAt(r)+((o<<5)-o);const n=["var(--shifl-color-primary-b80)","var(--shifl-color-success-g70)","var(--shifl-color-warning-o70)","var(--shifl-color-error-r70)","var(--shifl-color-accent-p80)","var(--shifl-color-primary-b70)","var(--shifl-color-success-g60)","var(--shifl-color-warning-o60)"];return n[Math.abs(o)%n.length]}function Y(t,o=!0){const r={...{width:t.width??"160px",minWidth:t.width??"160px"}},l=pe.value>0;if(t.frozen){const u=cn.value[t.key]??0;r.position="sticky",r.left=`${u}px`,r.background="#ffffff",r.boxShadow=l?"2px 0 6px rgba(0, 0, 0, 0.12)":"none",r.zIndex=o?40:10}return o&&(r.position="sticky",r.top="0px"),r}const Vn=e.computed(()=>_.value.filter(t=>!t.smartTrackingColumn));function z(t){return!!t.actionColumn}function Q(t){return!!t.smartTrackingColumn}function Mn(t,o){if(!t.smartTrackingColumn)return!1;const n=t.smartTrackingColumn.dataKey,r=o[n];if(r===!0||r===1)return!0;if(typeof r=="string"){const l=r.toLowerCase().trim();return l==="true"||l==="1"||l==="yes"}return!1}function P(t,o){if(!t.actionColumn)return null;const n=t.actionColumn.icon;return n?typeof n=="function"?n(o):n:null}function Nn(t,o,n,r){if(!n.actionColumn)return;const l=r.currentTarget;if(N.value.rowIndex===t){G();return}ae.value=n,R.value=o,Qt(t,l)}function Sn(t,o){return!(t!=null&&t.actionColumn)||!o?[]:(typeof t.actionColumn.actions=="function"?t.actionColumn.actions(o):t.actionColumn.actions).filter(r=>r.show?r.show(o):!0)}function Tn(t,o,n){g("action-click",t.key,o,n),G()}function $n(t,o){o&&(ie.value[t]=o)}function ke(t){if(N.value.rowIndex===null)return;const o=t.target,n=se.value,r=Object.values(ie.value),l=n==null?void 0:n.contains(o),u=r.some(y=>y.contains(o));!l&&!u&&G()}return e.onMounted(()=>{document.addEventListener("click",ke)}),e.onUnmounted(()=>{document.removeEventListener("click",ke)}),(t,o)=>(e.openBlock(),e.createElementBlock("div",ot,[e.createElementVNode("div",rt,[e.createElementVNode("button",{type:"button",class:"shifl-grid__pill-button whitespace-nowrap",onClick:o[0]||(o[0]=n=>H.value=!0)}," Edit Column ")]),e.createElementVNode("div",{class:e.normalizeClass(["shifl-grid__viewport",{"shifl-grid__viewport--scroll":en.value}]),onScroll:dn},[e.createElementVNode("table",lt,[e.createElementVNode("thead",null,[e.createElementVNode("tr",null,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(T.value,n=>{var r;return e.openBlock(),e.createElementBlock("th",{key:n.key,style:e.normalizeStyle(Y(n,!0)),onClick:()=>fn(n.key),class:e.normalizeClass(["shifl-grid__header-cell",`shifl-grid__header-align-${n!=null&&n.align?n.align:"left"}`,{"shifl-grid__cell--sticky":n.frozen,"shifl-grid__sortable-col":n.sortable}])},[e.createElementVNode("div",st,[n.label?(e.openBlock(),e.createElementBlock("span",at,e.toDisplayString(n.label),1)):e.createCommentVNode("",!0),((r=e.unref(h))==null?void 0:r.key)===n.key&&!z(n)&&!Q(n)?(e.openBlock(),e.createElementBlock("span",ct,[e.unref(h).order==="asc"?(e.openBlock(),e.createBlock(je,{key:0})):(e.openBlock(),e.createBlock(Je,{key:1}))])):e.createCommentVNode("",!0)])],14,it)}),128))])]),e.createElementVNode("tbody",null,[s.loading?(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:0},e.renderList(tn.value,n=>(e.openBlock(),e.createElementBlock("tr",{key:`skeleton-${n}`,class:"shifl-grid__skeleton-row"},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(T.value,r=>(e.openBlock(),e.createElementBlock("td",{key:r.key,style:e.normalizeStyle(Y(r,!1)),class:e.normalizeClass({"shifl-grid__cell--sticky":r.frozen})},[...o[5]||(o[5]=[e.createElementVNode("div",{class:"shifl-grid__skeleton-cell"},null,-1)])],6))),128))]))),128)):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[fe.value.length?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("tr",dt,[e.createElementVNode("td",{colspan:T.value.length,class:"text-center text-gray-500 py-6"}," No data ",8,ft)])),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(fe.value,(n,r)=>(e.openBlock(),e.createElementBlock("tr",{key:r},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(T.value,l=>(e.openBlock(),e.createElementBlock("td",{key:l.key,style:e.normalizeStyle(Y(l,!1)),class:e.normalizeClass([{"shifl-grid__cell--sticky":l.frozen},{"shifl-grid__cell--action":z(l)},`shifl-grid__cell-align-${l!=null&&l.align?l.align:"left"}`])},[Q(l)?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[Mn(l,n)?(e.openBlock(),e.createElementBlock("div",mt,[e.createVNode(Ie)])):e.createCommentVNode("",!0)],64)):z(l)?(e.openBlock(),e.createElementBlock("button",{key:1,type:"button",class:"shifl-grid__action-icon",ref_for:!0,ref:u=>$n(r,u),onClick:e.withModifiers(u=>Nn(r,n,l,u),["stop"])},[P(l,n)?typeof P(l,n)=="string"?(e.openBlock(),e.createElementBlock("span",{key:1,innerHTML:P(l,n),class:"w-4 h-4 inline-block"},null,8,pt)):(e.openBlock(),e.createBlock(e.resolveDynamicComponent(P(l,n)),{key:2,class:"w-4 h-4"})):(e.openBlock(),e.createElementBlock("span",gt,"⋯"))],8,ut)):l.key.toLowerCase()==="type"?(e.openBlock(),e.createElementBlock("div",ht,[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(un(n[l.key])),{class:"shifl-grid__type-icon"})),n.container_count!=null?(e.openBlock(),e.createElementBlock("span",kt," ("+e.toDisplayString(n.container_count)+") ",1)):e.createCommentVNode("",!0)])):l.key.toLowerCase()==="tag"||l.key.toLowerCase()==="tags"?(e.openBlock(),e.createElementBlock("div",_t,[e.createElementVNode("div",Ct,[e.createElementVNode("div",{ref_for:!0,ref:"(el) => setTagsRef(col.key, rowIndex, el as HTMLElement)",class:"shifl-grid__chips-container shifl-grid__chips-container--single-line"},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(X(n[l.key],l.key,r),(u,y)=>(e.openBlock(),e.createElementBlock("span",{key:y,class:"shifl-grid__chip shifl-grid__chip--tag",style:e.normalizeStyle({borderLeftColor:En(u)})},e.toDisplayString(u),5))),128))],512)]),bn(n[l.key],l.key,r)?(e.openBlock(),e.createElementBlock("button",{key:0,type:"button",class:"shifl-grid__counter-button",onMouseenter:u=>q(l.key,r,n[l.key],u.currentTarget),onMouseleave:J}," +"+e.toDisplayString(Bn(n[l.key],l.key,r)),41,yt)):e.createCommentVNode("",!0)])):gn(l.key)?(e.openBlock(),e.createElementBlock("div",bt,[e.createElementVNode("span",{class:"shifl-grid__truncated-text",ref_for:!0,ref:u=>Cn(l.key,r,u)},e.toDisplayString(pn(n[l.key])),513),U(l.key)&&kn(n[l.key])?(e.openBlock(),e.createElementBlock("button",{key:0,type:"button",class:"shifl-grid__counter-button",onMouseenter:u=>q(l.key,r,n[l.key],u.currentTarget),onMouseleave:J}," +"+e.toDisplayString(_n(n[l.key])),41,Bt)):!U(l.key)&&hn(n[l.key],l.key)?(e.openBlock(),e.createElementBlock("button",{key:1,type:"button",class:"shifl-grid__info-icon-button",onMouseenter:u=>q(l.key,r,n[l.key],u.currentTarget),onMouseleave:J},[e.createVNode(nt)],40,Et)):e.createCommentVNode("",!0)])):l.key.toLowerCase()==="status"?(e.openBlock(),e.createElementBlock("div",wt,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(x(n[l.key]),(u,y)=>(e.openBlock(),e.createElementBlock("span",{key:y,class:"shifl-grid__chip shifl-grid__chip--status"},e.toDisplayString(u),1))),128))])):(e.openBlock(),e.createElementBlock(e.Fragment,{key:6},[e.createTextVNode(e.toDisplayString(mn(n[l.key])),1)],64))],6))),128))]))),128))],64))])])],34),b.value&&b.value.show!==!1?(e.openBlock(),e.createElementBlock("div",Vt,[e.createElementVNode("div",Mt,[e.createElementVNode("span",Nt,[o[6]||(o[6]=e.createTextVNode(" Showing ",-1)),e.createElementVNode("span",St,e.toDisplayString(me.value.from)+"–"+e.toDisplayString(me.value.to),1),e.createTextVNode(" of "+e.toDisplayString(W.value),1)])]),e.createElementVNode("div",Tt,[e.createElementVNode("div",$t,[o[8]||(o[8]=e.createElementVNode("label",{class:"shifl-grid__pagination-label"},"Row per page",-1)),e.createElementVNode("select",{value:b.value.perPage||20,disabled:s.loading,onChange:sn,class:"shifl-grid__pagination-select"},[...o[7]||(o[7]=[e.createStaticVNode('<option value="20">20</option><option value="30">30</option><option value="50">50</option><option value="75">75</option><option value="100">100</option>',5)])],40,Lt)]),e.createElementVNode("div",xt,[e.createElementVNode("button",{type:"button",class:"shifl-grid__pagination-button",disabled:ue.value||s.loading,onClick:rn,"aria-label":"Previous page"}," ‹ ",8,zt),e.createElementVNode("div",Pt,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(nn.value,n=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:n},[n!==-1?(e.openBlock(),e.createElementBlock("button",{key:0,type:"button",class:e.normalizeClass(["shifl-grid__pagination-page",{"shifl-grid__pagination-page--active":n===S.value}]),disabled:s.loading,onClick:r=>on(n)},e.toDisplayString(n),11,Dt)):(e.openBlock(),e.createElementBlock("span",At,"…"))],64))),128))]),e.createElementVNode("button",{type:"button",class:"shifl-grid__pagination-button",disabled:ge.value||s.loading,onClick:ln,"aria-label":"Next page"}," › ",8,Gt)])])])):e.createCommentVNode("",!0),(e.openBlock(),e.createBlock(e.Teleport,{to:"body"},[e.unref(N).rowIndex!==null&&e.unref(N).position?(e.openBlock(),e.createElementBlock("div",{key:0,ref_key:"actionMenuRef",ref:se,class:"shifl-grid__action-menu",style:e.normalizeStyle(`
|
|
5
|
+
position: fixed !important;
|
|
6
|
+
top: ${e.unref(N).position.top}px !important;
|
|
7
|
+
left: ${e.unref(N).position.left}px !important;
|
|
8
|
+
z-index: 1000 !important;`),onClick:o[1]||(o[1]=e.withModifiers(()=>{},["stop"]))},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(Sn(ae.value,R.value),n=>(e.openBlock(),e.createElementBlock("div",{key:n.key,class:e.normalizeClass(["shifl-grid__action-menu-item",{"shifl-grid__action-menu-item--danger":n.danger}]),onClick:()=>Tn(n,R.value,e.unref(N).rowIndex)},[n.icon&&typeof n.icon=="string"?(e.openBlock(),e.createElementBlock("span",{key:0,innerHTML:n.icon,class:"w-4 h-4 inline-block"},null,8,Rt)):n.icon?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(typeof n.icon=="function"?n.icon():n.icon),{key:1,class:"w-4 h-4"})):e.createCommentVNode("",!0),e.createElementVNode("span",null,e.toDisplayString(n.label),1)],10,Ht))),128))],4)):e.createCommentVNode("",!0)])),e.createVNode(Ge,{content:ce.value,visible:F.value,"trigger-element":I.value},null,8,["content","visible","trigger-element"]),(e.openBlock(),e.createBlock(e.Teleport,{to:"body"},[H.value?(e.openBlock(),e.createBlock(De,{key:0,"title-prefix":i.config.name,columns:Vn.value,onClose:o[2]||(o[2]=n=>H.value=!1),onToggle:e.unref(B),onToggleFrozen:e.unref(a),onMove:e.unref(m),onSelectAll:o[3]||(o[3]=n=>e.unref(d)(!0)),onDeselectAll:o[4]||(o[4]=n=>e.unref(d)(!1)),onRestoreDefault:e.unref(E)},null,8,["title-prefix","columns","onToggle","onToggleFrozen","onMove","onRestoreDefault"])):e.createCommentVNode("",!0)]))]))}}),It={install(i){i.component("ShiflGrid",oe)}};function Zt(i){return{rows:i.rows}}function Wt(){const i=e.ref(new Set);function c(s){const g=s.id??JSON.stringify(s),f=new Set(i.value);f.has(g)?f.delete(g):f.add(g),i.value=f}return{selectedKeys:i,toggleRow:c}}function Ot(){return{}}const re=Symbol("shifl-grid-theme"),le={surface:"var(--shifl-surface)",surfaceAlt:"var(--shifl-surface-alt)",border:"var(--shifl-border)",text:"var(--shifl-text)",textMuted:"var(--shifl-text-muted)",accent:"var(--shifl-accent)",accentStrong:"var(--shifl-accent-strong)",focus:"var(--shifl-focus)"};function jt(i){const c=e.ref({...le,...i});return e.provide(re,c),c}function Kt(){const i=e.inject(re);return e.computed(()=>(i==null?void 0:i.value)??le)}const A={sm:640,lg:1024};function Ut(){const i=e.ref(typeof window<"u"?window.innerWidth:0);function c(){i.value=window.innerWidth}return e.onMounted(()=>{window.addEventListener("resize",c)}),e.onUnmounted(()=>{window.removeEventListener("resize",c)}),{width:i,isMobile:e.computed(()=>i.value<A.sm),isTablet:e.computed(()=>i.value>=A.sm&&i.value<A.lg)}}function qt(){return{}}function Jt(){return{}}function Xt(){return{}}k.ShiflGrid=oe,k.ShiflGridPlugin=It,k.provideGridTheme=jt,k.useBreakpoints=Ut,k.useGridColumns=v,k.useGridData=Zt,k.useGridEditing=Ot,k.useGridFilter=te,k.useGridInfiniteScroll=qt,k.useGridSelection=Wt,k.useGridSort=ee,k.useGridTheme=Kt,k.useGridTour=Xt,k.useVirtualScroll=Jt,Object.defineProperty(k,Symbol.toStringTag,{value:"Module"})});
|