vue-slim-tables 0.1.2 → 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/bundle.js +1 -1
- package/package.json +1 -4
- package/src/js/components/table.vue +16 -21
package/dist/bundle.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.VueSlimTable=e():t.VueSlimTable=e()}(self,(function(){return(()=>{var t={924:(t,e,r)=>{"use strict";var o=r(210),n=r(559),i=n(o("String.prototype.indexOf"));t.exports=function(t,e){var r=o(t,!!e);return"function"==typeof r&&i(t,".prototype.")>-1?n(r):r}},559:(t,e,r)=>{"use strict";var o=r(612),n=r(210),i=n("%Function.prototype.apply%"),a=n("%Function.prototype.call%"),c=n("%Reflect.apply%",!0)||o.call(a,i),p=n("%Object.getOwnPropertyDescriptor%",!0),l=n("%Object.defineProperty%",!0),u=n("%Math.max%");if(l)try{l({},"a",{value:1})}catch(t){l=null}t.exports=function(t){var e=c(o,a,arguments);if(p&&l){var r=p(e,"length");r.configurable&&l(e,"length",{value:1+u(0,t.length-(arguments.length-1))})}return e};var f=function(){return c(o,i,arguments)};l?l(t.exports,"apply",{value:f}):t.exports.apply=f},648:t=>{"use strict";var e="Function.prototype.bind called on incompatible ",r=Array.prototype.slice,o=Object.prototype.toString,n="[object Function]";t.exports=function(t){var i=this;if("function"!=typeof i||o.call(i)!==n)throw new TypeError(e+i);for(var a,c=r.call(arguments,1),p=function(){if(this instanceof a){var e=i.apply(this,c.concat(r.call(arguments)));return Object(e)===e?e:this}return i.apply(t,c.concat(r.call(arguments)))},l=Math.max(0,i.length-c.length),u=[],f=0;f<l;f++)u.push("$"+f);if(a=Function("binder","return function ("+u.join(",")+"){ return binder.apply(this,arguments); }")(p),i.prototype){var s=function(){};s.prototype=i.prototype,a.prototype=new s,s.prototype=null}return a}},612:(t,e,r)=>{"use strict";var o=r(648);t.exports=Function.prototype.bind||o},210:(t,e,r)=>{"use strict";var o,n=SyntaxError,i=Function,a=TypeError,c=function(t){try{return i('"use strict"; return ('+t+").constructor;")()}catch(t){}},p=Object.getOwnPropertyDescriptor;if(p)try{p({},"")}catch(t){p=null}var l=function(){throw new a},u=p?function(){try{return l}catch(t){try{return p(arguments,"callee").get}catch(t){return l}}}():l,f=r(405)(),s=Object.getPrototypeOf||function(t){return t.__proto__},y={},d="undefined"==typeof Uint8Array?o:s(Uint8Array),g={"%AggregateError%":"undefined"==typeof AggregateError?o:AggregateError,"%Array%":Array,"%ArrayBuffer%":"undefined"==typeof ArrayBuffer?o:ArrayBuffer,"%ArrayIteratorPrototype%":f?s([][Symbol.iterator]()):o,"%AsyncFromSyncIteratorPrototype%":o,"%AsyncFunction%":y,"%AsyncGenerator%":y,"%AsyncGeneratorFunction%":y,"%AsyncIteratorPrototype%":y,"%Atomics%":"undefined"==typeof Atomics?o:Atomics,"%BigInt%":"undefined"==typeof BigInt?o:BigInt,"%Boolean%":Boolean,"%DataView%":"undefined"==typeof DataView?o:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":Error,"%eval%":eval,"%EvalError%":EvalError,"%Float32Array%":"undefined"==typeof Float32Array?o:Float32Array,"%Float64Array%":"undefined"==typeof Float64Array?o:Float64Array,"%FinalizationRegistry%":"undefined"==typeof FinalizationRegistry?o:FinalizationRegistry,"%Function%":i,"%GeneratorFunction%":y,"%Int8Array%":"undefined"==typeof Int8Array?o:Int8Array,"%Int16Array%":"undefined"==typeof Int16Array?o:Int16Array,"%Int32Array%":"undefined"==typeof Int32Array?o:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":f?s(s([][Symbol.iterator]())):o,"%JSON%":"object"==typeof JSON?JSON:o,"%Map%":"undefined"==typeof Map?o:Map,"%MapIteratorPrototype%":"undefined"!=typeof Map&&f?s((new Map)[Symbol.iterator]()):o,"%Math%":Math,"%Number%":Number,"%Object%":Object,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":"undefined"==typeof Promise?o:Promise,"%Proxy%":"undefined"==typeof Proxy?o:Proxy,"%RangeError%":RangeError,"%ReferenceError%":ReferenceError,"%Reflect%":"undefined"==typeof Reflect?o:Reflect,"%RegExp%":RegExp,"%Set%":"undefined"==typeof Set?o:Set,"%SetIteratorPrototype%":"undefined"!=typeof Set&&f?s((new Set)[Symbol.iterator]()):o,"%SharedArrayBuffer%":"undefined"==typeof SharedArrayBuffer?o:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":f?s(""[Symbol.iterator]()):o,"%Symbol%":f?Symbol:o,"%SyntaxError%":n,"%ThrowTypeError%":u,"%TypedArray%":d,"%TypeError%":a,"%Uint8Array%":"undefined"==typeof Uint8Array?o:Uint8Array,"%Uint8ClampedArray%":"undefined"==typeof Uint8ClampedArray?o:Uint8ClampedArray,"%Uint16Array%":"undefined"==typeof Uint16Array?o:Uint16Array,"%Uint32Array%":"undefined"==typeof Uint32Array?o:Uint32Array,"%URIError%":URIError,"%WeakMap%":"undefined"==typeof WeakMap?o:WeakMap,"%WeakRef%":"undefined"==typeof WeakRef?o:WeakRef,"%WeakSet%":"undefined"==typeof WeakSet?o:WeakSet},h=function t(e){var r;if("%AsyncFunction%"===e)r=c("async function () {}");else if("%GeneratorFunction%"===e)r=c("function* () {}");else if("%AsyncGeneratorFunction%"===e)r=c("async function* () {}");else if("%AsyncGenerator%"===e){var o=t("%AsyncGeneratorFunction%");o&&(r=o.prototype)}else if("%AsyncIteratorPrototype%"===e){var n=t("%AsyncGenerator%");n&&(r=s(n.prototype))}return g[e]=r,r},b={"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},m=r(612),v=r(642),S=m.call(Function.call,Array.prototype.concat),j=m.call(Function.apply,Array.prototype.splice),O=m.call(Function.call,String.prototype.replace),w=m.call(Function.call,String.prototype.slice),A=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,P=/\\(\\)?/g,x=function(t){var e=w(t,0,1),r=w(t,-1);if("%"===e&&"%"!==r)throw new n("invalid intrinsic syntax, expected closing `%`");if("%"===r&&"%"!==e)throw new n("invalid intrinsic syntax, expected opening `%`");var o=[];return O(t,A,(function(t,e,r,n){o[o.length]=r?O(n,P,"$1"):e||t})),o},E=function(t,e){var r,o=t;if(v(b,o)&&(o="%"+(r=b[o])[0]+"%"),v(g,o)){var i=g[o];if(i===y&&(i=h(o)),void 0===i&&!e)throw new a("intrinsic "+t+" exists, but is not available. Please file an issue!");return{alias:r,name:o,value:i}}throw new n("intrinsic "+t+" does not exist!")};t.exports=function(t,e){if("string"!=typeof t||0===t.length)throw new a("intrinsic name must be a non-empty string");if(arguments.length>1&&"boolean"!=typeof e)throw new a('"allowMissing" argument must be a boolean');var r=x(t),o=r.length>0?r[0]:"",i=E("%"+o+"%",e),c=i.name,l=i.value,u=!1,f=i.alias;f&&(o=f[0],j(r,S([0,1],f)));for(var s=1,y=!0;s<r.length;s+=1){var d=r[s],h=w(d,0,1),b=w(d,-1);if(('"'===h||"'"===h||"`"===h||'"'===b||"'"===b||"`"===b)&&h!==b)throw new n("property names with quotes must have matching quotes");if("constructor"!==d&&y||(u=!0),v(g,c="%"+(o+="."+d)+"%"))l=g[c];else if(null!=l){if(!(d in l)){if(!e)throw new a("base intrinsic for "+t+" exists, but the property is not available.");return}if(p&&s+1>=r.length){var m=p(l,d);l=(y=!!m)&&"get"in m&&!("originalValue"in m.get)?m.get:l[d]}else y=v(l,d),l=l[d];y&&!u&&(g[c]=l)}}return l}},405:(t,e,r)=>{"use strict";var o="undefined"!=typeof Symbol&&Symbol,n=r(419);t.exports=function(){return"function"==typeof o&&("function"==typeof Symbol&&("symbol"==typeof o("foo")&&("symbol"==typeof Symbol("bar")&&n())))}},419:t=>{"use strict";t.exports=function(){if("function"!=typeof Symbol||"function"!=typeof Object.getOwnPropertySymbols)return!1;if("symbol"==typeof Symbol.iterator)return!0;var t={},e=Symbol("test"),r=Object(e);if("string"==typeof e)return!1;if("[object Symbol]"!==Object.prototype.toString.call(e))return!1;if("[object Symbol]"!==Object.prototype.toString.call(r))return!1;for(e in t[e]=42,t)return!1;if("function"==typeof Object.keys&&0!==Object.keys(t).length)return!1;if("function"==typeof Object.getOwnPropertyNames&&0!==Object.getOwnPropertyNames(t).length)return!1;var o=Object.getOwnPropertySymbols(t);if(1!==o.length||o[0]!==e)return!1;if(!Object.prototype.propertyIsEnumerable.call(t,e))return!1;if("function"==typeof Object.getOwnPropertyDescriptor){var n=Object.getOwnPropertyDescriptor(t,e);if(42!==n.value||!0!==n.enumerable)return!1}return!0}},642:(t,e,r)=>{"use strict";var o=r(612);t.exports=o.call(Function.call,Object.prototype.hasOwnProperty)},631:(t,e,r)=>{var o="function"==typeof Map&&Map.prototype,n=Object.getOwnPropertyDescriptor&&o?Object.getOwnPropertyDescriptor(Map.prototype,"size"):null,i=o&&n&&"function"==typeof n.get?n.get:null,a=o&&Map.prototype.forEach,c="function"==typeof Set&&Set.prototype,p=Object.getOwnPropertyDescriptor&&c?Object.getOwnPropertyDescriptor(Set.prototype,"size"):null,l=c&&p&&"function"==typeof p.get?p.get:null,u=c&&Set.prototype.forEach,f="function"==typeof WeakMap&&WeakMap.prototype?WeakMap.prototype.has:null,s="function"==typeof WeakSet&&WeakSet.prototype?WeakSet.prototype.has:null,y="function"==typeof WeakRef&&WeakRef.prototype?WeakRef.prototype.deref:null,d=Boolean.prototype.valueOf,g=Object.prototype.toString,h=Function.prototype.toString,b=String.prototype.match,m="function"==typeof BigInt?BigInt.prototype.valueOf:null,v=Object.getOwnPropertySymbols,S="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?Symbol.prototype.toString:null,j="function"==typeof Symbol&&"object"==typeof Symbol.iterator,O=Object.prototype.propertyIsEnumerable,w=("function"==typeof Reflect?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function(t){return t.__proto__}:null),A=r(654).custom,P=A&&R(A)?A:null,x="function"==typeof Symbol&&void 0!==Symbol.toStringTag?Symbol.toStringTag:null;function E(t,e,r){var o="double"===(r.quoteStyle||e)?'"':"'";return o+t+o}function k(t){return String(t).replace(/"/g,""")}function _(t){return!("[object Array]"!==I(t)||x&&"object"==typeof t&&x in t)}function R(t){if(j)return t&&"object"==typeof t&&t instanceof Symbol;if("symbol"==typeof t)return!0;if(!t||"object"!=typeof t||!S)return!1;try{return S.call(t),!0}catch(t){}return!1}t.exports=function t(e,r,o,n){var c=r||{};if(N(c,"quoteStyle")&&"single"!==c.quoteStyle&&"double"!==c.quoteStyle)throw new TypeError('option "quoteStyle" must be "single" or "double"');if(N(c,"maxStringLength")&&("number"==typeof c.maxStringLength?c.maxStringLength<0&&c.maxStringLength!==1/0:null!==c.maxStringLength))throw new TypeError('option "maxStringLength", if provided, must be a positive integer, Infinity, or `null`');var p=!N(c,"customInspect")||c.customInspect;if("boolean"!=typeof p&&"symbol"!==p)throw new TypeError("option \"customInspect\", if provided, must be `true`, `false`, or `'symbol'`");if(N(c,"indent")&&null!==c.indent&&"\t"!==c.indent&&!(parseInt(c.indent,10)===c.indent&&c.indent>0))throw new TypeError('options "indent" must be "\\t", an integer > 0, or `null`');if(void 0===e)return"undefined";if(null===e)return"null";if("boolean"==typeof e)return e?"true":"false";if("string"==typeof e)return M(e,c);if("number"==typeof e)return 0===e?1/0/e>0?"0":"-0":String(e);if("bigint"==typeof e)return String(e)+"n";var g=void 0===c.depth?5:c.depth;if(void 0===o&&(o=0),o>=g&&g>0&&"object"==typeof e)return _(e)?"[Array]":"[Object]";var v=function(t,e){var r;if("\t"===t.indent)r="\t";else{if(!("number"==typeof t.indent&&t.indent>0))return null;r=Array(t.indent+1).join(" ")}return{base:r,prev:Array(e+1).join(r)}}(c,o);if(void 0===n)n=[];else if(D(n,e)>=0)return"[Circular]";function O(e,r,i){if(r&&(n=n.slice()).push(r),i){var a={depth:c.depth};return N(c,"quoteStyle")&&(a.quoteStyle=c.quoteStyle),t(e,a,o+1,n)}return t(e,c,o+1,n)}if("function"==typeof e){var A=function(t){if(t.name)return t.name;var e=b.call(h.call(t),/^function\s*([\w$]+)/);if(e)return e[1];return null}(e),F=B(e,O);return"[Function"+(A?": "+A:" (anonymous)")+"]"+(F.length>0?" { "+F.join(", ")+" }":"")}if(R(e)){var C=j?String(e).replace(/^(Symbol\(.*\))_[^)]*$/,"$1"):S.call(e);return"object"!=typeof e||j?C:U(C)}if(function(t){if(!t||"object"!=typeof t)return!1;if("undefined"!=typeof HTMLElement&&t instanceof HTMLElement)return!0;return"string"==typeof t.nodeName&&"function"==typeof t.getAttribute}(e)){for(var $="<"+String(e.nodeName).toLowerCase(),G=e.attributes||[],V=0;V<G.length;V++)$+=" "+G[V].name+"="+E(k(G[V].value),"double",c);return $+=">",e.childNodes&&e.childNodes.length&&($+="..."),$+="</"+String(e.nodeName).toLowerCase()+">"}if(_(e)){if(0===e.length)return"[]";var q=B(e,O);return v&&!function(t){for(var e=0;e<t.length;e++)if(D(t[e],"\n")>=0)return!1;return!0}(q)?"["+L(q,v)+"]":"[ "+q.join(", ")+" ]"}if(function(t){return!("[object Error]"!==I(t)||x&&"object"==typeof t&&x in t)}(e)){var H=B(e,O);return 0===H.length?"["+String(e)+"]":"{ ["+String(e)+"] "+H.join(", ")+" }"}if("object"==typeof e&&p){if(P&&"function"==typeof e[P])return e[P]();if("symbol"!==p&&"function"==typeof e.inspect)return e.inspect()}if(function(t){if(!i||!t||"object"!=typeof t)return!1;try{i.call(t);try{l.call(t)}catch(t){return!0}return t instanceof Map}catch(t){}return!1}(e)){var z=[];return a.call(e,(function(t,r){z.push(O(r,e,!0)+" => "+O(t,e))})),W("Map",i.call(e),z,v)}if(function(t){if(!l||!t||"object"!=typeof t)return!1;try{l.call(t);try{i.call(t)}catch(t){return!0}return t instanceof Set}catch(t){}return!1}(e)){var Q=[];return u.call(e,(function(t){Q.push(O(t,e))})),W("Set",l.call(e),Q,v)}if(function(t){if(!f||!t||"object"!=typeof t)return!1;try{f.call(t,f);try{s.call(t,s)}catch(t){return!0}return t instanceof WeakMap}catch(t){}return!1}(e))return T("WeakMap");if(function(t){if(!s||!t||"object"!=typeof t)return!1;try{s.call(t,s);try{f.call(t,f)}catch(t){return!0}return t instanceof WeakSet}catch(t){}return!1}(e))return T("WeakSet");if(function(t){if(!y||!t||"object"!=typeof t)return!1;try{return y.call(t),!0}catch(t){}return!1}(e))return T("WeakRef");if(function(t){return!("[object Number]"!==I(t)||x&&"object"==typeof t&&x in t)}(e))return U(O(Number(e)));if(function(t){if(!t||"object"!=typeof t||!m)return!1;try{return m.call(t),!0}catch(t){}return!1}(e))return U(O(m.call(e)));if(function(t){return!("[object Boolean]"!==I(t)||x&&"object"==typeof t&&x in t)}(e))return U(d.call(e));if(function(t){return!("[object String]"!==I(t)||x&&"object"==typeof t&&x in t)}(e))return U(O(String(e)));if(!function(t){return!("[object Date]"!==I(t)||x&&"object"==typeof t&&x in t)}(e)&&!function(t){return!("[object RegExp]"!==I(t)||x&&"object"==typeof t&&x in t)}(e)){var J=B(e,O),X=w?w(e)===Object.prototype:e instanceof Object||e.constructor===Object,K=e instanceof Object?"":"null prototype",Y=!X&&x&&Object(e)===e&&x in e?I(e).slice(8,-1):K?"Object":"",Z=(X||"function"!=typeof e.constructor?"":e.constructor.name?e.constructor.name+" ":"")+(Y||K?"["+[].concat(Y||[],K||[]).join(": ")+"] ":"");return 0===J.length?Z+"{}":v?Z+"{"+L(J,v)+"}":Z+"{ "+J.join(", ")+" }"}return String(e)};var F=Object.prototype.hasOwnProperty||function(t){return t in this};function N(t,e){return F.call(t,e)}function I(t){return g.call(t)}function D(t,e){if(t.indexOf)return t.indexOf(e);for(var r=0,o=t.length;r<o;r++)if(t[r]===e)return r;return-1}function M(t,e){if(t.length>e.maxStringLength){var r=t.length-e.maxStringLength,o="... "+r+" more character"+(r>1?"s":"");return M(t.slice(0,e.maxStringLength),e)+o}return E(t.replace(/(['\\])/g,"\\$1").replace(/[\x00-\x1f]/g,C),"single",e)}function C(t){var e=t.charCodeAt(0),r={8:"b",9:"t",10:"n",12:"f",13:"r"}[e];return r?"\\"+r:"\\x"+(e<16?"0":"")+e.toString(16).toUpperCase()}function U(t){return"Object("+t+")"}function T(t){return t+" { ? }"}function W(t,e,r,o){return t+" ("+e+") {"+(o?L(r,o):r.join(", "))+"}"}function L(t,e){if(0===t.length)return"";var r="\n"+e.prev+e.base;return r+t.join(","+r)+"\n"+e.prev}function B(t,e){var r=_(t),o=[];if(r){o.length=t.length;for(var n=0;n<t.length;n++)o[n]=N(t,n)?e(t[n],t):""}var i,a="function"==typeof v?v(t):[];if(j){i={};for(var c=0;c<a.length;c++)i["$"+a[c]]=a[c]}for(var p in t)N(t,p)&&(r&&String(Number(p))===p&&p<t.length||j&&i["$"+p]instanceof Symbol||(/[^\w$]/.test(p)?o.push(e(p,t)+": "+e(t[p],t)):o.push(p+": "+e(t[p],t))));if("function"==typeof v)for(var l=0;l<a.length;l++)O.call(t,a[l])&&o.push("["+e(a[l])+"]: "+e(t[a[l]],t));return o}},798:t=>{"use strict";var e=String.prototype.replace,r=/%20/g,o="RFC1738",n="RFC3986";t.exports={default:n,formatters:{RFC1738:function(t){return e.call(t,r,"+")},RFC3986:function(t){return String(t)}},RFC1738:o,RFC3986:n}},129:(t,e,r)=>{"use strict";var o=r(261),n=r(235),i=r(798);t.exports={formats:i,parse:n,stringify:o}},235:(t,e,r)=>{"use strict";var o=r(769),n=Object.prototype.hasOwnProperty,i=Array.isArray,a={allowDots:!1,allowPrototypes:!1,allowSparse:!1,arrayLimit:20,charset:"utf-8",charsetSentinel:!1,comma:!1,decoder:o.decode,delimiter:"&",depth:5,ignoreQueryPrefix:!1,interpretNumericEntities:!1,parameterLimit:1e3,parseArrays:!0,plainObjects:!1,strictNullHandling:!1},c=function(t){return t.replace(/&#(\d+);/g,(function(t,e){return String.fromCharCode(parseInt(e,10))}))},p=function(t,e){return t&&"string"==typeof t&&e.comma&&t.indexOf(",")>-1?t.split(","):t},l=function(t,e,r,o){if(t){var i=r.allowDots?t.replace(/\.([^.[]+)/g,"[$1]"):t,a=/(\[[^[\]]*])/g,c=r.depth>0&&/(\[[^[\]]*])/.exec(i),l=c?i.slice(0,c.index):i,u=[];if(l){if(!r.plainObjects&&n.call(Object.prototype,l)&&!r.allowPrototypes)return;u.push(l)}for(var f=0;r.depth>0&&null!==(c=a.exec(i))&&f<r.depth;){if(f+=1,!r.plainObjects&&n.call(Object.prototype,c[1].slice(1,-1))&&!r.allowPrototypes)return;u.push(c[1])}return c&&u.push("["+i.slice(c.index)+"]"),function(t,e,r,o){for(var n=o?e:p(e,r),i=t.length-1;i>=0;--i){var a,c=t[i];if("[]"===c&&r.parseArrays)a=[].concat(n);else{a=r.plainObjects?Object.create(null):{};var l="["===c.charAt(0)&&"]"===c.charAt(c.length-1)?c.slice(1,-1):c,u=parseInt(l,10);r.parseArrays||""!==l?!isNaN(u)&&c!==l&&String(u)===l&&u>=0&&r.parseArrays&&u<=r.arrayLimit?(a=[])[u]=n:a[l]=n:a={0:n}}n=a}return n}(u,e,r,o)}};t.exports=function(t,e){var r=function(t){if(!t)return a;if(null!==t.decoder&&void 0!==t.decoder&&"function"!=typeof t.decoder)throw new TypeError("Decoder has to be a function.");if(void 0!==t.charset&&"utf-8"!==t.charset&&"iso-8859-1"!==t.charset)throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");var e=void 0===t.charset?a.charset:t.charset;return{allowDots:void 0===t.allowDots?a.allowDots:!!t.allowDots,allowPrototypes:"boolean"==typeof t.allowPrototypes?t.allowPrototypes:a.allowPrototypes,allowSparse:"boolean"==typeof t.allowSparse?t.allowSparse:a.allowSparse,arrayLimit:"number"==typeof t.arrayLimit?t.arrayLimit:a.arrayLimit,charset:e,charsetSentinel:"boolean"==typeof t.charsetSentinel?t.charsetSentinel:a.charsetSentinel,comma:"boolean"==typeof t.comma?t.comma:a.comma,decoder:"function"==typeof t.decoder?t.decoder:a.decoder,delimiter:"string"==typeof t.delimiter||o.isRegExp(t.delimiter)?t.delimiter:a.delimiter,depth:"number"==typeof t.depth||!1===t.depth?+t.depth:a.depth,ignoreQueryPrefix:!0===t.ignoreQueryPrefix,interpretNumericEntities:"boolean"==typeof t.interpretNumericEntities?t.interpretNumericEntities:a.interpretNumericEntities,parameterLimit:"number"==typeof t.parameterLimit?t.parameterLimit:a.parameterLimit,parseArrays:!1!==t.parseArrays,plainObjects:"boolean"==typeof t.plainObjects?t.plainObjects:a.plainObjects,strictNullHandling:"boolean"==typeof t.strictNullHandling?t.strictNullHandling:a.strictNullHandling}}(e);if(""===t||null==t)return r.plainObjects?Object.create(null):{};for(var u="string"==typeof t?function(t,e){var r,l={},u=e.ignoreQueryPrefix?t.replace(/^\?/,""):t,f=e.parameterLimit===1/0?void 0:e.parameterLimit,s=u.split(e.delimiter,f),y=-1,d=e.charset;if(e.charsetSentinel)for(r=0;r<s.length;++r)0===s[r].indexOf("utf8=")&&("utf8=%E2%9C%93"===s[r]?d="utf-8":"utf8=%26%2310003%3B"===s[r]&&(d="iso-8859-1"),y=r,r=s.length);for(r=0;r<s.length;++r)if(r!==y){var g,h,b=s[r],m=b.indexOf("]="),v=-1===m?b.indexOf("="):m+1;-1===v?(g=e.decoder(b,a.decoder,d,"key"),h=e.strictNullHandling?null:""):(g=e.decoder(b.slice(0,v),a.decoder,d,"key"),h=o.maybeMap(p(b.slice(v+1),e),(function(t){return e.decoder(t,a.decoder,d,"value")}))),h&&e.interpretNumericEntities&&"iso-8859-1"===d&&(h=c(h)),b.indexOf("[]=")>-1&&(h=i(h)?[h]:h),n.call(l,g)?l[g]=o.combine(l[g],h):l[g]=h}return l}(t,r):t,f=r.plainObjects?Object.create(null):{},s=Object.keys(u),y=0;y<s.length;++y){var d=s[y],g=l(d,u[d],r,"string"==typeof t);f=o.merge(f,g,r)}return!0===r.allowSparse?f:o.compact(f)}},261:(t,e,r)=>{"use strict";var o=r(478),n=r(769),i=r(798),a=Object.prototype.hasOwnProperty,c={brackets:function(t){return t+"[]"},comma:"comma",indices:function(t,e){return t+"["+e+"]"},repeat:function(t){return t}},p=Array.isArray,l=String.prototype.split,u=Array.prototype.push,f=function(t,e){u.apply(t,p(e)?e:[e])},s=Date.prototype.toISOString,y=i.default,d={addQueryPrefix:!1,allowDots:!1,charset:"utf-8",charsetSentinel:!1,delimiter:"&",encode:!0,encoder:n.encode,encodeValuesOnly:!1,format:y,formatter:i.formatters[y],indices:!1,serializeDate:function(t){return s.call(t)},skipNulls:!1,strictNullHandling:!1},g={},h=function t(e,r,i,a,c,u,s,y,h,b,m,v,S,j,O){for(var w,A=e,P=O,x=0,E=!1;void 0!==(P=P.get(g))&&!E;){var k=P.get(e);if(x+=1,void 0!==k){if(k===x)throw new RangeError("Cyclic object value");E=!0}void 0===P.get(g)&&(x=0)}if("function"==typeof s?A=s(r,A):A instanceof Date?A=b(A):"comma"===i&&p(A)&&(A=n.maybeMap(A,(function(t){return t instanceof Date?b(t):t}))),null===A){if(a)return u&&!S?u(r,d.encoder,j,"key",m):r;A=""}if("string"==typeof(w=A)||"number"==typeof w||"boolean"==typeof w||"symbol"==typeof w||"bigint"==typeof w||n.isBuffer(A)){if(u){var _=S?r:u(r,d.encoder,j,"key",m);if("comma"===i&&S){for(var R=l.call(String(A),","),F="",N=0;N<R.length;++N)F+=(0===N?"":",")+v(u(R[N],d.encoder,j,"value",m));return[v(_)+"="+F]}return[v(_)+"="+v(u(A,d.encoder,j,"value",m))]}return[v(r)+"="+v(String(A))]}var I,D=[];if(void 0===A)return D;if("comma"===i&&p(A))I=[{value:A.length>0?A.join(",")||null:void 0}];else if(p(s))I=s;else{var M=Object.keys(A);I=y?M.sort(y):M}for(var C=0;C<I.length;++C){var U=I[C],T="object"==typeof U&&void 0!==U.value?U.value:A[U];if(!c||null!==T){var W=p(A)?"function"==typeof i?i(r,U):r:r+(h?"."+U:"["+U+"]");O.set(e,x);var L=o();L.set(g,O),f(D,t(T,W,i,a,c,u,s,y,h,b,m,v,S,j,L))}}return D};t.exports=function(t,e){var r,n=t,l=function(t){if(!t)return d;if(null!==t.encoder&&void 0!==t.encoder&&"function"!=typeof t.encoder)throw new TypeError("Encoder has to be a function.");var e=t.charset||d.charset;if(void 0!==t.charset&&"utf-8"!==t.charset&&"iso-8859-1"!==t.charset)throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");var r=i.default;if(void 0!==t.format){if(!a.call(i.formatters,t.format))throw new TypeError("Unknown format option provided.");r=t.format}var o=i.formatters[r],n=d.filter;return("function"==typeof t.filter||p(t.filter))&&(n=t.filter),{addQueryPrefix:"boolean"==typeof t.addQueryPrefix?t.addQueryPrefix:d.addQueryPrefix,allowDots:void 0===t.allowDots?d.allowDots:!!t.allowDots,charset:e,charsetSentinel:"boolean"==typeof t.charsetSentinel?t.charsetSentinel:d.charsetSentinel,delimiter:void 0===t.delimiter?d.delimiter:t.delimiter,encode:"boolean"==typeof t.encode?t.encode:d.encode,encoder:"function"==typeof t.encoder?t.encoder:d.encoder,encodeValuesOnly:"boolean"==typeof t.encodeValuesOnly?t.encodeValuesOnly:d.encodeValuesOnly,filter:n,format:r,formatter:o,serializeDate:"function"==typeof t.serializeDate?t.serializeDate:d.serializeDate,skipNulls:"boolean"==typeof t.skipNulls?t.skipNulls:d.skipNulls,sort:"function"==typeof t.sort?t.sort:null,strictNullHandling:"boolean"==typeof t.strictNullHandling?t.strictNullHandling:d.strictNullHandling}}(e);"function"==typeof l.filter?n=(0,l.filter)("",n):p(l.filter)&&(r=l.filter);var u,s=[];if("object"!=typeof n||null===n)return"";u=e&&e.arrayFormat in c?e.arrayFormat:e&&"indices"in e?e.indices?"indices":"repeat":"indices";var y=c[u];r||(r=Object.keys(n)),l.sort&&r.sort(l.sort);for(var g=o(),b=0;b<r.length;++b){var m=r[b];l.skipNulls&&null===n[m]||f(s,h(n[m],m,y,l.strictNullHandling,l.skipNulls,l.encode?l.encoder:null,l.filter,l.sort,l.allowDots,l.serializeDate,l.format,l.formatter,l.encodeValuesOnly,l.charset,g))}var v=s.join(l.delimiter),S=!0===l.addQueryPrefix?"?":"";return l.charsetSentinel&&("iso-8859-1"===l.charset?S+="utf8=%26%2310003%3B&":S+="utf8=%E2%9C%93&"),v.length>0?S+v:""}},769:(t,e,r)=>{"use strict";var o=r(798),n=Object.prototype.hasOwnProperty,i=Array.isArray,a=function(){for(var t=[],e=0;e<256;++e)t.push("%"+((e<16?"0":"")+e.toString(16)).toUpperCase());return t}(),c=function(t,e){for(var r=e&&e.plainObjects?Object.create(null):{},o=0;o<t.length;++o)void 0!==t[o]&&(r[o]=t[o]);return r};t.exports={arrayToObject:c,assign:function(t,e){return Object.keys(e).reduce((function(t,r){return t[r]=e[r],t}),t)},combine:function(t,e){return[].concat(t,e)},compact:function(t){for(var e=[{obj:{o:t},prop:"o"}],r=[],o=0;o<e.length;++o)for(var n=e[o],a=n.obj[n.prop],c=Object.keys(a),p=0;p<c.length;++p){var l=c[p],u=a[l];"object"==typeof u&&null!==u&&-1===r.indexOf(u)&&(e.push({obj:a,prop:l}),r.push(u))}return function(t){for(;t.length>1;){var e=t.pop(),r=e.obj[e.prop];if(i(r)){for(var o=[],n=0;n<r.length;++n)void 0!==r[n]&&o.push(r[n]);e.obj[e.prop]=o}}}(e),t},decode:function(t,e,r){var o=t.replace(/\+/g," ");if("iso-8859-1"===r)return o.replace(/%[0-9a-f]{2}/gi,unescape);try{return decodeURIComponent(o)}catch(t){return o}},encode:function(t,e,r,n,i){if(0===t.length)return t;var c=t;if("symbol"==typeof t?c=Symbol.prototype.toString.call(t):"string"!=typeof t&&(c=String(t)),"iso-8859-1"===r)return escape(c).replace(/%u[0-9a-f]{4}/gi,(function(t){return"%26%23"+parseInt(t.slice(2),16)+"%3B"}));for(var p="",l=0;l<c.length;++l){var u=c.charCodeAt(l);45===u||46===u||95===u||126===u||u>=48&&u<=57||u>=65&&u<=90||u>=97&&u<=122||i===o.RFC1738&&(40===u||41===u)?p+=c.charAt(l):u<128?p+=a[u]:u<2048?p+=a[192|u>>6]+a[128|63&u]:u<55296||u>=57344?p+=a[224|u>>12]+a[128|u>>6&63]+a[128|63&u]:(l+=1,u=65536+((1023&u)<<10|1023&c.charCodeAt(l)),p+=a[240|u>>18]+a[128|u>>12&63]+a[128|u>>6&63]+a[128|63&u])}return p},isBuffer:function(t){return!(!t||"object"!=typeof t)&&!!(t.constructor&&t.constructor.isBuffer&&t.constructor.isBuffer(t))},isRegExp:function(t){return"[object RegExp]"===Object.prototype.toString.call(t)},maybeMap:function(t,e){if(i(t)){for(var r=[],o=0;o<t.length;o+=1)r.push(e(t[o]));return r}return e(t)},merge:function t(e,r,o){if(!r)return e;if("object"!=typeof r){if(i(e))e.push(r);else{if(!e||"object"!=typeof e)return[e,r];(o&&(o.plainObjects||o.allowPrototypes)||!n.call(Object.prototype,r))&&(e[r]=!0)}return e}if(!e||"object"!=typeof e)return[e].concat(r);var a=e;return i(e)&&!i(r)&&(a=c(e,o)),i(e)&&i(r)?(r.forEach((function(r,i){if(n.call(e,i)){var a=e[i];a&&"object"==typeof a&&r&&"object"==typeof r?e[i]=t(a,r,o):e.push(r)}else e[i]=r})),e):Object.keys(r).reduce((function(e,i){var a=r[i];return n.call(e,i)?e[i]=t(e[i],a,o):e[i]=a,e}),a)}}},478:(t,e,r)=>{"use strict";var o=r(210),n=r(924),i=r(631),a=o("%TypeError%"),c=o("%WeakMap%",!0),p=o("%Map%",!0),l=n("WeakMap.prototype.get",!0),u=n("WeakMap.prototype.set",!0),f=n("WeakMap.prototype.has",!0),s=n("Map.prototype.get",!0),y=n("Map.prototype.set",!0),d=n("Map.prototype.has",!0),g=function(t,e){for(var r,o=t;null!==(r=o.next);o=r)if(r.key===e)return o.next=r.next,r.next=t.next,t.next=r,r};t.exports=function(){var t,e,r,o={assert:function(t){if(!o.has(t))throw new a("Side channel does not contain "+i(t))},get:function(o){if(c&&o&&("object"==typeof o||"function"==typeof o)){if(t)return l(t,o)}else if(p){if(e)return s(e,o)}else if(r)return function(t,e){var r=g(t,e);return r&&r.value}(r,o)},has:function(o){if(c&&o&&("object"==typeof o||"function"==typeof o)){if(t)return f(t,o)}else if(p){if(e)return d(e,o)}else if(r)return function(t,e){return!!g(t,e)}(r,o);return!1},set:function(o,n){c&&o&&("object"==typeof o||"function"==typeof o)?(t||(t=new c),u(t,o,n)):p?(e||(e=new p),y(e,o,n)):(r||(r={key:{},next:null}),function(t,e,r){var o=g(t,e);o?o.value=r:t.next={key:e,next:t.next,value:r}}(r,o,n))}};return o}},654:()=>{}},e={};function r(o){var n=e[o];if(void 0!==n)return n.exports;var i=e[o]={exports:{}};return t[o](i,i.exports,r),i.exports}r.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return r.d(e,{a:e}),e},r.d=(t,e)=>{for(var o in e)r.o(e,o)&&!r.o(t,o)&&Object.defineProperty(t,o,{enumerable:!0,get:e[o]})},r.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};var o={};return(()=>{"use strict";r.r(o),r.d(o,{default:()=>a});var t=r(129),e=r.n(t);function n(t,e,r,o,n,i,a,c){var p,l="function"==typeof t?t.options:t;if(e&&(l.render=e,l.staticRenderFns=r,l._compiled=!0),o&&(l.functional=!0),i&&(l._scopeId="data-v-"+i),a?(p=function(t){(t=t||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext)||"undefined"==typeof __VUE_SSR_CONTEXT__||(t=__VUE_SSR_CONTEXT__),n&&n.call(this,t),t&&t._registeredComponents&&t._registeredComponents.add(a)},l._ssrRegister=p):n&&(p=c?function(){n.call(this,(l.functional?this.parent:this).$root.$options.shadowRoot)}:n),p)if(l.functional){l._injectStyles=p;var u=l.render;l.render=function(t,e){return p.call(e),u(t,e)}}else{var f=l.beforeCreate;l.beforeCreate=f?[].concat(f,p):[p]}return{exports:t,options:l}}var i=n({props:{columnsLength:{type:Number,required:!0}},data:()=>({randNum:Math.floor(10*Math.random())+1})},(function(){var t=this,e=t.$createElement,r=t._self._c||e;return r("tr",[r("td",{class:["vst-loading-row","vst-loading-row-"+t.randNum],attrs:{colspan:t.columnsLength}},[r("div")])])}),[],!1,null,null,null);const a=n({components:{LoadingRow:i.exports},props:{columns:{type:Array,required:!0},source:{type:[String,Function],required:!0},perPage:{type:Number,default:25}},data:()=>({page:1,rows:[],syncState:"initial",orders:{}}),watch:{page:"fetchData",orders:"refetch",perPage:"refetch"},created(){this.fetchData()},methods:{reload(){this.fetchData(this.page)},async fetchData(t=1){const r={per_page:this.perPage,page:t},o=Object.keys(this.orders);let n;if(o.length&&(r.order=o.map((t=>({field:t,direction:this.orders[t]})))),this.syncState="syncing",this.rows=[],"string"==typeof this.source){const t=await fetch(`${this.source}?${e().stringify(r,{arrayFormat:"brackets"})}`);n=await t.json()}else n=await this.source(r);this.rows=n,this.syncState="fetched"},onOrderClick(t){"asc"===this.orders[t]?this.orders={[t]:"desc"}:"desc"===this.orders[t]?this.orders={}:this.orders={[t]:"asc"}},refetch(){1===this.page?this.fetchData(1):this.page=1}}},(function(){var t=this,e=t.$createElement,r=t._self._c||e;return r("table",{staticClass:"vst"},[t.columns.length?r("thead",[r("tr",t._l(t.columns,(function(e){return r("th",{key:e.key,class:["vst-th",{"vst-orderable":e.orderable}],on:{click:function(r){r.preventDefault(),e.orderable&&t.onOrderClick(e.key)}}},[t._t("head:"+e.key,(function(){return[t._v("\n "+t._s(e.title)+"\n ")]}),{column:e}),t._v(" "),e.orderable?r("a",{class:"vst-orderable-toggle "+(t.orders[e.key]||""),attrs:{href:"#"}}):t._e()],2)})),0)]):t._e(),t._v(" "),r("tbody",[t._l(t.rows,(function(e,o){return t._t("row",(function(){return[r("tr",{key:e.id||o},t._l(t.columns,(function(n){return r("td",{key:n.key},[t._t("cell:"+n.key,(function(){return[t._v("\n "+t._s(e[n.key])+"\n ")]}),{row:e,value:e[n.key],column:n,index:o})],2)})),0)]}),{row:e,index:o,columns:t.columns})})),t._v(" "),"fetched"===t.syncState&&0===t.rows.length?t._t("row:empty",(function(){return[r("tr",[r("td",{attrs:{colspan:t.columns.length}},[t._v("\n No records found\n ")])])]})):t._e(),t._v(" "),"syncing"===t.syncState?t._t("row:loading",(function(){return t._l(t.perPage,(function(e,o){return r("LoadingRow",{key:"loadingRow"+o,attrs:{"columns-length":t.columns.length}})}))})):t._e()],2),t._v(" "),r("tfoot",[r("tr",[r("td",{attrs:{colspan:t.columns.length}},[t._t("pagination",(function(){return[t.page>1||t.rows.length===t.perPage?r("ul",{staticClass:"vst-pagination mt-3"},[r("li",{class:["vst-page-item",{disabled:1===t.page}]},[r("a",{staticClass:"vst-page-link",on:{click:function(e){e.preventDefault(),t.page-=1}}},[t._v("←")])]),t._v(" "),r("li",{class:["vst-page-item",{disabled:t.rows.length<t.perPage}]},[r("a",{staticClass:"vst-page-link",on:{click:function(e){e.preventDefault(),t.page+=1}}},[t._v("→")])])]):t._e()]}),{page:t.page,rows:t.rows})],2)])])])}),[],!1,null,null,null).exports})(),o})()}));
|
|
1
|
+
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.VueSlimTable=t():e.VueSlimTable=t()}(self,(function(){return(()=>{"use strict";var e={d:(t,n)=>{for(var r in n)e.o(n,r)&&!e.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:n[r]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};e.r(t),e.d(t,{default:()=>o});function n(e,t,n,r,o,s,a,i){var l,c="function"==typeof e?e.options:e;if(t&&(c.render=t,c.staticRenderFns=n,c._compiled=!0),r&&(c.functional=!0),s&&(c._scopeId="data-v-"+s),a?(l=function(e){(e=e||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext)||"undefined"==typeof __VUE_SSR_CONTEXT__||(e=__VUE_SSR_CONTEXT__),o&&o.call(this,e),e&&e._registeredComponents&&e._registeredComponents.add(a)},c._ssrRegister=l):o&&(l=i?function(){o.call(this,(c.functional?this.parent:this).$root.$options.shadowRoot)}:o),l)if(c.functional){c._injectStyles=l;var u=c.render;c.render=function(e,t){return l.call(t),u(e,t)}}else{var d=c.beforeCreate;c.beforeCreate=d?[].concat(d,l):[l]}return{exports:e,options:c}}var r=n({props:{columnsLength:{type:Number,required:!0}},data:()=>({randNum:Math.floor(10*Math.random())+1})},(function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("tr",[n("td",{class:["vst-loading-row","vst-loading-row-"+e.randNum],attrs:{colspan:e.columnsLength}},[n("div")])])}),[],!1,null,null,null);const o=n({components:{LoadingRow:r.exports},props:{columns:{type:Array,required:!0},source:{type:[String,Function],required:!0},page:{type:Number,default:1},perPage:{type:Number,default:25}},data(){return{internalPage:this.page,rows:[],syncState:"initial",orders:{}}},watch:{internalPage:"fetchData",orders:"refetch",perPage:"refetch",page(e){this.internalPage=e}},created(){this.fetchData(this.internalPage)},methods:{reload(){this.fetchData(this.internalPage)},async fetchData(e=1){const t={per_page:this.perPage,page:e},n=Object.keys(this.orders);n.length&&(t.order=n.map((e=>({field:e,direction:this.orders[e]})))),this.syncState="syncing",this.rows=[],this.rows=await this.source(t),this.syncState="fetched"},onOrderClick(e){"asc"===this.orders[e]?this.orders={[e]:"desc"}:"desc"===this.orders[e]?this.orders={}:this.orders={[e]:"asc"}},refetch(){1===this.internalPage?this.fetchData(1):this.internalPage=1}}},(function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("table",{staticClass:"vst"},[e.columns.length?n("thead",[n("tr",e._l(e.columns,(function(t){return n("th",{key:t.key,class:["vst-th",{"vst-orderable":t.orderable}],on:{click:function(n){n.preventDefault(),t.orderable&&e.onOrderClick(t.key)}}},[e._t("head:"+t.key,(function(){return[e._v("\n "+e._s(t.title)+"\n ")]}),{column:t}),e._v(" "),t.orderable?n("a",{class:"vst-orderable-toggle "+(e.orders[t.key]||""),attrs:{href:"#"}}):e._e()],2)})),0)]):e._e(),e._v(" "),n("tbody",[e._l(e.rows,(function(t,r){return e._t("row",(function(){return[n("tr",{key:t.id||r},e._l(e.columns,(function(o){return n("td",{key:o.key},[e._t("cell:"+o.key,(function(){return[e._v("\n "+e._s(t[o.key])+"\n ")]}),{row:t,value:t[o.key],column:o,index:r})],2)})),0)]}),{row:t,index:r,columns:e.columns})})),e._v(" "),"fetched"===e.syncState&&0===e.rows.length?e._t("row:empty",(function(){return[n("tr",[n("td",{attrs:{colspan:e.columns.length}},[e._v("\n No records found\n ")])])]})):e._e(),e._v(" "),"syncing"===e.syncState?e._t("row:loading",(function(){return e._l(e.perPage,(function(t,r){return n("LoadingRow",{key:"loadingRow"+r,attrs:{"columns-length":e.columns.length}})}))})):e._e()],2),e._v(" "),n("tfoot",[n("tr",[n("td",{attrs:{colspan:e.columns.length}},[e._t("pagination",(function(){return[e.internalPage>1||e.rows.length===e.perPage?n("ul",{staticClass:"vst-pagination mt-3"},[n("li",{class:["vst-page-item",{disabled:1===e.internalPage}]},[n("a",{staticClass:"vst-page-link",on:{click:function(t){t.preventDefault(),e.internalPage-=1}}},[e._v("←")])]),e._v(" "),n("li",{class:["vst-page-item",{disabled:e.rows.length<e.perPage}]},[n("a",{staticClass:"vst-page-link",on:{click:function(t){t.preventDefault(),e.internalPage+=1}}},[e._v("→")])])]):e._e()]}),{page:e.internalPage,rows:e.rows})],2)])])])}),[],!1,null,null,null).exports;return t})()}));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vue-slim-tables",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"main": "dist/bundle.js",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"build": "rm -rf ./dist && NODE_ENV=production webpack --config ./webpack.config.js",
|
|
@@ -37,8 +37,5 @@
|
|
|
37
37
|
"webpack": "^5.65.0",
|
|
38
38
|
"webpack-cli": "^4.9.1",
|
|
39
39
|
"webpack-dev-server": "^4.7.2"
|
|
40
|
-
},
|
|
41
|
-
"dependencies": {
|
|
42
|
-
"qs": "^6.10.2"
|
|
43
40
|
}
|
|
44
41
|
}
|
|
@@ -60,14 +60,14 @@
|
|
|
60
60
|
<tfoot>
|
|
61
61
|
<tr>
|
|
62
62
|
<td :colspan="columns.length">
|
|
63
|
-
<slot name="pagination" :page="
|
|
64
|
-
<ul v-if="
|
|
65
|
-
<li :class="['vst-page-item', { disabled:
|
|
66
|
-
<a class="vst-page-link" @click.prevent="
|
|
63
|
+
<slot name="pagination" :page="internalPage" :rows="rows">
|
|
64
|
+
<ul v-if="internalPage > 1 || rows.length === perPage" class="vst-pagination mt-3">
|
|
65
|
+
<li :class="['vst-page-item', { disabled: internalPage === 1 }]">
|
|
66
|
+
<a class="vst-page-link" @click.prevent="internalPage -= 1">←</a>
|
|
67
67
|
</li>
|
|
68
68
|
|
|
69
69
|
<li :class="['vst-page-item', { disabled: rows.length < perPage }]">
|
|
70
|
-
<a class="vst-page-link" @click.prevent="
|
|
70
|
+
<a class="vst-page-link" @click.prevent="internalPage += 1">→</a>
|
|
71
71
|
</li>
|
|
72
72
|
</ul>
|
|
73
73
|
</slot>
|
|
@@ -78,7 +78,6 @@
|
|
|
78
78
|
</template>
|
|
79
79
|
|
|
80
80
|
<script>
|
|
81
|
-
import qs from 'qs'
|
|
82
81
|
import LoadingRow from './loading_row.vue'
|
|
83
82
|
|
|
84
83
|
export default {
|
|
@@ -86,27 +85,31 @@ export default {
|
|
|
86
85
|
props: {
|
|
87
86
|
columns: { type: Array, required: true },
|
|
88
87
|
source: { type: [String, Function], required: true },
|
|
88
|
+
page: { type: Number, default: 1 },
|
|
89
89
|
perPage: { type: Number, default: 25 },
|
|
90
90
|
},
|
|
91
91
|
data() {
|
|
92
92
|
return {
|
|
93
|
-
|
|
93
|
+
internalPage: this.page,
|
|
94
94
|
rows: [],
|
|
95
95
|
syncState: 'initial',
|
|
96
96
|
orders: {},
|
|
97
97
|
}
|
|
98
98
|
},
|
|
99
99
|
watch: {
|
|
100
|
-
|
|
100
|
+
internalPage: 'fetchData',
|
|
101
101
|
orders: 'refetch',
|
|
102
102
|
perPage: 'refetch',
|
|
103
|
+
page(newPage) {
|
|
104
|
+
this.internalPage = newPage
|
|
105
|
+
},
|
|
103
106
|
},
|
|
104
107
|
created() {
|
|
105
|
-
this.fetchData()
|
|
108
|
+
this.fetchData(this.internalPage)
|
|
106
109
|
},
|
|
107
110
|
methods: {
|
|
108
111
|
reload() {
|
|
109
|
-
this.fetchData(this.
|
|
112
|
+
this.fetchData(this.internalPage)
|
|
110
113
|
},
|
|
111
114
|
async fetchData(page = 1) {
|
|
112
115
|
const params = { per_page: this.perPage, page }
|
|
@@ -119,15 +122,7 @@ export default {
|
|
|
119
122
|
this.syncState = 'syncing'
|
|
120
123
|
this.rows = []
|
|
121
124
|
|
|
122
|
-
|
|
123
|
-
if (typeof this.source === 'string') {
|
|
124
|
-
const response = await fetch(`${this.source}?${qs.stringify(params, { arrayFormat: 'brackets' })}`)
|
|
125
|
-
data = await response.json()
|
|
126
|
-
} else {
|
|
127
|
-
data = await this.source(params)
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
this.rows = data
|
|
125
|
+
this.rows = await this.source(params)
|
|
131
126
|
this.syncState = 'fetched'
|
|
132
127
|
},
|
|
133
128
|
onOrderClick(key) {
|
|
@@ -140,10 +135,10 @@ export default {
|
|
|
140
135
|
}
|
|
141
136
|
},
|
|
142
137
|
refetch() {
|
|
143
|
-
if (this.
|
|
138
|
+
if (this.internalPage === 1) {
|
|
144
139
|
this.fetchData(1)
|
|
145
140
|
} else {
|
|
146
|
-
this.
|
|
141
|
+
this.internalPage = 1
|
|
147
142
|
}
|
|
148
143
|
},
|
|
149
144
|
},
|