rumine-web/static/wagtailadmin/js/core.js

2 lines
73 KiB
JavaScript
Raw Normal View History

2024-03-13 07:49:06 +01:00
/*! For license information please see core.js.LICENSE.txt */
(()=>{"use strict";var e,t={6525:(e,t,n)=>{var i=n(5311),o=n.n(i),r=n(6599),a=n(7647),s=n.n(a),l=n(1302),c=n(3407),h=n(5697),d=n.n(h);d().shape({live:d().bool.isRequired,status:d().string.isRequired}).isRequired;var u=n(335),p=n.n(u);const f=({name:e,component:t,className:n,duration:i,children:o})=>s().createElement(p(),{component:t,transitionEnterTimeout:i,transitionLeaveTimeout:i,transitionName:`w-transition-${e}`,className:n},o);f.propTypes={name:d().oneOf(["push","pop"]).isRequired,component:d().string,className:d().string,duration:d().number,children:d().node},f.defaultProps={component:"div",children:null,className:null,duration:210};var g=n(434);class m extends r.Controller{static values={continue:{type:Boolean,default:!1},url:String};click(){this.element.click()}noop(){}post(e){e.preventDefault(),e.stopPropagation();const t=document.createElement("form");t.action=this.urlValue,t.method="POST";const n=document.createElement("input");if(n.type="hidden",n.name="csrfmiddlewaretoken",n.value=g.QF.CSRF_TOKEN,t.appendChild(n),!this.continueValue){const e=document.createElement("input");e.type="hidden",e.name="next",e.value=window.location.href,t.appendChild(e)}document.body.appendChild(t),t.submit()}redirect(e){const t=e?.params?.url??e?.detail?.url??this.element.value;t&&window.location.assign(t)}reset(e){const t=this.element,n=t.value,{value:i=""}={value:t instanceof HTMLInputElement?t.defaultValue:"",...e?.params,...e?.detail};n!==i&&(t.value=i,this.dispatch("change",{bubbles:!0,cancelable:!1,prefix:"",target:t}))}select(){const e=this.element;e&&(e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement)&&e.select()}}var v=new Map;function b(e){var t=v.get(e);t&&t.destroy()}function y(e){var t=v.get(e);t&&t.update()}var w=null;"undefined"==typeof window?((w=function(e){return e}).destroy=function(e){return e},w.update=function(e){return e}):((w=function(e,t){return e&&Array.prototype.forEach.call(e.length?e:[e],(function(e){return function(e){if(e&&e.nodeName&&"TEXTAREA"===e.nodeName&&!v.has(e)){var t,n=null,i=window.getComputedStyle(e),o=(t=e.value,function(){a({testForHeightReduction:""===t||!e.value.startsWith(t),restoreTextAlign:null}),t=e.value}),r=function(t){e.removeEventListener("autosize:destroy",r),e.removeEventListener("autosize:update",s),e.removeEventListener("input",o),window.removeEventListener("resize",s),Object.keys(t).forEach((function(n){return e.style[n]=t[n]})),v.delete(e)}.bind(e,{height:e.style.height,resize:e.style.resize,textAlign:e.style.textAlign,overflowY:e.style.overflowY,overflowX:e.style.overflowX,wordWrap:e.style.wordWrap});e.addEventListener("autosize:destroy",r),e.addEventListener("autosize:update",s),e.addEventListener("input",o),window.addEventListener("resize",s),e.style.overflowX="hidden",e.style.wordWrap="break-word",v.set(e,{destroy:r,update:s}),s()}function a(t){var o,r,s=t.restoreTextAlign,l=void 0===s?null:s,c=t.testForHeightReduction,h=void 0===c||c,d=i.overflowY;if(0!==e.scrollHeight&&("vertical"===i.resize?e.style.resize="none":"both"===i.resize&&(e.style.resize="horizontal"),h&&(o=function(e){for(var t=[];e&&e.parentNode&&e.parentNode instanceof Element;)e.parentNode.scrollTop&&t.push([e.parentNode,e.parentNode.scrollTop]),e=e.parentNode;return function(){return t.forEach((function(e){var t=e[0],n=e[1];t.style.scrollBehavior="auto",t.scrollTop=n,t.style.scrollBehavior=null}))}}(e),e.style.height=""),r="content-box"===i.boxSizing?e.scrollHeight-(parseFloat(i.paddingTop)+parseFloat(i.paddingBottom)):e.scrollHeight+parseFloat(i.borderTopWidth)+parseFloat(i.borderBottomWidth),"none"!==i.maxHeight&&r>parseFloat(i.maxHeight)?("hidden"===i.overflowY&&(e.style.overflow="scroll"),r=parseFloat(i.maxHeight)):"hidden"!==i.overflowY&&(e.style.overflow="hidden"),e.style.height=r+"px",l&&(e.style.textAlign=l),o&&o(),n!==r&&(e.dispatchEvent(new Event("autosize:resized",{bubbles:!0})),n=r),d!==i.overflow&&!l)){var u=i.textAlign;"hidden"===i.overflow&&(e.style.textAlign="start"===u?"end":"start"),a({restoreTextAlign:u,testForHeightReduction:!0})}}function s(){a({testForHeightReduct