@perevorot/shop 1.1.1 → 1.1.2

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.
Files changed (125) hide show
  1. package/dist/api.js +1 -1
  2. package/dist/api.js.map +1 -1
  3. package/dist/app.js +1 -1
  4. package/dist/app.js.map +1 -1
  5. package/dist/global.js +1 -1
  6. package/dist/global.js.map +1 -1
  7. package/dist/helpers.js +1 -1
  8. package/dist/helpers.js.map +1 -1
  9. package/dist/js/components/account/Account.js +1 -1
  10. package/dist/js/components/account/Account.js.map +1 -1
  11. package/dist/js/components/account/OrderItem.js +1 -1
  12. package/dist/js/components/account/OrderItem.js.map +1 -1
  13. package/dist/js/components/account/Orders.js +1 -1
  14. package/dist/js/components/account/Orders.js.map +1 -1
  15. package/dist/js/components/account/User.js +1 -1
  16. package/dist/js/components/account/User.js.map +1 -1
  17. package/dist/js/components/account/Wish.js +1 -1
  18. package/dist/js/components/account/Wish.js.map +1 -1
  19. package/dist/js/components/auth/Forget.js +1 -1
  20. package/dist/js/components/auth/Forget.js.map +1 -1
  21. package/dist/js/components/auth/Login.js +1 -1
  22. package/dist/js/components/auth/Login.js.map +1 -1
  23. package/dist/js/components/auth/Registration.js +1 -1
  24. package/dist/js/components/auth/Registration.js.map +1 -1
  25. package/dist/js/components/auth/Reset.js +1 -1
  26. package/dist/js/components/auth/Reset.js.map +1 -1
  27. package/dist/js/components/auth/User.js +1 -1
  28. package/dist/js/components/auth/User.js.map +1 -1
  29. package/dist/js/components/shop/Catalog.js +1 -1
  30. package/dist/js/components/shop/Catalog.js.map +1 -1
  31. package/dist/js/components/shop/CodeCopy.js +1 -1
  32. package/dist/js/components/shop/CodeCopy.js.map +1 -1
  33. package/dist/js/components/shop/Cross.js +1 -1
  34. package/dist/js/components/shop/Cross.js.map +1 -1
  35. package/dist/js/components/shop/FilterToggle.js +1 -1
  36. package/dist/js/components/shop/FilterToggle.js.map +1 -1
  37. package/dist/js/components/shop/Gallery.js +1 -1
  38. package/dist/js/components/shop/Gallery.js.map +1 -1
  39. package/dist/js/components/shop/Pagination.js +1 -1
  40. package/dist/js/components/shop/Pagination.js.map +1 -1
  41. package/dist/js/components/shop/PromoProducts.js +1 -1
  42. package/dist/js/components/shop/PromoProducts.js.map +1 -1
  43. package/dist/js/components/shop/Search.js +1 -1
  44. package/dist/js/components/shop/Search.js.map +1 -1
  45. package/dist/js/components/shop/bundle/Bundle.js +1 -1
  46. package/dist/js/components/shop/bundle/Bundle.js.map +1 -1
  47. package/dist/js/components/shop/bundle/BundleAdd.js +1 -1
  48. package/dist/js/components/shop/bundle/BundleAdd.js.map +1 -1
  49. package/dist/js/components/shop/cart/Cart.js +1 -1
  50. package/dist/js/components/shop/cart/Cart.js.map +1 -1
  51. package/dist/js/components/shop/cart/CartAdd.js +1 -1
  52. package/dist/js/components/shop/cart/CartAdd.js.map +1 -1
  53. package/dist/js/components/shop/cart/CartItem.js +1 -1
  54. package/dist/js/components/shop/cart/CartItem.js.map +1 -1
  55. package/dist/js/components/shop/cart/CartTrigger.js +1 -1
  56. package/dist/js/components/shop/cart/CartTrigger.js.map +1 -1
  57. package/dist/js/components/shop/cart/SuccessMessage.js +1 -1
  58. package/dist/js/components/shop/cart/SuccessMessage.js.map +1 -1
  59. package/dist/js/components/shop/compare/Compare.js +1 -1
  60. package/dist/js/components/shop/compare/Compare.js.map +1 -1
  61. package/dist/js/components/shop/compare/CompareAdd.js +1 -1
  62. package/dist/js/components/shop/compare/CompareAdd.js.map +1 -1
  63. package/dist/js/components/shop/compare/CompareDelete.js +1 -1
  64. package/dist/js/components/shop/compare/CompareDelete.js.map +1 -1
  65. package/dist/js/components/shop/compare/Comparsion.js +1 -1
  66. package/dist/js/components/shop/compare/Comparsion.js.map +1 -1
  67. package/dist/js/components/shop/compare/SuccessMessage.js +1 -1
  68. package/dist/js/components/shop/compare/SuccessMessage.js.map +1 -1
  69. package/dist/js/components/shop/filters/FilterSearch.js +1 -1
  70. package/dist/js/components/shop/filters/FilterSearch.js.map +1 -1
  71. package/dist/js/components/shop/filters/Price.js +1 -1
  72. package/dist/js/components/shop/filters/Price.js.map +1 -1
  73. package/dist/js/components/shop/order/Checkout.js +1 -1
  74. package/dist/js/components/shop/order/Checkout.js.map +1 -1
  75. package/dist/js/components/shop/order/CheckoutItem.js +1 -1
  76. package/dist/js/components/shop/order/CheckoutItem.js.map +1 -1
  77. package/dist/js/components/shop/order/OneClick.js +1 -1
  78. package/dist/js/components/shop/order/OneClick.js.map +1 -1
  79. package/dist/js/components/shop/order/shipping/CheckoutShippingCourier.js +1 -1
  80. package/dist/js/components/shop/order/shipping/CheckoutShippingCourier.js.map +1 -1
  81. package/dist/js/components/shop/order/shipping/CheckoutShippingNovaposhtaAddress.js +1 -1
  82. package/dist/js/components/shop/order/shipping/CheckoutShippingNovaposhtaAddress.js.map +1 -1
  83. package/dist/js/components/shop/order/shipping/CheckoutShippingNovaposhtaWarehouse.js +1 -1
  84. package/dist/js/components/shop/order/shipping/CheckoutShippingNovaposhtaWarehouse.js.map +1 -1
  85. package/dist/js/components/shop/order/shipping/CheckoutShippingPickup.js +1 -1
  86. package/dist/js/components/shop/order/shipping/CheckoutShippingPickup.js.map +1 -1
  87. package/dist/js/components/shop/reviews/Review.js +1 -1
  88. package/dist/js/components/shop/reviews/Review.js.map +1 -1
  89. package/dist/js/components/shop/viewed/Viewed.js +1 -1
  90. package/dist/js/components/shop/viewed/Viewed.js.map +1 -1
  91. package/dist/js/components/shop/viewed/ViewedDelete.js +1 -1
  92. package/dist/js/components/shop/viewed/ViewedDelete.js.map +1 -1
  93. package/dist/js/components/shop/viewed/Viewer.js +1 -1
  94. package/dist/js/components/shop/viewed/Viewer.js.map +1 -1
  95. package/dist/js/components/shop/wishlist/SuccessMessage.js +1 -1
  96. package/dist/js/components/shop/wishlist/SuccessMessage.js.map +1 -1
  97. package/dist/js/components/shop/wishlist/Wishlist.js +1 -1
  98. package/dist/js/components/shop/wishlist/Wishlist.js.map +1 -1
  99. package/dist/js/components/shop/wishlist/WishlistAdd.js +1 -1
  100. package/dist/js/components/shop/wishlist/WishlistAdd.js.map +1 -1
  101. package/dist/js/components/shop/wishlist/WishlistDelete.js +1 -1
  102. package/dist/js/components/shop/wishlist/WishlistDelete.js.map +1 -1
  103. package/dist/js/forms/FormCheckbox.js +1 -1
  104. package/dist/js/forms/FormCheckbox.js.map +1 -1
  105. package/dist/js/forms/FormCheckboxes.js +1 -1
  106. package/dist/js/forms/FormCheckboxes.js.map +1 -1
  107. package/dist/js/forms/FormPassword.js +1 -1
  108. package/dist/js/forms/FormPassword.js.map +1 -1
  109. package/dist/js/forms/FormRadio.js +1 -1
  110. package/dist/js/forms/FormRadio.js.map +1 -1
  111. package/dist/js/forms/FormRating.js +1 -1
  112. package/dist/js/forms/FormRating.js.map +1 -1
  113. package/dist/js/forms/FormSelect.js +1 -1
  114. package/dist/js/forms/FormSelect.js.map +1 -1
  115. package/dist/js/forms/FormSwitch.js +1 -1
  116. package/dist/js/forms/FormSwitch.js.map +1 -1
  117. package/dist/js/forms/FormText.js +1 -1
  118. package/dist/js/forms/FormText.js.map +1 -1
  119. package/dist/js/forms/FormTextarea.js +1 -1
  120. package/dist/js/forms/FormTextarea.js.map +1 -1
  121. package/dist/store.js +1 -1
  122. package/dist/store.js.map +1 -1
  123. package/dist/vuex.js +1 -1
  124. package/dist/vuex.js.map +1 -1
  125. package/package.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"Gallery.js","sources":["../../../../src/js/components/shop/Gallery.vue","../../../../src/js/components/shop/Gallery.vue?vue&type=template&id=6652fb70&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 SwiperCore, { Navigation, Mousewheel, Thumbs } from \"swiper/core\";\n\nSwiperCore.use([Navigation, Mousewheel, Thumbs]);\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 SwiperCore(thumbs, {\n spaceBetween: props.thumbsSpaceBetween,\n slidesPerView: \"auto\",\n mousewheel: {\n forceToAxis: true,\n },\n freeMode: true,\n watchSlidesVisibility: true,\n watchSlidesProgress: true,\n direction: props.thumbsDirection,\n navigation: {\n nextEl: props.thumbNext,\n prevEl: props.thumbPrev,\n },\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 sliderSwiper = new SwiperCore(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 SwiperCore, { Navigation, Mousewheel, Thumbs } from \"swiper/core\";\n\nSwiperCore.use([Navigation, Mousewheel, Thumbs]);\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 SwiperCore(thumbs, {\n spaceBetween: props.thumbsSpaceBetween,\n slidesPerView: \"auto\",\n mousewheel: {\n forceToAxis: true,\n },\n freeMode: true,\n watchSlidesVisibility: true,\n watchSlidesProgress: true,\n direction: props.thumbsDirection,\n navigation: {\n nextEl: props.thumbNext,\n prevEl: props.thumbPrev,\n },\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 sliderSwiper = new SwiperCore(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":["SwiperCore","use","Navigation","Mousewheel","Thumbs","defineComponent","name","props","thumbsDirection","type","String","default","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","spaceBetween","slidesPerView","mousewheel","forceToAxis","freeMode","watchSlidesVisibility","watchSlidesProgress","direction","navigation","nextEl","prevEl","options","centeredSlides","swiper","_ctx","_createElementBlock","class","onClick"],"mappings":"8IAYAA,UAAWC,IAAI,CAACC,aAAYC,aAAYC,WAExC,MAA6BC,kBAAgB,CACzCC,KAAM,UACNC,MAAO,CACHC,gBAAiB,CACbC,KAAMC,OACNC,QAAS,cAEbC,0BAA2B,CACvBH,KAAMC,OACNC,QAAS,cAEbE,KAAM,CACFJ,KAAMC,OACNC,QAAS,uBAEbG,KAAM,CACFL,KAAMC,OACNC,QAAS,uBAEbI,UAAW,CACPN,KAAMC,OACNC,QAAS,uBAEbK,UAAW,CACPP,KAAMC,OACNC,QAAS,uBAEbM,WAAY,CACRR,KAAMS,QACNP,SAAS,GAEbQ,eAAgB,CACZV,KAAMS,QACNP,SAAS,GAEbS,mBAAoB,CAChBX,KAAMY,OACNV,QAAS,KAGjBW,MAAMf,OAEEgB,EACAC,EACAC,EACAC,EACAC,EALEC,EAAQC,OAAI,GAOZC,EAAQ,KACVC,SAASC,KAAKC,UAAUC,OAAO,8BAC/BN,EAAMO,OAAQ,EAEdC,EAAO,SAEH7B,EAAMY,g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CAGwBF,WAF7BG,sCAAOH"}
1
+ {"version":3,"file":"Gallery.js","sources":["../../../../src/js/components/shop/Gallery.vue","../../../../src/js/components/shop/Gallery.vue?vue&type=template&id=6652fb70&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 SwiperCore, { Navigation, Mousewheel, Thumbs } from \"swiper/core\";\n\nSwiperCore.use([Navigation, Mousewheel, Thumbs]);\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 SwiperCore(thumbs, {\n spaceBetween: props.thumbsSpaceBetween,\n slidesPerView: \"auto\",\n mousewheel: {\n forceToAxis: true,\n },\n freeMode: true,\n watchSlidesVisibility: true,\n watchSlidesProgress: true,\n direction: props.thumbsDirection,\n navigation: {\n nextEl: props.thumbNext,\n prevEl: props.thumbPrev,\n },\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 sliderSwiper = new SwiperCore(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 SwiperCore, { Navigation, Mousewheel, Thumbs } from \"swiper/core\";\n\nSwiperCore.use([Navigation, Mousewheel, Thumbs]);\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 SwiperCore(thumbs, {\n spaceBetween: props.thumbsSpaceBetween,\n slidesPerView: \"auto\",\n mousewheel: {\n forceToAxis: true,\n },\n freeMode: true,\n watchSlidesVisibility: true,\n watchSlidesProgress: true,\n direction: props.thumbsDirection,\n navigation: {\n nextEl: props.thumbNext,\n prevEl: props.thumbPrev,\n },\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 sliderSwiper = new SwiperCore(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":["SwiperCore","use","Navigation","Mousewheel","Thumbs","defineComponent","name","props","thumbsDirection","type","String","default","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","spaceBetween","slidesPerView","mousewheel","forceToAxis","freeMode","watchSlidesVisibility","watchSlidesProgress","direction","navigation","nextEl","prevEl","options","centeredSlides","swiper","_ctx","_createElementBlock","class","onClick"],"mappings":"8IAYAA,UAAWC,IAAI,CAACC,aAAYC,aAAYC,WAExC,MAA6BC,kBAAgB,CACzCC,KAAM,UACNC,MAAO,CACHC,gBAAiB,CACbC,KAAMC,OACNC,QAAS,cAEbC,0BAA2B,CACvBH,KAAMC,OACNC,QAAS,cAEbE,KAAM,CACFJ,KAAMC,OACNC,QAAS,uBAEbG,KAAM,CACFL,KAAMC,OACNC,QAAS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OS,UAAUC,OAAO,eAGxB3B,EAAMU,YACNQ,EAAOkB,iBAAiB,QAASL,GAGjCb,EAAQ,KACJwC,EAAU,CACVX,aAAc,GACdE,WAAY,CACRC,aAAa,GAEjBS,gBAAgB,EAChBJ,WAAY,CACRC,OAAQxD,EAAMO,KACdkD,OAAQzD,EAAMM,OAIlBa,IACAuC,EAAQzC,OAAS,CACb2C,OAAQzC,IAIhBC,EAAe,IAAI3B,UAAWyB,EAAQwC,GAG1C7B,EAAO,YAGyC,GAE7C,CACHR,MAAAA,EACAE,MAAAA,4CC7KEsC,4BAHVC,qCACIC,wBAAM,gCAGwBF,WAF7BG,sCAAOH"}
@@ -1,2 +1,2 @@
1
- "use strict";var e=require("vue"),t=e.defineComponent({setup(){var t=e.ref(!1),o=e.ref(!0),n=e.ref([]),a=[],r={},l=!1,i=!1,c={},s=e=>{var t=e.substring(e.lastIndexOf("/")+1);return"page-product-"+(t.match(/^page([0-9]+)$/)?t:"page1")},p=[s(window.location.href)],d=e=>{e.preventDefault(),p=[s(e.currentTarget.href)],u(e.currentTarget)},u=(o,i)=>{var p=o.href,d=s(p);if(l||(window.app.component("products-paginate",{data:()=>({components:n}),template:'<teleport to="#products"><component :is="component" v-for="(component, key) in components" v-bind:key="key"></component></teleport>'}),t.value="products-paginate",l=!0),-1===a.indexOf(d))o.classList.add("is-loading"),$http.get(p+"?paginator").then(t=>{h(i);var o=document.createElement("html");o.innerHTML=t.data.products;var l=t.data.h1;l&&(document.querySelector(".shop-subcategory-title h1").innerHTML=l),window.app.component(d,{template:o.querySelector("#products").innerHTML}),c[d]=l,a.push(d),history.pushState({urlPath:p},document.title,p),o.innerHTML=t.data.paginator,r[d]=t.data.paginator,document.getElementById("pagination").replaceWith(o.querySelector("#pagination")),i?(n.value.push(d),m()):(n.value=[d],window.scrollTo({top:0,left:0,behavior:"smooth"})),window.lazyImages&&window.lazyImages.update(),e.nextTick(g)});else{history.pushState({urlPath:p},document.title,p);var u=document.createElement("html");u.innerHTML=r[d],document.getElementById("pagination").replaceWith(u.querySelector("#pagination")),i?(n.value.push(d),m()):(n.value=[d],c[d]&&(document.querySelector(".shop-subcategory-title h1").innerHTML=c[d]),window.scrollTo({top:0,left:0,behavior:"smooth"})),e.nextTick(g)}},m=()=>{var e=document.getElementById("pagination");p.forEach(t=>{var o=e.querySelector("."+t);o&&o.classList.add("is-current")})},h=e=>{e||i||(document.querySelectorAll("#products > *").forEach(e=>{e.remove()}),i=!0)},g=()=>{var e=document.querySelector("#pagination .pagination-next:not([disabled])");document.querySelectorAll("#pagination a:not([disabled])").forEach(e=>{e.addEventListener("click",d)}),o.value=Boolean(e),window.lazyImages&&window.lazyImages.update()};return e.onMounted(()=>{g()}),{component:t,hasMorePages:o,more:()=>{var e=document.querySelector("#pagination .pagination-next:not([disabled])"),t=s(e.href);p.push(t),u(e,!0)}}}}),o={class:"shop-pagination has-text-centered mb-3"},n={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,l,i,c,s){return e.openBlock(),e.createElementBlock("div",o,[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(t.component))),t.hasMorePages?(e.openBlock(),e.createElementBlock("div",n,[e.renderSlot(t.$slots,"default",{more:t.more},()=>[e.createElementVNode("button",{class:"button is-small",onClick:r[0]||(r[0]=function(){return t.more&&t.more(...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={},c=!1,i=!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,i){var s=n.href,d=u(s);if(c||(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",c=!0),-1===a.indexOf(d))n.classList.add("is-loading"),$http.get(s+"?paginator").then((function(t){f(i);var n=document.createElement("html");n.innerHTML=t.data.products;var c=t.data.h1;c&&(document.querySelector(".shop-subcategory-title h1").innerHTML=c),window.app.component(d,{template:n.querySelector("#products").innerHTML}),l[d]=c,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")),i?(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");p.innerHTML=r[d],document.getElementById("pagination").replaceWith(p.querySelector("#pagination")),i?(o.value.push(d),m()):(o.value=[d],l[d]&&(document.querySelector(".shop-subcategory-title h1").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||i||(document.querySelectorAll("#products > *").forEach((function(e){e.remove()})),i=!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,c,i,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=4419ecee&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 document.querySelector('.shop-subcategory-title h1').innerHTML = title;\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();\n }\n\n if (window.lazyImages) {\n window.lazyImages.update();\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 document.querySelector('.shop-subcategory-title h1').innerHTML = titles[componentName];\n }\n\n window.scrollTo({\n top: 0,\n left: 0,\n behavior: 'smooth'\n });\n } else {\n visiblePages.value.push(componentName);\n setPaginatorCurrentPages();\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 document.querySelector('.shop-subcategory-title h1').innerHTML = title;\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();\n }\n\n if (window.lazyImages) {\n window.lazyImages.update();\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 document.querySelector('.shop-subcategory-title h1').innerHTML = titles[componentName];\n }\n\n window.scrollTo({\n top: 0,\n left: 0,\n behavior: 'smooth'\n });\n } else {\n visiblePages.value.push(componentName);\n setPaginatorCurrentPages();\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","querySelector","push","history","pushState","urlPath","paginator","getElementById","replaceWith","setPaginatorCurrentPages","scrollTo","top","left","behavior","lazyImages","update","nextTick","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,YACUC,EAAYC,OAAI,GAChBC,EAAeD,OAAI,GACnBE,EAAeF,MAAI,IAErBG,EAAQ,GACRC,EAAa,GACbC,GAAS,EACTC,GAAU,EACVC,EAAS,GAEPC,EAAoBC,QAChBC,EAAOD,EAAKE,UAAUF,EAAKG,YAAY,KAAO,SAE7C,iBAAmBF,EAAKG,MAAM,kBAAoBH,EAAO,UAGhEI,EAAY,CAACN,EAAiBO,OAAOC,SAASP,OAE5CQ,EAAOC,IACTA,EAAEC,iBAEFL,EAAY,CAACN,EAAiBU,EAAEE,cAAcX,OAE9CY,EAAKH,EAAEE,gBAGLC,EAAO,CAACC,EAAQC,SACZd,EAAOa,EAAOb,KAEde,EAAgBhB,EAAiBC,MAElCJ,IACDU,OAAOU,IAAI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ACNC,SAAU,YAOlBG,WAASC,KAIXR,EAA2B,SACvBH,EAAYX,SAASY,eAAe,cAE1CpC,EAAU+C,QAASrC,QACTsC,EAAOb,EAAUL,cAAc,IAAMpB,GAEvCsC,GACAA,EAAK/B,UAAUC,IAAI,iBAKzBI,EAAgBb,IACbA,GAAajB,IACIgC,SAASyB,iBAAiB,iBAEhCF,QAASG,IACjBA,EAAQC,WAGZ3D,GAAU,IAIZsD,EAAO,SACHM,EAAO5B,SAASM,cAAc,gDAEtBN,SAASyB,iBAAiB,iCAElCF,QAASC,IACXA,EAAKK,iBAAiB,QAASlD,KAGnChB,EAAa4B,MAAQuC,QAAQF,GAEzBnD,OAAO0C,YACP1C,OAAO0C,WAAWC,iBAc1BW,YAAU,KACNT,MAGG,CACH7D,UAAAA,EACAE,aAAAA,EACAqE,KAjBS,SACHJ,EAAO5B,SAASM,cAAc,gDAE9BpB,EAAgBhB,EAAiB0D,EAAKzD,MAE5CK,EAAU+B,KAAKrB,GAEfH,EAAK6C,GAAM,WC9LdK,MAAM,mDAEFA,MAAM,0BAGCC,6BAAMD,MAAM,kBACRC,0BAAGD,MAAM,6EAN7BE,2BAAAC,kBACIC,wCAAgBC,eACwBA,8BAAxCH,2BAAAI,GACIC,iCAAOR,KAAMM,QAAb,KACIJ,+BAAQD,MAAM,kBAAmBQ,sCAAOH,iCACpCI,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=1d789ee5&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 document.querySelector('.shop-subcategory-title h1').innerHTML = title;\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 document.querySelector('.shop-subcategory-title h1').innerHTML = titles[componentName];\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 document.querySelector('.shop-subcategory-title h1').innerHTML = title;\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 document.querySelector('.shop-subcategory-title h1').innerHTML = titles[componentName];\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","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,EACTC,GAAU,EACVC,EAAS,GAEPC,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,MAElCJ,IACDU,OAAOU,IAAI1B,UAAU,oBAAqB,CACtC2B,sBACW,CACHC,WAAYzB,IAGpB0B,SAAU,wIAGd7B,EAAU8B,MAAQ,oBAClBxB,GAAS,IAGyB,IAAlCF,EAAM2B,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,GAExBD,IACAJ,SAASM,cAAc,8BAA8BJ,UAAYE,GAGrE3B,OAAOU,IAAI1B,UAAUyB,EAAe,CAChCI,SAAUS,EAAKO,cAAc,aAAaJ,YAG9CjC,EAAOiB,GAAiBkB,EAExB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AElCF,SAAQ,SAACC,GACXA,EAAKK,iBAAiB,QAASnD,MAGnChB,EAAa4B,MAAQwC,QAAQF,GAEzBpD,OAAO0C,YACP1C,OAAO0C,WAAWC,iBAc1BY,aAAU,WACNT,OAGG,CACH9D,UAAAA,EACAE,aAAAA,EACAsE,KAjBS,eACHJ,EAAO7B,SAASM,cAAc,gDAE9BpB,EAAgBhB,EAAiB2D,EAAK1D,MAE5CK,EAAU+B,KAAKrB,GAEfH,EAAK8C,GAAM,WC1MdK,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"}
@@ -1,2 +1,2 @@
1
- "use strict";var e=require("vue"),i=require("swiper/core");function s(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var a=s(i);a.default.use([i.Navigation,i.Mousewheel]);var r=e.defineComponent({props:{id:Number},setup(i){var s=!1,r=e.ref(!1),t=e.ref(null),d=e.ref(null),l=e=>{e.forEach(e=>{e.isIntersecting&&(s||(s=!0,o()))})},o=()=>{$http.post($ziggy("api.piece",{slug:"promo-products"}),{id:i.id}).then(s=>{var l="piece-promo-products-"+i.id;window.app.component(l,{template:s.data?s.data:"<i></i>"}),d.value=l,r.value=!0,e.nextTick(()=>{var e=t.value.querySelectorAll(".is-faded-tabs");e.length&&e.forEach(e=>{new a.default(e.querySelector(".swiper-container"),{slidesPerView:"auto",freeMode:!0})});var i=t.value.querySelectorAll(".is-faded-tabs .swiper-slide"),s=t.value.querySelectorAll("[products-slider]");i.forEach((e,a)=>{e.addEventListener("click",()=>{i.forEach(e=>{e.classList.remove("is-active")}),s.forEach(e=>{e.classList.add("is-hidden")}),s[a].classList.remove("is-hidden"),e.classList.add("is-active")})}),s.length&&s.forEach(e=>{new a.default(e,window.viewedSwiperOptions)}),window.lazyImages&&window.lazyImages.update()})})};return window.addEventListener("DOMContentLoaded",()=>{new IntersectionObserver(l,{threshold:.1}).observe(t.value)}),{container:t,component:d,loaded:r}}}),t={ref:"container"},d={key:0,class:"product-promo-block container is-fluid is-skeleton"},l=e.createStaticVNode('<div class="gradient"></div><div class="title slider-title"> </div><div class="is-faded-tabs"><div class="is-flex"><div class="swiper-slide"> </div><div class="swiper-slide"> </div></div></div>',3),o={class:"swiper-container"},c={class:"swiper-wrapper products is-slider"},n=[e.createStaticVNode('<div class="border"><div class="wrapper"><picture class="is-lazy-loaded"><img class="lazy entered loaded" src="/images/blank.png"></picture><div class="availability"> </div><div class="title"> </div><div class="prices"><div class="price"></div></div></div></div>',1)];r.render=function(i,s,a,r,v,p){return e.openBlock(),e.createElementBlock("div",t,[i.loaded?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(i.component),{key:1})):(e.openBlock(),e.createElementBlock("section",d,[l,e.createElementVNode("div",o,[e.createElementVNode("div",c,[(e.openBlock(),e.createElementBlock(e.Fragment,null,e.renderList(5,i=>e.createElementVNode("div",{class:"product",key:i},n)),64))])])]))],512)},module.exports=r;
1
+ "use strict";var e=require("vue"),i=require("swiper/core");function t(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var s=t(i);s.default.use([i.Navigation,i.Mousewheel]);var n=e.defineComponent({props:{id:Number},setup:function(i){var t=!1,n=e.ref(!1),r=e.ref(null),a=e.ref(null),o=function(e){e.forEach((function(e){e.isIntersecting&&(t||(t=!0,d()))}))},d=function(){$http.post($ziggy("api.piece",{slug:"promo-products"}),{id:i.id}).then((function(t){var o="piece-promo-products-"+i.id;window.app.component(o,{template:t.data?t.data:"<i></i>"}),a.value=o,n.value=!0,e.nextTick((function(){var e=r.value.querySelectorAll(".is-faded-tabs");e.length&&e.forEach((function(e){new s.default(e.querySelector(".swiper-container"),{slidesPerView:"auto",freeMode:!0})}));var i=r.value.querySelectorAll(".is-faded-tabs .swiper-slide"),t=r.value.querySelectorAll("[products-slider]");i.forEach((function(e,s){e.addEventListener("click",(function(){i.forEach((function(e){e.classList.remove("is-active")})),t.forEach((function(e){e.classList.add("is-hidden")})),t[s].classList.remove("is-hidden"),e.classList.add("is-active")}))})),t.length&&t.forEach((function(e){new s.default(e,window.viewedSwiperOptions)})),window.lazyImages&&window.lazyImages.update()}))}))};return window.addEventListener("DOMContentLoaded",(function(){new IntersectionObserver(o,{threshold:.1}).observe(r.value)})),{container:r,component:a,loaded:n}}}),r={ref:"container"},a={key:0,class:"product-promo-block container is-fluid is-skeleton"},o=e.createStaticVNode('<div class="gradient"></div><div class="title slider-title"> </div><div class="is-faded-tabs"><div class="is-flex"><div class="swiper-slide"> </div><div class="swiper-slide"> </div></div></div>',3),d={class:"swiper-container"},c={class:"swiper-wrapper products is-slider"},l=[e.createStaticVNode('<div class="border"><div class="wrapper"><picture class="is-lazy-loaded"><img class="lazy entered loaded" src="/images/blank.png"></picture><div class="availability"> </div><div class="title"> </div><div class="prices"><div class="price"></div></div></div></div>',1)];n.render=function(i,t,s,n,u,v){return e.openBlock(),e.createElementBlock("div",r,[i.loaded?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(i.component),{key:1})):(e.openBlock(),e.createElementBlock("section",a,[o,e.createElementVNode("div",d,[e.createElementVNode("div",c,[(e.openBlock(),e.createElementBlock(e.Fragment,null,e.renderList(5,(function(i){return e.createElementVNode("div",{class:"product",key:i},l)})),64))])])]))],512)},module.exports=n;
2
2
  //# sourceMappingURL=PromoProducts.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"PromoProducts.js","sources":["../../../../src/js/components/shop/PromoProducts.vue","../../../../src/js/components/shop/PromoProducts.vue?vue&type=template&id=508fb35b&lang.js"],"sourcesContent":["<template>\n <div ref=\"container\">\n <section class=\"product-promo-block container is-fluid is-skeleton\" v-if=\"!loaded\">\n <div class=\"gradient\"></div>\n <div class=\"title slider-title\">&nbsp;</div>\n <div class=\"is-faded-tabs\">\n <div class=\"is-flex\">\n <div class=\"swiper-slide\">&nbsp;</div>\n <div class=\"swiper-slide\">&nbsp;</div>\n </div>\n </div>\n <div class=\"swiper-container\">\n <div class=\"swiper-wrapper products is-slider\">\n <div class=\"product\" v-for=\"index in 5\" :key=\"index\">\n <div class=\"border\">\n <div class=\"wrapper\">\n <picture class=\"is-lazy-loaded\">\n <img class=\"lazy entered loaded\" src=\"/images/blank.png\" />\n </picture>\n <div class=\"availability\">&nbsp;</div>\n <div class=\"title\">&nbsp;</div>\n <div class=\"prices\">\n <div class=\"price\"></div>\n </div>\n </div>\n </div>\n </div>\n </div>\n </div>\n </section>\n <component :is=\"component\" v-else></component>\n </div>\n</template>\n<script>\nimport { ref, nextTick, defineComponent } from 'vue';\nimport SwiperCore, { Navigation, Mousewheel } from 'swiper/core';\n\nSwiperCore.use([Navigation, Mousewheel]);\n\nexport default defineComponent({\n props: {\n id: Number\n },\n setup(props) {\n let inited = false;\n\n const loaded = ref(false);\n const container = ref(null);\n const component = ref(null);\n\n const callback = (entries) => {\n entries.forEach((entry) => {\n if (entry.isIntersecting) {\n if (!inited) {\n inited = true;\n\n load();\n }\n }\n });\n };\n\n const load = () => {\n $http\n .post($ziggy('api.piece', { slug: 'promo-products' }), {\n id: props.id\n })\n .then((response) => {\n const componentName = 'piece-promo-products-' + props.id;\n\n window.app.component(componentName, {\n template: response.data ? response.data : '<i></i>'\n });\n\n component.value = componentName;\n loaded.value = true;\n\n nextTick(() => {\n const fadedTabs = container.value.querySelectorAll('.is-faded-tabs');\n\n if (fadedTabs.length) {\n fadedTabs.forEach((tab) => {\n new SwiperCore(tab.querySelector('.swiper-container'), {\n slidesPerView: 'auto',\n freeMode: true\n });\n });\n }\n\n const tabs = container.value.querySelectorAll('.is-faded-tabs .swiper-slide');\n const sliders = container.value.querySelectorAll('[products-slider]');\n\n tabs.forEach((tab, index) => {\n tab.addEventListener('click', () => {\n tabs.forEach((tab) => {\n tab.classList.remove('is-active');\n });\n\n sliders.forEach((slider) => {\n slider.classList.add('is-hidden');\n });\n\n sliders[index].classList.remove('is-hidden');\n tab.classList.add('is-active');\n });\n });\n\n if (sliders.length) {\n sliders.forEach((slider) => {\n new SwiperCore(slider, window.viewedSwiperOptions);\n });\n }\n\n if (window.lazyImages) {\n window.lazyImages.update();\n }\n });\n });\n };\n\n window.addEventListener('DOMContentLoaded', () => {\n new IntersectionObserver(callback, {\n threshold: 0.1\n }).observe(container.value);\n });\n\n return {\n container,\n component,\n loaded\n };\n }\n});\n</script>\n","<template>\n <div ref=\"container\">\n <section class=\"product-promo-block container is-fluid is-skeleton\" v-if=\"!loaded\">\n <div class=\"gradient\"></div>\n <div class=\"title slider-title\">&nbsp;</div>\n <div class=\"is-faded-tabs\">\n <div class=\"is-flex\">\n <div class=\"swiper-slide\">&nbsp;</div>\n <div class=\"swiper-slide\">&nbsp;</div>\n </div>\n </div>\n <div class=\"swiper-container\">\n <div class=\"swiper-wrapper products is-slider\">\n <div class=\"product\" v-for=\"index in 5\" :key=\"index\">\n <div class=\"border\">\n <div class=\"wrapper\">\n <picture class=\"is-lazy-loaded\">\n <img class=\"lazy entered loaded\" src=\"/images/blank.png\" />\n </picture>\n <div class=\"availability\">&nbsp;</div>\n <div class=\"title\">&nbsp;</div>\n <div class=\"prices\">\n <div class=\"price\"></div>\n </div>\n </div>\n </div>\n </div>\n </div>\n </div>\n </section>\n <component :is=\"component\" v-else></component>\n </div>\n</template>\n<script>\nimport { ref, nextTick, defineComponent } from 'vue';\nimport SwiperCore, { Navigation, Mousewheel } from 'swiper/core';\n\nSwiperCore.use([Navigation, Mousewheel]);\n\nexport default defineComponent({\n props: {\n id: Number\n },\n setup(props) {\n let inited = false;\n\n const loaded = ref(false);\n const container = ref(null);\n const component = ref(null);\n\n const callback = (entries) => {\n entries.forEach((entry) => {\n if (entry.isIntersecting) {\n if (!inited) {\n inited = true;\n\n load();\n }\n }\n });\n };\n\n const load = () => {\n $http\n .post($ziggy('api.piece', { slug: 'promo-products' }), {\n id: props.id\n })\n .then((response) => {\n const componentName = 'piece-promo-products-' + props.id;\n\n window.app.component(componentName, {\n template: response.data ? response.data : '<i></i>'\n });\n\n component.value = componentName;\n loaded.value = true;\n\n nextTick(() => {\n const fadedTabs = container.value.querySelectorAll('.is-faded-tabs');\n\n if (fadedTabs.length) {\n fadedTabs.forEach((tab) => {\n new SwiperCore(tab.querySelector('.swiper-container'), {\n slidesPerView: 'auto',\n freeMode: true\n });\n });\n }\n\n const tabs = container.value.querySelectorAll('.is-faded-tabs .swiper-slide');\n const sliders = container.value.querySelectorAll('[products-slider]');\n\n tabs.forEach((tab, index) => {\n tab.addEventListener('click', () => {\n tabs.forEach((tab) => {\n tab.classList.remove('is-active');\n });\n\n sliders.forEach((slider) => {\n slider.classList.add('is-hidden');\n });\n\n sliders[index].classList.remove('is-hidden');\n tab.classList.add('is-active');\n });\n });\n\n if (sliders.length) {\n sliders.forEach((slider) => {\n new SwiperCore(slider, window.viewedSwiperOptions);\n });\n }\n\n if (window.lazyImages) {\n window.lazyImages.update();\n }\n });\n });\n };\n\n window.addEventListener('DOMContentLoaded', () => {\n new IntersectionObserver(callback, {\n threshold: 0.1\n }).observe(container.value);\n });\n\n return {\n container,\n component,\n loaded\n };\n }\n});\n</script>\n"],"names":["SwiperCore","use","Navigation","Mousewheel","defineComponent","props","id","Number","setup","inited","loaded","ref","container","component","callback","entries","forEach","entry","isIntersecting","load","$http","post","$ziggy","slug","then","response","componentName","window","app","template","data","value","nextTick","fadedTabs","querySelectorAll","length","tab","querySelector","slidesPerView","freeMode","tabs","sliders","index","addEventListener","classList","remove","slider","add","viewedSwiperOptions","lazyImages","update","IntersectionObserver","threshold","observe","class","_createElementBlock","_hoisted_1","_ctx","_createBlock","_hoisted_2","_hoisted_3","_createElementVNode","_hoisted_6","_hoisted_7","key"],"mappings":"8IAqCAA,UAAWC,IAAI,CAACC,aAAYC,eAE5B,MAAeC,kBAAgB,CAC3BC,MAAO,CACHC,GAAIC,QAERC,MAAMH,OACEI,GAAS,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5BhBF,+BAAAI,GACIC,EAQAC,2BAAAC,GACID,2BAAAE,kBACIR,kDAAqC,EAATb,GAA5BmB,4BAAKP,MAAM,UAA8BU,IAAKtB"}
1
+ {"version":3,"file":"PromoProducts.js","sources":["../../../../src/js/components/shop/PromoProducts.vue","../../../../src/js/components/shop/PromoProducts.vue?vue&type=template&id=508fb35b&lang.js"],"sourcesContent":["<template>\n <div ref=\"container\">\n <section class=\"product-promo-block container is-fluid is-skeleton\" v-if=\"!loaded\">\n <div class=\"gradient\"></div>\n <div class=\"title slider-title\">&nbsp;</div>\n <div class=\"is-faded-tabs\">\n <div class=\"is-flex\">\n <div class=\"swiper-slide\">&nbsp;</div>\n <div class=\"swiper-slide\">&nbsp;</div>\n </div>\n </div>\n <div class=\"swiper-container\">\n <div class=\"swiper-wrapper products is-slider\">\n <div class=\"product\" v-for=\"index in 5\" :key=\"index\">\n <div class=\"border\">\n <div class=\"wrapper\">\n <picture class=\"is-lazy-loaded\">\n <img class=\"lazy entered loaded\" src=\"/images/blank.png\" />\n </picture>\n <div class=\"availability\">&nbsp;</div>\n <div class=\"title\">&nbsp;</div>\n <div class=\"prices\">\n <div class=\"price\"></div>\n </div>\n </div>\n </div>\n </div>\n </div>\n </div>\n </section>\n <component :is=\"component\" v-else></component>\n </div>\n</template>\n<script>\nimport { ref, nextTick, defineComponent } from 'vue';\nimport SwiperCore, { Navigation, Mousewheel } from 'swiper/core';\n\nSwiperCore.use([Navigation, Mousewheel]);\n\nexport default defineComponent({\n props: {\n id: Number\n },\n setup(props) {\n let inited = false;\n\n const loaded = ref(false);\n const container = ref(null);\n const component = ref(null);\n\n const callback = (entries) => {\n entries.forEach((entry) => {\n if (entry.isIntersecting) {\n if (!inited) {\n inited = true;\n\n load();\n }\n }\n });\n };\n\n const load = () => {\n $http\n .post($ziggy('api.piece', { slug: 'promo-products' }), {\n id: props.id\n })\n .then((response) => {\n const componentName = 'piece-promo-products-' + props.id;\n\n window.app.component(componentName, {\n template: response.data ? response.data : '<i></i>'\n });\n\n component.value = componentName;\n loaded.value = true;\n\n nextTick(() => {\n const fadedTabs = container.value.querySelectorAll('.is-faded-tabs');\n\n if (fadedTabs.length) {\n fadedTabs.forEach((tab) => {\n new SwiperCore(tab.querySelector('.swiper-container'), {\n slidesPerView: 'auto',\n freeMode: true\n });\n });\n }\n\n const tabs = container.value.querySelectorAll('.is-faded-tabs .swiper-slide');\n const sliders = container.value.querySelectorAll('[products-slider]');\n\n tabs.forEach((tab, index) => {\n tab.addEventListener('click', () => {\n tabs.forEach((tab) => {\n tab.classList.remove('is-active');\n });\n\n sliders.forEach((slider) => {\n slider.classList.add('is-hidden');\n });\n\n sliders[index].classList.remove('is-hidden');\n tab.classList.add('is-active');\n });\n });\n\n if (sliders.length) {\n sliders.forEach((slider) => {\n new SwiperCore(slider, window.viewedSwiperOptions);\n });\n }\n\n if (window.lazyImages) {\n window.lazyImages.update();\n }\n });\n });\n };\n\n window.addEventListener('DOMContentLoaded', () => {\n new IntersectionObserver(callback, {\n threshold: 0.1\n }).observe(container.value);\n });\n\n return {\n container,\n component,\n loaded\n };\n }\n});\n</script>\n","<template>\n <div ref=\"container\">\n <section class=\"product-promo-block container is-fluid is-skeleton\" v-if=\"!loaded\">\n <div class=\"gradient\"></div>\n <div class=\"title slider-title\">&nbsp;</div>\n <div class=\"is-faded-tabs\">\n <div class=\"is-flex\">\n <div class=\"swiper-slide\">&nbsp;</div>\n <div class=\"swiper-slide\">&nbsp;</div>\n </div>\n </div>\n <div class=\"swiper-container\">\n <div class=\"swiper-wrapper products is-slider\">\n <div class=\"product\" v-for=\"index in 5\" :key=\"index\">\n <div class=\"border\">\n <div class=\"wrapper\">\n <picture class=\"is-lazy-loaded\">\n <img class=\"lazy entered loaded\" src=\"/images/blank.png\" />\n </picture>\n <div class=\"availability\">&nbsp;</div>\n <div class=\"title\">&nbsp;</div>\n <div class=\"prices\">\n <div class=\"price\"></div>\n </div>\n </div>\n </div>\n </div>\n </div>\n </div>\n </section>\n <component :is=\"component\" v-else></component>\n </div>\n</template>\n<script>\nimport { ref, nextTick, defineComponent } from 'vue';\nimport SwiperCore, { Navigation, Mousewheel } from 'swiper/core';\n\nSwiperCore.use([Navigation, Mousewheel]);\n\nexport default defineComponent({\n props: {\n id: Number\n },\n setup(props) {\n let inited = false;\n\n const loaded = ref(false);\n const container = ref(null);\n const component = ref(null);\n\n const callback = (entries) => {\n entries.forEach((entry) => {\n if (entry.isIntersecting) {\n if (!inited) {\n inited = true;\n\n load();\n }\n }\n });\n };\n\n const load = () => {\n $http\n .post($ziggy('api.piece', { slug: 'promo-products' }), {\n id: props.id\n })\n .then((response) => {\n const componentName = 'piece-promo-products-' + props.id;\n\n window.app.component(componentName, {\n template: response.data ? response.data : '<i></i>'\n });\n\n component.value = componentName;\n loaded.value = true;\n\n nextTick(() => {\n const fadedTabs = container.value.querySelectorAll('.is-faded-tabs');\n\n if (fadedTabs.length) {\n fadedTabs.forEach((tab) => {\n new SwiperCore(tab.querySelector('.swiper-container'), {\n slidesPerView: 'auto',\n freeMode: true\n });\n });\n }\n\n const tabs = container.value.querySelectorAll('.is-faded-tabs .swiper-slide');\n const sliders = container.value.querySelectorAll('[products-slider]');\n\n tabs.forEach((tab, index) => {\n tab.addEventListener('click', () => {\n tabs.forEach((tab) => {\n tab.classList.remove('is-active');\n });\n\n sliders.forEach((slider) => {\n slider.classList.add('is-hidden');\n });\n\n sliders[index].classList.remove('is-hidden');\n tab.classList.add('is-active');\n });\n });\n\n if (sliders.length) {\n sliders.forEach((slider) => {\n new SwiperCore(slider, window.viewedSwiperOptions);\n });\n }\n\n if (window.lazyImages) {\n window.lazyImages.update();\n }\n });\n });\n };\n\n window.addEventListener('DOMContentLoaded', () => {\n new IntersectionObserver(callback, {\n threshold: 0.1\n }).observe(container.value);\n });\n\n return {\n container,\n component,\n loaded\n };\n }\n});\n</script>\n"],"names":["SwiperCore","use","Navigation","Mousewheel","defineComponent","props","id","Number","setup","inited","loaded","ref","container","component","callback","entries","forEach","entry","isIntersecting","load","$http","post","$ziggy","slug","then","response","componentName","window","app","template","data","value","nextTick","fadedTabs","querySelectorAll","length","tab","querySelector","slidesPerView","freeMode","tabs","sliders","index","addEventListener","classList","remove","slider","add","viewedSwiperOptions","lazyImages","update","IntersectionObserver","threshold","observe","class","_createElementBlock","_hoisted_1","_ctx","_createBlock","_hoisted_2","_hoisted_3","_createElementVNode","_hoisted_6","_hoisted_7","key"],"mappings":"8IAqCAA,UAAWC,IAAI,CAACC,aAAYC,eAE5B,MAAeC,kBAAgB,CAC3BC,MAAO,CACHC,GAAIC,QAERC,eAAMH,OACEI,GAAS,EAEPC,EAASC,OAAI,GACbC,EAAYD,MAAI,MAChBE,EAAYF,MAAI,MAEhBG,EAAW,SAACC,GACdA,EAAQC,SAAQ,SAACC,GACTA,EAAMC,iBACDT,IACDA,GAAS,EAETU,UAMVA,EAAO,WACTC,MACKC,KAAKC,OAAO,YAAa,CAAEC,KAAM,mBAAqB,CACnDjB,GAAID,EAAMC,KAEbkB,MAAK,SAACC,OACGC,EAAgB,wBAA0BrB,EAAMC,GAEtDqB,OAAOC,IAAIf,UAAUa,EAAe,CAChCG,SAAUJ,EAASK,KAAOL,EAASK,KAAO,YAG9CjB,EAAUkB,MAAQL,EAClBhB,EAAOqB,OAAQ,EAEfC,YAAS,eACCC,EAAYrB,EAAUmB,MAAMG,iBAAiB,kBAE/CD,EAAUE,QACVF,EAAUjB,SAAQ,SAACoB,OACXpC,UAAWoC,EAAIC,cAAc,qBAAsB,CACnDC,cAAe,OACfC,UAAU,WAKhBC,EAAO5B,EAAUmB,MAAMG,iBAAiB,gCACxCO,EAAU7B,EAAUmB,MAAMG,iBAAiB,qBAEjDM,EAAKxB,SAAQ,SAACoB,EAAKM,GACfN,EAAIO,iBAAiB,SAAS,WAC1BH,EAAKxB,SAAQ,SAACoB,GACVA,EAAIQ,UAAUC,OAAO,gBAGzBJ,EAAQzB,SAAQ,SAAC8B,GACbA,EAAOF,UAAUG,IAAI,gBAGzBN,EAAQC,GAAOE,UAAUC,OAAO,aAChCT,EAAIQ,UAAUG,IAAI,mBAItBN,EAAQN,QACRM,EAAQzB,SAAQ,SAAC8B,OACT9C,UAAW8C,EAAQnB,OAAOqB,wBAIlCrB,OAAOsB,YACPtB,OAAOsB,WAAWC,uBAMtCvB,OAAOgB,iBAAiB,oBAAoB,eACpCQ,qBAAqBrC,EAAU,CAC/BsC,UAAW,KACZC,QAAQzC,EAAUmB,UAGlB,CACHnB,UAAAA,EACAC,UAAAA,EACAH,OAAAA,SChIHC,IAAI,sBACI2C,MAAM,sRASNA,MAAM,uBACFA,MAAM,6XAXvBC,2BAAAC,GAC+EC,wBA4B3EC,wCAAgBD,sCA5BhBF,+BAAAI,GACIC,EAQAC,2BAAAC,GACID,2BAAAE,kBACIR,kDAAqC,YAATb,UAA5BmB,4BAAKP,MAAM,UAA8BU,IAAKtB"}
@@ -1,2 +1,2 @@
1
- "use strict";var e=require("vue"),t=require("vuex"),r=require("@perevorot/shop/dist/api"),o=require("simplebar"),a=require("secure-ls");function l(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var n=l(o),s=l(a);function c(e,t,r,o,a,l,n){try{var s=e[l](n),c=s.value}catch(e){return void r(e)}s.done?t(c):Promise.resolve(c).then(o,a)}var i=e.defineComponent({name:"search",props:{q:{type:String,default:""},placeholder:{type:String,default:""},parameter:{type:String,default:"/q{separator}"}},setup(o){var a=new s.default({isCompression:!1}),l=o.q;if(l){var i=document.createElement("textarea");i.innerHTML=l,l=i.value}var d=e.ref(!1),u=e.ref(l),p=e.ref([]),v=e.ref([]),m=e.ref(0),h=e.ref(-1),f=e.ref(!1),y=e.ref(),g=e.ref(""),k=e.ref(),w=e.ref(a.get("search")),E=e.ref([]),V=t.useStore(),N=e.computed(()=>V.getters["auth/me"]),B=[],C=()=>{clearTimeout(void 0),h.value=-1,u.value.trim()?(d.value=!0,u.value.trim()&&r.shop.search(u.value).then(e=>{e.data&&(_(),p.value=e.data.products,m.value=e.data.total,g.value=e.data.separator,v.value=e.data.byCategory,new n.default(k.value))}).finally(()=>{d.value=!1})):(p.value=[],d.value=!1)},_=()=>{if(u.value.length>1){var e=a.get("search")?a.get("search"):[];-1!==e.indexOf(u.value)&&(e=e.filter(e=>e!==u.value)),e.length>4&&(e=e.slice(0,4)),e.unshift(u.value),a.set("search",e),w.value=e}};e.onBeforeUpdate(()=>{B=[]}),e.watch(()=>u.value,()=>{f.value=!0,h.value=-1,C()});var S=e.computed(()=>u.value?$env.locale.url+"/search"+D.value:$env.locale.url+"/search"),D=e.computed(()=>o.parameter.replace("{separator}",g.value)+u.value.toLowerCase()),L=e=>{e.target.closest(".cart")||(f.value=!1,h.value=-1)};window.addEventListener("click",L);var x=e.computed(()=>u.value.length>3?E.value.filter(e=>-1!==e.search.indexOf(u.value)):[]),q=function(){var e,t=(e=function*(){var e=document.getElementById("menu");e&&e.querySelectorAll("[data-search]").forEach(e=>{var t=e.textContent.trim(),r=e.dataset.search;E.value.push({name:(r?r+" / ":"")+t,search:t.toLowerCase(),href:e.closest("a").href})}),o.q&&C()},function(){var t=this,r=arguments;return new Promise((function(o,a){var l=e.apply(t,r);function n(e){c(l,o,a,n,s,"next",e)}function s(e){c(l,o,a,n,s,"throw",e)}n(void 0)}))});return function(){return t.apply(this,arguments)}}();return document.addEventListener("DOMContentLoaded",q,!1),{isLoading:d,term:u,results:p,next:()=>{h.value<p.value.length-1&&h.value++},prev:()=>{h.value>=0&&h.value--},current:h,add:e=>{h.value>=0&&(e.preventDefault(),B[h.value].add())},cartRefs:e=>{e&&B.push(e)},isDropdown:f,preventCaret:e=>{(38==e.which||40==e.which||32==e.which&&h.value>=0)&&e.preventDefault()},esc:e=>{y.value.blur(),L(e)},input:y,dropdown:()=>{f.value=!0,h.value=-1},total:m,searchUrl:S,searchHrefWithParameter:D,open:()=>{h.value>=0?window.location.href=p.value[h.value].href:window.location.href=S.value},categories:x,byCategory:v,dropdownContent:k,history:w,clearSearchHistory:e=>{a.remove("search"),w.value=[],y.value.focus()},setSearchHistory:e=>{e.value=e},user:N}}}),d={class:"dropdown-trigger"},u=["placeholder"],p={class:"icon is-small is-right"},v=[e.createElementVNode("i",{class:"fas fa-search"},null,-1)],m={key:0,class:"dropdown-menu"},h={class:"dropdown-content"},f={class:"history-list"},y={class:"dropdown-item history-list-title"},g=["onClick"],k={class:"dropdown-item history-list-clear"},w={class:"dropdown-menu"},E={class:"dropdown-content",style:{"max-height":"600px",overflow:"auto"},ref:"dropdownContent"},V={key:0,class:"results-list"},N=["href"],B={key:0,class:"dropdown-divider"},C={key:1,class:"results-list-category"},_={class:"dropdown-item categories-list-title"},S=["href"],D={key:2,class:"results-list-total"},L={class:"dropdown-item mb-3 mt-2"},x=e.createElementVNode("br",null,null,-1),q=["href"],b={key:3,class:"products-list"},H={class:"dropdown-item products-list-title"},T=["data-code"],K={class:"column"},M={class:"title"},P=["href"],F=["innerHTML"],R={key:0,class:"price_old"},U=["innerHTML"],$={class:"code"},z={key:1,class:"quantity"},O={key:2,class:"no-quantity"},W={key:0,class:"column is-narrow"},j={key:1,class:"column is-eol"},A={key:0,class:"dropdown-content"},I={class:"dropdown-item"},G={class:"no-results"};i.render=function(t,r,o,a,l,n){var s=e.resolveComponent("cart-add");return e.openBlock(),e.createElementBlock("div",{class:"shop-search",onClick:r[10]||(r[10]=e=>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)}])},[e.createElementVNode("div",{class:"overlay search-overlay",onClick:r[0]||(r[0]=e=>t.esc(e))}),e.createElementVNode("div",d,[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]=e=>t.term=e),ref:"input",placeholder:t.placeholder,onKeyup:[r[2]||(r[2]=e.withKeys((function(){return t.next&&t.next(...arguments)}),["arrow-down"])),r[3]||(r[3]=e.withKeys((function(){return t.prev&&t.prev(...arguments)}),["arrow-up"])),r[4]||(r[4]=e.withKeys(e=>t.add(e),["space"])),r[5]||(r[5]=e.withKeys((function(){return t.open&&t.open(...arguments)}),["enter"])),r[6]||(r[6]=e.withKeys(e=>t.esc(e),["esc"]))],onClick:r[7]||(r[7]=function(){return t.dropdown&&t.dropdown(...arguments)}),onKeydown:r[8]||(r[8]=e=>t.preventCaret(e))},null,40,u),[[e.vModelText,t.term]]),e.renderSlot(t.$slots,"icon",{isLoading:t.isLoading},()=>[e.withDirectives(e.createElementVNode("span",p,v,512),[[e.vShow,!t.isLoading]])])],2)]),t.isDropdown&&t.history.length&&!t.term?(e.openBlock(),e.createElementBlock("div",m,[e.createElementVNode("div",h,[e.createElementVNode("div",f,[e.createElementVNode("div",y,[e.createElementVNode("p",null,e.toDisplayString(t.__("shop.search.history")),1)]),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.history,(r,o)=>(e.openBlock(),e.createElementBlock("div",{class:"dropdown-item",key:o},[e.createElementVNode("a",{onClick:e=>t.term=r},e.toDisplayString(r),9,g)]))),128)),e.createElementVNode("div",k,[e.createElementVNode("a",{onClick:r[9]||(r[9]=e=>t.clearSearchHistory(e))},e.toDisplayString(t.__("shop.search.history_clear")),1)])])])])):e.createCommentVNode("v-if",!0),e.withDirectives(e.createElementVNode("div",w,[e.withDirectives(e.createElementVNode("div",E,[t.categories.length?(e.openBlock(),e.createElementBlock("div",V,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.categories,(t,r)=>(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,N)])]))),128)),t.byCategory.length?(e.openBlock(),e.createElementBlock("hr",B)):e.createCommentVNode("v-if",!0)])):e.createCommentVNode("v-if",!0),t.byCategory.length?(e.openBlock(),e.createElementBlock("div",C,[e.createElementVNode("div",_,e.toDisplayString(t.__("shop.search.categories")),1),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.byCategory,(r,o)=>(e.openBlock(),e.createElementBlock("div",{class:"dropdown-item",key:o},[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",D,[e.createElementVNode("p",L,[e.createTextVNode(e.toDisplayString(t.__("shop.search.total_found",{total:t.total}))+" ",1),x,e.createElementVNode("a",{href:t.searchUrl},e.toDisplayString(t.__("shop.search.open_results")),9,q)])])):e.createCommentVNode("v-if",!0),t.results.length?(e.openBlock(),e.createElementBlock("div",b,[e.createElementVNode("div",H,e.toDisplayString(t.__("shop.search.products")),1),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.results,(r,o)=>(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},()=>[e.createElementVNode("div",{class:"columns","data-code":r.code,"shop-product":""},[e.createElementVNode("div",K,[e.createElementVNode("div",M,[e.createElementVNode("a",{href:r.href,"shop-product-name":""},e.toDisplayString(r.name),9,P)]),e.createElementVNode("div",{class:"price",innerHTML:r.price,"shop-product-price":""},null,8,F),r.price_old?(e.openBlock(),e.createElementBlock("div",R,[e.createElementVNode("span",{innerHTML:r.price_old},null,8,U)])):e.createCommentVNode("v-if",!0),e.createElementVNode("div",$,e.toDisplayString(r.code),1),r.quantity?(e.openBlock(),e.createElementBlock("div",z,e.toDisplayString(t.__("shop.search.in_stock")),1)):(e.openBlock(),e.createElementBlock("span",O,e.toDisplayString(t.__("shop.search.out_stock")),1))]),r.is_eol?(e.openBlock(),e.createElementBlock("div",j,e.toDisplayString(t.__("shop.search.eol")),1)):(e.openBlock(),e.createElementBlock("div",W,[e.createVNode(s,{id:r.id,"is-change-quantity":!1,"is-already-in-cart":!1,product:r,ref:t.cartRefs},null,8,["id","product"])]))],8,T)])],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",A,[e.createElementVNode("div",I,[e.createElementVNode("div",G,e.toDisplayString(t.__("shop.search.no_results")),1)])]))],512),[[e.vShow,t.results.length||t.term]])],2)])},module.exports=i;
1
+ "use strict";var e=require("vue"),t=require("vuex"),r=require("@perevorot/shop/dist/api"),o=require("simplebar"),n=require("secure-ls");function a(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var l=a(o),c=a(n);var i=e.defineComponent({name:"search",props:{q:{type:String,default:""},placeholder:{type:String,default:""},parameter:{type:String,default:"/q{separator}"}},setup:function(o){var n=new c.default({isCompression:!1}),a=o.q;if(a){var i=document.createElement("textarea");i.innerHTML=a,a=i.value}var s=e.ref(!1),u=e.ref(a),d=e.ref([]),p=e.ref([]),m=e.ref(0),v=e.ref(-1),h=e.ref(!1),f=e.ref(),y=e.ref(""),g=e.ref(),k=e.ref(n.get("search")),E=e.ref([]),w=t.useStore(),V=e.computed((function(){return w.getters["auth/me"]})),N=[],B=function(){clearTimeout(void 0),v.value=-1,u.value.trim()?(s.value=!0,u.value.trim()&&r.shop.search(u.value).then((function(e){e.data&&(C(),d.value=e.data.products,m.value=e.data.total,y.value=e.data.separator,p.value=e.data.byCategory,new l.default(g.value))})).finally((function(){s.value=!1}))):(d.value=[],s.value=!1)},C=function(){if(u.value.length>1){var e=n.get("search")?n.get("search"):[];-1!==e.indexOf(u.value)&&(e=e.filter((function(e){return e!==u.value}))),e.length>4&&(e=e.slice(0,4)),e.unshift(u.value),n.set("search",e),k.value=e}};e.onBeforeUpdate((function(){N=[]})),e.watch((function(){return u.value}),(function(){h.value=!0,v.value=-1,B()}));var _=e.computed((function(){return u.value?$env.locale.url+"/search"+S.value:$env.locale.url+"/search"})),S=e.computed((function(){return o.parameter.replace("{separator}",y.value)+u.value.toLowerCase()})),D=function(e){e.target.closest(".cart")||(h.value=!1,v.value=-1)};window.addEventListener("click",D);var L,q=e.computed((function(){return u.value.length>3?E.value.filter((function(e){return-1!==e.search.indexOf(u.value)})):[]})),x=(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;E.value.push({name:(r?r+" / ":"")+t,search:t.toLowerCase(),href:e.closest("a").href})})),o.q&&B(),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)}});return document.addEventListener("DOMContentLoaded",x,!1),{isLoading:s,term:u,results:d,next:function(){v.value<d.value.length-1&&v.value++},prev:function(){v.value>=0&&v.value--},current:v,add:function(e){v.value>=0&&(e.preventDefault(),N[v.value].add())},cartRefs:function(e){e&&N.push(e)},isDropdown:h,preventCaret:function(e){(38==e.which||40==e.which||32==e.which&&v.value>=0)&&e.preventDefault()},esc:function(e){f.value.blur(),D(e)},input:f,dropdown:function(){h.value=!0,v.value=-1},total:m,searchUrl:_,searchHrefWithParameter:S,open:function(){v.value>=0?window.location.href=d.value[v.value].href:window.location.href=_.value},categories:q,byCategory:p,dropdownContent:g,history:k,clearSearchHistory:function(e){n.remove("search"),k.value=[],f.value.focus()},setSearchHistory:function(e){e.value=e},user:V}}}),s={class:"dropdown-trigger"},u=["placeholder"],d={class:"icon is-small is-right"},p=[e.createElementVNode("i",{class:"fas fa-search"},null,-1)],m={key:0,class:"dropdown-menu"},v={class:"dropdown-content"},h={class:"history-list"},f={class:"dropdown-item history-list-title"},y=["onClick"],g={class:"dropdown-item history-list-clear"},k={class:"dropdown-menu"},E={class:"dropdown-content",style:{"max-height":"600px",overflow:"auto"},ref:"dropdownContent"},w={key:0,class:"results-list"},V=["href"],N={key:0,class:"dropdown-divider"},B={key:1,class:"results-list-category"},C={class:"dropdown-item categories-list-title"},_=["href"],S={key:2,class:"results-list-total"},D={class:"dropdown-item mb-3 mt-2"},L=e.createElementVNode("br",null,null,-1),q=["href"],x={key:3,class:"products-list"},b={class:"dropdown-item products-list-title"},H=["data-code"],T={class:"column"},K={class:"title"},M=["href"],P=["innerHTML"],F={key:0,class:"price_old"},R=["innerHTML"],U={class:"code"},$={key:1,class:"quantity"},z={key:2,class:"no-quantity"},O={key:0,class:"column is-narrow"},j={key:1,class:"column is-eol"},W={key:0,class:"dropdown-content"},A={class:"dropdown-item"},I={class:"no-results"};i.render=function(t,r,o,n,a,l){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)}])},[e.createElementVNode("div",{class:"overlay search-overlay",onClick:r[0]||(r[0]=function(e){return t.esc(e)})}),e.createElementVNode("div",s,[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.placeholder,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,u),[[e.vModelText,t.term]]),e.renderSlot(t.$slots,"icon",{isLoading:t.isLoading},(function(){return[e.withDirectives(e.createElementVNode("span",d,p,512),[[e.vShow,!t.isLoading]])]}))],2)]),t.isDropdown&&t.history.length&&!t.term?(e.openBlock(),e.createElementBlock("div",m,[e.createElementVNode("div",v,[e.createElementVNode("div",h,[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",E,[t.categories.length?(e.openBlock(),e.createElementBlock("div",w,[(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,V)])])})),128)),t.byCategory.length?(e.openBlock(),e.createElementBlock("hr",N)):e.createCommentVNode("v-if",!0)])):e.createCommentVNode("v-if",!0),t.byCategory.length?(e.openBlock(),e.createElementBlock("div",B,[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.createElementVNode("div",null,[e.createElementVNode("a",{href:r.href+t.searchHrefWithParameter},e.toDisplayString(r.name),9,_)]),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",S,[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,q)])])):e.createCommentVNode("v-if",!0),t.results.length?(e.openBlock(),e.createElementBlock("div",x,[e.createElementVNode("div",b,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",{class:"columns","data-code":r.code,"shop-product":""},[e.createElementVNode("div",T,[e.createElementVNode("div",K,[e.createElementVNode("a",{href:r.href,"shop-product-name":""},e.toDisplayString(r.name),9,M)]),e.createElementVNode("div",{class:"price",innerHTML:r.price,"shop-product-price":""},null,8,P),r.price_old?(e.openBlock(),e.createElementBlock("div",F,[e.createElementVNode("span",{innerHTML:r.price_old},null,8,R)])):e.createCommentVNode("v-if",!0),e.createElementVNode("div",U,e.toDisplayString(r.code),1),r.quantity?(e.openBlock(),e.createElementBlock("div",$,e.toDisplayString(t.__("shop.search.in_stock")),1)):(e.openBlock(),e.createElementBlock("span",z,e.toDisplayString(t.__("shop.search.out_stock")),1))]),r.is_eol?(e.openBlock(),e.createElementBlock("div",j,e.toDisplayString(t.__("shop.search.eol")),1)):(e.openBlock(),e.createElementBlock("div",O,[e.createVNode(c,{id:r.id,"is-change-quantity":!1,"is-already-in-cart":!1,product:r,ref:t.cartRefs},null,8,["id","product"])]))],8,H)]}))],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",W,[e.createElementVNode("div",A,[e.createElementVNode("div",I,e.toDisplayString(t.__("shop.search.no_results")),1)])]))],512),[[e.vShow,t.results.length||t.term]])],2)])},module.exports=i;
2
2
  //# sourceMappingURL=Search.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Search.js","sources":["../../../../src/js/components/shop/Search.vue","../../../../src/js/components/shop/Search.vue?vue&type=template&id=2edb6b6a&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)\"></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=\"placeholder\" @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=\"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=\"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 <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 <div>\n <a :href=\"item.href + searchHrefWithParameter\">{{ item.name }}</a>\n </div>\n <div>\n {{\n __('shop.search.category_found', {\n count: item.count\n })\n }}\n </div>\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\" :data-code=\"item.code\" shop-product>\n <div class=\"column\">\n <div class=\"title\">\n <a :href=\"item.href\" shop-product-name>\n {{ item.name }}\n </a>\n </div>\n <div class=\"price\" v-html=\"item.price\" shop-product-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\" :product=\"item\" :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\">\n {{ __('shop.search.no_results') }}\n </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 parameter: {\n type: String,\n default: '/q{separator}'\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 isDropdown.value = false;\n current.value = -1;\n }\n };\n\n const dropdown = () => {\n isDropdown.value = true;\n current.value = -1;\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 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 };\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)\"></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=\"placeholder\" @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=\"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=\"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 <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 <div>\n <a :href=\"item.href + searchHrefWithParameter\">{{ item.name }}</a>\n </div>\n <div>\n {{\n __('shop.search.category_found', {\n count: item.count\n })\n }}\n </div>\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\" :data-code=\"item.code\" shop-product>\n <div class=\"column\">\n <div class=\"title\">\n <a :href=\"item.href\" shop-product-name>\n {{ item.name }}\n </a>\n </div>\n <div class=\"price\" v-html=\"item.price\" shop-product-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\" :product=\"item\" :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\">\n {{ __('shop.search.no_results') }}\n </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 parameter: {\n type: String,\n default: '/q{separator}'\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 isDropdown.value = false;\n current.value = -1;\n }\n };\n\n const dropdown = () => {\n isDropdown.value = true;\n current.value = -1;\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 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 };\n }\n});\n</script>"],"names":["defineComponent","name","props","q","type","String","default","placeholder","parameter","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","finally","length","indexOf","filter","item","slice","unshift","set","onBeforeUpdate","watch","searchUrl","$env","locale","url","searchHrefWithParameter","replace","toLowerCase","close","event","target","closest","window","addEventListener","categories","load","menuElement","getElementById","querySelectorAll","forEach","element","textContent","dataset","push","href","next","prev","add","preventDefault","cartRefs","el","preventCaret","which","esc","blur","dropdown","open","location","clearSearchHistory","remove","focus","setSearchHistory","class","_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","_hoisted_20","_hoisted_21","_hoisted_22","_hoisted_24","_hoisted_25","id","code","_hoisted_27","_hoisted_28","price","price_old","_hoisted_31","_hoisted_33","quantity","_hoisted_34","_hoisted_35","is_eol","_hoisted_37","_hoisted_36","_createVNode","product","_hoisted_38","_hoisted_39","_hoisted_40"],"mappings":"2VA4HA,MAA6BA,kBAAgB,CACzCC,KAAM,SACNC,MAAO,CACHC,EAAG,CACCC,KAAMC,OACNC,QAAS,IAEbC,YAAa,CACTH,KAAMC,OACNC,QAAS,IAEbE,UAAW,CACPJ,KAAMC,OACNC,QAAS,kBAGjBG,MAAMP,OACIQ,EAAK,IAAIC,UAAS,CACpBC,eAAe,IAGfT,EAAID,EAAMC,KAEVA,EAAG,KACCU,EAAUC,SAASC,cAAc,YACrCF,EAAQG,UAAYb,EACpBA,EAAIU,EAAQI,UAGVC,EAAYC,OAAI,GAChBC,EAAOD,MAAIhB,GACXkB,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,WAAS,IAAMH,EAAMI,QAAQ,YAEtCC,EAAO,GAGLC,EAAS,KACXC,kBAHAC,GAKAhB,EAAQP,OAAS,EAEZG,EAAKH,MAAMwB,QAIZvB,EAAUD,OAAQ,EAGdG,EAAKH,MAAMwB,QACXC,OAAIJ,OAAOlB,EAAKH,OACX0B,KAAMC,IACCA,EAASC,OACTC,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1CvC,2BAAAwC,oBACOpC,4CAJPJ,2BAAAyC,GACIC,iBAAWd,GAAI9E,EAAK8E,yBAAyB,wBAA4B,EAAQe,QAAS7F,EAAOlC,IAAKwF,+GA/DxFA,UAAQzD,QAAUyD,aAAWzD,UAyE9ByD,aAAcA,UAAQzD,QAAWyD,aAAWzD,sDAAjFqD,2BAAA4C,GACI9C,2BAAA+C,GACI/C,2BAAAgD,oBACO1C,wDA7EgBA,UAAQzD,QAAUyD"}
1
+ {"version":3,"file":"Search.js","sources":["../../../../src/js/components/shop/Search.vue","../../../../src/js/components/shop/Search.vue?vue&type=template&id=2edb6b6a&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)\"></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=\"placeholder\" @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=\"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=\"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 <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 <div>\n <a :href=\"item.href + searchHrefWithParameter\">{{ item.name }}</a>\n </div>\n <div>\n {{\n __('shop.search.category_found', {\n count: item.count\n })\n }}\n </div>\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\" :data-code=\"item.code\" shop-product>\n <div class=\"column\">\n <div class=\"title\">\n <a :href=\"item.href\" shop-product-name>\n {{ item.name }}\n </a>\n </div>\n <div class=\"price\" v-html=\"item.price\" shop-product-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\" :product=\"item\" :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\">\n {{ __('shop.search.no_results') }}\n </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 parameter: {\n type: String,\n default: '/q{separator}'\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 isDropdown.value = false;\n current.value = -1;\n }\n };\n\n const dropdown = () => {\n isDropdown.value = true;\n current.value = -1;\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 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 };\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)\"></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=\"placeholder\" @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=\"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=\"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 <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 <div>\n <a :href=\"item.href + searchHrefWithParameter\">{{ item.name }}</a>\n </div>\n <div>\n {{\n __('shop.search.category_found', {\n count: item.count\n })\n }}\n </div>\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\" :data-code=\"item.code\" shop-product>\n <div class=\"column\">\n <div class=\"title\">\n <a :href=\"item.href\" shop-product-name>\n {{ item.name }}\n </a>\n </div>\n <div class=\"price\" v-html=\"item.price\" shop-product-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\" :product=\"item\" :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\">\n {{ __('shop.search.no_results') }}\n </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 parameter: {\n type: String,\n default: '/q{separator}'\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 isDropdown.value = false;\n current.value = -1;\n }\n };\n\n const dropdown = () => {\n isDropdown.value = true;\n current.value = -1;\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 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 };\n }\n});\n</script>"],"names":["defineComponent","name","props","q","type","String","default","placeholder","parameter","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","finally","length","indexOf","filter","item","slice","unshift","set","onBeforeUpdate","watch","searchUrl","$env","locale","url","searchHrefWithParameter","replace","toLowerCase","close","event","target","closest","window","addEventListener","categories","load","menuElement","getElementById","querySelectorAll","forEach","element","textContent","dataset","push","href","resolve","arguments","i","next","prev","add","preventDefault","cartRefs","el","preventCaret","which","esc","blur","dropdown","open","location","clearSearchHistory","remove","focus","setSearchHistory","class","_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","_hoisted_20","_hoisted_21","_hoisted_22","_hoisted_24","_hoisted_25","id","code","_hoisted_27","_hoisted_28","price","price_old","_hoisted_31","_hoisted_33","quantity","_hoisted_34","_hoisted_35","is_eol","_hoisted_37","_hoisted_36","_createVNode","product","_hoisted_38","_hoisted_39","_hoisted_40"],"mappings":"kOA4HA,MAA6BA,kBAAgB,CACzCC,KAAM,SACNC,MAAO,CACHC,EAAG,CACCC,KAAMC,OACNC,QAAS,IAEbC,YAAa,CACTH,KAAMC,OACNC,QAAS,IAEbE,UAAW,CACPJ,KAAMC,OACNC,QAAS,kBAGjBG,eAAMP,OACIQ,EAAK,IAAIC,UAAS,CACpBC,eAAe,IAGfT,EAAID,EAAMC,KAEVA,EAAG,KACCU,EAAUC,SAASC,cAAc,YACrCF,EAAQG,UAAYb,EACpBA,EAAIU,EAAQI,UAGVC,EAAYC,OAAI,GAChBC,EAAOD,MAAIhB,GACXkB,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,EAAKH,OACX0B,MAAK,SAACC,GACCA,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pC,6BAAMxF,UAAQqC,EAAKsF,wDAEvBnC,2BAAAqC,oBAAqBxF,EAAKkF,SACElF,EAAKyF,wBAAjCpC,2BAAAqC,oBACOjC,iDAEPJ,4BAAAsC,oBACOlC,qCAG0BzD,EAAK4F,sBAG1CvC,2BAAAwC,oBACOpC,4CAJPJ,2BAAAyC,GACIC,iBAAWd,GAAIjF,EAAKiF,yBAAyB,wBAA4B,EAAQe,QAAShG,EAAOlC,IAAK2F,kHA/DxFA,UAAQ5D,QAAU4D,aAAW5D,UAyE9B4D,aAAcA,UAAQ5D,QAAW4D,aAAW5D,sDAAjFwD,2BAAA4C,GACI9C,2BAAA+C,GACI/C,2BAAAgD,oBACO1C,wDA7EgBA,UAAQ5D,QAAU4D"}
@@ -1,2 +1,2 @@
1
- "use strict";var e=require("swiper/core"),t=require("countdown.to");function n(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var i=n(e),r=n(t);i.default.use([e.Navigation,e.Pagination]);var a={name:"bundle",props:{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"}},setup(e){var t=(e,t)=>e+" "+t[e%100>4&&e%100<20?2:[2,0,1,1,1,2][Math.min(e%10,5)]];window.addEventListener("DOMContentLoaded",()=>{var n=document.getElementById("bundles-root");new i.default(n,{slidesPerView:1,spaceBetween:24,allowTouchMove:!1,mousewheel:{forceToAxis:!0},navigation:{nextEl:e.next,prevEl:e.prev}}),n.querySelectorAll("#bundles-root > .swiper-wrapper > .swiper-slide").forEach((n,a)=>{var o=[],l=[],u=n.querySelectorAll(".bundle-info"),s=n.querySelectorAll(".bundles-subproduct");if(n.dataset.finish){var d=n.querySelector(".countdown");new r.default(n.dataset.finish,{onCalculateRemainingTime:function(){var e=this.timeRemaining[1],n=this.timeRemaining[2];if(e>0)d.innerHTML=t(e,__("shop.pluralize.monthes"));else if(n>0)d.innerHTML=t(n,__("shop.pluralize.days"));else{var i=this.timeRemaining[3],r=this.timeRemaining[4],a=this.timeRemaining[5];d.innerHTML=i+":"+r+":"+a}}})}s.forEach((t,n)=>{var r=t.querySelector(e.thumbNext),s=t.querySelector(e.thumbPrev),d=t.querySelector(".swiper-pagination");o[n]=0,d&&(l[n]=new i.default(t.querySelector(".swiper-container"),{slidesPerView:1,spaceBetween:24,navigation:{nextEl:r,prevEl:s},pagination:{el:d,clickable:!0},on:{slideChange:function(e){o[n]=e.activeIndex,u.forEach(e=>{e.classList.add("is-hidden")});var t="bundle"+a+"-info-"+o.join("-");document.getElementById(t).classList.remove("is-hidden")}}}))})})})}};a.render=function(e,t,n,i,r,a){return null},module.exports=a;
1
+ "use strict";var e=require("swiper/core"),t=require("countdown.to");function n(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var i=n(e),r=n(t);i.default.use([e.Navigation,e.Pagination]);var o={name:"bundle",props:{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"}},setup:function(e){var t=function(e,t){return e+" "+t[e%100>4&&e%100<20?2:[2,0,1,1,1,2][Math.min(e%10,5)]]};window.addEventListener("DOMContentLoaded",(function(){var n=document.getElementById("bundles-root");new i.default(n,{slidesPerView:1,spaceBetween:24,allowTouchMove:!1,mousewheel:{forceToAxis:!0},navigation:{nextEl:e.next,prevEl:e.prev}}),n.querySelectorAll("#bundles-root > .swiper-wrapper > .swiper-slide").forEach((function(n,o){var a=[],u=[],l=n.querySelectorAll(".bundle-info"),s=n.querySelectorAll(".bundles-subproduct");if(n.dataset.finish){var d=n.querySelector(".countdown");new r.default(n.dataset.finish,{onCalculateRemainingTime:function(){var e=this.timeRemaining[1],n=this.timeRemaining[2];if(e>0)d.innerHTML=t(e,__("shop.pluralize.monthes"));else if(n>0)d.innerHTML=t(n,__("shop.pluralize.days"));else{var i=this.timeRemaining[3],r=this.timeRemaining[4],o=this.timeRemaining[5];d.innerHTML=i+":"+r+":"+o}}})}s.forEach((function(t,n){var r=t.querySelector(e.thumbNext),s=t.querySelector(e.thumbPrev),d=t.querySelector(".swiper-pagination");a[n]=0,d&&(u[n]=new i.default(t.querySelector(".swiper-container"),{slidesPerView:1,spaceBetween:24,navigation:{nextEl:r,prevEl:s},pagination:{el:d,clickable:!0},on:{slideChange:function(e){a[n]=e.activeIndex,l.forEach((function(e){e.classList.add("is-hidden")}));var t="bundle"+o+"-info-"+a.join("-");document.getElementById(t).classList.remove("is-hidden")}}}))}))}))}))}};o.render=function(e,t,n,i,r,o){return null},module.exports=o;
2
2
  //# sourceMappingURL=Bundle.js.map