webseite-grav/plugins/form/assets/form.min.js

41 lines
24 KiB
JavaScript
Raw Permalink Normal View History

2021-04-30 11:23:26 +02:00
!function(c){function e(e){for(var a,t,n=e[0],r=e[1],o=e[2],i=0,s=[];i<n.length;i++)t=n[i],Object.prototype.hasOwnProperty.call(d,t)&&d[t]&&s.push(d[t][0]),d[t]=0;for(a in r)Object.prototype.hasOwnProperty.call(r,a)&&(c[a]=r[a]);for(p&&p(e);s.length;)s.shift()();return u.push.apply(u,o||[]),l()}function l(){for(var e,a=0;a<u.length;a++){for(var t=u[a],n=!0,r=1;r<t.length;r++){var o=t[r];0!==d[o]&&(n=!1)}n&&(u.splice(a--,1),e=i(i.s=t[0]))}return e}var t={},d={site:0},u=[];function i(e){if(t[e])return t[e].exports;var a=t[e]={i:e,l:!1,exports:{}};return c[e].call(a.exports,a,a.exports,i),a.l=!0,a.exports}i.m=c,i.c=t,i.d=function(e,a,t){i.o(e,a)||Object.defineProperty(e,a,{enumerable:!0,get:t})},i.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},i.t=function(a,e){if(1&e&&(a=i(a)),8&e)return a;if(4&e&&"object"==typeof a&&a&&a.__esModule)return a;var t=Object.create(null);if(i.r(t),Object.defineProperty(t,"default",{enumerable:!0,value:a}),2&e&&"string"!=typeof a)for(var n in a)i.d(t,n,function(e){return a[e]}.bind(null,n));return t},i.n=function(e){var a=e&&e.__esModule?function(){return e.default}:function(){return e};return i.d(a,"a",a),a},i.o=function(e,a){return Object.prototype.hasOwnProperty.call(e,a)},i.p="";var a=window.webpackJsonp=window.webpackJsonp||[],n=a.push.bind(a);a.push=e,a=a.slice();for(var r=0;r<a.length;r++)e(a[r]);var p=n;u.push(["./app/main.js","vendor"]),l()}({"./app/fields/array.js":
/*!*****************************!*\
!*** ./app/fields/array.js ***!
\*****************************/
/*! exports provided: default, Instance */function(e,a,t){"use strict";t.r(a),t.d(a,"default",function(){return u}),t.d(a,"Instance",function(){return p});var n=t(/*! jquery */"jquery"),c=t.n(n),r=t(/*! sortablejs */"./node_modules/sortablejs/modular/sortable.esm.js");function o(e,a){if(!(e instanceof a))throw new TypeError("Cannot call a class as a function")}function i(e,a){for(var t=0;t<a.length;t++){var n=a[t];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function s(e,a,t){return a&&i(e.prototype,a),t&&i(e,t),e}var l=c()("body"),d=function(){function a(e){o(this,a),this.container=c()(e),void 0===this.getName()&&(this.container=this.container.closest("[data-grav-array-name]"))}return s(a,[{key:"getName",value:function(){return this.container.data("grav-array-name")||""}},{key:"getKeyPlaceholder",value:function(){return this.container.data("grav-array-keyname")||"Key"}},{key:"getValuePlaceholder",value:function(){return this.container.data("grav-array-valuename")||"Value"}},{key:"isValueOnly",value:function(){return this.container.find('[data-grav-array-mode="value_only"]:first').length||!1}},{key:"isTextArea",value:function(){return this.container.data("grav-array-textarea")||!1}},{key:"shouldBeDisabled",value:function(){var e=this.container.closest(".form-field").find('[data-grav-field="toggleable"] input[type="checkbox"]');return e.length&&e.is(":not(:checked)")}},{key:"getNewRow",value:function(){var e="",a=this.isTextArea()?"<textarea ".concat(this.shouldBeDisabled()?'disabled="disabled"':"",' data-grav-array-type="value" name="" placeholder="').concat(this.getValuePlaceholder(),'"></textarea>'):"<input ".concat(this.shouldBeDisabled()?'disabled="disabled"':"",' data-grav-array-type="value" type="text" name="" value="" placeholder="').concat(this.getValuePlaceholder(),'" />');return this.isValueOnly()?e+='\n <div class="form-row array-field-value_only" data-grav-array-type="row">\n <span data-grav-array-action="sort" class="fa fa-bars"></span>\n '.concat(a,"\n "):e+='\n <div class="form-row" data-grav-array-type="row">\n <span data-grav-array-action="sort" class="fa fa-bars"></span>\n <input '.concat(this.shouldBeDisabled()?'disabled="disabled"':"",' data-grav-array-type="key" type="text" value="" placeholder="').concat(this.getKeyPlaceholder(),'" />\n ').concat(a,"\n "),e+='\n <span data-grav-array-action="rem" class="fa fa-minus"></span>\n <span data-grav-array-action="add" class="fa fa-plus"></span>\n </div>'}}]),a}(),u=function(){function e(){var t=this;o(this,e),l.on("input",'[data-grav-array-type="key"], [data-grav-array-type="value"]',function(e){return t.actionInput(e)}),l.on("click touch",'[data-grav-array-action]:not([data-grav-array-action="sort"])',function(e){return t.actionEvent(e)}),this.arrays=c()(),c()('[data-grav-field="array"]').each(function(e,a){return t.addArray(a)}),c()("body").on("mutation._grav",this._onAddedNodes.bind(this))}return s(e,[{key:"addArray",value:function(e){(e=c()(e)).find('[data-grav-array-type="container"]').each(function(e,a){(a=c()(a)).data("array-sort")||a[0].hasAttribute("data-array-nosort")||a.data("array-sort",new r.default(a.get(0),{handle:".fa-bars",animation:150}))})}},{key:"actionInput",value:function(e){var a=c()(e.target),t=a.data("grav-array-type");this._setTemplate(a);var n=a.data("array-template"),r="key"===t?a:a.siblings('[data-grav-array-type="key"]:first'),o="value"===t?a:a.siblings('[data-grav-array-type="value"]:first'),i=n.isValueOnly()?this.getIndexFor(a):r.val();i=i.toString().replace(/\[/g,"%5B").replace(/]/g,"%5D");var s="".concat(n.getName(),"[").concat(i,"]");n.isValueOnly()||r.val()||o.val()?o.attr("name",s):o.attr("name",""),this.refreshNames(n)}},{key:"actionEvent",value:function(e){e&&e.preventDefault();var a=c()(e.target),t=a.data("grav-array-action"),n=a.parents('[data-grav-array-type="container"]');this._setTemplate(a),this["".co
/*!****************************!*\
!*** ./app/fields/file.js ***!
\****************************/
/*! exports provided: default, Instances */function(e,v,h){"use strict";h.r(v),function(s){h.d(v,"default",function(){return r}),h.d(v,"Instances",function(){return m});var e=h(/*! jquery */"jquery"),c=h.n(e),a=h(/*! dropzone */"./node_modules/dropzone/dist/dropzone.js"),i=h.n(a),l=h(/*! grav-form */"grav-form");function n(e,a){for(var t=0;t<a.length;t++){var n=a[t];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function t(e,a){var t=c()(a).find(".dropzone.files-upload");t.length&&t.each(function(e,a){a=c()(a),~f.index(a)||o(a)})}var d={dictCancelUpload:l.translations.PLUGIN_FORM.DROPZONE_CANCEL_UPLOAD,dictCancelUploadConfirmation:l.translations.PLUGIN_FORM.DROPZONE_CANCEL_UPLOAD_CONFIRMATION,dictDefaultMessage:l.translations.PLUGIN_FORM.DROPZONE_DEFAULT_MESSAGE,dictFallbackMessage:l.translations.PLUGIN_FORM.DROPZONE_FALLBACK_MESSAGE,dictFallbackText:l.translations.PLUGIN_FORM.DROPZONE_FALLBACK_TEXT,dictFileTooBig:l.translations.PLUGIN_FORM.DROPZONE_FILE_TOO_BIG,dictInvalidFileType:l.translations.PLUGIN_FORM.DROPZONE_INVALID_FILE_TYPE,dictMaxFilesExceeded:l.translations.PLUGIN_FORM.DROPZONE_MAX_FILES_EXCEEDED,dictRemoveFile:l.translations.PLUGIN_FORM.DROPZONE_REMOVE_FILE,dictRemoveFileConfirmation:l.translations.PLUGIN_FORM.DROPZONE_REMOVE_FILE_CONFIRMATION,dictResponseError:l.translations.PLUGIN_FORM.DROPZONE_RESPONSE_ERROR},u={createImageThumbnails:{thumbnailWidth:150},addRemoveLinks:i.a.autoDiscover=!1,dictDefaultMessage:d.dictDefaultMessage,dictRemoveFileConfirmation:d.dictRemoveFileConfirmation,previewTemplate:""},r=function(){function o(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},a=e.container,t=void 0===a?".dropzone.files-upload":a,n=e.options,r=void 0===n?{}:n;!function(e,a){if(!(e instanceof a))throw new TypeError("Cannot call a class as a function")}(this,o),this.container=c()(t),this.container.length&&(this.urls={},u.previewTemplate=c()("#dropzone-template").html(),this.options=Object.assign({},d,u,{klass:this,url:this.container.data("file-url-add")||l.config.current_url,acceptedFiles:this.container.data("media-types"),init:this.initDropzone},this.container.data("dropzone-options"),r),this.dropzone=new i.a(t,this.options),this.dropzone.on("complete",this.onDropzoneComplete.bind(this)),this.dropzone.on("success",this.onDropzoneSuccess.bind(this)),this.dropzone.on("removedfile",this.onDropzoneRemovedFile.bind(this)),this.dropzone.on("sending",this.onDropzoneSending.bind(this)),this.dropzone.on("error",this.onDropzoneError.bind(this)))}var e,a,t;return e=o,(a=[{key:"initDropzone",value:function(){var r=this,e=this.options.klass.container.find("[data-file]"),o=this;e.length&&e.each(function(e,a){var t=(a=c()(a)).data("file"),n={name:t.name,size:t.size,type:t.type,status:i.a.ADDED,accepted:!0,url:r.options.url,removeUrl:t.remove,data:t};o.files.push(n),o.options.addedfile.call(o,n),n.type.match(/^image\//)&&o.options.thumbnail.call(o,n,t.path),a.remove()})}},{key:"getURI",value:function(){return this.container.data("mediaUri")||""}},{key:"onDropzoneSending",value:function(e,a,t){var n=this.container.closest("form"),r=n.find('[name="__unique_form_id__"]');t.append("__form-name__",n.find('[name="__form-name__"]').val()),r.length&&t.append("__unique_form_id__",r.val()),t.append("__form-file-uploader__",1),t.append("name",this.options.dotNotation),t.append("form-nonce",l.config.form_nonce),t.append("task","filesupload"),t.append("uri",this.getURI())}},{key:"onDropzoneSuccess",value:function(e,a){if(this.options.reloadPage&&s.location.reload(),a.session){e.sessionParams=a.session,e.removeUrl=this.options.url;var t=this.container.find('[name][type="hidden"]'),n=t.val();t.val(n+" ")}return this.handleError({file:e,data:a,mode:"removeFile",msg:"<p>".concat(l.translations.PLUGIN_FORM.FILE_ERROR_UPLOAD," <strong>").concat(e.name,"</strong></p>\n <pre>").concat(a.message,"</pre>")})}},{key:"onDropzoneComplete",value:function(e){if(!e.accepted&&!e.rejected){var a={status:"error",message:"".concat(l.translations.PLUGIN_FORM.FILE_UN
/*!****************************!*\
!*** ./app/fields/form.js ***!
\****************************/
/*! no exports provided */function(e,a,t){"use strict";t.r(a);var n=t(/*! jquery */"jquery"),s=t.n(n);s()(document).ready(function(){var e=s()("form").filter(function(e){return s()(e).find('[name="__form-name__"]')});e.length&&e.each(function(e,a){var t,n;t=a,n='[data-grav-field="toggleable"] input[type="checkbox"]',(t=s()(t)).on("change",n,function(e){var a=s()(e.target),n=a.is(":checked"),t=a.closest(".form-field"),r=t.find("label.toggleable"),o=t.find(".form-data"),i=o.find("input, select, textarea, button");r.add(o).css("opacity",n?"":.7),i.map(function(e,a){var t=a.selectize;a=s()(a),t?t[n?"enable":"disable"]():a.prop("disabled",!n)})}),t.find(n).trigger("change"),function(e){e=s()(e);var a=[];["input","select","label[for]","textarea",".selectize-control"].forEach(function(e){a.push("".concat(".form-field-toggleable .form-data"," ").concat(e))}),e.on("mousedown",a.join(", "),function(e){var a=s()(e.target),t=a.prop("for"),n=(a.hasClass("selectize-control")||a.parents(".selectize-control")).length;if(t&&(a=s()('[id="'.concat(t,'"]'))),n&&(a=a.closest(".selectize-control").siblings("select[name]")),!a.prop("disabled"))return!0;a.closest(".form-field").find('[data-grav-field="toggleable"] input[type="checkbox"]').trigger("click")})}(a)})})},"./app/fields/index.js":
/*!*****************************!*\
!*** ./app/fields/index.js ***!
\*****************************/
/*! exports provided: default */function(e,a,t){"use strict";t.r(a);t(/*! ./form */"./app/fields/form.js");var n=t(/*! ./file */"./app/fields/file.js"),r=t(/*! ./array */"./app/fields/array.js"),o=t(/*! ./media */"./app/fields/media.js");t(/*! ./tabs */"./app/fields/tabs.js");a.default={FileInstances:n.default,ArrayInstances:r.default,Media:{PageMedia:o.default,PageMediaInstances:o.Instance}}},"./app/fields/media.js":
/*!*****************************!*\
!*** ./app/fields/media.js ***!
\*****************************/
/*! exports provided: default, Instance */function(e,l,y){"use strict";y.r(l),function(s){y.d(l,"default",function(){return a}),y.d(l,"Instance",function(){return c});var e=y(/*! jquery */"jquery"),d=y.n(e),n=y(/*! ./file */"./app/fields/file.js"),u=y(/*! grav-form */"grav-form"),p=y(/*! sortablejs */"./node_modules/sortablejs/modular/sortable.esm.js");function t(e){return(t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function r(e,a){for(var t=0;t<a.length;t++){var n=a[t];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function o(e,a,t){return(o="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,a,t){var n=function(e,a){for(;!Object.prototype.hasOwnProperty.call(e,a)&&null!==(e=m(e)););return e}(e,a);if(n){var r=Object.getOwnPropertyDescriptor(n,a);return r.get?r.get.call(t):r.value}})(e,a,t||e)}function i(n){return function(){var e,a=m(n);if(function(){if("undefined"==typeof Reflect||!Reflect.construct)return;if(Reflect.construct.sham)return;if("function"==typeof Proxy)return 1;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),1}catch(e){return}}()){var t=m(this).constructor;e=Reflect.construct(a,arguments,t)}else e=a.apply(this,arguments);return f(this,e)}}function f(e,a){return!a||"object"!==t(a)&&"function"!=typeof a?function(e){if(void 0!==e)return e;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}(e):a}function m(e){return(m=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function v(e,a){return(v=Object.setPrototypeOf||function(e,a){return e.__proto__=a,e})(e,a)}var h='\n <div class="dz-preview dz-file-preview">\n <div class="dz-details">\n <div class="dz-filename"><span data-dz-name></span></div>\n <div class="dz-size" data-dz-size></div>\n <img data-dz-thumbnail />\n </div>\n <div class="dz-progress"><span class="dz-upload" data-dz-uploadprogress></span></div>\n <div class="dz-success-mark"><span>✔</span></div>\n <div class="dz-error-mark"><span>✘</span></div>\n <div class="dz-error-message"><span data-dz-errormessage></span></div>\n <a class="dz-remove" title="'.concat(u.translations.PLUGIN_FORM.DELETE,'" href="javascript:undefined;" data-dz-remove>').concat(u.translations.PLUGIN_FORM.DELETE,"</a>\n </div>").trim(),a=function(){!function(e,a){if("function"!=typeof a&&null!==a)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(a&&a.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),a&&v(e,a)}(l,n["default"]);var e,a,t,c=i(l);function l(){var t,e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},a=e.container,n=void 0===a?"#grav-dropzone":a,r=e.options,o=void 0===r?{}:r;!function(e,a){if(!(e instanceof a))throw new TypeError("Cannot call a class as a function")}(this,l);var i=d()("#dropzone-media-template").html()||h;if(o=Object.assign(o,{previewTemplate:i}),!(t=c.call(this,{container:n,options:o})).container.length)return f(t);t.urls={fetch:"".concat(t.container.data("media-url"),"/task").concat(u.config.param_sep,"listmedia"),add:"".concat(t.container.data("media-url"),"/task").concat(u.config.param_sep,"addmedia"),delete:"".concat(t.container.data("media-url"),"/task").concat(u.config.param_sep,"delmedia")},t.dropzone.options.url=t.urls.add,void 0!==t.options.fetchMedia&&!t.options.fetchMedia||t.fetchMedia();var s=d()('[name="'.concat(t.container.data("dropzone-field"),'"]'));return s.length&&(t.sortable=new p.default(t.container.get(0),{animation:150,setData:function(e,a){a=d()(a),t.dropzone.disable(),a.addClass("hide-backface"),e.effectAllowed="copy"},onSort:function(){var n=[];t.container.find("[data-dz-name]").each(function(e,a){var t=(a=d()(a)).text().trim();n.push(t)}),s.val(n.join(","))}})),t}return e=l,(a=[{key:
/*!****************************!*\
!*** ./app/fields/tabs.js ***!
\****************************/
/*! no exports provided */function(e,a,t){"use strict";t.r(a);var n=t(/*! jquery */"jquery"),r=t.n(n);r()("body").on("touchstart click","[data-tabid]",function(e){e&&e.stopPropagation();var a=r()(e.currentTarget),t=r()('[id="'.concat(a.data("tabid"),'"]'));a.siblings("[data-tabid]").removeClass("active"),a.addClass("active"),t.siblings("[id]").removeClass("active"),t.addClass("active")})},"./app/main.js":
/*!*********************!*\
!*** ./app/main.js ***!
\*********************/
/*! exports provided: Instances */function(e,a,t){"use strict";t.r(a);var n=t(/*! ./fields */"./app/fields/index.js");t.d(a,"Instances",function(){return n.default});t(/*! ./utils/keep-alive */"./app/utils/keep-alive.js")},"./app/utils/keep-alive.js":
/*!*********************************!*\
!*** ./app/utils/keep-alive.js ***!
\*********************************/
/*! no exports provided */function(e,a,t){"use strict";t.r(a);var n=t(/*! jquery */"jquery"),r=t.n(n),o=t(/*! grav-form */"grav-form");r()(document).ready(function(){if(r()("[data-grav-keepalive]").length){var e=o.config.session_timeout/1.5*1e3;setInterval(function(){r.a.ajax({url:"".concat(o.config.base_url_relative,"/task").concat(o.config.param_sep,"keep-alive")})},Math.min(e,2147483647))}})},"grav-form":
/*!***************************!*\
!*** external "GravForm" ***!
\***************************/
/*! no static exports found */function(e,a){e.exports=GravForm},jquery:
/*!*************************!*\
!*** external "jQuery" ***!
\*************************/
/*! no static exports found */function(e,a){e.exports=jQuery}});