@perevorot/shop 2.0.115 → 2.0.116
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=require("swiper");function n(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var o=n(t),i=e.defineComponent({name:"gallery",props:{thumbsDirection:{type:String,default:"horizontal"},fullscreenThumbsDirection:{type:String,default:"horizontal"},prev:{type:String,default:".swiper-button-prev"},next:{type:String,default:".swiper-button-next"},thumbPrev:{type:String,default:".swiper-button-prev"},thumbNext:{type:String,default:".swiper-button-next"},fullscreen:{type:Boolean,default:!1},isResizeThumbs:{type:Boolean,default:!1},thumbsSpaceBetween:{type:Number,default:10}},setup:function(n){var i,u,r,l,
|
|
1
|
+
"use strict";var e=require("vue"),t=require("swiper");function n(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var o=n(t),i=e.defineComponent({name:"gallery",props:{thumbsDirection:{type:String,default:"horizontal"},fullscreenThumbsDirection:{type:String,default:"horizontal"},prev:{type:String,default:".swiper-button-prev"},next:{type:String,default:".swiper-button-next"},thumbPrev:{type:String,default:".swiper-button-prev"},thumbNext:{type:String,default:".swiper-button-next"},fullscreen:{type:Boolean,default:!1},isResizeThumbs:{type:Boolean,default:!1},thumbsSpaceBetween:{type:Number,default:10}},setup:function(n){var i,u,r,s,l,a=e.ref(!1),d=function(){document.body.classList.remove("product-gallery-modal-open"),a.value=!1,p("close"),n.isResizeThumbs&&m()},c=function(){document.body.classList.add("product-gallery-modal-open"),a.value=!0,p("open")},p=function(e){u&&(n.thumbsDirection!=n.fullscreenThumbsDirection?s.changeDirection("open"==e?n.fullscreenThumbsDirection:n.thumbsDirection):s.update()),l.update()};window.addEventListener("keyup",(function(e){a.value&&"Escape"===e.key&&d()}));var m=function(){u.style.height=parseInt(r.offsetHeight)+"px",s.update()},f=function(){clearTimeout(i),i=setTimeout((function(){m()}),500)};return document.addEventListener("DOMContentLoaded",(function(){if(u=document.getElementById("product-gallery-thumbs"),r=document.getElementById("product-gallery"),u&&(s=new o.default(u,{spaceBetween:n.thumbsSpaceBetween,slidesPerView:"auto",mousewheel:{forceToAxis:!0},freeMode:{enabled:!0},watchSlidesVisibility:!0,watchSlidesProgress:!0,direction:n.thumbsDirection,navigation:{nextEl:n.thumbNext,prevEl:n.thumbPrev},modules:[t.Navigation,t.Mousewheel,t.FreeMode,t.Thumbs]}),n.isResizeThumbs&&(window.addEventListener("resize",f,{passive:!0}),m()),u.classList.remove("not-inited")),n.fullscreen&&r.addEventListener("click",c),r){var e={spaceBetween:10,mousewheel:{forceToAxis:!0},centeredSlides:!0,navigation:{nextEl:n.next,prevEl:n.prev}};s&&(e.thumbs={swiper:s}),e.modules=[t.Navigation,t.Mousewheel,t.FreeMode,t.Thumbs],l=new o.default(r,e)}p("close")}),!1),{modal:a,close:d}}});i.render=function(t,n,o,i,u,r){return t.fullscreen?(e.openBlock(),e.createElementBlock("button",{key:0,class:e.normalizeClass(["delete is-large",{"is-hidden":!t.modal}]),onClick:n[0]||(n[0]=function(){return t.close&&t.close.apply(t,arguments)})},null,2)):e.createCommentVNode("v-if",!0)},module.exports=i;
|
|
2
2
|
//# sourceMappingURL=Gallery.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Gallery.js","sources":["../../../src/components/shop/Gallery.vue","../../../src/components/shop/Gallery.vue?vue&type=template&id=6658f808&lang.js"],"sourcesContent":["<template>\n <button\n class=\"delete is-large\"\n @click=\"close\"\n v-if=\"fullscreen\"\n v-bind:class=\"{ 'is-hidden': !modal }\"\n ></button>\n</template>\n<script>\nimport { ref, defineComponent } from \"vue\";\nimport Swiper, { Navigation, Mousewheel, Thumbs, FreeMode } from \"swiper\";\n\nexport default /*#__PURE__*/ defineComponent({\n name: \"gallery\",\n props: {\n thumbsDirection: {\n type: String,\n default: \"horizontal\",\n },\n fullscreenThumbsDirection: {\n type: String,\n default: \"horizontal\",\n },\n prev: {\n type: String,\n default: \".swiper-button-prev\",\n },\n next: {\n type: String,\n default: \".swiper-button-next\",\n },\n thumbPrev: {\n type: String,\n default: \".swiper-button-prev\",\n },\n thumbNext: {\n type: String,\n default: \".swiper-button-next\",\n },\n fullscreen: {\n type: Boolean,\n default: false,\n },\n isResizeThumbs: {\n type: Boolean,\n default: false,\n },\n thumbsSpaceBetween: {\n type: Number,\n default: 10,\n },\n },\n setup(props) {\n const modal = ref(false);\n let resizeTimeout;\n let thumbs;\n let slider;\n let thumbsSwiper;\n let sliderSwiper;\n\n const close = () => {\n document.body.classList.remove(\"product-gallery-modal-open\");\n modal.value = false;\n\n update(\"close\");\n\n if (props.isResizeThumbs) {\n resizeThumbsSwiper();\n }\n };\n\n const open = () => {\n document.body.classList.add(\"product-gallery-modal-open\");\n modal.value = true;\n\n update(\"open\");\n };\n\n const update = (action) => {\n if (thumbs) {\n if (props.thumbsDirection != props.fullscreenThumbsDirection) {\n thumbsSwiper.changeDirection(\n action == \"open\"\n ? props.fullscreenThumbsDirection\n : props.thumbsDirection\n );\n } else {\n thumbsSwiper.update();\n }\n }\n\n sliderSwiper.update();\n };\n\n window.addEventListener(\"keyup\", (e) => {\n if (modal.value && e.key === \"Escape\") {\n close();\n }\n });\n\n const resizeThumbsSwiper = () => {\n thumbs.style.height = parseInt(slider.offsetHeight) + \"px\";\n thumbsSwiper.update();\n };\n\n const resizeBounced = () => {\n clearTimeout(resizeTimeout);\n\n resizeTimeout = setTimeout(() => {\n resizeThumbsSwiper();\n }, 500);\n };\n\n const init = () => {\n thumbs = document.getElementById(\"product-gallery-thumbs\");\n slider = document.getElementById(\"product-gallery\");\n\n if (thumbs) {\n thumbsSwiper = new Swiper(thumbs, {\n spaceBetween: props.thumbsSpaceBetween,\n slidesPerView: \"auto\",\n mousewheel: {\n forceToAxis: true,\n },\n freeMode: {\n enabled: true\n },\n watchSlidesVisibility: true,\n watchSlidesProgress: true,\n direction: props.thumbsDirection,\n navigation: {\n nextEl: props.thumbNext,\n prevEl: props.thumbPrev,\n },\n modules: [Navigation, Mousewheel, FreeMode, Thumbs]\n });\n\n if (props.isResizeThumbs) {\n window.addEventListener(\"resize\", resizeBounced);\n resizeThumbsSwiper();\n }\n\n thumbs.classList.remove(\"not-inited\");\n }\n\n if (props.fullscreen) {\n slider.addEventListener(\"click\", open);\n }\n\n if (slider) {\n let options = {\n spaceBetween: 10,\n mousewheel: {\n forceToAxis: true,\n },\n centeredSlides: true,\n navigation: {\n nextEl: props.next,\n prevEl: props.prev,\n },\n };\n\n if (thumbsSwiper) {\n options.thumbs = {\n swiper: thumbsSwiper,\n };\n }\n\n options.modules = [Navigation, Mousewheel, FreeMode, Thumbs];\n\n sliderSwiper = new Swiper(slider, options);\n }\n\n update(\"close\");\n };\n\n document.addEventListener(\"DOMContentLoaded\", init, false);\n\n return {\n modal,\n close,\n };\n },\n});\n</script>","<template>\n <button\n class=\"delete is-large\"\n @click=\"close\"\n v-if=\"fullscreen\"\n v-bind:class=\"{ 'is-hidden': !modal }\"\n ></button>\n</template>\n<script>\nimport { ref, defineComponent } from \"vue\";\nimport Swiper, { Navigation, Mousewheel, Thumbs, FreeMode } from \"swiper\";\n\nexport default /*#__PURE__*/ defineComponent({\n name: \"gallery\",\n props: {\n thumbsDirection: {\n type: String,\n default: \"horizontal\",\n },\n fullscreenThumbsDirection: {\n type: String,\n default: \"horizontal\",\n },\n prev: {\n type: String,\n default: \".swiper-button-prev\",\n },\n next: {\n type: String,\n default: \".swiper-button-next\",\n },\n thumbPrev: {\n type: String,\n default: \".swiper-button-prev\",\n },\n thumbNext: {\n type: String,\n default: \".swiper-button-next\",\n },\n fullscreen: {\n type: Boolean,\n default: false,\n },\n isResizeThumbs: {\n type: Boolean,\n default: false,\n },\n thumbsSpaceBetween: {\n type: Number,\n default: 10,\n },\n },\n setup(props) {\n const modal = ref(false);\n let resizeTimeout;\n let thumbs;\n let slider;\n let thumbsSwiper;\n let sliderSwiper;\n\n const close = () => {\n document.body.classList.remove(\"product-gallery-modal-open\");\n modal.value = false;\n\n update(\"close\");\n\n if (props.isResizeThumbs) {\n resizeThumbsSwiper();\n }\n };\n\n const open = () => {\n document.body.classList.add(\"product-gallery-modal-open\");\n modal.value = true;\n\n update(\"open\");\n };\n\n const update = (action) => {\n if (thumbs) {\n if (props.thumbsDirection != props.fullscreenThumbsDirection) {\n thumbsSwiper.changeDirection(\n action == \"open\"\n ? props.fullscreenThumbsDirection\n : props.thumbsDirection\n );\n } else {\n thumbsSwiper.update();\n }\n }\n\n sliderSwiper.update();\n };\n\n window.addEventListener(\"keyup\", (e) => {\n if (modal.value && e.key === \"Escape\") {\n close();\n }\n });\n\n const resizeThumbsSwiper = () => {\n thumbs.style.height = parseInt(slider.offsetHeight) + \"px\";\n thumbsSwiper.update();\n };\n\n const resizeBounced = () => {\n clearTimeout(resizeTimeout);\n\n resizeTimeout = setTimeout(() => {\n resizeThumbsSwiper();\n }, 500);\n };\n\n const init = () => {\n thumbs = document.getElementById(\"product-gallery-thumbs\");\n slider = document.getElementById(\"product-gallery\");\n\n if (thumbs) {\n thumbsSwiper = new Swiper(thumbs, {\n spaceBetween: props.thumbsSpaceBetween,\n slidesPerView: \"auto\",\n mousewheel: {\n forceToAxis: true,\n },\n freeMode: {\n enabled: true\n },\n watchSlidesVisibility: true,\n watchSlidesProgress: true,\n direction: props.thumbsDirection,\n navigation: {\n nextEl: props.thumbNext,\n prevEl: props.thumbPrev,\n },\n modules: [Navigation, Mousewheel, FreeMode, Thumbs]\n });\n\n if (props.isResizeThumbs) {\n window.addEventListener(\"resize\", resizeBounced);\n resizeThumbsSwiper();\n }\n\n thumbs.classList.remove(\"not-inited\");\n }\n\n if (props.fullscreen) {\n slider.addEventListener(\"click\", open);\n }\n\n if (slider) {\n let options = {\n spaceBetween: 10,\n mousewheel: {\n forceToAxis: true,\n },\n centeredSlides: true,\n navigation: {\n nextEl: props.next,\n prevEl: props.prev,\n },\n };\n\n if (thumbsSwiper) {\n options.thumbs = {\n swiper: thumbsSwiper,\n };\n }\n\n options.modules = [Navigation, Mousewheel, FreeMode, Thumbs];\n\n sliderSwiper = new Swiper(slider, options);\n }\n\n update(\"close\");\n };\n\n document.addEventListener(\"DOMContentLoaded\", init, false);\n\n return {\n modal,\n close,\n };\n },\n});\n</script>"],"names":["defineComponent","name","props","thumbsDirection","type","String","fullscreenThumbsDirection","prev","next","thumbPrev","thumbNext","fullscreen","Boolean","isResizeThumbs","thumbsSpaceBetween","Number","setup","resizeTimeout","thumbs","slider","thumbsSwiper","sliderSwiper","modal","ref","close","document","body","classList","remove","value","update","resizeThumbsSwiper","open","add","action","changeDirection","window","addEventListener","e","key","style","height","parseInt","offsetHeight","resizeBounced","clearTimeout","setTimeout","getElementById","Swiper","spaceBetween","slidesPerView","mousewheel","forceToAxis","freeMode","enabled","watchSlidesVisibility","watchSlidesProgress","direction","navigation","nextEl","prevEl","modules","Navigation","Mousewheel","FreeMode","Thumbs","options","centeredSlides","swiper","_ctx","_createElementBlock","onClick"],"mappings":"2IAY6BA,kBAAgB,CACzCC,KAAM,UACNC,MAAO,CACHC,gBAAiB,CACbC,KAAMC,eACG,cAEbC,0BAA2B,CACvBF,KAAMC,eACG,cAEbE,KAAM,CACFH,KAAMC,eACG,uBAEbG,KAAM,CACFJ,KAAMC,eACG,uBAEbI,UAAW,CACPL,KAAMC,eACG,uBAEbK,UAAW,CACPN,KAAMC,eACG,uBAEbM,WAAY,CACRP,KAAMQ,iBACG,GAEbC,eAAgB,CACZT,KAAMQ,iBACG,GAEbE,mBAAoB,CAChBV,KAAMW,eACG,KAGjBC,eAAMd,OAEEe,EACAC,EACAC,EACAC,EACAC,EALEC,EAAQC,OAAI,GAOZC,EAAQ,WACVC,SAASC,KAAKC,UAAUC,OAAO,8BAC/BN,EAAMO,OAAQ,EAEdC,EAAO,SAEH5B,EAAMW,gBACNkB,KAIFC,EAAO,WACTP,SAASC,KAAKC,UAAUM,IAAI,8BAC5BX,EAAMO,OAAQ,EAEdC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AAAA,4CChLE6C,4BAHVC,6DACU,gCAGwBD,WAF7BE,sCAAOF"}
|
|
1
|
+
{"version":3,"file":"Gallery.js","sources":["../../../src/components/shop/Gallery.vue","../../../src/components/shop/Gallery.vue?vue&type=template&id=7f4e9061&lang.js"],"sourcesContent":["<template>\n <button class=\"delete is-large\" @click=\"close\" v-if=\"fullscreen\" v-bind:class=\"{ 'is-hidden': !modal }\"></button>\n</template>\n<script>\nimport { ref, defineComponent } from \"vue\";\nimport Swiper, { Navigation, Mousewheel, Thumbs, FreeMode } from \"swiper\";\n\nexport default /*#__PURE__*/ defineComponent({\n name: \"gallery\",\n props: {\n thumbsDirection: {\n type: String,\n default: \"horizontal\",\n },\n fullscreenThumbsDirection: {\n type: String,\n default: \"horizontal\",\n },\n prev: {\n type: String,\n default: \".swiper-button-prev\",\n },\n next: {\n type: String,\n default: \".swiper-button-next\",\n },\n thumbPrev: {\n type: String,\n default: \".swiper-button-prev\",\n },\n thumbNext: {\n type: String,\n default: \".swiper-button-next\",\n },\n fullscreen: {\n type: Boolean,\n default: false,\n },\n isResizeThumbs: {\n type: Boolean,\n default: false,\n },\n thumbsSpaceBetween: {\n type: Number,\n default: 10,\n },\n },\n setup(props) {\n const modal = ref(false);\n let resizeTimeout;\n let thumbs;\n let slider;\n let thumbsSwiper;\n let sliderSwiper;\n\n const close = () => {\n document.body.classList.remove(\"product-gallery-modal-open\");\n modal.value = false;\n\n update(\"close\");\n\n if (props.isResizeThumbs) {\n resizeThumbsSwiper();\n }\n };\n\n const open = () => {\n document.body.classList.add(\"product-gallery-modal-open\");\n modal.value = true;\n\n update(\"open\");\n };\n\n const update = (action) => {\n if (thumbs) {\n if (props.thumbsDirection != props.fullscreenThumbsDirection) {\n thumbsSwiper.changeDirection(\n action == \"open\"\n ? props.fullscreenThumbsDirection\n : props.thumbsDirection\n );\n } else {\n thumbsSwiper.update();\n }\n }\n\n sliderSwiper.update();\n };\n\n window.addEventListener(\"keyup\", (e) => {\n if (modal.value && e.key === \"Escape\") {\n close();\n }\n });\n\n const resizeThumbsSwiper = () => {\n thumbs.style.height = parseInt(slider.offsetHeight) + \"px\";\n thumbsSwiper.update();\n };\n\n const resizeBounced = () => {\n clearTimeout(resizeTimeout);\n\n resizeTimeout = setTimeout(() => {\n resizeThumbsSwiper();\n }, 500);\n };\n\n const init = () => {\n thumbs = document.getElementById(\"product-gallery-thumbs\");\n slider = document.getElementById(\"product-gallery\");\n\n if (thumbs) {\n thumbsSwiper = new Swiper(thumbs, {\n spaceBetween: props.thumbsSpaceBetween,\n slidesPerView: \"auto\",\n mousewheel: {\n forceToAxis: true,\n },\n freeMode: {\n enabled: true\n },\n watchSlidesVisibility: true,\n watchSlidesProgress: true,\n direction: props.thumbsDirection,\n navigation: {\n nextEl: props.thumbNext,\n prevEl: props.thumbPrev,\n },\n modules: [Navigation, Mousewheel, FreeMode, Thumbs]\n });\n\n if (props.isResizeThumbs) {\n window.addEventListener(\"resize\", resizeBounced, { passive: true });\n resizeThumbsSwiper();\n }\n\n thumbs.classList.remove(\"not-inited\");\n }\n\n if (props.fullscreen) {\n slider.addEventListener(\"click\", open);\n }\n\n if (slider) {\n let options = {\n spaceBetween: 10,\n mousewheel: {\n forceToAxis: true,\n },\n centeredSlides: true,\n navigation: {\n nextEl: props.next,\n prevEl: props.prev,\n },\n };\n\n if (thumbsSwiper) {\n options.thumbs = {\n swiper: thumbsSwiper,\n };\n }\n\n options.modules = [Navigation, Mousewheel, FreeMode, Thumbs];\n\n sliderSwiper = new Swiper(slider, options);\n }\n\n update(\"close\");\n };\n\n document.addEventListener(\"DOMContentLoaded\", init, false);\n\n return {\n modal,\n close,\n };\n },\n});\n</script>","<template>\n <button class=\"delete is-large\" @click=\"close\" v-if=\"fullscreen\" v-bind:class=\"{ 'is-hidden': !modal }\"></button>\n</template>\n<script>\nimport { ref, defineComponent } from \"vue\";\nimport Swiper, { Navigation, Mousewheel, Thumbs, FreeMode } from \"swiper\";\n\nexport default /*#__PURE__*/ defineComponent({\n name: \"gallery\",\n props: {\n thumbsDirection: {\n type: String,\n default: \"horizontal\",\n },\n fullscreenThumbsDirection: {\n type: String,\n default: \"horizontal\",\n },\n prev: {\n type: String,\n default: \".swiper-button-prev\",\n },\n next: {\n type: String,\n default: \".swiper-button-next\",\n },\n thumbPrev: {\n type: String,\n default: \".swiper-button-prev\",\n },\n thumbNext: {\n type: String,\n default: \".swiper-button-next\",\n },\n fullscreen: {\n type: Boolean,\n default: false,\n },\n isResizeThumbs: {\n type: Boolean,\n default: false,\n },\n thumbsSpaceBetween: {\n type: Number,\n default: 10,\n },\n },\n setup(props) {\n const modal = ref(false);\n let resizeTimeout;\n let thumbs;\n let slider;\n let thumbsSwiper;\n let sliderSwiper;\n\n const close = () => {\n document.body.classList.remove(\"product-gallery-modal-open\");\n modal.value = false;\n\n update(\"close\");\n\n if (props.isResizeThumbs) {\n resizeThumbsSwiper();\n }\n };\n\n const open = () => {\n document.body.classList.add(\"product-gallery-modal-open\");\n modal.value = true;\n\n update(\"open\");\n };\n\n const update = (action) => {\n if (thumbs) {\n if (props.thumbsDirection != props.fullscreenThumbsDirection) {\n thumbsSwiper.changeDirection(\n action == \"open\"\n ? props.fullscreenThumbsDirection\n : props.thumbsDirection\n );\n } else {\n thumbsSwiper.update();\n }\n }\n\n sliderSwiper.update();\n };\n\n window.addEventListener(\"keyup\", (e) => {\n if (modal.value && e.key === \"Escape\") {\n close();\n }\n });\n\n const resizeThumbsSwiper = () => {\n thumbs.style.height = parseInt(slider.offsetHeight) + \"px\";\n thumbsSwiper.update();\n };\n\n const resizeBounced = () => {\n clearTimeout(resizeTimeout);\n\n resizeTimeout = setTimeout(() => {\n resizeThumbsSwiper();\n }, 500);\n };\n\n const init = () => {\n thumbs = document.getElementById(\"product-gallery-thumbs\");\n slider = document.getElementById(\"product-gallery\");\n\n if (thumbs) {\n thumbsSwiper = new Swiper(thumbs, {\n spaceBetween: props.thumbsSpaceBetween,\n slidesPerView: \"auto\",\n mousewheel: {\n forceToAxis: true,\n },\n freeMode: {\n enabled: true\n },\n watchSlidesVisibility: true,\n watchSlidesProgress: true,\n direction: props.thumbsDirection,\n navigation: {\n nextEl: props.thumbNext,\n prevEl: props.thumbPrev,\n },\n modules: [Navigation, Mousewheel, FreeMode, Thumbs]\n });\n\n if (props.isResizeThumbs) {\n window.addEventListener(\"resize\", resizeBounced, { passive: true });\n resizeThumbsSwiper();\n }\n\n thumbs.classList.remove(\"not-inited\");\n }\n\n if (props.fullscreen) {\n slider.addEventListener(\"click\", open);\n }\n\n if (slider) {\n let options = {\n spaceBetween: 10,\n mousewheel: {\n forceToAxis: true,\n },\n centeredSlides: true,\n navigation: {\n nextEl: props.next,\n prevEl: props.prev,\n },\n };\n\n if (thumbsSwiper) {\n options.thumbs = {\n swiper: thumbsSwiper,\n };\n }\n\n options.modules = [Navigation, Mousewheel, FreeMode, Thumbs];\n\n sliderSwiper = new Swiper(slider, options);\n }\n\n update(\"close\");\n };\n\n document.addEventListener(\"DOMContentLoaded\", init, false);\n\n return {\n modal,\n close,\n };\n },\n});\n</script>"],"names":["defineComponent","name","props","thumbsDirection","type","String","fullscreenThumbsDirection","prev","next","thumbPrev","thumbNext","fullscreen","Boolean","isResizeThumbs","thumbsSpaceBetween","Number","setup","resizeTimeout","thumbs","slider","thumbsSwiper","sliderSwiper","modal","ref","close","document","body","classList","remove","value","update","resizeThumbsSwiper","open","add","action","changeDirection","window","addEventListener","e","key","style","height","parseInt","offsetHeight","resizeBounced","clearTimeout","setTimeout","getElementById","Swiper","spaceBetween","slidesPerView","mousewheel","forceToAxis","freeMode","enabled","watchSlidesVisibility","watchSlidesProgress","direction","navigation","nextEl","prevEl","modules","Navigation","Mousewheel","FreeMode","Thumbs","passive","options","centeredSlides","swiper","_ctx","_createElementBlock","onClick"],"mappings":"2IAO6BA,kBAAgB,CACzCC,KAAM,UACNC,MAAO,CACHC,gBAAiB,CACbC,KAAMC,eACG,cAEbC,0BAA2B,CACvBF,KAAMC,eACG,cAEbE,KAAM,CAC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,WAAUC,YAG5C/D,EAAMW,iBACNuB,OAAOC,iBAAiB,SAAUO,EAAe,CAAEsB,SAAS,IAC5DnC,KAGJb,EAAOS,UAAUC,OAAO,eAGxB1B,EAAMS,YACNQ,EAAOkB,iBAAiB,QAASL,GAGjCb,EAAQ,KACJgD,EAAU,CACVlB,aAAc,GACdE,WAAY,CACRC,aAAa,GAEjBgB,gBAAgB,EAChBV,WAAY,CACRC,OAAQzD,EAAMM,KACdoD,OAAQ1D,EAAMK,OAIlBa,IACA+C,EAAQjD,OAAS,CACbmD,OAAQjD,IAIhB+C,EAAQN,QAAU,CAACC,aAAYC,aAAYC,WAAUC,UAErD5C,EAAe,IAAI2B,UAAO7B,EAAQgD,GAGtCrC,EAAO,YAGyC,GAE7C,CACHR,MAAAA,EACAE,MAAAA,4CC9K6C8C,4BAArDC,6DAAc,gCAAiFD,WAA9DE,sCAAOF"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var e=require("vue"),t=require("vuex"),r=require("@perevorot/shop/dist/api"),o=require("simplebar"),n=require("secure-ls");function l(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var a=l(o),c=l(n);var s=e.defineComponent({name:"search",props:{q:{type:String,default:""},placeholder:{type:String,default:""},placeholderMobile:{type:String,default:""},parameter:{type:String,default:"/q{separator}"},isHistory:{type:Boolean,default:!0},isToggleDropdownOnClose:{type:Boolean,default:!0},htmlClass:{type:String,default:""}},setup:function(o){var n=new c.default({isCompression:!1}),l=o.q;if(l){var s=document.createElement("textarea");s.innerHTML=l,l=s.value}var i=e.ref(!1),d=e.ref(l),u=e.ref([]),p=e.ref([]),m=e.ref(0),h=e.ref(-1),v=e.ref(!1),f=e.ref(),y=e.ref(""),g=e.ref(),k=e.ref(n.get("search")),w=e.ref([]),E=t.useStore(),B=e.computed((function(){return E.getters["auth/me"]})),V=[],N=function(){clearTimeout(void 0),h.value=-1,d.value.trim()?(i.value=!0,d.value.trim()&&r.shop.search(d.value).then((function(e){e.data&&(C(),u.value=e.data.products,m.value=e.data.total,y.value=e.data.separator,p.value=e.data.byCategory,new a.default(g.value))})).finally((function(){i.value=!1}))):(u.value=[],i.value=!1)},C=function(){if(d.value.length>1){var e=n.get("search")?n.get("search"):[];-1!==e.indexOf(d.value)&&(e=e.filter((function(e){return e!==d.value}))),e.length>4&&(e=e.slice(0,4)),e.unshift(d.value),n.set("search",e),k.value=e}};e.onBeforeUpdate((function(){V=[]})),e.watch((function(){return d.value}),(function(){v.value=!0,h.value=-1,N()}));var S=e.computed((function(){return d.value?$env.locale.url+"/search"+_.value:$env.locale.url+"/search"})),_=e.computed((function(){return o.parameter.replace("{separator}",y.value)+d.value.toLowerCase()})),D=function(e){e.target.closest(".cart")||(o.isToggleDropdownOnClose&&(v.value=!1,o.htmlClass&&document.querySelector("html").classList.remove(o.htmlClass)),h.value=-1)};window.addEventListener("click",D);var L,b=e.computed((function(){return d.value.length>3?w.value.filter((function(e){return-1!==e.search.indexOf(d.value)})):[]})),q=(L=function(){var e,t,r,n=document.getElementById("menu");return n&&n.querySelectorAll("[data-search]").forEach((function(e){var t=e.textContent.trim(),r=e.dataset.search;w.value.push({name:(r?r+" / ":"")+t,search:t.toLowerCase(),href:e.closest("a").href})})),o.q&&N(),r?t?t(e):e:(e&&e.then||(e=Promise.resolve(e)),t?e.then(t):e)},function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];try{return Promise.resolve(L.apply(this,e))}catch(e){return Promise.reject(e)}});document.addEventListener("DOMContentLoaded",q,!1);var x=e.ref(o.placeholder);if(o.placeholderMobile){var H=function(){var e=window.matchMedia("(max-width: 768px)").matches;x.value=e?o.placeholderMobile:o.placeholder};window.addEventListener("resize",H),H()}return{isLoading:i,term:d,results:u,next:function(){h.value<u.value.length-1&&h.value++},prev:function(){h.value>=0&&h.value--},current:h,add:function(e){h.value>=0&&(e.preventDefault(),V[h.value].add())},cartRefs:function(e){e&&V.push(e)},isDropdown:v,preventCaret:function(e){(38==e.which||40==e.which||32==e.which&&h.value>=0)&&e.preventDefault()},esc:function(e){f.value.blur(),D(e)},input:f,dropdown:function(){v.value=!0,h.value=-1,o.htmlClass&&document.querySelector("html").classList.add(o.htmlClass)},total:m,searchUrl:S,searchHrefWithParameter:_,open:function(){h.value>=0?window.location.href=u.value[h.value].href:window.location.href=S.value},categories:b,byCategory:p,dropdownContent:g,history:k,clearSearchHistory:function(e){n.remove("search"),k.value=[],f.value.focus()},setSearchHistory:function(e){e.value=e},user:B,clear:function(){d.value="",f.value.focus()},placeholderMobilized:x}}}),i={class:"dropdown-trigger"},d=["placeholder"],u={class:"icon is-small is-right"},p=[e.createElementVNode("i",{class:"fas fa-search"},null,-1)],m={key:1,class:"dropdown-menu"},h={class:"dropdown-content"},v={class:"history-list"},f={class:"dropdown-item history-list-title"},y=["onClick"],g={class:"dropdown-item history-list-clear"},k={class:"dropdown-menu"},w={class:"dropdown-content",style:{"max-height":"600px",overflow:"auto"},ref:"dropdownContent"},E={key:0,class:"results-list"},B=["href"],V={key:0,class:"dropdown-divider"},N={key:1,class:"results-list-category"},C={class:"dropdown-item categories-list-title"},S=["href"],_={key:2,class:"results-list-total"},D={class:"dropdown-item mb-3 mt-2"},L=e.createElementVNode("br",null,null,-1),b=["href"],q={key:3,class:"products-list"},x={class:"dropdown-item products-list-title"},H={class:"columns"},M={class:"column"},T={class:"title"},P=["href"],K=["innerHTML"],$={key:0,class:"price_old"},z=["innerHTML"],O={class:"code"},F={key:1,class:"quantity"},R={key:2,class:"no-quantity"},U={key:0,class:"column is-narrow"},W={key:1,class:"column is-eol"},j={key:0,class:"dropdown-content"},A={class:"dropdown-item"},I=["innerHTML"];s.render=function(t,r,o,n,l,a){var c=e.resolveComponent("cart-add");return e.openBlock(),e.createElementBlock("div",{class:"shop-search",onClick:r[10]||(r[10]=function(e){return e.stopPropagation()})},[e.createElementVNode("div",{class:e.normalizeClass(["dropdown",{"is-active":t.isDropdown,"is-dropdown-visible":t.isDropdown&&(t.history.length&&!t.term||t.results.length||t.categories.length||t.term&&!t.isLoading&&!t.results.length&&!t.categories.length)}])},[t.htmlClass?e.createCommentVNode("v-if",!0):(e.openBlock(),e.createElementBlock("div",{key:0,class:"overlay search-overlay",onClick:r[0]||(r[0]=function(e){return t.esc(e)})})),e.createElementVNode("div",i,[e.createElementVNode("div",{class:e.normalizeClass(["control has-icons-right",{"is-loading":t.isLoading}])},[e.withDirectives(e.createElementVNode("input",{class:"input",type:"text","onUpdate:modelValue":r[1]||(r[1]=function(e){return t.term=e}),ref:"input",placeholder:t.placeholderMobilized,onKeyup:[r[2]||(r[2]=e.withKeys((function(){return t.next&&t.next.apply(t,arguments)}),["arrow-down"])),r[3]||(r[3]=e.withKeys((function(){return t.prev&&t.prev.apply(t,arguments)}),["arrow-up"])),r[4]||(r[4]=e.withKeys((function(e){return t.add(e)}),["space"])),r[5]||(r[5]=e.withKeys((function(){return t.open&&t.open.apply(t,arguments)}),["enter"])),r[6]||(r[6]=e.withKeys((function(e){return t.esc(e)}),["esc"]))],onClick:r[7]||(r[7]=function(){return t.dropdown&&t.dropdown.apply(t,arguments)}),onKeydown:r[8]||(r[8]=function(e){return t.preventCaret(e)})},null,40,d),[[e.vModelText,t.term]]),e.renderSlot(t.$slots,"clear",{clear:t.clear,term:t.term}),e.renderSlot(t.$slots,"icon",{isLoading:t.isLoading},(function(){return[e.withDirectives(e.createElementVNode("span",u,p,512),[[e.vShow,!t.isLoading]])]}))],2)]),t.isHistory&&t.isDropdown&&t.history.length&&!t.term?(e.openBlock(),e.createElementBlock("div",m,[e.createElementVNode("div",h,[e.createElementVNode("div",v,[e.createElementVNode("div",f,[e.createElementVNode("p",null,e.toDisplayString(t.__("shop.search.history")),1)]),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.history,(function(r,o){return e.openBlock(),e.createElementBlock("div",{class:"dropdown-item",key:o},[e.createElementVNode("a",{onClick:function(e){return t.term=r}},e.toDisplayString(r),9,y)])})),128)),e.createElementVNode("div",g,[e.createElementVNode("a",{onClick:r[9]||(r[9]=function(e){return t.clearSearchHistory(e)})},e.toDisplayString(t.__("shop.search.history_clear")),1)])])])])):e.createCommentVNode("v-if",!0),e.withDirectives(e.createElementVNode("div",k,[e.withDirectives(e.createElementVNode("div",w,[e.renderSlot(t.$slots,"results-header"),t.categories.length?(e.openBlock(),e.createElementBlock("div",E,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.categories,(function(t,r){return e.openBlock(),e.createElementBlock("div",{class:"dropdown-item",key:r},[e.createElementVNode("div",null,[e.createElementVNode("a",{href:t.href},e.toDisplayString(t.name),9,B)])])})),128)),t.byCategory.length?(e.openBlock(),e.createElementBlock("hr",V)):e.createCommentVNode("v-if",!0)])):e.createCommentVNode("v-if",!0),t.byCategory.length?(e.openBlock(),e.createElementBlock("div",N,[e.createElementVNode("div",C,e.toDisplayString(t.__("shop.search.categories")),1),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.byCategory,(function(r,o){return e.openBlock(),e.createElementBlock("div",{class:"dropdown-item",key:o},[e.renderSlot(t.$slots,"item-category",{item:r,searchHrefWithParameter:t.searchHrefWithParameter},(function(){return[e.createElementVNode("div",null,[e.createElementVNode("a",{href:r.href+t.searchHrefWithParameter},e.toDisplayString(r.name),9,S)]),e.createElementVNode("div",null,e.toDisplayString(t.__("shop.search.category_found",{count:r.count})),1)]}))])})),128))])):e.createCommentVNode("v-if",!0),t.total?(e.openBlock(),e.createElementBlock("div",_,[e.createElementVNode("p",D,[e.createTextVNode(e.toDisplayString(t.__("shop.search.total_found",{total:t.total}))+" ",1),L,e.createElementVNode("a",{href:t.searchUrl},e.toDisplayString(t.__("shop.search.open_results")),9,b)])])):e.createCommentVNode("v-if",!0),t.results.length?(e.openBlock(),e.createElementBlock("div",q,[e.createElementVNode("div",x,e.toDisplayString(t.__("shop.search.products")),1),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.results,(function(r,o){return e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["dropdown-item",{"is-active":t.current==o}]),key:r.id},[e.renderSlot(t.$slots,"item",{user:t.user,item:r,cartRefs:t.cartRefs},(function(){return[e.createElementVNode("div",H,[e.createElementVNode("div",M,[e.createElementVNode("div",T,[e.createElementVNode("a",{href:r.href},e.toDisplayString(r.name),9,P)]),e.createElementVNode("div",{class:"price",innerHTML:r.price},null,8,K),r.price_old?(e.openBlock(),e.createElementBlock("div",$,[e.createElementVNode("span",{innerHTML:r.price_old},null,8,z)])):e.createCommentVNode("v-if",!0),e.createElementVNode("div",O,e.toDisplayString(r.code),1),r.quantity?(e.openBlock(),e.createElementBlock("div",F,e.toDisplayString(t.__("shop.search.in_stock")),1)):(e.openBlock(),e.createElementBlock("span",R,e.toDisplayString(t.__("shop.search.out_stock")),1))]),r.is_eol?(e.openBlock(),e.createElementBlock("div",W,e.toDisplayString(t.__("shop.search.eol")),1)):(e.openBlock(),e.createElementBlock("div",U,[e.createVNode(c,{id:r.id,"is-change-quantity":!1,"is-already-in-cart":!1,ref_for:!0,ref:t.cartRefs},null,8,["id"])]))])]}))],2)})),128))])):e.createCommentVNode("v-if",!0)],512),[[e.vShow,t.results.length||t.categories.length]]),t.isLoading||t.results.length||t.categories.length?e.createCommentVNode("v-if",!0):(e.openBlock(),e.createElementBlock("div",j,[e.createElementVNode("div",A,[e.createElementVNode("div",{class:"no-results",innerHTML:t.__("shop.search.no_results")},null,8,I)])]))],512),[[e.vShow,t.results.length||t.term]])],2)])},module.exports=s;
|
|
1
|
+
"use strict";var e=require("vue"),t=require("vuex"),r=require("@perevorot/shop/dist/api"),o=require("simplebar"),n=require("secure-ls");function l(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var a=l(o),c=l(n);var s=e.defineComponent({name:"search",props:{q:{type:String,default:""},placeholder:{type:String,default:""},placeholderMobile:{type:String,default:""},parameter:{type:String,default:"/q{separator}"},isHistory:{type:Boolean,default:!0},isToggleDropdownOnClose:{type:Boolean,default:!0},htmlClass:{type:String,default:""}},setup:function(o){var n=new c.default({isCompression:!1}),l=o.q;if(l){var s=document.createElement("textarea");s.innerHTML=l,l=s.value}var i=e.ref(!1),d=e.ref(l),u=e.ref([]),p=e.ref([]),m=e.ref(0),h=e.ref(-1),v=e.ref(!1),f=e.ref(),y=e.ref(""),g=e.ref(),k=e.ref(n.get("search")),w=e.ref([]),E=t.useStore(),B=e.computed((function(){return E.getters["auth/me"]})),V=[],N=function(){clearTimeout(void 0),h.value=-1,d.value.trim()?(i.value=!0,d.value.trim()&&r.shop.search(d.value).then((function(e){e.data&&(C(),u.value=e.data.products,m.value=e.data.total,y.value=e.data.separator,p.value=e.data.byCategory,new a.default(g.value))})).finally((function(){i.value=!1}))):(u.value=[],i.value=!1)},C=function(){if(d.value.length>1){var e=n.get("search")?n.get("search"):[];-1!==e.indexOf(d.value)&&(e=e.filter((function(e){return e!==d.value}))),e.length>4&&(e=e.slice(0,4)),e.unshift(d.value),n.set("search",e),k.value=e}};e.onBeforeUpdate((function(){V=[]})),e.watch((function(){return d.value}),(function(){v.value=!0,h.value=-1,N()}));var S=e.computed((function(){return d.value?$env.locale.url+"/search"+_.value:$env.locale.url+"/search"})),_=e.computed((function(){return o.parameter.replace("{separator}",y.value)+d.value.toLowerCase()})),D=function(e){e.target.closest(".cart")||(o.isToggleDropdownOnClose&&(v.value=!1,o.htmlClass&&document.querySelector("html").classList.remove(o.htmlClass)),h.value=-1)};window.addEventListener("click",D);var L,b=e.computed((function(){return d.value.length>3?w.value.filter((function(e){return-1!==e.search.indexOf(d.value)})):[]})),q=(L=function(){var e,t,r,n=document.getElementById("menu");return n&&n.querySelectorAll("[data-search]").forEach((function(e){var t=e.textContent.trim(),r=e.dataset.search;w.value.push({name:(r?r+" / ":"")+t,search:t.toLowerCase(),href:e.closest("a").href})})),o.q&&N(),r?t?t(e):e:(e&&e.then||(e=Promise.resolve(e)),t?e.then(t):e)},function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];try{return Promise.resolve(L.apply(this,e))}catch(e){return Promise.reject(e)}});document.addEventListener("DOMContentLoaded",q,!1);var x=e.ref(o.placeholder);if(o.placeholderMobile){var H=function(){var e=window.matchMedia("(max-width: 768px)").matches;x.value=e?o.placeholderMobile:o.placeholder};window.addEventListener("resize",H,{passive:!0}),H()}return{isLoading:i,term:d,results:u,next:function(){h.value<u.value.length-1&&h.value++},prev:function(){h.value>=0&&h.value--},current:h,add:function(e){h.value>=0&&(e.preventDefault(),V[h.value].add())},cartRefs:function(e){e&&V.push(e)},isDropdown:v,preventCaret:function(e){(38==e.which||40==e.which||32==e.which&&h.value>=0)&&e.preventDefault()},esc:function(e){f.value.blur(),D(e)},input:f,dropdown:function(){v.value=!0,h.value=-1,o.htmlClass&&document.querySelector("html").classList.add(o.htmlClass)},total:m,searchUrl:S,searchHrefWithParameter:_,open:function(){h.value>=0?window.location.href=u.value[h.value].href:window.location.href=S.value},categories:b,byCategory:p,dropdownContent:g,history:k,clearSearchHistory:function(e){n.remove("search"),k.value=[],f.value.focus()},setSearchHistory:function(e){e.value=e},user:B,clear:function(){d.value="",f.value.focus()},placeholderMobilized:x}}}),i={class:"dropdown-trigger"},d=["placeholder"],u={class:"icon is-small is-right"},p=[e.createElementVNode("i",{class:"fas fa-search"},null,-1)],m={key:1,class:"dropdown-menu"},h={class:"dropdown-content"},v={class:"history-list"},f={class:"dropdown-item history-list-title"},y=["onClick"],g={class:"dropdown-item history-list-clear"},k={class:"dropdown-menu"},w={class:"dropdown-content",style:{"max-height":"600px",overflow:"auto"},ref:"dropdownContent"},E={key:0,class:"results-list"},B=["href"],V={key:0,class:"dropdown-divider"},N={key:1,class:"results-list-category"},C={class:"dropdown-item categories-list-title"},S=["href"],_={key:2,class:"results-list-total"},D={class:"dropdown-item mb-3 mt-2"},L=e.createElementVNode("br",null,null,-1),b=["href"],q={key:3,class:"products-list"},x={class:"dropdown-item products-list-title"},H={class:"columns"},M={class:"column"},T={class:"title"},P=["href"],K=["innerHTML"],$={key:0,class:"price_old"},z=["innerHTML"],O={class:"code"},F={key:1,class:"quantity"},R={key:2,class:"no-quantity"},U={key:0,class:"column is-narrow"},W={key:1,class:"column is-eol"},j={key:0,class:"dropdown-content"},A={class:"dropdown-item"},I=["innerHTML"];s.render=function(t,r,o,n,l,a){var c=e.resolveComponent("cart-add");return e.openBlock(),e.createElementBlock("div",{class:"shop-search",onClick:r[10]||(r[10]=function(e){return e.stopPropagation()})},[e.createElementVNode("div",{class:e.normalizeClass(["dropdown",{"is-active":t.isDropdown,"is-dropdown-visible":t.isDropdown&&(t.history.length&&!t.term||t.results.length||t.categories.length||t.term&&!t.isLoading&&!t.results.length&&!t.categories.length)}])},[t.htmlClass?e.createCommentVNode("v-if",!0):(e.openBlock(),e.createElementBlock("div",{key:0,class:"overlay search-overlay",onClick:r[0]||(r[0]=function(e){return t.esc(e)})})),e.createElementVNode("div",i,[e.createElementVNode("div",{class:e.normalizeClass(["control has-icons-right",{"is-loading":t.isLoading}])},[e.withDirectives(e.createElementVNode("input",{class:"input",type:"text","onUpdate:modelValue":r[1]||(r[1]=function(e){return t.term=e}),ref:"input",placeholder:t.placeholderMobilized,onKeyup:[r[2]||(r[2]=e.withKeys((function(){return t.next&&t.next.apply(t,arguments)}),["arrow-down"])),r[3]||(r[3]=e.withKeys((function(){return t.prev&&t.prev.apply(t,arguments)}),["arrow-up"])),r[4]||(r[4]=e.withKeys((function(e){return t.add(e)}),["space"])),r[5]||(r[5]=e.withKeys((function(){return t.open&&t.open.apply(t,arguments)}),["enter"])),r[6]||(r[6]=e.withKeys((function(e){return t.esc(e)}),["esc"]))],onClick:r[7]||(r[7]=function(){return t.dropdown&&t.dropdown.apply(t,arguments)}),onKeydown:r[8]||(r[8]=function(e){return t.preventCaret(e)})},null,40,d),[[e.vModelText,t.term]]),e.renderSlot(t.$slots,"clear",{clear:t.clear,term:t.term}),e.renderSlot(t.$slots,"icon",{isLoading:t.isLoading},(function(){return[e.withDirectives(e.createElementVNode("span",u,p,512),[[e.vShow,!t.isLoading]])]}))],2)]),t.isHistory&&t.isDropdown&&t.history.length&&!t.term?(e.openBlock(),e.createElementBlock("div",m,[e.createElementVNode("div",h,[e.createElementVNode("div",v,[e.createElementVNode("div",f,[e.createElementVNode("p",null,e.toDisplayString(t.__("shop.search.history")),1)]),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.history,(function(r,o){return e.openBlock(),e.createElementBlock("div",{class:"dropdown-item",key:o},[e.createElementVNode("a",{onClick:function(e){return t.term=r}},e.toDisplayString(r),9,y)])})),128)),e.createElementVNode("div",g,[e.createElementVNode("a",{onClick:r[9]||(r[9]=function(e){return t.clearSearchHistory(e)})},e.toDisplayString(t.__("shop.search.history_clear")),1)])])])])):e.createCommentVNode("v-if",!0),e.withDirectives(e.createElementVNode("div",k,[e.withDirectives(e.createElementVNode("div",w,[e.renderSlot(t.$slots,"results-header"),t.categories.length?(e.openBlock(),e.createElementBlock("div",E,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.categories,(function(t,r){return e.openBlock(),e.createElementBlock("div",{class:"dropdown-item",key:r},[e.createElementVNode("div",null,[e.createElementVNode("a",{href:t.href},e.toDisplayString(t.name),9,B)])])})),128)),t.byCategory.length?(e.openBlock(),e.createElementBlock("hr",V)):e.createCommentVNode("v-if",!0)])):e.createCommentVNode("v-if",!0),t.byCategory.length?(e.openBlock(),e.createElementBlock("div",N,[e.createElementVNode("div",C,e.toDisplayString(t.__("shop.search.categories")),1),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.byCategory,(function(r,o){return e.openBlock(),e.createElementBlock("div",{class:"dropdown-item",key:o},[e.renderSlot(t.$slots,"item-category",{item:r,searchHrefWithParameter:t.searchHrefWithParameter},(function(){return[e.createElementVNode("div",null,[e.createElementVNode("a",{href:r.href+t.searchHrefWithParameter},e.toDisplayString(r.name),9,S)]),e.createElementVNode("div",null,e.toDisplayString(t.__("shop.search.category_found",{count:r.count})),1)]}))])})),128))])):e.createCommentVNode("v-if",!0),t.total?(e.openBlock(),e.createElementBlock("div",_,[e.createElementVNode("p",D,[e.createTextVNode(e.toDisplayString(t.__("shop.search.total_found",{total:t.total}))+" ",1),L,e.createElementVNode("a",{href:t.searchUrl},e.toDisplayString(t.__("shop.search.open_results")),9,b)])])):e.createCommentVNode("v-if",!0),t.results.length?(e.openBlock(),e.createElementBlock("div",q,[e.createElementVNode("div",x,e.toDisplayString(t.__("shop.search.products")),1),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.results,(function(r,o){return e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["dropdown-item",{"is-active":t.current==o}]),key:r.id},[e.renderSlot(t.$slots,"item",{user:t.user,item:r,cartRefs:t.cartRefs},(function(){return[e.createElementVNode("div",H,[e.createElementVNode("div",M,[e.createElementVNode("div",T,[e.createElementVNode("a",{href:r.href},e.toDisplayString(r.name),9,P)]),e.createElementVNode("div",{class:"price",innerHTML:r.price},null,8,K),r.price_old?(e.openBlock(),e.createElementBlock("div",$,[e.createElementVNode("span",{innerHTML:r.price_old},null,8,z)])):e.createCommentVNode("v-if",!0),e.createElementVNode("div",O,e.toDisplayString(r.code),1),r.quantity?(e.openBlock(),e.createElementBlock("div",F,e.toDisplayString(t.__("shop.search.in_stock")),1)):(e.openBlock(),e.createElementBlock("span",R,e.toDisplayString(t.__("shop.search.out_stock")),1))]),r.is_eol?(e.openBlock(),e.createElementBlock("div",W,e.toDisplayString(t.__("shop.search.eol")),1)):(e.openBlock(),e.createElementBlock("div",U,[e.createVNode(c,{id:r.id,"is-change-quantity":!1,"is-already-in-cart":!1,ref_for:!0,ref:t.cartRefs},null,8,["id"])]))])]}))],2)})),128))])):e.createCommentVNode("v-if",!0)],512),[[e.vShow,t.results.length||t.categories.length]]),t.isLoading||t.results.length||t.categories.length?e.createCommentVNode("v-if",!0):(e.openBlock(),e.createElementBlock("div",j,[e.createElementVNode("div",A,[e.createElementVNode("div",{class:"no-results",innerHTML:t.__("shop.search.no_results")},null,8,I)])]))],512),[[e.vShow,t.results.length||t.term]])],2)])},module.exports=s;
|
|
2
2
|
//# sourceMappingURL=Search.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Search.js","sources":["../../../src/components/shop/Search.vue","../../../src/components/shop/Search.vue?vue&type=template&id=81ea6246&lang.js"],"sourcesContent":["<template>\n <div class=\"shop-search\" @click=\"$event.stopPropagation()\">\n <div class=\"dropdown\" v-bind:class=\"{\n 'is-active': isDropdown,\n 'is-dropdown-visible': isDropdown && ((history.length && !term) || results.length || categories.length || (term && !isLoading && !results.length && !categories.length))\n }\">\n <div class=\"overlay search-overlay\" @click=\"esc($event)\" v-if=\"!htmlClass\"></div>\n <div class=\"dropdown-trigger\">\n <div class=\"control has-icons-right\" v-bind:class=\"{ 'is-loading': isLoading }\">\n <input class=\"input\" type=\"text\" v-model=\"term\" ref=\"input\" :placeholder=\"placeholderMobilized\" @keyup.arrow-down=\"next\" @keyup.arrow-up=\"prev\" @keyup.space=\"add($event)\" @keyup.enter=\"open\" @keyup.esc=\"esc($event)\" @click=\"dropdown\" @keydown=\"preventCaret($event)\" />\n <slot name=\"clear\" :clear=\"clear\" :term=\"term\"></slot>\n <slot name=\"icon\" :isLoading=\"isLoading\">\n <span class=\"icon is-small is-right\" v-show=\"!isLoading\">\n <i class=\"fas fa-search\"></i>\n </span>\n </slot>\n </div>\n </div>\n <div class=\"dropdown-menu\" v-if=\"isHistory && isDropdown && history.length && !term\">\n <div class=\"dropdown-content\">\n <div class=\"history-list\">\n <div class=\"dropdown-item history-list-title\">\n <p>{{ __('shop.search.history') }}</p>\n </div>\n <div class=\"dropdown-item\" v-for=\"(item, index) in history\" v-bind:key=\"index\">\n <a @click=\"term = item\">{{ item }}</a>\n </div>\n <div class=\"dropdown-item history-list-clear\">\n <a @click=\"clearSearchHistory($event)\">{{ __('shop.search.history_clear') }}</a>\n </div>\n </div>\n </div>\n </div>\n <div class=\"dropdown-menu\" v-show=\"results.length || term\">\n <div class=\"dropdown-content\" v-show=\"results.length || categories.length\" style=\"max-height: 600px; overflow: auto\" ref=\"dropdownContent\">\n <slot name=\"results-header\"></slot>\n <div class=\"results-list\" v-if=\"categories.length\">\n <div class=\"dropdown-item\" v-for=\"(item, index) in categories\" v-bind:key=\"index\">\n <div>\n <a :href=\"item.href\">{{ item.name }}</a>\n </div>\n </div>\n <hr class=\"dropdown-divider\" v-if=\"byCategory.length\" />\n </div>\n <div class=\"results-list-category\" v-if=\"byCategory.length\">\n <div class=\"dropdown-item categories-list-title\">\n {{ __('shop.search.categories') }}\n </div>\n <div class=\"dropdown-item\" v-for=\"(item, index) in byCategory\" v-bind:key=\"index\">\n <slot name=\"item-category\" :item=\"item\" :searchHrefWithParameter=\"searchHrefWithParameter\">\n <div>\n <a :href=\"item.href + searchHrefWithParameter\">{{ item.name }}</a>\n </div>\n <div>\n {{ __('shop.search.category_found', { count: item.count }) }}\n </div>\n </slot>\n </div>\n </div>\n <div class=\"results-list-total\" v-if=\"total\">\n <p class=\"dropdown-item mb-3 mt-2\">\n {{\n __('shop.search.total_found', {\n total: total\n })\n }}\n <br />\n <a :href=\"searchUrl\">{{ __('shop.search.open_results') }}</a>\n </p>\n </div>\n <div class=\"products-list\" v-if=\"results.length\">\n <div class=\"dropdown-item products-list-title\">\n {{ __('shop.search.products') }}\n </div>\n <div class=\"dropdown-item\" v-for=\"(item, index) in results\" v-bind:key=\"item.id\" v-bind:class=\"{ 'is-active': current == index }\">\n <slot name=\"item\" :user=\"user\" :item=\"item\" :cart-refs=\"cartRefs\">\n <div class=\"columns\">\n <div class=\"column\">\n <div class=\"title\">\n <a :href=\"item.href\">\n {{ item.name }}\n </a>\n </div>\n <div class=\"price\" v-html=\"item.price\"></div>\n <div class=\"price_old\" v-if=\"item.price_old\">\n <span v-html=\"item.price_old\"></span>\n </div>\n <div class=\"code\">{{ item.code }}</div>\n <div class=\"quantity\" v-if=\"item.quantity\">\n {{ __('shop.search.in_stock') }}\n </div>\n <span class=\"no-quantity\" v-else>\n {{ __('shop.search.out_stock') }}\n </span>\n </div>\n <div class=\"column is-narrow\" v-if=\"!item.is_eol\">\n <cart-add :id=\"item.id\" :is-change-quantity=\"false\" :is-already-in-cart=\"false\" :ref=\"cartRefs\"></cart-add>\n </div>\n <div v-else class=\"column is-eol\">\n {{ __('shop.search.eol') }}\n </div>\n </div>\n </slot>\n </div>\n </div>\n </div>\n <div class=\"dropdown-content\" v-if=\"!isLoading && !results.length && !categories.length\">\n <div class=\"dropdown-item\">\n <div class=\"no-results\" v-html=\"__('shop.search.no_results')\"></div>\n </div>\n </div>\n </div>\n </div>\n </div>\n</template>\n<script>\nimport { ref, watch, onBeforeUpdate, defineComponent, computed } from 'vue';\nimport { useStore } from 'vuex';\nimport { shop as api } from '@perevorot/shop/dist/api';\nimport SimpleBar from 'simplebar';\nimport SecureLS from 'secure-ls';\n\nexport default /*#__PURE__*/ defineComponent({\n name: 'search',\n props: {\n q: {\n type: String,\n default: ''\n },\n placeholder: {\n type: String,\n default: ''\n },\n placeholderMobile: {\n type: String,\n default: ''\n },\n parameter: {\n type: String,\n default: '/q{separator}'\n },\n isHistory: {\n type: Boolean,\n default: true\n },\n isToggleDropdownOnClose: {\n type: Boolean,\n default: true\n },\n htmlClass: {\n type: String,\n default: ''\n }\n },\n setup(props) {\n const ls = new SecureLS({\n isCompression: false\n });\n\n let q = props.q;\n\n if (q) {\n let encoder = document.createElement('textarea');\n encoder.innerHTML = q;\n q = encoder.value;\n }\n\n const isLoading = ref(false);\n const term = ref(q);\n const results = ref([]);\n const byCategory = ref([]);\n const total = ref(0);\n const current = ref(-1);\n const isDropdown = ref(false);\n const input = ref();\n const separator = ref('');\n const dropdownContent = ref();\n const history = ref(ls.get('search'));\n const menu = ref([]);\n const store = useStore();\n const user = computed(() => store.getters['auth/me']);\n\n let refs = [];\n let timeout;\n\n const search = () => {\n clearTimeout(timeout);\n\n current.value = -1;\n\n if (!term.value.trim()) {\n results.value = [];\n isLoading.value = false;\n } else {\n isLoading.value = true;\n\n //timeout = setTimeout(() => {\n if (term.value.trim()) {\n api.search(term.value)\n .then((response) => {\n if (response.data) {\n saveSearch();\n\n results.value = response.data.products;\n total.value = response.data.total;\n separator.value = response.data.separator;\n byCategory.value = response.data.byCategory;\n\n const scrollBar = new SimpleBar(dropdownContent.value);\n }\n })\n .finally(() => {\n isLoading.value = false;\n });\n }\n //}, 500);\n }\n };\n\n const saveSearch = () => {\n if (term.value.length > 1) {\n let search = ls.get('search') ? ls.get('search') : [];\n\n if (search.indexOf(term.value) !== -1) {\n search = search.filter((item) => item !== term.value);\n }\n\n if (search.length > 4) {\n search = search.slice(0, 4);\n }\n\n search.unshift(term.value);\n\n ls.set('search', search);\n\n history.value = search;\n }\n };\n\n const setSearchHistory = (term) => {\n term.value = term;\n };\n\n const clearSearchHistory = (event) => {\n ls.remove('search');\n\n history.value = [];\n\n input.value.focus();\n };\n\n onBeforeUpdate(() => {\n refs = [];\n });\n\n watch(\n () => term.value,\n () => {\n isDropdown.value = true;\n current.value = -1;\n search();\n }\n );\n\n const searchUrl = computed(() => {\n return term.value ? $env.locale.url + '/search' + searchHrefWithParameter.value : $env.locale.url + '/search';\n });\n\n const searchHrefWithParameter = computed(() => {\n return props.parameter.replace('{separator}', separator.value) + term.value.toLowerCase();\n });\n\n const preventCaret = (event) => {\n if (event.which == 38 || event.which == 40 || (event.which == 32 && current.value >= 0)) {\n event.preventDefault();\n }\n };\n\n const next = () => {\n if (current.value < results.value.length - 1) {\n current.value++;\n }\n };\n\n const prev = () => {\n if (current.value >= 0) {\n current.value--;\n }\n };\n\n const add = (event) => {\n if (current.value >= 0) {\n event.preventDefault();\n\n refs[current.value].add();\n }\n };\n\n const open = () => {\n if (current.value >= 0) {\n window.location.href = results.value[current.value].href;\n } else {\n window.location.href = searchUrl.value;\n }\n };\n\n const esc = (event) => {\n input.value.blur();\n close(event);\n };\n\n const cartRefs = (el) => {\n if (el) {\n refs.push(el);\n }\n };\n\n const close = (event) => {\n if (!event.target.closest('.cart')) {\n if (props.isToggleDropdownOnClose) {\n isDropdown.value = false;\n if (props.htmlClass) {\n document.querySelector('html').classList.remove(props.htmlClass);\n }\n }\n\n current.value = -1;\n }\n };\n\n const dropdown = () => {\n isDropdown.value = true;\n current.value = -1;\n\n if (props.htmlClass) {\n document.querySelector('html').classList.add(props.htmlClass);\n }\n };\n\n window.addEventListener('click', close);\n\n const categories = computed(() => {\n return term.value.length > 3 ? menu.value.filter((item) => item.search.indexOf(term.value) !== -1) : [];\n });\n\n const load = async () => {\n const menuElement = document.getElementById('menu');\n\n if (menuElement) {\n menuElement.querySelectorAll('[data-search]').forEach((element) => {\n const name = element.textContent.trim();\n const data = element.dataset.search;\n\n menu.value.push({\n name: (data ? data + ' / ' : '') + name,\n search: name.toLowerCase(),\n href: element.closest('a').href\n });\n });\n }\n\n if (props.q) {\n search();\n }\n };\n\n document.addEventListener('DOMContentLoaded', load, false);\n\n const clear = () => {\n term.value = '';\n input.value.focus();\n };\n\n const placeholderMobilized = ref(props.placeholder);\n\n if (props.placeholderMobile) {\n const switchPlaceholder = () => {\n const isMobile = window.matchMedia('(max-width: 768px)').matches;\n\n placeholderMobilized.value = isMobile ? props.placeholderMobile : props.placeholder;\n };\n\n window.addEventListener('resize', switchPlaceholder);\n\n switchPlaceholder();\n }\n\n return {\n isLoading,\n term,\n results,\n next,\n prev,\n current,\n add,\n cartRefs,\n isDropdown,\n preventCaret,\n esc,\n input,\n dropdown,\n total,\n searchUrl,\n searchHrefWithParameter,\n open,\n categories,\n byCategory,\n dropdownContent,\n history,\n clearSearchHistory,\n setSearchHistory,\n user,\n clear,\n placeholderMobilized,\n };\n }\n});\n</script>","<template>\n <div class=\"shop-search\" @click=\"$event.stopPropagation()\">\n <div class=\"dropdown\" v-bind:class=\"{\n 'is-active': isDropdown,\n 'is-dropdown-visible': isDropdown && ((history.length && !term) || results.length || categories.length || (term && !isLoading && !results.length && !categories.length))\n }\">\n <div class=\"overlay search-overlay\" @click=\"esc($event)\" v-if=\"!htmlClass\"></div>\n <div class=\"dropdown-trigger\">\n <div class=\"control has-icons-right\" v-bind:class=\"{ 'is-loading': isLoading }\">\n <input class=\"input\" type=\"text\" v-model=\"term\" ref=\"input\" :placeholder=\"placeholderMobilized\" @keyup.arrow-down=\"next\" @keyup.arrow-up=\"prev\" @keyup.space=\"add($event)\" @keyup.enter=\"open\" @keyup.esc=\"esc($event)\" @click=\"dropdown\" @keydown=\"preventCaret($event)\" />\n <slot name=\"clear\" :clear=\"clear\" :term=\"term\"></slot>\n <slot name=\"icon\" :isLoading=\"isLoading\">\n <span class=\"icon is-small is-right\" v-show=\"!isLoading\">\n <i class=\"fas fa-search\"></i>\n </span>\n </slot>\n </div>\n </div>\n <div class=\"dropdown-menu\" v-if=\"isHistory && isDropdown && history.length && !term\">\n <div class=\"dropdown-content\">\n <div class=\"history-list\">\n <div class=\"dropdown-item history-list-title\">\n <p>{{ __('shop.search.history') }}</p>\n </div>\n <div class=\"dropdown-item\" v-for=\"(item, index) in history\" v-bind:key=\"index\">\n <a @click=\"term = item\">{{ item }}</a>\n </div>\n <div class=\"dropdown-item history-list-clear\">\n <a @click=\"clearSearchHistory($event)\">{{ __('shop.search.history_clear') }}</a>\n </div>\n </div>\n </div>\n </div>\n <div class=\"dropdown-menu\" v-show=\"results.length || term\">\n <div class=\"dropdown-content\" v-show=\"results.length || categories.length\" style=\"max-height: 600px; overflow: auto\" ref=\"dropdownContent\">\n <slot name=\"results-header\"></slot>\n <div class=\"results-list\" v-if=\"categories.length\">\n <div class=\"dropdown-item\" v-for=\"(item, index) in categories\" v-bind:key=\"index\">\n <div>\n <a :href=\"item.href\">{{ item.name }}</a>\n </div>\n </div>\n <hr class=\"dropdown-divider\" v-if=\"byCategory.length\" />\n </div>\n <div class=\"results-list-category\" v-if=\"byCategory.length\">\n <div class=\"dropdown-item categories-list-title\">\n {{ __('shop.search.categories') }}\n </div>\n <div class=\"dropdown-item\" v-for=\"(item, index) in byCategory\" v-bind:key=\"index\">\n <slot name=\"item-category\" :item=\"item\" :searchHrefWithParameter=\"searchHrefWithParameter\">\n <div>\n <a :href=\"item.href + searchHrefWithParameter\">{{ item.name }}</a>\n </div>\n <div>\n {{ __('shop.search.category_found', { count: item.count }) }}\n </div>\n </slot>\n </div>\n </div>\n <div class=\"results-list-total\" v-if=\"total\">\n <p class=\"dropdown-item mb-3 mt-2\">\n {{\n __('shop.search.total_found', {\n total: total\n })\n }}\n <br />\n <a :href=\"searchUrl\">{{ __('shop.search.open_results') }}</a>\n </p>\n </div>\n <div class=\"products-list\" v-if=\"results.length\">\n <div class=\"dropdown-item products-list-title\">\n {{ __('shop.search.products') }}\n </div>\n <div class=\"dropdown-item\" v-for=\"(item, index) in results\" v-bind:key=\"item.id\" v-bind:class=\"{ 'is-active': current == index }\">\n <slot name=\"item\" :user=\"user\" :item=\"item\" :cart-refs=\"cartRefs\">\n <div class=\"columns\">\n <div class=\"column\">\n <div class=\"title\">\n <a :href=\"item.href\">\n {{ item.name }}\n </a>\n </div>\n <div class=\"price\" v-html=\"item.price\"></div>\n <div class=\"price_old\" v-if=\"item.price_old\">\n <span v-html=\"item.price_old\"></span>\n </div>\n <div class=\"code\">{{ item.code }}</div>\n <div class=\"quantity\" v-if=\"item.quantity\">\n {{ __('shop.search.in_stock') }}\n </div>\n <span class=\"no-quantity\" v-else>\n {{ __('shop.search.out_stock') }}\n </span>\n </div>\n <div class=\"column is-narrow\" v-if=\"!item.is_eol\">\n <cart-add :id=\"item.id\" :is-change-quantity=\"false\" :is-already-in-cart=\"false\" :ref=\"cartRefs\"></cart-add>\n </div>\n <div v-else class=\"column is-eol\">\n {{ __('shop.search.eol') }}\n </div>\n </div>\n </slot>\n </div>\n </div>\n </div>\n <div class=\"dropdown-content\" v-if=\"!isLoading && !results.length && !categories.length\">\n <div class=\"dropdown-item\">\n <div class=\"no-results\" v-html=\"__('shop.search.no_results')\"></div>\n </div>\n </div>\n </div>\n </div>\n </div>\n</template>\n<script>\nimport { ref, watch, onBeforeUpdate, defineComponent, computed } from 'vue';\nimport { useStore } from 'vuex';\nimport { shop as api } from '@perevorot/shop/dist/api';\nimport SimpleBar from 'simplebar';\nimport SecureLS from 'secure-ls';\n\nexport default /*#__PURE__*/ defineComponent({\n name: 'search',\n props: {\n q: {\n type: String,\n default: ''\n },\n placeholder: {\n type: String,\n default: ''\n },\n placeholderMobile: {\n type: String,\n default: ''\n },\n parameter: {\n type: String,\n default: '/q{separator}'\n },\n isHistory: {\n type: Boolean,\n default: true\n },\n isToggleDropdownOnClose: {\n type: Boolean,\n default: true\n },\n htmlClass: {\n type: String,\n default: ''\n }\n },\n setup(props) {\n const ls = new SecureLS({\n isCompression: false\n });\n\n let q = props.q;\n\n if (q) {\n let encoder = document.createElement('textarea');\n encoder.innerHTML = q;\n q = encoder.value;\n }\n\n const isLoading = ref(false);\n const term = ref(q);\n const results = ref([]);\n const byCategory = ref([]);\n const total = ref(0);\n const current = ref(-1);\n const isDropdown = ref(false);\n const input = ref();\n const separator = ref('');\n const dropdownContent = ref();\n const history = ref(ls.get('search'));\n const menu = ref([]);\n const store = useStore();\n const user = computed(() => store.getters['auth/me']);\n\n let refs = [];\n let timeout;\n\n const search = () => {\n clearTimeout(timeout);\n\n current.value = -1;\n\n if (!term.value.trim()) {\n results.value = [];\n isLoading.value = false;\n } else {\n isLoading.value = true;\n\n //timeout = setTimeout(() => {\n if (term.value.trim()) {\n api.search(term.value)\n .then((response) => {\n if (response.data) {\n saveSearch();\n\n results.value = response.data.products;\n total.value = response.data.total;\n separator.value = response.data.separator;\n byCategory.value = response.data.byCategory;\n\n const scrollBar = new SimpleBar(dropdownContent.value);\n }\n })\n .finally(() => {\n isLoading.value = false;\n });\n }\n //}, 500);\n }\n };\n\n const saveSearch = () => {\n if (term.value.length > 1) {\n let search = ls.get('search') ? ls.get('search') : [];\n\n if (search.indexOf(term.value) !== -1) {\n search = search.filter((item) => item !== term.value);\n }\n\n if (search.length > 4) {\n search = search.slice(0, 4);\n }\n\n search.unshift(term.value);\n\n ls.set('search', search);\n\n history.value = search;\n }\n };\n\n const setSearchHistory = (term) => {\n term.value = term;\n };\n\n const clearSearchHistory = (event) => {\n ls.remove('search');\n\n history.value = [];\n\n input.value.focus();\n };\n\n onBeforeUpdate(() => {\n refs = [];\n });\n\n watch(\n () => term.value,\n () => {\n isDropdown.value = true;\n current.value = -1;\n search();\n }\n );\n\n const searchUrl = computed(() => {\n return term.value ? $env.locale.url + '/search' + searchHrefWithParameter.value : $env.locale.url + '/search';\n });\n\n const searchHrefWithParameter = computed(() => {\n return props.parameter.replace('{separator}', separator.value) + term.value.toLowerCase();\n });\n\n const preventCaret = (event) => {\n if (event.which == 38 || event.which == 40 || (event.which == 32 && current.value >= 0)) {\n event.preventDefault();\n }\n };\n\n const next = () => {\n if (current.value < results.value.length - 1) {\n current.value++;\n }\n };\n\n const prev = () => {\n if (current.value >= 0) {\n current.value--;\n }\n };\n\n const add = (event) => {\n if (current.value >= 0) {\n event.preventDefault();\n\n refs[current.value].add();\n }\n };\n\n const open = () => {\n if (current.value >= 0) {\n window.location.href = results.value[current.value].href;\n } else {\n window.location.href = searchUrl.value;\n }\n };\n\n const esc = (event) => {\n input.value.blur();\n close(event);\n };\n\n const cartRefs = (el) => {\n if (el) {\n refs.push(el);\n }\n };\n\n const close = (event) => {\n if (!event.target.closest('.cart')) {\n if (props.isToggleDropdownOnClose) {\n isDropdown.value = false;\n if (props.htmlClass) {\n document.querySelector('html').classList.remove(props.htmlClass);\n }\n }\n\n current.value = -1;\n }\n };\n\n const dropdown = () => {\n isDropdown.value = true;\n current.value = -1;\n\n if (props.htmlClass) {\n document.querySelector('html').classList.add(props.htmlClass);\n }\n };\n\n window.addEventListener('click', close);\n\n const categories = computed(() => {\n return term.value.length > 3 ? menu.value.filter((item) => item.search.indexOf(term.value) !== -1) : [];\n });\n\n const load = async () => {\n const menuElement = document.getElementById('menu');\n\n if (menuElement) {\n menuElement.querySelectorAll('[data-search]').forEach((element) => {\n const name = element.textContent.trim();\n const data = element.dataset.search;\n\n menu.value.push({\n name: (data ? data + ' / ' : '') + name,\n search: name.toLowerCase(),\n href: element.closest('a').href\n });\n });\n }\n\n if (props.q) {\n search();\n }\n };\n\n document.addEventListener('DOMContentLoaded', load, false);\n\n const clear = () => {\n term.value = '';\n input.value.focus();\n };\n\n const placeholderMobilized = ref(props.placeholder);\n\n if (props.placeholderMobile) {\n const switchPlaceholder = () => {\n const isMobile = window.matchMedia('(max-width: 768px)').matches;\n\n placeholderMobilized.value = isMobile ? props.placeholderMobile : props.placeholder;\n };\n\n window.addEventListener('resize', switchPlaceholder);\n\n switchPlaceholder();\n }\n\n return {\n isLoading,\n term,\n results,\n next,\n prev,\n current,\n add,\n cartRefs,\n isDropdown,\n preventCaret,\n esc,\n input,\n dropdown,\n total,\n searchUrl,\n searchHrefWithParameter,\n open,\n categories,\n byCategory,\n dropdownContent,\n history,\n clearSearchHistory,\n setSearchHistory,\n user,\n clear,\n placeholderMobilized,\n };\n }\n});\n</script>"],"names":["defineComponent","name","props","q","type","String","placeholder","placeholderMobile","parameter","isHistory","Boolean","isToggleDropdownOnClose","htmlClass","setup","ls","SecureLS","isCompression","encoder","document","createElement","innerHTML","value","isLoading","ref","term","results","byCategory","total","current","isDropdown","input","separator","dropdownContent","history","get","menu","store","useStore","user","computed","getters","refs","search","clearTimeout","timeout","trim","api","then","response","data","saveSearch","products","SimpleBar","length","indexOf","filter","item","slice","unshift","set","onBeforeUpdate","watch","searchUrl","$env","locale","url","searchHrefWithParameter","replace","toLowerCase","close","event","target","closest","querySelector","classList","remove","window","addEventListener","f","categories","load","direct","menuElement","getElementById","querySelectorAll","forEach","element","textContent","dataset","push","href","arguments","i","resolve","apply","this","placeholderMobilized","switchPlaceholder","isMobile","matchMedia","matches","next","prev","add","preventDefault","cartRefs","el","preventCaret","which","esc","blur","dropdown","open","location","clearSearchHistory","focus","setSearchHistory","clear","_createElementVNode","style","_createElementBlock","onClick","$event","stopPropagation","_ctx","_hoisted_1","onKeyup","onKeydown","_renderSlot","_hoisted_3","_hoisted_6","_hoisted_7","_hoisted_8","_hoisted_9","index","key","_hoisted_11","_hoisted_12","_hoisted_13","_hoisted_14","_hoisted_16","_hoisted_17","_hoisted_18","count","_hoisted_20","_hoisted_21","_hoisted_22","_hoisted_24","_hoisted_25","id","_hoisted_26","_hoisted_27","_hoisted_28","price","price_old","_hoisted_31","_hoisted_33","code","quantity","_hoisted_34","_hoisted_35","is_eol","_hoisted_37","_hoisted_36","_createVNode","_hoisted_38","_hoisted_39"],"mappings":"kOA0HA,MAA6BA,kBAAgB,CACzCC,KAAM,SACNC,MAAO,CACHC,EAAG,CACCC,KAAMC,eACG,IAEbC,YAAa,CACTF,KAAMC,eACG,IAEbE,kBAAmB,CACfH,KAAMC,eACG,IAEbG,UAAW,CACPJ,KAAMC,eACG,iBAEbI,UAAW,CACPL,KAAMM,iBACG,GAEbC,wBAAyB,CACrBP,KAAMM,iBACG,GAEbE,UAAW,CACPR,KAAMC,eACG,KAGjBQ,eAAMX,OACIY,EAAK,IAAIC,UAAS,CACpBC,eAAe,IAGfb,EAAID,EAAMC,KAEVA,EAAG,KACCc,EAAUC,SAASC,cAAc,YACrCF,EAAQG,UAAYjB,EACpBA,EAAIc,EAAQI,UAGVC,EAAYC,OAAI,GAChBC,EAAOD,MAAIpB,GACXsB,EAAUF,MAAI,IACdG,EAAaH,MAAI,IACjBI,EAAQJ,MAAI,GACZK,EAAUL,OAAK,GACfM,EAAaN,OAAI,GACjBO,EAAQP,QACRQ,EAAYR,MAAI,IAChBS,EAAkBT,QAClBU,EAAUV,MAAIT,EAAGoB,IAAI,WACrBC,EAAOZ,MAAI,IACXa,EAAQC,aACRC,EAAOC,YAAS,kBAAMH,EAAMI,QAAQ,cAEtCC,EAAO,GAGLC,EAAS,WACXC,kBAHAC,GAKAhB,EAAQP,OAAS,EAEZG,EAAKH,MAAMwB,QAIZvB,EAAUD,OAAQ,EAGdG,EAAKH,MAAMwB,QACXC,OAAIJ,OAAOlB,EAAK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AWU,KAAtDC,IAAK/E,EAAK6F,KACzErB,8BAAmB1F,KAAMsF,OAAOpE,KAAMA,EAAOiD,SAAWmB,aAAxD,kBACIN,2BAAAgC,GACIhC,2BAAAiC,GACIjC,2BAAAkC,GACIlC,0BAAI5B,KAAMlC,EAAKkC,wBACRlC,EAAKvD,aAGhBqH,kCAAW,QAAQlG,UAAQoC,EAAKiG,iBACHjG,EAAKkG,yBAAlClC,2BAAAmC,GACIrC,6BAAMlG,UAAQoC,EAAKkG,wDAEvBpC,2BAAAsC,oBAAqBpG,EAAKqG,SACErG,EAAKsG,wBAAjCtC,2BAAAuC,oBACOnC,iDAEPJ,4BAAAwC,oBACOpC,qCAG0BpE,EAAKyG,sBAG1CzC,2BAAA0C,oBACOtC,4CAJPJ,2BAAA2C,GACIC,iBAAWf,GAAI7F,EAAK6F,yBAAyB,wBAA4B,aAAQ9H,IAAKqG,oGA9DxEA,UAAQvE,QAAUuE,aAAWvE,UAwE9BuE,aAAcA,UAAQvE,QAAWuE,aAAWvE,sDAAjFmE,2BAAA6C,GACI/C,2BAAAgD,GACIhD,kCAAW,aAAalG,UAAQwG,+DA3ETA,UAAQvE,QAAUuE"}
|
|
1
|
+
{"version":3,"file":"Search.js","sources":["../../../src/components/shop/Search.vue","../../../src/components/shop/Search.vue?vue&type=template&id=135a1b70&lang.js"],"sourcesContent":["<template>\n <div class=\"shop-search\" @click=\"$event.stopPropagation()\">\n <div class=\"dropdown\" v-bind:class=\"{\n 'is-active': isDropdown,\n 'is-dropdown-visible': isDropdown && ((history.length && !term) || results.length || categories.length || (term && !isLoading && !results.length && !categories.length))\n }\">\n <div class=\"overlay search-overlay\" @click=\"esc($event)\" v-if=\"!htmlClass\"></div>\n <div class=\"dropdown-trigger\">\n <div class=\"control has-icons-right\" v-bind:class=\"{ 'is-loading': isLoading }\">\n <input class=\"input\" type=\"text\" v-model=\"term\" ref=\"input\" :placeholder=\"placeholderMobilized\" @keyup.arrow-down=\"next\" @keyup.arrow-up=\"prev\" @keyup.space=\"add($event)\" @keyup.enter=\"open\" @keyup.esc=\"esc($event)\" @click=\"dropdown\" @keydown=\"preventCaret($event)\" />\n <slot name=\"clear\" :clear=\"clear\" :term=\"term\"></slot>\n <slot name=\"icon\" :isLoading=\"isLoading\">\n <span class=\"icon is-small is-right\" v-show=\"!isLoading\">\n <i class=\"fas fa-search\"></i>\n </span>\n </slot>\n </div>\n </div>\n <div class=\"dropdown-menu\" v-if=\"isHistory && isDropdown && history.length && !term\">\n <div class=\"dropdown-content\">\n <div class=\"history-list\">\n <div class=\"dropdown-item history-list-title\">\n <p>{{ __('shop.search.history') }}</p>\n </div>\n <div class=\"dropdown-item\" v-for=\"(item, index) in history\" v-bind:key=\"index\">\n <a @click=\"term = item\">{{ item }}</a>\n </div>\n <div class=\"dropdown-item history-list-clear\">\n <a @click=\"clearSearchHistory($event)\">{{ __('shop.search.history_clear') }}</a>\n </div>\n </div>\n </div>\n </div>\n <div class=\"dropdown-menu\" v-show=\"results.length || term\">\n <div class=\"dropdown-content\" v-show=\"results.length || categories.length\" style=\"max-height: 600px; overflow: auto\" ref=\"dropdownContent\">\n <slot name=\"results-header\"></slot>\n <div class=\"results-list\" v-if=\"categories.length\">\n <div class=\"dropdown-item\" v-for=\"(item, index) in categories\" v-bind:key=\"index\">\n <div>\n <a :href=\"item.href\">{{ item.name }}</a>\n </div>\n </div>\n <hr class=\"dropdown-divider\" v-if=\"byCategory.length\" />\n </div>\n <div class=\"results-list-category\" v-if=\"byCategory.length\">\n <div class=\"dropdown-item categories-list-title\">\n {{ __('shop.search.categories') }}\n </div>\n <div class=\"dropdown-item\" v-for=\"(item, index) in byCategory\" v-bind:key=\"index\">\n <slot name=\"item-category\" :item=\"item\" :searchHrefWithParameter=\"searchHrefWithParameter\">\n <div>\n <a :href=\"item.href + searchHrefWithParameter\">{{ item.name }}</a>\n </div>\n <div>\n {{ __('shop.search.category_found', { count: item.count }) }}\n </div>\n </slot>\n </div>\n </div>\n <div class=\"results-list-total\" v-if=\"total\">\n <p class=\"dropdown-item mb-3 mt-2\">\n {{\n __('shop.search.total_found', {\n total: total\n })\n }}\n <br />\n <a :href=\"searchUrl\">{{ __('shop.search.open_results') }}</a>\n </p>\n </div>\n <div class=\"products-list\" v-if=\"results.length\">\n <div class=\"dropdown-item products-list-title\">\n {{ __('shop.search.products') }}\n </div>\n <div class=\"dropdown-item\" v-for=\"(item, index) in results\" v-bind:key=\"item.id\" v-bind:class=\"{ 'is-active': current == index }\">\n <slot name=\"item\" :user=\"user\" :item=\"item\" :cart-refs=\"cartRefs\">\n <div class=\"columns\">\n <div class=\"column\">\n <div class=\"title\">\n <a :href=\"item.href\">\n {{ item.name }}\n </a>\n </div>\n <div class=\"price\" v-html=\"item.price\"></div>\n <div class=\"price_old\" v-if=\"item.price_old\">\n <span v-html=\"item.price_old\"></span>\n </div>\n <div class=\"code\">{{ item.code }}</div>\n <div class=\"quantity\" v-if=\"item.quantity\">\n {{ __('shop.search.in_stock') }}\n </div>\n <span class=\"no-quantity\" v-else>\n {{ __('shop.search.out_stock') }}\n </span>\n </div>\n <div class=\"column is-narrow\" v-if=\"!item.is_eol\">\n <cart-add :id=\"item.id\" :is-change-quantity=\"false\" :is-already-in-cart=\"false\" :ref=\"cartRefs\"></cart-add>\n </div>\n <div v-else class=\"column is-eol\">\n {{ __('shop.search.eol') }}\n </div>\n </div>\n </slot>\n </div>\n </div>\n </div>\n <div class=\"dropdown-content\" v-if=\"!isLoading && !results.length && !categories.length\">\n <div class=\"dropdown-item\">\n <div class=\"no-results\" v-html=\"__('shop.search.no_results')\"></div>\n </div>\n </div>\n </div>\n </div>\n </div>\n</template>\n<script>\nimport { ref, watch, onBeforeUpdate, defineComponent, computed } from 'vue';\nimport { useStore } from 'vuex';\nimport { shop as api } from '@perevorot/shop/dist/api';\nimport SimpleBar from 'simplebar';\nimport SecureLS from 'secure-ls';\n\nexport default /*#__PURE__*/ defineComponent({\n name: 'search',\n props: {\n q: {\n type: String,\n default: ''\n },\n placeholder: {\n type: String,\n default: ''\n },\n placeholderMobile: {\n type: String,\n default: ''\n },\n parameter: {\n type: String,\n default: '/q{separator}'\n },\n isHistory: {\n type: Boolean,\n default: true\n },\n isToggleDropdownOnClose: {\n type: Boolean,\n default: true\n },\n htmlClass: {\n type: String,\n default: ''\n }\n },\n setup(props) {\n const ls = new SecureLS({\n isCompression: false\n });\n\n let q = props.q;\n\n if (q) {\n let encoder = document.createElement('textarea');\n encoder.innerHTML = q;\n q = encoder.value;\n }\n\n const isLoading = ref(false);\n const term = ref(q);\n const results = ref([]);\n const byCategory = ref([]);\n const total = ref(0);\n const current = ref(-1);\n const isDropdown = ref(false);\n const input = ref();\n const separator = ref('');\n const dropdownContent = ref();\n const history = ref(ls.get('search'));\n const menu = ref([]);\n const store = useStore();\n const user = computed(() => store.getters['auth/me']);\n\n let refs = [];\n let timeout;\n\n const search = () => {\n clearTimeout(timeout);\n\n current.value = -1;\n\n if (!term.value.trim()) {\n results.value = [];\n isLoading.value = false;\n } else {\n isLoading.value = true;\n\n //timeout = setTimeout(() => {\n if (term.value.trim()) {\n api.search(term.value)\n .then((response) => {\n if (response.data) {\n saveSearch();\n\n results.value = response.data.products;\n total.value = response.data.total;\n separator.value = response.data.separator;\n byCategory.value = response.data.byCategory;\n\n const scrollBar = new SimpleBar(dropdownContent.value);\n }\n })\n .finally(() => {\n isLoading.value = false;\n });\n }\n //}, 500);\n }\n };\n\n const saveSearch = () => {\n if (term.value.length > 1) {\n let search = ls.get('search') ? ls.get('search') : [];\n\n if (search.indexOf(term.value) !== -1) {\n search = search.filter((item) => item !== term.value);\n }\n\n if (search.length > 4) {\n search = search.slice(0, 4);\n }\n\n search.unshift(term.value);\n\n ls.set('search', search);\n\n history.value = search;\n }\n };\n\n const setSearchHistory = (term) => {\n term.value = term;\n };\n\n const clearSearchHistory = (event) => {\n ls.remove('search');\n\n history.value = [];\n\n input.value.focus();\n };\n\n onBeforeUpdate(() => {\n refs = [];\n });\n\n watch(\n () => term.value,\n () => {\n isDropdown.value = true;\n current.value = -1;\n search();\n }\n );\n\n const searchUrl = computed(() => {\n return term.value ? $env.locale.url + '/search' + searchHrefWithParameter.value : $env.locale.url + '/search';\n });\n\n const searchHrefWithParameter = computed(() => {\n return props.parameter.replace('{separator}', separator.value) + term.value.toLowerCase();\n });\n\n const preventCaret = (event) => {\n if (event.which == 38 || event.which == 40 || (event.which == 32 && current.value >= 0)) {\n event.preventDefault();\n }\n };\n\n const next = () => {\n if (current.value < results.value.length - 1) {\n current.value++;\n }\n };\n\n const prev = () => {\n if (current.value >= 0) {\n current.value--;\n }\n };\n\n const add = (event) => {\n if (current.value >= 0) {\n event.preventDefault();\n\n refs[current.value].add();\n }\n };\n\n const open = () => {\n if (current.value >= 0) {\n window.location.href = results.value[current.value].href;\n } else {\n window.location.href = searchUrl.value;\n }\n };\n\n const esc = (event) => {\n input.value.blur();\n close(event);\n };\n\n const cartRefs = (el) => {\n if (el) {\n refs.push(el);\n }\n };\n\n const close = (event) => {\n if (!event.target.closest('.cart')) {\n if (props.isToggleDropdownOnClose) {\n isDropdown.value = false;\n if (props.htmlClass) {\n document.querySelector('html').classList.remove(props.htmlClass);\n }\n }\n\n current.value = -1;\n }\n };\n\n const dropdown = () => {\n isDropdown.value = true;\n current.value = -1;\n\n if (props.htmlClass) {\n document.querySelector('html').classList.add(props.htmlClass);\n }\n };\n\n window.addEventListener('click', close);\n\n const categories = computed(() => {\n return term.value.length > 3 ? menu.value.filter((item) => item.search.indexOf(term.value) !== -1) : [];\n });\n\n const load = async () => {\n const menuElement = document.getElementById('menu');\n\n if (menuElement) {\n menuElement.querySelectorAll('[data-search]').forEach((element) => {\n const name = element.textContent.trim();\n const data = element.dataset.search;\n\n menu.value.push({\n name: (data ? data + ' / ' : '') + name,\n search: name.toLowerCase(),\n href: element.closest('a').href\n });\n });\n }\n\n if (props.q) {\n search();\n }\n };\n\n document.addEventListener('DOMContentLoaded', load, false);\n\n const clear = () => {\n term.value = '';\n input.value.focus();\n };\n\n const placeholderMobilized = ref(props.placeholder);\n\n if (props.placeholderMobile) {\n const switchPlaceholder = () => {\n const isMobile = window.matchMedia('(max-width: 768px)').matches;\n\n placeholderMobilized.value = isMobile ? props.placeholderMobile : props.placeholder;\n };\n\n window.addEventListener('resize', switchPlaceholder, { passive: true });\n\n switchPlaceholder();\n }\n\n return {\n isLoading,\n term,\n results,\n next,\n prev,\n current,\n add,\n cartRefs,\n isDropdown,\n preventCaret,\n esc,\n input,\n dropdown,\n total,\n searchUrl,\n searchHrefWithParameter,\n open,\n categories,\n byCategory,\n dropdownContent,\n history,\n clearSearchHistory,\n setSearchHistory,\n user,\n clear,\n placeholderMobilized,\n };\n }\n});\n</script>","<template>\n <div class=\"shop-search\" @click=\"$event.stopPropagation()\">\n <div class=\"dropdown\" v-bind:class=\"{\n 'is-active': isDropdown,\n 'is-dropdown-visible': isDropdown && ((history.length && !term) || results.length || categories.length || (term && !isLoading && !results.length && !categories.length))\n }\">\n <div class=\"overlay search-overlay\" @click=\"esc($event)\" v-if=\"!htmlClass\"></div>\n <div class=\"dropdown-trigger\">\n <div class=\"control has-icons-right\" v-bind:class=\"{ 'is-loading': isLoading }\">\n <input class=\"input\" type=\"text\" v-model=\"term\" ref=\"input\" :placeholder=\"placeholderMobilized\" @keyup.arrow-down=\"next\" @keyup.arrow-up=\"prev\" @keyup.space=\"add($event)\" @keyup.enter=\"open\" @keyup.esc=\"esc($event)\" @click=\"dropdown\" @keydown=\"preventCaret($event)\" />\n <slot name=\"clear\" :clear=\"clear\" :term=\"term\"></slot>\n <slot name=\"icon\" :isLoading=\"isLoading\">\n <span class=\"icon is-small is-right\" v-show=\"!isLoading\">\n <i class=\"fas fa-search\"></i>\n </span>\n </slot>\n </div>\n </div>\n <div class=\"dropdown-menu\" v-if=\"isHistory && isDropdown && history.length && !term\">\n <div class=\"dropdown-content\">\n <div class=\"history-list\">\n <div class=\"dropdown-item history-list-title\">\n <p>{{ __('shop.search.history') }}</p>\n </div>\n <div class=\"dropdown-item\" v-for=\"(item, index) in history\" v-bind:key=\"index\">\n <a @click=\"term = item\">{{ item }}</a>\n </div>\n <div class=\"dropdown-item history-list-clear\">\n <a @click=\"clearSearchHistory($event)\">{{ __('shop.search.history_clear') }}</a>\n </div>\n </div>\n </div>\n </div>\n <div class=\"dropdown-menu\" v-show=\"results.length || term\">\n <div class=\"dropdown-content\" v-show=\"results.length || categories.length\" style=\"max-height: 600px; overflow: auto\" ref=\"dropdownContent\">\n <slot name=\"results-header\"></slot>\n <div class=\"results-list\" v-if=\"categories.length\">\n <div class=\"dropdown-item\" v-for=\"(item, index) in categories\" v-bind:key=\"index\">\n <div>\n <a :href=\"item.href\">{{ item.name }}</a>\n </div>\n </div>\n <hr class=\"dropdown-divider\" v-if=\"byCategory.length\" />\n </div>\n <div class=\"results-list-category\" v-if=\"byCategory.length\">\n <div class=\"dropdown-item categories-list-title\">\n {{ __('shop.search.categories') }}\n </div>\n <div class=\"dropdown-item\" v-for=\"(item, index) in byCategory\" v-bind:key=\"index\">\n <slot name=\"item-category\" :item=\"item\" :searchHrefWithParameter=\"searchHrefWithParameter\">\n <div>\n <a :href=\"item.href + searchHrefWithParameter\">{{ item.name }}</a>\n </div>\n <div>\n {{ __('shop.search.category_found', { count: item.count }) }}\n </div>\n </slot>\n </div>\n </div>\n <div class=\"results-list-total\" v-if=\"total\">\n <p class=\"dropdown-item mb-3 mt-2\">\n {{\n __('shop.search.total_found', {\n total: total\n })\n }}\n <br />\n <a :href=\"searchUrl\">{{ __('shop.search.open_results') }}</a>\n </p>\n </div>\n <div class=\"products-list\" v-if=\"results.length\">\n <div class=\"dropdown-item products-list-title\">\n {{ __('shop.search.products') }}\n </div>\n <div class=\"dropdown-item\" v-for=\"(item, index) in results\" v-bind:key=\"item.id\" v-bind:class=\"{ 'is-active': current == index }\">\n <slot name=\"item\" :user=\"user\" :item=\"item\" :cart-refs=\"cartRefs\">\n <div class=\"columns\">\n <div class=\"column\">\n <div class=\"title\">\n <a :href=\"item.href\">\n {{ item.name }}\n </a>\n </div>\n <div class=\"price\" v-html=\"item.price\"></div>\n <div class=\"price_old\" v-if=\"item.price_old\">\n <span v-html=\"item.price_old\"></span>\n </div>\n <div class=\"code\">{{ item.code }}</div>\n <div class=\"quantity\" v-if=\"item.quantity\">\n {{ __('shop.search.in_stock') }}\n </div>\n <span class=\"no-quantity\" v-else>\n {{ __('shop.search.out_stock') }}\n </span>\n </div>\n <div class=\"column is-narrow\" v-if=\"!item.is_eol\">\n <cart-add :id=\"item.id\" :is-change-quantity=\"false\" :is-already-in-cart=\"false\" :ref=\"cartRefs\"></cart-add>\n </div>\n <div v-else class=\"column is-eol\">\n {{ __('shop.search.eol') }}\n </div>\n </div>\n </slot>\n </div>\n </div>\n </div>\n <div class=\"dropdown-content\" v-if=\"!isLoading && !results.length && !categories.length\">\n <div class=\"dropdown-item\">\n <div class=\"no-results\" v-html=\"__('shop.search.no_results')\"></div>\n </div>\n </div>\n </div>\n </div>\n </div>\n</template>\n<script>\nimport { ref, watch, onBeforeUpdate, defineComponent, computed } from 'vue';\nimport { useStore } from 'vuex';\nimport { shop as api } from '@perevorot/shop/dist/api';\nimport SimpleBar from 'simplebar';\nimport SecureLS from 'secure-ls';\n\nexport default /*#__PURE__*/ defineComponent({\n name: 'search',\n props: {\n q: {\n type: String,\n default: ''\n },\n placeholder: {\n type: String,\n default: ''\n },\n placeholderMobile: {\n type: String,\n default: ''\n },\n parameter: {\n type: String,\n default: '/q{separator}'\n },\n isHistory: {\n type: Boolean,\n default: true\n },\n isToggleDropdownOnClose: {\n type: Boolean,\n default: true\n },\n htmlClass: {\n type: String,\n default: ''\n }\n },\n setup(props) {\n const ls = new SecureLS({\n isCompression: false\n });\n\n let q = props.q;\n\n if (q) {\n let encoder = document.createElement('textarea');\n encoder.innerHTML = q;\n q = encoder.value;\n }\n\n const isLoading = ref(false);\n const term = ref(q);\n const results = ref([]);\n const byCategory = ref([]);\n const total = ref(0);\n const current = ref(-1);\n const isDropdown = ref(false);\n const input = ref();\n const separator = ref('');\n const dropdownContent = ref();\n const history = ref(ls.get('search'));\n const menu = ref([]);\n const store = useStore();\n const user = computed(() => store.getters['auth/me']);\n\n let refs = [];\n let timeout;\n\n const search = () => {\n clearTimeout(timeout);\n\n current.value = -1;\n\n if (!term.value.trim()) {\n results.value = [];\n isLoading.value = false;\n } else {\n isLoading.value = true;\n\n //timeout = setTimeout(() => {\n if (term.value.trim()) {\n api.search(term.value)\n .then((response) => {\n if (response.data) {\n saveSearch();\n\n results.value = response.data.products;\n total.value = response.data.total;\n separator.value = response.data.separator;\n byCategory.value = response.data.byCategory;\n\n const scrollBar = new SimpleBar(dropdownContent.value);\n }\n })\n .finally(() => {\n isLoading.value = false;\n });\n }\n //}, 500);\n }\n };\n\n const saveSearch = () => {\n if (term.value.length > 1) {\n let search = ls.get('search') ? ls.get('search') : [];\n\n if (search.indexOf(term.value) !== -1) {\n search = search.filter((item) => item !== term.value);\n }\n\n if (search.length > 4) {\n search = search.slice(0, 4);\n }\n\n search.unshift(term.value);\n\n ls.set('search', search);\n\n history.value = search;\n }\n };\n\n const setSearchHistory = (term) => {\n term.value = term;\n };\n\n const clearSearchHistory = (event) => {\n ls.remove('search');\n\n history.value = [];\n\n input.value.focus();\n };\n\n onBeforeUpdate(() => {\n refs = [];\n });\n\n watch(\n () => term.value,\n () => {\n isDropdown.value = true;\n current.value = -1;\n search();\n }\n );\n\n const searchUrl = computed(() => {\n return term.value ? $env.locale.url + '/search' + searchHrefWithParameter.value : $env.locale.url + '/search';\n });\n\n const searchHrefWithParameter = computed(() => {\n return props.parameter.replace('{separator}', separator.value) + term.value.toLowerCase();\n });\n\n const preventCaret = (event) => {\n if (event.which == 38 || event.which == 40 || (event.which == 32 && current.value >= 0)) {\n event.preventDefault();\n }\n };\n\n const next = () => {\n if (current.value < results.value.length - 1) {\n current.value++;\n }\n };\n\n const prev = () => {\n if (current.value >= 0) {\n current.value--;\n }\n };\n\n const add = (event) => {\n if (current.value >= 0) {\n event.preventDefault();\n\n refs[current.value].add();\n }\n };\n\n const open = () => {\n if (current.value >= 0) {\n window.location.href = results.value[current.value].href;\n } else {\n window.location.href = searchUrl.value;\n }\n };\n\n const esc = (event) => {\n input.value.blur();\n close(event);\n };\n\n const cartRefs = (el) => {\n if (el) {\n refs.push(el);\n }\n };\n\n const close = (event) => {\n if (!event.target.closest('.cart')) {\n if (props.isToggleDropdownOnClose) {\n isDropdown.value = false;\n if (props.htmlClass) {\n document.querySelector('html').classList.remove(props.htmlClass);\n }\n }\n\n current.value = -1;\n }\n };\n\n const dropdown = () => {\n isDropdown.value = true;\n current.value = -1;\n\n if (props.htmlClass) {\n document.querySelector('html').classList.add(props.htmlClass);\n }\n };\n\n window.addEventListener('click', close);\n\n const categories = computed(() => {\n return term.value.length > 3 ? menu.value.filter((item) => item.search.indexOf(term.value) !== -1) : [];\n });\n\n const load = async () => {\n const menuElement = document.getElementById('menu');\n\n if (menuElement) {\n menuElement.querySelectorAll('[data-search]').forEach((element) => {\n const name = element.textContent.trim();\n const data = element.dataset.search;\n\n menu.value.push({\n name: (data ? data + ' / ' : '') + name,\n search: name.toLowerCase(),\n href: element.closest('a').href\n });\n });\n }\n\n if (props.q) {\n search();\n }\n };\n\n document.addEventListener('DOMContentLoaded', load, false);\n\n const clear = () => {\n term.value = '';\n input.value.focus();\n };\n\n const placeholderMobilized = ref(props.placeholder);\n\n if (props.placeholderMobile) {\n const switchPlaceholder = () => {\n const isMobile = window.matchMedia('(max-width: 768px)').matches;\n\n placeholderMobilized.value = isMobile ? props.placeholderMobile : props.placeholder;\n };\n\n window.addEventListener('resize', switchPlaceholder, { passive: true });\n\n switchPlaceholder();\n }\n\n return {\n isLoading,\n term,\n results,\n next,\n prev,\n current,\n add,\n cartRefs,\n isDropdown,\n preventCaret,\n esc,\n input,\n dropdown,\n total,\n searchUrl,\n searchHrefWithParameter,\n open,\n categories,\n byCategory,\n dropdownContent,\n history,\n clearSearchHistory,\n setSearchHistory,\n user,\n clear,\n placeholderMobilized,\n };\n }\n});\n</script>"],"names":["defineComponent","name","props","q","type","String","placeholder","placeholderMobile","parameter","isHistory","Boolean","isToggleDropdownOnClose","htmlClass","setup","ls","SecureLS","isCompression","encoder","document","createElement","innerHTML","value","isLoading","ref","term","results","byCategory","total","current","isDropdown","input","separator","dropdownContent","history","get","menu","store","useStore","user","computed","getters","refs","search","clearTimeout","timeout","trim","api","then","response","data","saveSearch","products","SimpleBar","length","indexOf","filter","item","slice","unshift","set","onBeforeUpdate","watch","searchUrl","$env","locale","url","searchHrefWithParameter","replace","toLowerCase","close","event","target","closest","querySelector","classList","remove","window","addEventListener","f","categories","load","direct","menuElement","getElementById","querySelectorAll","forEach","element","textContent","dataset","push","href","arguments","i","resolve","apply","this","placeholderMobilized","switchPlaceholder","isMobile","matchMedia","matches","passive","next","prev","add","preventDefault","cartRefs","el","preventCaret","which","esc","blur","dropdown","open","location","clearSearchHistory","focus","setSearchHistory","clear","_createElementVNode","style","_createElementBlock","onClick","$event","stopPropagation","_ctx","_hoisted_1","onKeyup","onKeydown","_renderSlot","_hoisted_3","_hoisted_6","_hoisted_7","_hoisted_8","_hoisted_9","index","key","_hoisted_11","_hoisted_12","_hoisted_13","_hoisted_14","_hoisted_16","_hoisted_17","_hoisted_18","count","_hoisted_20","_hoisted_21","_hoisted_22","_hoisted_24","_hoisted_25","id","_hoisted_26","_hoisted_27","_hoisted_28","price","price_old","_hoisted_31","_hoisted_33","code","quantity","_hoisted_34","_hoisted_35","is_eol","_hoisted_37","_hoisted_36","_createVNode","_hoisted_38","_hoisted_39"],"mappings":"kOA0HA,MAA6BA,kBAAgB,CACzCC,KAAM,SACNC,MAAO,CACHC,EAAG,CACCC,KAAMC,eACG,IAEbC,YAAa,CACTF,KAAMC,eACG,IAEbE,kBAAmB,CACfH,KAAMC,eACG,IAEbG,UAAW,CACPJ,KAAMC,eACG,iBAEbI,UAAW,CACPL,KAAMM,iBACG,GAEbC,wBAAyB,CACrBP,KAAMM,iBACG,GAEbE,UAAW,CAC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