1 line
51 KiB
JavaScript
1 line
51 KiB
JavaScript
|
(self.webpackChunktimetrex=self.webpackChunktimetrex||[]).push([["reports-custom_column-CustomColumnViewController","formula_builder-FormulaBuilder"],{9326:(__unused_webpack_module,__unused_webpack_exports,__webpack_require__)=>{eval("/* provided dependency */ var jQuery = __webpack_require__(9755);\n( function( $ ) {\n\n\t$.fn.FormulaBuilder = function( options ) {\n\t\tvar opts = $.extend( {}, $.fn.FormulaBuilder.defaults, options );\n\t\tvar $this = this;\n\t\tvar field;\n\n\t\tvar text_label = $.i18n._( 'Formula Builder' );\n\n\t\tvar field_type = 'textarea';\n\n\t\tvar error_string = '';\n\t\tvar error_tip_box;\n\n\t\tvar mass_edit_mode = false;\n\t\tvar check_box = null;\n\n\t\tvar enabled = true;\n\n\t\tvar text_input = null;\n\n\t\tthis.getEnabled = function() {\n\t\t\treturn enabled;\n\t\t};\n\n\t\tthis.setEnabled = function( val ) {\n\t\t\tenabled = val;\n\t\t\tif ( val === false || val === '' ) {\n\t\t\t\ttext_input.children().attr( 'disabled', 'true' );\n\t\t\t\ttext_input.addClass( 't-text-area-readonly' );\n\t\t\t} else {\n\t\t\t\ttext_input.children().removeAttr( 'disabled' );\n\t\t\t\ttext_input.removeClass( 't-text-area-readonly' );\n\t\t\t}\n\n\t\t};\n\n\t\tthis.setCheckBox = function( val ) {\n\t\t\tif ( check_box ) {\n\t\t\t\tcheck_box.children().eq( 0 )[0].checked = val;\n\t\t\t}\n\t\t};\n\n\t\tthis.isChecked = function() {\n\t\t\tif ( check_box ) {\n\t\t\t\tif ( check_box.children().eq( 0 )[0].checked === true ) {\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn false;\n\t\t};\n\n\t\tthis.setMassEditMode = function( val ) {\n\t\t\tmass_edit_mode = val;\n\n\t\t\tif ( mass_edit_mode ) {\n\t\t\t\tcheck_box = $( ' <div class=\"mass-edit-checkbox-wrapper\"><input type=\"checkbox\" class=\"mass-edit-checkbox\"></input>' +\n\t\t\t\t\t'<label for=\"checkbox-input-1\" class=\"input-helper input-helper--checkbox\"></label></div>' );\n\t\t\t\tcheck_box.insertBefore( text_input );\n\n\t\t\t\tcheck_box.change( function() {\n\t\t\t\t\t$this.trigger( 'formItemChange', [$this] );\n\t\t\t\t} );\n\n\t\t\t} else {\n\t\t\t\tif ( check_box ) {\n\t\t\t\t\tcheck_box.remove();\n\t\t\t\t\tcheck_box = null;\n\t\t\t\t}\n\t\t\t}\n\n\t\t};\n\n\t\tthis.setValue = function( val ) {\n\n\t\t\tif ( !val ) {\n\t\t\t\tval = '';\n\t\t\t}\n\n\t\t\ttext_input.val( val );\n\n\t\t};\n\n\t\tthis.setErrorStyle = function( errStr, show, isWarning ) {\n\t\t\tif ( isWarning ) {\n\t\t\t\ttext_input.addClass( 'warning-tip' );\n\t\t\t} else {\n\t\t\t\ttext_input.addClass( 'error-tip' );\n\t\t\t}\n\t\t\terror_string = errStr;\n\n\t\t\tif ( show ) {\n\t\t\t\tthis.showErrorTip();\n\t\t\t}\n\t\t};\n\n\t\tthis.showErrorTip = function( sec ) {\n\n\t\t\tif ( !Global.isSet( sec ) ) {\n\t\t\t\tsec = 2;\n\t\t\t}\n\n\t\t\tif ( !error_tip_box ) {\n\t\t\t\terror_tip_box = Global.loadWidgetByName( WidgetNamesDic.ERROR_TOOLTIP );\n\t\t\t\terror_tip_box = error_tip_box.ErrorTipBox();\n\t\t\t}\n\t\t\tif ( text_input.hasClass( 'warning-tip' ) ) {\n\t\t\t\terror_tip_box.show( this, error_string, sec, true );\n\t\t\t} else {\n\t\t\t\terror_tip_box.show( this, error_string, sec );\n\t\t\t}\n\t\t};\n\n\t\tthis.hideErrorTip = function() {\n\n\t\t\tif ( Global.isSet( error_tip_box ) ) {\n\t\t\t\terror_tip_box.remove();\n\t\t\t}\n\n\t\t};\n\n\t\tthis.clearErrorStyle = function() {\n\t\t\ttext_input.removeClass( 'error-tip' );\n\t\t\ttext_input.removeClass( 'warning-tip' );\n\t\t\tthis.hideErrorTip();\n\t\t\terror_string = '';\n\t\t};\n\n\t\tthis.setField = function( val ) {\n\t\t\tfield = val;\n\t\t};\n\n\t\tthis.getField = function() {\n\t\t\treturn field;\n\t\t};\n\n\t\tthis.getValue = function() {\n\t\t\treturn text_input.val();\n\t\t};\n\n\t\tthis.setValue = function( val ) {\n\n\t\t\tif ( !val ) {\n\t\t\t\tval = '';\n\t\t\t}\n\n\t\t\ttext_input.val( val );\n\t\t};\n\n\t\tthis.each( function() {\n\n\t\t\tvar o = $.meta ? $.extend( {}, opts, $( this ).data() ) : opts;\n\t\t\tvar calc_width = true;\n\n\t\t\tif ( o.field_type && o.field_type === 'text_input' ) {\n\t\t\t\t$( this ).html( $.fn.FormulaBuilder.html_template_text_input );\n\t\t\t\tcalc_width = fal
|