@perevorot/shop 1.1.4 → 1.1.6

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.
@@ -1,2 +1,2 @@
1
- "use strict";var e=require("vue"),t=e.defineComponent({setup:function(){var t=e.ref(!1),n=e.ref(!0),o=e.ref([]),a=[],r={},i=!1,c=!1,l={},u=function(e){var t=e.substring(e.lastIndexOf("/")+1);return"page-product-"+(t.match(/^page([0-9]+)$/)?t:"page1")},s=[u(window.location.href)],d=function(e){e.preventDefault(),s=[u(e.currentTarget.href)],p(e.currentTarget)},p=function(n,c){var s=n.href,d=u(s);if(i||(window.app.component("products-paginate",{data:function(){return{components:o}},template:'<teleport to="#products"><component :is="component" v-for="(component, key) in components" v-bind:key="key"></component></teleport>'}),t.value="products-paginate",i=!0),-1===a.indexOf(d))n.classList.add("is-loading"),$http.get(s+"?paginator").then((function(t){f(c);var n=document.createElement("html");n.innerHTML=t.data.products;var i=t.data.h1;if(i){var u=document.querySelector(".shop-subcategory-title h1");u&&(u.innerHTML=i)}window.app.component(d,{template:n.querySelector("#products").innerHTML}),l[d]=i,a.push(d),history.pushState({urlPath:s},document.title,s),n.innerHTML=t.data.paginator,r[d]=t.data.paginator,document.getElementById("pagination").replaceWith(n.querySelector("#pagination")),c?(o.value.push(d),m()):(o.value=[d],window.scrollTo({top:0,left:0,behavior:"smooth"})),window.lazyImages&&window.lazyImages.update(),e.nextTick((function(){"function"==typeof window.loadProductsCallback&&window.loadProductsCallback()})),e.nextTick(h)}));else{history.pushState({urlPath:s},document.title,s);var p=document.createElement("html");if(p.innerHTML=r[d],document.getElementById("pagination").replaceWith(p.querySelector("#pagination")),c)o.value.push(d),m();else{if(o.value=[d],l[d]){var g=document.querySelector(".shop-subcategory-title h1");g&&(g.innerHTML=l[d])}window.scrollTo({top:0,left:0,behavior:"smooth"})}e.nextTick((function(){"function"==typeof window.loadProductsCallback&&window.loadProductsCallback()})),e.nextTick(h)}},m=function(){var e=document.getElementById("pagination");s.forEach((function(t){var n=e.querySelector("."+t);n&&n.classList.add("is-current")}))},f=function(e){e||c||(document.querySelectorAll("#products > *").forEach((function(e){e.remove()})),c=!0)},h=function(){var e=document.querySelector("#pagination .pagination-next:not([disabled])");document.querySelectorAll("#pagination a:not([disabled])").forEach((function(e){e.addEventListener("click",d)})),n.value=Boolean(e),window.lazyImages&&window.lazyImages.update()};return e.onMounted((function(){h()})),{component:t,hasMorePages:n,more:function(){var e=document.querySelector("#pagination .pagination-next:not([disabled])"),t=u(e.href);s.push(t),p(e,!0)}}}}),n={class:"shop-pagination has-text-centered mb-3"},o={key:0,class:"shop-pagination-more"},a=e.createElementVNode("span",{class:"icon is-small"},[e.createElementVNode("i",{class:"fas fa-sync-alt"})],-1);t.render=function(t,r,i,c,l,u){return e.openBlock(),e.createElementBlock("div",n,[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(t.component))),t.hasMorePages?(e.openBlock(),e.createElementBlock("div",o,[e.renderSlot(t.$slots,"default",{more:t.more},(function(){return[e.createElementVNode("button",{class:"button is-small",onClick:r[0]||(r[0]=function(){return t.more&&t.more.apply(t,arguments)})},[a,e.createElementVNode("span",null,e.toDisplayString(t.__("shop.pagination.more")),1)])]}))])):e.createCommentVNode("v-if",!0)])},module.exports=t;
1
+ "use strict";var e=require("vue"),t=e.defineComponent({setup:function(){var t=e.ref(!1),n=e.ref(!0),o=e.ref([]),a=[],r={},i=!1,c=!1,l={},u={},s=function(e){var t=e.substring(e.lastIndexOf("/")+1);return"page-product-"+(t.match(/^page([0-9]+)$/)?t:"page1")},d=[s(window.location.href)],p=function(e){e.preventDefault(),d=[s(e.currentTarget.href)],m(e.currentTarget)},m=function(n,c){var d=n.href,p=s(d);if(i||(window.app.component("products-paginate",{data:function(){return{components:o}},template:'<teleport to="#products"><component :is="component" v-for="(component, key) in components" v-bind:key="key"></component></teleport>'}),t.value="products-paginate",i=!0),-1===a.indexOf(p))n.classList.add("is-loading"),$http.get(d+"?paginator").then((function(t){g(c);var n=document.createElement("html");n.innerHTML=t.data.products;var i=t.data.h1;if(i){var s=document.querySelector(".shop-subcategory-title h1");s&&(s.innerHTML=i)}window.app.component(p,{template:n.querySelector("#products").innerHTML});var m=t.data.title;u[p]=m,l[p]=i,a.push(p),n.innerHTML=t.data.paginator,r[p]=t.data.paginator,document.getElementById("pagination").replaceWith(n.querySelector("#pagination")),c?(o.value.push(p),f()):(o.value=[p],window.scrollTo({top:0,left:0,behavior:"instant"})),setTimeout((function(){document.title=m||i,history.pushState(null,m,d),e.nextTick((function(){"function"==typeof window.loadProductsCallback&&window.loadProductsCallback()}))}),200),window.lazyImages&&window.lazyImages.update(),e.nextTick(h)}));else{var m=document.createElement("html");if(m.innerHTML=r[p],document.getElementById("pagination").replaceWith(m.querySelector("#pagination")),c)o.value.push(p),f();else{if(o.value=[p],l[p]){var v=document.querySelector(".shop-subcategory-title h1");v&&(v.innerHTML=l[p])}window.scrollTo({top:0,left:0,behavior:"instant"})}setTimeout((function(){document.title=u[p],history.pushState(null,u[p],d),e.nextTick((function(){"function"==typeof window.loadProductsCallback&&window.loadProductsCallback()}))}),200),e.nextTick(h)}},f=function(){var e=document.getElementById("pagination");d.forEach((function(t){var n=e.querySelector("."+t);n&&n.classList.add("is-current")}))},g=function(e){e||c||(document.querySelectorAll("#products > *").forEach((function(e){e.remove()})),c=!0)},h=function(){var e=document.querySelector("#pagination .pagination-next:not([disabled])");document.querySelectorAll("#pagination a:not([disabled])").forEach((function(e){e.addEventListener("click",p)})),n.value=Boolean(e),window.lazyImages&&window.lazyImages.update()};return e.onMounted((function(){h()})),{component:t,hasMorePages:n,more:function(){var e=document.querySelector("#pagination .pagination-next:not([disabled])"),t=s(e.href);d.push(t),m(e,!0)}}}}),n={class:"shop-pagination has-text-centered mb-3"},o={key:0,class:"shop-pagination-more"},a=e.createElementVNode("span",{class:"icon is-small"},[e.createElementVNode("i",{class:"fas fa-sync-alt"})],-1);t.render=function(t,r,i,c,l,u){return e.openBlock(),e.createElementBlock("div",n,[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(t.component))),t.hasMorePages?(e.openBlock(),e.createElementBlock("div",o,[e.renderSlot(t.$slots,"default",{more:t.more},(function(){return[e.createElementVNode("button",{class:"button is-small",onClick:r[0]||(r[0]=function(){return t.more&&t.more.apply(t,arguments)})},[a,e.createElementVNode("span",null,e.toDisplayString(t.__("shop.pagination.more")),1)])]}))])):e.createCommentVNode("v-if",!0)])},module.exports=t;
2
2
  //# sourceMappingURL=Pagination.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Pagination.js","sources":["../../../../src/js/components/shop/Pagination.vue","../../../../src/js/components/shop/Pagination.vue?vue&type=template&id=79193d05&lang.js"],"sourcesContent":["<template>\n <div class=\"shop-pagination has-text-centered mb-3\">\n <component :is=\"component\"></component>\n <div class=\"shop-pagination-more\" v-if=\"hasMorePages\">\n <slot :more=\"more\">\n <button class=\"button is-small\" @click=\"more\">\n <span class=\"icon is-small\">\n <i class=\"fas fa-sync-alt\"></i>\n </span>\n <span>{{ __('shop.pagination.more') }}</span>\n </button>\n </slot>\n </div>\n </div>\n</template>\n<script>\nimport { ref, onMounted, defineComponent, nextTick } from 'vue';\n\nexport default defineComponent({\n setup() {\n const component = ref(false);\n const hasMorePages = ref(true);\n const visiblePages = ref([]);\n\n let pages = [];\n let paginators = {};\n let inited = false;\n let cleared = false;\n let titles = {};\n\n const getComponentName = (href) => {\n const last = href.substring(href.lastIndexOf('/') + 1);\n\n return 'page-product-' + (last.match(/^page([0-9]+)$/) ? last : 'page1');\n };\n\n let nextPages = [getComponentName(window.location.href)];\n\n const get = (e) => {\n e.preventDefault();\n\n nextPages = [getComponentName(e.currentTarget.href)];\n\n load(e.currentTarget);\n };\n\n const load = (button, isAppend) => {\n const href = button.href;\n\n const componentName = getComponentName(href);\n\n if (!inited) {\n window.app.component('products-paginate', {\n data() {\n return {\n components: visiblePages\n };\n },\n template: '<teleport to=\"#products\"><component :is=\"component\" v-for=\"(component, key) in components\" v-bind:key=\"key\"></component></teleport>'\n });\n\n component.value = 'products-paginate';\n inited = true;\n }\n\n if (pages.indexOf(componentName) === -1) {\n button.classList.add('is-loading');\n\n $http.get(href + '?paginator').then((response) => {\n clearInitial(isAppend);\n\n let html = document.createElement('html');\n\n html.innerHTML = response.data.products;\n\n const title = response.data.h1;\n\n if (title) {\n const titleElement = document.querySelector('.shop-subcategory-title h1');\n\n if (titleElement) {\n titleElement.innerHTML = title;\n }\n }\n\n window.app.component(componentName, {\n template: html.querySelector('#products').innerHTML\n });\n\n titles[componentName] = title;\n\n pages.push(componentName);\n\n history.pushState({ urlPath: href }, document.title, href);\n html.innerHTML = response.data.paginator;\n\n paginators[componentName] = response.data.paginator;\n\n document.getElementById('pagination').replaceWith(html.querySelector('#pagination'));\n\n if (!isAppend) {\n visiblePages.value = [componentName];\n\n window.scrollTo({\n top: 0,\n left: 0,\n behavior: 'smooth'\n });\n } else {\n visiblePages.value.push(componentName);\n setPaginatorCurrentPages(null, 'Pagination');\n }\n\n if (window.lazyImages) {\n window.lazyImages.update();\n }\n\n nextTick(() => {\n if (typeof window.loadProductsCallback == 'function') {\n window.loadProductsCallback();\n }\n });\n\n nextTick(init);\n });\n } else {\n history.pushState({ urlPath: href }, document.title, href);\n\n let html = document.createElement('html');\n html.innerHTML = paginators[componentName];\n\n document.getElementById('pagination').replaceWith(html.querySelector('#pagination'));\n\n if (!isAppend) {\n visiblePages.value = [componentName];\n\n if (titles[componentName]) {\n const titleElement = document.querySelector('.shop-subcategory-title h1');\n\n if (titleElement) {\n titleElement.innerHTML = titles[componentName];\n }\n }\n\n window.scrollTo({\n top: 0,\n left: 0,\n behavior: 'smooth'\n });\n } else {\n visiblePages.value.push(componentName);\n setPaginatorCurrentPages(null, 'Pagination');\n }\n\n nextTick(() => {\n if (typeof window.loadProductsCallback == 'function') {\n window.loadProductsCallback();\n }\n });\n\n nextTick(init);\n }\n };\n\n const setPaginatorCurrentPages = () => {\n const paginator = document.getElementById('pagination');\n\n nextPages.forEach((componentName) => {\n const link = paginator.querySelector('.' + componentName);\n\n if (link) {\n link.classList.add('is-current');\n }\n });\n };\n\n const clearInitial = (isAppend) => {\n if (!isAppend && !cleared) {\n let productsOld = document.querySelectorAll('#products > *');\n\n productsOld.forEach((product) => {\n product.remove();\n });\n\n cleared = true;\n }\n };\n\n const init = () => {\n const next = document.querySelector('#pagination .pagination-next:not([disabled])');\n\n const links = document.querySelectorAll('#pagination a:not([disabled])');\n\n links.forEach((link) => {\n link.addEventListener('click', get);\n });\n\n hasMorePages.value = Boolean(next);\n\n if (window.lazyImages) {\n window.lazyImages.update();\n }\n };\n\n const more = () => {\n const next = document.querySelector('#pagination .pagination-next:not([disabled])');\n\n const componentName = getComponentName(next.href);\n\n nextPages.push(componentName);\n\n load(next, true);\n };\n\n onMounted(() => {\n init();\n });\n\n return {\n component,\n hasMorePages,\n more\n };\n }\n});\n</script>","<template>\n <div class=\"shop-pagination has-text-centered mb-3\">\n <component :is=\"component\"></component>\n <div class=\"shop-pagination-more\" v-if=\"hasMorePages\">\n <slot :more=\"more\">\n <button class=\"button is-small\" @click=\"more\">\n <span class=\"icon is-small\">\n <i class=\"fas fa-sync-alt\"></i>\n </span>\n <span>{{ __('shop.pagination.more') }}</span>\n </button>\n </slot>\n </div>\n </div>\n</template>\n<script>\nimport { ref, onMounted, defineComponent, nextTick } from 'vue';\n\nexport default defineComponent({\n setup() {\n const component = ref(false);\n const hasMorePages = ref(true);\n const visiblePages = ref([]);\n\n let pages = [];\n let paginators = {};\n let inited = false;\n let cleared = false;\n let titles = {};\n\n const getComponentName = (href) => {\n const last = href.substring(href.lastIndexOf('/') + 1);\n\n return 'page-product-' + (last.match(/^page([0-9]+)$/) ? last : 'page1');\n };\n\n let nextPages = [getComponentName(window.location.href)];\n\n const get = (e) => {\n e.preventDefault();\n\n nextPages = [getComponentName(e.currentTarget.href)];\n\n load(e.currentTarget);\n };\n\n const load = (button, isAppend) => {\n const href = button.href;\n\n const componentName = getComponentName(href);\n\n if (!inited) {\n window.app.component('products-paginate', {\n data() {\n return {\n components: visiblePages\n };\n },\n template: '<teleport to=\"#products\"><component :is=\"component\" v-for=\"(component, key) in components\" v-bind:key=\"key\"></component></teleport>'\n });\n\n component.value = 'products-paginate';\n inited = true;\n }\n\n if (pages.indexOf(componentName) === -1) {\n button.classList.add('is-loading');\n\n $http.get(href + '?paginator').then((response) => {\n clearInitial(isAppend);\n\n let html = document.createElement('html');\n\n html.innerHTML = response.data.products;\n\n const title = response.data.h1;\n\n if (title) {\n const titleElement = document.querySelector('.shop-subcategory-title h1');\n\n if (titleElement) {\n titleElement.innerHTML = title;\n }\n }\n\n window.app.component(componentName, {\n template: html.querySelector('#products').innerHTML\n });\n\n titles[componentName] = title;\n\n pages.push(componentName);\n\n history.pushState({ urlPath: href }, document.title, href);\n html.innerHTML = response.data.paginator;\n\n paginators[componentName] = response.data.paginator;\n\n document.getElementById('pagination').replaceWith(html.querySelector('#pagination'));\n\n if (!isAppend) {\n visiblePages.value = [componentName];\n\n window.scrollTo({\n top: 0,\n left: 0,\n behavior: 'smooth'\n });\n } else {\n visiblePages.value.push(componentName);\n setPaginatorCurrentPages(null, 'Pagination');\n }\n\n if (window.lazyImages) {\n window.lazyImages.update();\n }\n\n nextTick(() => {\n if (typeof window.loadProductsCallback == 'function') {\n window.loadProductsCallback();\n }\n });\n\n nextTick(init);\n });\n } else {\n history.pushState({ urlPath: href }, document.title, href);\n\n let html = document.createElement('html');\n html.innerHTML = paginators[componentName];\n\n document.getElementById('pagination').replaceWith(html.querySelector('#pagination'));\n\n if (!isAppend) {\n visiblePages.value = [componentName];\n\n if (titles[componentName]) {\n const titleElement = document.querySelector('.shop-subcategory-title h1');\n\n if (titleElement) {\n titleElement.innerHTML = titles[componentName];\n }\n }\n\n window.scrollTo({\n top: 0,\n left: 0,\n behavior: 'smooth'\n });\n } else {\n visiblePages.value.push(componentName);\n setPaginatorCurrentPages(null, 'Pagination');\n }\n\n nextTick(() => {\n if (typeof window.loadProductsCallback == 'function') {\n window.loadProductsCallback();\n }\n });\n\n nextTick(init);\n }\n };\n\n const setPaginatorCurrentPages = () => {\n const paginator = document.getElementById('pagination');\n\n nextPages.forEach((componentName) => {\n const link = paginator.querySelector('.' + componentName);\n\n if (link) {\n link.classList.add('is-current');\n }\n });\n };\n\n const clearInitial = (isAppend) => {\n if (!isAppend && !cleared) {\n let productsOld = document.querySelectorAll('#products > *');\n\n productsOld.forEach((product) => {\n product.remove();\n });\n\n cleared = true;\n }\n };\n\n const init = () => {\n const next = document.querySelector('#pagination .pagination-next:not([disabled])');\n\n const links = document.querySelectorAll('#pagination a:not([disabled])');\n\n links.forEach((link) => {\n link.addEventListener('click', get);\n });\n\n hasMorePages.value = Boolean(next);\n\n if (window.lazyImages) {\n window.lazyImages.update();\n }\n };\n\n const more = () => {\n const next = document.querySelector('#pagination .pagination-next:not([disabled])');\n\n const componentName = getComponentName(next.href);\n\n nextPages.push(componentName);\n\n load(next, true);\n };\n\n onMounted(() => {\n init();\n });\n\n return {\n component,\n hasMorePages,\n more\n };\n }\n});\n</script>"],"names":["defineComponent","setup","component","ref","hasMorePages","visiblePages","pages","paginators","inited","cleared","titles","getComponentName","href","last","substring","lastIndexOf","match","nextPages","window","location","get","e","preventDefault","currentTarget","load","button","isAppend","componentName","app","data","components","template","value","indexOf","classList","add","$http","then","response","clearInitial","html","document","createElement","innerHTML","products","title","h1","titleElement","querySelector","push","history","pushState","urlPath","paginator","getElementById","replaceWith","setPaginatorCurrentPages","scrollTo","top","left","behavior","lazyImages","update","nextTick","loadProductsCallback","init","forEach","link","querySelectorAll","product","remove","next","addEventListener","Boolean","onMounted","more","class","_createElementVNode","_createElementBlock","_hoisted_1","_createBlock","_ctx","_hoisted_2","_renderSlot","onClick","_hoisted_3"],"mappings":"oCAkBeA,kBAAgB,CAC3BC,qBACUC,EAAYC,OAAI,GAChBC,EAAeD,OAAI,GACnBE,EAAeF,MAAI,IAErBG,EAAQ,GACRC,EAAa,GACbC,GAAS,E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DAEFA,MAAM,0BAGCC,6BAAMD,MAAM,kBACRC,0BAAGD,MAAM,6EAN7BE,2BAAAC,kBACIC,wCAAgBC,eACwBA,8BAAxCH,2BAAAI,GACIC,iCAAOR,KAAMM,SAAb,kBACIJ,+BAAQD,MAAM,kBAAmBQ,sCAAOH,sCACpCI,EAGAR,mDAASI"}
