aprog 2.2.5 → 2.2.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/helper.js +10 -1
package/package.json
CHANGED
package/src/helper.js
CHANGED
|
@@ -14,7 +14,7 @@ export const abort = (message = "") => {
|
|
|
14
14
|
throw new AbortError(`=> ${message}`);
|
|
15
15
|
};
|
|
16
16
|
|
|
17
|
-
export const useTableDrag = (selectorOrElement, onReorder = null) => {
|
|
17
|
+
export const useTableDrag = (selectorOrElement, onReorder = null, time = 1000) => {
|
|
18
18
|
const css = `
|
|
19
19
|
tr.dragging td {
|
|
20
20
|
opacity: 0.6;
|
|
@@ -25,6 +25,10 @@ export const useTableDrag = (selectorOrElement, onReorder = null) => {
|
|
|
25
25
|
color: #043458 !important;
|
|
26
26
|
background-color: rgba(4,52,88,.2) !important;
|
|
27
27
|
}
|
|
28
|
+
tr.good td {
|
|
29
|
+
color: #28a745 !important;
|
|
30
|
+
background-color: rgba(40,167,69,.2) !important;
|
|
31
|
+
}
|
|
28
32
|
`;
|
|
29
33
|
|
|
30
34
|
const style = document.createElement("style");
|
|
@@ -85,6 +89,11 @@ export const useTableDrag = (selectorOrElement, onReorder = null) => {
|
|
|
85
89
|
const newOrder = getOrder();
|
|
86
90
|
if (typeof onReorder === "function") {
|
|
87
91
|
onReorder(newOrder);
|
|
92
|
+
if (draggedRow) setTimeout(() => {
|
|
93
|
+
draggedRow.classList.remove("sorted");
|
|
94
|
+
draggedRow.classList.add("good");
|
|
95
|
+
setTimeout(() => draggedRow.classList.remove("good"), time / 3);
|
|
96
|
+
}, time);
|
|
88
97
|
}
|
|
89
98
|
});
|
|
90
99
|
|