Ver Fonte

Revert "HUE-7680 [frontend] Get rid of the mCustomScrollbar plugin"

This reverts commit a5cf75ad53738e148dc96be016bd23cc5dbb144a.
Romain Rigaux há 7 anos atrás
pai
commit
6567d59206

Diff do ficheiro suprimidas por serem muito extensas
+ 0 - 0
desktop/core/src/desktop/static/desktop/ext/css/jquery.mCustomScrollbar.min.css


Diff do ficheiro suprimidas por serem muito extensas
+ 1 - 0
desktop/core/src/desktop/static/desktop/ext/js/jquery.mCustomScrollbar.concat.min.js


+ 1 - 0
desktop/core/src/desktop/templates/common_home.mako

@@ -28,6 +28,7 @@
   <script src="${ static('desktop/ext/js/knockout-sortable.min.js') }"></script>
   <script src="${ static('desktop/js/ko.editable.js') }"></script>
   <script src="${ static('desktop/ext/js/jquery/plugins/jquery.mousewheel.min.js') }"></script>
+  <script src="${ static('desktop/ext/js/jquery.mCustomScrollbar.concat.min.js') }"></script>
   <script src="${ static('desktop/js/home2.vm.js') }"></script>
 
   ${ docBrowser.docBrowser(is_embeddable) }

+ 24 - 3
desktop/libs/notebook/src/notebook/templates/editor_components.mako

@@ -38,6 +38,7 @@ from notebook.conf import ENABLE_QUERY_BUILDER, ENABLE_QUERY_SCHEDULING, ENABLE_
 <link rel="stylesheet" href="${ static('desktop/ext/select2/select2.css') }">
 <link rel="stylesheet" href="${ static('desktop/ext/css/medium-editor.min.css') }">
 <link rel="stylesheet" href="${ static('desktop/css/bootstrap-medium-editor.css') }">
+<link rel="stylesheet" href="${ static('desktop/ext/css/jquery.mCustomScrollbar.min.css') }">
 
 % if not is_embeddable:
 <script src="${ static('desktop/ext/js/jquery/plugins/jquery-ui-1.10.4.custom.min.js') }"></script>
@@ -71,6 +72,7 @@ from notebook.conf import ENABLE_QUERY_BUILDER, ENABLE_QUERY_SCHEDULING, ENABLE_
 <script src="${ static('desktop/ext/js/markdown.min.js') }"></script>
 <script src="${ static('desktop/ext/js/jquery/plugins/jquery.hotkeys.js') }"></script>
 <script src="${ static('desktop/ext/js/jquery/plugins/jquery.mousewheel.min.js') }"></script>
+<script src="${ static('desktop/ext/js/jquery.mCustomScrollbar.concat.min.js') }"></script>
 
 
 %if ENABLE_QUERY_BUILDER.get():
@@ -3583,7 +3585,10 @@ function togglePresentation(value) {};
       $(document).on("toggleResultSettings", function (e, snippet) {
         window.setTimeout(function () {
           $('#snippet_' + snippet.id()).find('.chart').trigger("forceUpdate");
-          $('#snippet_' + snippet.id()).find('.snippet-grid-settings').scrollLeft(0);
+          $('#snippet_' + snippet.id()).find('.snippet-grid-settings').mCustomScrollbar('update');
+          $('#snippet_' + snippet.id()).find('.snippet-grid-settings').mCustomScrollbar('scrollTo', 'left', {
+            scrollInertia: 0
+          });
           if (snippet.isResultSettingsVisible()){
             $("#snippet_" + snippet.id()).find('.table-results .grid-side').width((100 - $("#snippet_" + snippet.id()).find('.table-results .column-side').data('newWidth') - hueUtils.bootstrapRatios.margin()) + '%');
           }
@@ -3683,7 +3688,12 @@ function togglePresentation(value) {};
           huePubSub.publish('editor.snippet.result.normal', options.snippet);
         }
         $("#snippet_" + options.snippet.id()).find("select").trigger('chosen:updated');
-        $('#snippet_' + options.snippet.id()).find('.snippet-grid-settings').scrollLeft(0);
+        $('#snippet_' + options.snippet.id()).find('.snippet-grid-settings').mCustomScrollbar({axis: 'xy', theme: 'minimal-dark', scrollbarPosition: 'outside', mouseWheel:{ preventDefault: true, deltaFactor: 10 }, scrollInertia: 0});
+        window.setTimeout(function(){
+          $('#snippet_' + options.snippet.id()).find('.snippet-grid-settings').mCustomScrollbar('scrollTo', 'left', {
+            scrollInertia: 0
+          });
+        }, 200)
       }, HUE_PUB_SUB_EDITOR_ID);
 
       huePubSub.subscribe('editor.redraw.data', function (options) {
@@ -3791,7 +3801,18 @@ function togglePresentation(value) {};
         }, function () {
           resizeToggleResultSettings(snippet, true);
           forceChartDraws();
-          $('#snippet_' + snippet.id()).find('.snippet-grid-settings').scrollLeft(0);
+          $('#snippet_' + snippet.id()).find('.snippet-grid-settings').mCustomScrollbar({
+            axis: 'xy',
+            theme: 'minimal-dark',
+            scrollbarPosition: 'outside',
+            mouseWheel: {preventDefault: true, deltaFactor: 10},
+            scrollInertia: 0
+          });
+          window.setTimeout(function () {
+            $('#snippet_' + snippet.id()).find('.snippet-grid-settings').mCustomScrollbar('scrollTo', 'left', {
+              scrollInertia: 0
+            });
+          }, 200)
         });
       }, HUE_PUB_SUB_EDITOR_ID);
 

Alguns ficheiros não foram mostrados porque muitos ficheiros mudaram neste diff