1
+ {"version":3,"file":"Pagination.js","sources":["../../../../src/js/components/shop/Pagination.vue","../../../../src/js/components/shop/Pagination.vue?vue&type=template&id=7e50a684&lang.js"],"sourcesContent":["<template>\n <div class=\"shop-pagination has-text-centered mb-3\">\n <component :is=\"component\"></component>\n <div class=\"shop-pagination-more\" v-if=\"hasMorePages\">\n <slot :more=\"more\">\n <button class=\"button is-small\" @click=\"more\">\n <span class=\"icon is-small\">\n <i class=\"fas fa-sync-alt\"></i>\n </span>\n <span>{{ __('shop.pagination.more') }}</span>\n </button>\n </slot>\n </div>\n </div>\n</template>\n<script>\nimport { ref, onMounted, defineComponent, nextTick } from 'vue';\n\nexport default defineComponent({\n setup() {\n const component = ref(false);\n const hasMorePages = ref(true);\n const visiblePages = ref([]);\n\n let pages = [];\n let paginators = {};\n let inited = false;\n let cleared = false;\n let titles = {};\n let titlesDocument = {};\n\n const getComponentName = (href) => {\n const last = href.substring(href.lastIndexOf('/') + 1);\n\n return 'page-product-' + (last.match(/^page([0-9]+)$/) ? last : 'page1');\n };\n\n let nextPages = [getComponentName(window.location.href)];\n\n const get = (e) => {\n e.preventDefault();\n\n nextPages = [getComponentName(e.currentTarget.href)];\n\n load(e.currentTarget);\n };\n\n const load = (button, isAppend) => {\n const href = button.href;\n\n const componentName = getComponentName(href);\n\n if (!inited) {\n window.app.component('products-paginate', {\n data() {\n return {\n components: visiblePages\n };\n },\n template: '<teleport to=\"#products\"><component :is=\"component\" v-for=\"(component, key) in components\" v-bind:key=\"key\"></component></teleport>'\n });\n\n component.value = 'products-paginate';\n inited = true;\n }\n\n if (pages.indexOf(componentName) === -1) {\n button.classList.add('is-loading');\n\n $http.get(href + '?paginator').then((response) => {\n clearInitial(isAppend);\n\n let html = document.createElement('html');\n\n html.innerHTML = response.data.products;\n\n const title = response.data.h1;\n\n if (title) {\n const titleElement = document.querySelector('.shop-subcategory-title h1');\n\n if (titleElement) {\n titleElement.innerHTML = title;\n }\n }\n\n window.app.component(componentName, {\n template: html.querySelector('#products').innerHTML\n });\n\n const documentTitle = response.data.title;\n\n titlesDocument[componentName] = documentTitle;\n titles[componentName] = title;\n\n pages.push(componentName);\n\n html.innerHTML = response.data.paginator;\n\n paginators[componentName] = response.data.paginator;\n\n document.getElementById('pagination').replaceWith(html.querySelector('#pagination'));\n\n if (!isAppend) {\n visiblePages.value = [componentName];\n\n window.scrollTo({\n top: 0,\n left: 0,\n behavior: 'instant'\n });\n } else {\n visiblePages.value.push(componentName);\n setPaginatorCurrentPages(null, 'Pagination');\n }\n\n setTimeout(() => {\n document.title = documentTitle ? documentTitle : title;\n\n history.pushState(null, documentTitle, href);\n //history.pushState({ urlPath: href }, documentTitle, href);\n\n nextTick(() => {\n if (typeof window.loadProductsCallback == 'function') {\n window.loadProductsCallback();\n }\n });\n }, 200)\n\n if (window.lazyImages) {\n window.lazyImages.update();\n }\n\n nextTick(init);\n });\n } else {\n let html = document.createElement('html');\n html.innerHTML = paginators[componentName];\n\n document.getElementById('pagination').replaceWith(html.querySelector('#pagination'));\n\n if (!isAppend) {\n visiblePages.value = [componentName];\n\n if (titles[componentName]) {\n const titleElement = document.querySelector('.shop-subcategory-title h1');\n\n if (titleElement) {\n titleElement.innerHTML = titles[componentName];\n }\n }\n\n window.scrollTo({\n top: 0,\n left: 0,\n behavior: 'instant'\n });\n } else {\n visiblePages.value.push(componentName);\n setPaginatorCurrentPages(null, 'Pagination');\n }\n\n setTimeout(() => {\n document.title = titlesDocument[componentName];\n\n //history.pushState({ urlPath: href }, titlesDocument[componentName], href);\n history.pushState(null, titlesDocument[componentName], href);\n\n nextTick(() => {\n if (typeof window.loadProductsCallback == 'function') {\n window.loadProductsCallback();\n }\n });\n }, 200);\n\n nextTick(init);\n }\n };\n\n const setPaginatorCurrentPages = () => {\n const paginator = document.getElementById('pagination');\n\n nextPages.forEach((componentName) => {\n const link = paginator.querySelector('.' + componentName);\n\n if (link) {\n link.classList.add('is-current');\n }\n });\n };\n\n const clearInitial = (isAppend) => {\n if (!isAppend && !cleared) {\n let productsOld = document.querySelectorAll('#products > *');\n\n productsOld.forEach((product) => {\n product.remove();\n });\n\n cleared = true;\n }\n };\n\n const init = () => {\n const next = document.querySelector('#pagination .pagination-next:not([disabled])');\n\n const links = document.querySelectorAll('#pagination a:not([disabled])');\n\n links.forEach((link) => {\n link.addEventListener('click', get);\n });\n\n hasMorePages.value = Boolean(next);\n\n if (window.lazyImages) {\n window.lazyImages.update();\n }\n };\n\n const more = () => {\n const next = document.querySelector('#pagination .pagination-next:not([disabled])');\n\n const componentName = getComponentName(next.href);\n\n nextPages.push(componentName);\n\n load(next, true);\n };\n\n onMounted(() => {\n init();\n });\n\n return {\n component,\n hasMorePages,\n more\n };\n }\n});\n</script>","<template>\n <div class=\"shop-pagination has-text-centered mb-3\">\n <component :is=\"component\"></component>\n <div class=\"shop-pagination-more\" v-if=\"hasMorePages\">\n <slot :more=\"more\">\n <button class=\"button is-small\" @click=\"more\">\n <span class=\"icon is-small\">\n <i class=\"fas fa-sync-alt\"></i>\n </span>\n <span>{{ __('shop.pagination.more') }}</span>\n </button>\n </slot>\n </div>\n </div>\n</template>\n<script>\nimport { ref, onMounted, defineComponent, nextTick } from 'vue';\n\nexport default defineComponent({\n setup() {\n const component = ref(false);\n const hasMorePages = ref(true);\n const visiblePages = ref([]);\n\n let pages = [];\n let paginators = {};\n let inited = false;\n let cleared = false;\n let titles = {};\n let titlesDocument = {};\n\n const getComponentName = (href) => {\n const last = href.substring(href.lastIndexOf('/') + 1);\n\n return 'page-product-' + (last.match(/^page([0-9]+)$/) ? last : 'page1');\n };\n\n let nextPages = [getComponentName(window.location.href)];\n\n const get = (e) => {\n e.preventDefault();\n\n nextPages = [getComponentName(e.currentTarget.href)];\n\n load(e.currentTarget);\n };\n\n const load = (button, isAppend) => {\n const href = button.href;\n\n const componentName = getComponentName(href);\n\n if (!inited) {\n window.app.component('products-paginate', {\n data() {\n return {\n components: visiblePages\n };\n },\n template: '<teleport to=\"#products\"><component :is=\"component\" v-for=\"(component, key) in components\" v-bind:key=\"key\"></component></teleport>'\n });\n\n component.value = 'products-paginate';\n inited = true;\n }\n\n if (pages.indexOf(componentName) === -1) {\n button.classList.add('is-loading');\n\n $http.get(href + '?paginator').then((response) => {\n clearInitial(isAppend);\n\n let html = document.createElement('html');\n\n html.innerHTML = response.data.products;\n\n const title = response.data.h1;\n\n if (title) {\n const titleElement = document.querySelector('.shop-subcategory-title h1');\n\n if (titleElement) {\n titleElement.innerHTML = title;\n }\n }\n\n window.app.component(componentName, {\n template: html.querySelector('#products').innerHTML\n });\n\n const documentTitle = response.data.title;\n\n titlesDocument[componentName] = documentTitle;\n titles[componentName] = title;\n\n pages.push(componentName);\n\n html.innerHTML = response.data.paginator;\n\n paginators[componentName] = response.data.paginator;\n\n document.getElementById('pagination').replaceWith(html.querySelector('#pagination'));\n\n if (!isAppend) {\n visiblePages.value = [componentName];\n\n window.scrollTo({\n top: 0,\n left: 0,\n behavior: 'instant'\n });\n } else {\n visiblePages.value.push(componentName);\n setPaginatorCurrentPages(null, 'Pagination');\n }\n\n setTimeout(() => {\n document.title = documentTitle ? documentTitle : title;\n\n history.pushState(null, documentTitle, href);\n //history.pushState({ urlPath: href }, documentTitle, href);\n\n nextTick(() => {\n if (typeof window.loadProductsCallback == 'function') {\n window.loadProductsCallback();\n }\n });\n }, 200)\n\n if (window.lazyImages) {\n window.lazyImages.update();\n }\n\n nextTick(init);\n });\n } else {\n let html = document.createElement('html');\n html.innerHTML = paginators[componentName];\n\n document.getElementById('pagination').replaceWith(html.querySelector('#pagination'));\n\n if (!isAppend) {\n visiblePages.value = [componentName];\n\n if (titles[componentName]) {\n const titleElement = document.querySelector('.shop-subcategory-title h1');\n\n if (titleElement) {\n titleElement.innerHTML = titles[componentName];\n }\n }\n\n window.scrollTo({\n top: 0,\n left: 0,\n behavior: 'instant'\n });\n } else {\n visiblePages.value.push(componentName);\n setPaginatorCurrentPages(null, 'Pagination');\n }\n\n setTimeout(() => {\n document.title = titlesDocument[componentName];\n\n //history.pushState({ urlPath: href }, titlesDocument[componentName], href);\n history.pushState(null, titlesDocument[componentName], href);\n\n nextTick(() => {\n if (typeof window.loadProductsCallback == 'function') {\n window.loadProductsCallback();\n }\n });\n }, 200);\n\n nextTick(init);\n }\n };\n\n const setPaginatorCurrentPages = () => {\n const paginator = document.getElementById('pagination');\n\n nextPages.forEach((componentName) => {\n const link = paginator.querySelector('.' + componentName);\n\n if (link) {\n link.classList.add('is-current');\n }\n });\n };\n\n const clearInitial = (isAppend) => {\n if (!isAppend && !cleared) {\n let productsOld = document.querySelectorAll('#products > *');\n\n productsOld.forEach((product) => {\n product.remove();\n });\n\n cleared = true;\n }\n };\n\n const init = () => {\n const next = document.querySelector('#pagination .pagination-next:not([disabled])');\n\n const links = document.querySelectorAll('#pagination a:not([disabled])');\n\n links.forEach((link) => {\n link.addEventListener('click', get);\n });\n\n hasMorePages.value = Boolean(next);\n\n if (window.lazyImages) {\n window.lazyImages.update();\n }\n };\n\n const more = () => {\n const next = document.querySelector('#pagination .pagination-next:not([disabled])');\n\n const componentName = getComponentName(next.href);\n\n nextPages.push(componentName);\n\n load(next, true);\n };\n\n onMounted(() => {\n init();\n });\n\n return {\n component,\n hasMorePages,\n more\n };\n }\n});\n</script>"],"names":["defineComponent","setup","component","ref","hasMorePages","visiblePages","pages","paginators","inited","cleared","titles","titlesDocument","getComponentName","href","last","substring","lastIndexOf","match","nextPages","window","location","get","e","preventDefault","currentTarget","load","button","isAppend","componentName","app","data","components","template","value","indexOf","classList","add","$http","then","response","clearInitial","html","document","createElement","innerHTML","products","title","h1","titleElement","querySelector","documentTitle","push","paginator","getElementById","replaceWith","setPaginatorCurrentPages","scrollTo","top","left","behavior","setTimeout","history","pushState","nextTick","loadProductsCallback","lazyImages","update","init","forEach","link","querySelectorAll","product","remove","next","addEventListener","Boolean","onMounted","more","class","_createElementVNode","_createElementBlock","_hoisted_1","_createBlock","_ctx","_hoisted_2","_renderSlot","onClick","_hoisted_3"],"mappings":"oCAkBeA,kBAAgB,CAC3BC,qBACUC,EAAYC,OAAI,GAChBC,EAAeD,OAAI,GACnBE,EAAeF,MAAI,IAErBG,EAAQ,GACRC,EAAa,GACbC,GAAS,EACTC,GAAU,EACVC,EAAS,GACTC,EAAiB,GAEfC,EAAmB,SAACC,OAChBC,EAAOD,EAAKE,UAAUF,EAAKG,YAAY,KAAO,SAE7C,iBAAmBF,EAAKG,MAAM,kBAAoBH,EAAO,UAGhEI,EAAY,CAACN,EAAiBO,OAAOC,SAASP,OAE5CQ,EAAM,SAACC,GACTA,EAAEC,iBAEFL,EAAY,CAACN,EAAiBU,EAAEE,cAAcX,OAE9CY,EAAKH,EAAEE,gBAGLC,EAAO,SAACC,EAAQC,OACZd,EAAOa,EAAOb,KAEde,EAAgBhB,EAAiBC,MAElCL,IACDW,OAAOU,IAAI3B,UAAU,oBAAqB,CACtC4B,sBACW,CACHC,WAAY1B,IAGpB2B,SAAU,wIAGd9B,EAAU+B,MAAQ,oBAClBzB,GAAS,IAGyB,IAAlCF,EAAM4B,QAAQN,GACdF,EAAOS,UAAUC,IAAI,cAErBC,MAAMhB,IAAIR,EAAO,cAAcyB,MAAK,SAACC,GACjCC,EAAab,OAETc,EAAOC,SAASC,cAAc,QAElCF,EAAKG,UAAYL,EAAST,KAAKe,aAEzBC,EAAQP,EAAST,KAAKiB,MAExBD,EAAO,KACDE,EAAeN,SAASO,cAAc,8BAExCD,IACAA,EAAaJ,UAAYE,GAIjC3B,OAAOU,IAAI3B,UAAU0B,EAAe,CAChCI,SAAUS,EAAKQ,cAAc,aAAaL,gBAGxCM,EAAgBX,EAAST,KAAKgB,MAEpCnC,EAAeiB,GAA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AalB,IACIiC,SAAS4B,iBAAiB,iBAEhCF,SAAQ,SAACG,GACjBA,EAAQC,YAGZ/D,GAAU,IAIZ0D,EAAO,eACHM,EAAO/B,SAASO,cAAc,gDAEtBP,SAAS4B,iBAAiB,iCAElCF,SAAQ,SAACC,GACXA,EAAKK,iBAAiB,QAASrD,MAGnCjB,EAAa6B,MAAQ0C,QAAQF,GAEzBtD,OAAO8C,YACP9C,OAAO8C,WAAWC,iBAc1BU,aAAU,WACNT,OAGG,CACHjE,UAAAA,EACAE,aAAAA,EACAyE,KAjBS,eACHJ,EAAO/B,SAASO,cAAc,gDAE9BrB,EAAgBhB,EAAiB6D,EAAK5D,MAE5CK,EAAUiC,KAAKvB,GAEfH,EAAKgD,GAAM,WCjOdK,MAAM,mDAEFA,MAAM,0BAGCC,6BAAMD,MAAM,kBACRC,0BAAGD,MAAM,6EAN7BE,2BAAAC,kBACIC,wCAAgBC,eACwBA,8BAAxCH,2BAAAI,GACIC,iCAAOR,KAAMM,SAAb,kBACIJ,+BAAQD,MAAM,kBAAmBQ,sCAAOH,sCACpCI,EAGAR,mDAASI"}
package/dist/vuex.js CHANGED
@@ -1,2 +1,2 @@
1
- "use strict";var e=require("vuex"),t=require("vuex-persistedstate"),r=require("secure-ls"),u=require("@perevorot/shop/dist/store");function o(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var s=o(t),n=o(r),a=o(u),i=new n.default({isCompression:!0});a.default.plugins=[s.default({key:"compressed",storage:{getItem:function(e){return i.get(e)},setItem:function(e,t){return i.set(e,t)},removeItem:function(e){return i.remove(e)}}})];var d=e.createStore(a.default);window.addEventListener("storage",(function(e){if("vuex"===e.key&&e.newValue!=e.oldValue)try{d.replaceState(JSON.parse(i.get("vuex")))}catch(e){}})),module.exports=d;
1
+ "use strict";var e=require("vuex"),t=require("vuex-persistedstate"),r=require("secure-ls"),u=require("@perevorot/shop/dist/store");function o(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var s=o(t),n=o(r),a=o(u),i=new n.default({isCompression:!0});a.default.plugins=[s.default({key:"compressed-v2",storage:{getItem:function(e){return i.get(e)},setItem:function(e,t){return i.set(e,t)},removeItem:function(e){return i.remove(e)}}})];var d=e.createStore(a.default);window.addEventListener("storage",(function(e){if("vuex"===e.key&&e.newValue!=e.oldValue)try{d.replaceState(JSON.parse(i.get("vuex")))}catch(e){}})),module.exports=d;
2
2
  //# sourceMappingURL=vuex.js.map
package/dist/vuex.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"vuex.js","sources":["../src/js/vuex.js"],"sourcesContent":["import { createStore } from 'vuex';\n\nimport createPersistedState from 'vuex-persistedstate';\nimport secure from 'secure-ls';\nimport storeObject from '@perevorot/shop/dist/store';\n\nconst ls = new secure({\n isCompression: true,\n});\n\nstoreObject.plugins = [\n createPersistedState({\n key: 'compressed',\n storage: {\n getItem: (key) => ls.get(key),\n setItem: (key, value) => ls.set(key, value),\n removeItem: (key) => ls.remove(key),\n },\n }),\n];\n\nconst store = createStore(storeObject);\n\nwindow.addEventListener('storage', (e) => {\n if (e.key === 'vuex' && e.newValue != e.oldValue) {\n try {\n store.replaceState(JSON.parse(ls.get('vuex')));\n } catch (e) {}\n }\n});\n\nexport default store;\n"],"names":["ls","secure","isCompression","storeObject","plugins","createPersistedState","key","storage","getItem","get","setItem","value","set","removeItem","remove","store","createStore","window","addEventListener","e","newValue","oldValue","replaceState","JSON","parse"],"mappings":"oOAMMA,EAAK,IAAIC,UAAO,CAClBC,eAAe,IAGnBC,UAAYC,QAAU,CAClBC,UAAqB,CACjBC,IAAK,aACLC,QAAS,CACLC,QAAS,SAACF,UAAQN,EAAGS,IAAIH,IACzBI,QAAS,SAACJ,EAAKK,UAAUX,EAAGY,IAAIN,EAAKK,IACrCE,WAAY,SAACP,UAAQN,EAAGc,OAAOR,YAKrCS,EAAQC,cAAYb,WAE1Bc,OAAOC,iBAAiB,WAAW,SAACC,MAClB,SAAVA,EAAEb,KAAkBa,EAAEC,UAAYD,EAAEE,aAEhCN,EAAMO,aAAaC,KAAKC,MAAMxB,EAAGS,IAAI,UACvC,MAAOU"}
1
+ {"version":3,"file":"vuex.js","sources":["../src/js/vuex.js"],"sourcesContent":["import { createStore } from 'vuex';\n\nimport createPersistedState from 'vuex-persistedstate';\nimport secure from 'secure-ls';\nimport storeObject from '@perevorot/shop/dist/store';\n\nconst ls = new secure({\n isCompression: true,\n});\n\nstoreObject.plugins = [\n createPersistedState({\n key: 'compressed-v2',\n storage: {\n getItem: (key) => ls.get(key),\n setItem: (key, value) => ls.set(key, value),\n removeItem: (key) => ls.remove(key),\n },\n }),\n];\n\nconst store = createStore(storeObject);\n\nwindow.addEventListener('storage', (e) => {\n if (e.key === 'vuex' && e.newValue != e.oldValue) {\n try {\n store.replaceState(JSON.parse(ls.get('vuex')));\n } catch (e) {}\n }\n});\n\nexport default store;\n"],"names":["ls","secure","isCompression","storeObject","plugins","createPersistedState","key","storage","getItem","get","setItem","value","set","removeItem","remove","store","createStore","window","addEventListener","e","newValue","oldValue","replaceState","JSON","parse"],"mappings":"oOAMMA,EAAK,IAAIC,UAAO,CAClBC,eAAe,IAGnBC,UAAYC,QAAU,CAClBC,UAAqB,CACjBC,IAAK,gBACLC,QAAS,CACLC,QAAS,SAACF,UAAQN,EAAGS,IAAIH,IACzBI,QAAS,SAACJ,EAAKK,UAAUX,EAAGY,IAAIN,EAAKK,IACrCE,WAAY,SAACP,UAAQN,EAAGc,OAAOR,YAKrCS,EAAQC,cAAYb,WAE1Bc,OAAOC,iBAAiB,WAAW,SAACC,MAClB,SAAVA,EAAEb,KAAkBa,EAAEC,UAAYD,EAAEE,aAEhCN,EAAMO,aAAaC,KAAKC,MAAMxB,EAAGS,IAAI,UACvC,MAAOU"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@perevorot/shop",
3
- "version": "1.1.4",
3
+ "version": "1.1.6",
4
4
  "description": "",
5
5
  "files": [
6
6
  "dist/*"