瀏覽代碼

Card drag/drop scrolls now the list at top/bottom

Martin Filser 3 年之前
父節點
當前提交
292e43466e
共有 6 個文件被更改,包括 49 次插入3 次删除
  1. 0 1
      .meteor/packages
  2. 1 2
      .meteor/versions
  3. 16 0
      client/components/lists/list.js
  4. 17 0
      client/lib/jquery-ui.js
  5. 13 0
      package-lock.json
  6. 2 0
      package.json

+ 0 - 1
.meteor/packages

@@ -60,7 +60,6 @@ reactive-var@1.0.11
 fortawesome:fontawesome
 mousetrap:mousetrap
 mquandalle:jquery-textcomplete
-mquandalle:jquery-ui-drag-drop-sort
 mquandalle:mousetrap-bindglobal
 peerlibrary:blaze-components@=0.15.1
 templates:tabs

+ 1 - 2
.meteor/versions

@@ -76,6 +76,7 @@ matb33:collection-hooks@0.9.1
 matteodem:easy-search@1.6.4
 mdg:validation-error@0.5.1
 meteor@1.9.3
+meteor-autosize@5.0.1
 meteor-base@1.4.0
 meteor-platform@1.2.6
 meteorhacks:aggregate@1.3.0
@@ -106,7 +107,6 @@ mquandalle:collection-mutations@0.1.0
 mquandalle:jade@0.4.9
 mquandalle:jade-compiler@0.4.5
 mquandalle:jquery-textcomplete@0.8.0_1
-mquandalle:jquery-ui-drag-drop-sort@0.2.0
 mquandalle:moment@1.0.1
 mquandalle:mousetrap-bindglobal@0.0.1
 msavin:usercache@1.8.0
@@ -219,7 +219,6 @@ url@1.3.2
 useraccounts:core@1.14.2
 useraccounts:flow-routing@1.14.2
 useraccounts:unstyled@1.14.2
-meteor-autosize@5.0.1
 webapp@1.10.1
 webapp-hashing@1.1.0
 wekan-accounts-cas@0.1.0

+ 16 - 0
client/components/lists/list.js

@@ -1,3 +1,5 @@
+require('/client/lib/jquery-ui.js')
+
 const { calculateIndex } = Utils;
 
 BlazeComponent.extendComponent({
@@ -114,6 +116,20 @@ BlazeComponent.extendComponent({
         }
         boardComponent.setIsDragging(false);
       },
+      sort(event, ui) {
+        const $boardCanvas = $('.board-canvas');
+        const  boardCanvas = $boardCanvas[0];
+
+        if (event.pageX < 10)
+        { // scroll to the left
+          boardCanvas.scrollLeft -= 15;
+          ui.helper[0].offsetLeft -= 15;
+        }
+        if (event.pageX > boardCanvas.offsetWidth - 10)
+        { // scroll to the right
+          boardCanvas.scrollLeft += 15;
+        }
+      },
     });
 
     this.autorun(() => {

+ 17 - 0
client/lib/jquery-ui.js

@@ -0,0 +1,17 @@
+// https://bugs.jqueryui.com/ticket/15020
+// required for sortable
+require('jquery-ui/ui/widget')
+require('jquery-ui/ui/scroll-parent')
+require('jquery-ui/ui/data')
+require('jquery-ui/ui/widgets/mouse')
+require('jquery-ui/ui/ie')
+require('jquery-ui/ui/widgets/sortable')
+
+// required for draggable
+require('jquery-ui/ui/plugin')
+require('jquery-ui/ui/safe-active-element')
+require('jquery-ui/ui/safe-blur')
+require('jquery-ui/ui/widgets/draggable')
+
+// everything already required for droppable
+require('jquery-ui/ui/widgets/droppable')

+ 13 - 0
package-lock.json

@@ -1802,6 +1802,19 @@
         "semver": "^6.3.0"
       }
     },
+    "jquery": {
+      "version": "2.2.4",
+      "resolved": "https://registry.npmjs.org/jquery/-/jquery-2.2.4.tgz",
+      "integrity": "sha1-LInWiJterFIqfuoywUUhVZxsvwI="
+    },
+    "jquery-ui": {
+      "version": "1.13.0",
+      "resolved": "https://registry.npmjs.org/jquery-ui/-/jquery-ui-1.13.0.tgz",
+      "integrity": "sha512-Osf7ECXNTYHtKBkn9xzbIf9kifNrBhfywFEKxOeB/OVctVmLlouV9mfc2qXCp6uyO4Pn72PXKOnj09qXetopCw==",
+      "requires": {
+        "jquery": ">=1.8.0 <4.0.0"
+      }
+    },
     "js-tokens": {
       "version": "4.0.0",
       "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz",

+ 2 - 0
package.json

@@ -34,6 +34,8 @@
     "exceljs": "^4.2.1",
     "fibers": "^5.0.0",
     "gridfs-stream": "https://github.com/wekan/gridfs-stream/tarball/master",
+    "jquery": "^2.2.4",
+    "jquery-ui": "^1.13.0",
     "jszip": "^3.7.1",
     "ldapjs": "^2.3.1",
     "markdown-it": "^12.2.0",