TimeTrex/interface/html5/dist/company-permission_control-PermissionControlViewController.bundle.js

1 line
44 KiB
JavaScript
Raw Normal View History

2022-12-13 07:10:06 +01:00
"use strict";(self.webpackChunktimetrex=self.webpackChunktimetrex||[]).push([["company-permission_control-PermissionControlViewController"],{5448:(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"PermissionControlViewController\": () => (/* binding */ PermissionControlViewController)\n/* harmony export */ });\n/* provided dependency */ var _ = __webpack_require__(9050);\n/* provided dependency */ var $ = __webpack_require__(9755);\nclass PermissionControlViewController extends BaseViewController {\n\tconstructor( options = {} ) {\n\t\t_.defaults( options, {\n\t\t\tel: '#permission_control_view_container',\n\n\n\n\t\t\tlevel_array: null,\n\t\t\tuser_api: null,\n\t\t\tpermission_array: null,\n\n\t\t\tquick_search_dic: {},\n\n\t\t\t//Save multi key typed when quick search\n\t\t\tquick_search_typed_keys: '',\n\n\t\t\t//use to juedge if need to clear quick_search_this.quick_search_typed_keyss\n\t\t\tquick_search_timer: null\n\t\t} );\n\n\t\tsuper( options );\n\t}\n\n\tinit( options ) {\n\t\t//this._super('initialize', options );\n\t\tthis.edit_view_tpl = 'PermissionControlEditView.html';\n\t\tthis.permission_id = 'permission';\n\t\tthis.viewId = 'PermissionControl';\n\t\tthis.script_name = 'PermissionControlView';\n\t\tthis.table_name_key = 'permission_control';\n\t\tthis.context_menu_name = $.i18n._( 'Permission Group' );\n\t\tthis.navigation_label = $.i18n._( 'Permission Group' );\n\t\tthis.api = TTAPI.APIPermissionControl;\n\t\tthis.user_api = TTAPI.APIUser;\n\n\t\tthis.render();\n\t\tthis.buildContextMenu();\n\n\t\tthis.initData();\n\t}\n\n\tonKeyDown( e ) {\n\t\tvar focus = $( ':focus' );\n\t\tvar $this = this;\n\n\t\tif ( this.edit_view_tab_selected_index === 0 && !LocalCacheData.openAwesomeBox &&\n\t\t\t( focus.length < 1 || focus[0].localName !== 'input' ) ) {\n\t\t\tvar a_dropdown = this.edit_view_ui_dic.permission;\n\n\t\t\tif ( e.keyCode === 39 ) { //right\n\n\t\t\t\te.preventDefault();\n\n\t\t\t\tif ( a_dropdown.getAllowMultipleSelection() ) {\n\n\t\t\t\t\ta_dropdown.onUnSelectGridDoubleClick();\n\t\t\t\t}\n\t\t\t} else if ( e.keyCode === 37 ) { //left\n\n\t\t\t\te.preventDefault();\n\n\t\t\t\tif ( a_dropdown.getAllowMultipleSelection() ) {\n\n\t\t\t\t\ta_dropdown.onSelectGridDoubleClick();\n\t\t\t\t}\n\t\t\t} else {\n\n\t\t\t\tif ( e.keyCode === 16 ||\n\t\t\t\t\te.keyCode === 17 ||\n\t\t\t\t\te.keyCode === 91 ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tif ( this.quick_search_timer ) {\n\t\t\t\t\tclearTimeout( this.quick_search_timer );\n\t\t\t\t}\n\n\t\t\t\tthis.quick_search_timer = setTimeout( function() {\n\t\t\t\t\t$this.quick_search_typed_keys = '';\n\t\t\t\t}, 200 );\n\n\t\t\t\te.preventDefault();\n\t\t\t\tvar target_grid;\n\t\t\t\tvar next_index;\n\t\t\t\tvar next_select_item;\n\t\t\t\tthis.quick_search_typed_keys = this.quick_search_typed_keys + Global.KEYCODES[e.which];\n\n\t\t\t\tif ( a_dropdown.getAllowMultipleSelection() || a_dropdown.getTreeMode() ) {\n\t\t\t\t\tif ( this.quick_search_typed_keys ) {\n\t\t\t\t\t\ttarget_grid = a_dropdown.getFocusInSeletGrid() ? a_dropdown.getSelectGrid() : a_dropdown.getUnSelectGrid();\n\t\t\t\t\t\tvar search_index = this.quick_search_dic[this.quick_search_typed_keys] ? this.quick_search_dic[this.quick_search_typed_keys] : 0;\n\t\t\t\t\t\tvar tds = $( target_grid.grid.find( 'tr' ).find( 'td:eq(1)' ).filter( function() {\n\t\t\t\t\t\t\treturn $.text( [this] ).toLowerCase().indexOf( $this.quick_search_typed_keys ) == 0;\n\t\t\t\t\t\t} ) );\n\n\t\t\t\t\t\tvar td;\n\t\t\t\t\t\tif ( search_index > 0 && search_index < tds.length ) {\n\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tsearch_index = 0;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\ttd = $( tds[search_index] );\n\n\t\t\t\t\t\ta_dropdown.unSelectAll( target_grid, true );\n\n\t\t\t\t\t\tnext_index = td.parent().index() - 1;\n\t\t\t\t\t\tnext_select_item = target_grid.grid.jqGrid( 'getGridParam', 'data' )[next_index];\n\t\t\t\t\t\ta_dropdown.setSelectItem( next_select_item, target_g