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