praiadeseselle/wire/templates-admin/scripts/inputfields.min.js

1 line
41 KiB
JavaScript
Raw Normal View History

2023-03-10 19:41:40 +01:00
var Inputfields={debug:false,processingIfs:false,toggling:false,toggleBehavior:0,defaultDuration:0,init:function($target){InputfieldsInit($target)},toggle:function($inputfield,open,duration,callback){$inputfield=this.inputfield($inputfield);if(!$inputfield.length)return $inputfield;var $header=$inputfield.children(".InputfieldHeader, .ui-widget-header");var $content=$inputfield.children(".InputfieldContent, .ui-widget-content");var $toggleIcon=$header.find(".toggle-icon");var isCollapsed=$inputfield.hasClass("InputfieldStateCollapsed");var isAjax=$inputfield.hasClass("collapsed10")||$inputfield.hasClass("collapsed11");var Inputfields=this;var $siblings=null;if($inputfield.hasClass("InputfieldAjaxLoading"))return $inputfield;if($inputfield.hasClass("InputfieldStateToggling"))return $inputfield;if(!isAjax&&!this.toggling&&$inputfield.hasClass("InputfieldColumnWidth")){var $siblings=Inputfields.getAllInRow($inputfield);if($siblings.length<2)$siblings=null}if(typeof open=="undefined"||open===null)open=isCollapsed;if(typeof duration=="undefined")duration=this.defaultDuration;function completed(){if(Inputfields.toggling===$inputfield.prop("id")){if($siblings&&$siblings.length){$siblings.each(function(){Inputfields.toggle(jQuery(this),open,0)})}setTimeout(function(){Inputfields.toggling=false},100);$siblings=null}if(typeof callback!="undefined")callback($inputfield,open,duration)}function toggled(){if($inputfield.css("overflow")=="hidden")$inputfield.css("overflow","");$toggleIcon.toggleClass($toggleIcon.attr("data-to"));$inputfield.removeClass("InputfieldStateToggling");Inputfields.redraw($inputfield,500);completed()}function opened(){$inputfield.trigger("opened",$inputfield);if($inputfield.hasClass("InputfieldColumnWidth")){$inputfield.children(".InputfieldContent").show()}if($inputfield.prop("id")===Inputfields.toggling&&!$inputfield.hasClass("InputfieldNoFocus")){Inputfields.focus($inputfield)}toggled()}function closed(){if($inputfield.css("overflow")=="hidden")$inputfield.css("overflow","");$inputfield.trigger("closed",$inputfield);if($inputfield.hasClass("InputfieldColumnWidth")){$inputfield.children(".InputfieldContent").hide()}toggled()}if(open&&!$inputfield.is(":visible")){var $tabContent=$inputfield.parents(".InputfieldWrapper").last();if($tabContent.length&&!$tabContent.is(":visible")){var $tabButton=jQuery("#_"+$tabContent.attr("id"));if($tabButton.length){$tabContent.show();setTimeout(function(){$tabButton.click()},25)}}var $collapsedParent=$inputfield.closest(".InputfieldStateCollapsed:not([id="+$inputfield.attr("id")+"])");if($collapsedParent.length){Inputfields.toggle($collapsedParent,true,duration,function($in){Inputfields.toggle($in,true,duration,callback)})}}if(open&&!isCollapsed){completed();return $inputfield}if(!open&&isCollapsed){completed();return $inputfield}if(isCollapsed&&isAjax&&!$inputfield.hasClass("InputfieldStateWasCollapsed")){$toggleIcon.click();return $inputfield}if(!this.toggling)this.toggling=$inputfield.prop("id");if(open&&isCollapsed){$inputfield.addClass("InputfieldStateToggling").trigger("openReady",$inputfield);if(duration&&jQuery.ui){$inputfield.toggleClass("InputfieldStateCollapsed",duration,opened)}else{$inputfield.removeClass("InputfieldStateCollapsed");opened()}}else if(!open&&!isCollapsed){$inputfield.addClass("InputfieldStateToggling").trigger("closeReady",$inputfield);if(duration&&jQuery.ui){$inputfield.toggleClass("InputfieldStateCollapsed",duration,closed)}else{$inputfield.addClass("InputfieldStateCollapsed");closed()}}return $inputfield},toggleAll:function($inputfields,open,duration,callback){if(typeof $inputfields==="string")$inputfields=jQuery($inputfields);var Inputfields=this;$($inputfields.get().reverse()).each(function(i,el){Inputfields.toggle($(el),open,duration,callback)});return $inputfields},open:function($inputfield,duration,callback){return this.toggle($inputfield,true,duration)},close:function($inputfield,duration,callback){return this.toggle($inputfield,false,duration)},show:function($inputfield){$inputfield=this.inputfield($inputfield);if(!this.hidden($inputfi