TimeTrex/interface/html5/dist/inside_editor-InsideEditor.bundle.js

1 line
14 KiB
JavaScript
Raw Permalink Normal View History

2022-12-13 07:10:06 +01:00
(self.webpackChunktimetrex=self.webpackChunktimetrex||[]).push([["inside_editor-InsideEditor"],{1745:(__unused_webpack_module,__unused_webpack_exports,__webpack_require__)=>{eval("/* provided dependency */ var _ = __webpack_require__(9050);\n/* provided dependency */ var jQuery = __webpack_require__(9755);\n( function( $ ) {\n\n\t$.fn.InsideEditor = function( options ) {\n\n\t\tGlobal.addCss( 'global/widgets/inside_editor/InsideEditor.css' );\n\t\tvar opts = $.extend( {}, $.fn.InsideEditor.defaults, options );\n\n\t\tvar $this = this;\n\t\tvar field;\n\t\tvar row_render;\n\t\tvar render;\n\n\t\tthis.rows_widgets_array = null;\n\t\tthis.delete_ids = null;\n\t\tthis.addRow = null;\n\t\tthis.setValue = null;\n\t\tthis.getValue = null; // set outside\n\t\tthis.removeRow = null;\n\t\tthis.updateAllRows = null;\n\t\tthis.render_inline_html = false;\n\t\tthis.editor_data = null;\n\t\tthis.onFormItemChange = null;\n\n\t\tthis.parent_controller = null;\n//\t\tthis.parent_id = null;\n\n\t\tthis.api = null;\n\n\t\tthis.setValue = function( val ) {\n\t\t\tif ( val && val.length > 0 ) {\n\t\t\t\tthis.setValue( val );\n\t\t\t} else {\n\t\t\t\tthis.addRow();\n\t\t\t}\n\t\t};\n\n\t\tthis.getRender = function() {\n\t\t\treturn render;\n\t\t};\n\n\t\tthis.getRowRender = function() {\n\t\t\treturn row_render.clone();\n\t\t};\n\n\t\tthis.clearErrorStyle = function() {\n\n\t\t};\n\n\t\tthis.getField = function() {\n\t\t\treturn field;\n\t\t};\n\n\t\tthis.setTitle = function( val ) {\n\t\t\tvar title = $this.children().eq( 0 );\n\n\t\t\ttitle.text( val );\n\n\t\t};\n\n\t\tthis.removeLastRowLine = function() {\n\t\t\tvar table = this.find( '.inside-editor-render' );\n\t\t\tvar trs = table.find( 'tr' );\n\t\t\ttable.find( 'td' ).removeClass( 'no-line' );\n\n\t\t\tvar last_tr = trs.eq( trs.length - 1 );\n\n\t\t\tlast_tr.find( 'td' ).addClass( 'no-line' );\n\t\t};\n\n\t\tthis.removeAllRows = function( include_header ) {\n\t\t\tvar table = this.find( '.inside-editor-render' );\n\t\t\tvar trs = table.find( 'tr' );\n\t\t\tif ( include_header ) {\n\n\t\t\t\ttable.find( 'tr' ).each( function() {\n\t\t\t\t\t$( this ).remove();\n\t\t\t\t} );\n\n\t\t\t} else {\n\t\t\t\ttable.find( 'tr.inside-editor-row' ).remove();\n\t\t\t}\n\n\t\t\tthis.rows_widgets_array = [];\n\t\t};\n\n\t\tthis.setWidgetEnableBaseOnParentController = function( form_item_input ) {\n\t\t\tif ( this.parent_controller.is_viewing ) {\n\t\t\t\tform_item_input.setEnabled( false );\n\t\t\t} else {\n\t\t\t\tform_item_input.setEnabled( true );\n\t\t\t}\n\t\t};\n\n\t\tthis.addIconsEvent = function( row ) {\n\t\t\tvar plus_icon = row.find( '.plus-icon' );\n\t\t\tvar minus_icon = row.find( '.minus-icon' );\n\n\t\t\tplus_icon.click( function() {\n\t\t\t\t$this.addRow( null, $( this ).parents( 'tr' ).index(), row );\n\t\t\t} );\n\n\t\t\tminus_icon.click( function() {\n\t\t\t\t$this.removeRow( row );\n\n\t\t\t\tif ( render.find( 'tr' ).length === 1 ) {\n\t\t\t\t\t$this.addRow();\n\t\t\t\t}\n\n\t\t\t} );\n\n\t\t};\n\n\t\tthis.getDefaultData = function( index ) {\n\n\t\t\tif ( Global.isSet( this.api ) ) {\n\t\t\t\tthis.api['get' + this.api.key_name + 'DefaultData']( {\n\t\t\t\t\tonResult: function( result ) {\n\t\t\t\t\t\tvar result_data = result.getResult();\n\t\t\t\t\t\tresult_data.id = false;\n\n\t\t\t\t\t\tif ( !result_data ) {\n\t\t\t\t\t\t\tresult_data = [];\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t$this.addRow( result_data, index );\n\n\t\t\t\t\t}\n\t\t\t\t} );\n\t\t\t}\n\t\t};\n\n\t\tthis.each( function() {\n\t\t\tvar o = $.meta ? $.extend( {}, opts, $( this ).data() ) : opts;\n\t\t\tif ( o.title ) {\n\t\t\t\t$this.setTitle( o.title );\n\t\t\t}\n\t\t\tif ( o.onFormItemChange ) {\n\t\t\t\t$this.onFormItemChange = o.onFormItemChange;\n\t\t\t}\n\t\t\t$this.rows_widgets_array = [];\n\t\t\t$this.delete_ids = [];\n\t\t\t$this.addRow = o.addRow;\n\t\t\t$this.removeRow = o.removeRow;\n\t\t\t$this.getValue = o.getValue;\n\t\t\t$this.setValue = o.setValue;\n\t\t\t$this.parent_controller = o.parent_controller;\n\t\t\t$this.api = o.api;\n\t\t\t$this.updateAllRows = o.updateAllRows;\n\t\t\t$this.render_inline_html =