2024-04-02 17:23:54 +02:00
|
|
|
(function(){"use strict";var __webpack_modules__={630:function(t,e,n){n.r(e),n.d(e,{FormContainer:function(){return a},InputGroup:function(){return s}});var r=n(510),i=function(){return i=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t},i.apply(this,arguments)},o=function(t,e,n){if(n||2===arguments.length)for(var r,i=0,o=e.length;i<o;i++)!r&&i in e||(r||(r=Array.prototype.slice.call(e,0,i)),r[i]=e[i]);return t.concat(r||Array.prototype.slice.call(e))},s=function(){function t(t,e){this._name="",this.currentData={},this.dataRequestedEventManager=new r.Z,this.name=t,this.initialData=e}return Object.defineProperty(t.prototype,"name",{get:function(){return this._name},set:function(t){if(0===t.length)throw new RangeError("empty name");this._name=t},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"data",{get:function(){return i({},this.currentData)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"element",{get:function(){if(null==this._element){var t=document.createElement("div");t.className="input-group input-group-".concat(this.name);var e=this.createContent();e instanceof Array?e.forEach(t.appendChild):t.appendChild(e),this._element=t}return this._element},enumerable:!1,configurable:!0}),t.prototype.reset=function(){this.currentData={}},t.prototype.updateData=function(t){this.currentData=i(i({},this.currentData),t)},t.prototype.requestData=function(t,e,n){this.dataRequestedEventManager.emit({identifier:t,params:e,done:n})},t.prototype.onDataRequested=function(t){return this.dataRequestedEventManager.on(t)},t}(),a=function(){function t(t,e,n){void 0===e&&(e=[]),void 0===n&&(n=[]);var i=this;this.inputGroupsByName={},this.enabledInputGroupNames=[],this.submitEventManager=new r.Z,this.itemDataRequestedEventManager=new r.Z,this.handleItemDataRequested=this.itemDataRequestedEventManager.emit,this.title=t,e.length>0&&(this.inputGroupsByName=e.reduce((function(t,e){return e.onDataRequested(i.handleItemDataRequested),t[e.name]=e,t}),this.inputGroupsByName)),n.length>0&&(this.enabledInputGroupNames=o(o([],this.enabledInputGroupNames,!0),n.filter((function(t){return null!=i.inputGroupsByName[t]})),!0))}return t.prototype.getInputGroup=function(t){return this.inputGroupsByName[t]||null},t.prototype.addInputGroup=function(t,e){return void 0===e&&(e=null),t.onDataRequested(this.handleItemDataRequested),this.inputGroupsByName[t.name]=t,this.enabledInputGroupNames=this.enabledInputGroupNames.filter((function(e){return e!==t.name})),null!==e?e<=0?this.enabledInputGroupNames=o([t.name],this.enabledInputGroupNames,!0):e>=this.enabledInputGroupNames.length?this.enabledInputGroupNames=o(o([],this.enabledInputGroupNames,!0),[t.name],!1):this.enabledInputGroupNames=o(o(o([],this.enabledInputGroupNames.slice(0,e),!0),[t.name],!1),this.enabledInputGroupNames.slice(e),!0):this.enabledInputGroupNames=o(o([],this.enabledInputGroupNames,!0),[t.name],!1),this},t.prototype.removeInputGroup=function(t){return delete this.inputGroupsByName[t],this.enabledInputGroupNames=this.enabledInputGroupNames.filter((function(e){return e!==t})),this},t.prototype.getFormElement=function(t){var e=this;void 0===t&&(t="update");var n=document.createElement("form");n.id="visual-console-item-edition",n.className="visual-console-item-edition",n.addEventListener("submit",(function(t){t.preventDefault(),e.submitEventManager.emit({nativeEvent:t,data:e.enabledInputGroupNames.reduce((function(t,n){return e.inputGroupsByName[n]&&(t=i(i({},t),e.inputGroupsByName[n].data)),t}),{})})}));var r=document.createElement("div");return r.className="input-groups",this.enabledInputGroupNames.forEach((function(t){e.inputGroupsByName[t]&&r.appendChild(e.inputGroupsByName[t].element)})),n.appendChild(r),n},t.prototype.reset=function(){var t=this;this.enabledInputGroupNames.forEach((function(e){t.inputGroupsByName[e]&&t.inputGroupsByName[e].reset()}))},t.prototype.onSubmit=function(t){return this.submitEventManager.on(t)},t.prototype.onInputGroupDat
|