JavaScript - Cambiar Cabecera de tabla por filtros

 
Vista:
sin imagen de perfil
Val: 13
Ha disminuido su posición en 4 puestos en JavaScript (en relación al último mes)
Gráfica de JavaScript

Cambiar Cabecera de tabla por filtros

Publicado por iván (8 intervenciones) el 21/04/2020 16:03:35
Hola necesitaría un poco de ayuda, tengo un plugin de woocomerce en wordpress, que de un producto coge sus variaciones, crea una tabla mediante js, y tambien unos filtros, y lo que necesito sería quitar la cabecera que sale los nombres de los atributos y sustituirlos por los filtros que lo hace justo antes, nose si me he explicado bien
Tal que asi es la tabla
Captura-de-pantalla-2020-04-21-a-las-15.58.11
Muchas gracias de antemano

El código comprimido que lo hace es este
1
2
3
// JavaScript Document
var app=function(){"use strict";function t(){}function e(t){return t()}function n(){return Object.create(null)}function i(t){t.forEach(e)}function r(t){return"function"==typeof t}function l(t,e){return t!=t?e==e:t!==e||t&&"object"==typeof t||"function"==typeof t}function o(t,e){t.appendChild(e)}function c(t,e,n){t.insertBefore(e,n||null)}function s(t){t.parentNode.removeChild(t)}function a(t,e){for(let n=0;n<t.length;n+=1)t[n]&&t[n].d(e)}function u(t){return document.createElement(t)}function m(t){return document.createTextNode(t)}function d(){return m(" ")}function f(){return m("")}function p(t,e,n,i){return t.addEventListener(e,n,i),()=>t.removeEventListener(e,n,i)}function h(t,e,n){null==n?t.removeAttribute(e):t.getAttribute(e)!==n&&t.setAttribute(e,n)}function g(t,e){e=""+e,t.data!==e&&(t.data=e)}function _(t,e){(null!=e||t.value)&&(t.value=e)}function y(t,e){for(let n=0;n<t.options.length;n+=1){const i=t.options[n];if(i.__value===e)return void(i.selected=!0)}}function v(t,e,n){t.classList[n?"add":"remove"](e)}let b;function k(t){b=t}function w(){if(!b)throw new Error("Function called outside component initialization");return b}function $(){const t=w();return(e,n)=>{const i=t.$$.callbacks[e];if(i){const r=function(t,e){const n=document.createEvent("CustomEvent");return n.initCustomEvent(t,!1,!1,e),n}(e,n);i.slice().forEach(e=>{e.call(t,r)})}}}const x=[],T=[],V=[],L=[],S=Promise.resolve();let C=!1;function A(t){V.push(t)}function q(t){L.push(t)}const j=new Set;function F(){do{for(;x.length;){const t=x.shift();k(t),R(t.$$)}for(;T.length;)T.pop()();for(let t=0;t<V.length;t+=1){const e=V[t];j.has(e)||(j.add(e),e())}V.length=0}while(x.length);for(;L.length;)L.pop()();C=!1,j.clear()}function R(t){if(null!==t.fragment){t.update(),i(t.before_update);const e=t.dirty;t.dirty=[-1],t.fragment&&t.fragment.p(t.ctx,e),t.after_update.forEach(A)}}const E=new Set;let Q;function M(){Q={r:0,c:[],p:Q}}function U(){Q.r||i(Q.c),Q=Q.p}function N(t,e){t&&t.i&&(E.delete(t),t.i(e))}function O(t,e,n,i){if(t&&t.o){if(E.has(t))return;E.add(t),Q.c.push(()=>{E.delete(t),i&&(n&&t.d(1),i())}),t.o(e)}}function D(t,e){O(t,1,1,()=>{e.delete(t.key)})}function H(t,e,n){const i=t.$$.props[e];void 0!==i&&(t.$$.bound[i]=n,n(t.$$.ctx[i]))}function I(t){t&&t.c()}function P(t,n,l){const{fragment:o,on_mount:c,on_destroy:s,after_update:a}=t.$$;o&&o.m(n,l),A(()=>{const n=c.map(e).filter(r);s?s.push(...n):i(n),t.$$.on_mount=[]}),a.forEach(A)}function K(t,e){const n=t.$$;null!==n.fragment&&(i(n.on_destroy),n.fragment&&n.fragment.d(e),n.on_destroy=n.fragment=null,n.ctx=[])}function z(t,e){-1===t.$$.dirty[0]&&(x.push(t),C||(C=!0,S.then(F)),t.$$.dirty.fill(0)),t.$$.dirty[e/31|0]|=1<<e%31}function B(e,r,l,o,c,s,a=[-1]){const u=b;k(e);const m=r.props||{},d=e.$$={fragment:null,ctx:null,props:s,update:t,not_equal:c,bound:n(),on_mount:[],on_destroy:[],before_update:[],after_update:[],context:new Map(u?u.$$.context:[]),callbacks:n(),dirty:a};let f=!1;d.ctx=l?l(e,m,(t,n,...i)=>{const r=i.length?i[0]:n;return d.ctx&&c(d.ctx[t],d.ctx[t]=r)&&(d.bound[t]&&d.bound[t](r),f&&z(e,t)),n}):[],d.update(),f=!0,i(d.before_update),d.fragment=!!o&&o(d.ctx),r.target&&(r.hydrate?d.fragment&&d.fragment.l(function(t){return Array.from(t.childNodes)}(r.target)):d.fragment&&d.fragment.c(),r.intro&&N(e.$$.fragment),P(e,r.target,r.anchor),F()),k(u)}class W{$destroy(){K(this,1),this.$destroy=t}$on(t,e){const n=this.$$.callbacks[t]||(this.$$.callbacks[t]=[]);return n.push(e),()=>{const t=n.indexOf(e);-1!==t&&n.splice(t,1)}}$set(){}}function G(t,e,n){const i=t.slice();return i[12]=e[n],i[14]=n,i}function J(t,e,n){const i=t.slice();return i[9]=e[n],i[11]=n,i}function X(t){let e,n,r,l,f,_,v,b,k,w=t[9].name+"",$=t[3].anyText+"",x=t[9].options,T=[];for(let e=0;e<x.length;e+=1)T[e]=Y(G(t,x,e));function V(){t[8].call(f,t[11])}return{c(){e=u("div"),n=u("label"),r=m(w),l=d(),f=u("select"),_=u("option"),v=m($);for(let t=0;t<T.length;t+=1)T[t].c();b=d(),_.__value="",_.value=_.__value,h(f,"class","form-control"),void 0===t[0][t[11]]&&A(V),h(e,"class","filter")},m(i,s){c(i,e,s),o(e,n),o(n,r),o(e,l),o(e,f),o(f,_),o(_,v);for(let t=0;t<T.length;t+=1)T[t].m(f,null);y(f,t[0][t[11]]),o(e,b),k=[p(f,"change",V),p(f,"change",t[4])]},p(e,n){if(t=e,4&n&&w!==(w=t[9].name+"")&&g(r,w),8&n&&$!==($=t[3].anyText+"")&&g(v,$),4&n){let e;for(x=t[9].options,e=0;e<x.length;e+=1){const i=G(t,x,e);T[e]?T[e].p(i,n):(T[e]=Y(i),T[e].c(),T[e].m(f,null))}for(;e<T.length;e+=1)T[e].d(1);T.length=x.length}1&n&&y(f,t[0][t[11]])},d(t){t&&s(e),a(T,t),i(k)}}}function Y(t){let e,n,i,r,l=t[12].name+"";return{c(){e=u("option"),n=m(l),i=d(),e.__value=r="attribute_"+t[9].key+":"+t[12].slug,e.value=e.__value},m(t,r){c(t,e,r),o(e,n),o(e,i)},p(t,i){4&i&&l!==(l=t[12].name+"")&&g(n,l),4&i&&r!==(r="attribute_"+t[9].key+":"+t[12].slug)&&(e.__value=r),e.value=e.__value},d(t){t&&s(e)}}}function Z(t){let e,n=t[9].visible&&X(t);return{c(){n&&n.c(),e=f()},m(t,i){n&&n.m(t,i),c(t,e,i)},p(t,i){t[9].visible?n?n.p(t,i):(n=X(t),n.c(),n.m(e.parentNode,e)):n&&(n.d(1),n=null)},d(t){n&&n.d(t),t&&s(e)}}}function tt(e){let n,r,l,m,f,g,y,v=e[2],b=[];for(let t=0;t<v.length;t+=1)b[t]=Z(J(e,v,t));return{c(){n=u("div"),r=u("div"),l=u("div"),m=u("input"),g=d();for(let t=0;t<b.length;t+=1)b[t].c();h(m,"placeholder",f=e[3].searchPlaceholderText),h(m,"name","query"),h(m,"class","form-control"),h(l,"class","filter"),h(r,"class","filters form-inline"),h(n,"class","variation-filters")},m(t,i){c(t,n,i),o(n,r),o(r,l),o(l,m),_(m,e[1]),o(r,g);for(let t=0;t<b.length;t+=1)b[t].m(r,null);y=[p(m,"input",e[7]),p(m,"input",e[4])]},p(t,[e]){if(8&e&&f!==(f=t[3].searchPlaceholderText)&&h(m,"placeholder",f),2&e&&m.value!==t[1]&&_(m,t[1]),29&e){let n;for(v=t[2],n=0;n<v.length;n+=1){const i=J(t,v,n);b[n]?b[n].p(i,e):(b[n]=Z(i),b[n].c(),b[n].m(r,null))}for(;n<b.length;n+=1)b[n].d(1);b.length=v.length}},i:t,o:t,d(t){t&&s(n),a(b,t),i(y)}}}function et(t,e,n){let{attributes:i}=e,{activeFilters:r}=e,{filters:l=[]}=e,{searchQuery:o=""}=e,{textVars:c}=e;const s=$();return t.$set=t=>{"attributes"in t&&n(2,i=t.attributes),"activeFilters"in t&&n(0,r=t.activeFilters),"filters"in t&&n(5,l=t.filters),"searchQuery"in t&&n(1,o=t.searchQuery),"textVars"in t&&n(3,c=t.textVars)},[r,o,i,c,function(){if(r.length){var t=0;n(5,l=[]);for(let i=0;i<r.length;i++)if(""!=r[i]){var e=r[i].split(":");n(5,l[i-t]={},l),n(5,l[i-t][e[0]]=e[1],l)}else t++}return s("setFilters",l),l},l,s,function(){o=this.value,n(1,o)},function(t){r[t]=function(t){const e=t.querySelector(":checked")||t.options[0];return e&&e.__value}(this),n(0,r),n(2,i)}]}class nt extends W{constructor(t){super(),B(this,t,et,tt,l,{attributes:2,activeFilters:0,filters:5,searchQuery:1,textVars:3})}}function it(e){let n;return{c(){n=u("span"),h(n,"class","spinner svelte-1522nvw")},m(t,e){c(t,n,e)},p:t,i:t,o:t,d(t){t&&s(n)}}}class rt extends W{constructor(t){super(),B(this,t,null,it,l,{})}}function lt(e){let n;return{c(){n=u("span"),n.innerHTML='<div class="checkmark_circle svelte-ui7w65"></div> \n  <div class="checkmark_stem svelte-ui7w65"></div> \n  <div class="checkmark_kick svelte-ui7w65"></div>',h(n,"class","checkmark svelte-ui7w65")},m(t,e){c(t,n,e)},p:t,i:t,o:t,d(t){t&&s(n)}}}class ot extends W{constructor(t){super(),B(this,t,null,lt,l,{})}}function ct(t,e,n){const i=t.slice();return i[18]=e[n],i[20]=n,i}function st(t,e,n){const i=t.slice();return i[21]=e[n],i[20]=n,i}function at(t){let e,n,i,r,l="image"===t[21].type&&ut(t),a="text"===t[21].type&&dt(t),m="html"===t[21].type&&ft(t);return{c(){e=u("td"),l&&l.c(),n=d(),a&&a.c(),i=d(),m&&m.c(),h(e,"data-title",r=t[21].title)},m(t,r){c(t,e,r),l&&l.m(e,null),o(e,n),a&&a.m(e,null),o(e,i),m&&m.m(e,null)},p(t,o){"image"===t[21].type?l?l.p(t,o):(l=ut(t),l.c(),l.m(e,n)):l&&(l.d(1),l=null),"text"===t[21].type?a?a.p(t,o):(a=dt(t),a.c(),a.m(e,i)):a&&(a.d(1),a=null),"html"===t[21].type?m?m.p(t,o):(m=ft(t),m.c(),m.m(e,null)):m&&(m.d(1),m=null),1&o&&r!==(r=t[21].title)&&h(e,"data-title",r)},d(t){t&&s(e),l&&l.d(),a&&a.d(),m&&m.d()}}}function ut(t){let e,n=""!=t[10](t[2][t[21].key]),i=n&&mt(t);return{c(){e=u("span"),i&&i.c(),h(e,"class","item")},m(t,n){c(t,e,n),i&&i.m(e,null)},p(t,r){5&r&&(n=""!=t[10](t[2][t[21].key])),n?i?i.p(t,r):(i=mt(t),i.c(),i.m(e,null)):i&&(i.d(1),i=null)},d(t){t&&s(e),i&&i.d()}}}function mt(t){let e,n,i;return{c(){e=u("img"),e.src!==(n=t[10](t[2][t[21].key]))&&h(e,"src",n),h(e,"alt",i=t[2].sku)},m(t,n){c(t,e,n)},p(t,r){5&r&&e.src!==(n=t[10](t[2][t[21].key]))&&h(e,"src",n),4&r&&i!==(i=t[2].sku)&&h(e,"alt",i)},d(t){t&&s(e)}}}function dt(t){let e,n,i=t[2][t[21].key]+"";return{c(){e=u("span"),n=m(i),h(e,"class","item")},m(t,i){c(t,e,i),o(e,n)},p(t,e){5&e&&i!==(i=t[2][t[21].key]+"")&&g(n,i)},d(t){t&&s(e)}}}function ft(t){let e,n=t[2][t[21].key]+"";return{c(){e=u("span"),h(e,"class","item")},m(t,i){c(t,e,i),e.innerHTML=n},p(t,i){5&i&&n!==(n=t[2][t[21].key]+"")&&(e.innerHTML=n)},d(t){t&&s(e)}}}function pt(t){let e,n="on"===t[1][t[21].key]&&at(t);return{c(){n&&n.c(),e=f()},m(t,i){n&&n.m(t,i),c(t,e,i)},p(t,i){"on"===t[1][t[21].key]?n?n.p(t,i):(n=at(t),n.c(),n.m(e.parentNode,e)):n&&(n.d(1),n=null)},d(t){n&&n.d(t),t&&s(e)}}}function ht(t){let e,n=Object.entries(t[2].attributes),i=[];for(let e=0;e<n.length;e+=1)i[e]=_t(ct(t,n,e));return{c(){for(let t=0;t<i.length;t+=1)i[t].c();e=f()},m(t,n){for(let e=0;e<i.length;e+=1)i[e].m(t,n);c(t,e,n)},p(t,r){if(4100&r){let l;for(n=Object.entries(t[2].attributes),l=0;l<n.length;l+=1){const o=ct(t,n,l);i[l]?i[l].p(o,r):(i[l]=_t(o),i[l].c(),i[l].m(e.parentNode,e))}for(;l<i.length;l+=1)i[l].d(1);i.length=n.length}},d(t){a(i,t),t&&s(e)}}}function gt(t){let e,n,i,r,l=Vt(t[18][1],t[12](t[18][0].substr(10)).options)+"";return{c(){e=u("td"),n=m(l),i=d(),h(e,"data-title",r=t[12](t[18][0].substr(10)).name)},m(t,r){c(t,e,r),o(e,n),o(e,i)},p(t,i){4&i&&l!==(l=Vt(t[18][1],t[12](t[18][0].substr(10)).options)+"")&&g(n,l),4&i&&r!==(r=t[12](t[18][0].substr(10)).name)&&h(e,"data-title",r)},d(t){t&&s(e)}}}function _t(t){let e,n=t[12](t[18][0].substr(10))&&t[12](t[18][0].substr(10)).visible,i=n&&gt(t);return{c(){i&&i.c(),e=f()},m(t,n){i&&i.m(t,n),c(t,e,n)},p(t,r){4&r&&(n=t[12](t[18][0].substr(10))&&t[12](t[18][0].substr(10)).visible),n?i?i.p(t,r):(i=gt(t),i.c(),i.m(e.parentNode,e)):i&&(i.d(1),i=null)},d(t){i&&i.d(t),t&&s(e)}}}function yt(t){let e,n,i=t[2].availability_html&&vt(t);return{c(){e=u("td"),n=u("span"),i&&i.c(),h(n,"class","item"),h(e,"class","stock"),h(e,"data-title","Stock")},m(t,r){c(t,e,r),o(e,n),i&&i.m(n,null)},p(t,e){t[2].availability_html?i?i.p(t,e):(i=vt(t),i.c(),i.m(n,null)):i&&(i.d(1),i=null)},d(t){t&&s(e),i&&i.d()}}}function vt(t){let e,n=t[2].availability_html+"";return{c(){e=u("span"),v(e,"in-stock",t[2].is_in_stock),v(e,"out-of-stock",!t[2].is_in_stock)},m(t,i){c(t,e,i),e.innerHTML=n},p(t,i){4&i&&n!==(n=t[2].availability_html+"")&&(e.innerHTML=n),4&i&&v(e,"in-stock",t[2].is_in_stock),4&i&&v(e,"out-of-stock",!t[2].is_in_stock)},d(t){t&&s(e)}}}function bt(t){let e,n,i=t[2].price_html+"";return{c(){e=u("td"),n=u("span"),h(n,"class","item"),h(e,"class","price_html"),h(e,"data-title","Price")},m(t,r){c(t,e,r),o(e,n),n.innerHTML=i},p(t,e){4&e&&i!==(i=t[2].price_html+"")&&(n.innerHTML=i)},d(t){t&&s(e)}}}function kt(t){let e,n=t[2].is_in_stock&&wt(t);return{c(){e=u("td"),n&&n.c(),h(e,"class","quantity")},m(t,i){c(t,e,i),n&&n.m(e,null)},p(t,i){t[2].is_in_stock?n?n.p(t,i):(n=wt(t),n.c(),n.m(e,null)):n&&(n.d(1),n=null)},d(t){t&&s(e),n&&n.d()}}}function wt(t){let e,n,i=!1;function r(){i=!0,t[16].call(e)}return{c(){e=u("input"),h(e,"type","number"),h(e,"step","1"),h(e,"min","1"),h(e,"name","quantity"),h(e,"data-title","Qty"),h(e,"title","Qty"),h(e,"class","input-text qty text"),h(e,"size","4"),h(e,"pattern","[0-9]*"),h(e,"inputmode","numeric")},m(i,l){c(i,e,l),_(e,t[7]),n=p(e,"input",r)},p(t,n){!i&&128&n&&_(e,t[7]),i=!1},d(t){t&&s(e),n()}}}function $t(t){let e;const n=new rt({});return{c(){I(n.$$.fragment)},m(t,i){P(n,t,i),e=!0},i(t){e||(N(n.$$.fragment,t),e=!0)},o(t){O(n.$$.fragment,t),e=!1},d(t){K(n,t)}}}function xt(t){let e;const n=new ot({});return{c(){I(n.$$.fragment)},m(t,i){P(n,t,i),e=!0},i(t){e||(N(n.$$.fragment,t),e=!0)},o(t){O(n.$$.fragment,t),e=!1},d(t){K(n,t)}}}function Tt(t){let e,n,i,r,l,f,_,y,b,k,w,$,x,T,V,L=t[4].addToCartText+"",S=t[0],C=[];for(let e=0;e<S.length;e+=1)C[e]=pt(st(t,S,e));let A=t[3]&&ht(t),q="on"===t[1].stock&&yt(t),j="on"===t[1].price_html&&bt(t),F="on"===t[1].quantity&&kt(t),R=t[9]&&"on"===t[5]&&$t(),E=!t[9]&&t[8]&&"on"===t[5]&&xt();return{c(){e=u("tr");for(let t=0;t<C.length;t+=1)C[t].c();n=d(),A&&A.c(),i=d(),q&&q.c(),r=d(),j&&j.c(),l=d(),F&&F.c(),f=d(),_=u("td"),y=u("button"),b=m(L),k=d(),R&&R.c(),w=d(),E&&E.c(),h(y,"type","submit"),y.disabled=$=!t[2].is_in_stock,h(y,"class","single_add_to_cart_button button alt"),v(y,"added",t[8]),v(y,"loading",t[9]),h(_,"class","add-to-cart"),h(e,"class",x="variation-"+t[2].variation_id+" image-"+t[11](t[2].image_link))},m(s,a){c(s,e,a);for(let t=0;t<C.length;t+=1)C[t].m(e,null);var u;o(e,n),A&&A.m(e,null),o(e,i),q&&q.m(e,null),o(e,r),j&&j.m(e,null),o(e,l),F&&F.m(e,null),o(e,f),o(e,_),o(_,y),o(y,b),o(y,k),R&&R.m(y,null),o(y,w),E&&E.m(y,null),t[17](y),T=!0,V=p(y,"click",(u=t[13],function(t){return t.preventDefault(),u.call(this,t)}))},p(t,[o]){if(1031&o){let i;for(S=t[0],i=0;i<S.length;i+=1){const r=st(t,S,i);C[i]?C[i].p(r,o):(C[i]=pt(r),C[i].c(),C[i].m(e,n))}for(;i<C.length;i+=1)C[i].d(1);C.length=S.length}t[3]?A?A.p(t,o):(A=ht(t),A.c(),A.m(e,i)):A&&(A.d(1),A=null),"on"===t[1].stock?q?q.p(t,o):(q=yt(t),q.c(),q.m(e,r)):q&&(q.d(1),q=null),"on"===t[1].price_html?j?j.p(t,o):(j=bt(t),j.c(),j.m(e,l)):j&&(j.d(1),j=null),"on"===t[1].quantity?F?F.p(t,o):(F=kt(t),F.c(),F.m(e,f)):F&&(F.d(1),F=null),(!T||16&o)&&L!==(L=t[4].addToCartText+"")&&g(b,L),t[9]&&"on"===t[5]?R?N(R,1):(R=$t(),R.c(),N(R,1),R.m(y,w)):R&&(M(),O(R,1,1,()=>{R=null}),U()),!t[9]&&t[8]&&"on"===t[5]?E?N(E,1):(E=xt(),E.c(),N(E,1),E.m(y,null)):E&&(M(),O(E,1,1,()=>{E=null}),U()),(!T||4&o&&$!==($=!t[2].is_in_stock))&&(y.disabled=$),256&o&&v(y,"added",t[8]),512&o&&v(y,"loading",t[9]),(!T||4&o&&x!==(x="variation-"+t[2].variation_id+" image-"+t[11](t[2].image_link)))&&h(e,"class",x)},i(t){T||(N(R),N(E),T=!0)},o(t){O(R),O(E),T=!1},d(n){n&&s(e),a(C,n),A&&A.d(),q&&q.d(),j&&j.d(),F&&F.d(),R&&R.d(),E&&E.d(),t[17](null),V()}}}function Vt(t,e){var n=e.filter((function(e){return e.slug===t}));return n[0]&&n[0].name?n[0].name:""}function Lt(t,e,n){let i,{columns:r}=e,{activeColumns:l}=e,{item:o}=e,{showAttributes:c}=e,{attributes:s}=e,{productImageURL:a}=e,{textVars:u}=e,{showSpinner:m}=e,d=1,f=!1,p=!1;return t.$set=t=>{"columns"in t&&n(0,r=t.columns),"activeColumns"in t&&n(1,l=t.activeColumns),"item"in t&&n(2,o=t.item),"showAttributes"in t&&n(3,c=t.showAttributes),"attributes"in t&&n(14,s=t.attributes),"productImageURL"in t&&n(15,a=t.productImageURL),"textVars"in t&&n(4,u=t.textVars),"showSpinner"in t&&n(5,m=t.showSpinner)},[r,l,o,c,u,m,i,d,f,p,function(t){return t||a},function(t){let e=(t||a).split("/");return e=e[e.length-1].split(".")[0].replace(/\s+/g,""),e},function(t){let e=s.find(e=>e.key===t);return void 0!==e&&e},function(){const t={product_id:o.variation_id,variation_id:o.variation_id,quantity:d},e=Object.assign(o.attributes,t);jQuery(document.body).trigger("adding_to_cart",[jQuery(i),e]),jQuery.ajax({type:"POST",url:woocommerce_params.wc_ajax_url.toString().replace("%%endpoint%%","add_to_cart"),data:e,beforeSend(t){n(8,f=!1),n(9,p=!0)},complete(t){n(8,f=!0),n(9,p=!1)},success(t){t.error&t.product_url?window.location=t.product_url:"yes"!==wc_add_to_cart_params.cart_redirect_after_add?jQuery(document.body).trigger("added_to_cart",[t.fragments,t.cart_hash,void 0]):window.location=wc_add_to_cart_params.cart_url}})},s,a,function(){var t;t=this.value,d=""===t?void 0:+t,n(7,d)},function(t){T[t?"unshift":"push"](()=>{n(6,i=t)})}]}class St extends W{constructor(t){super(),B(this,t,Lt,Tt,l,{columns:0,activeColumns:1,item:2,showAttributes:3,attributes:14,productImageURL:15,textVars:4,showSpinner:5})}}function Ct(t,e,n){const i=t.slice();return i[27]=e[n],i}function At(t,e,n){const i=t.slice();return i[30]=e[n],i[32]=n,i}function qt(t,e,n){const i=t.slice();return i[33]=e[n],i[32]=n,i}function jt(t){let e,n;function i(e){t[21].call(null,e)}let r={attributes:t[5],activeFilters:t[11],textVars:t[2]};void 0!==t[8]&&(r.searchQuery=t[8]);const l=new nt({props:r});return T.push(()=>H(l,"searchQuery",i)),l.$on("setFilters",t[15]),{c(){I(l.$$.fragment)},m(t,e){P(l,t,e),n=!0},p(t,n){const i={};32&n[0]&&(i.attributes=t[5]),4&n[0]&&(i.textVars=t[2]),!e&&256&n[0]&&(e=!0,i.searchQuery=t[8],q(()=>e=!1)),l.$set(i)},i(t){n||(N(l.$$.fragment,t),n=!0)},o(t){O(l.$$.fragment,t),n=!1},d(t){K(l,t)}}}function Ft(t){let e,n,i,r,l,a,f=t[33].title+"";function g(...e){return t[22](t[33],...e)}return{c(){e=u("th"),n=m(f),i=d(),r=u("span"),h(r,"class","arrow"),v(r,"asc",t[9][t[33].key]>0||t[1]!==t[33].key),v(r,"dsc",t[9][t[33].key]<0&&t[1]===t[33].key),h(e,"class",l=t[33].key),v(e,"active",t[1]===t[33].key)},m(t,l){c(t,e,l),o(e,n),o(e,i),o(e,r),a=p(e,"click",g)},p(n,i){t=n,4610&i[0]&&v(r,"asc",t[9][t[33].key]>0||t[1]!==t[33].key),4610&i[0]&&v(r,"dsc",t[9][t[33].key]<0&&t[1]===t[33].key),4098&i[0]&&v(e,"active",t[1]===t[33].key)},d(t){t&&s(e),a()}}}function Rt(t){let e,n=t[0][t[33].key]&&Ft(t);return{c(){n&&n.c(),e=f()},m(t,i){n&&n.m(t,i),c(t,e,i)},p(t,i){t[0][t[33].key]?n?n.p(t,i):(n=Ft(t),n.c(),n.m(e.parentNode,e)):n&&(n.d(1),n=null)},d(t){n&&n.d(t),t&&s(e)}}}function Et(t){let e,n=t[5],i=[];for(let e=0;e<n.length;e+=1)i[e]=Mt(At(t,n,e));return{c(){for(let t=0;t<i.length;t+=1)i[t].c();e=f()},m(t,n){for(let e=0;e<i.length;e+=1)i[e].m(t,n);c(t,e,n)},p(t,r){if(16930&r[0]){let l;for(n=t[5],l=0;l<n.length;l+=1){const o=At(t,n,l);i[l]?i[l].p(o,r):(i[l]=Mt(o),i[l].c(),i[l].m(e.parentNode,e))}for(;l<i.length;l+=1)i[l].d(1);i.length=n.length}},d(t){a(i,t),t&&s(e)}}}function Qt(t){let e,n,i,r,l,a,f,_=t[30].name+"";function y(...e){return t[23](t[30],...e)}return{c(){e=u("th"),n=m(_),i=d(),r=u("span"),l=d(),h(r,"class","arrow"),v(r,"asc",t[9]["attribute_"+t[30].key]>0||t[1]!=="attribute_"+t[30].key),v(r,"dsc",t[9]["attribute_"+t[30].key]<0&&t[1]==="attribute_"+t[30].key),h(e,"class",a=t[30].key),v(e,"active",t[1]==="attribute_"+t[30].key)},m(t,s){c(t,e,s),o(e,n),o(e,i),o(e,r),o(e,l),f=p(e,"click",y)},p(i,l){t=i,32&l[0]&&_!==(_=t[30].name+"")&&g(n,_),546&l[0]&&v(r,"asc",t[9]["attribute_"+t[30].key]>0||t[1]!=="attribute_"+t[30].key),546&l[0]&&v(r,"dsc",t[9]["attribute_"+t[30].key]<0&&t[1]==="attribute_"+t[30].key),32&l[0]&&a!==(a=t[30].key)&&h(e,"class",a),34&l[0]&&v(e,"active",t[1]==="attribute_"+t[30].key)},d(t){t&&s(e),f()}}}function Mt(t){let e,n=t[30].visible&&Qt(t);return{c(){n&&n.c(),e=f()},m(t,i){n&&n.m(t,i),c(t,e,i)},p(t,i){t[30].visible?n?n.p(t,i):(n=Qt(t),n.c(),n.m(e.parentNode,e)):n&&(n.d(1),n=null)},d(t){n&&n.d(t),t&&s(e)}}}function Ut(t){let e,n,i,r,l,a=t[2].columnsText.stock+"";return{c(){e=u("th"),n=m(a),i=d(),r=u("span"),h(r,"class","arrow"),v(r,"asc",t[9].availability_html>0||"availability_html"!==t[1]),v(r,"dsc",t[9].availability_html<0&&"availability_html"===t[1]),h(e,"class","stock"),v(e,"active","availability_html"===t[1])},m(s,a){c(s,e,a),o(e,n),o(e,i),o(e,r),l=p(e,"click",t[24])},p(t,i){4&i[0]&&a!==(a=t[2].columnsText.stock+"")&&g(n,a),514&i[0]&&v(r,"asc",t[9].availability_html>0||"availability_html"!==t[1]),514&i[0]&&v(r,"dsc",t[9].availability_html<0&&"availability_html"===t[1]),2&i[0]&&v(e,"active","availability_html"===t[1])},d(t){t&&s(e),l()}}}function Nt(t){let e,n,i,r,l,a=t[2].columnsText.price_html+"";return{c(){e=u("th"),n=m(a),i=d(),r=u("span"),h(r,"class","arrow"),v(r,"asc",t[9].price_html>0||"price_html"!==t[1]),v(r,"dsc",t[9].price_html<0&&"price_html"===t[1]),h(e,"class","price_html"),v(e,"active","price_html"===t[1])},m(s,a){c(s,e,a),o(e,n),o(e,i),o(e,r),l=p(e,"click",t[25])},p(t,i){4&i[0]&&a!==(a=t[2].columnsText.price_html+"")&&g(n,a),514&i[0]&&v(r,"asc",t[9].price_html>0||"price_html"!==t[1]),514&i[0]&&v(r,"dsc",t[9].price_html<0&&"price_html"===t[1]),2&i[0]&&v(e,"active","price_html"===t[1])},d(t){t&&s(e),l()}}}function Ot(t){let e,n,i=t[2].columnsText.quantity+"";return{c(){e=u("th"),n=m(i),h(e,"class","quantity")},m(t,i){c(t,e,i),o(e,n)},p(t,e){4&e[0]&&i!==(i=t[2].columnsText.quantity+"")&&g(n,i)},d(t){t&&s(e)}}}function Dt(t,e){let n,i,r;function l(t){e[26].call(null,t)}let o={item:e[27],columns:e[12],showAttributes:e[3],attributes:e[5],productImageURL:e[6],showSpinner:e[7],textVars:e[2]};void 0!==e[0]&&(o.activeColumns=e[0]);const a=new St({props:o});return T.push(()=>H(a,"activeColumns",l)),{key:t,first:null,c(){n=f(),I(a.$$.fragment),this.first=n},m(t,e){c(t,n,e),P(a,t,e),r=!0},p(t,e){const n={};1024&e[0]&&(n.item=t[27]),8&e[0]&&(n.showAttributes=t[3]),32&e[0]&&(n.attributes=t[5]),64&e[0]&&(n.productImageURL=t[6]),128&e[0]&&(n.showSpinner=t[7]),4&e[0]&&(n.textVars=t[2]),!i&&1&e[0]&&(i=!0,n.activeColumns=t[0],q(()=>i=!1)),a.$set(n)},i(t){r||(N(a.$$.fragment,t),r=!0)},o(t){O(a.$$.fragment,t),r=!1},d(t){t&&s(n),K(a,t)}}}function Ht(t){let e,n,i,r=t[2].noResultsText+"";return{c(){var l,o,c;e=u("tr"),n=u("td"),i=m(r),h(n,"colspan",t[13]),l="text-align",o="center",n.style.setProperty(l,o,c?"important":"")},m(t,r){c(t,e,r),o(e,n),o(n,i)},p(t,e){4&e[0]&&r!==(r=t[2].noResultsText+"")&&g(i,r)},d(t){t&&s(e)}}}function It(t){let e,n,i,r,l,m,f,p,g,_,y,v,b,k,w,$=[],x=new Map,T=t[4]&&jt(t),V=t[12],L=[];for(let e=0;e<V.length;e+=1)L[e]=Rt(qt(t,V,e));let S=t[3]&&Et(t),C="on"===t[0].stock&&Ut(t),A=t[0].price_html&&Nt(t),q="on"===t[0].quantity&&Ot(t),j=t[10];const F=t=>t[27].variation_id;for(let e=0;e<j.length;e+=1){let n=Ct(t,j,e),i=F(n);x.set(i,$[e]=Dt(i,n))}let R=(!t[10]||!t[10].length)&&Ht(t);return{c(){e=u("div"),T&&T.c(),n=d(),i=u("table"),r=u("thead"),l=u("tr");for(let t=0;t<L.length;t+=1)L[t].c();m=d(),S&&S.c(),f=d(),C&&C.c(),p=d(),A&&A.c(),g=d(),q&&q.c(),_=d(),y=u("th"),v=d(),b=u("tbody");for(let t=0;t<$.length;t+=1)$[t].c();k=d(),R&&R.c(),h(y,"class","add-to-cart"),h(i,"class","variations"),h(e,"id","variations")},m(t,s){c(t,e,s),T&&T.m(e,null),o(e,n),o(e,i),o(i,r),o(r,l);for(let t=0;t<L.length;t+=1)L[t].m(l,null);o(l,m),S&&S.m(l,null),o(l,f),C&&C.m(l,null),o(l,p),A&&A.m(l,null),o(l,g),q&&q.m(l,null),o(l,_),o(l,y),o(i,v),o(i,b);for(let t=0;t<$.length;t+=1)$[t].m(b,null);o(b,k),R&&R.m(b,null),w=!0},p(t,i){if(t[4]?T?(T.p(t,i),N(T,1)):(T=jt(t),T.c(),N(T,1),T.m(e,n)):T&&(M(),O(T,1,1,()=>{T=null}),U()),20995&i[0]){let e;for(V=t[12],e=0;e<V.length;e+=1){const n=qt(t,V,e);L[e]?L[e].p(n,i):(L[e]=Rt(n),L[e].c(),L[e].m(l,m))}for(;e<L.length;e+=1)L[e].d(1);L.length=V.length}t[3]?S?S.p(t,i):(S=Et(t),S.c(),S.m(l,f)):S&&(S.d(1),S=null),"on"===t[0].stock?C?C.p(t,i):(C=Ut(t),C.c(),C.m(l,p)):C&&(C.d(1),C=null),t[0].price_html?A?A.p(t,i):(A=Nt(t),A.c(),A.m(l,g)):A&&(A.d(1),A=null),"on"===t[0].quantity?q?q.p(t,i):(q=Ot(t),q.c(),q.m(l,_)):q&&(q.d(1),q=null);const r=t[10];M(),$=function(t,e,n,i,r,l,o,c,s,a,u,m){let d=t.length,f=l.length,p=d;const h={};for(;p--;)h[t[p].key]=p;const g=[],_=new Map,y=new Map;for(p=f;p--;){const t=m(r,l,p),c=n(t);let s=o.get(c);s?i&&s.p(t,e):(s=a(c,t),s.c()),_.set(c,g[p]=s),c in h&&y.set(c,Math.abs(p-h[c]))}const v=new Set,b=new Set;function k(t){N(t,1),t.m(c,u),o.set(t.key,t),u=t.first,f--}for(;d&&f;){const e=g[f-1],n=t[d-1],i=e.key,r=n.key;e===n?(u=e.first,d--,f--):_.has(r)?!o.has(i)||v.has(i)?k(e):b.has(r)?d--:y.get(i)>y.get(r)?(b.add(i),k(e)):(v.add(r),d--):(s(n,o),d--)}for(;d--;){const e=t[d];_.has(e.key)||s(e,o)}for(;f;)k(g[f-1]);return g}($,i,F,1,t,r,x,b,D,Dt,k,Ct),U(),t[10]&&t[10].length?R&&(R.d(1),R=null):R?R.p(t,i):(R=Ht(t),R.c(),R.m(b,null))},i(t){if(!w){N(T);for(let t=0;t<j.length;t+=1)N($[t]);w=!0}},o(t){O(T);for(let t=0;t<$.length;t+=1)O($[t]);w=!1},d(t){t&&s(e),T&&T.d(),a(L,t),S&&S.d(),C&&C.d(),A&&A.d(),q&&q.d();for(let t=0;t<$.length;t+=1)$[t].d();R&&R.d()}}}function Pt(t,e,n){let{variations:i}=e,{textVars:r}=e,{activeColumns:l}=e,{showAttributes:o}=e,{showFilters:c}=e,{attributes:s}=e,{sortKey:a}=e,{imageURL:u}=e,{showSpinner:m}=e,d=[],f=[],p="";var h;h=async()=>{for(let t=0;t<Object.keys(s).length;t++)f.push("")},w().$$.on_mount.push(h);let g={},_=[{key:"image_link",title:"",type:"image"},{key:"sku",title:r.columnsText.sku,type:"text"},{key:"variation_description",title:r.columnsText.variation_description,type:"html"},{key:"weight_html",title:r.columnsText.weight_html,type:"text"},{key:"dimensions",title:r.columnsText.dimensions,type:"text"}];function y(){let t=1;return _.forEach(e=>{l[e.key]&&t++}),"on"===l.stock&&t++,"on"===l.price_html&&t++,"on"===l.quantity&&t++,o&&(t+=s.length),t}let v=y();function b(t){"image_link"!==t&&(n(1,a=t),void 0===g[t]?n(9,g[t]=1,g):n(9,g[t]=-1*g[t],g),n(10,x=$()))}function k(t){var e=0;for(let n=0;n<d.length;n++){let i=Object.keys(d[n])[0];if(!t.attributes[i])return!1;t.attributes[i]===d[n][i]&&e++}return e===d.length}function $(){let t=p&&p.toLowerCase(),e=g[a]||1,n=i;return t&&(n=i.filter((function(e){return Object.keys(e).some((function(n){return String(e[n]).toLowerCase().indexOf(t)>-1}))}))),d&&d.length&&(n=n.filter(k)),a&&(n=n.slice().sort((function(t,n){return a.startsWith("attribute_")?(t=t.attributes[a],n=n.attributes[a]):(t=t[a],n=n[a]),(t===n?0:t>n?1:-1)*e}))),n}let x=$();return t.$set=t=>{"variations"in t&&n(16,i=t.variations),"textVars"in t&&n(2,r=t.textVars),"activeColumns"in t&&n(0,l=t.activeColumns),"showAttributes"in t&&n(3,o=t.showAttributes),"showFilters"in t&&n(4,c=t.showFilters),"attributes"in t&&n(5,s=t.attributes),"sortKey"in t&&n(1,a=t.sortKey),"imageURL"in t&&n(6,u=t.imageURL),"showSpinner"in t&&n(7,m=t.showSpinner)},[l,a,r,o,c,s,u,m,p,g,x,f,_,v,b,function(t){d=t.detail,n(10,x=$())},i,d,y,k,$,function(t){p=t,n(8,p)},t=>b(t.key),t=>b("attribute_"+t.key),()=>b("availability_html"),()=>b("price_html"),function(t){l=t,n(0,l)}]}return new class extends W{constructor(t){super(),B(this,t,Pt,It,l,{variations:16,textVars:2,activeColumns:0,showAttributes:3,showFilters:4,attributes:5,sortKey:1,imageURL:6,showSpinner:7},[-1,-1])}}({target:document.getElementById("woo-variations-table-component"),props:{variations:wooVariationsTableData.variations,attributes:wooVariationsTableData.attributes,showAttributes:wooVariationsTableData.showAttributes,showFilters:wooVariationsTableData.showFilters,activeColumns:wooVariationsTableData.activeColumns,imageURL:wooVariationsTableData.imageURL,showSpinner:wooVariationsTableData.showSpinner,textVars:wooVariationsTableData.textVars}})}();
//# sourceMappingURL=woo-variations-table-app.js.map
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder