@apicart/vue-components
Version:
Apicart Vue.Js components for simple e-commerce platform development
8 lines (6 loc) • 5.31 kB
JavaScript
/**
* @apicart/vue-components v1.0.0-alpha7
* (c) 2018-2020 Apicart Company
* Released under the MIT License.
*/
!function(t,a){"object"==typeof exports&&"undefined"!=typeof module?module.exports=a(require("@apicart/core-sdk"),require("../.."),require("./..")):"function"==typeof define&&define.amd?define(["@apicart/core-sdk","../..","./.."],a):(t=t||self).ApicartCartDialog=a(t.Apicart,t.src,t.components)}(this,(function(t,a,e){"use strict";t=t&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t;var i={enabled:!0,dispatcherEvents:["apicart:cart:item:added"]},r=(t.VueComponentsTranslator||a.Translator).getI18n(),o=null,c="undefined"!=typeof window,n={name:"apicart-cart-dialog",components:{"apicart-dialog":c&&window.ApicartDialog?window.ApicartDialog:e.ApicartDialog,"apicart-buy-button-with-quantity":c&&window.ApicartBuyButtonWithQuantity?window.ApicartBuyButtonWithQuantity:e.ApicartBuyButtonWithQuantity},i18n:r,data:function(){return{cartItem:null,enabled:!1}},created:function(){i=t.Utils.Objects.merge(i,t.getConfigParameter("vueComponents.cartDialog")),this.enabled=i.enabled,t.getConfigParameter("store")},mounted:function(){var a=this;void 0!==this.$refs.apicartDialog&&i.enabled&&(o=this.$refs,t.Utils.EventDispatcher.addListener("apicart-cart-dialog-"+this._uid,i.dispatcherEvents,(function(t){a.cartItem=t,o.apicartDialog.open()})))}};!function(t,a){void 0===a&&(a={});var e=a.insertAt;if(t&&"undefined"!=typeof document){var i=document.head||document.getElementsByTagName("head")[0],r=document.createElement("style");r.type="text/css","top"===e&&i.firstChild?i.insertBefore(r,i.firstChild):i.appendChild(r),r.styleSheet?r.styleSheet.cssText=t:r.appendChild(document.createTextNode(t))}}('.apicart-cart-dialog{font-family:-apple-system,"Segoe UI",Roboto,Oxygen,Ubuntu,Cantarell,"Helvetica Neue",Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol";-webkit-font-smoothing:antialiased;box-sizing:border-box;outline:0}.apicart-cart-dialog *{box-sizing:border-box;outline:0}.apicart-cart-dialog.apicart-dialog__mask{z-index:9999}.apicart-cart-dialog .apicart-dialog__container{max-width:600px}.apicart-cart-dialog .apicart-cart-dialog__title{margin:0}.apicart-cart-dialog .apicart-cart-dialog__item{align-items:center;display:flex;background:#f8f9fa!important;border-radius:2px;padding:8px}.apicart-cart-dialog .apicart-cart-dialog__item-image-wrapper{max-width:80px;display:flex;max-height:80px;margin-right:12px}@media (min-width:768px){.apicart-cart-dialog .apicart-cart-dialog__item-image-wrapper{max-width:160px;max-height:160px}}.apicart-cart-dialog .apicart-cart-dialog__item-image{max-width:100%;max-height:100%;display:inline-block}.apicart-cart-dialog .apicart-cart-dialog__item-info{display:flex;flex-direction:column;flex:1}.apicart-cart-dialog .apicart-cart-dialog__item-name{margin-bottom:12px;font-size:20px}.apicart-cart-dialog .apicart-cart-dialog__item-price-quantity-wrapper{display:flex;align-items:center;flex-wrap:wrap;justify-content:space-between}.apicart-cart-dialog .apicart-cart-dialog__item-price{margin-right:12px}');return function(t,a,e,i,r,o,c,n,d,s){"boolean"!=typeof c&&(d=n,n=c,c=!1);const l="function"==typeof e?e.options:e;let p;if(t&&t.render&&(l.render=t.render,l.staticRenderFns=t.staticRenderFns,l._compiled=!0,r&&(l.functional=!0)),i&&(l._scopeId=i),o?(p=function(t){(t=t||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext)||"undefined"==typeof __VUE_SSR_CONTEXT__||(t=__VUE_SSR_CONTEXT__),a&&a.call(this,d(t)),t&&t._registeredComponents&&t._registeredComponents.add(o)},l._ssrRegister=p):a&&(p=c?function(t){a.call(this,s(t,this.$root.$options.shadowRoot))}:function(t){a.call(this,n(t))}),p)if(l.functional){const t=l.render;l.render=function(a,e){return p.call(e),t(a,e)}}else{const t=l.beforeCreate;l.beforeCreate=t?[].concat(t,p):[p]}return e}({render:function(){var t=this,a=t.$createElement,e=t._self._c||a;return e("apicart-dialog",{directives:[{name:"show",rawName:"v-show",value:t.cartItem,expression:"cartItem"}],ref:"apicartDialog",staticClass:"apicart-cart-dialog"},[t.cartItem?e("div",{attrs:{slot:"header"},slot:"header"},[e("h1",{staticClass:"apicart-dialog__title apicart-cart-dialog__title"},[t._v(t._s(t.$t("cartDialog.title")))])]):t._e(),t.cartItem?e("div",{attrs:{slot:"body"},slot:"body"},[e("div",{staticClass:"apicart-cart-dialog__item"},[t.cartItem.getItem().getParameterValue("images").primary.url?e("div",{staticClass:"apicart-cart-dialog__item-image-wrapper"},[e("img",{staticClass:"apicart-cart-dialog__item-image",attrs:{src:t.cartItem.getItem().getParameterValue("images").primary.url,alt:""}})]):t._e(),e("div",{staticClass:"apicart-cart-dialog__item-info"},[e("div",{staticClass:"apicart-cart-dialog__item-name"},[e("strong",[t._v(t._s(t.cartItem.getItem().getName()))])]),e("div",{staticClass:"apicart-cart-dialog__item-price-quantity-wrapper"},[e("div",{staticClass:"apicart-cart-dialog__item-price"},[t._v(t._s(t.$n(t.cartItem.getItem().getPrice(),"currency")))]),e("div",{staticClass:"apicart-cart-dialog__item-quantity-manipulator"},[e("apicart-buy-button-with-quantity",{attrs:{productUrl:t.cartItem.getItem().getDataUrl()}})],1)])])])]):t._e()])},staticRenderFns:[]},void 0,n,void 0,!1,void 0,!1,void 0,void 0,void 0)}));