BIHomeWP/wp-content/plugins/woocommerce/packages/woocommerce-blocks/build/product-search.js
2020-02-13 10:39:37 +07:00

1 line
9.0 KiB
JavaScript

this.wc=this.wc||{},this.wc.blocks=this.wc.blocks||{},this.wc.blocks["product-search"]=function(e){function t(t){for(var c,a,l=t[0],i=t[1],s=t[2],b=0,d=[];b<l.length;b++)a=l[b],Object.prototype.hasOwnProperty.call(r,a)&&r[a]&&d.push(r[a][0]),r[a]=0;for(c in i)Object.prototype.hasOwnProperty.call(i,c)&&(e[c]=i[c]);for(u&&u(t);d.length;)d.shift()();return o.push.apply(o,s||[]),n()}function n(){for(var e,t=0;t<o.length;t++){for(var n=o[t],c=!0,l=1;l<n.length;l++){var i=n[l];0!==r[i]&&(c=!1)}c&&(o.splice(t--,1),e=a(a.s=n[0]))}return e}var c={},r={18:0},o=[];function a(t){if(c[t])return c[t].exports;var n=c[t]={i:t,l:!1,exports:{}};return e[t].call(n.exports,n,n.exports,a),n.l=!0,n.exports}a.m=e,a.c=c,a.d=function(e,t,n){a.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},a.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},a.t=function(e,t){if(1&t&&(e=a(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(a.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var c in e)a.d(n,c,function(t){return e[t]}.bind(null,c));return n},a.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return a.d(t,"a",t),t},a.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},a.p="";var l=window.webpackWcBlocksJsonp=window.webpackWcBlocksJsonp||[],i=l.push.bind(l);l.push=t,l=l.slice();for(var s=0;s<l.length;s++)t(l[s]);var u=i;return o.push([656,2,1,0]),n()}({0:function(e,t){!function(){e.exports=this.wp.element}()},1:function(e,t){!function(){e.exports=this.wp.i18n}()},18:function(e,t,n){"use strict";n.d(t,"e",(function(){return r})),n.d(t,"r",(function(){return o})),n.d(t,"k",(function(){return a})),n.d(t,"m",(function(){return l})),n.d(t,"b",(function(){return i})),n.d(t,"l",(function(){return s})),n.d(t,"o",(function(){return u})),n.d(t,"d",(function(){return b})),n.d(t,"n",(function(){return d})),n.d(t,"c",(function(){return p})),n.d(t,"p",(function(){return g})),n.d(t,"i",(function(){return h})),n.d(t,"j",(function(){return f})),n.d(t,"f",(function(){return m})),n.d(t,"g",(function(){return w})),n.d(t,"h",(function(){return O})),n.d(t,"q",(function(){return j})),n.d(t,"a",(function(){return _})),n.d(t,"s",(function(){return v}));var c=n(4),r=Object(c.getSetting)("enableReviewRating",!0),o=Object(c.getSetting)("showAvatars",!0),a=Object(c.getSetting)("max_columns",6),l=Object(c.getSetting)("min_columns",1),i=Object(c.getSetting)("default_columns",3),s=Object(c.getSetting)("max_rows",6),u=Object(c.getSetting)("min_rows",1),b=Object(c.getSetting)("default_rows",2),d=Object(c.getSetting)("min_height",500),p=Object(c.getSetting)("default_height",500),g=Object(c.getSetting)("placeholderImgSrc",""),h=(Object(c.getSetting)("thumbnail_size",300),Object(c.getSetting)("isLargeCatalog")),f=Object(c.getSetting)("limitTags"),m=Object(c.getSetting)("hasProducts",!0),w=Object(c.getSetting)("hasTags",!0),O=Object(c.getSetting)("homeUrl",""),j=Object(c.getSetting)("productCount",0),_=Object(c.getSetting)("attributes",[]),v=Object(c.getSetting)("wcBlocksAssetUrl","")},21:function(e,t){!function(){e.exports=this.wp.compose}()},22:function(e,t){!function(){e.exports=this.wp.editor}()},23:function(e,t){!function(){e.exports=this.wp.blocks}()},3:function(e,t){!function(){e.exports=this.wp.components}()},338:function(e,t,n){var c=n(607);"string"==typeof c&&(c=[[e.i,c,""]]);var r={insert:"head",singleton:!1};n(30)(c,r);c.locals&&(e.exports=c.locals)},4:function(e,t){!function(){e.exports=this.wc.wcSettings}()},607:function(e,t,n){},656:function(e,t,n){"use strict";n.r(t);var c=n(11),r=n.n(c),o=n(0),a=n(1),l=n(23),i=n(22),s=n(3),u=(n(337),n(338),n(13)),b=n.n(u),d=n(17),p=n.n(d),g=n(14),h=n.n(g),f=n(15),m=n.n(f),w=n(16),O=n.n(w),j=n(6),_=n.n(j),v=(n(2),n(21)),k=n(18),y=function(e){function t(){return b()(this,t),h()(this,m()(t).apply(this,arguments))}return O()(t,e),p()(t,[{key:"renderView",value:function(){var e=this.props.attributes,t=e.label,n=e.placeholder,c=e.formId,r=e.className,l=e.hasLabel,i=e.align,s=_()("wc-block-product-search",i?"align"+i:"",r);return Object(o.createElement)("div",{className:s},Object(o.createElement)("form",{role:"search",method:"get",action:k.h},Object(o.createElement)("label",{htmlFor:c,className:l?"wc-block-product-search__label":"wc-block-product-search__label screen-reader-text"},t),Object(o.createElement)("div",{className:"wc-block-product-search__fields"},Object(o.createElement)("input",{type:"search",id:c,className:"wc-block-product-search__field",placeholder:n,name:"s"}),Object(o.createElement)("input",{type:"hidden",name:"post_type",value:"product"}),Object(o.createElement)("button",{type:"submit",className:"wc-block-product-search__button",label:Object(a.__)("Search",'woocommerce')},Object(o.createElement)("svg",{"aria-hidden":"true",role:"img",focusable:"false",className:"dashicon dashicons-arrow-right-alt2",xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 20 20"},Object(o.createElement)("path",{d:"M6 15l5-5-5-5 1-2 7 7-7 7z"}))))))}},{key:"renderEdit",value:function(){var e=this.props,t=e.attributes,n=e.setAttributes,c=e.instanceId,r=t.label,l=t.placeholder,s=t.formId,u=t.className,b=t.hasLabel,d=t.align,p=_()("wc-block-product-search",d?"align"+d:"",u);return s||n({formId:"wc-block-product-search-".concat(c)}),Object(o.createElement)("div",{className:p},!!b&&Object(o.createElement)(i.PlainText,{className:"wc-block-product-search__label",value:r,onChange:function(e){return n({label:e})}}),Object(o.createElement)("div",{className:"wc-block-product-search__fields"},Object(o.createElement)(i.PlainText,{className:"wc-block-product-search__field input-control",value:l,onChange:function(e){return n({placeholder:e})}}),Object(o.createElement)("button",{type:"submit",className:"wc-block-product-search__button",label:Object(a.__)("Search",'woocommerce'),onClick:function(e){return e.preventDefault()},tabIndex:"-1"},Object(o.createElement)("svg",{"aria-hidden":"true",role:"img",focusable:"false",className:"dashicon dashicons-arrow-right-alt2",xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 20 20"},Object(o.createElement)("path",{d:"M6 15l5-5-5-5 1-2 7 7-7 7z"})))))}},{key:"render",value:function(){return this.props.isEditor?this.renderEdit():this.renderView()}}]),t}(o.Component),E=Object(v.compose)([v.withInstanceId])(y);Object(l.registerBlockType)("woocommerce/product-search",{title:Object(a.__)("Product Search",'woocommerce'),icon:{src:Object(o.createElement)((function(e){var t=e.className;return Object(o.createElement)(s.Icon,{className:t,icon:Object(o.createElement)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 23"},Object(o.createElement)("path",{d:"M13.0993 2.41207V2.01231C13.0993 0.912976 12.1999 0.0135193 11.1005 0.0135193H4.80435C3.70501 0.0135193 2.80556 0.912976 2.80556 2.01231V5.41026H21.1944V4.5108C21.1944 3.41147 20.295 2.51201 19.1957 2.51201H13.0993V2.41207Z"}),Object(o.createElement)("path",{d:"M8.60759 11.3092C7.50759 12.4092 7.50759 14.2092 8.60759 15.3092C9.70759 16.4092 11.5076 16.4092 12.6076 15.3092C13.7076 14.2092 13.7076 12.4092 12.6076 11.3092C11.5076 10.2092 9.70759 10.2092 8.60759 11.3092Z"}),Object(o.createElement)("path",{d:"M22.0076 7.10919H2.00759C0.80759 7.10919 -0.0924101 8.10919 0.00758988 9.30919L0.70759 20.4092C0.80759 21.5092 1.70759 22.3092 2.70759 22.3092H21.2076C22.3076 22.3092 23.2076 21.5092 23.2076 20.4092L24.0076 9.30919C24.1076 8.10919 23.1076 7.10919 22.0076 7.10919ZM16.5076 20.2092L13.4076 17.1092V16.5092L13.3076 16.4092C11.7076 17.8092 9.30759 17.7092 7.80759 16.2092C6.20759 14.6092 6.20759 12.0092 7.80759 10.4092C9.40759 8.80919 12.0076 8.80919 13.6076 10.4092C15.1076 11.9092 15.2076 14.3092 13.8076 15.9092L13.9076 16.0092H14.4076L17.5076 19.1092L16.5076 20.2092Z"}))})}),null),foreground:"#96588a"},category:"woocommerce",keywords:[Object(a.__)("WooCommerce",'woocommerce')],description:Object(a.__)("Help visitors find your products.",'woocommerce'),supports:{align:["wide","full"]},example:{attributes:{hasLabel:!0}},attributes:{hasLabel:{type:"boolean",default:!0},label:{type:"string",default:Object(a.__)("Search",'woocommerce'),source:"text",selector:"label"},placeholder:{type:"string",default:Object(a.__)("Search products...",'woocommerce'),source:"attribute",selector:"input.wc-block-product-search__field",attribute:"placeholder"},formId:{type:"string",default:""}},edit:function(e){var t=e.attributes,n=e.setAttributes,c=t.hasLabel;return Object(o.createElement)(o.Fragment,null,Object(o.createElement)(i.InspectorControls,{key:"inspector"},Object(o.createElement)(s.PanelBody,{title:Object(a.__)("Content",'woocommerce'),initialOpen:!0},Object(o.createElement)(s.ToggleControl,{label:Object(a.__)("Show search field label",'woocommerce'),help:c?Object(a.__)("Label is visible.",'woocommerce'):Object(a.__)("Label is hidden.",'woocommerce'),checked:c,onChange:function(){return n({hasLabel:!c})}}))),Object(o.createElement)(E,r()({},e,{isEditor:!0})))},save:function(e){return Object(o.createElement)("div",null,Object(o.createElement)(E,e))}})}});