bullet_train-sortable 1.7.1 → 1.7.2
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 11c6147e94228b261835e381c28d238e73736f022489a790857ab51212970bfc
|
4
|
+
data.tar.gz: c4e5a5c700f368aebe1087d7c4acc15b4f5dd8084ae6dae6a817a932595e8a02
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: edca08683a8ec8982b8ecd7b826d39f672632a8455e90ad0eebee4fd2660c0e7eccca81d241ec5d209cf17871b7260a18b34e8fd882e7f0495e180dea432d955
|
7
|
+
data.tar.gz: 5487e12f52823841509a303b3485125f1f920267680ef1a7d2f5147d6875eab5fff0abde4c72efb1699870c8e4cb8e4e15003fb59ae178250074a8988b163d96
|
@@ -1,5 +1,6 @@
|
|
1
1
|
import { Controller } from "@hotwired/stimulus"
|
2
2
|
import { post } from '@rails/request.js'
|
3
|
+
import jquery from "jquery";
|
3
4
|
require("dragula/dist/dragula.min.css")
|
4
5
|
|
5
6
|
import dragula from 'dragula';
|
@@ -13,6 +14,12 @@ export default class extends Controller {
|
|
13
14
|
// will be reissued as native dom events name prepended with 'sortable:' e.g. 'sortable:drag', 'sortable:drop', etc
|
14
15
|
static pluginEventsToReissue = [ "drag", "dragend", "drop", "cancel", "remove", "shadow", "over", "out", "cloned" ]
|
15
16
|
|
17
|
+
initialize() {
|
18
|
+
if (window.jQuery === undefined) {
|
19
|
+
window.jQuery = jquery // required for select2 used for time zone select, but we also use global jQuery throughout below
|
20
|
+
}
|
21
|
+
}
|
22
|
+
|
16
23
|
connect() {
|
17
24
|
if (!this.hasReorderPathValue) { return }
|
18
25
|
this.initPluginInstance()
|
@@ -26,11 +33,11 @@ export default class extends Controller {
|
|
26
33
|
const self = this
|
27
34
|
this.plugin = dragula([this.element], {
|
28
35
|
moves: function(el, container, handle) {
|
29
|
-
var $handles =
|
36
|
+
var $handles = jQuery(el).find('.reorder-handle')
|
30
37
|
if ($handles.length) {
|
31
|
-
return
|
38
|
+
return !!jQuery(handle).closest('.reorder-handle').length
|
32
39
|
} else {
|
33
|
-
if (
|
40
|
+
if (!jQuery(handle).closest('.undraggable').length) {
|
34
41
|
return self.element === container
|
35
42
|
} else {
|
36
43
|
return false
|
@@ -38,7 +45,7 @@ export default class extends Controller {
|
|
38
45
|
}
|
39
46
|
},
|
40
47
|
accepts: function (el, target, source, sibling) {
|
41
|
-
if (
|
48
|
+
if (jQuery(sibling).hasClass('undraggable') && jQuery(sibling).prev().hasClass('undraggable')) {
|
42
49
|
return false
|
43
50
|
} else {
|
44
51
|
return true
|
@@ -51,7 +58,7 @@ export default class extends Controller {
|
|
51
58
|
}
|
52
59
|
}).on('over', function (el, container) {
|
53
60
|
// deselect any text fields, or else things go slow!
|
54
|
-
|
61
|
+
jQuery(document.activeElement).blur()
|
55
62
|
})
|
56
63
|
|
57
64
|
this.initReissuePluginEventsAsNativeEvents()
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bullet_train-sortable
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.7.
|
4
|
+
version: 1.7.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andrew Culver
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-04-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: standard
|