@honed/table 0.9.1 → 0.10.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/index.d.ts +57 -147
- package/dist/index.es.js +410 -397
- package/dist/index.umd.js +1 -1
- package/package.json +3 -3
package/dist/index.umd.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(k,c){typeof exports=="object"&&typeof module<"u"?c(exports,require("vue"),require("@inertiajs/vue3")):typeof define=="function"&&define.amd?define(["exports","vue","@inertiajs/vue3"],c):(k=typeof globalThis<"u"?globalThis:k||self,c(k["@honed/table"]={},k.Vue,k.Inertia))})(this,function(k,c,b){"use strict";function Y(a,f,s,r={}){return a.route?(b.router.visit(a.route.url,{...r,method:a.route.method}),!0):a.action&&f?(b.router.post(f,{...s,name:a.name,type:a.type},r),!0):!1}function Q(a,f,s,r={},m={}){return Y(a,f,{...r,id:s??void 0},m)}function Z(a,f,s,r={}){return a.map(m=>({...m,execute:(o={},i={})=>Q(m,f,s,o,{...r,...i})}))}function _(){const a=c.ref({all:!1,only:new Set,except:new Set});function f(){a.value.all=!0,a.value.only.clear(),a.value.except.clear()}function s(){a.value.all=!1,a.value.only.clear(),a.value.except.clear()}function r(...d){d.forEach(v=>a.value.except.delete(v)),d.forEach(v=>a.value.only.add(v))}function m(...d){d.forEach(v=>a.value.except.add(v)),d.forEach(v=>a.value.only.delete(v))}function o(d,v){if(i(d)||v===!1)return m(d);if(!i(d)||v===!0)return r(d)}function i(d){return a.value.all?!a.value.except.has(d):a.value.only.has(d)}const g=c.computed(()=>a.value.all&&a.value.except.size===0),w=c.computed(()=>a.value.only.size>0||g.value);function x(d){return{"onUpdate:modelValue":v=>{v?r(d):m(d)},modelValue:i(d),value:d}}function S(){return{"onUpdate:modelValue":d=>{d?f():s()},modelValue:g.value}}return{allSelected:g,selection:a,hasSelected:w,selectAll:f,deselectAll:s,select:r,deselect:m,toggle:o,selected:i,bind:x,bindAll:S}}typeof WorkerGlobalScope<"u"&&globalThis instanceof WorkerGlobalScope;const X=()=>{};function ee(a,f){function s(...r){return new Promise((m,o)=>{Promise.resolve(a(()=>f.apply(this,r),{fn:f,thisArg:this,args:r})).then(m).catch(o)})}return s}function te(a,f={}){let s,r,m=X;const o=g=>{clearTimeout(g),m(),m=X};let i;return g=>{const w=c.toValue(a),x=c.toValue(f.maxWait);return s&&o(s),w<=0||x!==void 0&&x<=0?(r&&(o(r),r=null),Promise.resolve(g())):new Promise((S,d)=>{m=f.rejectOnCancel?d:S,i=g,x&&!r&&(r=setTimeout(()=>{s&&o(s),r=null,S(i())},x)),s=setTimeout(()=>{r&&o(r),r=null,S(g())},w)})}}function q(a,f=200,s={}){return ee(te(f,s),a)}function ne(a,f,s={}){if(!(a!=null&&a[f]))throw new Error("The refine must be provided with valid props and key.");const r=c.computed(()=>a[f]),m=c.computed(()=>!!r.value.sort),o=c.computed(()=>!!r.value.search),i=c.computed(()=>!!r.value.match),g=c.computed(()=>{var e;return(e=r.value.filters)==null?void 0:e.map(n=>({...n,apply:(l,p={})=>P(n,l,p),clear:(l={})=>B(n,l),bind:()=>O(n.name)}))}),w=c.computed(()=>{var e;return(e=r.value.sorts)==null?void 0:e.map(n=>({...n,apply:(l={})=>L(n,n.direction,l),clear:(l={})=>K(l),bind:()=>D(n)}))}),x=c.computed(()=>{var e;return(e=r.value.searches)==null?void 0:e.map(n=>({...n,apply:(l={})=>j(n,l),clear:(l={})=>j(n,l),bind:()=>u(n)}))}),S=c.computed(()=>g.value.filter(({active:e})=>e)),d=c.computed(()=>w.value.find(({active:e})=>e)),v=c.computed(()=>x.value.filter(({active:e})=>e));function F(e){return Array.isArray(e)?e.join(r.value.delimiter):e}function M(e){return typeof e!="string"?e:e.trim().replace(/\s+/g,"+")}function E(e){if(!["",null,void 0,[]].includes(e))return e}function z(e){return[F,M,E].reduce((n,l)=>l(n),e)}function G(e,n){return n=Array.isArray(n)?n:[n],n.includes(e)?n.filter(l=>l!==e):[...n,e]}function $(e){return typeof e!="string"?e:g.value.find(({name:n})=>n===e)}function R(e,n=null){return typeof e!="string"?e:w.value.find(({name:l,direction:p})=>l===e&&p===n)}function h(e){return typeof e!="string"?e:x.value.find(({name:n})=>n===e)}function I(e){return e?typeof e=="string"?S.value.some(n=>n.name===e):e.active:!!S.value.length}function y(e){var n;return e?typeof e=="string"?((n=d.value)==null?void 0:n.name)===e:e.active:!!d.value}function U(e){var n;return e?typeof e=="string"?(n=v.value)==null?void 0:n.some(l=>l.name===e):e.active:!!r.value.term}function C(e,n={}){const l=Object.fromEntries(Object.entries(e).map(([p,A])=>[p,z(A)]));b.router.reload({...s,...n,data:l})}function P(e,n,l={}){const p=$(e);if(!p)return console.warn(`Filter [${e}] does not exist.`);b.router.reload({...s,...l,data:{[p.name]:z(n)}})}function L(e,n=null,l={}){if(!m.value)return console.warn("Refine cannot perform sorting.");const p=R(e,n);if(!p)return console.warn(`Sort [${e}] does not exist.`);b.router.reload({...s,...l,data:{[r.value.sort]:E(p.next)}})}function V(e,n={}){if(!o.value)return console.warn("Refine cannot perform searching.");e=[M,E].reduce((l,p)=>p(l),e),b.router.reload({...s,...n,data:{[r.value.search]:e}})}function j(e,n={}){if(!i.value||!o.value)return console.warn("Refine cannot perform matching.");const l=h(e);if(!l)return console.warn(`Match [${e}] does not exist.`);const p=G(l.name,v.value.map(({name:A})=>A));b.router.reload({...s,...n,data:{[r.value.match]:F(p)}})}function B(e,n={}){if(e)return P(e,null,n);b.router.reload({...s,...n,data:Object.fromEntries(S.value.map(({name:l})=>[l,null]))})}function K(e={}){if(!m.value)return console.warn("Refine cannot perform sorting.");b.router.reload({...s,...e,data:{[r.value.sort]:null}})}function H(e={}){V(null,e)}function J(e={}){if(!i.value)return console.warn("Refine cannot perform matching.");b.router.reload({...s,...e,data:{[r.value.match]:null}})}function N(e={}){var n;b.router.reload({...s,...e,data:{[r.value.search??""]:void 0,[r.value.sort??""]:void 0,[r.value.match??""]:void 0,...Object.fromEntries(((n=r.value.filters)==null?void 0:n.map(l=>[l.name,void 0]))??[])}})}function O(e,n={}){const l=$(e);if(!l)return console.warn(`Filter [${e}] does not exist.`);const{debounce:p=250,transform:A=T=>T,...W}=n;return{"onUpdate:modelValue":q(T=>{P(l,A(T),W)},p),modelValue:l.value}}function D(e,n={}){const l=R(e);if(!l)return console.warn(`Sort [${e}] does not exist.`);const{debounce:p=0,transform:A,...W}=n;return{onClick:q(()=>{var T;L(l,(T=d.value)==null?void 0:T.direction,W)},p)}}function t(e={}){const{debounce:n=700,transform:l,...p}=e;return{"onUpdate:modelValue":q(A=>{V(A,p)},n),modelValue:r.value.term??""}}function u(e,n={}){const l=h(e);if(!l)return console.warn(`Match [${e}] does not exist.`);const{debounce:p=0,transform:A,...W}=n;return{"onUpdate:modelValue":q(T=>{j(T,W)},p),modelValue:U(l),value:l.name}}return{filters:g,sorts:w,searches:x,currentFilters:S,currentSort:d,currentSearches:v,isSortable:m,isSearchable:o,isMatchable:i,isFiltering:I,isSorting:y,isSearching:U,getFilter:$,getSort:R,getSearch:h,apply:C,applyFilter:P,applySort:L,applySearch:V,applyMatch:j,clearFilter:B,clearSort:K,clearSearch:H,clearMatch:J,reset:N,bindFilter:O,bindSort:D,bindSearch:t,bindMatch:u,stringValue:M,omitValue:E,toggleValue:G,delimitArray:F}}function le(a,f,s={}){if(!(a!=null&&a[f]))throw new Error("The table must be provided with valid props and key.");const{recordOperations:r={},...m}={only:[...s.only??[],f.toString()],...s},o=c.computed(()=>a[f]),i=_(),g=ne(a,f,m),w=c.computed(()=>o.value.meta),x=c.computed(()=>!!o.value.emptyState),S=c.computed(()=>!!o.value.page&&!!o.value.record),d=c.computed(()=>!!o.value.column),v=c.computed(()=>o.value.columns.filter(({active:t,hidden:u})=>t&&!u).map(t=>{var u;return{...t,isSorting:!!((u=t.sort)!=null&&u.active),toggleSort:(e={})=>g.applySort(t.sort,null,e)}})),F=c.computed(()=>o.value.columns.filter(({hidden:t})=>!t).map(t=>({...t,toggle:(u={})=>J(t.name,u)}))),M=c.computed(()=>o.value.records.map(t=>({operations:L(t.operations),default:(u={})=>{const e=t.operations.find(({default:n})=>n);e&&j(e,t,u)},select:()=>i.select(y(t)),deselect:()=>i.deselect(y(t)),toggle:()=>i.toggle(y(t)),selected:i.selected(y(t)),bind:()=>i.bind(y(t)),entry:u=>C(t,u),value:u=>{var e;return((e=C(t,u))==null?void 0:e.v)??null},extra:u=>{var e;return((e=C(t,u))==null?void 0:e.e)??null}}))),E=c.computed(()=>!!o.value.operations.inline),z=c.computed(()=>L(o.value.operations.bulk)),G=c.computed(()=>L(o.value.operations.page)),$=c.computed(()=>o.value.pages.find(({active:t})=>t)),R=c.computed(()=>o.value.pages),h=c.computed(()=>({...o.value.paginate,next:(t={})=>{"nextLink"in h.value&&h.value.nextLink&&V(h.value.nextLink,t)},previous:(t={})=>{"prevLink"in h.value&&h.value.prevLink&&V(h.value.prevLink,t)},first:(t={})=>{"firstLink"in h.value&&h.value.firstLink&&V(h.value.firstLink,t)},last:(t={})=>{"lastLink"in h.value&&h.value.lastLink&&V(h.value.lastLink,t)},..."links"in o.value.paginate&&o.value.paginate.links?{links:o.value.paginate.links.map(t=>({...t,navigate:(u={})=>t.url&&V(t.url,u)}))}:{}})),I=c.computed(()=>o.value.records.length>0&&o.value.records.every(t=>i.selected(y(t))));function y(t){return t[o.value.key].v}function U(t){return typeof t=="string"?t:t.name}function C(t,u){const e=U(u);return e in t?t[e]:null}function P(t,u={},e={}){return Q(t,o.value.endpoint,o.value.id,u,{...m,...e})}function L(t){return Z(t,o.value.endpoint,o.value.id,m)}function V(t,u={}){b.router.visit(t,{preserveScroll:!0,preserveState:!0,...m,...u,method:"get"})}function j(t,u,e={}){var l;P(t,{record:y(u)},e)||(l=r==null?void 0:r[t.name])==null||l.call(r,u)}function B(t,u={}){P(t,{all:i.selection.value.all,only:Array.from(i.selection.value.only),except:Array.from(i.selection.value.except)},{...u,onSuccess:e=>{var n;(n=u.onSuccess)==null||n.call(u,e),t.keepSelected||i.deselectAll()}})}function K(t,u={},e={}){return P(t,u,e)}function H(t,u={}){if(!S.value)return console.warn("The table does not support pagination changes.");b.router.reload({...m,...u,data:{[o.value.record]:t.value,[o.value.page]:void 0}})}function J(t,u={}){if(!d.value)return console.warn("The table does not support column toggling.");const e=U(t);if(!e)return console.log(`Column [${t}] does not exist.`);const n=g.toggleValue(e,v.value.map(({name:l})=>l));b.router.reload({...m,...u,data:{[o.value.column]:g.delimitArray(n)}})}function N(){i.select(...o.value.records.map(t=>y(t)))}function O(){i.deselect(...o.value.records.map(t=>y(t)))}function D(){return{"onUpdate:modelValue":t=>{t?N():O()},modelValue:I.value}}return c.reactive({meta:w,isEmpty:x,isPageable:S,isToggleable:d,getRecordKey:y,headings:v,columns:F,records:M,inline:E,bulk:z,page:G,pages:R,currentPage:$,paginator:h,executeInline:j,executeBulk:B,executePage:K,applyPage:H,selection:i.selection,select:t=>i.select(y(t)),deselect:t=>i.deselect(y(t)),selectPage:N,deselectPage:O,toggle:t=>i.toggle(y(t)),selected:t=>i.selected(y(t)),selectAll:i.selectAll,deselectAll:i.deselectAll,isPageSelected:I,hasSelected:i.hasSelected,bindCheckbox:t=>i.bind(y(t)),bindPage:D,bindAll:i.bindAll,...g})}function ae(a,f){return a?typeof a=="object"?a.type===f:a===f:!1}k.is=ae,k.useTable=le,Object.defineProperty(k,Symbol.toStringTag,{value:"Module"})});
|
|
1
|
+
(function(A,i){typeof exports=="object"&&typeof module<"u"?i(exports,require("vue"),require("@inertiajs/vue3")):typeof define=="function"&&define.amd?define(["exports","vue","@inertiajs/vue3"],i):(A=typeof globalThis<"u"?globalThis:A||self,i(A["@honed/table"]={},A.Vue,A.Inertia))})(this,function(A,i,S){"use strict";function _(l,p,d,o={}){return l.route?(S.router.visit(l.route.url,{...o,method:l.route.method}),!0):l.action&&p?(S.router.post(p,{...d,name:l.name,type:l.type},o),!0):!1}function Q(l,p,d,o={},m={}){return _(l,p,{...o,id:d??void 0},m)}function ee(l,p,d,o={}){return l.map(m=>({...m,execute:(u={},c={})=>Q(m,p,d,u,{...o,...c})}))}function te(){const l=i.ref({all:!1,only:new Set,except:new Set});function p(){l.value.all=!0,l.value.only.clear(),l.value.except.clear()}function d(){l.value.all=!1,l.value.only.clear(),l.value.except.clear()}function o(...f){f.forEach(y=>l.value.except.delete(y)),f.forEach(y=>l.value.only.add(y))}function m(...f){f.forEach(y=>l.value.except.add(y)),f.forEach(y=>l.value.only.delete(y))}function u(f,y){if(c(f)||y===!1)return m(f);if(!c(f)||y===!0)return o(f)}function c(f){return l.value.all?!l.value.except.has(f):l.value.only.has(f)}const h=i.computed(()=>l.value.all&&l.value.except.size===0),x=i.computed(()=>l.value.only.size>0||h.value);function w(f){return{"onUpdate:modelValue":y=>{y?o(f):m(f)},modelValue:c(f),value:f}}function k(){return{"onUpdate:modelValue":f=>{f?p():d()},modelValue:h.value}}return{allSelected:h,selection:l,hasSelected:x,selectAll:p,deselectAll:d,select:o,deselect:m,toggle:u,selected:c,bind:w,bindAll:k}}typeof WorkerGlobalScope<"u"&&globalThis instanceof WorkerGlobalScope;const Z=()=>{};function ne(l,p){function d(...o){return new Promise((m,u)=>{Promise.resolve(l(()=>p.apply(this,o),{fn:p,thisArg:this,args:o})).then(m).catch(u)})}return d}function le(l,p={}){let d,o,m=Z;const u=h=>{clearTimeout(h),m(),m=Z};let c;return h=>{const x=i.toValue(l),w=i.toValue(p.maxWait);return d&&u(d),x<=0||w!==void 0&&w<=0?(o&&(u(o),o=null),Promise.resolve(h())):new Promise((k,f)=>{m=p.rejectOnCancel?f:k,c=h,w&&!o&&(o=setTimeout(()=>{d&&u(d),o=null,k(c())},w)),d=setTimeout(()=>{o&&u(o),o=null,k(h())},x)})}}function I(l,p=200,d={}){return ne(le(p,d),l)}function ae(l,p,d={}){if(!(l!=null&&l[p]))throw new Error("The refine must be provided with valid props and key.");const o=i.computed(()=>l[p]),m=i.computed(()=>!!o.value.sort),u=i.computed(()=>!!o.value.search),c=i.computed(()=>!!o.value.match),h=i.computed(()=>{var e;return(e=o.value.filters)==null?void 0:e.map(n=>({...n,apply:(a,v={})=>T(n,a,v),clear:(a={})=>O(n,a),bind:()=>G(n.name)}))}),x=i.computed(()=>{var e;return(e=o.value.sorts)==null?void 0:e.map(n=>({...n,apply:(a={})=>F(n,n.direction,a),clear:(a={})=>W(a),bind:()=>D(n)}))}),w=i.computed(()=>{var e;return(e=o.value.searches)==null?void 0:e.map(n=>({...n,apply:(a={})=>V(n,a),clear:(a={})=>V(n,a),bind:()=>H(n)}))}),k=i.computed(()=>h.value.filter(({active:e})=>e)),f=i.computed(()=>x.value.find(({active:e})=>e)),y=i.computed(()=>w.value.filter(({active:e})=>e));function M(e){return Array.isArray(e)?e.join(o.value.delimiter):e}function j(e){return typeof e!="string"?e:e.trim().replace(/\s+/g,"+")}function P(e){if(!["",null,void 0,[]].includes(e))return e}function $(e){return[M,j,P].reduce((n,a)=>a(n),e)}function B(e,n){return n=Array.isArray(n)?n:[n],n.includes(e)?n.filter(a=>a!==e):[...n,e]}function R(e){return typeof e!="string"?e:h.value.find(({name:n})=>n===e)}function U(e,n=null){return typeof e!="string"?e:x.value.find(({name:a,direction:v})=>a===e&&v===n)}function C(e){return typeof e!="string"?e:w.value.find(({name:n})=>n===e)}function N(e){return e?typeof e=="string"?k.value.some(n=>n.name===e):e.active:!!k.value.length}function X(e){var n;return e?typeof e=="string"?((n=f.value)==null?void 0:n.name)===e:e.active:!!f.value}function K(e){var n;return e?typeof e=="string"?(n=y.value)==null?void 0:n.some(a=>a.name===e):e.active:!!o.value.term}function b(e,n={}){const a=Object.fromEntries(Object.entries(e).map(([v,t])=>[v,$(t)]));S.router.reload({...d,...n,data:a})}function T(e,n,a={}){const v=R(e);if(!v)return console.warn(`Filter [${e}] does not exist.`);S.router.reload({...d,...a,data:{[v.name]:$(n)}})}function F(e,n=null,a={}){if(!m.value)return console.warn("Refine cannot perform sorting.");const v=U(e,n);if(!v)return console.warn(`Sort [${e}] does not exist.`);S.router.reload({...d,...a,data:{[o.value.sort]:P(v.next)}})}function g(e,n={}){if(!u.value)return console.warn("Refine cannot perform searching.");e=[j,P].reduce((a,v)=>v(a),e),S.router.reload({...d,...n,data:{[o.value.search]:e}})}function V(e,n={}){if(!c.value||!u.value)return console.warn("Refine cannot perform matching.");const a=C(e);if(!a)return console.warn(`Match [${e}] does not exist.`);const v=B(a.name,y.value.map(({name:t})=>t));S.router.reload({...d,...n,data:{[o.value.match]:M(v)}})}function O(e,n={}){if(e)return T(e,null,n);S.router.reload({...d,...n,data:Object.fromEntries(k.value.map(({name:a})=>[a,null]))})}function W(e={}){if(!m.value)return console.warn("Refine cannot perform sorting.");S.router.reload({...d,...e,data:{[o.value.sort]:null}})}function q(e={}){g(null,e)}function z(e={}){if(!c.value)return console.warn("Refine cannot perform matching.");S.router.reload({...d,...e,data:{[o.value.match]:null}})}function E(e={}){var n;S.router.reload({...d,...e,data:{[o.value.search??""]:void 0,[o.value.sort??""]:void 0,[o.value.match??""]:void 0,...Object.fromEntries(((n=o.value.filters)==null?void 0:n.map(a=>[a.name,void 0]))??[])}})}function G(e,n={}){const a=R(e);if(!a)return console.warn(`Filter [${e}] does not exist.`);const{debounce:v=250,transform:t=s=>s,...r}=n;return{"onUpdate:modelValue":I(s=>{T(a,t(s),r)},v),modelValue:a.value}}function D(e,n={}){const a=U(e);if(!a)return console.warn(`Sort [${e}] does not exist.`);const{debounce:v=0,transform:t,...r}=n;return{onClick:I(()=>{var s;F(a,(s=f.value)==null?void 0:s.direction,r)},v)}}function Y(e={}){const{debounce:n=700,transform:a,...v}=e;return{"onUpdate:modelValue":I(t=>{g(t,v)},n),modelValue:o.value.term??""}}function H(e,n={}){const a=C(e);if(!a)return console.warn(`Match [${e}] does not exist.`);const{debounce:v=0,transform:t,...r}=n;return{"onUpdate:modelValue":I(s=>{V(s,r)},v),modelValue:K(a),value:a.name}}return i.reactive({filters:h,sorts:x,searches:w,currentFilters:k,currentSort:f,currentSearches:y,isSortable:m,isSearchable:u,isMatchable:c,isFiltering:N,isSorting:X,isSearching:K,getFilter:R,getSort:U,getSearch:C,apply:b,applyFilter:T,applySort:F,applySearch:g,applyMatch:V,clearFilter:O,clearSort:W,clearSearch:q,clearMatch:z,reset:E,bindFilter:G,bindSort:D,bindSearch:Y,bindMatch:H,stringValue:j,omitValue:P,toggleValue:B,delimitArray:M})}function re(l,p,d={}){if(!(l!=null&&l[p]))throw new Error("The table must be provided with valid props and key.");const{recordOperations:o={},...m}={only:[...d.only??[],p.toString()],...d},u=i.computed(()=>l[p]),c=te(),h=ae(l,p,m),x=i.computed(()=>u.value.id??null),w=i.computed(()=>u.value.meta),k=i.computed(()=>u.value.views??[]),f=i.computed(()=>u.value.emptyState??null),y=i.computed(()=>u.value.placeholder??null),M=i.computed(()=>!!u.value.emptyState),j=i.computed(()=>!!u.value.page&&!!u.value.record),P=i.computed(()=>!!u.value.column),$=i.computed(()=>u.value.columns.filter(({active:t,hidden:r})=>t&&!r).map(t=>{var r;return{...t,isSorting:!!((r=t.sort)!=null&&r.active),toggleSort:(s={})=>h.applySort(t.sort,null,s)}})),B=i.computed(()=>u.value.columns.filter(({hidden:t})=>!t).map(t=>({...t,toggle:(r={})=>e(t.name,r)}))),R=i.computed(()=>u.value.records.map(t=>({operations:z(t.operations),classes:t.classes??null,default:(r={})=>{const s=t.operations.find(({default:L})=>L);s&&G(s,t,r)},select:()=>c.select(g(t)),deselect:()=>c.deselect(g(t)),toggle:()=>c.toggle(g(t)),selected:c.selected(g(t)),bind:()=>c.bind(g(t)),entry:r=>V(t,r),value:r=>O(t,r),extra:r=>W(t,r)}))),U=i.computed(()=>!!u.value.operations.inline),C=i.computed(()=>z(u.value.operations.bulk)),N=i.computed(()=>z(u.value.operations.page)),X=i.computed(()=>u.value.pages.find(({active:t})=>t)),K=i.computed(()=>u.value.pages),b=i.computed(()=>({...u.value.paginate,next:(t={})=>{"nextLink"in b.value&&b.value.nextLink&&E(b.value.nextLink,t)},previous:(t={})=>{"prevLink"in b.value&&b.value.prevLink&&E(b.value.prevLink,t)},first:(t={})=>{"firstLink"in b.value&&b.value.firstLink&&E(b.value.firstLink,t)},last:(t={})=>{"lastLink"in b.value&&b.value.lastLink&&E(b.value.lastLink,t)},..."links"in u.value.paginate&&u.value.paginate.links?{links:u.value.paginate.links.map(t=>({...t,navigate:(r={})=>t.url&&E(t.url,r)}))}:{}})),T=i.computed(()=>u.value.records.length>0&&u.value.records.every(t=>c.selected(g(t))));function F(t){return typeof t=="string"?t:t.name}function g(t){var r;return(r=V(t,u.value.key))==null?void 0:r.v}function V(t,r){const s=F(r);return s in t&&s!=="classes"?t[s]:null}function O(t,r){var s;return((s=V(t,r))==null?void 0:s.v)??null}function W(t,r){var s;return(s=V(t,r))==null?void 0:s.e}function q(t,r={},s={}){return Q(t,u.value.endpoint,x.value,r,{...m,...s})}function z(t){return ee(t,u.value.endpoint,x.value,m)}function E(t,r={}){S.router.visit(t,{preserveScroll:!0,preserveState:!0,...m,...r,method:"get"})}function G(t,r,s={}){var J;q(t,{record:g(r)},s)||(J=o==null?void 0:o[t.name])==null||J.call(o,r)}function D(t,r={}){q(t,{all:c.selection.value.all,only:Array.from(c.selection.value.only),except:Array.from(c.selection.value.except)},{...r,onSuccess:s=>{var L;(L=r.onSuccess)==null||L.call(r,s),t.keepSelected||c.deselectAll()}})}function Y(t,r={},s={}){return q(t,r,s)}function H(t,r={}){if(!j.value)return console.warn("The table does not support pagination changes.");S.router.reload({...m,...r,data:{[u.value.record]:t.value,[u.value.page]:void 0}})}function e(t,r={}){if(!P.value)return console.warn("The table does not support column toggling.");const s=F(t);if(!s)return console.log(`Column [${t}] does not exist.`);const L=h.toggleValue(s,$.value.map(({name:J})=>J));S.router.reload({...m,...r,data:{[u.value.column]:h.delimitArray(L)}})}function n(){c.select(...u.value.records.map(t=>g(t)))}function a(){c.deselect(...u.value.records.map(t=>g(t)))}function v(){return{"onUpdate:modelValue":t=>{t?n():a()},modelValue:T.value}}return i.reactive({id:x,meta:w,views:k,emptyState:f,placeholder:y,isEmpty:M,isPageable:j,isToggleable:P,getEntry:V,getValue:O,getExtra:W,getRecordKey:g,headings:$,columns:B,records:R,inline:U,bulk:C,page:N,pages:K,currentPage:X,paginator:b,executeInline:G,executeBulk:D,executePage:Y,applyPage:H,selection:c.selection,select:t=>c.select(g(t)),deselect:t=>c.deselect(g(t)),selectPage:n,deselectPage:a,toggle:t=>c.toggle(g(t)),selected:t=>c.selected(g(t)),selectAll:c.selectAll,deselectAll:c.deselectAll,isPageSelected:T,hasSelected:c.hasSelected,bindCheckbox:t=>c.bind(g(t)),bindPage:v,bindAll:c.bindAll,...h})}function oe(l,p){return l?typeof l=="object"?l.type===p:l===p:!1}A.is=oe,A.useTable=re,Object.defineProperty(A,Symbol.toStringTag,{value:"Module"})});
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@honed/table",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.10.0",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"description": "-",
|
|
7
7
|
"keywords": [
|
|
@@ -57,8 +57,8 @@
|
|
|
57
57
|
}
|
|
58
58
|
},
|
|
59
59
|
"peerDependencies": {
|
|
60
|
-
"@honed/action": "^0.
|
|
61
|
-
"@honed/refine": "^0.7.
|
|
60
|
+
"@honed/action": "^0.10.0",
|
|
61
|
+
"@honed/refine": "^0.7.1",
|
|
62
62
|
"@inertiajs/vue3": "^1.2.0||^2.0.0",
|
|
63
63
|
"@vueuse/core": "^11.0.0||^12.0.0",
|
|
64
64
|
"axios": "^1.2.0",
|