@shifl-inc/ui 0.1.0 → 0.2.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/components/grid/GridColumnManager.vue.d.ts +12 -34
- package/dist/components/grid/GridTooltip.vue.d.ts +9 -0
- package/dist/components/grid/ShiflGrid.vue.d.ts +15 -23
- package/dist/components/icons/InfoAlertIcon.vue.d.ts +2 -0
- package/dist/components/icons/OceanIcon.vue.d.ts +2 -0
- package/dist/components/icons/SmartTrackingIcon.vue.d.ts +2 -0
- package/dist/components/icons/SortAscendingIcon.vue.d.ts +2 -0
- package/dist/components/icons/SortDescendingIcon.vue.d.ts +2 -0
- package/dist/composables/useBreakpoints.d.ts +3 -3
- package/dist/composables/useGridActionMenu.d.ts +25 -0
- package/dist/composables/useGridColumns.d.ts +104 -50
- package/dist/composables/useGridData.d.ts +1 -1
- package/dist/composables/useGridFilter.d.ts +1 -3
- package/dist/composables/useGridSelection.d.ts +4 -9
- package/dist/composables/useGridSort.d.ts +7 -13
- package/dist/composables/useGridTheme.d.ts +11 -15
- package/dist/plugins/install.d.ts +1 -1
- package/dist/shifl-ui.js +1073 -616
- package/dist/shifl-ui.umd +4 -1
- package/dist/stores/gridStore.d.ts +2 -7
- package/dist/style.css +1 -778
- package/dist/types/grid.d.ts +84 -54
- package/dist/types/theme.d.ts +8 -8
- package/package.json +1 -1
package/dist/shifl-ui.umd
CHANGED
|
@@ -1 +1,4 @@
|
|
|
1
|
-
(function(d,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],e):(d=typeof globalThis<"u"?globalThis:d||self,e(d.ShiflGrid={},d.Vue))})(this,function(d,e){"use strict";function F(t){const i=(t.columns||[]).map(r=>({...r,frozen:r.frozen??r.fixed??!1,visible:r.visible??!0}));return{...t,columns:i,rows:t.rows??[],search:t.search??[],filters:t.filters??[],paginationMeta:t.paginationMeta??{}}}function _(t){const i=[...t],r=e.ref([...t]);function u(o){r.value=r.value.map(n=>n.key===o?{...n,visible:!n.visible}:n)}function l(o){r.value=r.value.map(n=>({...n,visible:o}))}function m(o){const n=r.value.map(g=>g.key===o?{...g,frozen:!g.frozen}:g),p=n.filter(g=>g.frozen),b=n.filter(g=>!g.frozen);r.value=[...p,...b]}function y(o,n){if(o===n||n<0||n>=r.value.length)return;const p=r.value.findIndex(V=>!V.frozen),b=p===-1?r.value.length:p;if(o<b||n<b)return;const g=[...r.value],[E]=g.splice(o,1);g.splice(n,0,E),r.value=g}function k(){r.value=[...i]}const s=e.computed(()=>r.value.filter(o=>o.visible));return{columns:r,visibleColumns:s,toggleColumnVisibility:u,setAllVisible:l,toggleFrozen:m,moveColumn:y,resetColumns:k}}function C(t){const i=e.ref(t);function r(l){var m;i.value=((m=i.value)==null?void 0:m.key)===l&&i.value.order==="asc"?{key:l,order:"desc"}:{key:l,order:"asc"}}function u(l){if(!i.value)return l;const{key:m,order:y}=i.value;return[...l].sort((k,s)=>{const o=k[m],n=s[m];if(o===n)return 0;if(o==null)return 1;if(n==null)return-1;const p=String(o).localeCompare(String(n),void 0,{numeric:!0});return y==="asc"?p:-p})}return{sort:i,setSort:r,applySort:u}}function $(){const t=e.ref("");function i(u){t.value=u}function r(u,l){const m=t.value.trim().toLowerCase();return m?u.filter(y=>(l&&l.length?l.map(s=>y[s]):Object.values(y)).some(s=>String(s??"").toLowerCase().includes(m))):u}return{globalFilter:t,setGlobalFilter:i,applyGlobalFilter:r}}const T={class:"fixed inset-0 z-40 flex justify-end bg-black/20"},M={class:"flex h-full w-full max-w-md flex-col bg-white shadow-xl ring-1 ring-black/5",role:"dialog","aria-modal":"true"},j={class:"flex items-center justify-between border-b border-gray-200 px-6 py-4"},A={class:"min-w-0"},R={class:"text-xs font-medium text-gray-400"},v={class:"flex items-center justify-between border-b border-gray-200 px-6 py-3 text-xs"},L={class:"flex gap-3 font-medium text-gray-600"},O={class:"flex-1 overflow-y-auto px-4 py-4"},P={class:"space-y-2"},I=["draggable","onDragstart","onDragover","onDrop"],K={class:"flex items-center gap-3"},W=["aria-label"],J={class:"flex items-center gap-2"},U=["checked","onChange"],q={class:"text-gray-800"},H={class:"flex items-center gap-2 text-gray-400"},Y=["onClick"],Q={class:"flex justify-end gap-3 border-t border-gray-200 px-6 py-3"},X=e.defineComponent({__name:"GridColumnManager",props:{titlePrefix:{},columns:{}},emits:["close","toggle","move","toggleFrozen","selectAll","deselectAll","restoreDefault"],setup(t,{emit:i}){const r=t,u=i,l=e.ref(null);function m(s){var o;(o=r.columns[s])!=null&&o.frozen||(l.value=s)}function y(s){}function k(s){l.value===null||l.value===s||(u("move",l.value,s),l.value=null)}return(s,o)=>(e.openBlock(),e.createElementBlock("div",T,[e.createElementVNode("div",M,[e.createElementVNode("header",j,[e.createElementVNode("div",A,[e.createElementVNode("p",R,e.toDisplayString(t.titlePrefix),1),o[6]||(o[6]=e.createElementVNode("h2",{class:"truncate text-base font-semibold text-gray-900"}," Edit Columns ",-1))]),e.createElementVNode("button",{type:"button",class:"inline-flex h-8 w-8 items-center justify-center rounded-full text-gray-400 hover:bg-gray-100 hover:text-gray-600",onClick:o[0]||(o[0]=n=>s.$emit("close"))},[...o[7]||(o[7]=[e.createElementVNode("span",{class:"sr-only"},"Close",-1),e.createTextVNode(" ✕ ",-1)])])]),e.createElementVNode("div",v,[e.createElementVNode("div",L,[e.createElementVNode("button",{type:"button",class:"hover:text-blue-600",onClick:o[1]||(o[1]=n=>s.$emit("selectAll"))}," Select All "),e.createElementVNode("button",{type:"button",class:"hover:text-blue-600",onClick:o[2]||(o[2]=n=>s.$emit("deselectAll"))}," Deselect All ")]),e.createElementVNode("button",{type:"button",class:"text-xs font-medium text-blue-600 hover:text-blue-700",onClick:o[3]||(o[3]=n=>s.$emit("restoreDefault"))}," Restore Default ")]),e.createElementVNode("div",O,[e.createElementVNode("ul",P,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.columns,(n,p)=>(e.openBlock(),e.createElementBlock("li",{key:n.key,class:"flex items-center justify-between rounded-lg border border-gray-200 bg-gray-50 px-4 py-2 text-sm shadow-[0_1px_0_rgba(15,23,42,0.02)]",draggable:!n.frozen,onDragstart:b=>m(p),onDragover:e.withModifiers(b=>void 0,["prevent"]),onDrop:e.withModifiers(b=>k(p),["prevent"])},[e.createElementVNode("div",K,[e.createElementVNode("button",{type:"button",class:e.normalizeClass(["cursor-grab text-gray-300 hover:text-gray-500",{"opacity-40 cursor-not-allowed":n.frozen}]),"aria-label":`Move ${n.label}`}," ⋮⋮ ",10,W),e.createElementVNode("label",J,[e.createElementVNode("input",{type:"checkbox",class:"h-4 w-4 rounded border-gray-300 text-blue-600 focus:ring-blue-500",checked:n.visible,onChange:b=>s.$emit("toggle",n.key)},null,40,U),e.createElementVNode("span",q,e.toDisplayString(n.label),1)])]),e.createElementVNode("div",H,[e.createElementVNode("button",{type:"button",class:e.normalizeClass(["h-7 w-7 rounded-full border border-transparent text-xs font-medium text-gray-500 hover:border-blue-200 hover:bg-blue-50 hover:text-blue-600 disabled:opacity-40",{"bg-blue-50 text-blue-600 border-blue-200":n.frozen}]),onClick:b=>s.$emit("toggleFrozen",n.key)}," Pin ",10,Y)])],40,I))),128))])]),e.createElementVNode("footer",Q,[e.createElementVNode("button",{type:"button",class:"rounded-md border border-gray-300 px-4 py-2 text-sm font-medium text-gray-700 hover:bg-gray-50",onClick:o[4]||(o[4]=n=>s.$emit("close"))}," Cancel "),e.createElementVNode("button",{type:"button",class:"rounded-md bg-blue-600 px-4 py-2 text-sm font-semibold text-white hover:bg-blue-700",onClick:o[5]||(o[5]=n=>s.$emit("close"))}," Update ")])])]))}}),Z={class:"shifl-grid relative"},ee={class:"shifl-grid__controls"},te=["value"],ne={class:"shifl-grid__header flex items-center justify-between"},oe={class:"text-xs font-medium text-gray-500"},re={class:"shifl-grid__viewport"},le={class:"shifl-grid__table"},se=["onClick"],ie={key:0},ae={key:0},ce=["colspan"],z=e.defineComponent({__name:"ShiflGrid",props:{config:{}},setup(t){const i=t,r=e.computed(()=>F(i.config)),{columns:u,visibleColumns:l,toggleColumnVisibility:m,setAllVisible:y,toggleFrozen:k,moveColumn:s,resetColumns:o}=_(r.value.columns),{sort:n,setSort:p,applySort:b}=C(r.value.sort),{globalFilter:g,setGlobalFilter:E,applyGlobalFilter:V}=$(),w=e.ref(!1);e.watch(()=>r.value.columns,a=>{u.value=[...a]},{deep:!0}),e.watch(()=>r.value.sort,a=>{a&&(n.value=a)},{deep:!0});const xe=e.computed(()=>V(r.value.rows,r.value.search)),N=e.computed(()=>b(xe.value)),Ee=e.computed(()=>{let a=0;const c={};for(const f of l.value){f.frozen&&(c[f.key]=a);const h=parseInt(f.width??"160",10);Number.isNaN(h)||(a+=h)}return c});function Ve(a){const c=u.value.find(f=>f.key===a);c!=null&&c.sortable&&p(a)}function we(a){const c=a.target.value;E(c)}function Ne(a){return a==null?"":typeof a=="object"?JSON.stringify(a):String(a)}function D(a,c=!0){const f={width:a.width??"160px",minWidth:a.width??"160px"};if(!a.frozen)return f;const h=Ee.value[a.key]??0;return{...f,position:"sticky",left:`${h}px`,zIndex:c?30:10,background:"#ffffff"}}return(a,c)=>(e.openBlock(),e.createElementBlock("div",Z,[e.createElementVNode("div",ee,[e.createElementVNode("input",{class:"flex-1 rounded border border-gray-300 px-3 py-2 text-sm",type:"text",value:e.unref(g),onInput:we,placeholder:"Search anything..."},null,40,te),e.createElementVNode("button",{type:"button",class:"shifl-grid__pill-button whitespace-nowrap",onClick:c[0]||(c[0]=f=>w.value=!0)}," Edit Columns ")]),e.createElementVNode("div",ne,[e.createElementVNode("span",null,e.toDisplayString(t.config.name??"Shifl Grid"),1),e.createElementVNode("span",oe," Showing "+e.toDisplayString(N.value.length)+" of "+e.toDisplayString(r.value.rows.length),1)]),e.createElementVNode("div",re,[e.createElementVNode("table",le,[e.createElementVNode("thead",null,[e.createElementVNode("tr",null,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(l),f=>{var h;return e.openBlock(),e.createElementBlock("th",{key:f.key,style:e.normalizeStyle(D(f,!0)),onClick:()=>Ve(f.key)},[e.createElementVNode("span",null,e.toDisplayString(f.label),1),((h=e.unref(n))==null?void 0:h.key)===f.key?(e.openBlock(),e.createElementBlock("span",ie,e.toDisplayString(e.unref(n).order==="asc"?"▲":"▼"),1)):e.createCommentVNode("",!0)],12,se)}),128))])]),e.createElementVNode("tbody",null,[N.value.length?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("tr",ae,[e.createElementVNode("td",{colspan:e.unref(l).length,class:"text-center text-gray-500 py-6"}," No data ",8,ce)])),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(N.value,(f,h)=>(e.openBlock(),e.createElementBlock("tr",{key:h},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(l),S=>(e.openBlock(),e.createElementBlock("td",{key:S.key,style:e.normalizeStyle(D(S,!1))},e.toDisplayString(Ne(f[S.key])),5))),128))]))),128))])])]),c[4]||(c[4]=e.createElementVNode("div",{class:"shifl-grid__footer text-xs text-gray-600"}," Row per page 20 ▾ ",-1)),w.value?(e.openBlock(),e.createBlock(X,{key:0,"title-prefix":t.config.name,columns:e.unref(u),onClose:c[1]||(c[1]=f=>w.value=!1),onToggle:e.unref(m),onToggleFrozen:e.unref(k),onMove:e.unref(s),onSelectAll:c[2]||(c[2]=f=>e.unref(y)(!0)),onDeselectAll:c[3]||(c[3]=f=>e.unref(y)(!1)),onRestoreDefault:e.unref(o)},null,8,["title-prefix","columns","onToggle","onToggleFrozen","onMove","onRestoreDefault"])):e.createCommentVNode("",!0)]))}}),de={install(t){t.component("ShiflGrid",z)}};function fe(t){return{rows:t.rows}}function ue(){const t=e.ref(new Set);function i(r){const u=r.id??JSON.stringify(r),l=new Set(t.value);l.has(u)?l.delete(u):l.add(u),t.value=l}return{selectedKeys:t,toggleRow:i}}function me(){return{}}const G=Symbol("shifl-grid-theme"),B={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 ge(t){const i=e.ref({...B,...t});return e.provide(G,i),i}function pe(){const t=e.inject(G);return e.computed(()=>(t==null?void 0:t.value)??B)}const x={sm:640,lg:1024};function be(){const t=e.ref(typeof window<"u"?window.innerWidth:0);function i(){t.value=window.innerWidth}return e.onMounted(()=>{window.addEventListener("resize",i)}),e.onUnmounted(()=>{window.removeEventListener("resize",i)}),{width:t,isMobile:e.computed(()=>t.value<x.sm),isTablet:e.computed(()=>t.value>=x.sm&&t.value<x.lg)}}function ye(){return{}}function he(){return{}}function ke(){return{}}d.ShiflGrid=z,d.ShiflGridPlugin=de,d.provideGridTheme=ge,d.useBreakpoints=be,d.useGridColumns=_,d.useGridData=fe,d.useGridEditing=me,d.useGridFilter=$,d.useGridInfiniteScroll=ye,d.useGridSelection=ue,d.useGridSort=C,d.useGridTheme=pe,d.useGridTour=ke,d.useVirtualScroll=he,Object.defineProperty(d,Symbol.toStringTag,{value:"Module"})});
|
|
1
|
+
(function(_,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],e):(_=typeof globalThis<"u"?globalThis:_||self,e(_.ShiflGrid={},_.Vue))})(this,function(_,e){"use strict";function ke(i){const a=(i.columns||[]).map(s=>({...s,frozen:s.frozen??s.fixed??!1,visible:s.visible??!0,protected:s.protected??!1}));return{...i,columns:a,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 a=[...i],s=e.ref([...i]);function g(m){s.value=s.value.map(c=>c.key===m?{...c,visible:!c.visible}:c)}function d(m){s.value=s.value.map(c=>({...c,visible:m}))}function p(m){const c=s.value.map(h=>h.key===m?{...h,frozen:!h.frozen}:h),f=c.filter(h=>h.frozen),E=c.filter(h=>!h.frozen);s.value=[...f,...E]}function y(m,c){if(m===c||c<0||c>=s.value.length)return;const f=s.value.findIndex(A=>!A.frozen),E=f===-1?s.value.length:f;if(m<E||c<E)return;const h=[...s.value],[M]=h.splice(m,1);h.splice(c,0,M),s.value=h}function k(){s.value=[...a]}const B=e.computed(()=>s.value.filter(m=>m.visible));return{columns:s,visibleColumns:B,toggleColumnVisibility:g,setAllVisible:d,toggleFrozen:p,moveColumn:y,resetColumns:k}}function ee(i){const a=e.ref(i);function s(d){var p;a.value=((p=a.value)==null?void 0:p.key)===d&&a.value.order==="asc"?{key:d,order:"desc"}:{key:d,order:"asc"}}function g(d){if(!a.value)return d;const{key:p,order:y}=a.value;return[...d].sort((k,B)=>{const m=k[p],c=B[p];if(m===c)return 0;if(m==null)return 1;if(c==null)return-1;const f=String(m).localeCompare(String(c),void 0,{numeric:!0});return y==="asc"?f:-f})}return{sort:a,setSort:s,applySort:g}}function te(){function i(a,s,g){const d=(g||"").trim().toLowerCase();return d?a.filter(p=>(s&&s.length?s.map(k=>p[k]):Object.values(p)).some(k=>String(k??"").toLowerCase().includes(d))):a}return{applyGlobalFilter:i}}function _e(){const i=e.ref({rowIndex:null,position:null});function a(p,y){const k=y.getBoundingClientRect();i.value={rowIndex:p,position:{top:k.bottom+4,left:k.left}}}function s(){i.value={rowIndex:null,position:null}}function g(p){return i.value.rowIndex===p}function d(p){p.key==="Escape"&&i.value.rowIndex!==null&&s()}return e.onMounted(()=>{document.addEventListener("keydown",d)}),e.onUnmounted(()=>{document.removeEventListener("keydown",d)}),{menuState:i,openMenu:a,closeMenu:s,isMenuOpen:g}}const Ce={class:"shifl-column-manager__header"},ye={class:"shifl-column-manager__title-wrapper"},be={class:"shifl-column-manager__title"},Be={key:0},Ee={class:"shifl-column-manager__controls"},we={class:"shifl-column-manager__controls-left"},Me={class:"shifl-column-manager__content"},Ve={class:"shifl-column-manager__list"},Ne=["draggable","onDragstart","onDragover","onDrop"],Te=["aria-label","disabled"],Se=["checked","disabled","onChange"],$e={class:"shifl-column-manager__label-text"},Le={class:"shifl-column-manager__footer"},xe=e.defineComponent({__name:"GridColumnManager",props:{titlePrefix:{},columns:{}},emits:["close","toggle","move","toggleFrozen","selectAll","deselectAll","restoreDefault"],setup(i,{emit:a}){const s=i,g=e.computed(()=>s.columns),d=a,p=e.ref(null);function y(m){var c,f;(c=s.columns[m])!=null&&c.frozen||(f=s.columns[m])!=null&&f.protected||(p.value=m)}function k(m){}function B(m){p.value===null||p.value===m||(d("move",p.value,m),p.value=null)}return(m,c)=>(e.openBlock(),e.createElementBlock("div",{class:"shifl-column-manager__backdrop",onClick:c[7]||(c[7]=e.withModifiers(f=>m.$emit("close"),["self"]))},[e.createElementVNode("div",{class:"shifl-column-manager__dialog",role:"dialog","aria-modal":"true",onClick:c[6]||(c[6]=e.withModifiers(()=>{},["stop"]))},[e.createElementVNode("header",Ce,[e.createElementVNode("div",ye,[e.createElementVNode("h2",be,[i.titlePrefix?(e.openBlock(),e.createElementBlock("span",Be,e.toDisplayString(i.titlePrefix)+" > ",1)):e.createCommentVNode("",!0),c[8]||(c[8]=e.createTextVNode("Edit Columns ",-1))])]),e.createElementVNode("button",{type:"button",class:"shifl-column-manager__close",onClick:c[0]||(c[0]=f=>m.$emit("close"))},[...c[9]||(c[9]=[e.createElementVNode("span",null,"✕",-1)])])]),e.createElementVNode("div",Ee,[e.createElementVNode("div",we,[e.createElementVNode("button",{type:"button",class:"shifl-column-manager__link-button",onClick:c[1]||(c[1]=f=>m.$emit("selectAll"))}," Select All "),e.createElementVNode("button",{type:"button",class:"shifl-column-manager__link-button",onClick:c[2]||(c[2]=f=>m.$emit("deselectAll"))}," Deselect All ")]),e.createElementVNode("button",{type:"button",class:"shifl-column-manager__link-button shifl-column-manager__link-button--primary",onClick:c[3]||(c[3]=f=>m.$emit("restoreDefault"))}," Restore Default ")]),e.createElementVNode("div",Me,[e.createElementVNode("ul",Ve,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(g.value,(f,E)=>(e.openBlock(),e.createElementBlock("li",{key:f.key,class:e.normalizeClass(["shifl-column-manager__item",{"shifl-column-manager__item--disabled":f.frozen||f.protected}]),draggable:!f.frozen&&!f.protected,onDragstart:h=>y(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":f.frozen||f.protected}]),"aria-label":`Move ${f.label}`,disabled:f.frozen||f.protected},[...c[10]||(c[10]=[e.createElementVNode("span",null,"⋮⋮",-1)])],10,Te),e.createElementVNode("label",{class:e.normalizeClass(["shifl-column-manager__checkbox-label",{"shifl-column-manager__checkbox-label--disabled":f.frozen||f.protected}])},[e.createElementVNode("input",{type:"checkbox",class:"shifl-column-manager__checkbox",checked:f.visible,disabled:f.frozen||f.protected,onChange:h=>m.$emit("toggle",f.key)},null,40,Se),e.createElementVNode("span",$e,e.toDisplayString(f.label),1)],2)],42,Ne))),128))])]),e.createElementVNode("footer",Le,[e.createElementVNode("button",{type:"button",class:"shifl-column-manager__button shifl-column-manager__button--secondary",onClick:c[4]||(c[4]=f=>m.$emit("close"))}," Cancel "),e.createElementVNode("button",{type:"button",class:"shifl-column-manager__button shifl-column-manager__button--primary",onClick:c[5]||(c[5]=f=>m.$emit("close"))}," Update ")])])]))}}),V=(i,a)=>{const s=i.__vccOpts||i;for(const[g,d]of a)s[g]=d;return s},ze=V(xe,[["__scopeId","data-v-70b33c44"]]),Pe={class:"shifl-grid__tooltip-content"},De=V(e.defineComponent({__name:"GridTooltip",props:{content:{},visible:{type:Boolean},triggerElement:{}},setup(i){const a=i,s=e.ref(null),g=e.ref({}),d=e.computed(()=>a.content.includes(`
|
|
2
|
+
`)),p=e.computed(()=>d.value?a.content.split(`
|
|
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"})});
|