TimeTrex/interface/html5/dist/text_input-TTextInput.bundle.js

1 line
36 KiB
JavaScript
Raw Normal View History

2022-12-13 07:10:06 +01:00
(self.webpackChunktimetrex=self.webpackChunktimetrex||[]).push([["text_input-TTextInput"],{9264:(__unused_webpack_module,__unused_webpack_exports,__webpack_require__)=>{eval("/* provided dependency */ var jQuery = __webpack_require__(9755);\n( function( $ ) {\n\n\t$.fn.TTextInput = function( options ) {\n\t\tvar opts = $.extend( {}, $.fn.TTextInput.defaults, options );\n\t\tvar $this = this;\n\t\tvar field;\n\t\tvar validation_field;\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 hasKeyEvent = null;\n\n\t\t//DONT USE THIS ANY MORE\n\t\tvar need_parser_date = false;\n\n\t\tvar need_parser_sec = false;\n\n\t\tvar parsed_value = false; //work with need_parser_date\n\n\t\tvar api_date = null;\n\n\t\tvar validate_timer = null;\n\n\t\tvar no_validate_timer = null;\n\n\t\tvar no_validate_timer_sec = 0;\n\n\t\tvar password_style = false;\n\n\t\tvar disable_keyup_event = false; //set to not send change event when mouseup\n\n\t\tvar mode;\n\n\t\tvar is_static_width;\n\n\t\tvar static_width;\n\n\t\tvar display_na = true; // Display N/A when no value\n\n\t\t// var cancel_date_parse = false;\n\n\t\tvar do_validate = true;\n\n\t\t// var parseDateAsync = function( callBack ) {\n\t\t// \tparsed_value = -1;\n\t\t// \tif ( !api_date ) {\n\t\t// \t\tapi_date = TTAPI.APITTDate;\n\t\t// \t}\n\t\t// \tapi_date.parseTimeUnit( $this.val(), {\n\t\t// \t\tonResult: function( result ) {\n\t\t// \t\t\tif ( cancel_date_parse ) {\n\t\t// \t\t\t\treturn;\n\t\t// \t\t\t}\n\t\t// \t\t\tparsed_value = result.getResult();\n\t\t// \t\t\tif ( callBack ) {\n\t\t// \t\t\t\tcallBack();\n\t\t// \t\t\t}\n\t\t// \t\t\tProgressBar.closeOverlay();\n\t\t// \t\t}\n\t\t// \t} );\n\t\t//\n\t\t// \t//parsed_value = Global.parseTimeUnit( $this.val() );\n\t\t// };\n\n\t\tthis.setPlaceHolder = function( val ) {\n\t\t\t$this.attr( 'placeholder', val );\n\t\t};\n\n\t\tthis.setNeedParsDate = function( val ) {\n\t\t\tneed_parser_date = val;\n\t\t};\n\n\t\tthis.setNeedParseSec = function( val ) {\n\t\t\tif ( val ) {\n\t\t\t\t//parsed_value = parseDateAsync();\n\t\t\t\tparsed_value = Global.parseTimeUnit( $this.val() );\n\t\t\t}\n\t\t\tneed_parser_sec = val;\n\n\t\t};\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\t$this.attr( 'readonly', 'true' );\n\t\t\t\t$this.addClass( 't-text-input-readonly' );\n\t\t\t\tif ( check_box ) {\n\t\t\t\t\tcheck_box.hide();\n\t\t\t\t}\n\t\t\t\tif ( !this.getValue() && display_na ) {\n\t\t\t\t\tthis.val( $.i18n._( 'N/A' ) );\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\t$this.removeAttr( 'readonly' );\n\t\t\t\t$this.removeClass( 't-text-input-readonly' );\n\t\t\t\tif ( check_box ) {\n\t\t\t\t\tcheck_box.show();\n\t\t\t\t}\n\t\t\t\tif ( this.val() === $.i18n._( 'N/A' ) ) {\n\t\t\t\t\tthis.val( '' );\n\t\t\t\t}\n\t\t\t}\n\n\t\t};\n\n\t\tthis.setReadOnly = function( val ) {\n\t\t\tif ( val ) {\n\t\t\t\t$this.attr( 'disabled', 'true' );\n\t\t\t\t$this.addClass( 't-text-input-readonly-bg' );\n\t\t\t} else {\n\t\t\t\t$this.removeAttr( 'disabled' );\n\t\t\t\t$this.removeClass( 't-text-input-readonly-bg' );\n\t\t\t}\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\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( $( this ) );\n\t\t\t\tcheck_box.change( function() {\n\t\t\t\t\tif ( need_parser_