views.static.FileManagerModule.js.file-upload.js Maven / Gradle / Ivy
The newest version!
!function(e){function t(r){if(n[r])return n[r].exports;var a=n[r]={i:r,l:!1,exports:{}};return e[r].call(a.exports,a,a.exports,t),a.l=!0,a.exports}var n={};t.m=e,t.c=n,t.d=function(e,n,r){t.o(e,n)||Object.defineProperty(e,n,{configurable:!1,enumerable:!0,get:r})},t.n=function(e){var n=e&&e.__esModule?function t(){return e.default}:function t(){return e};return t.d(n,"a",n),n},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="/across/resources/static/FileManagerModule/js/",t(t.s=0)}([function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function a(e){return(0,u.default)(e).get(0).outerHTML}function o(e){var t=(0,u.default)(BootstrapUiModule.refTarget(e.find("[data-role=selected-item-template]"))),n=t.html();return t.remove(),n}function l(e){function t(e){e.find("a.remove-file").on("click",function(e){e.preventDefault(),(0,u.default)(e.target).closest(".file-reference-control-item").remove(),r.removeAttr("data-id"),r.attr("type","hidden"),r.removeAttr("value"),r.attr("type","file"),r.removeClass("d-none")})}var n=o(e),r=e.find(":file");r.data("id")&&(r.attr("type","hidden"),r.attr("value",r.data("id"))),t(e),r.on("change",function(){var a=r[0].files;if(a.length>0){var o=a[0];r.addClass("d-none"),e.append(n.replace("{{fileName}}",o.name)),t(e)}})}function i(e){function t(e){e.find("a.remove-file").on("click",function(e){e.preventDefault(),(0,u.default)(e.target).closest(".file-reference-control-item").remove()})}function n(a){a.on("change",function(){var o=f++,l="item-"+o,d=a[0].files;if(d.length>0){var c=a.data("control-name").replace(/{{key}}/g,l);a.addClass("d-none"),a.removeAttr("data-role"),a.removeAttr("data-control-name"),a.attr("name",c);for(var p=0;p ');m.prop("name",a.attr("name").replace(/.value$/g,".sortIndex")),m.prop("value",o),v.append(m),t(v)}var g=(0,u.default)(i);e.append(g),n(g)}})}var r=o(e),l=e.find("[data-role=file-upload-template]").first(),i=a(l),f=e.data("next-item-id");t(e),n(l)}var f=n(1),u=r(f);EntityModule.registerInitializer(function(e){(0,u.default)(".js-file-reference-control",e).each(function(e,t){var n=(0,u.default)(t);n.data("multiple")?i(n):l(n)})})},function(e,t){e.exports=jQuery}]);