@get-set/gs-sortable 0.0.13 → 0.0.15
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.
|
@@ -5,19 +5,21 @@ import init from '../actions/init';
|
|
|
5
5
|
import destroy from '../actions/destroy';
|
|
6
6
|
import PropTypes from 'prop-types';
|
|
7
7
|
import defaultParams from '../constants/defaultParams';
|
|
8
|
-
import initMouseMove from
|
|
9
|
-
import initSortEnd from
|
|
10
|
-
import initScroll from
|
|
8
|
+
import initMouseMove from '../actions/initMouseMove';
|
|
9
|
+
import initSortEnd from '../actions/initSortEnd';
|
|
10
|
+
import initScroll from '../actions/initScroll';
|
|
11
11
|
import types from '../constants/types';
|
|
12
12
|
import './styles/GSSortable.css';
|
|
13
13
|
|
|
14
14
|
const params = {
|
|
15
15
|
reference: PropTypes.string,
|
|
16
16
|
handler: PropTypes.string,
|
|
17
|
+
className: PropTypes.string,
|
|
18
|
+
gsx: PropTypes.object,
|
|
17
19
|
gap: PropTypes.string,
|
|
18
20
|
allowOutOfBox: PropTypes.bool,
|
|
19
21
|
count: PropTypes.number,
|
|
20
|
-
type: PropTypes.oneOf([types.column, types.row, types.grid])
|
|
22
|
+
type: PropTypes.oneOf([types.column, types.row, types.grid]),
|
|
21
23
|
};
|
|
22
24
|
|
|
23
25
|
/**
|
|
@@ -26,6 +28,8 @@ const params = {
|
|
|
26
28
|
* @component
|
|
27
29
|
* @param {Object} props - The props object.
|
|
28
30
|
* @param {string} props.reference - Unique key for each sortable.
|
|
31
|
+
* @param {boolean} props.className - Enable add classes.
|
|
32
|
+
* @param {React.CSSProperties & Record<string, React.CSSProperties | Record<string, React.CSSProperties | Record<string, React.CSSProperties | Record<string, React.CSSProperties>>>} props.gsx
|
|
29
33
|
* @param {string} props.gap - Allows set gap among elements.
|
|
30
34
|
* @param {string} props.handler - selector of target element to move.
|
|
31
35
|
* @param {number} props.count - Shows items count per row.
|
|
@@ -58,14 +62,14 @@ const GSSortable = ({ children, ...rest }) => {
|
|
|
58
62
|
}
|
|
59
63
|
},
|
|
60
64
|
};
|
|
61
|
-
|
|
62
|
-
window.addEventListener(
|
|
65
|
+
|
|
66
|
+
window.addEventListener('mousemove', e => {
|
|
63
67
|
initMouseMove(e);
|
|
64
68
|
});
|
|
65
|
-
window.addEventListener(
|
|
69
|
+
window.addEventListener('mouseup', e => {
|
|
66
70
|
initSortEnd(e);
|
|
67
71
|
});
|
|
68
|
-
window.addEventListener(
|
|
72
|
+
window.addEventListener('scroll', () => {
|
|
69
73
|
initScroll();
|
|
70
74
|
});
|
|
71
75
|
}
|
|
@@ -81,7 +85,7 @@ const GSSortable = ({ children, ...rest }) => {
|
|
|
81
85
|
ref: {
|
|
82
86
|
isAddjusting: false,
|
|
83
87
|
grid: gridRef.current,
|
|
84
|
-
currentParams
|
|
88
|
+
currentParams: { ...currentParams, reference: componentKey },
|
|
85
89
|
destroy: () => {
|
|
86
90
|
destroy(window.GSSortableConfigue.instance(componentKey));
|
|
87
91
|
},
|
|
@@ -114,9 +118,18 @@ const GSSortable = ({ children, ...rest }) => {
|
|
|
114
118
|
);
|
|
115
119
|
}, []);
|
|
116
120
|
|
|
121
|
+
useEffect(() => {
|
|
122
|
+
if (componentKey != null) {
|
|
123
|
+
const ref = window.GSSortableConfigue.instance(componentKey);
|
|
124
|
+
if (ref !== undefined) {
|
|
125
|
+
ref.refresh();
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
}, [children]);
|
|
129
|
+
|
|
117
130
|
return (
|
|
118
131
|
<div
|
|
119
|
-
className={`gs-sortable-instance gs-sortable-${params.type}`}
|
|
132
|
+
className={`gs-sortable-instance gs-sortable-${params.type} ${rest.className}`}
|
|
120
133
|
ref={gridRef}
|
|
121
134
|
{...Object.fromEntries(
|
|
122
135
|
Object.entries({ ...rest }).filter(([key]) => !(key in defaultParams)),
|
|
@@ -1,39 +1,39 @@
|
|
|
1
|
-
.gs-sortable-instance {
|
|
2
|
-
box-sizing: border-box;
|
|
3
|
-
-webkit-user-select: none !important;
|
|
4
|
-
-moz-user-select: none !important;
|
|
5
|
-
user-select: none !important;
|
|
6
|
-
transition: 0.4s;
|
|
7
|
-
z-index: 1;
|
|
8
|
-
}
|
|
9
|
-
.gs-sortable-instance.gs-sortable-active {
|
|
10
|
-
z-index: 2;
|
|
11
|
-
}
|
|
12
|
-
.gs-sortable-instance * {
|
|
13
|
-
-webkit-user-select: none !important;
|
|
14
|
-
-moz-user-select: none !important;
|
|
15
|
-
user-select: none !important;
|
|
16
|
-
}
|
|
17
|
-
.gs-sortable-instance .gs-sortable-placeholder {
|
|
18
|
-
position: absolute;
|
|
19
|
-
background-color: #f1f1f1;
|
|
20
|
-
border: 1px solid;
|
|
21
|
-
z-index: 1;
|
|
22
|
-
}
|
|
23
|
-
.gs-sortable-instance .gs-sortable-item {
|
|
24
|
-
z-index: 2;
|
|
25
|
-
}
|
|
26
|
-
.gs-sortable-instance .gs-sortable-item.gs-sortable-item-active-parent {
|
|
27
|
-
z-index: 3;
|
|
28
|
-
}
|
|
29
|
-
.gs-sortable-instance .gs-sortable-item-inmove {
|
|
30
|
-
transition: none !important;
|
|
31
|
-
z-index: 99999;
|
|
32
|
-
}
|
|
33
|
-
.gs-sortable-instance .gs-sortable-item-addjusting {
|
|
34
|
-
z-index: 99999;
|
|
35
|
-
}
|
|
36
|
-
.gs-sortable-instance.gs-sortable-row .gs-sortable-item {
|
|
37
|
-
width: -moz-max-content;
|
|
38
|
-
width: max-content;
|
|
1
|
+
.gs-sortable-instance {
|
|
2
|
+
box-sizing: border-box;
|
|
3
|
+
-webkit-user-select: none !important;
|
|
4
|
+
-moz-user-select: none !important;
|
|
5
|
+
user-select: none !important;
|
|
6
|
+
transition: 0.4s;
|
|
7
|
+
z-index: 1;
|
|
8
|
+
}
|
|
9
|
+
.gs-sortable-instance.gs-sortable-active {
|
|
10
|
+
z-index: 2;
|
|
11
|
+
}
|
|
12
|
+
.gs-sortable-instance * {
|
|
13
|
+
-webkit-user-select: none !important;
|
|
14
|
+
-moz-user-select: none !important;
|
|
15
|
+
user-select: none !important;
|
|
16
|
+
}
|
|
17
|
+
.gs-sortable-instance .gs-sortable-placeholder {
|
|
18
|
+
position: absolute;
|
|
19
|
+
background-color: #f1f1f1;
|
|
20
|
+
border: 1px solid;
|
|
21
|
+
z-index: 1;
|
|
22
|
+
}
|
|
23
|
+
.gs-sortable-instance .gs-sortable-item {
|
|
24
|
+
z-index: 2;
|
|
25
|
+
}
|
|
26
|
+
.gs-sortable-instance .gs-sortable-item.gs-sortable-item-active-parent {
|
|
27
|
+
z-index: 3;
|
|
28
|
+
}
|
|
29
|
+
.gs-sortable-instance .gs-sortable-item-inmove {
|
|
30
|
+
transition: none !important;
|
|
31
|
+
z-index: 99999;
|
|
32
|
+
}
|
|
33
|
+
.gs-sortable-instance .gs-sortable-item-addjusting {
|
|
34
|
+
z-index: 99999;
|
|
35
|
+
}
|
|
36
|
+
.gs-sortable-instance.gs-sortable-row .gs-sortable-item {
|
|
37
|
+
width: -moz-max-content;
|
|
38
|
+
width: max-content;
|
|
39
39
|
}/*# sourceMappingURL=GSSortable.css.map */
|