views.static.entity.js.entity-module.js Maven / Gradle / Ivy
!function(t){var e={};function a(i){if(e[i])return e[i].exports;var r=e[i]={i:i,l:!1,exports:{}};return t[i].call(r.exports,r,r.exports,a),r.l=!0,r.exports}a.m=t,a.c=e,a.d=function(t,e,i){a.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:i})},a.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},a.t=function(t,e){if(1&e&&(t=a(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var i=Object.create(null);if(a.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var r in t)a.d(i,r,function(e){return t[e]}.bind(null,r));return i},a.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return a.d(e,"a",e),e},a.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},a.p="",a(a.s=16)}([,function(t,e){t.exports=jQuery},,function(t,e,a){"use strict";var i;a.d(e,"a",function(){return i}),function(t){t.MOVE_TO_PAGE="emSortableTable:moveToPage",t.SORT="emSortableTable:sort",t.PREPARE_DATA="emSortableTable:prepareData",t.LOAD_DATA="emSortableTable:loadData",t.NEW_DATA_LOADED="emSortableTable:newDataLoaded"}(i||(i={}))},function(t,e,a){"use strict";a.d(e,"a",function(){return r}),a.d(e,"b",function(){return n});var i=a(1),r=function(){function t(e){var a=this;this.bootstrapUiModule=window.BootstrapUiModule;var r=e.find("[data-role=items]").first(),n=e.find("[data-role=edit-item-template]").first();r.find("tr").length>1&&r.removeClass("d-none");var o=function(){var t=e.data("bootstrapui-adapter");t&&t.triggerChange()},l=function(t){t.preventDefault(),i(t.currentTarget).closest("[data-role=item]").remove(),1===r.find("tr").length&&r.addClass("d-none"),o()};r.find("[data-action=remove-item]").click(l);var s=e.find("[data-role=control]").first().data("bootstrapui-adapter");i(s.getTarget()).on("bootstrapui.change",function(e,s){e.stopPropagation();var u=s.getValue()[0];if(""!==u.value){var d=t.escapeHtml(""+u.value);if(0===r.find('[value="'+d+'"]').length){var c=i(i(a.bootstrapUiModule.refTarget(n)).html().replace("{{id}}",d).replace("{{label}}",t.escapeHtml(""+u.label)));c.find("[data-action=remove-item]").click(l),r.append(c),r.removeClass("d-none")}s.reset(),o()}})}return t.escapeHtml=function(t){return t.replace(/&/g,"&").replace(//g,">").replace(/"/g,""")},t}(),n=function(){function t(t){this.target=t,this.items=i(t).find("[data-role=items]").first()}return t.prototype.getTarget=function(){return this.target},t.prototype.getValue=function(){return this.items.find("input[type=hidden]").map(function(t,e){var a=i(e).val();return{label:a,value:a,context:e}}).toArray()},t.prototype.reset=function(){},t.prototype.selectValue=function(t){},t.prototype.triggerChange=function(){i(this.getTarget()).trigger("bootstrapui.change",[this])},t.prototype.triggerSubmit=function(){i(this.getTarget()).trigger("bootstrapui.submit",[this])},t}()},,function(t,e,a){"use strict";(function(t){a.d(e,"a",function(){return i});var i=function(){return function(e){var a=this;this.bootstrapUiModule=window.BootstrapUiModule,this.entityModule=window.EntityModule;var i=e,r=function(e){return e.filter(function(e,a){return t(a).closest("[data-item-format]").is(i)})},n=r(i.find("[data-role=items]")).first(),o=r(i.find("[data-role=edit-item-template]")).first(),l=o.attr("data-template-prefix"),s=o.data("next-item-index"),u=i.attr("data-item-format"),d=i.closest("[data-item-prefix]");if(d.length){var c=d.attr("data-item-prefix"),f=d.closest("[data-item-format]").attr("data-item-format");u=u.replace(f,c)}r(n.find("[data-action=remove-item]")).click(function(e){e.preventDefault(),t(e.currentTarget).closest("[data-role=item]").remove()}),r(i.find("[data-action=add-item]")).click(function(){var e=s++,i="item-"+e,r=u.replace("{{key}}",i),d=t(a.bootstrapUiModule.refTarget(o).html());d.attr("data-item-key",i),d.attr("data-item-prefix",r),d.find('[name^="'+l+'"]').each(function(e,a){t(a).attr("name",t(a).attr("name").replace(l,r))}),d.find('[name^="_'+l+'"]').each(function(e,a){t(a).attr("name",t(a).attr("name").replace("_"+l,"_"+r))}),d.find('[for^="'+l+'"]').each(function(e,a){t(a).attr("for",t(a).attr("for").replace(l,r))}),d.find('[id^="'+l+'"]').each(function(e,a){t(a).attr("id",t(a).attr("id").replace(l,r))}),d.find("[data-action=remove-item]").click(function(e){e.preventDefault(),t(e.currentTarget).closest("[data-role=item]").remove()}),d.find('[name="'+r+'.sortIndex"]').attr("value",e),n.append(d),a.entityModule.initializeFormElements(d)})}}()}).call(this,a(1))},,,function(t,e,a){"use strict";(function(t){a.d(e,"a",function(){return n});var i=a(6),r=a(4),n=function(){function e(){this.documentInitialized=!1,this.initializers=[],this.bootstrapUiModule=window.BootstrapUiModule}return e.prototype.registerInitializer=function(t,e){this.initializers.push(t),(void 0===e||!0===e)&&this.documentInitialized&&t()},e.prototype.initializeFormElements=function(e){(void 0!==e||this.documentInitialized)&&this.bootstrapUiModule&&this.bootstrapUiModule.initializeFormElements&&this.bootstrapUiModule.initializeFormElements(e),void 0!==e||this.documentInitialized||(this.documentInitialized=!0),t('[data-tbl-type="paged"]',e).emSortableTable(),t("[data-dependson]",e).each(function(e,a){var i=t(this).data("dependson"),r=null!=i.options?i.options:{hide:!1};delete i.options,t(a).dependsOn(i,r)}),t(".js-multi-value-control",e).each(function(e,a){var i=t(a);i.find(".js-multi-value-input").on("keypress",function(e){if(13===(e.keyCode?e.keyCode:e.which)){e.preventDefault();var a=t(e.currentTarget).val();if(a){var r=i.find(".js-multi-value-template").clone(!1);r.removeClass("d-none js-multi-value-template"),r.addClass("js-multi-value-item"),r.find(".js-multi-value-value").each(function(t,e){e.innerText=a}),r.find("[type=hidden]").val(a).removeAttr("disabled"),i.find("table").append(r),r.find("a").on("click",function(e){e.preventDefault(),t(e.currentTarget).closest("tr").remove()}),t(e.currentTarget).val("")}}}),i.find(".js-multi-value-item a").on("click",function(e){e.preventDefault(),t(e.currentTarget).closest("tr").remove()})}),t(".js-embedded-collection-form-group",e).each(function(e,a){return new i.a(t(a))}),t(".js-multi-value-autosuggest",e).each(function(e,a){return new r.a(t(a))}),t('[data-toggle="tooltip"]',e).tooltip();for(var a=0;a-1&&(0===a&&(r.dir="ASC"===e.sort[a].dir?"DESC":"ASC"),e.sort.length>1?e.sort.splice(a,1):e.sort=[]),e.sort=[r].concat(e.sort),e.moveToPage(e.page)},this.init(t),this.entityModule=window.EntityModule}return e.prototype.init=function(e){var a=this;this.table=t(e);var n=t(e).attr("data-tbl");this.page=parseInt(this.table.attr("data-tbl-current-page"),10),this.formName=t(e).attr("data-tbl-form"),this.form=t("form[name="+this.formName+"]"),this.doesDataLoadWithAjax=this.table.data("tbl-ajax-load"),this.size=parseInt(this.table.attr("data-tbl-size"),10),this.totalPages=parseInt(this.table.attr("data-tbl-total-pages"),10);var o=this.table.data("tbl-sort");this.sort=null!=o?o:[],this.sortables=t("[data-tbl='"+n+"'][data-tbl-sort-property]",this.table),this.sortables.removeClass("asc","desc");for(var l=function(e){var a=s.sort[e];t("[data-tbl='"+n+"'][data-tbl-sort-property='"+a.prop+"']",s.table).each(function(i,r){0===e&&t(r).addClass("ASC"===a.dir?"asc":"desc"),a.prop=t(r).data("tbl-sort-property")})},s=this,u=0;ua.totalPages&&(i=a.totalPages),a.table.trigger(r.a.MOVE_TO_PAGE,i-1))}}),this.sortables.click(function(e){e.preventDefault(),e.stopPropagation(),a.table.trigger(r.a.SORT,t(e.target).data("tbl-sort-property"))});var d=this;i.event.special[r.a.LOAD_DATA]={_default:function(t,e){d.loadData(e)}},i.event.special[r.a.PREPARE_DATA]={_default:function(t,e){d.prepareData(e)}}},e.prototype.moveToPage=function(t){var e={page:t,size:this.size};if(null!=this.sort&&this.sort.length>0){for(var a=[],i=0;i ');else a.append('')}}(e,i)}),this.doesDataLoadWithAjax?(this.dataIsLoading=!0,this.loadDataWithAjax(e,a)):a.submit()}else{var i=window.location.href.split("?")[0];window.location.href=i+"?"+t.param(e,!0)}},e}()}).call(this,a(1),a(1))},,,,function(t,e,a){"use strict";a.r(e),function(t){var e=a(9),i=a(12),r=a(4),n=new e.a,o=window.BootstrapUiModule;o.ControlAdapterFactory&&o.ControlAdapterFactory.register("multi-value-autosuggest",function(t){return o.ControlAdapterFactory.initializeControlAdapters(t),new r.b(t)}),t(document).ready(function(){n.initializeFormElements()}),window.EntityModule=n,t.fn.emSortableTable=function(){return this.each(function(){this._emSortableTable||(this._emSortableTable=new i.a(this))})}}.call(this,a(1))}]);
//# sourceMappingURL=entity-module.js.map
© 2015 - 2024 Weber Informatics LLC | Privacy Policy