diff --git a/crispy_formset_modal/static/crispy_formset_modal/js/crispy-formset-modal.min.js b/crispy_formset_modal/static/crispy_formset_modal/js/crispy-formset-modal.min.js index cef2694..2a0bcfc 100644 --- a/crispy_formset_modal/static/crispy_formset_modal/js/crispy-formset-modal.min.js +++ b/crispy_formset_modal/static/crispy_formset_modal/js/crispy-formset-modal.min.js @@ -1,2 +1,2 @@ -!function(t){"use strict";let e=window.gettext;const s=Object.prototype.hasOwnProperty;function i(){function t(){return Math.floor(65536*(1+Math.random())).toString(16).substring(1)}return`${t()+t()}-${t()}-${(4095&parseInt(t(),16)|16384).toString(16)}-${(16383&parseInt(t(),16)|32768).toString(16)}-${t()+t()+t()}`}function r(t){let e="";if("select"===t.tagName.toLowerCase()){let s=document.createElement("div");s.innerHTML=t.options[t.selectedIndex].innerText,e=s.innerText.split("\n").map((t=>t.trim())).join(" ").trim()}else i=t,r="inputmask",s.call(i,r)?e=t.inputmask.undoValue:"date"==t.getAttribute("type")?t.value&&(e=t.value):e="checkbox"==t.getAttribute("type")?t.checked?"on":"off":t.value;var i,r;return e}function o(){window.hasOwnProperty("calculatedFields")&&calculatedFields.forEach((function(t){t.executeAll()}))}function a(){window.hasOwnProperty("calculatedFields")&&window.calculatedFields.forEach((function(t){let e=t.field,s=e.getAttribute("id");document.querySelector("td[data-source='"+s+"']")&&(e.hasAttribute("data-event")||(e.addEventListener("oncalculate",(function(){let t=r(e),i=document.querySelector("td[data-source='"+s+"']");i&&(i.innerText=t)})),e.setAttribute("data-event",!0)))}))}function n(t,e){return!!e.some((e=>e.id===t))&&e.find((e=>e.id===t))}window.django&&window.django.jsi18n_initialized||(e=t=>t);const l={hidden:"d-none",inlineFlex:"d-inline-flex",flex:"d-flex",relative:"position-relative",textRight:"text-right",textCenter:"text-center",alignMiddle:"align-middle",pointer:"cfm-cursor-pointer",checkbox:"checkbox",td:"cfm-td",tr:"cfm-tr",selectionMark:"cfm-selection-border",p0:"p-0",opacity50:"cfm-opacity-50",opacity100:"cfm-opacity-100",backdrop:"cfm-modal-backdrop",justifyStart:"justify-content-start",justifyCenter:"justify-content-center",justifyEnd:"justify-content-end",itemsStart:"align-items-start",itemsCenter:"align-items-center",itemsEnd:"align-items-end"},d={sm:"modal-sm",md:"modal-md",lg:"modal-lg",xl:"modal-xl"},c={bootstrap4:{classes:l,sizes:d},bootstrap5:{classes:{...l,textRight:"text-end"},sizes:d},tailwind:{classes:{hidden:"hidden",inlineFlex:"inline-flex",flex:"flex",relative:"relative",textRight:"text-right",textCenter:"text-center",alignMiddle:"align-middle",pointer:"cursor-pointer",checkbox:"w-4 rounded border-gray-300 focus:ring-indigo-500 text-indigo-600 h-4",td:"whitespace-nowrap px-3 py-3 text-sm text-gray-500",tr:"divide-x divide-gray-200 border-b",selectionMark:"absolute inset-y-0 left-0 w-0.5 bg-indigo-600 selection-border",p0:"p-0",opacity50:"opacity-50",opacity100:"opacity-100",backdrop:"transition-opacity ease-in-out duration-300 opacity-0 bg-gray-800 fixed inset-0 z-40",justifyStart:"justify-start",justifyCenter:"justify-center",justifyEnd:"justify-end",itemsStart:"items-start",itemsCenter:"items-center",itemsEnd:"items-end"},sizes:{sm:"max-w-lg",md:"max-w-4xl",lg:"max-w-5xl",xl:"max-w-6xl"}},bulma:{classes:{hidden:"is-hidden",inlineFlex:"is-inline-flex",flex:"is-flex",relative:"is-relative",textRight:"has-text-right",textCenter:"has-text-center",alignMiddle:"is-vcentered",pointer:"cfm-cursor-pointer",checkbox:"checkbox",td:"cfm-td",tr:"cfm-tr",selectionMark:"cfm-selection-border",p0:"p-0",opacity50:"cfm-opacity-50",opacity100:"cfm-opacity-100",backdrop:"cfm-modal-backdrop",justifyStart:"is-justify-content-start",justifyCenter:"is-justify-content-center",justifyEnd:"is-justify-content-end",itemsStart:"is-align-items-start",itemsCenter:"is-align-items-center",itemsEnd:"is-align-items-end"},sizes:{sm:"modal-sm",md:"modal-md",lg:"modal-lg",xl:"modal-xl"}}},m="formset";class h{constructor(e,s){var r=this;this.opts=t.extend({},h.defaults,s),this.$formset=t(e),this.$formset.attr("data-uuid",i()),this.$emptyForm=this.$formset.find(this.opts.emptyForm),this.$body=this.$formset.find(this.opts.body),this.$add=this.$formset.find(this.opts.add),this.formsetPrefix=t(e).data("formset-prefix"),this.addForm=t.proxy(this,"addForm"),this.$add.click(this.addForm),this.$formset.on("formAdded formDeleted",this.opts.form,t.proxy(this,"checkMaxForms")),this.$forms().each((function(e,s){t(s),r.bindForm(t(this),e)})),this.$formset.data(m,this);t.each(["animateForms"],(function(t,e){e in r.opts&&r.opts[e]&&r[e]()}))}static getOrCreate(e,s){var i=t(e).data(m);return i||(i=new h(e,s)),i}addForm(){if(this.hasMaxForms())throw new Error("MAX_NUM_FORMS reached");var e=this.totalFormCount();this.$managementForm("TOTAL_FORMS").val(e+1);var s=this.$emptyForm.html().replace(new RegExp("__prefix__","g"),e).replace(new RegExp("<\\\\/script>","g"),"<\/script>"),i=t(t.parseHTML(s,this.$body.document,!0));this.$body.append(i);var r=i.filter(this.opts.form);return this.bindForm(r,e),this.opts.newFormCallback&&this.opts.newFormCallback(r),r}bindForm(e,s){var i=this.formsetPrefix+"-"+s;e.data(m+"__formPrefix",i);var r=e.find("[name="+i+"-DELETE]");r.change((function(s){r.is(":checked")?(e.attr("data-formset-form-deleted",""),e.find(":required").data(m+"-required-field",!0).prop("required",!1),e.find("input[pattern]").each((function(){var e=t(this).attr("pattern");t(this).data(m+"-field-pattern",e).removeAttr("pattern")})),e.trigger("formDeleted")):(e.removeAttr("data-formset-form-deleted"),e.find("*").filter((function(){return!0===t(this).data(m+"-required-field")})).prop("required",!0),e.find("input").each((function(){var e=t(this).data(m+"-field-pattern");e&&t(this).attr("pattern",e)})),e.trigger("formAdded"))})).trigger("change"),e.find(this.opts.deleteButton).bind("click",(function(){r.attr("checked",!0).change()}))}$forms(){return this.$body.find(this.opts.form)}$managementForm(t){return this.$formset.find("[name="+this.formsetPrefix+"-"+t+"]")}totalFormCount(){return this.$forms().length}deletedFormCount(){return this.$forms().filter("[data-formset-form-deleted]").length}clear(){this.$forms().each((function(e,s){t(s).find(":input").not(":button, :submit, :reset, :hidden, :checkbox, :radio").val("")}))}deleteAll(){this.$forms().each((function(e,s){t(s).find("[deletecheckbox]").prop("checked",!0).change()}))}activeFormCount(){return this.totalFormCount()-this.deletedFormCount()}openRownum(){var t=this.$formset.find("tr.row-open").attr("data-rownum");return null!=typeof t?parseInt(t):0}hasMaxForms(){var t=parseInt(this.$managementForm("MAX_NUM_FORMS").val(),10)||1e3;return this.activeFormCount()>=t}checkMaxForms(){this.hasMaxForms()?(this.$formset.addClass(this.opts.hasMaxFormsClass),this.$add.attr("disabled","disabled")):(this.$formset.removeClass(this.opts.hasMaxFormsClass),this.$add.removeAttr("disabled"))}animateForms(){this.$formset.on("formAdded",this.opts.form,(function(){var e=t(this);e.slideUp(0),e.slideDown()})).on("formDeleted",this.opts.form,(function(){t(this).slideUp()})),this.$forms().filter("[data-formset-form-deleted]").slideUp(0)}}h.defaults={form:"[data-formset-form]",emptyForm:"script[type=form-template][data-formset-empty-form]",body:"[data-formset-body]",add:"[data-formset-add]",deleteButton:"[data-formset-delete-button]",hasMaxFormsClass:"has-max-forms",animateForms:!1,newFormCallback:!1};const u={placement:"center",size:"md",templatePack:null,onHide:()=>{},onShow:()=>{},onToggle:()=>{}};class f{constructor(t=null,e={}){this._targetEl=t,this._parentEl=t.parentElement,this._options={...u,...e},this._isHidden=!0,this._init(),this._addEventListeners()}_init(){this._getPlacementClasses().map((t=>{this._targetEl.classList.add(t)})),this._clearSize(),this._getSizeClasses().map((t=>{this._targetEl.firstElementChild.classList.add(t)}))}_createBackdrop(t){if(this._isHidden){const e=document.createElement("div");e.setAttribute("data-ref-id",t),e.setAttribute("modal-backdrop",""),e.classList.add(...this._getClasses("backdrop")),this._parentEl.append(e),e.offsetWidth,e.classList.add(...this._getClasses("opacity50"))}}_destroyBackdropEl(){if(!this._isHidden){let t=this._targetEl.getAttribute("data-ref-id");document.querySelector(`[modal-backdrop][data-ref-id="${t}"]`).remove()}}_getPlacementClasses(){let t=this;switch(this._options.placement){case"top-left":return[t._getClasses("justifyStart",!1),t._getClasses("itemsStart",!1)];case"top-center":return[t._getClasses("justifyCenter",!1),t._getClasses("itemsStart",!1)];case"top-right":return[t._getClasses("justifyEnd",!1),t._getClasses("itemsStart",!1)];case"center-left":return[t._getClasses("justifyStart",!1),t._getClasses("itemsCenter",!1)];case"center":default:return[t._getClasses("justifyCenter",!1),t._getClasses("itemsCenter",!1)];case"center-right":return[t._getClasses("justifyEnd",!1),t._getClasses("itemsCenter",!1)];case"bottom-left":return[t._getClasses("justifyStart",!1),t._getClasses("itemsEnd",!1)];case"bottom-center":return[t._getClasses("justifyCenter",!1),t._getClasses("itemsEnd",!1)];case"bottom-right":return[t._getClasses("justifyEnd",!1),t._getClasses("itemsEnd",!1)]}}_getSizeClasses(){return c[this._options.templatePack].sizes[this._options.size].split(" ")}_getClasses(t,e=!1){let s=c[this._options.templatePack].classes[t];return e?s:s.split(" ")}_clearSize(){const t=this._targetEl.firstElementChild,e=c[this._options.templatePack].sizes;for(const s in e)e.hasOwnProperty(s)&&t.classList.remove(e[s])}_addEventListeners(){let t=this;this._targetEl.addEventListener("keyup",(function(e){"Escape"===e.key&&t.hide()}))}toggle(){this._isHidden?this.show():this.hide(),this._options.onToggle(this)}show(){const t=i();this._targetEl.classList.add(...this._getClasses("flex")),this._targetEl.classList.remove(...this._getClasses("hidden")),this._targetEl.setAttribute("aria-modal","true"),this._targetEl.setAttribute("role","dialog"),this._targetEl.removeAttribute("aria-hidden"),this._targetEl.setAttribute("data-ref-id",t),this._createBackdrop(t),this._isHidden=!1,document.body.classList.add("modal-open"),this._options.onShow(this);let e=this._targetEl.querySelector('select, input:not([type="hidden"]');e&&(e.setAttribute("tabindex","0"),e.focus()),this._targetEl.offsetWidth,this._targetEl.classList.add(...this._getClasses("opacity100"))}hide(){this._targetEl.classList.add(...this._getClasses("hidden")),this._targetEl.classList.remove(...this._getClasses("flex")),this._targetEl.setAttribute("aria-hidden","true"),this._targetEl.removeAttribute("aria-modal"),this._targetEl.removeAttribute("role"),this._destroyBackdropEl(),this._isHidden=!0,document.body.classList.remove("modal-open"),this._options.onHide(this)}}const p={parent:null,modalId:null,onKeyUp:function(){},onClose:function(){},onOpen:function(){}};class g{constructor(t,e={}){this.targetEl=t,this._options={...p,...e},this.modalId=this._options.modalId,this._modalEl=null,this._modalTitleEl=null,this._modalDeleteBt=null,this.modalInstance=!1,this.rownum=null,this._init(),this._addEvents()}_init(){this._modalEl=document.getElementById(this.modalId),this._modalTitleEl=this._modalEl.querySelector(".modal-title"),this._modalDeleteBt=this._modalEl.querySelector(".formset-delete"),this._createModal()}_addEvents(){let t=this;this._modalEl.querySelectorAll('[data-formset-modal-toggle="'+this.modalId+'"]').forEach((function(e){e.addEventListener("click",(function(){t.close()}))}))}hasFieldError(t){let e=this.targetEl.querySelector(`#div_${t}`),s=!1,i="";return e.querySelectorAll("[id^='error_']").forEach((function(t){s=!0,i=t.innerText})),{error:s,text:i}}hasNonFieldError(){return null!=this.targetEl.querySelector(".non-field-errors")}errors(){let t={};return this.targetEl.querySelectorAll("[id^='error_']").forEach((function(e){let s=e.id.replace("error_",""),i=s.replace(/.*?-.*?-(.*)/,"$1");t[i]={error:e.innerText,sourceId:s}})),t}hasErrorsNotIncluded(t,e){let s=Object.keys(t).filter((t=>!e.hasOwnProperty(t))),i=Object.values(e).every((t=>!t.hasError||!t.hasError.error));return s.length>0&&i}_hiddeDefaultDeleteBt(t){t.parentNode.classList.add("d-none")}_createModal(){let t=this;if(!this.modalInstance){let e=this.targetEl.querySelector(".formset-delete"),s=new f(this._modalEl,{placement:t._options.placement,size:t._options.size,templatePack:t._options.templatePack,onHide:function(e){t._onModalClose(e)},onShow:function(e){t._onModalShow(e)}});s._targetEl.addEventListener("keyup",(function(e){t._options.onKeyUp(e,t)})),this.modalInstance=s,this._hiddeDefaultDeleteBt(e)}}_onModalShow(t){this._options.onOpen(this);let s=this._options.parent.targetEl.querySelector(".btn-open-row[data-formset-modal-toggle='"+this.modalId+"']").closest("tr");this._modalTitleEl.innerText=e("Editing row #")+this.rownum,s.classList.add("row-open")}_onModalClose(t){this._options.onClose(this);let e=this._options.parent.targetEl.querySelector(".btn-open-row[data-formset-modal-toggle='"+this.modalId+"']");if(e){e.closest("tr").classList.remove("row-open")}}isDeleted(){return this.targetEl.hasAttribute("data-formset-form-deleted")}isSelected(){return this.targetEl.hasAttribute("data-formset-form-selected")}open(){this.modalInstance.show()}close(){this.modalInstance.hide()}}const _="tabular",y="modal";class b{constructor(t){this._id=t,this.targetEl=document.getElementById(this._id),this.variant=_,this.$formset=null,this._modalForms=[],this._deleteBt=null,this._table=null,this._tbody=null,this._tfoot=null,this._init(),this._addEvents()}_init(){this.variant=this._getVariant(),this.templatePack=this._getTemplatePack(),this.modalSize=this._getModalSize(),this.modalPlacement=this._getModalPlacement(),this.$formset=t(`#${this._id}`),this.$formset.formset({animateForms:!0}),this.variant!==y&&this.variant!=_||(this._table=this.targetEl.querySelector("table"),this._tbody=this._table.querySelector("tbody"),this._tfoot=this._table.querySelector("tfoot"),this._emptyState=this._tbody.innerHTML),this.variant===y&&(this._deleteBt=this.targetEl.querySelector(".delete-selected"),this._checkInitials(),this._configureSelectAllToggler(),this._refresh())}_getVariant(){return this.targetEl.getAttribute("data-formset-variant")}_getTemplatePack(){return this.targetEl.getAttribute("data-template-pack")}_getClasses(t){return c[this.templatePack].classes[t].split(" ")}_getEditButton(t){const e=this.targetEl.querySelector("template").content.cloneNode(!0).querySelector("button");return e.classList.contains("btn-open-row")||e.classList.add("btn-open-row"),e.setAttribute("data-formset-modal-toggle",t),e}_getModalSize(){return this.targetEl.getAttribute("data-modal-size")}_getModalPlacement(){return this.targetEl.getAttribute("data-modal-placement")}_getModalFormInstanceByRownum(t){let e=!1;return this._modalForms.forEach((function(s){s.rownum!==t||s.isDeleted()||(e=s)})),e}_addEvents(){let t=this;this.$formset.on("formAdded",(function(e){t._onFormsetAdded(e),window.crispyFormsetModal.onFormAdded(e)})),this.$formset.on("formDeleted",(function(e){t._onFormsetDeleted(e),window.crispyFormsetModal.onFormDeleted(e)}))}_checkInitials(){let t=this,e=[];this.targetEl.querySelectorAll("[data-formset-modal-toggle]").forEach((function(s){let i=s.closest("[data-formset-form]"),r=s.getAttribute("data-formset-modal-toggle");e.includes(r)||t._newModalForm(i,r),e.push(r)}))}_newModalForm(t,e){let s=this,i={parent:s,modalId:e,size:s.modalSize,placement:s.modalPlacement,templatePack:s.templatePack,onKeyUp:function(t,e){s._onModalFormKeyUp(t,e)},onOpen:function(t){s._onModalFormOpen(t)},onClose:function(t){s._onModalFormClose(t)}},r=new g(t,i);return s._modalForms.push(r),r}_onFormsetAdded(e){if(this.variant===y){let s=i();t(this.targetEl).find("#__dialog_id__").attr("id",s),t(this.targetEl).find('[data-formset-modal-toggle="__dialog_id__"]').attr("data-formset-modal-toggle",s),this._newModalForm(e.target,s).open()}window.hasOwnProperty("calculatedFields")&&(window.resetCalculatedFields(),a())}_onFormsetDeleted(){this.variant==y&&this._refresh(),o()}_onModalFormKeyUp(t,e){if(t.ctrlKey&&(38===t.keyCode||40===t.keyCode)){t.preventDefault();let s=e.rownum,i=this.$formset.formset("getOrCreate"),r=i.activeFormCount();if(38==t.keyCode&&s>1){e.close(),this._getModalFormInstanceByRownum(s-1).open()}if(40===t.keyCode){if(s0?(i.checked=!0,i.indeterminate=!1,s=!0):(o!=r&&o>0&&(i.indeterminate=!0,i.checked=!1,s=!0),0===o&&(i.checked=!1,i.indeterminate=!1,s=!1)),s?(e.classList.remove(...this._getClasses("hidden")),e.classList.add(...this._getClasses("inlineFlex"))):(e.classList.remove(...this._getClasses("inlineFlex")),e.classList.add(...this._getClasses("hidden")))}_checker(t,e,s,i){let r=e.querySelector(".cfm-selection-border, .selection-border");if(r&&r.remove(),i.checked){let i=document.createElement("div");e.classList.add(...this._getClasses("relative")),i.classList.add(...this._getClasses("selectionMark")),e.prepend(i),s.setAttribute("data-formset-form-selected","selected"),t.classList.add("selected")}else i.classList.remove(...this._getClasses("relative")),t.classList.remove("selected"),s.removeAttribute("data-formset-form-selected");this._checkSelectAllState()}_refresh(){let t=this,e={},s=[],i=[];this._table.querySelectorAll("[data-field-name]").forEach((function(t){e[t.getAttribute("data-field-name")]={type:t.getAttribute("data-field-type"),hasSummary:t.hasAttribute("data-field-summary"),summary:0}})),s=Object.keys(e),this._modalForms.forEach((function(t){if(!t.isDeleted()){let e={};t.targetEl.querySelectorAll("input, select, textarea").forEach((function(i){let o=i.name.match(/(?
\w+)-(?\w+)-(?\w+)/);if(o){let a=o.groups.name;if(s.includes(a)){let s=r(i);e[a]={value:s,sourceId:i.getAttribute("id"),hasError:t.hasFieldError(i.getAttribute("id"))},e.modalForm=t}}})),i.push(e)}})),function(t){for(;t.hasChildNodes();)t.removeChild(t.lastChild)}(this._tbody),0===i.length&&(this._tbody.innerHTML=this._emptyState);let o=1;i.forEach((function(i){i.modalForm.rownum=o;let r=document.createElement("tr");r.classList.add(...t._getClasses("tr")),r.setAttribute("data-rownum",o),(i.modalForm.hasNonFieldError()||i.modalForm.hasErrorsNotIncluded(i.modalForm.errors(),i))&&(r.style="border: 2px solid #ff4545");let a=document.createElement("td"),n=document.createElement("input");n.setAttribute("type","checkbox"),n.classList.add(...t._getClasses("checkbox")),n.classList.add("select-row"),a.appendChild(n),a.classList.add(...t._getClasses("td")),n.addEventListener("change",(function(e){t._checker(r,a,i.modalForm.targetEl,e.target)})),r.appendChild(a);let l=document.createElement("td");l.classList.add(...t._getClasses("td")),l.classList.add(...t._getClasses("textRight")),l.classList.add(...t._getClasses("pointer")),l.innerText=o,l.addEventListener("click",(function(){i.modalForm.open()})),r.appendChild(l),s.forEach((function(s){let o=document.createElement("td"),a=i[s].hasError;if(o.classList.add(...t._getClasses("td")),a.error&&(o.style="border: 2px solid #ff4545",o.title=a.text),"bool"===e[s].type){let e="on"===i[s].value?"checked":"";o.innerHTML=``}else o.innerText=i[s].value;var n;"numeric"===e[s].type&&(o.classList.add(...t._getClasses("textRight")),e[s].hasSummary&&(e[s].summary=e[s].summary+(n=i[s].value,Number(n)))),"bool"!==e[s].type&&"date"!=e[s].type||o.classList.add(...t._getClasses("textCenter")),o.setAttribute("data-source",i[s].sourceId),r.appendChild(o)}));let d=document.createElement("td");d.classList.add(...t._getClasses("td")),d.classList.add(...t._getClasses("textCenter")),d.classList.add(...t._getClasses("p0")),d.classList.add(...t._getClasses("alignMiddle")),d.appendChild(t._getEditButton(i.modalForm.modalId)),d.querySelector(".btn-open-row").addEventListener("click",(function(t){i.modalForm.open()})),r.appendChild(d),t._tbody.appendChild(r),i.modalForm.isSelected()&&(n.checked=!0,t._checker(r,a,i.modalForm.targetEl,n)),o++})),this._tfoot&&this._tfoot.querySelectorAll("[data-summary-column]").forEach((function(t){let s=e[t.getAttribute("data-summary-column")].summary;t.innerText=s})),this._checkSelectAllState()}}function E(){document.querySelectorAll(".formset").forEach((function(t){new b(t.getAttribute("id"))}))}function C(){let t=[];document.querySelectorAll("[data-modal-toggle]").forEach((e=>{const s=e.getAttribute("data-modal-toggle"),i=document.getElementById(s),r=i.getAttribute("data-modal-placement");i&&(i.hasAttribute("aria-hidden")||i.hasAttribute("aria-modal")||i.setAttribute("aria-hidden","true"));let o=null;n(s,t)?(o=n(s,t),o=o.object):(o=new f(i,{placement:r||Default.placement}),t.push({id:s,object:o})),i.hasAttribute("data-modal-show")&&"true"===i.getAttribute("data-modal-show")&&o.show(),e.addEventListener("click",(()=>{o.toggle()}))}))}var x;window.crispyFormsetModal={},t.fn[m]=function(){var e,s,i;if(0===arguments.length||1===arguments.length&&"string"!=t.type(arguments[0]))return e=arguments[0],this.each((function(){return h.getOrCreate(this,e)}));if(s=arguments[0],i=t.makeArray(arguments).slice(1),s in h)return i.unshift(this),h[s].apply(h,i);throw new Error("Unknown function call "+s+" for $.fn.formset")},window.crispyFormsetModal.refresh=function(){E(),C(),o()},window.crispyFormsetModal.onFormAdded=function(){},window.crispyFormsetModal.onFormDeleted=function(){},x=function(){!function(){const t=document.createElement("style");t.innerHTML="\n .cfm-selection-border {\n position: absolute;\n top: 0px;\n bottom: 0px;\n left: 0px;\n width: 0.150rem;\n background-color: rgb(220 53 69 / 1);\n }\n .cfm-modal-backdrop {\n position: fixed;\n inset: 0px;\n z-index: 100;\n background-color: rgb(31 41 55 / 1);\n opacity: 0;\n transition-property: opacity;\n transition-duration: 300ms;\n transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);\n }\n .cfm-opacity-50 {\n opacity: 0.5;\n }\n .cfm-opacity-100 {\n opacity: 1;\n }\n .cfm-tr.selected{\n background-color: rgba(0, 0, 0, 0.08) !important;\n }\n .cfm .modal-body {\n max-height: calc(100vh - 150px);\n overflow-x: auto;\n }\n .cfm-cursor-pointer {\n cursor: pointer;\n }\n ",document.head.appendChild(t)}(),C(),a(),E(),o()},"loading"!==document.readyState?x():document.addEventListener("DOMContentLoaded",x)}($); +!function(t){"use strict";let e=window.gettext;const s=Object.prototype.hasOwnProperty;function i(){function t(){return Math.floor(65536*(1+Math.random())).toString(16).substring(1)}return`${t()+t()}-${t()}-${(4095&parseInt(t(),16)|16384).toString(16)}-${(16383&parseInt(t(),16)|32768).toString(16)}-${t()+t()+t()}`}function r(t){let e="";if("select"===t.tagName.toLowerCase()){let s=document.createElement("div");s.innerHTML=t.options[t.selectedIndex].innerText,e=s.innerText.split("\n").map((t=>t.trim())).join(" ").trim()}else i=t,r="inputmask",s.call(i,r)?e=t.inputmask.undoValue:"date"==t.getAttribute("type")?t.value&&(e=t.value):e="checkbox"==t.getAttribute("type")?t.checked?"on":"off":t.value;var i,r;return e}function o(){window.hasOwnProperty("calculatedFields")&&calculatedFields.forEach((function(t){t.executeAll()}))}function a(){window.hasOwnProperty("calculatedFields")&&window.calculatedFields.forEach((function(t){let e=t.field,s=e.getAttribute("id");document.querySelector("td[data-source='"+s+"']")&&(e.hasAttribute("data-event")||(e.addEventListener("oncalculate",(function(){let t=r(e),i=document.querySelector("td[data-source='"+s+"']");i&&(i.innerText=t)})),e.setAttribute("data-event",!0)))}))}function n(t,e){return!!e.some((e=>e.id===t))&&e.find((e=>e.id===t))}window.django&&window.django.jsi18n_initialized||(e=t=>t);const l={hidden:"d-none",inlineFlex:"d-inline-flex",flex:"d-flex",relative:"position-relative",textRight:"text-right",textCenter:"text-center",alignMiddle:"align-middle",pointer:"cfm-cursor-pointer",checkbox:"checkbox",td:"cfm-td",tr:"cfm-tr",selectionMark:"cfm-selection-border",p0:"p-0",opacity50:"cfm-opacity-50",opacity100:"cfm-opacity-100",backdrop:"cfm-modal-backdrop",justifyStart:"justify-content-start",justifyCenter:"justify-content-center",justifyEnd:"justify-content-end",itemsStart:"align-items-start",itemsCenter:"align-items-center",itemsEnd:"align-items-end"},d={sm:"modal-sm",md:"modal-md",lg:"modal-lg",xl:"modal-xl"},c={bootstrap4:{classes:l,sizes:d},bootstrap5:{classes:{...l,textRight:"text-end"},sizes:d},tailwind:{classes:{hidden:"hidden",inlineFlex:"inline-flex",flex:"flex",relative:"relative",textRight:"text-right",textCenter:"text-center",alignMiddle:"align-middle",pointer:"cursor-pointer",checkbox:"w-4 rounded border-gray-300 focus:ring-indigo-500 text-indigo-600 h-4",td:"whitespace-nowrap px-3 py-3 text-sm text-gray-500",tr:"divide-x divide-gray-200 border-b",selectionMark:"absolute inset-y-0 left-0 w-0.5 bg-indigo-600 selection-border",p0:"p-0",opacity50:"opacity-50",opacity100:"opacity-100",backdrop:"transition-opacity ease-in-out duration-300 opacity-0 bg-gray-800 fixed inset-0 z-40",justifyStart:"justify-start",justifyCenter:"justify-center",justifyEnd:"justify-end",itemsStart:"items-start",itemsCenter:"items-center",itemsEnd:"items-end"},sizes:{sm:"max-w-lg",md:"max-w-4xl",lg:"max-w-5xl",xl:"max-w-6xl"}},bulma:{classes:{hidden:"is-hidden",inlineFlex:"is-inline-flex",flex:"is-flex",relative:"is-relative",textRight:"has-text-right",textCenter:"has-text-center",alignMiddle:"is-vcentered",pointer:"cfm-cursor-pointer",checkbox:"checkbox",td:"cfm-td",tr:"cfm-tr",selectionMark:"cfm-selection-border",p0:"p-0",opacity50:"cfm-opacity-50",opacity100:"cfm-opacity-100",backdrop:"cfm-modal-backdrop",justifyStart:"is-justify-content-start",justifyCenter:"is-justify-content-center",justifyEnd:"is-justify-content-end",itemsStart:"is-align-items-start",itemsCenter:"is-align-items-center",itemsEnd:"is-align-items-end"},sizes:{sm:"modal-sm",md:"modal-md",lg:"modal-lg",xl:"modal-xl"}}},m="formset";class h{constructor(e,s){var r=this;this.opts=t.extend({},h.defaults,s),this.$formset=t(e),this.$formset.attr("data-uuid",i()),this.$emptyForm=this.$formset.find(this.opts.emptyForm),this.$body=this.$formset.find(this.opts.body),this.$add=this.$formset.find(this.opts.add),this.formsetPrefix=t(e).data("formset-prefix"),this.addForm=t.proxy(this,"addForm"),this.$add.click(this.addForm),this.$formset.on("formAdded formDeleted",this.opts.form,t.proxy(this,"checkMaxForms")),this.$forms().each((function(e,s){t(s),r.bindForm(t(this),e)})),this.$formset.data(m,this);t.each(["animateForms"],(function(t,e){e in r.opts&&r.opts[e]&&r[e]()}))}static getOrCreate(e,s){var i=t(e).data(m);return i||(i=new h(e,s)),i}addForm(){if(this.hasMaxForms())throw new Error("MAX_NUM_FORMS reached");var e=this.totalFormCount();this.$managementForm("TOTAL_FORMS").val(e+1);var s=this.$emptyForm.html().replace(new RegExp("__prefix__","g"),e).replace(new RegExp("<\\\\/script>","g"),"<\/script>"),i=t(t.parseHTML(s,this.$body.document,!0));this.$body.append(i);var r=i.filter(this.opts.form);return this.bindForm(r,e),this.opts.newFormCallback&&this.opts.newFormCallback(r),r}bindForm(e,s){var i=this.formsetPrefix+"-"+s;e.data(m+"__formPrefix",i);var r=e.find("[name="+i+"-DELETE]");r.change((function(s){r.is(":checked")?(e.attr("data-formset-form-deleted",""),e.find(":required").data(m+"-required-field",!0).prop("required",!1),e.find("input[pattern]").each((function(){var e=t(this).attr("pattern");t(this).data(m+"-field-pattern",e).removeAttr("pattern")})),e.trigger("formDeleted")):(e.removeAttr("data-formset-form-deleted"),e.find("*").filter((function(){return!0===t(this).data(m+"-required-field")})).prop("required",!0),e.find("input").each((function(){var e=t(this).data(m+"-field-pattern");e&&t(this).attr("pattern",e)})),e.trigger("formAdded"))})).trigger("change"),e.find(this.opts.deleteButton).bind("click",(function(){r.attr("checked",!0).change()}))}$forms(){return this.$body.find(this.opts.form)}$managementForm(t){return this.$formset.find("[name="+this.formsetPrefix+"-"+t+"]")}totalFormCount(){return this.$forms().length}deletedFormCount(){return this.$forms().filter("[data-formset-form-deleted]").length}clear(){this.$forms().each((function(e,s){t(s).find(":input").not(":button, :submit, :reset, :hidden, :checkbox, :radio").val("")}))}deleteAll(){this.$forms().each((function(e,s){t(s).find("[deletecheckbox]").prop("checked",!0).change()}))}activeFormCount(){return this.totalFormCount()-this.deletedFormCount()}openRownum(){var t=this.$formset.find("tr.row-open").attr("data-rownum");return null!=typeof t?parseInt(t):0}hasMaxForms(){var t=parseInt(this.$managementForm("MAX_NUM_FORMS").val(),10)||1e3;return this.activeFormCount()>=t}checkMaxForms(){this.hasMaxForms()?(this.$formset.addClass(this.opts.hasMaxFormsClass),this.$add.attr("disabled","disabled")):(this.$formset.removeClass(this.opts.hasMaxFormsClass),this.$add.removeAttr("disabled"))}animateForms(){this.$formset.on("formAdded",this.opts.form,(function(){var e=t(this);e.slideUp(0),e.slideDown()})).on("formDeleted",this.opts.form,(function(){t(this).slideUp()})),this.$forms().filter("[data-formset-form-deleted]").slideUp(0)}}h.defaults={form:"[data-formset-form]",emptyForm:"script[type=form-template][data-formset-empty-form]",body:"[data-formset-body]",add:"[data-formset-add]",deleteButton:"[data-formset-delete-button]",hasMaxFormsClass:"has-max-forms",animateForms:!1,newFormCallback:!1};const u={placement:"center",size:"md",templatePack:null,onHide:()=>{},onShow:()=>{},onToggle:()=>{}};class f{constructor(t=null,e={}){this._targetEl=t,this._parentEl=t.parentElement,this._options={...u,...e},this._isHidden=!0,this._bsParent=this._parentEl.closest(".modal"),this._init(),this._addEventListeners()}_init(){this._getPlacementClasses().map((t=>{this._targetEl.classList.add(t)})),this._clearSize(),this._getSizeClasses().map((t=>{this._targetEl.firstElementChild.classList.add(t)}))}_createBackdrop(t){if(this._isHidden){const e=document.createElement("div");e.setAttribute("data-ref-id",t),e.setAttribute("modal-backdrop",""),e.classList.add(...this._getClasses("backdrop")),this._parentEl.append(e),e.offsetWidth,e.classList.add(...this._getClasses("opacity50"))}}_destroyBackdropEl(){if(!this._isHidden){let t=this._targetEl.getAttribute("data-ref-id");document.querySelector(`[modal-backdrop][data-ref-id="${t}"]`).remove()}}_getPlacementClasses(){let t=this;switch(this._options.placement){case"top-left":return[t._getClasses("justifyStart",!1),t._getClasses("itemsStart",!1)];case"top-center":return[t._getClasses("justifyCenter",!1),t._getClasses("itemsStart",!1)];case"top-right":return[t._getClasses("justifyEnd",!1),t._getClasses("itemsStart",!1)];case"center-left":return[t._getClasses("justifyStart",!1),t._getClasses("itemsCenter",!1)];case"center":default:return[t._getClasses("justifyCenter",!1),t._getClasses("itemsCenter",!1)];case"center-right":return[t._getClasses("justifyEnd",!1),t._getClasses("itemsCenter",!1)];case"bottom-left":return[t._getClasses("justifyStart",!1),t._getClasses("itemsEnd",!1)];case"bottom-center":return[t._getClasses("justifyCenter",!1),t._getClasses("itemsEnd",!1)];case"bottom-right":return[t._getClasses("justifyEnd",!1),t._getClasses("itemsEnd",!1)]}}_getSizeClasses(){return c[this._options.templatePack].sizes[this._options.size].split(" ")}_getClasses(t,e=!1){let s=c[this._options.templatePack].classes[t];return e?s:s.split(" ")}_clearSize(){const t=this._targetEl.firstElementChild,e=c[this._options.templatePack].sizes;for(const s in e)e.hasOwnProperty(s)&&t.classList.remove(e[s])}_addEventListeners(){let t=this;this._targetEl.addEventListener("keyup",(function(e){27===e.which&&(e.preventDefault(),t.hide())}))}toggle(){this._isHidden?this.show():this.hide(),this._options.onToggle(this)}show(){const e=i();this._targetEl.classList.add(...this._getClasses("flex")),this._targetEl.classList.remove(...this._getClasses("hidden")),this._targetEl.setAttribute("aria-modal","true"),this._targetEl.setAttribute("role","dialog"),this._targetEl.removeAttribute("aria-hidden"),this._targetEl.setAttribute("data-ref-id",e),this._createBackdrop(e),this._isHidden=!1,document.body.classList.add("modal-open"),this._options.onShow(this);let s=this._targetEl.querySelector('select, input:not([type="hidden"]');s&&(s.setAttribute("tabindex","0"),s.focus()),this._targetEl.offsetWidth,this._targetEl.classList.add(...this._getClasses("opacity100")),this._bsParent&&t(this._bsParent).off("keydown.dismiss.bs.modal")}hide(){this._targetEl.classList.add(...this._getClasses("hidden")),this._targetEl.classList.remove(...this._getClasses("flex")),this._targetEl.setAttribute("aria-hidden","true"),this._targetEl.removeAttribute("aria-modal"),this._targetEl.removeAttribute("role"),this._destroyBackdropEl(),this._isHidden=!0,document.body.classList.remove("modal-open"),this._options.onHide(this),this._bsParent&&(this._bsParent.focus(),t(this._bsParent).on("keydown.dismiss.bs.modal",(e=>{27===e.which&&(e.preventDefault(),t(this._bsParent).modal("hide"))})))}}const p={parent:null,modalId:null,onKeyUp:function(){},onClose:function(){},onOpen:function(){}};class g{constructor(t,e={}){this.targetEl=t,this._options={...p,...e},this.modalId=this._options.modalId,this._modalEl=null,this._modalTitleEl=null,this._modalDeleteBt=null,this.modalInstance=!1,this.rownum=null,this._init(),this._addEvents()}_init(){this._modalEl=document.getElementById(this.modalId),this._modalTitleEl=this._modalEl.querySelector(".modal-title"),this._modalDeleteBt=this._modalEl.querySelector(".formset-delete"),this._createModal()}_addEvents(){let t=this;this._modalEl.querySelectorAll('[data-formset-modal-toggle="'+this.modalId+'"]').forEach((function(e){e.addEventListener("click",(function(){t.close()}))}))}hasFieldError(t){let e=this.targetEl.querySelector(`#div_${t}`),s=!1,i="";return e.querySelectorAll("[id^='error_']").forEach((function(t){s=!0,i=t.innerText})),{error:s,text:i}}hasNonFieldError(){return null!=this.targetEl.querySelector(".non-field-errors")}errors(){let t={};return this.targetEl.querySelectorAll("[id^='error_']").forEach((function(e){let s=e.id.replace("error_",""),i=s.replace(/.*?-.*?-(.*)/,"$1");t[i]={error:e.innerText,sourceId:s}})),t}hasErrorsNotIncluded(t,e){let s=Object.keys(t).filter((t=>!e.hasOwnProperty(t))),i=Object.values(e).every((t=>!t.hasError||!t.hasError.error));return s.length>0&&i}_hiddeDefaultDeleteBt(t){t.parentNode.classList.add("d-none")}_createModal(){let t=this;if(!this.modalInstance){let e=this.targetEl.querySelector(".formset-delete"),s=new f(this._modalEl,{placement:t._options.placement,size:t._options.size,templatePack:t._options.templatePack,onHide:function(e){t._onModalClose(e)},onShow:function(e){t._onModalShow(e)}});s._targetEl.addEventListener("keyup",(function(e){t._options.onKeyUp(e,t)})),this.modalInstance=s,this._hiddeDefaultDeleteBt(e)}}_onModalShow(t){this._options.onOpen(this);let s=this._options.parent.targetEl.querySelector(".btn-open-row[data-formset-modal-toggle='"+this.modalId+"']").closest("tr");this._modalTitleEl.innerText=e("Editing row #")+this.rownum,s.classList.add("row-open")}_onModalClose(t){this._options.onClose(this);let e=this._options.parent.targetEl.querySelector(".btn-open-row[data-formset-modal-toggle='"+this.modalId+"']");if(e){e.closest("tr").classList.remove("row-open")}}isDeleted(){return this.targetEl.hasAttribute("data-formset-form-deleted")}isSelected(){return this.targetEl.hasAttribute("data-formset-form-selected")}open(){this.modalInstance.show()}close(){this.modalInstance.hide()}}const _="tabular",y="modal";class b{constructor(t){this._id=t,this.targetEl=document.getElementById(this._id),this.variant=_,this.$formset=null,this._modalForms=[],this._deleteBt=null,this._table=null,this._tbody=null,this._tfoot=null,this._init(),this._addEvents()}_init(){this.variant=this._getVariant(),this.templatePack=this._getTemplatePack(),this.modalSize=this._getModalSize(),this.modalPlacement=this._getModalPlacement(),this.$formset=t(`#${this._id}`),this.$formset.formset({animateForms:!0}),this.variant!==y&&this.variant!=_||(this._table=this.targetEl.querySelector("table"),this._tbody=this._table.querySelector("tbody"),this._tfoot=this._table.querySelector("tfoot"),this._emptyState=this._tbody.innerHTML),this.variant===y&&(this._deleteBt=this.targetEl.querySelector(".delete-selected"),this._checkInitials(),this._configureSelectAllToggler(),this._refresh()),this.targetEl.setAttribute("data-formset-initialized","true")}_getVariant(){return this.targetEl.getAttribute("data-formset-variant")}_getTemplatePack(){return this.targetEl.getAttribute("data-template-pack")}_getClasses(t){return c[this.templatePack].classes[t].split(" ")}_getEditButton(t){const e=this.targetEl.querySelector("template").content.cloneNode(!0).querySelector("button");return e.classList.contains("btn-open-row")||e.classList.add("btn-open-row"),e.setAttribute("data-formset-modal-toggle",t),e}_getModalSize(){return this.targetEl.getAttribute("data-modal-size")}_getModalPlacement(){return this.targetEl.getAttribute("data-modal-placement")}_getModalFormInstanceByRownum(t){let e=!1;return this._modalForms.forEach((function(s){s.rownum!==t||s.isDeleted()||(e=s)})),e}_addEvents(){let t=this;this.$formset.on("formAdded",(function(e){t._onFormsetAdded(e),window.crispyFormsetModal.onFormAdded(e)})),this.$formset.on("formDeleted",(function(e){t._onFormsetDeleted(e),window.crispyFormsetModal.onFormDeleted(e)}))}_checkInitials(){let t=this,e=[];this.targetEl.querySelectorAll("[data-formset-modal-toggle]").forEach((function(s){let i=s.closest("[data-formset-form]"),r=s.getAttribute("data-formset-modal-toggle");e.includes(r)||t._newModalForm(i,r),e.push(r)}))}_newModalForm(t,e){let s=this,i={parent:s,modalId:e,size:s.modalSize,placement:s.modalPlacement,templatePack:s.templatePack,onKeyUp:function(t,e){s._onModalFormKeyUp(t,e)},onOpen:function(t){s._onModalFormOpen(t)},onClose:function(t){s._onModalFormClose(t)}},r=new g(t,i);return s._modalForms.push(r),r}_onFormsetAdded(e){if(this.variant===y){let s=i();t(this.targetEl).find("#__dialog_id__").attr("id",s),t(this.targetEl).find('[data-formset-modal-toggle="__dialog_id__"]').attr("data-formset-modal-toggle",s),this._newModalForm(e.target,s).open()}window.hasOwnProperty("calculatedFields")&&(window.resetCalculatedFields(),a())}_onFormsetDeleted(){this.variant==y&&this._refresh(),o()}_onModalFormKeyUp(t,e){if(t.ctrlKey&&(38===t.keyCode||40===t.keyCode)){t.preventDefault();let s=e.rownum,i=this.$formset.formset("getOrCreate"),r=i.activeFormCount();if(38==t.keyCode&&s>1){e.close(),this._getModalFormInstanceByRownum(s-1).open()}if(40===t.keyCode){if(s0?(i.checked=!0,i.indeterminate=!1,s=!0):(o!=r&&o>0&&(i.indeterminate=!0,i.checked=!1,s=!0),0===o&&(i.checked=!1,i.indeterminate=!1,s=!1)),s?(e.classList.remove(...this._getClasses("hidden")),e.classList.add(...this._getClasses("inlineFlex"))):(e.classList.remove(...this._getClasses("inlineFlex")),e.classList.add(...this._getClasses("hidden")))}_checker(t,e,s,i){let r=e.querySelector(".cfm-selection-border, .selection-border");if(r&&r.remove(),i.checked){let i=document.createElement("div");e.classList.add(...this._getClasses("relative")),i.classList.add(...this._getClasses("selectionMark")),e.prepend(i),s.setAttribute("data-formset-form-selected","selected"),t.classList.add("selected")}else i.classList.remove(...this._getClasses("relative")),t.classList.remove("selected"),s.removeAttribute("data-formset-form-selected");this._checkSelectAllState()}_refresh(){let t=this,e={},s=[],i=[];this._table.querySelectorAll("[data-field-name]").forEach((function(t){e[t.getAttribute("data-field-name")]={type:t.getAttribute("data-field-type"),hasSummary:t.hasAttribute("data-field-summary"),summary:0}})),s=Object.keys(e),this._modalForms.forEach((function(t){if(!t.isDeleted()){let e={};t.targetEl.querySelectorAll("input, select, textarea").forEach((function(i){let o=i.name.match(/(?\w+)-(?\w+)-(?\w+)/);if(o){let a=o.groups.name;if(s.includes(a)){let s=r(i);e[a]={value:s,sourceId:i.getAttribute("id"),hasError:t.hasFieldError(i.getAttribute("id"))},e.modalForm=t}}})),i.push(e)}})),function(t){for(;t.hasChildNodes();)t.removeChild(t.lastChild)}(this._tbody),0===i.length&&(this._tbody.innerHTML=this._emptyState);let o=1;i.forEach((function(i){i.modalForm.rownum=o;let r=document.createElement("tr");r.classList.add(...t._getClasses("tr")),r.setAttribute("data-rownum",o),(i.modalForm.hasNonFieldError()||i.modalForm.hasErrorsNotIncluded(i.modalForm.errors(),i))&&(r.style="border: 2px solid #ff4545");let a=document.createElement("td"),n=document.createElement("input");n.setAttribute("type","checkbox"),n.classList.add(...t._getClasses("checkbox")),n.classList.add("select-row"),a.appendChild(n),a.classList.add(...t._getClasses("td")),n.addEventListener("change",(function(e){t._checker(r,a,i.modalForm.targetEl,e.target)})),r.appendChild(a);let l=document.createElement("td");l.classList.add(...t._getClasses("td")),l.classList.add(...t._getClasses("textRight")),l.classList.add(...t._getClasses("pointer")),l.innerText=o,l.addEventListener("click",(function(){i.modalForm.open()})),r.appendChild(l),s.forEach((function(s){let o=document.createElement("td"),a=i[s].hasError;if(o.classList.add(...t._getClasses("td")),a.error&&(o.style="border: 2px solid #ff4545",o.title=a.text),"bool"===e[s].type){let e="on"===i[s].value?"checked":"";o.innerHTML=``}else o.innerText=i[s].value;var n;"numeric"===e[s].type&&(o.classList.add(...t._getClasses("textRight")),e[s].hasSummary&&(e[s].summary=e[s].summary+(n=i[s].value,Number(n)))),"bool"!==e[s].type&&"date"!=e[s].type||o.classList.add(...t._getClasses("textCenter")),o.setAttribute("data-source",i[s].sourceId),r.appendChild(o)}));let d=document.createElement("td");d.classList.add(...t._getClasses("td")),d.classList.add(...t._getClasses("textCenter")),d.classList.add(...t._getClasses("p0")),d.classList.add(...t._getClasses("alignMiddle")),d.appendChild(t._getEditButton(i.modalForm.modalId)),d.querySelector(".btn-open-row").addEventListener("click",(function(t){i.modalForm.open()})),r.appendChild(d),t._tbody.appendChild(r),i.modalForm.isSelected()&&(n.checked=!0,t._checker(r,a,i.modalForm.targetEl,n)),o++})),this._tfoot&&this._tfoot.querySelectorAll("[data-summary-column]").forEach((function(t){let s=e[t.getAttribute("data-summary-column")].summary;t.innerText=s})),this._checkSelectAllState()}}function E(){document.querySelectorAll(".formset").forEach((function(t){t.hasAttribute("data-formset-initialized")||new b(t.getAttribute("id"))}))}function C(){let t=[];document.querySelectorAll("[data-modal-toggle]").forEach((e=>{const s=e.getAttribute("data-modal-toggle"),i=document.getElementById(s),r=i.getAttribute("data-modal-placement");i&&(i.hasAttribute("aria-hidden")||i.hasAttribute("aria-modal")||i.setAttribute("aria-hidden","true"));let o=null;n(s,t)?(o=n(s,t),o=o.object):(o=new f(i,{placement:r||Default.placement}),t.push({id:s,object:o})),i.hasAttribute("data-modal-show")&&"true"===i.getAttribute("data-modal-show")&&o.show(),e.addEventListener("click",(()=>{o.toggle()}))}))}var w;window.crispyFormsetModal={},t.fn[m]=function(){var e,s,i;if(0===arguments.length||1===arguments.length&&"string"!=t.type(arguments[0]))return e=arguments[0],this.each((function(){return h.getOrCreate(this,e)}));if(s=arguments[0],i=t.makeArray(arguments).slice(1),s in h)return i.unshift(this),h[s].apply(h,i);throw new Error("Unknown function call "+s+" for $.fn.formset")},window.crispyFormsetModal.init=function(){!function(){const t="cfm-styles";if(!document.getElementById(t)){const e="\n .cfm-selection-border {\n position: absolute;\n top: 0px;\n bottom: 0px;\n left: 0px;\n width: 0.150rem;\n background-color: rgb(220 53 69 / 1);\n }\n .cfm-modal-backdrop {\n position: fixed;\n inset: 0px;\n z-index: 100;\n background-color: rgb(31 41 55 / 1);\n opacity: 0;\n transition-property: opacity;\n transition-duration: 300ms;\n transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);\n }\n .cfm-opacity-50 {\n opacity: 0.5;\n }\n .cfm-opacity-100 {\n opacity: 1;\n }\n .cfm-tr.selected{\n background-color: rgba(0, 0, 0, 0.08) !important;\n }\n .cfm .modal-body {\n max-height: calc(100vh - 150px);\n overflow-x: auto;\n }\n .cfm-cursor-pointer {\n cursor: pointer;\n }\n ",s=document.createElement("style");s.innerHTML=e,s.id=t,document.head.appendChild(s)}}(),E(),C(),a(),o()},window.crispyFormsetModal.refresh=function(){E(),C(),a(),o()},window.crispyFormsetModal.onFormAdded=function(){},window.crispyFormsetModal.onFormDeleted=function(){},w=function(){window.crispyFormsetModal.init()},"loading"!==document.readyState?w():document.addEventListener("DOMContentLoaded",w)}($); //# sourceMappingURL=crispy-formset-modal.min.js.map diff --git a/crispy_formset_modal/static/crispy_formset_modal/js/crispy-formset-modal.min.js.map b/crispy_formset_modal/static/crispy_formset_modal/js/crispy-formset-modal.min.js.map index 3cce581..621e683 100644 --- a/crispy_formset_modal/static/crispy_formset_modal/js/crispy-formset-modal.min.js.map +++ b/crispy_formset_modal/static/crispy_formset_modal/js/crispy-formset-modal.min.js.map @@ -1 +1 @@ -{"version":3,"file":"crispy-formset-modal.min.js","sources":["../../../../js/src/utils.js","../../../../js/src/formset.js","../../../../js/src/modal.js","../../../../js/src/modal-form.js","../../../../js/src/formset-modal.js","../../../../js/src/index.js"],"sourcesContent":["let gettext = window.gettext;\nconst _has = Object.prototype.hasOwnProperty;\n/**\n * Checks if the object has the property passed as argument\n */\nexport function has(object, key) {\n return _has.call(object, key);\n}\n\nexport function uuidv4() {\n function randomHex() {\n return Math.floor((1 + Math.random()) * 0x10000)\n .toString(16)\n .substring(1);\n }\n\n const part1 = randomHex() + randomHex();\n const part2 = randomHex();\n const part3 = ((parseInt(randomHex(), 16) & 0x0fff) | 0x4000).toString(16);\n const part4 = ((parseInt(randomHex(), 16) & 0x3fff) | 0x8000).toString(16);\n const part5 = randomHex() + randomHex() + randomHex();\n\n return `${part1}-${part2}-${part3}-${part4}-${part5}`;\n}\n\nexport function getTextValue(el) {\n let type = el.tagName.toLowerCase();\n let textValue = \"\";\n if (type === \"select\") {\n let tempDiv = document.createElement(\"div\");\n tempDiv.innerHTML = el.options[el.selectedIndex].innerText;\n textValue = tempDiv.innerText\n .split(\"\\n\")\n .map((item) => item.trim())\n .join(\" \")\n .trim();\n } else {\n if (has(el, \"inputmask\")) {\n textValue = el.inputmask.undoValue;\n } else {\n if (el.getAttribute(\"type\") == \"date\") {\n if (el.value) {\n textValue = el.value;\n }\n } else {\n if (el.getAttribute(\"type\") == \"checkbox\") {\n textValue = el.checked ? \"on\" : \"off\";\n } else {\n textValue = el.value;\n }\n }\n }\n }\n return textValue;\n}\n\nexport function getNumberValue(value) {\n return Number(value);\n}\n\nexport function executeAllCalculatedFields() {\n if (window.hasOwnProperty(\"calculatedFields\")) {\n calculatedFields.forEach(function (obj) {\n obj.executeAll();\n });\n }\n}\n\nexport function hookCalculatedFields() {\n if (window.hasOwnProperty(\"calculatedFields\")) {\n window.calculatedFields.forEach(function (obj) {\n let el = obj.field;\n let id = el.getAttribute(\"id\");\n let column = document.querySelector(\"td[data-source='\" + id + \"']\");\n if (column) {\n if (!el.hasAttribute(\"data-event\")) {\n el.addEventListener(\"oncalculate\", function () {\n let content = getTextValue(el);\n // The column element is refetched since the table is recreated on each event\n let _column = document.querySelector(\n \"td[data-source='\" + id + \"']\"\n );\n if (_column) {\n _column.innerText = content;\n }\n });\n el.setAttribute(\"data-event\", true);\n }\n }\n });\n }\n}\n\nexport function removeChildren(a) {\n while (a.hasChildNodes()) {\n a.removeChild(a.lastChild);\n }\n}\n\nexport function injectStyles() {\n const css = `\n .cfm-selection-border {\n position: absolute;\n top: 0px;\n bottom: 0px;\n left: 0px;\n width: 0.150rem;\n background-color: rgb(220 53 69 / 1);\n }\n .cfm-modal-backdrop {\n position: fixed;\n inset: 0px;\n z-index: 100;\n background-color: rgb(31 41 55 / 1);\n opacity: 0;\n transition-property: opacity;\n transition-duration: 300ms;\n transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);\n }\n .cfm-opacity-50 {\n opacity: 0.5;\n }\n .cfm-opacity-100 {\n opacity: 1;\n }\n .cfm-tr.selected{\n background-color: rgba(0, 0, 0, 0.08) !important;\n }\n .cfm .modal-body {\n max-height: calc(100vh - 150px);\n overflow-x: auto;\n }\n .cfm-cursor-pointer {\n cursor: pointer;\n }\n `;\n const style = document.createElement(\"style\");\n style.innerHTML = css;\n document.head.appendChild(style);\n}\n\nexport function getModalInstance(id, instances) {\n if (instances.some((modalInstance) => modalInstance.id === id)) {\n return instances.find((modalInstance) => modalInstance.id === id);\n }\n return false;\n}\n\nexport function ready(fn) {\n if (document.readyState !== \"loading\") {\n fn();\n } else {\n document.addEventListener(\"DOMContentLoaded\", fn);\n }\n}\n\nif (!window.django || !window.django.jsi18n_initialized) {\n gettext = (msg) => msg;\n}\n\nconst bootstrap4Classes = {\n hidden: \"d-none\",\n inlineFlex: \"d-inline-flex\",\n flex: \"d-flex\",\n relative: \"position-relative\",\n textRight: \"text-right\",\n textCenter: \"text-center\",\n alignMiddle: \"align-middle\",\n pointer: \"cfm-cursor-pointer\",\n checkbox: \"checkbox\",\n td: \"cfm-td\",\n tr: \"cfm-tr\",\n selectionMark: \"cfm-selection-border\",\n p0: \"p-0\",\n opacity50: \"cfm-opacity-50\",\n opacity100: \"cfm-opacity-100\",\n backdrop: \"cfm-modal-backdrop\",\n justifyStart: \"justify-content-start\",\n justifyCenter: \"justify-content-center\",\n justifyEnd: \"justify-content-end\",\n itemsStart: \"align-items-start\",\n itemsCenter: \"align-items-center\",\n itemsEnd: \"align-items-end\",\n};\n\nconst bootstrap5Classes = {\n ...bootstrap4Classes,\n textRight: \"text-end\",\n};\n\nconst tailwindClasses = {\n hidden: \"hidden\",\n inlineFlex: \"inline-flex\",\n flex: \"flex\",\n relative: \"relative\",\n textRight: \"text-right\",\n textCenter: \"text-center\",\n alignMiddle: \"align-middle\",\n pointer: \"cursor-pointer\",\n checkbox:\n \"w-4 rounded border-gray-300 focus:ring-indigo-500 text-indigo-600 h-4\",\n td: \"whitespace-nowrap px-3 py-3 text-sm text-gray-500\",\n tr: \"divide-x divide-gray-200 border-b\",\n selectionMark:\n \"absolute inset-y-0 left-0 w-0.5 bg-indigo-600 selection-border\",\n p0: \"p-0\",\n opacity50: \"opacity-50\",\n opacity100: \"opacity-100\",\n backdrop:\n \"transition-opacity ease-in-out duration-300 opacity-0 bg-gray-800 fixed inset-0 z-40\",\n justifyStart: \"justify-start\",\n justifyCenter: \"justify-center\",\n justifyEnd: \"justify-end\",\n itemsStart: \"items-start\",\n itemsCenter: \"items-center\",\n itemsEnd: \"items-end\",\n};\n\nconst bulmaClasses = {\n hidden: \"is-hidden\",\n inlineFlex: \"is-inline-flex\",\n flex: \"is-flex\",\n relative: \"is-relative\",\n textRight: \"has-text-right\",\n textCenter: \"has-text-center\",\n alignMiddle: \"is-vcentered\",\n pointer: \"cfm-cursor-pointer\",\n checkbox: \"checkbox\",\n td: \"cfm-td\",\n tr: \"cfm-tr\",\n selectionMark: \"cfm-selection-border\",\n p0: \"p-0\",\n opacity50: \"cfm-opacity-50\",\n opacity100: \"cfm-opacity-100\",\n backdrop: \"cfm-modal-backdrop\",\n justifyStart: \"is-justify-content-start\",\n justifyCenter: \"is-justify-content-center\",\n justifyEnd: \"is-justify-content-end\",\n itemsStart: \"is-align-items-start\",\n itemsCenter: \"is-align-items-center\",\n itemsEnd: \"is-align-items-end\",\n};\n\nconst tailwindSizeClasses = {\n sm: \"max-w-lg\",\n md: \"max-w-4xl\",\n lg: \"max-w-5xl\",\n xl: \"max-w-6xl\",\n};\n\nconst bootstrap4SizeClasses = {\n sm: \"modal-sm\",\n md: \"modal-md\",\n lg: \"modal-lg\",\n xl: \"modal-xl\",\n};\n\nconst bootstrap5SizeClasses = bootstrap4SizeClasses;\n\nconst bulmaSizeClasses = {\n sm: \"modal-sm\",\n md: \"modal-md\",\n lg: \"modal-lg\",\n xl: \"modal-xl\",\n};\n\nconst templatePacks = {\n bootstrap4: {\n classes: bootstrap4Classes,\n sizes: bootstrap4SizeClasses,\n },\n bootstrap5: {\n classes: bootstrap5Classes,\n sizes: bootstrap5SizeClasses,\n },\n tailwind: {\n classes: tailwindClasses,\n sizes: tailwindSizeClasses,\n },\n bulma: {\n classes: bulmaClasses,\n sizes: bulmaSizeClasses,\n },\n};\n\nexport { gettext, bootstrap4Classes, templatePacks };\n","/**\n* Django formset helper\n* Copyright (c) 2013, Ionata Web Solutions\n* All rights reserved.\n*\n* Redistribution and use in source and binary forms, with or without\n* modification, are permitted provided that the following conditions are met:\n*\n* Redistributions of source code must retain the above copyright notice, this\n* list of conditions and the following disclaimer.\n*\n* Redistributions in binary form must reproduce the above copyright notice, this\n* list of conditions and the following disclaimer in the documentation and/or\n* other materials provided with the distribution.\n*\n* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND\n* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\n* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE\n* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR\n* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\n* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,\n* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n*/\n\nimport { uuidv4 } from \"./utils\";\nimport $ from \"jquery\";\n\nexport const pluginName = 'formset';\n\n\nclass Formset {\n constructor(el, options) {\n var _this = this;\n\n //Defaults:\n this.opts = $.extend({}, Formset.defaults, options);\n\n this.$formset = $(el);\n this.$formset.attr(\"data-uuid\", uuidv4());\n this.$emptyForm = this.$formset.find(this.opts.emptyForm);\n this.$body = this.$formset.find(this.opts.body);\n this.$add = this.$formset.find(this.opts.add);\n\n this.formsetPrefix = $(el).data('formset-prefix');\n\n // Bind to the `Add form` button\n this.addForm = $.proxy(this, 'addForm');\n this.$add.click(this.addForm);\n\n // Bind receiver to `formAdded` and `formDeleted` events\n this.$formset.on('formAdded formDeleted', this.opts.form, $.proxy(this, 'checkMaxForms'));\n\n // Set up the existing forms\n this.$forms().each(function (i, form) {\n var $form = $(form);\n _this.bindForm($(this), i);\n });\n\n // Store a reference to this in the formset element\n this.$formset.data(pluginName, this);\n\n var extras = ['animateForms'];\n $.each(extras, function (i, extra) {\n if ((extra in _this.opts) && (_this.opts[extra])) {\n _this[extra]();\n }\n });\n }\n static getOrCreate(el, options) {\n var rev = $(el).data(pluginName);\n if (!rev) {\n rev = new Formset(el, options);\n }\n\n return rev;\n }\n addForm() {\n // Don't proceed if the number of maximum forms has been reached\n if (this.hasMaxForms()) {\n throw new Error(\"MAX_NUM_FORMS reached\");\n }\n\n var newIndex = this.totalFormCount();\n this.$managementForm('TOTAL_FORMS').val(newIndex + 1);\n\n var newFormHtml = this.$emptyForm.html()\n .replace(new RegExp('__prefix__', 'g'), newIndex)\n .replace(new RegExp('<\\\\\\\\/script>', 'g'), '');\n\n var $newFormFragment = $($.parseHTML(newFormHtml, this.$body.document, true));\n this.$body.append($newFormFragment);\n\n var $newForm = $newFormFragment.filter(this.opts.form);\n this.bindForm($newForm, newIndex);\n if (this.opts.newFormCallback) {\n this.opts.newFormCallback($newForm);\n }\n return $newForm;\n }\n /**\n * Attach any events needed to a new form\n */\n bindForm($form, index) {\n var prefix = this.formsetPrefix + '-' + index;\n $form.data(pluginName + '__formPrefix', prefix);\n\n var $delete = $form.find('[name=' + prefix + '-DELETE]');\n\n // Trigger `formAdded` / `formDeleted` events when delete checkbox value changes\n $delete.change(function (event) {\n if ($delete.is(':checked')) {\n $form.attr('data-formset-form-deleted', '');\n // Remove required property and pattern attribute to allow submit, back it up to data field\n $form.find(':required').data(pluginName + '-required-field', true).prop('required', false);\n $form.find('input[pattern]').each(function () {\n var pattern = $(this).attr('pattern');\n $(this).data(pluginName + '-field-pattern', pattern).removeAttr('pattern');\n });\n $form.trigger('formDeleted');\n } else {\n $form.removeAttr('data-formset-form-deleted');\n // Restore required property and pattern attributes from data field\n $form.find('*').filter(function () {\n return $(this).data(pluginName + '-required-field') === true;\n }).prop('required', true);\n $form.find('input').each(function () {\n var pattern = $(this).data(pluginName + '-field-pattern');\n if (pattern) {\n $(this).attr('pattern', pattern);\n }\n });\n $form.trigger('formAdded');\n }\n }).trigger('change');\n\n var $deleteButton = $form.find(this.opts.deleteButton);\n\n $deleteButton.bind('click', function () {\n $delete.attr('checked', true).change();\n });\n }\n $forms() {\n return this.$body.find(this.opts.form);\n }\n $managementForm(name) {\n return this.$formset.find('[name=' + this.formsetPrefix + '-' + name + ']');\n }\n totalFormCount() {\n return this.$forms().length;\n }\n deletedFormCount() {\n return this.$forms().filter('[data-formset-form-deleted]').length;\n }\n clear() {\n this.$forms().each(function (key, row) {\n $(row).find(':input').not(':button, :submit, :reset, :hidden, :checkbox, :radio').val('');\n });\n }\n deleteAll() {\n this.$forms().each(function (key, row) {\n $(row).find('[deletecheckbox]').prop(\"checked\", true).change();\n });\n }\n activeFormCount() {\n return this.totalFormCount() - this.deletedFormCount();\n }\n openRownum() {\n var rownum = this.$formset.find('tr.row-open').attr('data-rownum');\n return typeof rownum != undefined ? parseInt(rownum) : 0;\n }\n hasMaxForms() {\n var maxForms = parseInt(this.$managementForm('MAX_NUM_FORMS').val(), 10) || 1000;\n return this.activeFormCount() >= maxForms;\n }\n checkMaxForms() {\n if (this.hasMaxForms()) {\n this.$formset.addClass(this.opts.hasMaxFormsClass);\n this.$add.attr('disabled', 'disabled');\n } else {\n this.$formset.removeClass(this.opts.hasMaxFormsClass);\n this.$add.removeAttr('disabled');\n }\n }\n animateForms() {\n this.$formset.on('formAdded', this.opts.form, function () {\n var $form = $(this);\n $form.slideUp(0);\n $form.slideDown();\n }).on('formDeleted', this.opts.form, function () {\n var $form = $(this);\n $form.slideUp();\n });\n this.$forms().filter('[data-formset-form-deleted]').slideUp(0);\n }\n}\n\nFormset.defaults = {\n form: '[data-formset-form]',\n emptyForm: 'script[type=form-template][data-formset-empty-form]',\n body: '[data-formset-body]',\n add: '[data-formset-add]',\n deleteButton: '[data-formset-delete-button]',\n hasMaxFormsClass: 'has-max-forms',\n animateForms: false,\n newFormCallback: false\n};\n\nexport default Formset;\n","import { uuidv4, templatePacks } from \"./utils\";\n\nconst modalDefault = {\n placement: \"center\",\n size: \"md\",\n templatePack: null,\n onHide: () => {},\n onShow: () => {},\n onToggle: () => {},\n};\n\nclass Modal {\n constructor(targetEl = null, options = {}) {\n this._targetEl = targetEl;\n this._parentEl = targetEl.parentElement;\n this._options = {\n ...modalDefault,\n ...options,\n };\n this._isHidden = true;\n this._init();\n this._addEventListeners();\n }\n _init() {\n this._getPlacementClasses().map((c) => {\n this._targetEl.classList.add(c);\n });\n this._clearSize();\n this._getSizeClasses().map((c) => {\n this._targetEl.firstElementChild.classList.add(c);\n });\n }\n _createBackdrop(id) {\n if (this._isHidden) {\n const backdropEl = document.createElement(\"div\");\n backdropEl.setAttribute(\"data-ref-id\", id);\n backdropEl.setAttribute(\"modal-backdrop\", \"\");\n backdropEl.classList.add(...this._getClasses(\"backdrop\"));\n this._parentEl.append(backdropEl);\n backdropEl.offsetWidth;\n backdropEl.classList.add(...this._getClasses(\"opacity50\"));\n }\n }\n _destroyBackdropEl() {\n if (!this._isHidden) {\n let id = this._targetEl.getAttribute(\"data-ref-id\");\n document.querySelector(`[modal-backdrop][data-ref-id=\"${id}\"]`).remove();\n }\n }\n _getPlacementClasses() {\n let that = this;\n switch (this._options.placement) {\n // top\n case \"top-left\":\n return [\n that._getClasses(\"justifyStart\", false),\n that._getClasses(\"itemsStart\", false),\n ];\n case \"top-center\":\n return [\n that._getClasses(\"justifyCenter\", false),\n that._getClasses(\"itemsStart\", false),\n ];\n case \"top-right\":\n return [\n that._getClasses(\"justifyEnd\", false),\n that._getClasses(\"itemsStart\", false),\n ];\n\n // center\n case \"center-left\":\n return [\n that._getClasses(\"justifyStart\", false),\n that._getClasses(\"itemsCenter\", false),\n ];\n case \"center\":\n return [\n that._getClasses(\"justifyCenter\", false),\n that._getClasses(\"itemsCenter\", false),\n ];\n case \"center-right\":\n return [\n that._getClasses(\"justifyEnd\", false),\n that._getClasses(\"itemsCenter\", false),\n ];\n\n // bottom\n case \"bottom-left\":\n return [\n that._getClasses(\"justifyStart\", false),\n that._getClasses(\"itemsEnd\", false),\n ];\n case \"bottom-center\":\n return [\n that._getClasses(\"justifyCenter\", false),\n that._getClasses(\"itemsEnd\", false),\n ];\n case \"bottom-right\":\n return [\n that._getClasses(\"justifyEnd\", false),\n that._getClasses(\"itemsEnd\", false),\n ];\n\n default:\n return [\n that._getClasses(\"justifyCenter\", false),\n that._getClasses(\"itemsCenter\", false),\n ];\n }\n }\n _getSizeClasses() {\n return templatePacks[this._options.templatePack].sizes[\n this._options.size\n ].split(\" \");\n }\n _getClasses(name, str = false) {\n let names = templatePacks[this._options.templatePack].classes[name];\n return str ? names : names.split(\" \");\n }\n _clearSize() {\n const element = this._targetEl.firstElementChild;\n const obj = templatePacks[this._options.templatePack].sizes;\n for (const key in obj) {\n if (obj.hasOwnProperty(key)) {\n element.classList.remove(obj[key]);\n }\n }\n }\n _addEventListeners() {\n let that = this;\n this._targetEl.addEventListener(\"keyup\", function (e) {\n if (e.key === \"Escape\") {\n that.hide();\n }\n });\n }\n toggle() {\n if (this._isHidden) {\n this.show();\n } else {\n this.hide();\n }\n\n // callback function\n this._options.onToggle(this);\n }\n show() {\n const id = uuidv4();\n this._targetEl.classList.add(...this._getClasses(\"flex\"));\n this._targetEl.classList.remove(...this._getClasses(\"hidden\"));\n this._targetEl.setAttribute(\"aria-modal\", \"true\");\n this._targetEl.setAttribute(\"role\", \"dialog\");\n this._targetEl.removeAttribute(\"aria-hidden\");\n this._targetEl.setAttribute(\"data-ref-id\", id);\n this._createBackdrop(id);\n this._isHidden = false;\n\n document.body.classList.add(\"modal-open\");\n\n // callback function\n this._options.onShow(this);\n\n let firstEl = this._targetEl.querySelector(\n 'select, input:not([type=\"hidden\"]'\n );\n if (firstEl) {\n firstEl.setAttribute(\"tabindex\", \"0\");\n firstEl.focus();\n }\n this._targetEl.offsetWidth;\n this._targetEl.classList.add(...this._getClasses(\"opacity100\"));\n }\n hide() {\n this._targetEl.classList.add(...this._getClasses(\"hidden\"));\n this._targetEl.classList.remove(...this._getClasses(\"flex\"));\n this._targetEl.setAttribute(\"aria-hidden\", \"true\");\n this._targetEl.removeAttribute(\"aria-modal\");\n this._targetEl.removeAttribute(\"role\");\n this._destroyBackdropEl();\n this._isHidden = true;\n\n document.body.classList.remove(\"modal-open\");\n\n // callback function\n this._options.onHide(this);\n }\n}\n\nexport default Modal;\n","import Modal from \"./modal\";\nimport { gettext } from \"./utils\";\n\nconst modalFormOptions = {\n parent: null,\n modalId: null,\n onKeyUp: function () {},\n onClose: function () {},\n onOpen: function () {},\n};\n\nclass ModalForm {\n constructor(targetEl, options = {}) {\n this.targetEl = targetEl;\n this._options = {\n ...modalFormOptions,\n ...options,\n };\n this.modalId = this._options.modalId;\n this._modalEl = null;\n this._modalTitleEl = null;\n this._modalDeleteBt = null;\n this.modalInstance = false;\n this.rownum = null;\n this._init();\n this._addEvents();\n }\n _init() {\n this._modalEl = document.getElementById(this.modalId);\n this._modalTitleEl = this._modalEl.querySelector(\".modal-title\");\n this._modalDeleteBt = this._modalEl.querySelector(\".formset-delete\");\n this._createModal();\n }\n _addEvents() {\n let that = this;\n this._modalEl\n .querySelectorAll('[data-formset-modal-toggle=\"' + this.modalId + '\"]')\n .forEach(function (el) {\n el.addEventListener(\"click\", function () {\n that.close();\n });\n });\n }\n hasFieldError(fieldId) {\n let fieldWrapper = this.targetEl.querySelector(`#div_${fieldId}`);\n let hasError = false;\n let errorText = \"\";\n fieldWrapper\n .querySelectorAll(\"[id^='error_']\")\n .forEach(function (el) {\n hasError = true;\n errorText = el.innerText;\n });\n return { error: hasError, text: errorText };\n }\n hasNonFieldError() {\n return this.targetEl.querySelector(\".non-field-errors\") != null;\n }\n errors() {\n let errors = {};\n this.targetEl.querySelectorAll(\"[id^='error_']\").forEach(function (el) {\n let fieldId = el.id.replace(\"error_\", \"\");\n let fieldName = fieldId.replace(/.*?-.*?-(.*)/, \"$1\");\n errors[fieldName] = {\n error: el.innerText,\n sourceId: fieldId,\n };\n });\n return errors;\n }\n hasErrorsNotIncluded(errors, row) {\n let errorProps = Object.keys(errors);\n let propsNotIncluded = errorProps.filter(\n (prop) => !row.hasOwnProperty(prop)\n );\n let allHasErrorFalse = Object.values(row).every(\n (field) => !field.hasError || !field.hasError.error\n );\n return propsNotIncluded.length > 0 && allHasErrorFalse;\n }\n _hiddeDefaultDeleteBt(el) {\n let parentEl = el.parentNode;\n parentEl.classList.add(\"d-none\");\n }\n _createModal() {\n let that = this;\n if (!this.modalInstance) {\n let deleteBt = this.targetEl.querySelector(\".formset-delete\");\n let modal = new Modal(this._modalEl, {\n placement: that._options.placement,\n size: that._options.size,\n templatePack: that._options.templatePack,\n onHide: function (modal) {\n that._onModalClose(modal);\n },\n onShow: function (modal) {\n that._onModalShow(modal);\n },\n });\n modal._targetEl.addEventListener(\"keyup\", function (e) {\n that._options.onKeyUp(e, that);\n });\n this.modalInstance = modal;\n this._hiddeDefaultDeleteBt(deleteBt);\n }\n }\n _onModalShow(modal) {\n this._options.onOpen(this);\n let openRowBt = this._options.parent.targetEl.querySelector(\n \".btn-open-row[data-formset-modal-toggle='\" + this.modalId + \"']\"\n );\n let tr = openRowBt.closest(\"tr\");\n this._modalTitleEl.innerText = gettext(\"Editing row #\") + this.rownum;\n tr.classList.add(\"row-open\");\n }\n _onModalClose(modal) {\n this._options.onClose(this);\n let openRowBt = this._options.parent.targetEl.querySelector(\n \".btn-open-row[data-formset-modal-toggle='\" + this.modalId + \"']\"\n );\n if (openRowBt) {\n let tr = openRowBt.closest(\"tr\");\n tr.classList.remove(\"row-open\");\n }\n }\n isDeleted() {\n return this.targetEl.hasAttribute(\"data-formset-form-deleted\");\n }\n isSelected() {\n return this.targetEl.hasAttribute(\"data-formset-form-selected\");\n }\n open() {\n this.modalInstance.show();\n }\n close() {\n this.modalInstance.hide();\n }\n}\n\nexport default ModalForm;\n","import $ from \"jquery\";\nimport ModalForm from \"./modal-form\";\nimport {\n executeAllCalculatedFields,\n getNumberValue,\n getTextValue,\n hookCalculatedFields,\n removeChildren,\n templatePacks,\n uuidv4,\n} from \"./utils\";\n\nconst variant = {\n tabular: \"tabular\",\n stacked: \"stacked\",\n modal: \"modal\",\n};\n\nclass FormsetModal {\n constructor(elementId) {\n this._id = elementId;\n this.targetEl = document.getElementById(this._id);\n this.variant = variant.tabular;\n this.$formset = null;\n this._modalForms = [];\n this._deleteBt = null;\n this._table = null;\n this._tbody = null;\n this._tfoot = null;\n this._init();\n this._addEvents();\n }\n _init() {\n this.variant = this._getVariant();\n this.templatePack = this._getTemplatePack();\n this.modalSize = this._getModalSize();\n this.modalPlacement = this._getModalPlacement();\n // Create Formset Helper Instance\n this.$formset = $(`#${this._id}`);\n this.$formset.formset({\n animateForms: true,\n });\n if (this.variant === variant.modal || this.variant == variant.tabular) {\n this._table = this.targetEl.querySelector(\"table\");\n this._tbody = this._table.querySelector(\"tbody\");\n this._tfoot = this._table.querySelector(\"tfoot\");\n this._emptyState = this._tbody.innerHTML;\n }\n if (this.variant === variant.modal) {\n this._deleteBt = this.targetEl.querySelector(\".delete-selected\");\n this._checkInitials();\n this._configureSelectAllToggler();\n this._refresh();\n }\n }\n _getVariant() {\n return this.targetEl.getAttribute(\"data-formset-variant\");\n }\n _getTemplatePack() {\n return this.targetEl.getAttribute(\"data-template-pack\");\n }\n _getClasses(name) {\n return templatePacks[this.templatePack].classes[name].split(\" \");\n }\n _getEditButton(modalId) {\n const templateEl = this.targetEl.querySelector(\"template\");\n const template = templateEl.content.cloneNode(true);\n const editButton = template.querySelector(\"button\");\n\n if (!editButton.classList.contains(\"btn-open-row\")) {\n editButton.classList.add(\"btn-open-row\");\n }\n\n editButton.setAttribute(\"data-formset-modal-toggle\", modalId);\n return editButton;\n }\n _getModalSize() {\n return this.targetEl.getAttribute(\"data-modal-size\");\n }\n _getModalPlacement() {\n return this.targetEl.getAttribute(\"data-modal-placement\");\n }\n _getModalFormInstanceByRownum(rownum) {\n let instance = false;\n this._modalForms.forEach(function (obj) {\n if (obj.rownum === rownum && !obj.isDeleted()) {\n instance = obj;\n }\n });\n return instance;\n }\n _addEvents() {\n let that = this;\n this.$formset.on(\"formAdded\", function (e) {\n that._onFormsetAdded(e);\n window.crispyFormsetModal.onFormAdded(e);\n });\n this.$formset.on(\"formDeleted\", function (e) {\n that._onFormsetDeleted(e);\n window.crispyFormsetModal.onFormDeleted(e);\n });\n }\n /**\n * Check if the page loaded form from the server to configure them.\n */\n _checkInitials() {\n let that = this;\n let modals = [];\n this.targetEl\n .querySelectorAll(\"[data-formset-modal-toggle]\")\n .forEach(function (el) {\n let targetEl = el.closest(\"[data-formset-form]\");\n let modalId = el.getAttribute(\"data-formset-modal-toggle\");\n if (!modals.includes(modalId)) {\n that._newModalForm(targetEl, modalId);\n }\n modals.push(modalId);\n });\n }\n _newModalForm(targetEl, modalId) {\n let that = this;\n let options = {\n parent: that,\n modalId: modalId,\n size: that.modalSize,\n placement: that.modalPlacement,\n templatePack: that.templatePack,\n onKeyUp: function (e, modalForm) {\n that._onModalFormKeyUp(e, modalForm);\n },\n onOpen: function (modalForm) {\n that._onModalFormOpen(modalForm);\n },\n onClose: function (modalForm) {\n that._onModalFormClose(modalForm);\n },\n };\n let modalForm = new ModalForm(targetEl, options);\n that._modalForms.push(modalForm);\n return modalForm;\n }\n _onFormsetAdded(e) {\n if (this.variant === variant.modal) {\n let id = uuidv4();\n $(this.targetEl).find(\"#__dialog_id__\").attr(\"id\", id);\n $(this.targetEl)\n .find('[data-formset-modal-toggle=\"__dialog_id__\"]')\n .attr(\"data-formset-modal-toggle\", id);\n let modalForm = this._newModalForm(e.target, id);\n modalForm.open();\n }\n if (window.hasOwnProperty(\"calculatedFields\")) {\n window.resetCalculatedFields();\n hookCalculatedFields();\n }\n }\n _onFormsetDeleted() {\n if (this.variant == variant.modal) {\n this._refresh();\n }\n executeAllCalculatedFields();\n }\n _onModalFormKeyUp(e, modalForm) {\n if (e.ctrlKey && (e.keyCode === 38 || e.keyCode === 40)) {\n e.preventDefault();\n let openRownum = modalForm.rownum;\n let $formset = this.$formset.formset(\"getOrCreate\");\n let activeFormCount = $formset.activeFormCount();\n if (e.keyCode == 38) {\n // Up\n if (openRownum > 1) {\n modalForm.close();\n let previewsModalForm = this._getModalFormInstanceByRownum(\n openRownum - 1\n );\n previewsModalForm.open();\n }\n }\n\n if (e.keyCode === 40) {\n // Down\n if (openRownum < activeFormCount) {\n modalForm.close();\n let nextsModalForm = this._getModalFormInstanceByRownum(\n openRownum + 1\n );\n nextsModalForm.open();\n }\n if (openRownum == activeFormCount) {\n modalForm.close();\n $formset.addForm();\n }\n }\n }\n }\n _onModalFormOpen(modalForm) {\n this._refresh();\n }\n _onModalFormClose(modalForm) {\n this._refresh();\n }\n _configureSelectAllToggler() {\n let that = this;\n let table = this._table;\n let toggler = this.targetEl.querySelector(\".select-all\");\n let deleteBt = this.targetEl.querySelector(\".delete-selected\");\n\n toggler.addEventListener(\"change\", function (e) {\n let checked = toggler.checked;\n let checkBoxes = table.querySelectorAll(\".select-row\");\n checkBoxes.forEach(function (checkbox) {\n let tr = checkbox.closest(\"tr\");\n let td = checkbox.closest(\"td\");\n let btnOpenRow = tr.querySelector(\"[data-formset-modal-toggle]\");\n let modalId = btnOpenRow.getAttribute(\"data-formset-modal-toggle\");\n let modalEl = document.getElementById(modalId);\n let formsetFormEl = modalEl.closest(\"[data-formset-form]\");\n checkbox.checked = checked;\n that._checker(tr, td, formsetFormEl, checkbox);\n });\n });\n\n deleteBt.addEventListener(\"click\", function (e) {\n let formset = that.targetEl;\n let selectedForms = formset.querySelectorAll(\n \"[data-formset-form-selected]\"\n );\n selectedForms.forEach(function (selectedForm) {\n let deleteCheckbox = selectedForm.querySelector(\".formset-delete\");\n deleteCheckbox.checked = true;\n deleteCheckbox.dispatchEvent(new Event(\"change\"));\n });\n });\n }\n _checkSelectAllState() {\n let table = this._table;\n let formset = this.targetEl;\n let deleteBt = formset.querySelector(\".delete-selected\");\n let showDeleteBt = false;\n let selectAllToggler = table.querySelector(\".select-all\");\n let recordCount = table.querySelectorAll(\"tbody tr\").length;\n let selected = table.querySelectorAll(\"tr.selected\").length;\n\n if (selected === recordCount && recordCount > 0) {\n selectAllToggler.checked = true;\n selectAllToggler.indeterminate = false;\n showDeleteBt = true;\n } else {\n if (selected != recordCount && selected > 0) {\n selectAllToggler.indeterminate = true;\n selectAllToggler.checked = false;\n showDeleteBt = true;\n }\n if (selected === 0) {\n selectAllToggler.checked = false;\n selectAllToggler.indeterminate = false;\n showDeleteBt = false;\n }\n }\n\n if (showDeleteBt) {\n deleteBt.classList.remove(...this._getClasses(\"hidden\"));\n deleteBt.classList.add(...this._getClasses(\"inlineFlex\"));\n } else {\n deleteBt.classList.remove(...this._getClasses(\"inlineFlex\"));\n deleteBt.classList.add(...this._getClasses(\"hidden\"));\n }\n }\n _checker(tr, td, formsetFormEl, checkbox) {\n // remove previous divSel if exists.\n let prevDivSel = td.querySelector(\n \".cfm-selection-border, .selection-border\"\n );\n if (prevDivSel) {\n prevDivSel.remove();\n }\n if (checkbox.checked) {\n let divSel = document.createElement(\"div\");\n td.classList.add(...this._getClasses(\"relative\"));\n divSel.classList.add(...this._getClasses(\"selectionMark\"));\n td.prepend(divSel);\n formsetFormEl.setAttribute(\"data-formset-form-selected\", \"selected\");\n tr.classList.add(\"selected\");\n } else {\n checkbox.classList.remove(...this._getClasses(\"relative\"));\n tr.classList.remove(\"selected\");\n formsetFormEl.removeAttribute(\"data-formset-form-selected\");\n }\n this._checkSelectAllState();\n }\n _refresh() {\n let that = this;\n let fields = {};\n let fieldNames = [];\n let rows = [];\n\n this._table.querySelectorAll(\"[data-field-name]\").forEach(function (el) {\n fields[el.getAttribute(\"data-field-name\")] = {\n type: el.getAttribute(\"data-field-type\"),\n hasSummary: el.hasAttribute(\"data-field-summary\"),\n summary: 0,\n };\n });\n\n fieldNames = Object.keys(fields);\n\n this._modalForms.forEach(function (modalForm) {\n if (!modalForm.isDeleted()) {\n let row = {};\n modalForm.targetEl\n .querySelectorAll(\"input, select, textarea\")\n .forEach(function (el) {\n let match = el.name.match(\n /(?\\w+)-(?\\w+)-(?\\w+)/\n );\n if (match) {\n let name = match.groups.name;\n if (fieldNames.includes(name)) {\n let content = getTextValue(el);\n row[name] = {\n value: content,\n sourceId: el.getAttribute(\"id\"),\n hasError: modalForm.hasFieldError(el.getAttribute(\"id\")),\n };\n row[\"modalForm\"] = modalForm;\n }\n }\n });\n rows.push(row);\n }\n });\n\n // Remove all rows\n removeChildren(this._tbody);\n\n if (rows.length === 0) {\n this._tbody.innerHTML = this._emptyState;\n }\n\n let rownum = 1;\n rows.forEach(function (row) {\n row.modalForm.rownum = rownum;\n // Table row\n let tr = document.createElement(\"tr\");\n tr.classList.add(...that._getClasses(\"tr\"));\n tr.setAttribute(\"data-rownum\", rownum);\n // Highlight row if there are non field errors\n if (\n row.modalForm.hasNonFieldError() ||\n row.modalForm.hasErrorsNotIncluded(row.modalForm.errors(), row)\n ) {\n tr[\"style\"] = \"border: 2px solid #ff4545\";\n }\n // Selection column\n let tdSel = document.createElement(\"td\");\n let selCheckbox = document.createElement(\"input\");\n selCheckbox.setAttribute(\"type\", \"checkbox\");\n selCheckbox.classList.add(...that._getClasses(\"checkbox\"));\n selCheckbox.classList.add(\"select-row\");\n tdSel.appendChild(selCheckbox);\n tdSel.classList.add(...that._getClasses(\"td\"));\n selCheckbox.addEventListener(\"change\", function (e) {\n that._checker(tr, tdSel, row.modalForm.targetEl, e.target);\n });\n tr.appendChild(tdSel);\n // Column for row number\n let tdNumber = document.createElement(\"td\");\n tdNumber.classList.add(...that._getClasses(\"td\"));\n tdNumber.classList.add(...that._getClasses(\"textRight\"));\n tdNumber.classList.add(...that._getClasses(\"pointer\"));\n tdNumber.innerText = rownum;\n tdNumber.addEventListener(\"click\", function () {\n row.modalForm.open();\n });\n tr.appendChild(tdNumber);\n // Mirror columns\n fieldNames.forEach(function (field) {\n let td = document.createElement(\"td\");\n let hasError = row[field].hasError;\n td.classList.add(...that._getClasses(\"td\"));\n if (hasError.error) {\n td[\"style\"] = \"border: 2px solid #ff4545\";\n td[\"title\"] = hasError.text;\n }\n if (fields[field].type === \"bool\") {\n let checked = row[field].value === \"on\" ? \"checked\" : \"\";\n td.innerHTML = ``;\n } else {\n td.innerText = row[field].value;\n }\n if (fields[field].type === \"numeric\") {\n td.classList.add(...that._getClasses(\"textRight\"));\n if (fields[field].hasSummary) {\n fields[field].summary =\n fields[field].summary + getNumberValue(row[field].value);\n }\n }\n if (fields[field].type === \"bool\" || fields[field].type == \"date\") {\n td.classList.add(...that._getClasses(\"textCenter\"));\n }\n td.setAttribute(\"data-source\", row[field].sourceId);\n tr.appendChild(td);\n });\n // Column for edit button\n let tdEdit = document.createElement(\"td\");\n tdEdit.classList.add(...that._getClasses(\"td\"));\n tdEdit.classList.add(...that._getClasses(\"textCenter\"));\n tdEdit.classList.add(...that._getClasses(\"p0\"));\n tdEdit.classList.add(...that._getClasses(\"alignMiddle\"));\n tdEdit.appendChild(that._getEditButton(row.modalForm.modalId));\n let button = tdEdit.querySelector(\".btn-open-row\");\n\n button.addEventListener(\"click\", function (e) {\n row.modalForm.open();\n });\n\n tr.appendChild(tdEdit);\n that._tbody.appendChild(tr);\n\n if (row.modalForm.isSelected()) {\n selCheckbox.checked = true;\n that._checker(tr, tdSel, row.modalForm.targetEl, selCheckbox);\n }\n\n rownum++;\n });\n\n if (this._tfoot) {\n this._tfoot\n .querySelectorAll(\"[data-summary-column]\")\n .forEach(function (el) {\n let summary = fields[el.getAttribute(\"data-summary-column\")].summary;\n el.innerText = summary;\n });\n }\n\n this._checkSelectAllState();\n }\n}\n\nexport default FormsetModal;\n","import $ from \"jquery\";\nimport Formset, { pluginName } from \"./formset\";\nimport FormsetModal from \"./formset-modal\";\nimport Modal from \"./modal\";\nimport {\n executeAllCalculatedFields,\n getModalInstance,\n hookCalculatedFields,\n ready,\n injectStyles,\n} from \"./utils\";\n\nwindow.crispyFormsetModal = {};\n\nfunction configureFormsets() {\n let formsets = document.querySelectorAll(\".formset\");\n formsets.forEach(function (formsetEl) {\n new FormsetModal(formsetEl.getAttribute(\"id\"));\n });\n}\n\nfunction configureModals() {\n let modalInstances = [];\n document.querySelectorAll(\"[data-modal-toggle]\").forEach((el) => {\n const modalId = el.getAttribute(\"data-modal-toggle\");\n const modalEl = document.getElementById(modalId);\n const placement = modalEl.getAttribute(\"data-modal-placement\");\n\n if (modalEl) {\n if (\n !modalEl.hasAttribute(\"aria-hidden\") &&\n !modalEl.hasAttribute(\"aria-modal\")\n ) {\n modalEl.setAttribute(\"aria-hidden\", \"true\");\n }\n }\n\n let modal = null;\n if (getModalInstance(modalId, modalInstances)) {\n modal = getModalInstance(modalId, modalInstances);\n modal = modal.object;\n } else {\n modal = new Modal(modalEl, {\n placement: placement ? placement : Default.placement,\n });\n modalInstances.push({\n id: modalId,\n object: modal,\n });\n }\n\n if (\n modalEl.hasAttribute(\"data-modal-show\") &&\n modalEl.getAttribute(\"data-modal-show\") === \"true\"\n ) {\n modal.show();\n }\n\n el.addEventListener(\"click\", () => {\n modal.toggle();\n });\n });\n}\n\n$.fn[pluginName] = function () {\n var options, fn, args;\n // Create a new Formset for each element\n if (\n arguments.length === 0 ||\n (arguments.length === 1 && $.type(arguments[0]) != \"string\")\n ) {\n options = arguments[0];\n return this.each(function () {\n return Formset.getOrCreate(this, options);\n });\n }\n\n // Call a function on each Formset in the selector\n fn = arguments[0];\n args = $.makeArray(arguments).slice(1);\n\n if (fn in Formset) {\n // Call the Formset class method if it exists\n args.unshift(this);\n return Formset[fn].apply(Formset, args);\n } else {\n throw new Error(\"Unknown function call \" + fn + \" for $.fn.formset\");\n }\n};\n\nwindow.crispyFormsetModal.refresh = function () {\n configureFormsets();\n configureModals();\n executeAllCalculatedFields();\n};\n\nwindow.crispyFormsetModal.onFormAdded = function () {};\nwindow.crispyFormsetModal.onFormDeleted = function () {};\n\nready(function () {\n injectStyles();\n configureModals();\n hookCalculatedFields();\n configureFormsets();\n executeAllCalculatedFields();\n});\n"],"names":["gettext","window","_has","Object","prototype","hasOwnProperty","uuidv4","randomHex","Math","floor","random","toString","substring","parseInt","getTextValue","el","textValue","tagName","toLowerCase","tempDiv","document","createElement","innerHTML","options","selectedIndex","innerText","split","map","item","trim","join","object","key","call","inputmask","undoValue","getAttribute","value","checked","executeAllCalculatedFields","calculatedFields","forEach","obj","executeAll","hookCalculatedFields","field","id","querySelector","hasAttribute","addEventListener","content","_column","setAttribute","getModalInstance","instances","some","modalInstance","find","django","jsi18n_initialized","msg","bootstrap4Classes","hidden","inlineFlex","flex","relative","textRight","textCenter","alignMiddle","pointer","checkbox","td","tr","selectionMark","p0","opacity50","opacity100","backdrop","justifyStart","justifyCenter","justifyEnd","itemsStart","itemsCenter","itemsEnd","bootstrap4SizeClasses","sm","md","lg","xl","templatePacks","bootstrap4","classes","sizes","bootstrap5","tailwind","bulma","pluginName","Formset","constructor","_this","this","opts","$","extend","defaults","$formset","attr","$emptyForm","emptyForm","$body","body","$add","add","formsetPrefix","data","addForm","proxy","click","on","form","$forms","each","i","bindForm","extra","static","rev","hasMaxForms","Error","newIndex","totalFormCount","$managementForm","val","newFormHtml","html","replace","RegExp","$newFormFragment","parseHTML","append","$newForm","filter","newFormCallback","$form","index","prefix","$delete","change","event","is","prop","pattern","removeAttr","trigger","deleteButton","bind","name","length","deletedFormCount","clear","row","not","deleteAll","activeFormCount","openRownum","rownum","maxForms","checkMaxForms","addClass","hasMaxFormsClass","removeClass","animateForms","slideUp","slideDown","modalDefault","placement","size","templatePack","onHide","onShow","onToggle","Modal","targetEl","_targetEl","_parentEl","parentElement","_options","_isHidden","_init","_addEventListeners","_getPlacementClasses","c","classList","_clearSize","_getSizeClasses","firstElementChild","_createBackdrop","backdropEl","_getClasses","offsetWidth","_destroyBackdropEl","remove","that","str","names","element","e","hide","toggle","show","removeAttribute","firstEl","focus","modalFormOptions","parent","modalId","onKeyUp","onClose","onOpen","ModalForm","_modalEl","_modalTitleEl","_modalDeleteBt","_addEvents","getElementById","_createModal","querySelectorAll","close","hasFieldError","fieldId","fieldWrapper","hasError","errorText","error","text","hasNonFieldError","errors","fieldName","sourceId","hasErrorsNotIncluded","propsNotIncluded","keys","allHasErrorFalse","values","every","_hiddeDefaultDeleteBt","parentNode","deleteBt","modal","_onModalClose","_onModalShow","closest","openRowBt","isDeleted","isSelected","open","variant","FormsetModal","elementId","_id","_modalForms","_deleteBt","_table","_tbody","_tfoot","_getVariant","_getTemplatePack","modalSize","_getModalSize","modalPlacement","_getModalPlacement","formset","_emptyState","_checkInitials","_configureSelectAllToggler","_refresh","_getEditButton","editButton","cloneNode","contains","_getModalFormInstanceByRownum","instance","_onFormsetAdded","crispyFormsetModal","onFormAdded","_onFormsetDeleted","onFormDeleted","modals","includes","_newModalForm","push","modalForm","_onModalFormKeyUp","_onModalFormOpen","_onModalFormClose","target","resetCalculatedFields","ctrlKey","keyCode","preventDefault","table","toggler","formsetFormEl","_checker","selectedForm","deleteCheckbox","dispatchEvent","Event","_checkSelectAllState","showDeleteBt","selectAllToggler","recordCount","selected","indeterminate","prevDivSel","divSel","prepend","fields","fieldNames","rows","type","hasSummary","summary","match","groups","a","hasChildNodes","removeChild","lastChild","removeChildren","tdSel","selCheckbox","appendChild","tdNumber","Number","tdEdit","configureFormsets","formsetEl","configureModals","modalInstances","modalEl","Default","fn","args","arguments","getOrCreate","makeArray","slice","unshift","apply","refresh","style","head","readyState"],"mappings":"0BAAA,IAAIA,EAAUC,OAAOD,QACf,MAAAE,EAAOC,OAAOC,UAAUC,eAQvB,SAASC,IACd,SAASC,IACP,OAAOC,KAAKC,MAA4B,OAArB,EAAID,KAAKE,WACzBC,SAAS,IACTC,UAAU,EACd,CAQD,MAAO,GANOL,IAAcA,OACdA,QAC8B,KAA5BM,SAASN,IAAa,IAAgB,OAAQI,SAAS,QAC3B,MAA5BE,SAASN,IAAa,IAAgB,OAAQI,SAAS,OACzDJ,IAAcA,IAAcA,KAG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ADPjU,EAAUiU,UAAU,GACbpP,KAAKqB,MAAK,WACR,OAAAxB,EAAQwP,YAAYrP,KAAM7E,EACvC,IAOE,GAHA+T,EAAKE,UAAU,GACfD,EAAOjP,EAAEoP,UAAUF,WAAWG,MAAM,GAEhCL,KAAMrP,EAGR,OADAsP,EAAKK,QAAQxP,MACNH,EAAQqP,GAAIO,MAAM5P,EAASsP,GAElC,MAAM,IAAIvN,MAAM,yBAA2BsN,EAAK,oBAEpD,EAEOrV,OAAA0R,mBAAmBmE,QAAU,sBAIpC,EAEO7V,OAAA0R,mBAAmBC,YAAc,aACjC3R,OAAA0R,mBAAmBG,cAAgB,aLmDpBwD,EKjDhB,YLAC,WACL,MAoCMS,EAAQ3U,SAASC,cAAc,SACrC0U,EAAMzU,UArCM,o2BAsCHF,SAAA4U,KAAKpB,YAAYmB,EAC5B,mBKlCA,EL4C8B,YAAxB3U,SAAS6U,eAGF7U,SAAA6B,iBAAiB,mBAAoBqS"} \ No newline at end of file +{"version":3,"file":"crispy-formset-modal.min.js","sources":["../../../../js/src/utils.js","../../../../js/src/formset.js","../../../../js/src/modal.js","../../../../js/src/modal-form.js","../../../../js/src/formset-modal.js","../../../../js/src/index.js"],"sourcesContent":["let gettext = window.gettext;\nconst _has = Object.prototype.hasOwnProperty;\n/**\n * Checks if the object has the property passed as argument\n */\nexport function has(object, key) {\n return _has.call(object, key);\n}\n\nexport function uuidv4() {\n function randomHex() {\n return Math.floor((1 + Math.random()) * 0x10000)\n .toString(16)\n .substring(1);\n }\n\n const part1 = randomHex() + randomHex();\n const part2 = randomHex();\n const part3 = ((parseInt(randomHex(), 16) & 0x0fff) | 0x4000).toString(16);\n const part4 = ((parseInt(randomHex(), 16) & 0x3fff) | 0x8000).toString(16);\n const part5 = randomHex() + randomHex() + randomHex();\n\n return `${part1}-${part2}-${part3}-${part4}-${part5}`;\n}\n\nexport function getTextValue(el) {\n let type = el.tagName.toLowerCase();\n let textValue = \"\";\n if (type === \"select\") {\n let tempDiv = document.createElement(\"div\");\n tempDiv.innerHTML = el.options[el.selectedIndex].innerText;\n textValue = tempDiv.innerText\n .split(\"\\n\")\n .map((item) => item.trim())\n .join(\" \")\n .trim();\n } else {\n if (has(el, \"inputmask\")) {\n textValue = el.inputmask.undoValue;\n } else {\n if (el.getAttribute(\"type\") == \"date\") {\n if (el.value) {\n textValue = el.value;\n }\n } else {\n if (el.getAttribute(\"type\") == \"checkbox\") {\n textValue = el.checked ? \"on\" : \"off\";\n } else {\n textValue = el.value;\n }\n }\n }\n }\n return textValue;\n}\n\nexport function getNumberValue(value) {\n return Number(value);\n}\n\nexport function executeAllCalculatedFields() {\n if (window.hasOwnProperty(\"calculatedFields\")) {\n calculatedFields.forEach(function (obj) {\n obj.executeAll();\n });\n }\n}\n\nexport function hookCalculatedFields() {\n if (window.hasOwnProperty(\"calculatedFields\")) {\n window.calculatedFields.forEach(function (obj) {\n let el = obj.field;\n let id = el.getAttribute(\"id\");\n let column = document.querySelector(\"td[data-source='\" + id + \"']\");\n if (column) {\n if (!el.hasAttribute(\"data-event\")) {\n el.addEventListener(\"oncalculate\", function () {\n let content = getTextValue(el);\n // The column element is refetched since the table is recreated on each event\n let _column = document.querySelector(\n \"td[data-source='\" + id + \"']\"\n );\n if (_column) {\n _column.innerText = content;\n }\n });\n el.setAttribute(\"data-event\", true);\n }\n }\n });\n }\n}\n\nexport function removeChildren(a) {\n while (a.hasChildNodes()) {\n a.removeChild(a.lastChild);\n }\n}\n\nexport function injectStyles() {\n const styleId = \"cfm-styles\";\n if (!document.getElementById(styleId)) {\n const css = `\n .cfm-selection-border {\n position: absolute;\n top: 0px;\n bottom: 0px;\n left: 0px;\n width: 0.150rem;\n background-color: rgb(220 53 69 / 1);\n }\n .cfm-modal-backdrop {\n position: fixed;\n inset: 0px;\n z-index: 100;\n background-color: rgb(31 41 55 / 1);\n opacity: 0;\n transition-property: opacity;\n transition-duration: 300ms;\n transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);\n }\n .cfm-opacity-50 {\n opacity: 0.5;\n }\n .cfm-opacity-100 {\n opacity: 1;\n }\n .cfm-tr.selected{\n background-color: rgba(0, 0, 0, 0.08) !important;\n }\n .cfm .modal-body {\n max-height: calc(100vh - 150px);\n overflow-x: auto;\n }\n .cfm-cursor-pointer {\n cursor: pointer;\n }\n `;\n const style = document.createElement(\"style\");\n style.innerHTML = css;\n style.id = styleId;\n document.head.appendChild(style);\n }\n}\n\nexport function getModalInstance(id, instances) {\n if (instances.some((modalInstance) => modalInstance.id === id)) {\n return instances.find((modalInstance) => modalInstance.id === id);\n }\n return false;\n}\n\nexport function ready(fn) {\n if (document.readyState !== \"loading\") {\n fn();\n } else {\n document.addEventListener(\"DOMContentLoaded\", fn);\n }\n}\n\nif (!window.django || !window.django.jsi18n_initialized) {\n gettext = (msg) => msg;\n}\n\nconst bootstrap4Classes = {\n hidden: \"d-none\",\n inlineFlex: \"d-inline-flex\",\n flex: \"d-flex\",\n relative: \"position-relative\",\n textRight: \"text-right\",\n textCenter: \"text-center\",\n alignMiddle: \"align-middle\",\n pointer: \"cfm-cursor-pointer\",\n checkbox: \"checkbox\",\n td: \"cfm-td\",\n tr: \"cfm-tr\",\n selectionMark: \"cfm-selection-border\",\n p0: \"p-0\",\n opacity50: \"cfm-opacity-50\",\n opacity100: \"cfm-opacity-100\",\n backdrop: \"cfm-modal-backdrop\",\n justifyStart: \"justify-content-start\",\n justifyCenter: \"justify-content-center\",\n justifyEnd: \"justify-content-end\",\n itemsStart: \"align-items-start\",\n itemsCenter: \"align-items-center\",\n itemsEnd: \"align-items-end\",\n};\n\nconst bootstrap5Classes = {\n ...bootstrap4Classes,\n textRight: \"text-end\",\n};\n\nconst tailwindClasses = {\n hidden: \"hidden\",\n inlineFlex: \"inline-flex\",\n flex: \"flex\",\n relative: \"relative\",\n textRight: \"text-right\",\n textCenter: \"text-center\",\n alignMiddle: \"align-middle\",\n pointer: \"cursor-pointer\",\n checkbox:\n \"w-4 rounded border-gray-300 focus:ring-indigo-500 text-indigo-600 h-4\",\n td: \"whitespace-nowrap px-3 py-3 text-sm text-gray-500\",\n tr: \"divide-x divide-gray-200 border-b\",\n selectionMark:\n \"absolute inset-y-0 left-0 w-0.5 bg-indigo-600 selection-border\",\n p0: \"p-0\",\n opacity50: \"opacity-50\",\n opacity100: \"opacity-100\",\n backdrop:\n \"transition-opacity ease-in-out duration-300 opacity-0 bg-gray-800 fixed inset-0 z-40\",\n justifyStart: \"justify-start\",\n justifyCenter: \"justify-center\",\n justifyEnd: \"justify-end\",\n itemsStart: \"items-start\",\n itemsCenter: \"items-center\",\n itemsEnd: \"items-end\",\n};\n\nconst bulmaClasses = {\n hidden: \"is-hidden\",\n inlineFlex: \"is-inline-flex\",\n flex: \"is-flex\",\n relative: \"is-relative\",\n textRight: \"has-text-right\",\n textCenter: \"has-text-center\",\n alignMiddle: \"is-vcentered\",\n pointer: \"cfm-cursor-pointer\",\n checkbox: \"checkbox\",\n td: \"cfm-td\",\n tr: \"cfm-tr\",\n selectionMark: \"cfm-selection-border\",\n p0: \"p-0\",\n opacity50: \"cfm-opacity-50\",\n opacity100: \"cfm-opacity-100\",\n backdrop: \"cfm-modal-backdrop\",\n justifyStart: \"is-justify-content-start\",\n justifyCenter: \"is-justify-content-center\",\n justifyEnd: \"is-justify-content-end\",\n itemsStart: \"is-align-items-start\",\n itemsCenter: \"is-align-items-center\",\n itemsEnd: \"is-align-items-end\",\n};\n\nconst tailwindSizeClasses = {\n sm: \"max-w-lg\",\n md: \"max-w-4xl\",\n lg: \"max-w-5xl\",\n xl: \"max-w-6xl\",\n};\n\nconst bootstrap4SizeClasses = {\n sm: \"modal-sm\",\n md: \"modal-md\",\n lg: \"modal-lg\",\n xl: \"modal-xl\",\n};\n\nconst bootstrap5SizeClasses = bootstrap4SizeClasses;\n\nconst bulmaSizeClasses = {\n sm: \"modal-sm\",\n md: \"modal-md\",\n lg: \"modal-lg\",\n xl: \"modal-xl\",\n};\n\nconst templatePacks = {\n bootstrap4: {\n classes: bootstrap4Classes,\n sizes: bootstrap4SizeClasses,\n },\n bootstrap5: {\n classes: bootstrap5Classes,\n sizes: bootstrap5SizeClasses,\n },\n tailwind: {\n classes: tailwindClasses,\n sizes: tailwindSizeClasses,\n },\n bulma: {\n classes: bulmaClasses,\n sizes: bulmaSizeClasses,\n },\n};\n\nexport { gettext, bootstrap4Classes, templatePacks };\n","/**\n* Django formset helper\n* Copyright (c) 2013, Ionata Web Solutions\n* All rights reserved.\n*\n* Redistribution and use in source and binary forms, with or without\n* modification, are permitted provided that the following conditions are met:\n*\n* Redistributions of source code must retain the above copyright notice, this\n* list of conditions and the following disclaimer.\n*\n* Redistributions in binary form must reproduce the above copyright notice, this\n* list of conditions and the following disclaimer in the documentation and/or\n* other materials provided with the distribution.\n*\n* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND\n* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\n* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE\n* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR\n* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\n* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,\n* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n*/\n\nimport { uuidv4 } from \"./utils\";\nimport $ from \"jquery\";\n\nexport const pluginName = 'formset';\n\n\nclass Formset {\n constructor(el, options) {\n var _this = this;\n\n //Defaults:\n this.opts = $.extend({}, Formset.defaults, options);\n\n this.$formset = $(el);\n this.$formset.attr(\"data-uuid\", uuidv4());\n this.$emptyForm = this.$formset.find(this.opts.emptyForm);\n this.$body = this.$formset.find(this.opts.body);\n this.$add = this.$formset.find(this.opts.add);\n\n this.formsetPrefix = $(el).data('formset-prefix');\n\n // Bind to the `Add form` button\n this.addForm = $.proxy(this, 'addForm');\n this.$add.click(this.addForm);\n\n // Bind receiver to `formAdded` and `formDeleted` events\n this.$formset.on('formAdded formDeleted', this.opts.form, $.proxy(this, 'checkMaxForms'));\n\n // Set up the existing forms\n this.$forms().each(function (i, form) {\n var $form = $(form);\n _this.bindForm($(this), i);\n });\n\n // Store a reference to this in the formset element\n this.$formset.data(pluginName, this);\n\n var extras = ['animateForms'];\n $.each(extras, function (i, extra) {\n if ((extra in _this.opts) && (_this.opts[extra])) {\n _this[extra]();\n }\n });\n }\n static getOrCreate(el, options) {\n var rev = $(el).data(pluginName);\n if (!rev) {\n rev = new Formset(el, options);\n }\n\n return rev;\n }\n addForm() {\n // Don't proceed if the number of maximum forms has been reached\n if (this.hasMaxForms()) {\n throw new Error(\"MAX_NUM_FORMS reached\");\n }\n\n var newIndex = this.totalFormCount();\n this.$managementForm('TOTAL_FORMS').val(newIndex + 1);\n\n var newFormHtml = this.$emptyForm.html()\n .replace(new RegExp('__prefix__', 'g'), newIndex)\n .replace(new RegExp('<\\\\\\\\/script>', 'g'), '');\n\n var $newFormFragment = $($.parseHTML(newFormHtml, this.$body.document, true));\n this.$body.append($newFormFragment);\n\n var $newForm = $newFormFragment.filter(this.opts.form);\n this.bindForm($newForm, newIndex);\n if (this.opts.newFormCallback) {\n this.opts.newFormCallback($newForm);\n }\n return $newForm;\n }\n /**\n * Attach any events needed to a new form\n */\n bindForm($form, index) {\n var prefix = this.formsetPrefix + '-' + index;\n $form.data(pluginName + '__formPrefix', prefix);\n\n var $delete = $form.find('[name=' + prefix + '-DELETE]');\n\n // Trigger `formAdded` / `formDeleted` events when delete checkbox value changes\n $delete.change(function (event) {\n if ($delete.is(':checked')) {\n $form.attr('data-formset-form-deleted', '');\n // Remove required property and pattern attribute to allow submit, back it up to data field\n $form.find(':required').data(pluginName + '-required-field', true).prop('required', false);\n $form.find('input[pattern]').each(function () {\n var pattern = $(this).attr('pattern');\n $(this).data(pluginName + '-field-pattern', pattern).removeAttr('pattern');\n });\n $form.trigger('formDeleted');\n } else {\n $form.removeAttr('data-formset-form-deleted');\n // Restore required property and pattern attributes from data field\n $form.find('*').filter(function () {\n return $(this).data(pluginName + '-required-field') === true;\n }).prop('required', true);\n $form.find('input').each(function () {\n var pattern = $(this).data(pluginName + '-field-pattern');\n if (pattern) {\n $(this).attr('pattern', pattern);\n }\n });\n $form.trigger('formAdded');\n }\n }).trigger('change');\n\n var $deleteButton = $form.find(this.opts.deleteButton);\n\n $deleteButton.bind('click', function () {\n $delete.attr('checked', true).change();\n });\n }\n $forms() {\n return this.$body.find(this.opts.form);\n }\n $managementForm(name) {\n return this.$formset.find('[name=' + this.formsetPrefix + '-' + name + ']');\n }\n totalFormCount() {\n return this.$forms().length;\n }\n deletedFormCount() {\n return this.$forms().filter('[data-formset-form-deleted]').length;\n }\n clear() {\n this.$forms().each(function (key, row) {\n $(row).find(':input').not(':button, :submit, :reset, :hidden, :checkbox, :radio').val('');\n });\n }\n deleteAll() {\n this.$forms().each(function (key, row) {\n $(row).find('[deletecheckbox]').prop(\"checked\", true).change();\n });\n }\n activeFormCount() {\n return this.totalFormCount() - this.deletedFormCount();\n }\n openRownum() {\n var rownum = this.$formset.find('tr.row-open').attr('data-rownum');\n return typeof rownum != undefined ? parseInt(rownum) : 0;\n }\n hasMaxForms() {\n var maxForms = parseInt(this.$managementForm('MAX_NUM_FORMS').val(), 10) || 1000;\n return this.activeFormCount() >= maxForms;\n }\n checkMaxForms() {\n if (this.hasMaxForms()) {\n this.$formset.addClass(this.opts.hasMaxFormsClass);\n this.$add.attr('disabled', 'disabled');\n } else {\n this.$formset.removeClass(this.opts.hasMaxFormsClass);\n this.$add.removeAttr('disabled');\n }\n }\n animateForms() {\n this.$formset.on('formAdded', this.opts.form, function () {\n var $form = $(this);\n $form.slideUp(0);\n $form.slideDown();\n }).on('formDeleted', this.opts.form, function () {\n var $form = $(this);\n $form.slideUp();\n });\n this.$forms().filter('[data-formset-form-deleted]').slideUp(0);\n }\n}\n\nFormset.defaults = {\n form: '[data-formset-form]',\n emptyForm: 'script[type=form-template][data-formset-empty-form]',\n body: '[data-formset-body]',\n add: '[data-formset-add]',\n deleteButton: '[data-formset-delete-button]',\n hasMaxFormsClass: 'has-max-forms',\n animateForms: false,\n newFormCallback: false\n};\n\nexport default Formset;\n","import $ from \"jquery\";\nimport { templatePacks, uuidv4 } from \"./utils\";\n\nconst modalDefault = {\n placement: \"center\",\n size: \"md\",\n templatePack: null,\n onHide: () => {},\n onShow: () => {},\n onToggle: () => {},\n};\n\nclass Modal {\n constructor(targetEl = null, options = {}) {\n this._targetEl = targetEl;\n this._parentEl = targetEl.parentElement;\n this._options = {\n ...modalDefault,\n ...options,\n };\n this._isHidden = true;\n this._bsParent = this._parentEl.closest(\".modal\");\n this._init();\n this._addEventListeners();\n }\n _init() {\n this._getPlacementClasses().map((c) => {\n this._targetEl.classList.add(c);\n });\n this._clearSize();\n this._getSizeClasses().map((c) => {\n this._targetEl.firstElementChild.classList.add(c);\n });\n }\n _createBackdrop(id) {\n if (this._isHidden) {\n const backdropEl = document.createElement(\"div\");\n backdropEl.setAttribute(\"data-ref-id\", id);\n backdropEl.setAttribute(\"modal-backdrop\", \"\");\n backdropEl.classList.add(...this._getClasses(\"backdrop\"));\n this._parentEl.append(backdropEl);\n backdropEl.offsetWidth;\n backdropEl.classList.add(...this._getClasses(\"opacity50\"));\n }\n }\n _destroyBackdropEl() {\n if (!this._isHidden) {\n let id = this._targetEl.getAttribute(\"data-ref-id\");\n document.querySelector(`[modal-backdrop][data-ref-id=\"${id}\"]`).remove();\n }\n }\n _getPlacementClasses() {\n let that = this;\n switch (this._options.placement) {\n // top\n case \"top-left\":\n return [\n that._getClasses(\"justifyStart\", false),\n that._getClasses(\"itemsStart\", false),\n ];\n case \"top-center\":\n return [\n that._getClasses(\"justifyCenter\", false),\n that._getClasses(\"itemsStart\", false),\n ];\n case \"top-right\":\n return [\n that._getClasses(\"justifyEnd\", false),\n that._getClasses(\"itemsStart\", false),\n ];\n\n // center\n case \"center-left\":\n return [\n that._getClasses(\"justifyStart\", false),\n that._getClasses(\"itemsCenter\", false),\n ];\n case \"center\":\n return [\n that._getClasses(\"justifyCenter\", false),\n that._getClasses(\"itemsCenter\", false),\n ];\n case \"center-right\":\n return [\n that._getClasses(\"justifyEnd\", false),\n that._getClasses(\"itemsCenter\", false),\n ];\n\n // bottom\n case \"bottom-left\":\n return [\n that._getClasses(\"justifyStart\", false),\n that._getClasses(\"itemsEnd\", false),\n ];\n case \"bottom-center\":\n return [\n that._getClasses(\"justifyCenter\", false),\n that._getClasses(\"itemsEnd\", false),\n ];\n case \"bottom-right\":\n return [\n that._getClasses(\"justifyEnd\", false),\n that._getClasses(\"itemsEnd\", false),\n ];\n\n default:\n return [\n that._getClasses(\"justifyCenter\", false),\n that._getClasses(\"itemsCenter\", false),\n ];\n }\n }\n _getSizeClasses() {\n return templatePacks[this._options.templatePack].sizes[\n this._options.size\n ].split(\" \");\n }\n _getClasses(name, str = false) {\n let names = templatePacks[this._options.templatePack].classes[name];\n return str ? names : names.split(\" \");\n }\n _clearSize() {\n const element = this._targetEl.firstElementChild;\n const obj = templatePacks[this._options.templatePack].sizes;\n for (const key in obj) {\n if (obj.hasOwnProperty(key)) {\n element.classList.remove(obj[key]);\n }\n }\n }\n _addEventListeners() {\n let that = this;\n this._targetEl.addEventListener(\"keyup\", function (e) {\n if (e.which === 27) {\n e.preventDefault();\n that.hide();\n }\n });\n }\n toggle() {\n if (this._isHidden) {\n this.show();\n } else {\n this.hide();\n }\n\n // callback function\n this._options.onToggle(this);\n }\n show() {\n const id = uuidv4();\n this._targetEl.classList.add(...this._getClasses(\"flex\"));\n this._targetEl.classList.remove(...this._getClasses(\"hidden\"));\n this._targetEl.setAttribute(\"aria-modal\", \"true\");\n this._targetEl.setAttribute(\"role\", \"dialog\");\n this._targetEl.removeAttribute(\"aria-hidden\");\n this._targetEl.setAttribute(\"data-ref-id\", id);\n this._createBackdrop(id);\n this._isHidden = false;\n\n document.body.classList.add(\"modal-open\");\n\n // callback function\n this._options.onShow(this);\n\n let firstEl = this._targetEl.querySelector(\n 'select, input:not([type=\"hidden\"]'\n );\n if (firstEl) {\n firstEl.setAttribute(\"tabindex\", \"0\");\n firstEl.focus();\n }\n this._targetEl.offsetWidth;\n this._targetEl.classList.add(...this._getClasses(\"opacity100\"));\n\n if (this._bsParent) {\n $(this._bsParent).off(\"keydown.dismiss.bs.modal\");\n }\n }\n hide() {\n this._targetEl.classList.add(...this._getClasses(\"hidden\"));\n this._targetEl.classList.remove(...this._getClasses(\"flex\"));\n this._targetEl.setAttribute(\"aria-hidden\", \"true\");\n this._targetEl.removeAttribute(\"aria-modal\");\n this._targetEl.removeAttribute(\"role\");\n this._destroyBackdropEl();\n this._isHidden = true;\n\n document.body.classList.remove(\"modal-open\");\n\n // callback function\n this._options.onHide(this);\n\n if (this._bsParent) {\n this._bsParent.focus();\n $(this._bsParent).on(\"keydown.dismiss.bs.modal\", (e) => {\n if (e.which === 27) {\n e.preventDefault();\n $(this._bsParent).modal(\"hide\");\n }\n });\n }\n }\n}\n\nexport default Modal;\n","import Modal from \"./modal\";\nimport { gettext } from \"./utils\";\n\nconst modalFormOptions = {\n parent: null,\n modalId: null,\n onKeyUp: function () {},\n onClose: function () {},\n onOpen: function () {},\n};\n\nclass ModalForm {\n constructor(targetEl, options = {}) {\n this.targetEl = targetEl;\n this._options = {\n ...modalFormOptions,\n ...options,\n };\n this.modalId = this._options.modalId;\n this._modalEl = null;\n this._modalTitleEl = null;\n this._modalDeleteBt = null;\n this.modalInstance = false;\n this.rownum = null;\n this._init();\n this._addEvents();\n }\n _init() {\n this._modalEl = document.getElementById(this.modalId);\n this._modalTitleEl = this._modalEl.querySelector(\".modal-title\");\n this._modalDeleteBt = this._modalEl.querySelector(\".formset-delete\");\n this._createModal();\n }\n _addEvents() {\n let that = this;\n this._modalEl\n .querySelectorAll('[data-formset-modal-toggle=\"' + this.modalId + '\"]')\n .forEach(function (el) {\n el.addEventListener(\"click\", function () {\n that.close();\n });\n });\n }\n hasFieldError(fieldId) {\n let fieldWrapper = this.targetEl.querySelector(`#div_${fieldId}`);\n let hasError = false;\n let errorText = \"\";\n fieldWrapper\n .querySelectorAll(\"[id^='error_']\")\n .forEach(function (el) {\n hasError = true;\n errorText = el.innerText;\n });\n return { error: hasError, text: errorText };\n }\n hasNonFieldError() {\n return this.targetEl.querySelector(\".non-field-errors\") != null;\n }\n errors() {\n let errors = {};\n this.targetEl.querySelectorAll(\"[id^='error_']\").forEach(function (el) {\n let fieldId = el.id.replace(\"error_\", \"\");\n let fieldName = fieldId.replace(/.*?-.*?-(.*)/, \"$1\");\n errors[fieldName] = {\n error: el.innerText,\n sourceId: fieldId,\n };\n });\n return errors;\n }\n hasErrorsNotIncluded(errors, row) {\n let errorProps = Object.keys(errors);\n let propsNotIncluded = errorProps.filter(\n (prop) => !row.hasOwnProperty(prop)\n );\n let allHasErrorFalse = Object.values(row).every(\n (field) => !field.hasError || !field.hasError.error\n );\n return propsNotIncluded.length > 0 && allHasErrorFalse;\n }\n _hiddeDefaultDeleteBt(el) {\n let parentEl = el.parentNode;\n parentEl.classList.add(\"d-none\");\n }\n _createModal() {\n let that = this;\n if (!this.modalInstance) {\n let deleteBt = this.targetEl.querySelector(\".formset-delete\");\n let modal = new Modal(this._modalEl, {\n placement: that._options.placement,\n size: that._options.size,\n templatePack: that._options.templatePack,\n onHide: function (modal) {\n that._onModalClose(modal);\n },\n onShow: function (modal) {\n that._onModalShow(modal);\n },\n });\n modal._targetEl.addEventListener(\"keyup\", function (e) {\n that._options.onKeyUp(e, that);\n });\n this.modalInstance = modal;\n this._hiddeDefaultDeleteBt(deleteBt);\n }\n }\n _onModalShow(modal) {\n this._options.onOpen(this);\n let openRowBt = this._options.parent.targetEl.querySelector(\n \".btn-open-row[data-formset-modal-toggle='\" + this.modalId + \"']\"\n );\n let tr = openRowBt.closest(\"tr\");\n this._modalTitleEl.innerText = gettext(\"Editing row #\") + this.rownum;\n tr.classList.add(\"row-open\");\n }\n _onModalClose(modal) {\n this._options.onClose(this);\n let openRowBt = this._options.parent.targetEl.querySelector(\n \".btn-open-row[data-formset-modal-toggle='\" + this.modalId + \"']\"\n );\n if (openRowBt) {\n let tr = openRowBt.closest(\"tr\");\n tr.classList.remove(\"row-open\");\n }\n }\n isDeleted() {\n return this.targetEl.hasAttribute(\"data-formset-form-deleted\");\n }\n isSelected() {\n return this.targetEl.hasAttribute(\"data-formset-form-selected\");\n }\n open() {\n this.modalInstance.show();\n }\n close() {\n this.modalInstance.hide();\n }\n}\n\nexport default ModalForm;\n","import $ from \"jquery\";\nimport ModalForm from \"./modal-form\";\nimport {\n executeAllCalculatedFields,\n getNumberValue,\n getTextValue,\n hookCalculatedFields,\n removeChildren,\n templatePacks,\n uuidv4,\n} from \"./utils\";\n\nconst variant = {\n tabular: \"tabular\",\n stacked: \"stacked\",\n modal: \"modal\",\n};\n\nclass FormsetModal {\n constructor(elementId) {\n this._id = elementId;\n this.targetEl = document.getElementById(this._id);\n this.variant = variant.tabular;\n this.$formset = null;\n this._modalForms = [];\n this._deleteBt = null;\n this._table = null;\n this._tbody = null;\n this._tfoot = null;\n this._init();\n this._addEvents();\n }\n _init() {\n this.variant = this._getVariant();\n this.templatePack = this._getTemplatePack();\n this.modalSize = this._getModalSize();\n this.modalPlacement = this._getModalPlacement();\n // Create Formset Helper Instance\n this.$formset = $(`#${this._id}`);\n this.$formset.formset({\n animateForms: true,\n });\n if (this.variant === variant.modal || this.variant == variant.tabular) {\n this._table = this.targetEl.querySelector(\"table\");\n this._tbody = this._table.querySelector(\"tbody\");\n this._tfoot = this._table.querySelector(\"tfoot\");\n this._emptyState = this._tbody.innerHTML;\n }\n if (this.variant === variant.modal) {\n this._deleteBt = this.targetEl.querySelector(\".delete-selected\");\n this._checkInitials();\n this._configureSelectAllToggler();\n this._refresh();\n }\n this.targetEl.setAttribute(\"data-formset-initialized\", \"true\");\n }\n _getVariant() {\n return this.targetEl.getAttribute(\"data-formset-variant\");\n }\n _getTemplatePack() {\n return this.targetEl.getAttribute(\"data-template-pack\");\n }\n _getClasses(name) {\n return templatePacks[this.templatePack].classes[name].split(\" \");\n }\n _getEditButton(modalId) {\n const templateEl = this.targetEl.querySelector(\"template\");\n const template = templateEl.content.cloneNode(true);\n const editButton = template.querySelector(\"button\");\n\n if (!editButton.classList.contains(\"btn-open-row\")) {\n editButton.classList.add(\"btn-open-row\");\n }\n\n editButton.setAttribute(\"data-formset-modal-toggle\", modalId);\n return editButton;\n }\n _getModalSize() {\n return this.targetEl.getAttribute(\"data-modal-size\");\n }\n _getModalPlacement() {\n return this.targetEl.getAttribute(\"data-modal-placement\");\n }\n _getModalFormInstanceByRownum(rownum) {\n let instance = false;\n this._modalForms.forEach(function (obj) {\n if (obj.rownum === rownum && !obj.isDeleted()) {\n instance = obj;\n }\n });\n return instance;\n }\n _addEvents() {\n let that = this;\n this.$formset.on(\"formAdded\", function (e) {\n that._onFormsetAdded(e);\n window.crispyFormsetModal.onFormAdded(e);\n });\n this.$formset.on(\"formDeleted\", function (e) {\n that._onFormsetDeleted(e);\n window.crispyFormsetModal.onFormDeleted(e);\n });\n }\n /**\n * Check if the page loaded form from the server to configure them.\n */\n _checkInitials() {\n let that = this;\n let modals = [];\n this.targetEl\n .querySelectorAll(\"[data-formset-modal-toggle]\")\n .forEach(function (el) {\n let targetEl = el.closest(\"[data-formset-form]\");\n let modalId = el.getAttribute(\"data-formset-modal-toggle\");\n if (!modals.includes(modalId)) {\n that._newModalForm(targetEl, modalId);\n }\n modals.push(modalId);\n });\n }\n _newModalForm(targetEl, modalId) {\n let that = this;\n let options = {\n parent: that,\n modalId: modalId,\n size: that.modalSize,\n placement: that.modalPlacement,\n templatePack: that.templatePack,\n onKeyUp: function (e, modalForm) {\n that._onModalFormKeyUp(e, modalForm);\n },\n onOpen: function (modalForm) {\n that._onModalFormOpen(modalForm);\n },\n onClose: function (modalForm) {\n that._onModalFormClose(modalForm);\n },\n };\n let modalForm = new ModalForm(targetEl, options);\n that._modalForms.push(modalForm);\n return modalForm;\n }\n _onFormsetAdded(e) {\n if (this.variant === variant.modal) {\n let id = uuidv4();\n $(this.targetEl).find(\"#__dialog_id__\").attr(\"id\", id);\n $(this.targetEl)\n .find('[data-formset-modal-toggle=\"__dialog_id__\"]')\n .attr(\"data-formset-modal-toggle\", id);\n let modalForm = this._newModalForm(e.target, id);\n modalForm.open();\n }\n if (window.hasOwnProperty(\"calculatedFields\")) {\n window.resetCalculatedFields();\n hookCalculatedFields();\n }\n }\n _onFormsetDeleted() {\n if (this.variant == variant.modal) {\n this._refresh();\n }\n executeAllCalculatedFields();\n }\n _onModalFormKeyUp(e, modalForm) {\n if (e.ctrlKey && (e.keyCode === 38 || e.keyCode === 40)) {\n e.preventDefault();\n let openRownum = modalForm.rownum;\n let $formset = this.$formset.formset(\"getOrCreate\");\n let activeFormCount = $formset.activeFormCount();\n if (e.keyCode == 38) {\n // Up\n if (openRownum > 1) {\n modalForm.close();\n let previewsModalForm = this._getModalFormInstanceByRownum(\n openRownum - 1\n );\n previewsModalForm.open();\n }\n }\n\n if (e.keyCode === 40) {\n // Down\n if (openRownum < activeFormCount) {\n modalForm.close();\n let nextsModalForm = this._getModalFormInstanceByRownum(\n openRownum + 1\n );\n nextsModalForm.open();\n }\n if (openRownum == activeFormCount) {\n modalForm.close();\n $formset.addForm();\n }\n }\n }\n }\n _onModalFormOpen(modalForm) {\n this._refresh();\n }\n _onModalFormClose(modalForm) {\n this._refresh();\n }\n _configureSelectAllToggler() {\n let that = this;\n let table = this._table;\n let toggler = this.targetEl.querySelector(\".select-all\");\n let deleteBt = this.targetEl.querySelector(\".delete-selected\");\n\n toggler.addEventListener(\"change\", function (e) {\n let checked = toggler.checked;\n let checkBoxes = table.querySelectorAll(\".select-row\");\n checkBoxes.forEach(function (checkbox) {\n let tr = checkbox.closest(\"tr\");\n let td = checkbox.closest(\"td\");\n let btnOpenRow = tr.querySelector(\"[data-formset-modal-toggle]\");\n let modalId = btnOpenRow.getAttribute(\"data-formset-modal-toggle\");\n let modalEl = document.getElementById(modalId);\n let formsetFormEl = modalEl.closest(\"[data-formset-form]\");\n checkbox.checked = checked;\n that._checker(tr, td, formsetFormEl, checkbox);\n });\n });\n\n deleteBt.addEventListener(\"click\", function (e) {\n let formset = that.targetEl;\n let selectedForms = formset.querySelectorAll(\n \"[data-formset-form-selected]\"\n );\n selectedForms.forEach(function (selectedForm) {\n let deleteCheckbox = selectedForm.querySelector(\".formset-delete\");\n deleteCheckbox.checked = true;\n deleteCheckbox.dispatchEvent(new Event(\"change\"));\n });\n });\n }\n _checkSelectAllState() {\n let table = this._table;\n let formset = this.targetEl;\n let deleteBt = formset.querySelector(\".delete-selected\");\n let showDeleteBt = false;\n let selectAllToggler = table.querySelector(\".select-all\");\n let recordCount = table.querySelectorAll(\"tbody tr\").length;\n let selected = table.querySelectorAll(\"tr.selected\").length;\n\n if (selected === recordCount && recordCount > 0) {\n selectAllToggler.checked = true;\n selectAllToggler.indeterminate = false;\n showDeleteBt = true;\n } else {\n if (selected != recordCount && selected > 0) {\n selectAllToggler.indeterminate = true;\n selectAllToggler.checked = false;\n showDeleteBt = true;\n }\n if (selected === 0) {\n selectAllToggler.checked = false;\n selectAllToggler.indeterminate = false;\n showDeleteBt = false;\n }\n }\n\n if (showDeleteBt) {\n deleteBt.classList.remove(...this._getClasses(\"hidden\"));\n deleteBt.classList.add(...this._getClasses(\"inlineFlex\"));\n } else {\n deleteBt.classList.remove(...this._getClasses(\"inlineFlex\"));\n deleteBt.classList.add(...this._getClasses(\"hidden\"));\n }\n }\n _checker(tr, td, formsetFormEl, checkbox) {\n // remove previous divSel if exists.\n let prevDivSel = td.querySelector(\n \".cfm-selection-border, .selection-border\"\n );\n if (prevDivSel) {\n prevDivSel.remove();\n }\n if (checkbox.checked) {\n let divSel = document.createElement(\"div\");\n td.classList.add(...this._getClasses(\"relative\"));\n divSel.classList.add(...this._getClasses(\"selectionMark\"));\n td.prepend(divSel);\n formsetFormEl.setAttribute(\"data-formset-form-selected\", \"selected\");\n tr.classList.add(\"selected\");\n } else {\n checkbox.classList.remove(...this._getClasses(\"relative\"));\n tr.classList.remove(\"selected\");\n formsetFormEl.removeAttribute(\"data-formset-form-selected\");\n }\n this._checkSelectAllState();\n }\n _refresh() {\n let that = this;\n let fields = {};\n let fieldNames = [];\n let rows = [];\n\n this._table.querySelectorAll(\"[data-field-name]\").forEach(function (el) {\n fields[el.getAttribute(\"data-field-name\")] = {\n type: el.getAttribute(\"data-field-type\"),\n hasSummary: el.hasAttribute(\"data-field-summary\"),\n summary: 0,\n };\n });\n\n fieldNames = Object.keys(fields);\n\n this._modalForms.forEach(function (modalForm) {\n if (!modalForm.isDeleted()) {\n let row = {};\n modalForm.targetEl\n .querySelectorAll(\"input, select, textarea\")\n .forEach(function (el) {\n let match = el.name.match(\n /(?\\w+)-(?\\w+)-(?\\w+)/\n );\n if (match) {\n let name = match.groups.name;\n if (fieldNames.includes(name)) {\n let content = getTextValue(el);\n row[name] = {\n value: content,\n sourceId: el.getAttribute(\"id\"),\n hasError: modalForm.hasFieldError(el.getAttribute(\"id\")),\n };\n row[\"modalForm\"] = modalForm;\n }\n }\n });\n rows.push(row);\n }\n });\n\n // Remove all rows\n removeChildren(this._tbody);\n\n if (rows.length === 0) {\n this._tbody.innerHTML = this._emptyState;\n }\n\n let rownum = 1;\n rows.forEach(function (row) {\n row.modalForm.rownum = rownum;\n // Table row\n let tr = document.createElement(\"tr\");\n tr.classList.add(...that._getClasses(\"tr\"));\n tr.setAttribute(\"data-rownum\", rownum);\n // Highlight row if there are non field errors\n if (\n row.modalForm.hasNonFieldError() ||\n row.modalForm.hasErrorsNotIncluded(row.modalForm.errors(), row)\n ) {\n tr[\"style\"] = \"border: 2px solid #ff4545\";\n }\n // Selection column\n let tdSel = document.createElement(\"td\");\n let selCheckbox = document.createElement(\"input\");\n selCheckbox.setAttribute(\"type\", \"checkbox\");\n selCheckbox.classList.add(...that._getClasses(\"checkbox\"));\n selCheckbox.classList.add(\"select-row\");\n tdSel.appendChild(selCheckbox);\n tdSel.classList.add(...that._getClasses(\"td\"));\n selCheckbox.addEventListener(\"change\", function (e) {\n that._checker(tr, tdSel, row.modalForm.targetEl, e.target);\n });\n tr.appendChild(tdSel);\n // Column for row number\n let tdNumber = document.createElement(\"td\");\n tdNumber.classList.add(...that._getClasses(\"td\"));\n tdNumber.classList.add(...that._getClasses(\"textRight\"));\n tdNumber.classList.add(...that._getClasses(\"pointer\"));\n tdNumber.innerText = rownum;\n tdNumber.addEventListener(\"click\", function () {\n row.modalForm.open();\n });\n tr.appendChild(tdNumber);\n // Mirror columns\n fieldNames.forEach(function (field) {\n let td = document.createElement(\"td\");\n let hasError = row[field].hasError;\n td.classList.add(...that._getClasses(\"td\"));\n if (hasError.error) {\n td[\"style\"] = \"border: 2px solid #ff4545\";\n td[\"title\"] = hasError.text;\n }\n if (fields[field].type === \"bool\") {\n let checked = row[field].value === \"on\" ? \"checked\" : \"\";\n td.innerHTML = ``;\n } else {\n td.innerText = row[field].value;\n }\n if (fields[field].type === \"numeric\") {\n td.classList.add(...that._getClasses(\"textRight\"));\n if (fields[field].hasSummary) {\n fields[field].summary =\n fields[field].summary + getNumberValue(row[field].value);\n }\n }\n if (fields[field].type === \"bool\" || fields[field].type == \"date\") {\n td.classList.add(...that._getClasses(\"textCenter\"));\n }\n td.setAttribute(\"data-source\", row[field].sourceId);\n tr.appendChild(td);\n });\n // Column for edit button\n let tdEdit = document.createElement(\"td\");\n tdEdit.classList.add(...that._getClasses(\"td\"));\n tdEdit.classList.add(...that._getClasses(\"textCenter\"));\n tdEdit.classList.add(...that._getClasses(\"p0\"));\n tdEdit.classList.add(...that._getClasses(\"alignMiddle\"));\n tdEdit.appendChild(that._getEditButton(row.modalForm.modalId));\n let button = tdEdit.querySelector(\".btn-open-row\");\n\n button.addEventListener(\"click\", function (e) {\n row.modalForm.open();\n });\n\n tr.appendChild(tdEdit);\n that._tbody.appendChild(tr);\n\n if (row.modalForm.isSelected()) {\n selCheckbox.checked = true;\n that._checker(tr, tdSel, row.modalForm.targetEl, selCheckbox);\n }\n\n rownum++;\n });\n\n if (this._tfoot) {\n this._tfoot\n .querySelectorAll(\"[data-summary-column]\")\n .forEach(function (el) {\n let summary = fields[el.getAttribute(\"data-summary-column\")].summary;\n el.innerText = summary;\n });\n }\n\n this._checkSelectAllState();\n }\n}\n\nexport default FormsetModal;\n","import $ from \"jquery\";\nimport Formset, { pluginName } from \"./formset\";\nimport FormsetModal from \"./formset-modal\";\nimport Modal from \"./modal\";\nimport {\n executeAllCalculatedFields,\n getModalInstance,\n hookCalculatedFields,\n ready,\n injectStyles,\n} from \"./utils\";\n\nwindow.crispyFormsetModal = {};\n\nfunction configureFormsets() {\n let formsets = document.querySelectorAll(\".formset\");\n formsets.forEach(function (formsetEl) {\n if (!formsetEl.hasAttribute(\"data-formset-initialized\")) {\n new FormsetModal(formsetEl.getAttribute(\"id\"));\n }\n });\n}\n\nfunction configureModals() {\n let modalInstances = [];\n document.querySelectorAll(\"[data-modal-toggle]\").forEach((el) => {\n const modalId = el.getAttribute(\"data-modal-toggle\");\n const modalEl = document.getElementById(modalId);\n const placement = modalEl.getAttribute(\"data-modal-placement\");\n\n if (modalEl) {\n if (\n !modalEl.hasAttribute(\"aria-hidden\") &&\n !modalEl.hasAttribute(\"aria-modal\")\n ) {\n modalEl.setAttribute(\"aria-hidden\", \"true\");\n }\n }\n\n let modal = null;\n if (getModalInstance(modalId, modalInstances)) {\n modal = getModalInstance(modalId, modalInstances);\n modal = modal.object;\n } else {\n modal = new Modal(modalEl, {\n placement: placement ? placement : Default.placement,\n });\n modalInstances.push({\n id: modalId,\n object: modal,\n });\n }\n\n if (\n modalEl.hasAttribute(\"data-modal-show\") &&\n modalEl.getAttribute(\"data-modal-show\") === \"true\"\n ) {\n modal.show();\n }\n\n el.addEventListener(\"click\", () => {\n modal.toggle();\n });\n });\n}\n\n$.fn[pluginName] = function () {\n var options, fn, args;\n // Create a new Formset for each element\n if (\n arguments.length === 0 ||\n (arguments.length === 1 && $.type(arguments[0]) != \"string\")\n ) {\n options = arguments[0];\n return this.each(function () {\n return Formset.getOrCreate(this, options);\n });\n }\n\n // Call a function on each Formset in the selector\n fn = arguments[0];\n args = $.makeArray(arguments).slice(1);\n\n if (fn in Formset) {\n // Call the Formset class method if it exists\n args.unshift(this);\n return Formset[fn].apply(Formset, args);\n } else {\n throw new Error(\"Unknown function call \" + fn + \" for $.fn.formset\");\n }\n};\n\nwindow.crispyFormsetModal.init = function () {\n injectStyles();\n configureFormsets();\n configureModals();\n hookCalculatedFields();\n executeAllCalculatedFields();\n}\n\nwindow.crispyFormsetModal.refresh = function () {\n configureFormsets();\n configureModals();\n hookCalculatedFields();\n executeAllCalculatedFields();\n};\n\nwindow.crispyFormsetModal.onFormAdded = function () {};\nwindow.crispyFormsetModal.onFormDeleted = function () {};\n\nready(function () {\n window.crispyFormsetModal.init();\n});\n"],"names":["gettext","window","_has","Object","prototype","hasOwnProperty","uuidv4","randomHex","Math","floor","random","toString","substring","parseInt","getTextValue","el","textValue","tagName","toLowerCase","tempDiv","document","createElement","innerHTML","options","selectedIndex","innerText","split","map","item","trim","join","object","key","call","inputmask","undoValue","getAttribute","value","checked","executeAllCalculatedFields","calculatedFields","forEach","obj","executeAll","hookCalculatedFields","field","id","querySelector","hasAttribute","addEventListener","content","_column","setAttribute","getModalInstance","instances","some","modalInstance","find","django","jsi18n_initialized","msg","bootstrap4Classes","hidden","inlineFlex","flex","relative","textRight","textCenter","alignMiddle","pointer","checkbox","td","tr","selectionMark","p0","opacity50","opacity100","backdrop","justifyStart","justifyCenter","justifyEnd","itemsStart","itemsCenter","itemsEnd","bootstrap4SizeClasses","sm","md","lg","xl","templatePacks","bootstrap4","classes","sizes","bootstrap5","tailwind","bulma","pluginName","Formset","constructor","_this","this","opts","$","extend","defaults","$formset","attr","$emptyForm","emptyForm","$body","body","$add","add","formsetPrefix","data","addForm","proxy","click","on","form","$forms","each","i","bindForm","extra","static","rev","hasMaxForms","Error","newIndex","totalFormCount","$managementForm","val","newFormHtml","html","replace","RegExp","$newFormFragment","parseHTML","append","$newForm","filter","newFormCallback","$form","index","prefix","$delete","change","event","is","prop","pattern","removeAttr","trigger","deleteButton","bind","name","length","deletedFormCount","clear","row","not","deleteAll","activeFormCount","openRownum","rownum","maxForms","checkMaxForms","addClass","hasMaxFormsClass","removeClass","animateForms","slideUp","slideDown","modalDefault","placement","size","templatePack","onHide","onShow","onToggle","Modal","targetEl","_targetEl","_parentEl","parentElement","_options","_isHidden","_bsParent","closest","_init","_addEventListeners","_getPlacementClasses","c","classList","_clearSize","_getSizeClasses","firstElementChild","_createBackdrop","backdropEl","_getClasses","offsetWidth","_destroyBackdropEl","remove","that","str","names","element","e","which","preventDefault","hide","toggle","show","removeAttribute","firstEl","focus","off","modal","modalFormOptions","parent","modalId","onKeyUp","onClose","onOpen","ModalForm","_modalEl","_modalTitleEl","_modalDeleteBt","_addEvents","getElementById","_createModal","querySelectorAll","close","hasFieldError","fieldId","fieldWrapper","hasError","errorText","error","text","hasNonFieldError","errors","fieldName","sourceId","hasErrorsNotIncluded","propsNotIncluded","keys","allHasErrorFalse","values","every","_hiddeDefaultDeleteBt","parentNode","deleteBt","_onModalClose","_onModalShow","openRowBt","isDeleted","isSelected","open","variant","FormsetModal","elementId","_id","_modalForms","_deleteBt","_table","_tbody","_tfoot","_getVariant","_getTemplatePack","modalSize","_getModalSize","modalPlacement","_getModalPlacement","formset","_emptyState","_checkInitials","_configureSelectAllToggler","_refresh","_getEditButton","editButton","cloneNode","contains","_getModalFormInstanceByRownum","instance","_onFormsetAdded","crispyFormsetModal","onFormAdded","_onFormsetDeleted","onFormDeleted","modals","includes","_newModalForm","push","modalForm","_onModalFormKeyUp","_onModalFormOpen","_onModalFormClose","target","resetCalculatedFields","ctrlKey","keyCode","table","toggler","formsetFormEl","_checker","selectedForm","deleteCheckbox","dispatchEvent","Event","_checkSelectAllState","showDeleteBt","selectAllToggler","recordCount","selected","indeterminate","prevDivSel","divSel","prepend","fields","fieldNames","rows","type","hasSummary","summary","match","groups","a","hasChildNodes","removeChild","lastChild","removeChildren","tdSel","selCheckbox","appendChild","tdNumber","Number","tdEdit","configureFormsets","formsetEl","configureModals","modalInstances","modalEl","Default","fn","args","arguments","getOrCreate","makeArray","slice","unshift","apply","init","styleId","css","style","head","refresh","readyState"],"mappings":"0BAAA,IAAIA,EAAUC,OAAOD,QACf,MAAAE,EAAOC,OAAOC,UAAUC,eAQvB,SAASC,IACd,SAASC,IACP,OAAOC,KAAKC,MAA4B,OAArB,EAAID,KAAKE,WACzBC,SAAS,IACTC,UAAU,EACd,CAQD,MAAO,GANOL,IAAcA,OACdA,QAC8B,KAA5BM,SAASN,IAAa,IAAgB,OAAQI,SAAS,QAC3B,MAA5BE,SAASN,IAAa,IAAgB,OAAQI,SAAS,OACzDJ,IAAcA,IAAcA,KAG5C,CAEO,SAASO,EAAaC,GACvB,IACAC,EAAY,GAChB,GAAa,WAFFD,EAAGE,QAAQC,cAEC,CACjB,IAAAC,EAAUC,SAASC,cAAc,OACrCF,EAAQG,UAAYP,EAAGQ,QAAQR,EAAGS,eAAeC,UACjDT,EAAYG,EAAQM,UACjBC,MAAM,MACNC,KAAKC,GAASA,EAAKC,SACnBC,KAAK,KACLD,MACP,MA/BoBE,EAgCRhB,EAhCgBiB,EAgCZ,YA/BP9B,EAAK+B,KAAKF,EAAQC,GAgCrBhB,EAAYD,EAAGmB,UAAUC,UAEM,QAA3BpB,EAAGqB,aAAa,QACdrB,EAAGsB,QACLrB,EAAYD,EAAGsB,OAIHrB,E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