관리-도구
편집 파일: control.js
(()=>{"use strict";const t=React,e=function(e){var n=e.control,o=e.customizerSetting,a=e.choices,i="";n.updateComponentState=function(t){"slider"===i?s.current.textContent=t:"input"===i?l.current.value=t:"reset"===i&&(s.current.textContent=t,l.current.value=t)};var r="kirki-control-input-".concat(o.id),c=""!==e.value?e.value:0,l=(0,t.useRef)(null),s=(0,t.useRef)(null);return React.createElement("div",{className:"kirki-control-form",tabIndex:"1"},React.createElement("label",{className:"kirki-control-label",htmlFor:r},React.createElement("span",{className:"customize-control-title"},e.label),React.createElement("span",{className:"customize-control-description description",dangerouslySetInnerHTML:{__html:e.description}})),React.createElement("div",{className:"customize-control-notifications-container",ref:e.setNotificationContainer}),React.createElement("button",{type:"button",className:"kirki-control-reset",onClick:function(t){""!==e.default&&void 0!==e.default?(l.current.value=e.default,s.current.textContent=e.default):""!==e.value?(l.current.value=e.value,s.current.textContent=e.value):(l.current.value=a.min,s.current.textContent=""),i="reset",o.set(l.current.value)}},React.createElement("i",{className:"dashicons dashicons-image-rotate"})),React.createElement("div",{className:"kirki-control-cols"},React.createElement("div",{className:"kirki-control-left-col"},React.createElement("input",{ref:l,type:"range",id:r,defaultValue:c,min:a.min,max:a.max,step:a.step,className:"kirki-control-slider",onChange:function(t){i="range"===t.target.type?"slider":"input";var e=t.target.value;e<a.min&&(e=a.min),e>a.max&&(e=a.max),"input"===i&&(t.target.value=e),o.set(e)}})),React.createElement("div",{className:"kirki-control-right-col"},React.createElement("div",{className:"kirki-control-value",ref:s},c))))};function n(){return n=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(t[o]=n[o])}return t},n.apply(this,arguments)}const o=wp.customize.Control.extend({initialize:function(t,e){var n=this;n.setNotificationContainer=n.setNotificationContainer.bind(n),wp.customize.Control.prototype.initialize.call(n,t,e),wp.customize.control.bind("removed",(function t(e){n===e&&(n.destroy(),n.container.remove(),wp.customize.control.unbind("removed",t))}))},setNotificationContainer:function(t){this.notifications.container=jQuery(t),this.notifications.render()},renderContent:function(){var t=this;ReactDOM.render(React.createElement(e,n({},t.params,{control:t,customizerSetting:t.setting,setNotificationContainer:t.setNotificationCotainer,value:t.params.value})),t.container[0]),!1!==t.params.choices.allowCollapse&&t.container.addClass("allowCollapse")},ready:function(){var t=this;t.setting.bind((function(e){t.updateComponentState(e)}))},updateComponentState:function(t){},destroy:function(){ReactDOM.unmountComponentAtNode(this.container[0]),wp.customize.Control.prototype.destroy&&wp.customize.Control.prototype.destroy.call(this)}});wp.customize.controlConstructor["kirki-slider"]=o})(); //# sourceMappingURL=control.js.map