@reportportal/ui-kit 0.0.1-alpha.174 → 0.0.1-alpha.176
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/dist/common/hooks/useTreeSortable.d.ts +1 -1
- package/dist/common/hooks.js +1 -1
- package/dist/common/types/sortableTypes.d.ts +3 -2
- package/dist/components/sortable/treeSortableItem/treeSortableItem.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/segmentedControl.js +28 -28
- package/dist/sortable.js +166 -163
- package/dist/style.css +2 -2
- package/dist/tooltip.js +65 -62
- package/dist/useTreeSortable-694cfbbc.js +184 -0
- package/package.json +1 -1
- package/dist/useTreeSortable-70a9c8f5.js +0 -179
package/dist/tooltip.js
CHANGED
|
@@ -1,102 +1,105 @@
|
|
|
1
|
-
import { jsxs as p, Fragment as P, jsx as
|
|
2
|
-
import { useState as R, useRef as
|
|
1
|
+
import { jsxs as p, Fragment as P, jsx as n } from "react/jsx-runtime";
|
|
2
|
+
import { useState as R, useRef as f } from "react";
|
|
3
3
|
import { createPortal as G } from "react-dom";
|
|
4
4
|
import { c as j } from "./bind-06a7ff84.js";
|
|
5
|
-
import { useFloating as k, offset as $, flip as
|
|
6
|
-
import { T as
|
|
5
|
+
import { useFloating as k, offset as $, flip as B, arrow as C, autoUpdate as U, FloatingArrow as Y } from "@floating-ui/react";
|
|
6
|
+
import { T as u, g as Z, b as q, a as z } from "./floatingUi-41f8c7b5.js";
|
|
7
7
|
const J = {
|
|
8
|
-
"tooltip-wrapper": "_tooltip-
|
|
9
|
-
"tooltip-content": "_tooltip-
|
|
10
|
-
},
|
|
11
|
-
content:
|
|
12
|
-
wrapperClassName:
|
|
13
|
-
tooltipClassName:
|
|
14
|
-
contentClassName:
|
|
15
|
-
dynamicWidth:
|
|
16
|
-
width:
|
|
17
|
-
minWidth:
|
|
18
|
-
safeZone:
|
|
19
|
-
zIndex:
|
|
20
|
-
placement:
|
|
21
|
-
arrowColor:
|
|
22
|
-
dataAutomationId:
|
|
23
|
-
mainAxis:
|
|
24
|
-
children:
|
|
25
|
-
portalRoot:
|
|
26
|
-
isFloating:
|
|
8
|
+
"tooltip-wrapper": "_tooltip-wrapper_1n6ya_16",
|
|
9
|
+
"tooltip-content": "_tooltip-content_1n6ya_26"
|
|
10
|
+
}, s = j.bind(J), K = 300, Q = 100, st = ({
|
|
11
|
+
content: h,
|
|
12
|
+
wrapperClassName: x,
|
|
13
|
+
tooltipClassName: g,
|
|
14
|
+
contentClassName: w,
|
|
15
|
+
dynamicWidth: T,
|
|
16
|
+
width: _,
|
|
17
|
+
minWidth: A = 120,
|
|
18
|
+
safeZone: E = 4,
|
|
19
|
+
zIndex: b = 9,
|
|
20
|
+
placement: y = "bottom",
|
|
21
|
+
arrowColor: I = "rgba(34, 34, 34, 0.91)",
|
|
22
|
+
dataAutomationId: N,
|
|
23
|
+
mainAxis: F = !0,
|
|
24
|
+
children: O,
|
|
25
|
+
portalRoot: i,
|
|
26
|
+
isFloating: S = !0
|
|
27
27
|
}) => {
|
|
28
|
-
const [
|
|
29
|
-
open:
|
|
30
|
-
placement:
|
|
28
|
+
const [a, l] = R(!1), r = f(null), t = f(), { refs: c, floatingStyles: W, context: v } = k({
|
|
29
|
+
open: a,
|
|
30
|
+
placement: y,
|
|
31
31
|
middleware: [
|
|
32
32
|
$(({ rects: D, placement: H }) => ({
|
|
33
|
-
mainAxis:
|
|
34
|
-
alignmentAxis:
|
|
33
|
+
mainAxis: E + u,
|
|
34
|
+
alignmentAxis: Z(D, H)
|
|
35
35
|
})),
|
|
36
|
-
|
|
37
|
-
mainAxis:
|
|
36
|
+
S && B({
|
|
37
|
+
mainAxis: F,
|
|
38
38
|
fallbackAxisSideDirection: "start",
|
|
39
|
-
fallbackPlacements:
|
|
39
|
+
fallbackPlacements: q
|
|
40
40
|
}),
|
|
41
|
-
|
|
42
|
-
element:
|
|
41
|
+
C({
|
|
42
|
+
element: r
|
|
43
43
|
})
|
|
44
44
|
],
|
|
45
|
-
whileElementsMounted:
|
|
46
|
-
}), e =
|
|
45
|
+
whileElementsMounted: U
|
|
46
|
+
}), e = T ? null : { width: `${_}px` }, L = document.documentElement.clientWidth, M = e || L - Q, o = () => {
|
|
47
47
|
t.current && clearTimeout(t.current), l(!1);
|
|
48
|
-
},
|
|
48
|
+
}, m = () => {
|
|
49
49
|
t.current = setTimeout(() => l(!0), K);
|
|
50
|
-
},
|
|
50
|
+
}, d = () => /* @__PURE__ */ p(
|
|
51
51
|
"div",
|
|
52
52
|
{
|
|
53
|
-
ref:
|
|
53
|
+
ref: c.setFloating,
|
|
54
54
|
style: {
|
|
55
|
-
...
|
|
55
|
+
...W,
|
|
56
56
|
...e,
|
|
57
|
-
minWidth:
|
|
58
|
-
zIndex:
|
|
57
|
+
minWidth: A,
|
|
58
|
+
zIndex: b,
|
|
59
59
|
pointerEvents: "none"
|
|
60
60
|
},
|
|
61
|
-
"data-automation-id":
|
|
62
|
-
className:
|
|
61
|
+
"data-automation-id": N,
|
|
62
|
+
className: s(g),
|
|
63
63
|
children: [
|
|
64
|
-
/* @__PURE__ */
|
|
65
|
-
|
|
64
|
+
/* @__PURE__ */ n(
|
|
65
|
+
Y,
|
|
66
66
|
{
|
|
67
|
-
ref:
|
|
68
|
-
context:
|
|
69
|
-
width:
|
|
70
|
-
height:
|
|
71
|
-
fill:
|
|
67
|
+
ref: r,
|
|
68
|
+
context: v,
|
|
69
|
+
width: z,
|
|
70
|
+
height: u,
|
|
71
|
+
fill: I
|
|
72
72
|
}
|
|
73
73
|
),
|
|
74
|
-
/* @__PURE__ */
|
|
74
|
+
/* @__PURE__ */ n(
|
|
75
75
|
"div",
|
|
76
76
|
{
|
|
77
|
-
className:
|
|
77
|
+
className: s("tooltip-content", w),
|
|
78
78
|
style: {
|
|
79
|
-
maxWidth: `${
|
|
79
|
+
maxWidth: `${M}px`
|
|
80
80
|
},
|
|
81
|
-
children:
|
|
81
|
+
children: h
|
|
82
82
|
}
|
|
83
83
|
)
|
|
84
84
|
]
|
|
85
85
|
}
|
|
86
86
|
);
|
|
87
87
|
return /* @__PURE__ */ p(P, { children: [
|
|
88
|
-
/* @__PURE__ */
|
|
88
|
+
/* @__PURE__ */ n(
|
|
89
89
|
"div",
|
|
90
90
|
{
|
|
91
|
-
ref:
|
|
92
|
-
className:
|
|
93
|
-
onMouseDown:
|
|
94
|
-
onMouseEnter:
|
|
95
|
-
onMouseLeave:
|
|
96
|
-
|
|
91
|
+
ref: c.setReference,
|
|
92
|
+
className: s("tooltip-wrapper", x),
|
|
93
|
+
onMouseDown: o,
|
|
94
|
+
onMouseEnter: m,
|
|
95
|
+
onMouseLeave: o,
|
|
96
|
+
onFocus: m,
|
|
97
|
+
onBlur: o,
|
|
98
|
+
tabIndex: 0,
|
|
99
|
+
children: O
|
|
97
100
|
}
|
|
98
101
|
),
|
|
99
|
-
|
|
102
|
+
a && (i ? G(d(), i) : d())
|
|
100
103
|
] });
|
|
101
104
|
};
|
|
102
105
|
export {
|
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
import { useRef as _, useState as N, useEffect as w, useCallback as b } from "react";
|
|
2
|
+
import { useDrag as Z, useDrop as A } from "react-dnd";
|
|
3
|
+
import { getEmptyImage as F } from "react-dnd-html5-backend";
|
|
4
|
+
import { DROP_POSITIONS as D, DROP_DETECTION_MODE as d, TREE_DROP_POSITIONS as h } from "./common.js";
|
|
5
|
+
const k = "SORTABLE_ITEM", y = (r) => {
|
|
6
|
+
if (!r)
|
|
7
|
+
return {
|
|
8
|
+
display: "none"
|
|
9
|
+
};
|
|
10
|
+
const { x: n, y: o } = r, i = `translate(${n}px, ${o}px)`;
|
|
11
|
+
return {
|
|
12
|
+
transform: i,
|
|
13
|
+
WebkitTransform: i
|
|
14
|
+
};
|
|
15
|
+
}, L = ({
|
|
16
|
+
fromIndex: r,
|
|
17
|
+
targetIndex: n,
|
|
18
|
+
isTopZone: o
|
|
19
|
+
}) => o ? r < n ? n - 1 : n : r > n ? n + 1 : n, $ = (r, n) => r / n < 0.5 ? D.TOP : D.BOTTOM, z = ({
|
|
20
|
+
id: r,
|
|
21
|
+
index: n,
|
|
22
|
+
type: o = k,
|
|
23
|
+
isDisabled: i = !1,
|
|
24
|
+
isLast: R = !1,
|
|
25
|
+
onDrop: g,
|
|
26
|
+
hideDefaultPreview: T = !1,
|
|
27
|
+
dropDetectionMode: u = d.INDEX_BASED
|
|
28
|
+
}) => {
|
|
29
|
+
const p = u === d.HOVER, v = _(null), O = _(null), [E, c] = N(null), [{ isDragging: B }, I, m] = Z(
|
|
30
|
+
() => ({
|
|
31
|
+
type: o,
|
|
32
|
+
item: { id: r, index: n, type: o },
|
|
33
|
+
collect: (t) => ({
|
|
34
|
+
isDragging: t.isDragging()
|
|
35
|
+
}),
|
|
36
|
+
canDrag: () => !i
|
|
37
|
+
}),
|
|
38
|
+
[r, n, o, i]
|
|
39
|
+
);
|
|
40
|
+
w(() => {
|
|
41
|
+
T && m(F(), { captureDraggingState: !0 });
|
|
42
|
+
}, [T, m]);
|
|
43
|
+
const [{ isOver: P, draggedItemIndex: S }, C] = A(
|
|
44
|
+
() => ({
|
|
45
|
+
accept: o,
|
|
46
|
+
collect: (t) => {
|
|
47
|
+
const e = t.getItem(), l = (e == null ? void 0 : e.id) !== r ? t.isOver() : !1;
|
|
48
|
+
return {
|
|
49
|
+
isOver: l,
|
|
50
|
+
draggedItemIndex: l ? (e == null ? void 0 : e.index) ?? null : null
|
|
51
|
+
};
|
|
52
|
+
},
|
|
53
|
+
hover: (t, e) => {
|
|
54
|
+
if (!p)
|
|
55
|
+
return;
|
|
56
|
+
if (t.id === r) {
|
|
57
|
+
c(null);
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
60
|
+
const a = v.current;
|
|
61
|
+
if (!a) {
|
|
62
|
+
c(null);
|
|
63
|
+
return;
|
|
64
|
+
}
|
|
65
|
+
const l = a.getBoundingClientRect(), x = l.bottom - l.top, V = e.getClientOffset();
|
|
66
|
+
if (!V) {
|
|
67
|
+
c(null);
|
|
68
|
+
return;
|
|
69
|
+
}
|
|
70
|
+
const H = V.y - l.top, Y = $(H, x);
|
|
71
|
+
Y === null ? (c(null), O.current = null) : Y === D.TOP ? (c(D.TOP), O.current = D.TOP) : (c(D.BOTTOM), O.current = D.BOTTOM);
|
|
72
|
+
},
|
|
73
|
+
drop: (t) => {
|
|
74
|
+
if (!(t.id === r || !g))
|
|
75
|
+
if (p) {
|
|
76
|
+
const e = O.current;
|
|
77
|
+
if (!e)
|
|
78
|
+
return;
|
|
79
|
+
const a = e === D.TOP, l = L({
|
|
80
|
+
fromIndex: t.index,
|
|
81
|
+
targetIndex: n,
|
|
82
|
+
isTopZone: a
|
|
83
|
+
});
|
|
84
|
+
g(t.index, l);
|
|
85
|
+
} else
|
|
86
|
+
g(t.index, n);
|
|
87
|
+
}
|
|
88
|
+
}),
|
|
89
|
+
[r, n, o, g, R, p]
|
|
90
|
+
), M = b(
|
|
91
|
+
(t) => (v.current = t, C(t)),
|
|
92
|
+
[C]
|
|
93
|
+
);
|
|
94
|
+
w(() => {
|
|
95
|
+
P || c(null);
|
|
96
|
+
}, [P]);
|
|
97
|
+
const f = p ? E : (() => S === null ? null : S > n ? D.TOP : D.BOTTOM)();
|
|
98
|
+
return {
|
|
99
|
+
isDragging: B,
|
|
100
|
+
isOver: P,
|
|
101
|
+
draggedItemIndex: S,
|
|
102
|
+
dropPosition: f,
|
|
103
|
+
dragRef: I,
|
|
104
|
+
dropRef: M,
|
|
105
|
+
previewRef: m
|
|
106
|
+
};
|
|
107
|
+
}, G = (r, n, o = !1) => {
|
|
108
|
+
if (!r || !n)
|
|
109
|
+
return null;
|
|
110
|
+
const { top: i, height: R } = n, T = r.y - i, u = 6;
|
|
111
|
+
return T >= 0 && T < u ? h.BEFORE : o && T >= R - u && T <= R ? h.AFTER : h.INSIDE;
|
|
112
|
+
}, J = ({
|
|
113
|
+
id: r,
|
|
114
|
+
index: n,
|
|
115
|
+
parentId: o = null,
|
|
116
|
+
type: i = k,
|
|
117
|
+
isDisabled: R = !1,
|
|
118
|
+
acceptDrop: g = !0,
|
|
119
|
+
isLast: T = !1,
|
|
120
|
+
canDropOn: u,
|
|
121
|
+
onDrop: p,
|
|
122
|
+
hideDefaultPreview: v = !1
|
|
123
|
+
}) => {
|
|
124
|
+
const O = _(null), E = _(null), [c, B] = N(null), [{ isDragging: I }, m, P] = Z(
|
|
125
|
+
() => ({
|
|
126
|
+
type: i,
|
|
127
|
+
item: { id: r, index: n, type: i, parentId: o },
|
|
128
|
+
collect: (s) => ({
|
|
129
|
+
isDragging: s.isDragging()
|
|
130
|
+
}),
|
|
131
|
+
canDrag: () => !R
|
|
132
|
+
}),
|
|
133
|
+
[r, n, i, o, R]
|
|
134
|
+
);
|
|
135
|
+
w(() => {
|
|
136
|
+
v && P(F(), { captureDraggingState: !0 });
|
|
137
|
+
}, [v, P]);
|
|
138
|
+
const [{ isOver: S }, C] = A(
|
|
139
|
+
() => ({
|
|
140
|
+
accept: i,
|
|
141
|
+
hover: (s, f) => {
|
|
142
|
+
if (O.current && s.id !== r && g)
|
|
143
|
+
if (!u || u(s, r)) {
|
|
144
|
+
const e = f.getClientOffset(), a = O.current.getBoundingClientRect();
|
|
145
|
+
if (e && a) {
|
|
146
|
+
const l = G(e, a, T);
|
|
147
|
+
l !== c && (B(l), E.current = l);
|
|
148
|
+
}
|
|
149
|
+
} else
|
|
150
|
+
c !== null && (B(null), E.current = null);
|
|
151
|
+
},
|
|
152
|
+
collect: (s) => {
|
|
153
|
+
const f = s.getItem(), t = (f == null ? void 0 : f.id) !== r && g, e = !u || !f || u(f, r), a = s.isOver({ shallow: !0 }), l = t && e;
|
|
154
|
+
return !a && c !== null && (B(null), E.current = null), {
|
|
155
|
+
isOver: a && l
|
|
156
|
+
};
|
|
157
|
+
},
|
|
158
|
+
drop: (s, f) => {
|
|
159
|
+
if (f.didDrop())
|
|
160
|
+
return;
|
|
161
|
+
const t = !u || u(s, r);
|
|
162
|
+
s.id !== r && g && t && p && E.current && p(s, r, E.current);
|
|
163
|
+
}
|
|
164
|
+
}),
|
|
165
|
+
[r, i, g, T, u, p, c]
|
|
166
|
+
);
|
|
167
|
+
return {
|
|
168
|
+
isDragging: I,
|
|
169
|
+
isOver: S,
|
|
170
|
+
dropPosition: c,
|
|
171
|
+
dragRef: m,
|
|
172
|
+
dropRef: (s) => {
|
|
173
|
+
O.current = s, C(s);
|
|
174
|
+
},
|
|
175
|
+
previewRef: P,
|
|
176
|
+
elementRef: O
|
|
177
|
+
};
|
|
178
|
+
};
|
|
179
|
+
export {
|
|
180
|
+
k as D,
|
|
181
|
+
J as a,
|
|
182
|
+
y as g,
|
|
183
|
+
z as u
|
|
184
|
+
};
|
package/package.json
CHANGED
|
@@ -1,179 +0,0 @@
|
|
|
1
|
-
import { useRef as C, useState as V, useEffect as d, useCallback as b } from "react";
|
|
2
|
-
import { useDrag as F, useDrop as Y } from "react-dnd";
|
|
3
|
-
import { getEmptyImage as k } from "react-dnd-html5-backend";
|
|
4
|
-
import { DROP_POSITIONS as l, DROP_DETECTION_MODE as h, TREE_DROP_POSITIONS as Z } from "./common.js";
|
|
5
|
-
const x = "SORTABLE_ITEM", z = (r) => {
|
|
6
|
-
if (!r)
|
|
7
|
-
return {
|
|
8
|
-
display: "none"
|
|
9
|
-
};
|
|
10
|
-
const { x: n, y: t } = r, s = `translate(${n}px, ${t}px)`;
|
|
11
|
-
return {
|
|
12
|
-
transform: s,
|
|
13
|
-
WebkitTransform: s
|
|
14
|
-
};
|
|
15
|
-
}, $ = ({
|
|
16
|
-
fromIndex: r,
|
|
17
|
-
targetIndex: n,
|
|
18
|
-
isTopZone: t
|
|
19
|
-
}) => t ? r < n ? n - 1 : n : r > n ? n + 1 : n, G = (r, n) => r / n < 0.5 ? l.TOP : l.BOTTOM, J = ({
|
|
20
|
-
id: r,
|
|
21
|
-
index: n,
|
|
22
|
-
type: t = x,
|
|
23
|
-
isDisabled: s = !1,
|
|
24
|
-
isLast: a = !1,
|
|
25
|
-
onDrop: g,
|
|
26
|
-
hideDefaultPreview: O = !1,
|
|
27
|
-
dropDetectionMode: E = h.INDEX_BASED
|
|
28
|
-
}) => {
|
|
29
|
-
const T = E === h.HOVER, p = C(null), i = C(null), [_, u] = V(null), [{ isDragging: P }, I, m] = F(
|
|
30
|
-
() => ({
|
|
31
|
-
type: t,
|
|
32
|
-
item: { id: r, index: n, type: t },
|
|
33
|
-
collect: (e) => ({
|
|
34
|
-
isDragging: e.isDragging()
|
|
35
|
-
}),
|
|
36
|
-
canDrag: () => !s
|
|
37
|
-
}),
|
|
38
|
-
[r, n, t, s]
|
|
39
|
-
);
|
|
40
|
-
d(() => {
|
|
41
|
-
O && m(k(), { captureDraggingState: !0 });
|
|
42
|
-
}, [O, m]);
|
|
43
|
-
const [{ isOver: v, draggedItemIndex: B }, o] = Y(
|
|
44
|
-
() => ({
|
|
45
|
-
accept: t,
|
|
46
|
-
collect: (e) => {
|
|
47
|
-
const c = e.getItem(), D = (c == null ? void 0 : c.id) !== r ? e.isOver() : !1;
|
|
48
|
-
return {
|
|
49
|
-
isOver: D,
|
|
50
|
-
draggedItemIndex: D ? (c == null ? void 0 : c.index) ?? null : null
|
|
51
|
-
};
|
|
52
|
-
},
|
|
53
|
-
hover: (e, c) => {
|
|
54
|
-
if (!T)
|
|
55
|
-
return;
|
|
56
|
-
if (e.id === r) {
|
|
57
|
-
u(null);
|
|
58
|
-
return;
|
|
59
|
-
}
|
|
60
|
-
const R = p.current;
|
|
61
|
-
if (!R) {
|
|
62
|
-
u(null);
|
|
63
|
-
return;
|
|
64
|
-
}
|
|
65
|
-
const D = R.getBoundingClientRect(), H = D.bottom - D.top, w = c.getClientOffset();
|
|
66
|
-
if (!w) {
|
|
67
|
-
u(null);
|
|
68
|
-
return;
|
|
69
|
-
}
|
|
70
|
-
const L = w.y - D.top, N = G(L, H);
|
|
71
|
-
N === null ? (u(null), i.current = null) : N === l.TOP ? (u(l.TOP), i.current = l.TOP) : (u(l.BOTTOM), i.current = l.BOTTOM);
|
|
72
|
-
},
|
|
73
|
-
drop: (e) => {
|
|
74
|
-
if (!(e.id === r || !g))
|
|
75
|
-
if (T) {
|
|
76
|
-
const c = i.current;
|
|
77
|
-
if (!c)
|
|
78
|
-
return;
|
|
79
|
-
const R = c === l.TOP, D = $({
|
|
80
|
-
fromIndex: e.index,
|
|
81
|
-
targetIndex: n,
|
|
82
|
-
isTopZone: R
|
|
83
|
-
});
|
|
84
|
-
g(e.index, D);
|
|
85
|
-
} else
|
|
86
|
-
g(e.index, n);
|
|
87
|
-
}
|
|
88
|
-
}),
|
|
89
|
-
[r, n, t, g, a, T]
|
|
90
|
-
), f = b(
|
|
91
|
-
(e) => (p.current = e, o(e)),
|
|
92
|
-
[o]
|
|
93
|
-
);
|
|
94
|
-
d(() => {
|
|
95
|
-
v || u(null);
|
|
96
|
-
}, [v]);
|
|
97
|
-
const S = T ? _ : (() => B === null ? null : B > n ? l.TOP : l.BOTTOM)();
|
|
98
|
-
return {
|
|
99
|
-
isDragging: P,
|
|
100
|
-
isOver: v,
|
|
101
|
-
draggedItemIndex: B,
|
|
102
|
-
dropPosition: S,
|
|
103
|
-
dragRef: I,
|
|
104
|
-
dropRef: f,
|
|
105
|
-
previewRef: m
|
|
106
|
-
};
|
|
107
|
-
}, A = 2, U = (r, n) => {
|
|
108
|
-
if (!r || !n)
|
|
109
|
-
return null;
|
|
110
|
-
const { top: t, height: s } = n, a = r.y - t;
|
|
111
|
-
return a < A ? Z.BEFORE : a > s - A ? Z.AFTER : Z.INSIDE;
|
|
112
|
-
}, K = ({
|
|
113
|
-
id: r,
|
|
114
|
-
index: n,
|
|
115
|
-
parentId: t = null,
|
|
116
|
-
type: s = x,
|
|
117
|
-
isDisabled: a = !1,
|
|
118
|
-
acceptDrop: g = !0,
|
|
119
|
-
canDropOn: O,
|
|
120
|
-
onDrop: E,
|
|
121
|
-
hideDefaultPreview: T = !1
|
|
122
|
-
}) => {
|
|
123
|
-
const p = C(null), i = C(null), [{ isDragging: _ }, u, P] = F(
|
|
124
|
-
() => ({
|
|
125
|
-
type: s,
|
|
126
|
-
item: { id: r, index: n, type: s, parentId: t },
|
|
127
|
-
collect: (o) => ({
|
|
128
|
-
isDragging: o.isDragging()
|
|
129
|
-
}),
|
|
130
|
-
canDrag: () => !a
|
|
131
|
-
}),
|
|
132
|
-
[r, n, s, t, a]
|
|
133
|
-
);
|
|
134
|
-
d(() => {
|
|
135
|
-
T && P(k(), { captureDraggingState: !0 });
|
|
136
|
-
}, [T, P]);
|
|
137
|
-
const [{ isOver: I, dropPosition: m }, v] = Y(
|
|
138
|
-
() => ({
|
|
139
|
-
accept: s,
|
|
140
|
-
collect: (o) => {
|
|
141
|
-
const f = o.getItem(), S = (f == null ? void 0 : f.id) !== r && g && (!O || !f || O(f, r)) ? o.isOver({ shallow: !0 }) : !1;
|
|
142
|
-
let e = null;
|
|
143
|
-
if (S && p.current) {
|
|
144
|
-
const c = o.getClientOffset(), R = p.current.getBoundingClientRect();
|
|
145
|
-
e = U(c, R), i.current = e;
|
|
146
|
-
} else
|
|
147
|
-
i.current = null;
|
|
148
|
-
return {
|
|
149
|
-
isOver: S,
|
|
150
|
-
dropPosition: e
|
|
151
|
-
};
|
|
152
|
-
},
|
|
153
|
-
drop: (o, f) => {
|
|
154
|
-
if (f.didDrop())
|
|
155
|
-
return;
|
|
156
|
-
const M = !O || O(o, r);
|
|
157
|
-
o.id !== r && g && M && E && i.current && E(o, r, i.current);
|
|
158
|
-
}
|
|
159
|
-
}),
|
|
160
|
-
[r, s, g, O, E]
|
|
161
|
-
);
|
|
162
|
-
return {
|
|
163
|
-
isDragging: _,
|
|
164
|
-
isOver: I,
|
|
165
|
-
dropPosition: m,
|
|
166
|
-
dragRef: u,
|
|
167
|
-
dropRef: (o) => {
|
|
168
|
-
p.current = o, v(o);
|
|
169
|
-
},
|
|
170
|
-
previewRef: P,
|
|
171
|
-
elementRef: p
|
|
172
|
-
};
|
|
173
|
-
};
|
|
174
|
-
export {
|
|
175
|
-
x as D,
|
|
176
|
-
K as a,
|
|
177
|
-
z as g,
|
|
178
|
-
J as u
|
|
179
|
-
};
|