← Back
Editing: catalog-sorting.js
(()=>{var e,o,t,r={49683:(e,o,t)=>{"use strict";const r=window.wp.blocks;var n=t(11789),l=t(5573),s=t(10790);const i=(0,s.jsxs)(l.SVG,{xmlns:"http://www.w3.org/2000/SVG",viewBox:"0 0 24 24",fill:"none",children:[(0,s.jsx)("path",{stroke:"currentColor",strokeWidth:"1.5",fill:"none",d:"M6 3.75h12c.69 0 1.25.56 1.25 1.25v14c0 .69-.56 1.25-1.25 1.25H6c-.69 0-1.25-.56-1.25-1.25V5c0-.69.56-1.25 1.25-1.25z"}),(0,s.jsx)("path",{fill:"currentColor",fillRule:"evenodd",d:"M6.9 7.5A1.1 1.1 0 018 6.4h8a1.1 1.1 0 011.1 1.1v2a1.1 1.1 0 01-1.1 1.1H8a1.1 1.1 0 01-1.1-1.1v-2zm1.2.1v1.8h7.8V7.6H8.1z",clipRule:"evenodd"}),(0,s.jsx)("path",{fill:"currentColor",d:"M8.5 12h1v1h-1v-1zM8.5 14h1v1h-1v-1zM8.5 16h1v1h-1v-1zM11.5 12h1v1h-1v-1zM11.5 14h1v1h-1v-1zM11.5 16h1v1h-1v-1zM14.5 12h1v1h-1v-1zM14.5 14h1v1h-1v-1zM14.5 16h1v1h-1v-1z"})]}),c=JSON.parse('{"name":"woocommerce/catalog-sorting","title":"Catalog Sorting","description":"Enable customers to change the sorting order of the products.","category":"woocommerce","keywords":["WooCommerce"],"supports":{"interactivity":true,"color":{"text":true,"background":true,"gradients":true},"typography":{"fontSize":true,"textAlign":true,"__experimentalFontFamily":true,"__experimentalFontWeight":true,"__experimentalFontStyle":true,"__experimentalLetterSpacing":true},"spacing":{"margin":true,"padding":true}},"viewScriptModule":"woocommerce/catalog-sorting","style":"file:../woocommerce/catalog-sorting-style.css","attributes":{"fontSize":{"type":"string","default":"small"},"useLabel":{"type":"boolean","default":false}},"textdomain":"woocommerce","apiVersion":3,"$schema":"https://schemas.wp.org/trunk/block.json"}'),a=window.wp.blockEditor;var u=t(27723);const h=window.wp.components,p=({useLabel:e})=>(0,s.jsx)(s.Fragment,{children:e?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("label",{htmlFor:"woocommerce-orderby",children:(0,u.__)("Sort by","woocommerce")}),(0,s.jsx)("select",{className:"orderby",id:"woocommerce-orderby",children:(0,s.jsx)("option",{children:(0,u.__)("Default","woocommerce")})})]}):(0,s.jsx)("select",{className:"orderby",children:(0,s.jsx)("option",{children:(0,u.__)("Default sorting","woocommerce")})})});t(47950),(0,r.registerBlockType)(c,{icon:{src:(0,s.jsx)(n.A,{icon:i,className:"wc-block-editor-components-block-icon"})},attributes:{...c.attributes},edit:({attributes:e,setAttributes:o})=>{const{useLabel:t}=e,r=(0,a.useBlockProps)({className:"woocommerce wc-block-catalog-sorting"});return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(a.InspectorControls,{children:(0,s.jsx)(h.__experimentalToolsPanel,{label:(0,u.__)("Accessibility","woocommerce"),resetAll:()=>{o({useLabel:!1})},children:(0,s.jsx)(h.__experimentalToolsPanelItem,{hasValue:()=>!1!==t,label:(0,u.__)("Show visual label","woocommerce"),onDeselect:()=>o({useLabel:!1}),isShownByDefault:!0,children:(0,s.jsx)(h.ToggleControl,{__nextHasNoMarginBottom:!0,label:(0,u.__)("Show visual label","woocommerce"),help:(0,u.__)('Displays "Sort by" text before the dropdown menu to improve clarity and accessibility.',"woocommerce"),checked:t,onChange:e=>o({useLabel:e})})})})}),(0,s.jsx)("div",{...r,children:(0,s.jsx)(h.Disabled,{children:(0,s.jsx)(p,{useLabel:t})})})]})},save:()=>null})},47950:()=>{},10790:e=>{"use strict";e.exports=window.ReactJSXRuntime},86087:e=>{"use strict";e.exports=window.wp.element},27723:e=>{"use strict";e.exports=window.wp.i18n},5573:e=>{"use strict";e.exports=window.wp.primitives}},n={};function l(e){var o=n[e];if(void 0!==o)return o.exports;var t=n[e]={exports:{}};return r[e](t,t.exports,l),t.exports}l.m=r,e=[],l.O=(o,t,r,n)=>{if(!t){var s=1/0;for(u=0;u<e.length;u++){for(var[t,r,n]=e[u],i=!0,c=0;c<t.length;c++)(!1&n||s>=n)&&Object.keys(l.O).every(e=>l.O[e](t[c]))?t.splice(c--,1):(i=!1,n<s&&(s=n));if(i){e.splice(u--,1);var a=r();void 0!==a&&(o=a)}}return o}n=n||0;for(var u=e.length;u>0&&e[u-1][2]>n;u--)e[u]=e[u-1];e[u]=[t,r,n]},l.n=e=>{var o=e&&e.__esModule?()=>e.default:()=>e;return l.d(o,{a:o}),o},t=Object.getPrototypeOf?e=>Object.getPrototypeOf(e):e=>e.__proto__,l.t=function(e,r){if(1&r&&(e=this(e)),8&r)return e;if("object"==typeof e&&e){if(4&r&&e.__esModule)return e;if(16&r&&"function"==typeof e.then)return e}var n=Object.create(null);l.r(n);var s={};o=o||[null,t({}),t([]),t(t)];for(var i=2&r&&e;"object"==typeof i&&!~o.indexOf(i);i=t(i))Object.getOwnPropertyNames(i).forEach(o=>s[o]=()=>e[o]);return s.default=()=>e,l.d(n,s),n},l.d=(e,o)=>{for(var t in o)l.o(o,t)&&!l.o(e,t)&&Object.defineProperty(e,t,{enumerable:!0,get:o[t]})},l.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),l.o=(e,o)=>Object.prototype.hasOwnProperty.call(e,o),l.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},l.j=7619,(()=>{var e={7619:0};l.O.j=o=>0===e[o];var o=(o,t)=>{var r,n,[s,i,c]=t,a=0;if(s.some(o=>0!==e[o])){for(r in i)l.o(i,r)&&(l.m[r]=i[r]);if(c)var u=c(l)}for(o&&o(t);a<s.length;a++)n=s[a],l.o(e,n)&&e[n]&&e[n][0](),e[n]=0;return l.O(u)},t=globalThis.webpackChunkwebpackWcBlocksMainJsonp=globalThis.webpackChunkwebpackWcBlocksMainJsonp||[];t.forEach(o.bind(null,0)),t.push=o.bind(null,t.push.bind(t))})();var s=l.O(void 0,[94],()=>l(49683));s=l.O(s),((this.wc=this.wc||{}).blocks=this.wc.blocks||{})["catalog-sorting"]=s})();
Save File
Cancel