@react-aria/dnd 3.0.0-alpha.1 → 3.0.0-alpha.5
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/main.js +1615 -1984
- package/dist/main.js.map +1 -1
- package/dist/module.js +1578 -1909
- package/dist/module.js.map +1 -1
- package/dist/types.d.ts.map +1 -1
- package/package.json +12 -12
- package/src/DragManager.ts +3 -11
- package/src/constants.ts +3 -1
- package/src/useDrop.ts +7 -2
- package/src/useDroppableCollection.ts +2 -2
- package/src/utils.ts +1 -20
package/dist/main.js
CHANGED
|
@@ -1,2196 +1,1827 @@
|
|
|
1
|
-
var
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
var
|
|
6
|
-
|
|
7
|
-
var
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
chain
|
|
15
|
-
} = require("@react-aria/utils");
|
|
16
|
-
|
|
17
|
-
var {
|
|
18
|
-
getInteractionModality,
|
|
19
|
-
useInteractionModality,
|
|
20
|
-
setInteractionModality,
|
|
21
|
-
useFocus
|
|
22
|
-
} = require("@react-aria/interactions");
|
|
23
|
-
|
|
24
|
-
var _babelRuntimeHelpersWrapAsyncGenerator = $parcel$interopDefault(require("@babel/runtime/helpers/wrapAsyncGenerator"));
|
|
25
|
-
|
|
26
|
-
var _babelRuntimeHelpersAwaitAsyncGenerator = $parcel$interopDefault(require("@babel/runtime/helpers/awaitAsyncGenerator"));
|
|
27
|
-
|
|
28
|
-
var {
|
|
29
|
-
ariaHideOutside
|
|
30
|
-
} = require("@react-aria/overlays");
|
|
31
|
-
|
|
32
|
-
var {
|
|
33
|
-
announce
|
|
34
|
-
} = require("@react-aria/live-announcer");
|
|
35
|
-
|
|
36
|
-
var {
|
|
37
|
-
useRef,
|
|
38
|
-
useState,
|
|
39
|
-
useEffect,
|
|
40
|
-
useLayoutEffect,
|
|
41
|
-
useCallback
|
|
42
|
-
} = require("react");
|
|
43
|
-
|
|
44
|
-
var _babelRuntimeHelpersInteropRequireDefault = $parcel$interopDefault(require("@babel/runtime/helpers/interopRequireDefault"));
|
|
1
|
+
var $67uu7$react = require("react");
|
|
2
|
+
var $67uu7$reactdom = require("react-dom");
|
|
3
|
+
var $67uu7$reactariautils = require("@react-aria/utils");
|
|
4
|
+
var $67uu7$reactariai18n = require("@react-aria/i18n");
|
|
5
|
+
var $67uu7$reactarialiveannouncer = require("@react-aria/live-announcer");
|
|
6
|
+
var $67uu7$reactariaoverlays = require("@react-aria/overlays");
|
|
7
|
+
var $67uu7$reactariainteractions = require("@react-aria/interactions");
|
|
8
|
+
|
|
9
|
+
function $parcel$exportWildcard(dest, source) {
|
|
10
|
+
Object.keys(source).forEach(function(key) {
|
|
11
|
+
if (key === 'default' || key === '__esModule' || dest.hasOwnProperty(key)) {
|
|
12
|
+
return;
|
|
13
|
+
}
|
|
45
14
|
|
|
46
|
-
|
|
15
|
+
Object.defineProperty(dest, key, {
|
|
16
|
+
enumerable: true,
|
|
17
|
+
get: function get() {
|
|
18
|
+
return source[key];
|
|
19
|
+
}
|
|
20
|
+
});
|
|
21
|
+
});
|
|
47
22
|
|
|
23
|
+
return dest;
|
|
24
|
+
}
|
|
48
25
|
function $parcel$interopDefault(a) {
|
|
49
26
|
return a && a.__esModule ? a.default : a;
|
|
50
27
|
}
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
(
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
const $b29ea0269b2ea2bf4827b4fa19ddc83e$export$DROP_OPERATION_ALLOWED = _babelRuntimeHelpersExtends({}, $b29ea0269b2ea2bf4827b4fa19ddc83e$export$DROP_OPERATION, {
|
|
78
|
-
copyMove: $b29ea0269b2ea2bf4827b4fa19ddc83e$export$DROP_OPERATION.copy | $b29ea0269b2ea2bf4827b4fa19ddc83e$export$DROP_OPERATION.move,
|
|
79
|
-
copyLink: $b29ea0269b2ea2bf4827b4fa19ddc83e$export$DROP_OPERATION.copy | $b29ea0269b2ea2bf4827b4fa19ddc83e$export$DROP_OPERATION.link,
|
|
80
|
-
linkMove: $b29ea0269b2ea2bf4827b4fa19ddc83e$export$DROP_OPERATION.link | $b29ea0269b2ea2bf4827b4fa19ddc83e$export$DROP_OPERATION.move,
|
|
81
|
-
all: $b29ea0269b2ea2bf4827b4fa19ddc83e$export$DROP_OPERATION.all,
|
|
82
|
-
uninitialized: $b29ea0269b2ea2bf4827b4fa19ddc83e$export$DROP_OPERATION.all
|
|
83
|
-
});
|
|
84
|
-
|
|
85
|
-
const $b29ea0269b2ea2bf4827b4fa19ddc83e$export$EFFECT_ALLOWED = $b29ea0269b2ea2bf4827b4fa19ddc83e$var$invert($b29ea0269b2ea2bf4827b4fa19ddc83e$export$DROP_OPERATION_ALLOWED);
|
|
86
|
-
const $b29ea0269b2ea2bf4827b4fa19ddc83e$export$DROP_EFFECT = $b29ea0269b2ea2bf4827b4fa19ddc83e$var$invert($b29ea0269b2ea2bf4827b4fa19ddc83e$export$DROP_OPERATION);
|
|
87
|
-
const $b29ea0269b2ea2bf4827b4fa19ddc83e$export$DROP_EFFECT_TO_DROP_OPERATION = {
|
|
88
|
-
none: 'cancel',
|
|
89
|
-
link: 'link',
|
|
90
|
-
copy: 'copy',
|
|
91
|
-
move: 'move'
|
|
28
|
+
function $parcel$export(e, n, v, s) {
|
|
29
|
+
Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
|
|
30
|
+
}
|
|
31
|
+
var $e2630e07d35639b3$exports = {};
|
|
32
|
+
|
|
33
|
+
$parcel$export($e2630e07d35639b3$exports, "useDrag", () => $e2630e07d35639b3$export$7941f8aafa4b6021);
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
let $d7547fb11526b355$export$60b7b4bcf3903d8e;
|
|
38
|
+
(function($d7547fb11526b355$export$60b7b4bcf3903d8e) {
|
|
39
|
+
$d7547fb11526b355$export$60b7b4bcf3903d8e[$d7547fb11526b355$export$60b7b4bcf3903d8e["none"] = 0] = "none";
|
|
40
|
+
$d7547fb11526b355$export$60b7b4bcf3903d8e[$d7547fb11526b355$export$60b7b4bcf3903d8e["cancel"] = 0] = "cancel";
|
|
41
|
+
$d7547fb11526b355$export$60b7b4bcf3903d8e[$d7547fb11526b355$export$60b7b4bcf3903d8e["move"] = 1] = "move";
|
|
42
|
+
$d7547fb11526b355$export$60b7b4bcf3903d8e[$d7547fb11526b355$export$60b7b4bcf3903d8e["copy"] = 2] = "copy";
|
|
43
|
+
$d7547fb11526b355$export$60b7b4bcf3903d8e[$d7547fb11526b355$export$60b7b4bcf3903d8e["link"] = 4] = "link";
|
|
44
|
+
$d7547fb11526b355$export$60b7b4bcf3903d8e[$d7547fb11526b355$export$60b7b4bcf3903d8e["all"] = 7] = "all";
|
|
45
|
+
})($d7547fb11526b355$export$60b7b4bcf3903d8e || ($d7547fb11526b355$export$60b7b4bcf3903d8e = {
|
|
46
|
+
}));
|
|
47
|
+
const $d7547fb11526b355$export$9bbdfc78cf083e16 = {
|
|
48
|
+
...$d7547fb11526b355$export$60b7b4bcf3903d8e,
|
|
49
|
+
copyMove: $d7547fb11526b355$export$60b7b4bcf3903d8e.copy | $d7547fb11526b355$export$60b7b4bcf3903d8e.move,
|
|
50
|
+
copyLink: $d7547fb11526b355$export$60b7b4bcf3903d8e.copy | $d7547fb11526b355$export$60b7b4bcf3903d8e.link,
|
|
51
|
+
linkMove: $d7547fb11526b355$export$60b7b4bcf3903d8e.link | $d7547fb11526b355$export$60b7b4bcf3903d8e.move,
|
|
52
|
+
all: $d7547fb11526b355$export$60b7b4bcf3903d8e.all,
|
|
53
|
+
uninitialized: $d7547fb11526b355$export$60b7b4bcf3903d8e.all
|
|
92
54
|
};
|
|
93
|
-
const $
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
55
|
+
const $d7547fb11526b355$export$dd0165308d8bff45 = $d7547fb11526b355$var$invert($d7547fb11526b355$export$9bbdfc78cf083e16);
|
|
56
|
+
const $d7547fb11526b355$export$d7ebf00f36b7a95e = $d7547fb11526b355$var$invert($d7547fb11526b355$export$60b7b4bcf3903d8e);
|
|
57
|
+
const $d7547fb11526b355$export$608ecc6f1b23c35d = {
|
|
58
|
+
none: 'cancel',
|
|
59
|
+
link: 'link',
|
|
60
|
+
copy: 'copy',
|
|
61
|
+
move: 'move'
|
|
62
|
+
};
|
|
63
|
+
const $d7547fb11526b355$export$5eacb0769d26d3b2 = $d7547fb11526b355$var$invert($d7547fb11526b355$export$608ecc6f1b23c35d);
|
|
64
|
+
function $d7547fb11526b355$var$invert(object) {
|
|
65
|
+
let res = {
|
|
66
|
+
};
|
|
67
|
+
for(let key in object)res[object[key]] = key;
|
|
68
|
+
return res;
|
|
103
69
|
}
|
|
70
|
+
const $d7547fb11526b355$export$4a7729b856e9a690 = new Set([
|
|
71
|
+
'text/plain',
|
|
72
|
+
'text/uri-list',
|
|
73
|
+
'text/html'
|
|
74
|
+
]);
|
|
75
|
+
const $d7547fb11526b355$export$fd9f9fc120c5402d = 'application/vnd.react-aria.items+json';
|
|
76
|
+
const $d7547fb11526b355$export$f8fc6581787339b3 = 'application/octet-stream';
|
|
104
77
|
|
|
105
|
-
const $b29ea0269b2ea2bf4827b4fa19ddc83e$export$NATIVE_DRAG_TYPES = new Set(['text/plain', 'text/uri-list', 'text/html']);
|
|
106
|
-
const $b29ea0269b2ea2bf4827b4fa19ddc83e$export$CUSTOM_DRAG_TYPE = 'application/vnd.react-aria.items+json';
|
|
107
|
-
const $b29ea0269b2ea2bf4827b4fa19ddc83e$export$GENERIC_TYPE = 'application/octet-stream';
|
|
108
|
-
const $bc29619458500c186021634c18dc$var$droppableCollectionIds = new WeakMap();
|
|
109
|
-
|
|
110
|
-
function $bc29619458500c186021634c18dc$export$useDroppableCollectionId(state) {
|
|
111
|
-
let id = useId();
|
|
112
|
-
$bc29619458500c186021634c18dc$var$droppableCollectionIds.set(state, id);
|
|
113
|
-
return id;
|
|
114
|
-
}
|
|
115
78
|
|
|
116
|
-
function $bc29619458500c186021634c18dc$export$getDroppableCollectionId(state) {
|
|
117
|
-
let id = $bc29619458500c186021634c18dc$var$droppableCollectionIds.get(state);
|
|
118
79
|
|
|
119
|
-
if (!id) {
|
|
120
|
-
throw new Error('Droppable item outside a droppable collection');
|
|
121
|
-
}
|
|
122
80
|
|
|
123
|
-
|
|
81
|
+
const $29c8537521cf08fe$var$droppableCollectionIds = new WeakMap();
|
|
82
|
+
function $29c8537521cf08fe$export$b1601eb39394a581(state) {
|
|
83
|
+
let id = $67uu7$reactariautils.useId();
|
|
84
|
+
$29c8537521cf08fe$var$droppableCollectionIds.set(state, id);
|
|
85
|
+
return id;
|
|
124
86
|
}
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
for (let item of items) {
|
|
130
|
-
for (let type of Object.keys(item)) {
|
|
131
|
-
types.add(type);
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
return types;
|
|
87
|
+
function $29c8537521cf08fe$export$3093291712f09a77(state) {
|
|
88
|
+
let id = $29c8537521cf08fe$var$droppableCollectionIds.get(state);
|
|
89
|
+
if (!id) throw new Error('Droppable item outside a droppable collection');
|
|
90
|
+
return id;
|
|
136
91
|
}
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
if (modality === 'pointer') {
|
|
144
|
-
modality = 'virtual';
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
if (modality === 'virtual' && 'ontouchstart' in window) {
|
|
148
|
-
modality = 'touch';
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
return modality;
|
|
92
|
+
function $29c8537521cf08fe$export$e1d41611756c6326(items) {
|
|
93
|
+
let types = new Set();
|
|
94
|
+
for (let item of items)for (let type of Object.keys(item))types.add(type);
|
|
95
|
+
return types;
|
|
152
96
|
}
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
97
|
+
function $29c8537521cf08fe$var$mapModality(modality) {
|
|
98
|
+
if (!modality) modality = 'virtual';
|
|
99
|
+
if (modality === 'pointer') modality = 'virtual';
|
|
100
|
+
if (modality === 'virtual' && 'ontouchstart' in window) modality = 'touch';
|
|
101
|
+
return modality;
|
|
156
102
|
}
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
return $bc29619458500c186021634c18dc$var$mapModality(getInteractionModality());
|
|
103
|
+
function $29c8537521cf08fe$export$49bac5d6d4b352ea() {
|
|
104
|
+
return $29c8537521cf08fe$var$mapModality($67uu7$reactariainteractions.useInteractionModality());
|
|
160
105
|
}
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
// The data transfer API doesn't support more than one item of a given type at once.
|
|
164
|
-
// In addition, only a small set of types are supported natively for transfer between applications.
|
|
165
|
-
// We allow for both multiple items, as well as multiple representations of a single item.
|
|
166
|
-
// In order to make our API work with the native API, we serialize all items to JSON and
|
|
167
|
-
// store as a single native item. We only need to do this if there is more than one item
|
|
168
|
-
// of the same type, or if an item has more than one representation. Otherwise the native
|
|
169
|
-
// API is sufficient.
|
|
170
|
-
//
|
|
171
|
-
// The DataTransferItemList API also theoretically supports adding files, which would enable
|
|
172
|
-
// dragging binary data out of the browser onto the user's desktop for example. Unfortunately,
|
|
173
|
-
// this does not currently work in any browser, so it is not currently supported by our API.
|
|
174
|
-
// See e.g. https://bugs.chromium.org/p/chromium/issues/detail?id=438479.
|
|
175
|
-
let groupedByType = new Map();
|
|
176
|
-
let needsCustomData = false;
|
|
177
|
-
let customData = [];
|
|
178
|
-
|
|
179
|
-
for (let item of items) {
|
|
180
|
-
let types = Object.keys(item);
|
|
181
|
-
|
|
182
|
-
if (types.length > 1) {
|
|
183
|
-
needsCustomData = true;
|
|
184
|
-
}
|
|
185
|
-
|
|
186
|
-
let dataByType = {};
|
|
187
|
-
|
|
188
|
-
for (let type of types) {
|
|
189
|
-
let typeItems = groupedByType.get(type);
|
|
190
|
-
|
|
191
|
-
if (!typeItems) {
|
|
192
|
-
typeItems = [];
|
|
193
|
-
groupedByType.set(type, typeItems);
|
|
194
|
-
} else {
|
|
195
|
-
needsCustomData = true;
|
|
196
|
-
}
|
|
197
|
-
|
|
198
|
-
let data = item[type];
|
|
199
|
-
dataByType[type] = data;
|
|
200
|
-
typeItems.push(data);
|
|
201
|
-
}
|
|
202
|
-
|
|
203
|
-
customData.push(dataByType);
|
|
204
|
-
}
|
|
205
|
-
|
|
206
|
-
for (let [type, items] of groupedByType) {
|
|
207
|
-
if ($b29ea0269b2ea2bf4827b4fa19ddc83e$export$NATIVE_DRAG_TYPES.has(type)) {
|
|
208
|
-
// Only one item of a given type can be set on a data transfer.
|
|
209
|
-
// Join all of the items together separated by newlines.
|
|
210
|
-
let data = items.join('\n');
|
|
211
|
-
dataTransfer.items.add(data, type);
|
|
212
|
-
} else {
|
|
213
|
-
// Set data to the first item so we have access to the list of types.
|
|
214
|
-
dataTransfer.items.add(items[0], type);
|
|
215
|
-
}
|
|
216
|
-
}
|
|
217
|
-
|
|
218
|
-
if (needsCustomData) {
|
|
219
|
-
let data = JSON.stringify(customData);
|
|
220
|
-
dataTransfer.items.add(data, $b29ea0269b2ea2bf4827b4fa19ddc83e$export$CUSTOM_DRAG_TYPE);
|
|
221
|
-
}
|
|
106
|
+
function $29c8537521cf08fe$export$1fb2158d224b542c() {
|
|
107
|
+
return $29c8537521cf08fe$var$mapModality($67uu7$reactariainteractions.getInteractionModality());
|
|
222
108
|
}
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
109
|
+
function $29c8537521cf08fe$export$f9c1490890ddd063(dataTransfer, items) {
|
|
110
|
+
// The data transfer API doesn't support more than one item of a given type at once.
|
|
111
|
+
// In addition, only a small set of types are supported natively for transfer between applications.
|
|
112
|
+
// We allow for both multiple items, as well as multiple representations of a single item.
|
|
113
|
+
// In order to make our API work with the native API, we serialize all items to JSON and
|
|
114
|
+
// store as a single native item. We only need to do this if there is more than one item
|
|
115
|
+
// of the same type, or if an item has more than one representation. Otherwise the native
|
|
116
|
+
// API is sufficient.
|
|
117
|
+
//
|
|
118
|
+
// The DataTransferItemList API also theoretically supports adding files, which would enable
|
|
119
|
+
// dragging binary data out of the browser onto the user's desktop for example. Unfortunately,
|
|
120
|
+
// this does not currently work in any browser, so it is not currently supported by our API.
|
|
121
|
+
// See e.g. https://bugs.chromium.org/p/chromium/issues/detail?id=438479.
|
|
122
|
+
let groupedByType = new Map();
|
|
123
|
+
let needsCustomData = false;
|
|
124
|
+
let customData = [];
|
|
125
|
+
for (let item of items){
|
|
126
|
+
let types = Object.keys(item);
|
|
127
|
+
if (types.length > 1) needsCustomData = true;
|
|
128
|
+
let dataByType = {
|
|
129
|
+
};
|
|
130
|
+
for (let type of types){
|
|
131
|
+
let typeItems = groupedByType.get(type);
|
|
132
|
+
if (!typeItems) {
|
|
133
|
+
typeItems = [];
|
|
134
|
+
groupedByType.set(type, typeItems);
|
|
135
|
+
} else needsCustomData = true;
|
|
136
|
+
let data = item[type];
|
|
137
|
+
dataByType[type] = data;
|
|
138
|
+
typeItems.push(data);
|
|
235
139
|
}
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
140
|
+
customData.push(dataByType);
|
|
141
|
+
}
|
|
142
|
+
for (let [type, items1] of groupedByType)if ($d7547fb11526b355$export$4a7729b856e9a690.has(type)) {
|
|
143
|
+
// Only one item of a given type can be set on a data transfer.
|
|
144
|
+
// Join all of the items together separated by newlines.
|
|
145
|
+
let data = items1.join('\n');
|
|
146
|
+
dataTransfer.items.add(data, type);
|
|
147
|
+
} else // Set data to the first item so we have access to the list of types.
|
|
148
|
+
dataTransfer.items.add(items1[0], type);
|
|
149
|
+
if (needsCustomData) {
|
|
150
|
+
let data = JSON.stringify(customData);
|
|
151
|
+
dataTransfer.items.add(data, $d7547fb11526b355$export$fd9f9fc120c5402d);
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
class $29c8537521cf08fe$export$7f04ce188c91447c {
|
|
155
|
+
has(type) {
|
|
156
|
+
if (this.includesUnknownTypes) return true;
|
|
157
|
+
return this.types.has(type);
|
|
158
|
+
}
|
|
159
|
+
constructor(dataTransfer){
|
|
160
|
+
this.types = new Set();
|
|
161
|
+
let hasFiles = false;
|
|
162
|
+
for (let item of dataTransfer.items)if (item.type !== $d7547fb11526b355$export$fd9f9fc120c5402d) {
|
|
163
|
+
if (item.kind === 'file') hasFiles = true;
|
|
164
|
+
if (item.type) this.types.add(item.type);
|
|
165
|
+
else // Files with unknown types or extensions that don't map to a known mime type
|
|
166
|
+
// are sometimes exposed as an empty string by the browser. Map to a generic
|
|
167
|
+
// mime type instead. Note that this could also be a directory as there's no
|
|
168
|
+
// way to determine if something is a file or directory until drop.
|
|
169
|
+
this.types.add($d7547fb11526b355$export$f8fc6581787339b3);
|
|
245
170
|
}
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
this.includesUnknownTypes = !hasFiles && dataTransfer.types.includes('Files');
|
|
253
|
-
}
|
|
254
|
-
|
|
255
|
-
has(type) {
|
|
256
|
-
if (this.includesUnknownTypes) {
|
|
257
|
-
return true;
|
|
171
|
+
// In Safari, when dragging files, the dataTransfer.items list is empty, but dataTransfer.types contains "Files".
|
|
172
|
+
// Unfortunately, this doesn't tell us what types of files the user is dragging, so we need to assume that any
|
|
173
|
+
// type the user checks for is included. See https://bugs.webkit.org/show_bug.cgi?id=223517.
|
|
174
|
+
this.includesUnknownTypes = !hasFiles && dataTransfer.types.includes('Files');
|
|
258
175
|
}
|
|
259
|
-
|
|
260
|
-
return this.types.has(type);
|
|
261
|
-
}
|
|
262
|
-
|
|
263
176
|
}
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
for (let item of parsed) {
|
|
278
|
-
items.push({
|
|
279
|
-
kind: 'text',
|
|
280
|
-
types: new Set(Object.keys(item)),
|
|
281
|
-
getText: type => Promise.resolve(item[type])
|
|
177
|
+
function $29c8537521cf08fe$export$d9e760437831f8b3(dataTransfer) {
|
|
178
|
+
let items = [];
|
|
179
|
+
// If our custom drag type is available, use that. This is a JSON serialized
|
|
180
|
+
// representation of all items in the drag, set when there are multiple items
|
|
181
|
+
// of the same type, or an individual item has multiple representations.
|
|
182
|
+
let hasCustomType = false;
|
|
183
|
+
if (dataTransfer.types.includes($d7547fb11526b355$export$fd9f9fc120c5402d)) try {
|
|
184
|
+
let data = dataTransfer.getData($d7547fb11526b355$export$fd9f9fc120c5402d);
|
|
185
|
+
let parsed = JSON.parse(data);
|
|
186
|
+
for (let item of parsed)items.push({
|
|
187
|
+
kind: 'text',
|
|
188
|
+
types: new Set(Object.keys(item)),
|
|
189
|
+
getText: (type)=>Promise.resolve(item[type])
|
|
282
190
|
});
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
}
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
if (!entry) {
|
|
308
|
-
// For some reason, Firefox includes an item with type image/png when copy
|
|
309
|
-
// and pasting any file or directory (no matter the type), but returns `null` for both
|
|
310
|
-
// item.getAsFile() and item.webkitGetAsEntry(). Safari works as expected. Ignore this
|
|
311
|
-
// item if this happens. See https://bugzilla.mozilla.org/show_bug.cgi?id=1699743.
|
|
312
|
-
// This was recently fixed in Chrome Canary: https://bugs.chromium.org/p/chromium/issues/detail?id=1175483.
|
|
313
|
-
continue;
|
|
314
|
-
}
|
|
315
|
-
|
|
316
|
-
if (entry.isFile) {
|
|
317
|
-
items.push($bc29619458500c186021634c18dc$var$createFileItem(item.getAsFile()));
|
|
318
|
-
} else if (entry.isDirectory) {
|
|
319
|
-
items.push($bc29619458500c186021634c18dc$var$createDirectoryItem(entry));
|
|
320
|
-
}
|
|
321
|
-
} else {
|
|
322
|
-
// Assume it's a file.
|
|
323
|
-
items.push($bc29619458500c186021634c18dc$var$createFileItem(item.getAsFile()));
|
|
191
|
+
hasCustomType = true;
|
|
192
|
+
} catch (e) {
|
|
193
|
+
// ignore
|
|
194
|
+
}
|
|
195
|
+
// Otherwise, map native drag items to items of a single representation.
|
|
196
|
+
if (!hasCustomType) {
|
|
197
|
+
let stringItems = new Map();
|
|
198
|
+
for (let item of dataTransfer.items){
|
|
199
|
+
if (item.kind === 'string') // The data for all formats must be read here because the data transfer gets
|
|
200
|
+
// cleared out after the event handler finishes. If the item has an empty string
|
|
201
|
+
// as a type, the mime type is unknown. Map to a generic mime type instead.
|
|
202
|
+
stringItems.set(item.type || $d7547fb11526b355$export$f8fc6581787339b3, dataTransfer.getData(item.type));
|
|
203
|
+
else if (item.kind === 'file') {
|
|
204
|
+
// Despite the name, webkitGetAsEntry is also implemented in Firefox and Edge.
|
|
205
|
+
// In the future, we may use getAsFileSystemHandle instead, but that's currently
|
|
206
|
+
// only implemented in Chrome.
|
|
207
|
+
if (typeof item.webkitGetAsEntry === 'function') {
|
|
208
|
+
let entry = item.webkitGetAsEntry();
|
|
209
|
+
if (!entry) continue;
|
|
210
|
+
if (entry.isFile) items.push($29c8537521cf08fe$var$createFileItem(item.getAsFile()));
|
|
211
|
+
else if (entry.isDirectory) items.push($29c8537521cf08fe$var$createDirectoryItem(entry));
|
|
212
|
+
} else // Assume it's a file.
|
|
213
|
+
items.push($29c8537521cf08fe$var$createFileItem(item.getAsFile()));
|
|
214
|
+
}
|
|
324
215
|
}
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
kind: 'text',
|
|
333
|
-
types: new Set(stringItems.keys()),
|
|
334
|
-
getText: type => Promise.resolve(stringItems.get(type))
|
|
335
|
-
});
|
|
216
|
+
// All string items are different representations of the same item. There's no way to have
|
|
217
|
+
// multiple string items at once in the current DataTransfer API.
|
|
218
|
+
if (stringItems.size > 0) items.push({
|
|
219
|
+
kind: 'text',
|
|
220
|
+
types: new Set(stringItems.keys()),
|
|
221
|
+
getText: (type)=>Promise.resolve(stringItems.get(type))
|
|
222
|
+
});
|
|
336
223
|
}
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
return items;
|
|
340
|
-
}
|
|
341
|
-
|
|
342
|
-
function $bc29619458500c186021634c18dc$var$blobToString(blob) {
|
|
343
|
-
if (typeof blob.text === 'function') {
|
|
344
|
-
return blob.text();
|
|
345
|
-
} // Safari doesn't have the Blob#text() method yet...
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
return new Promise((resolve, reject) => {
|
|
349
|
-
let reader = new FileReader();
|
|
350
|
-
|
|
351
|
-
reader.onload = () => {
|
|
352
|
-
resolve(reader.result);
|
|
353
|
-
};
|
|
354
|
-
|
|
355
|
-
reader.onerror = reject;
|
|
356
|
-
reader.readAsText(blob);
|
|
357
|
-
});
|
|
224
|
+
return items;
|
|
358
225
|
}
|
|
359
|
-
|
|
360
|
-
function
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
226
|
+
function $29c8537521cf08fe$var$blobToString(blob) {
|
|
227
|
+
if (typeof blob.text === 'function') return blob.text();
|
|
228
|
+
// Safari doesn't have the Blob#text() method yet...
|
|
229
|
+
return new Promise((resolve, reject)=>{
|
|
230
|
+
let reader = new FileReader;
|
|
231
|
+
reader.onload = ()=>{
|
|
232
|
+
resolve(reader.result);
|
|
233
|
+
};
|
|
234
|
+
reader.onerror = reject;
|
|
235
|
+
reader.readAsText(blob);
|
|
236
|
+
});
|
|
368
237
|
}
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
238
|
+
function $29c8537521cf08fe$var$createFileItem(file) {
|
|
239
|
+
return {
|
|
240
|
+
kind: 'file',
|
|
241
|
+
type: file.type || $d7547fb11526b355$export$f8fc6581787339b3,
|
|
242
|
+
name: file.name,
|
|
243
|
+
getText: ()=>$29c8537521cf08fe$var$blobToString(file)
|
|
244
|
+
,
|
|
245
|
+
getFile: ()=>Promise.resolve(file)
|
|
246
|
+
};
|
|
376
247
|
}
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
248
|
+
function $29c8537521cf08fe$var$createDirectoryItem(entry) {
|
|
249
|
+
return {
|
|
250
|
+
kind: 'directory',
|
|
251
|
+
name: entry.name,
|
|
252
|
+
getEntries: ()=>$29c8537521cf08fe$var$getEntries(entry)
|
|
253
|
+
};
|
|
380
254
|
}
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
let reader = item.createReader(); // We must call readEntries repeatedly because there may be a limit to the
|
|
255
|
+
async function* $29c8537521cf08fe$var$getEntries(item) {
|
|
256
|
+
let reader = item.createReader();
|
|
257
|
+
// We must call readEntries repeatedly because there may be a limit to the
|
|
385
258
|
// number of entries that are returned at once.
|
|
386
|
-
|
|
387
259
|
let entries;
|
|
388
|
-
|
|
389
260
|
do {
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
} else if (entry.isDirectory) {
|
|
399
|
-
yield $bc29619458500c186021634c18dc$var$createDirectoryItem(entry);
|
|
261
|
+
entries = await new Promise((resolve, reject)=>{
|
|
262
|
+
reader.readEntries(resolve, reject);
|
|
263
|
+
});
|
|
264
|
+
for (let entry of entries){
|
|
265
|
+
if (entry.isFile) {
|
|
266
|
+
let file = await $29c8537521cf08fe$var$getEntryFile(entry);
|
|
267
|
+
yield $29c8537521cf08fe$var$createFileItem(file);
|
|
268
|
+
} else if (entry.isDirectory) yield $29c8537521cf08fe$var$createDirectoryItem(entry);
|
|
400
269
|
}
|
|
401
|
-
|
|
402
|
-
} while (entries.length > 0);
|
|
403
|
-
});
|
|
404
|
-
return $bc29619458500c186021634c18dc$var$_getEntries.apply(this, arguments);
|
|
270
|
+
}while (entries.length > 0)
|
|
405
271
|
}
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
272
|
+
function $29c8537521cf08fe$var$getEntryFile(entry) {
|
|
273
|
+
return new Promise((resolve, reject)=>entry.file(resolve, reject)
|
|
274
|
+
);
|
|
409
275
|
}
|
|
410
276
|
|
|
411
|
-
let $a75d092e5c30878812fba78e$var$dropTargets = new Map();
|
|
412
|
-
let $a75d092e5c30878812fba78e$var$dropItems = new Map();
|
|
413
|
-
let $a75d092e5c30878812fba78e$var$dragSession = null;
|
|
414
|
-
let $a75d092e5c30878812fba78e$var$subscriptions = new Set();
|
|
415
277
|
|
|
416
|
-
function $a75d092e5c30878812fba78e$export$registerDropTarget(target) {
|
|
417
|
-
var _dragSession;
|
|
418
278
|
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
$
|
|
425
|
-
|
|
426
|
-
|
|
279
|
+
let $7b1813d52b80b911$var$dropTargets = new Map();
|
|
280
|
+
let $7b1813d52b80b911$var$dropItems = new Map();
|
|
281
|
+
let $7b1813d52b80b911$var$dragSession = null;
|
|
282
|
+
let $7b1813d52b80b911$var$subscriptions = new Set();
|
|
283
|
+
function $7b1813d52b80b911$export$c28d9fb4a54e471a(target) {
|
|
284
|
+
$7b1813d52b80b911$var$dropTargets.set(target.element, target);
|
|
285
|
+
$7b1813d52b80b911$var$dragSession === null || $7b1813d52b80b911$var$dragSession === void 0 ? void 0 : $7b1813d52b80b911$var$dragSession.updateValidDropTargets();
|
|
286
|
+
return ()=>{
|
|
287
|
+
$7b1813d52b80b911$var$dropTargets.delete(target.element);
|
|
288
|
+
$7b1813d52b80b911$var$dragSession === null || $7b1813d52b80b911$var$dragSession === void 0 ? void 0 : $7b1813d52b80b911$var$dragSession.updateValidDropTargets();
|
|
289
|
+
};
|
|
427
290
|
}
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
};
|
|
291
|
+
function $7b1813d52b80b911$export$aef80212ac99c003(item) {
|
|
292
|
+
$7b1813d52b80b911$var$dropItems.set(item.element, item);
|
|
293
|
+
return ()=>{
|
|
294
|
+
$7b1813d52b80b911$var$dropItems.delete(item.element);
|
|
295
|
+
};
|
|
434
296
|
}
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
$a75d092e5c30878812fba78e$var$dragSession.setup();
|
|
444
|
-
|
|
445
|
-
if ($bc29619458500c186021634c18dc$export$getDragModality() === 'keyboard') {
|
|
446
|
-
$a75d092e5c30878812fba78e$var$dragSession.next();
|
|
447
|
-
}
|
|
448
|
-
});
|
|
449
|
-
|
|
450
|
-
for (let cb of $a75d092e5c30878812fba78e$var$subscriptions) {
|
|
451
|
-
cb();
|
|
452
|
-
}
|
|
297
|
+
function $7b1813d52b80b911$export$549dbcf8649bf3b2(target, formatMessage) {
|
|
298
|
+
if ($7b1813d52b80b911$var$dragSession) throw new Error('Cannot begin dragging while already dragging');
|
|
299
|
+
$7b1813d52b80b911$var$dragSession = new $7b1813d52b80b911$var$DragSession(target, formatMessage);
|
|
300
|
+
requestAnimationFrame(()=>{
|
|
301
|
+
$7b1813d52b80b911$var$dragSession.setup();
|
|
302
|
+
if ($29c8537521cf08fe$export$1fb2158d224b542c() === 'keyboard') $7b1813d52b80b911$var$dragSession.next();
|
|
303
|
+
});
|
|
304
|
+
for (let cb of $7b1813d52b80b911$var$subscriptions)cb();
|
|
453
305
|
}
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
};
|
|
464
|
-
|
|
465
|
-
return session;
|
|
306
|
+
function $7b1813d52b80b911$export$418e185dd3f1b968() {
|
|
307
|
+
let [session, setSession] = $67uu7$react.useState($7b1813d52b80b911$var$dragSession);
|
|
308
|
+
$67uu7$react.useEffect(()=>{
|
|
309
|
+
let cb = ()=>setSession($7b1813d52b80b911$var$dragSession)
|
|
310
|
+
;
|
|
311
|
+
$7b1813d52b80b911$var$subscriptions.add(cb);
|
|
312
|
+
return ()=>{
|
|
313
|
+
$7b1813d52b80b911$var$subscriptions.delete(cb);
|
|
314
|
+
};
|
|
315
|
+
}, []);
|
|
316
|
+
return session;
|
|
466
317
|
}
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
for (let cb of $a75d092e5c30878812fba78e$var$subscriptions) {
|
|
472
|
-
cb();
|
|
473
|
-
}
|
|
318
|
+
function $7b1813d52b80b911$var$endDragging() {
|
|
319
|
+
$7b1813d52b80b911$var$dragSession = null;
|
|
320
|
+
for (let cb of $7b1813d52b80b911$var$subscriptions)cb();
|
|
474
321
|
}
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
322
|
+
const $7b1813d52b80b911$var$CANCELED_EVENTS = [
|
|
323
|
+
'pointerdown',
|
|
324
|
+
'pointermove',
|
|
325
|
+
'pointerenter',
|
|
326
|
+
'pointerleave',
|
|
327
|
+
'pointerover',
|
|
328
|
+
'pointerout',
|
|
329
|
+
'pointerup',
|
|
330
|
+
'mousedown',
|
|
331
|
+
'mousemove',
|
|
332
|
+
'mouseenter',
|
|
333
|
+
'mouseleave',
|
|
334
|
+
'mouseover',
|
|
335
|
+
'mouseout',
|
|
336
|
+
'mouseup',
|
|
337
|
+
'touchstart',
|
|
338
|
+
'touchmove',
|
|
339
|
+
'touchend',
|
|
340
|
+
'keyup',
|
|
341
|
+
'focusin',
|
|
342
|
+
'focusout'
|
|
343
|
+
];
|
|
344
|
+
const $7b1813d52b80b911$var$CLICK_EVENTS = [
|
|
345
|
+
'pointerup',
|
|
346
|
+
'mouseup',
|
|
347
|
+
'touchend'
|
|
348
|
+
];
|
|
349
|
+
const $7b1813d52b80b911$var$MESSAGES = {
|
|
350
|
+
keyboard: 'dragStartedKeyboard',
|
|
351
|
+
touch: 'dragStartedTouch',
|
|
352
|
+
virtual: 'dragStartedVirtual'
|
|
482
353
|
};
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
this.mutationImmediate = void 0;
|
|
493
|
-
this.restoreAriaHidden = void 0;
|
|
494
|
-
this.formatMessage = void 0;
|
|
495
|
-
this.dragTarget = target;
|
|
496
|
-
this.formatMessage = formatMessage;
|
|
497
|
-
this.onKeyDown = this.onKeyDown.bind(this);
|
|
498
|
-
this.onFocus = this.onFocus.bind(this);
|
|
499
|
-
this.onBlur = this.onBlur.bind(this);
|
|
500
|
-
this.onClick = this.onClick.bind(this);
|
|
501
|
-
this.cancelEvent = this.cancelEvent.bind(this);
|
|
502
|
-
}
|
|
503
|
-
|
|
504
|
-
setup() {
|
|
505
|
-
document.addEventListener('keydown', this.onKeyDown, true);
|
|
506
|
-
window.addEventListener('focus', this.onFocus, true);
|
|
507
|
-
window.addEventListener('blur', this.onBlur, true);
|
|
508
|
-
document.addEventListener('click', this.onClick, true);
|
|
509
|
-
|
|
510
|
-
for (let event of $a75d092e5c30878812fba78e$var$CANCELED_EVENTS) {
|
|
511
|
-
document.addEventListener(event, this.cancelEvent, true);
|
|
512
|
-
}
|
|
513
|
-
|
|
514
|
-
this.mutationObserver = new MutationObserver(() => {
|
|
515
|
-
// JSDOM has a bug where MutationObserver enters an infinite loop if mutations
|
|
516
|
-
// occur inside a MutationObserver callback. If running in Node, wait until
|
|
517
|
-
// the next tick to update valid drop targets.
|
|
518
|
-
// See https://github.com/jsdom/jsdom/issues/3096
|
|
519
|
-
if (typeof setImmediate === 'function') {
|
|
520
|
-
this.mutationImmediate = setImmediate(() => this.updateValidDropTargets());
|
|
521
|
-
} else {
|
|
354
|
+
class $7b1813d52b80b911$var$DragSession {
|
|
355
|
+
setup() {
|
|
356
|
+
document.addEventListener('keydown', this.onKeyDown, true);
|
|
357
|
+
window.addEventListener('focus', this.onFocus, true);
|
|
358
|
+
window.addEventListener('blur', this.onBlur, true);
|
|
359
|
+
document.addEventListener('click', this.onClick, true);
|
|
360
|
+
for (let event of $7b1813d52b80b911$var$CANCELED_EVENTS)document.addEventListener(event, this.cancelEvent, true);
|
|
361
|
+
this.mutationObserver = new MutationObserver(()=>this.updateValidDropTargets()
|
|
362
|
+
);
|
|
522
363
|
this.updateValidDropTargets();
|
|
523
|
-
|
|
524
|
-
}
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
if (this.mutationImmediate) {
|
|
543
|
-
clearImmediate(this.mutationImmediate);
|
|
544
|
-
}
|
|
545
|
-
}
|
|
546
|
-
|
|
547
|
-
onKeyDown(e) {
|
|
548
|
-
var _this$currentDropTarg;
|
|
549
|
-
|
|
550
|
-
this.cancelEvent(e);
|
|
551
|
-
|
|
552
|
-
if (e.key === 'Escape') {
|
|
553
|
-
this.cancel();
|
|
554
|
-
return;
|
|
555
|
-
}
|
|
556
|
-
|
|
557
|
-
if (e.key === 'Enter') {
|
|
558
|
-
if (e.altKey) {
|
|
559
|
-
this.activate();
|
|
560
|
-
} else {
|
|
561
|
-
this.drop();
|
|
562
|
-
}
|
|
563
|
-
|
|
564
|
-
return;
|
|
565
|
-
}
|
|
566
|
-
|
|
567
|
-
if (e.key === 'Tab' && !(e.metaKey || e.altKey || e.ctrlKey)) {
|
|
568
|
-
if (e.shiftKey) {
|
|
569
|
-
this.previous();
|
|
570
|
-
} else {
|
|
571
|
-
this.next();
|
|
572
|
-
}
|
|
573
|
-
}
|
|
574
|
-
|
|
575
|
-
if (typeof ((_this$currentDropTarg = this.currentDropTarget) == null ? void 0 : _this$currentDropTarg.onKeyDown) === 'function') {
|
|
576
|
-
this.currentDropTarget.onKeyDown(e, this.dragTarget);
|
|
577
|
-
}
|
|
578
|
-
}
|
|
579
|
-
|
|
580
|
-
onFocus(e) {
|
|
581
|
-
// Prevent focus events, except to the original drag target.
|
|
582
|
-
if (e.target !== this.dragTarget.element) {
|
|
583
|
-
this.cancelEvent(e);
|
|
584
|
-
} // Ignore focus events on the window/document (JSDOM). Will be handled in onBlur, below.
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
if (!(e.target instanceof HTMLElement) || e.target === this.dragTarget.element) {
|
|
588
|
-
return;
|
|
589
|
-
}
|
|
590
|
-
|
|
591
|
-
let dropTarget = this.validDropTargets.find(target => target.element.contains(e.target));
|
|
592
|
-
|
|
593
|
-
if (!dropTarget) {
|
|
594
|
-
if (this.currentDropTarget) {
|
|
595
|
-
this.currentDropTarget.element.focus();
|
|
596
|
-
} else {
|
|
597
|
-
this.dragTarget.element.focus();
|
|
598
|
-
}
|
|
599
|
-
|
|
600
|
-
return;
|
|
601
|
-
}
|
|
602
|
-
|
|
603
|
-
let item = $a75d092e5c30878812fba78e$var$dropItems.get(e.target);
|
|
604
|
-
this.setCurrentDropTarget(dropTarget, item);
|
|
605
|
-
}
|
|
606
|
-
|
|
607
|
-
onBlur(e) {
|
|
608
|
-
if (e.target !== this.dragTarget.element) {
|
|
609
|
-
this.cancelEvent(e);
|
|
610
|
-
} // If nothing is gaining focus, or e.relatedTarget is the window/document (JSDOM),
|
|
611
|
-
// restore focus back to the current drop target if any, or the original drag target.
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
if (!e.relatedTarget || !(e.relatedTarget instanceof HTMLElement)) {
|
|
615
|
-
if (this.currentDropTarget) {
|
|
616
|
-
this.currentDropTarget.element.focus();
|
|
617
|
-
} else {
|
|
618
|
-
this.dragTarget.element.focus();
|
|
619
|
-
}
|
|
620
|
-
}
|
|
621
|
-
}
|
|
622
|
-
|
|
623
|
-
onClick(e) {
|
|
624
|
-
this.cancelEvent(e);
|
|
625
|
-
|
|
626
|
-
if (e.detail !== 0) {
|
|
627
|
-
return;
|
|
628
|
-
}
|
|
629
|
-
|
|
630
|
-
if (e.target === this.dragTarget.element) {
|
|
631
|
-
this.cancel();
|
|
632
|
-
return;
|
|
633
|
-
}
|
|
634
|
-
|
|
635
|
-
let dropTarget = this.validDropTargets.find(target => target.element.contains(e.target));
|
|
636
|
-
|
|
637
|
-
if (dropTarget) {
|
|
638
|
-
let item = $a75d092e5c30878812fba78e$var$dropItems.get(e.target);
|
|
639
|
-
this.setCurrentDropTarget(dropTarget, item);
|
|
640
|
-
this.drop(item);
|
|
641
|
-
}
|
|
642
|
-
}
|
|
643
|
-
|
|
644
|
-
cancelEvent(e) {
|
|
645
|
-
// Allow default for events that might cancel a click event
|
|
646
|
-
if (!$a75d092e5c30878812fba78e$var$CLICK_EVENTS.includes(e.type)) {
|
|
647
|
-
e.preventDefault();
|
|
648
|
-
}
|
|
649
|
-
|
|
650
|
-
e.stopPropagation();
|
|
651
|
-
e.stopImmediatePropagation();
|
|
652
|
-
}
|
|
653
|
-
|
|
654
|
-
updateValidDropTargets() {
|
|
655
|
-
if (!this.mutationObserver) {
|
|
656
|
-
return;
|
|
657
|
-
}
|
|
658
|
-
|
|
659
|
-
this.mutationObserver.disconnect();
|
|
660
|
-
|
|
661
|
-
if (this.restoreAriaHidden) {
|
|
662
|
-
this.restoreAriaHidden();
|
|
663
|
-
}
|
|
664
|
-
|
|
665
|
-
this.validDropTargets = $a75d092e5c30878812fba78e$var$findValidDropTargets(this.dragTarget);
|
|
666
|
-
|
|
667
|
-
if (this.currentDropTarget && !this.validDropTargets.includes(this.currentDropTarget)) {
|
|
668
|
-
this.setCurrentDropTarget(this.validDropTargets[0]);
|
|
669
|
-
} // Find valid drop items within collections
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
let types = $bc29619458500c186021634c18dc$export$getTypes(this.dragTarget.items);
|
|
673
|
-
let validDropItems = [...$a75d092e5c30878812fba78e$var$dropItems.values()].filter(item => {
|
|
674
|
-
if (typeof item.getDropOperation === 'function') {
|
|
675
|
-
return item.getDropOperation(types, this.dragTarget.allowedDropOperations) !== 'cancel';
|
|
676
|
-
}
|
|
677
|
-
|
|
678
|
-
return true;
|
|
679
|
-
}); // Filter out drop targets that contain valid items. We don't want to stop hiding elements
|
|
680
|
-
// other than the drop items that exist inside the collection.
|
|
681
|
-
|
|
682
|
-
let visibleDropTargets = this.validDropTargets.filter(target => !validDropItems.some(item => target.element.contains(item.element)));
|
|
683
|
-
this.restoreAriaHidden = ariaHideOutside([this.dragTarget.element, ...validDropItems.map(item => item.element), ...visibleDropTargets.map(target => target.element)]);
|
|
684
|
-
this.mutationObserver.observe(document.body, {
|
|
685
|
-
subtree: true,
|
|
686
|
-
attributes: true,
|
|
687
|
-
attributeFilter: ['aria-hidden']
|
|
688
|
-
});
|
|
689
|
-
}
|
|
690
|
-
|
|
691
|
-
next() {
|
|
692
|
-
if (!this.currentDropTarget) {
|
|
693
|
-
this.setCurrentDropTarget(this.validDropTargets[0]);
|
|
694
|
-
return;
|
|
695
|
-
}
|
|
696
|
-
|
|
697
|
-
let index = this.validDropTargets.indexOf(this.currentDropTarget);
|
|
698
|
-
|
|
699
|
-
if (index < 0) {
|
|
700
|
-
this.setCurrentDropTarget(this.validDropTargets[0]);
|
|
701
|
-
return;
|
|
702
|
-
} // If we've reached the end of the valid drop targets, cycle back to the original drag target.
|
|
703
|
-
// This lets the user cancel the drag in case they don't have an Escape key (e.g. iPad keyboard case).
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
if (index === this.validDropTargets.length - 1) {
|
|
707
|
-
if (!this.dragTarget.element.closest('[aria-hidden="true"]')) {
|
|
708
|
-
this.setCurrentDropTarget(null);
|
|
709
|
-
this.dragTarget.element.focus();
|
|
710
|
-
} else {
|
|
711
|
-
this.setCurrentDropTarget(this.validDropTargets[0]);
|
|
712
|
-
}
|
|
713
|
-
} else {
|
|
714
|
-
this.setCurrentDropTarget(this.validDropTargets[index + 1]);
|
|
715
|
-
}
|
|
716
|
-
}
|
|
717
|
-
|
|
718
|
-
previous() {
|
|
719
|
-
if (!this.currentDropTarget) {
|
|
720
|
-
this.setCurrentDropTarget(this.validDropTargets[this.validDropTargets.length - 1]);
|
|
721
|
-
return;
|
|
722
|
-
}
|
|
723
|
-
|
|
724
|
-
let index = this.validDropTargets.indexOf(this.currentDropTarget);
|
|
725
|
-
|
|
726
|
-
if (index < 0) {
|
|
727
|
-
this.setCurrentDropTarget(this.validDropTargets[this.validDropTargets.length - 1]);
|
|
728
|
-
return;
|
|
729
|
-
} // If we've reached the start of the valid drop targets, cycle back to the original drag target.
|
|
730
|
-
// This lets the user cancel the drag in case they don't have an Escape key (e.g. iPad keyboard case).
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
if (index === 0) {
|
|
734
|
-
if (!this.dragTarget.element.closest('[aria-hidden="true"]')) {
|
|
735
|
-
this.setCurrentDropTarget(null);
|
|
736
|
-
this.dragTarget.element.focus();
|
|
737
|
-
} else {
|
|
738
|
-
this.setCurrentDropTarget(this.validDropTargets[this.validDropTargets.length - 1]);
|
|
739
|
-
}
|
|
740
|
-
} else {
|
|
741
|
-
this.setCurrentDropTarget(this.validDropTargets[index - 1]);
|
|
742
|
-
}
|
|
743
|
-
}
|
|
744
|
-
|
|
745
|
-
setCurrentDropTarget(dropTarget, item) {
|
|
746
|
-
if (dropTarget !== this.currentDropTarget) {
|
|
747
|
-
if (this.currentDropTarget && typeof this.currentDropTarget.onDropExit === 'function') {
|
|
748
|
-
let rect = this.currentDropTarget.element.getBoundingClientRect();
|
|
749
|
-
this.currentDropTarget.onDropExit({
|
|
750
|
-
type: 'dropexit',
|
|
751
|
-
x: rect.left + rect.width / 2,
|
|
752
|
-
y: rect.top + rect.height / 2
|
|
753
|
-
});
|
|
754
|
-
}
|
|
755
|
-
|
|
756
|
-
this.currentDropTarget = dropTarget;
|
|
757
|
-
|
|
758
|
-
if (dropTarget) {
|
|
759
|
-
if (typeof dropTarget.onDropEnter === 'function') {
|
|
760
|
-
let rect = dropTarget.element.getBoundingClientRect();
|
|
761
|
-
dropTarget.onDropEnter({
|
|
762
|
-
type: 'dropenter',
|
|
763
|
-
x: rect.left + rect.width / 2,
|
|
764
|
-
y: rect.top + rect.height / 2
|
|
765
|
-
}, this.dragTarget);
|
|
364
|
+
$67uu7$reactarialiveannouncer.announce(this.formatMessage($7b1813d52b80b911$var$MESSAGES[$29c8537521cf08fe$export$1fb2158d224b542c()]));
|
|
365
|
+
}
|
|
366
|
+
teardown() {
|
|
367
|
+
document.removeEventListener('keydown', this.onKeyDown, true);
|
|
368
|
+
window.removeEventListener('focus', this.onFocus, true);
|
|
369
|
+
window.removeEventListener('blur', this.onBlur, true);
|
|
370
|
+
document.removeEventListener('click', this.onClick, true);
|
|
371
|
+
for (let event of $7b1813d52b80b911$var$CANCELED_EVENTS)document.removeEventListener(event, this.cancelEvent, true);
|
|
372
|
+
this.mutationObserver.disconnect();
|
|
373
|
+
this.restoreAriaHidden();
|
|
374
|
+
if (this.mutationImmediate) clearImmediate(this.mutationImmediate);
|
|
375
|
+
}
|
|
376
|
+
onKeyDown(e) {
|
|
377
|
+
var ref;
|
|
378
|
+
this.cancelEvent(e);
|
|
379
|
+
if (e.key === 'Escape') {
|
|
380
|
+
this.cancel();
|
|
381
|
+
return;
|
|
766
382
|
}
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
383
|
+
if (e.key === 'Enter') {
|
|
384
|
+
if (e.altKey) this.activate();
|
|
385
|
+
else this.drop();
|
|
386
|
+
return;
|
|
770
387
|
}
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
if (item !== this.currentDropItem) {
|
|
775
|
-
if (item && typeof this.currentDropTarget.onDropTargetEnter === 'function') {
|
|
776
|
-
this.currentDropTarget.onDropTargetEnter(item == null ? void 0 : item.target);
|
|
777
|
-
}
|
|
778
|
-
|
|
779
|
-
item == null ? void 0 : item.element.focus();
|
|
780
|
-
this.currentDropItem = item;
|
|
781
|
-
}
|
|
782
|
-
}
|
|
783
|
-
|
|
784
|
-
end() {
|
|
785
|
-
this.teardown();
|
|
786
|
-
|
|
787
|
-
if (typeof this.dragTarget.onDragEnd === 'function') {
|
|
788
|
-
let target = this.currentDropTarget && this.dropOperation !== 'cancel' ? this.currentDropTarget : this.dragTarget;
|
|
789
|
-
let rect = target.element.getBoundingClientRect();
|
|
790
|
-
this.dragTarget.onDragEnd({
|
|
791
|
-
type: 'dragend',
|
|
792
|
-
x: rect.x + rect.width / 2,
|
|
793
|
-
y: rect.y + rect.height / 2,
|
|
794
|
-
dropOperation: this.dropOperation
|
|
795
|
-
});
|
|
796
|
-
}
|
|
797
|
-
|
|
798
|
-
this.setCurrentDropTarget(null);
|
|
799
|
-
$a75d092e5c30878812fba78e$var$endDragging();
|
|
800
|
-
}
|
|
801
|
-
|
|
802
|
-
cancel() {
|
|
803
|
-
this.end();
|
|
804
|
-
|
|
805
|
-
if (!this.dragTarget.element.closest('[aria-hidden="true"]')) {
|
|
806
|
-
this.dragTarget.element.focus();
|
|
807
|
-
}
|
|
808
|
-
|
|
809
|
-
announce(this.formatMessage('dropCanceled'));
|
|
810
|
-
}
|
|
811
|
-
|
|
812
|
-
drop(item) {
|
|
813
|
-
if (!this.currentDropTarget) {
|
|
814
|
-
this.cancel();
|
|
815
|
-
return;
|
|
816
|
-
}
|
|
817
|
-
|
|
818
|
-
if (typeof (item == null ? void 0 : item.getDropOperation) === 'function') {
|
|
819
|
-
let types = $bc29619458500c186021634c18dc$export$getTypes(this.dragTarget.items);
|
|
820
|
-
this.dropOperation = item.getDropOperation(types, this.dragTarget.allowedDropOperations);
|
|
821
|
-
} else if (typeof this.currentDropTarget.getDropOperation === 'function') {
|
|
822
|
-
let types = $bc29619458500c186021634c18dc$export$getTypes(this.dragTarget.items);
|
|
823
|
-
this.dropOperation = this.currentDropTarget.getDropOperation(types, this.dragTarget.allowedDropOperations);
|
|
824
|
-
} else {
|
|
825
|
-
// TODO: show menu ??
|
|
826
|
-
this.dropOperation = this.dragTarget.allowedDropOperations[0];
|
|
827
|
-
}
|
|
828
|
-
|
|
829
|
-
if (typeof this.currentDropTarget.onDrop === 'function') {
|
|
830
|
-
let items = this.dragTarget.items.map(item => ({
|
|
831
|
-
kind: 'text',
|
|
832
|
-
types: new Set(Object.keys(item)),
|
|
833
|
-
getText: type => Promise.resolve(item[type])
|
|
834
|
-
}));
|
|
835
|
-
let rect = this.currentDropTarget.element.getBoundingClientRect();
|
|
836
|
-
this.currentDropTarget.onDrop({
|
|
837
|
-
type: 'drop',
|
|
838
|
-
x: rect.left + rect.width / 2,
|
|
839
|
-
y: rect.top + rect.height / 2,
|
|
840
|
-
items,
|
|
841
|
-
dropOperation: this.dropOperation
|
|
842
|
-
}, item == null ? void 0 : item.target);
|
|
843
|
-
}
|
|
844
|
-
|
|
845
|
-
this.end();
|
|
846
|
-
announce(this.formatMessage('dropComplete'));
|
|
847
|
-
}
|
|
848
|
-
|
|
849
|
-
activate() {
|
|
850
|
-
if (this.currentDropTarget && typeof this.currentDropTarget.onDropActivate === 'function') {
|
|
851
|
-
let rect = this.currentDropTarget.element.getBoundingClientRect();
|
|
852
|
-
this.currentDropTarget.onDropActivate({
|
|
853
|
-
type: 'dropactivate',
|
|
854
|
-
x: rect.left + rect.width / 2,
|
|
855
|
-
y: rect.top + rect.height / 2
|
|
856
|
-
});
|
|
857
|
-
}
|
|
858
|
-
}
|
|
859
|
-
|
|
860
|
-
}
|
|
861
|
-
|
|
862
|
-
function $a75d092e5c30878812fba78e$var$findValidDropTargets(options) {
|
|
863
|
-
let types = $bc29619458500c186021634c18dc$export$getTypes(options.items);
|
|
864
|
-
return [...$a75d092e5c30878812fba78e$var$dropTargets.values()].filter(target => {
|
|
865
|
-
if (target.element.closest('[aria-hidden="true"]')) {
|
|
866
|
-
return false;
|
|
867
|
-
}
|
|
868
|
-
|
|
869
|
-
if (typeof target.getDropOperation === 'function') {
|
|
870
|
-
return target.getDropOperation(types, options.allowedDropOperations) !== 'cancel';
|
|
871
|
-
}
|
|
872
|
-
|
|
873
|
-
return true;
|
|
874
|
-
});
|
|
875
|
-
}
|
|
876
|
-
|
|
877
|
-
// ASSET: /Users/govett/dev/react-spectrum-v3/packages/@react-aria/dnd/intl/en-US.json
|
|
878
|
-
var $ece80d58838919a4624d1c28b393f77$exports = {};
|
|
879
|
-
$ece80d58838919a4624d1c28b393f77$exports = JSON.parse("{\"dragItem\":\"Drag {itemText}\",\"dragSelectedItems\":\"Drag {count, plural, one {# selected item} other {# selected items}}\",\"dragDescriptionKeyboard\":\"Press Enter to start dragging.\",\"dragDescriptionTouch\":\"Double tap to start dragging.\",\"dragDescriptionVirtual\":\"Click to start dragging.\",\"dragStartedKeyboard\":\"Started dragging. Press Tab to navigate to a drop target, then press Enter to drop, or press Escape to cancel.\",\"dragStartedTouch\":\"Started dragging. Navigate to a drop target, then double tap to drop.\",\"dragStartedVirtual\":\"Started dragging. Navigate to a drop target, then click or press Enter to drop.\",\"endDragKeyboard\":\"Dragging. Press Enter to cancel drag.\",\"endDragTouch\":\"Dragging. Double tap to cancel drag.\",\"endDragVirtual\":\"Dragging. Click to cancel drag.\",\"dropDescriptionKeyboard\":\"Press Enter to drop. Press Escape to cancel drag.\",\"dropDescriptionTouch\":\"Double tap to drop.\",\"dropDescriptionVirtual\":\"Click to drop.\",\"dropCanceled\":\"Drop canceled.\",\"dropComplete\":\"Drop complete.\",\"dropIndicator\":\"drop indicator\",\"dropOnRoot\":\"Drop on\",\"dropOnItem\":\"Drop on {itemText}\",\"insertBefore\":\"Insert before {itemText}\",\"insertBetween\":\"Insert between {beforeItemText} and {afterItemText}\",\"insertAfter\":\"Insert after {itemText}\"}");
|
|
880
|
-
// @ts-ignore
|
|
881
|
-
const $faa3fd9c929dcb7fde0b75ef821032d3$var$intlMessages = {
|
|
882
|
-
"en-US": _babelRuntimeHelpersInteropRequireDefault($ece80d58838919a4624d1c28b393f77$exports).default
|
|
883
|
-
};
|
|
884
|
-
const $faa3fd9c929dcb7fde0b75ef821032d3$var$MESSAGES = {
|
|
885
|
-
keyboard: {
|
|
886
|
-
start: 'dragDescriptionKeyboard',
|
|
887
|
-
end: 'endDragKeyboard'
|
|
888
|
-
},
|
|
889
|
-
touch: {
|
|
890
|
-
start: 'dragDescriptionTouch',
|
|
891
|
-
end: 'endDragTouch'
|
|
892
|
-
},
|
|
893
|
-
virtual: {
|
|
894
|
-
start: 'dragDescriptionVirtual',
|
|
895
|
-
end: 'endDragVirtual'
|
|
896
|
-
}
|
|
897
|
-
};
|
|
898
|
-
|
|
899
|
-
function useDrag(options) {
|
|
900
|
-
let formatMessage = useMessageFormatter($faa3fd9c929dcb7fde0b75ef821032d3$var$intlMessages);
|
|
901
|
-
let state = useRef({
|
|
902
|
-
options,
|
|
903
|
-
x: 0,
|
|
904
|
-
y: 0
|
|
905
|
-
}).current;
|
|
906
|
-
state.options = options;
|
|
907
|
-
let [isDragging, setDragging] = useState(false);
|
|
908
|
-
|
|
909
|
-
let onDragStart = e => {
|
|
910
|
-
let items = options.getItems();
|
|
911
|
-
$bc29619458500c186021634c18dc$export$writeToDataTransfer(e.dataTransfer, items);
|
|
912
|
-
|
|
913
|
-
if (typeof options.getAllowedDropOperations === 'function') {
|
|
914
|
-
let allowedOperations = options.getAllowedDropOperations();
|
|
915
|
-
let allowed = $b29ea0269b2ea2bf4827b4fa19ddc83e$export$DROP_OPERATION.none;
|
|
916
|
-
|
|
917
|
-
for (let operation of allowedOperations) {
|
|
918
|
-
allowed |= $b29ea0269b2ea2bf4827b4fa19ddc83e$export$DROP_OPERATION[operation] || $b29ea0269b2ea2bf4827b4fa19ddc83e$export$DROP_OPERATION.none;
|
|
919
|
-
}
|
|
920
|
-
|
|
921
|
-
e.dataTransfer.effectAllowed = $b29ea0269b2ea2bf4827b4fa19ddc83e$export$EFFECT_ALLOWED[allowed] || 'none';
|
|
922
|
-
} // If there is a renderPreview function, use it to render a custom preview image that will
|
|
923
|
-
// appear under the pointer while dragging. If not, the element itself is dragged by the browser.
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
if (typeof options.renderPreview === 'function') {
|
|
927
|
-
let preview = options.renderPreview(items);
|
|
928
|
-
|
|
929
|
-
if (preview) {
|
|
930
|
-
// Create an off-screen div to render the preview into.
|
|
931
|
-
let node = document.createElement('div');
|
|
932
|
-
node.style.zIndex = '-100';
|
|
933
|
-
node.style.position = 'absolute';
|
|
934
|
-
node.style.top = '0';
|
|
935
|
-
node.style.left = '-100000px';
|
|
936
|
-
document.body.appendChild(node); // Call renderPreview to get a JSX element, and render it into the div with React DOM.
|
|
937
|
-
|
|
938
|
-
_reactDom.render(preview, node); // Compute the offset that the preview will appear under the mouse.
|
|
939
|
-
// If possible, this is based on the point the user clicked on the target.
|
|
940
|
-
// If the preview is much smaller, then just use the center point of the preview.
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
let size = node.getBoundingClientRect();
|
|
944
|
-
let rect = e.currentTarget.getBoundingClientRect();
|
|
945
|
-
let x = e.clientX - rect.x;
|
|
946
|
-
let y = e.clientY - rect.y;
|
|
947
|
-
|
|
948
|
-
if (x > size.width || y > size.height) {
|
|
949
|
-
x = size.width / 2;
|
|
950
|
-
y = size.height / 2;
|
|
388
|
+
if (e.key === 'Tab' && !(e.metaKey || e.altKey || e.ctrlKey)) {
|
|
389
|
+
if (e.shiftKey) this.previous();
|
|
390
|
+
else this.next();
|
|
951
391
|
}
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
};
|
|
977
|
-
|
|
978
|
-
let onDrag = e => {
|
|
979
|
-
if (e.clientX === state.x && e.clientY === state.y) {
|
|
980
|
-
return;
|
|
981
|
-
}
|
|
982
|
-
|
|
983
|
-
if (typeof options.onDragMove === 'function') {
|
|
984
|
-
options.onDragMove({
|
|
985
|
-
type: 'dragmove',
|
|
986
|
-
x: e.clientX,
|
|
987
|
-
y: e.clientY
|
|
988
|
-
});
|
|
989
|
-
}
|
|
990
|
-
|
|
991
|
-
state.x = e.clientX;
|
|
992
|
-
state.y = e.clientY;
|
|
993
|
-
};
|
|
994
|
-
|
|
995
|
-
let onDragEnd = e => {
|
|
996
|
-
if (typeof options.onDragEnd === 'function') {
|
|
997
|
-
options.onDragEnd({
|
|
998
|
-
type: 'dragend',
|
|
999
|
-
x: e.clientX,
|
|
1000
|
-
y: e.clientY,
|
|
1001
|
-
dropOperation: $b29ea0269b2ea2bf4827b4fa19ddc83e$export$DROP_EFFECT_TO_DROP_OPERATION[e.dataTransfer.dropEffect]
|
|
1002
|
-
});
|
|
1003
|
-
}
|
|
1004
|
-
|
|
1005
|
-
setDragging(false);
|
|
1006
|
-
};
|
|
1007
|
-
|
|
1008
|
-
let onPress = e => {
|
|
1009
|
-
if (e.pointerType !== 'keyboard' && e.pointerType !== 'virtual') {
|
|
1010
|
-
return;
|
|
1011
|
-
}
|
|
1012
|
-
|
|
1013
|
-
if (typeof state.options.onDragStart === 'function') {
|
|
1014
|
-
let rect = e.target.getBoundingClientRect();
|
|
1015
|
-
state.options.onDragStart({
|
|
1016
|
-
type: 'dragstart',
|
|
1017
|
-
x: rect.x + rect.width / 2,
|
|
1018
|
-
y: rect.y + rect.height / 2
|
|
1019
|
-
});
|
|
1020
|
-
}
|
|
1021
|
-
|
|
1022
|
-
$a75d092e5c30878812fba78e$export$beginDragging({
|
|
1023
|
-
element: e.target,
|
|
1024
|
-
items: state.options.getItems(),
|
|
1025
|
-
allowedDropOperations: typeof state.options.getAllowedDropOperations === 'function' ? state.options.getAllowedDropOperations() : ['move', 'copy', 'link'],
|
|
1026
|
-
|
|
1027
|
-
onDragEnd(e) {
|
|
1028
|
-
setDragging(false);
|
|
1029
|
-
|
|
1030
|
-
if (typeof state.options.onDragEnd === 'function') {
|
|
1031
|
-
state.options.onDragEnd(e);
|
|
392
|
+
if (typeof ((ref = this.currentDropTarget) === null || ref === void 0 ? void 0 : ref.onKeyDown) === 'function') this.currentDropTarget.onKeyDown(e, this.dragTarget);
|
|
393
|
+
}
|
|
394
|
+
onFocus(e) {
|
|
395
|
+
// Prevent focus events, except to the original drag target.
|
|
396
|
+
if (e.target !== this.dragTarget.element) this.cancelEvent(e);
|
|
397
|
+
// Ignore focus events on the window/document (JSDOM). Will be handled in onBlur, below.
|
|
398
|
+
if (!(e.target instanceof HTMLElement) || e.target === this.dragTarget.element) return;
|
|
399
|
+
let dropTarget = this.validDropTargets.find((target)=>target.element.contains(e.target)
|
|
400
|
+
);
|
|
401
|
+
if (!dropTarget) {
|
|
402
|
+
if (this.currentDropTarget) this.currentDropTarget.element.focus();
|
|
403
|
+
else this.dragTarget.element.focus();
|
|
404
|
+
return;
|
|
405
|
+
}
|
|
406
|
+
let item = $7b1813d52b80b911$var$dropItems.get(e.target);
|
|
407
|
+
this.setCurrentDropTarget(dropTarget, item);
|
|
408
|
+
}
|
|
409
|
+
onBlur(e) {
|
|
410
|
+
if (e.target !== this.dragTarget.element) this.cancelEvent(e);
|
|
411
|
+
// If nothing is gaining focus, or e.relatedTarget is the window/document (JSDOM),
|
|
412
|
+
// restore focus back to the current drop target if any, or the original drag target.
|
|
413
|
+
if (!e.relatedTarget || !(e.relatedTarget instanceof HTMLElement)) {
|
|
414
|
+
if (this.currentDropTarget) this.currentDropTarget.element.focus();
|
|
415
|
+
else this.dragTarget.element.focus();
|
|
1032
416
|
}
|
|
1033
|
-
}
|
|
1034
|
-
|
|
1035
|
-
}, formatMessage);
|
|
1036
|
-
setDragging(true);
|
|
1037
|
-
};
|
|
1038
|
-
|
|
1039
|
-
let modality = $bc29619458500c186021634c18dc$export$useDragModality();
|
|
1040
|
-
let descriptionProps = useDescription(formatMessage(!isDragging ? $faa3fd9c929dcb7fde0b75ef821032d3$var$MESSAGES[modality].start : $faa3fd9c929dcb7fde0b75ef821032d3$var$MESSAGES[modality].end));
|
|
1041
|
-
return {
|
|
1042
|
-
dragProps: {
|
|
1043
|
-
draggable: 'true',
|
|
1044
|
-
onDragStart,
|
|
1045
|
-
onDrag,
|
|
1046
|
-
onDragEnd
|
|
1047
|
-
},
|
|
1048
|
-
dragButtonProps: _babelRuntimeHelpersExtends({}, descriptionProps, {
|
|
1049
|
-
onPress
|
|
1050
|
-
}),
|
|
1051
|
-
isDragging
|
|
1052
|
-
};
|
|
1053
|
-
}
|
|
1054
|
-
|
|
1055
|
-
exports.useDrag = useDrag;
|
|
1056
|
-
// @ts-ignore
|
|
1057
|
-
const $ca75888e192994dbb11ae05e54$var$intlMessages = {
|
|
1058
|
-
"en-US": _babelRuntimeHelpersInteropRequireDefault($ece80d58838919a4624d1c28b393f77$exports).default
|
|
1059
|
-
};
|
|
1060
|
-
const $ca75888e192994dbb11ae05e54$var$MESSAGES = {
|
|
1061
|
-
keyboard: 'dropDescriptionKeyboard',
|
|
1062
|
-
touch: 'dropDescriptionTouch',
|
|
1063
|
-
virtual: 'dropDescriptionVirtual'
|
|
1064
|
-
};
|
|
1065
|
-
|
|
1066
|
-
function $ca75888e192994dbb11ae05e54$export$useVirtualDrop() {
|
|
1067
|
-
let formatMessage = useMessageFormatter($ca75888e192994dbb11ae05e54$var$intlMessages);
|
|
1068
|
-
let modality = $bc29619458500c186021634c18dc$export$useDragModality();
|
|
1069
|
-
let dragSession = $a75d092e5c30878812fba78e$export$useDragSession();
|
|
1070
|
-
let descriptionProps = useDescription(dragSession ? formatMessage($ca75888e192994dbb11ae05e54$var$MESSAGES[modality]) : '');
|
|
1071
|
-
return {
|
|
1072
|
-
dropProps: _babelRuntimeHelpersExtends({}, descriptionProps, {
|
|
1073
|
-
// Mobile Safari does not properly bubble click events on elements except links or inputs
|
|
1074
|
-
// unless there is an onclick handler bound directly to the element itself. By adding this
|
|
1075
|
-
// handler, React will take care of adding that for us, and we are able to handle document
|
|
1076
|
-
// level click events in the DragManager.
|
|
1077
|
-
// See https://www.quirksmode.org/blog/archives/2010/09/click_event_del.html
|
|
1078
|
-
onClick: () => {}
|
|
1079
|
-
})
|
|
1080
|
-
};
|
|
1081
|
-
}
|
|
1082
|
-
|
|
1083
|
-
const $db0591c71140b157a950096251935c$var$DROP_ACTIVATE_TIMEOUT = 800;
|
|
1084
|
-
|
|
1085
|
-
function useDrop(options) {
|
|
1086
|
-
let [isDropTarget, setDropTarget] = useState(false);
|
|
1087
|
-
let state = useRef({
|
|
1088
|
-
x: 0,
|
|
1089
|
-
y: 0,
|
|
1090
|
-
dragEnterCount: 0,
|
|
1091
|
-
dropEffect: 'none',
|
|
1092
|
-
dropActivateTimer: null
|
|
1093
|
-
}).current;
|
|
1094
|
-
|
|
1095
|
-
let onDragOver = e => {
|
|
1096
|
-
e.preventDefault();
|
|
1097
|
-
|
|
1098
|
-
if (e.clientX === state.x && e.clientY === state.y) {
|
|
1099
|
-
e.dataTransfer.dropEffect = state.dropEffect;
|
|
1100
|
-
return;
|
|
1101
|
-
}
|
|
1102
|
-
|
|
1103
|
-
state.x = e.clientX;
|
|
1104
|
-
state.y = e.clientY;
|
|
1105
|
-
|
|
1106
|
-
if (typeof options.getDropOperationForPoint === 'function') {
|
|
1107
|
-
let allowedOperations = $db0591c71140b157a950096251935c$var$effectAllowedToOperations(e.dataTransfer.effectAllowed);
|
|
1108
|
-
let types = new $bc29619458500c186021634c18dc$export$DragTypes(e.dataTransfer);
|
|
1109
|
-
let rect = e.currentTarget.getBoundingClientRect();
|
|
1110
|
-
let dropOperation = options.getDropOperationForPoint(types, allowedOperations, state.x - rect.x, state.y - rect.y);
|
|
1111
|
-
state.dropEffect = $b29ea0269b2ea2bf4827b4fa19ddc83e$export$DROP_OPERATION_TO_DROP_EFFECT[dropOperation] || 'none';
|
|
1112
417
|
}
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
418
|
+
onClick(e) {
|
|
419
|
+
this.cancelEvent(e);
|
|
420
|
+
if (e.detail !== 0) return;
|
|
421
|
+
if (e.target === this.dragTarget.element) {
|
|
422
|
+
this.cancel();
|
|
423
|
+
return;
|
|
424
|
+
}
|
|
425
|
+
let dropTarget = this.validDropTargets.find((target)=>target.element.contains(e.target)
|
|
426
|
+
);
|
|
427
|
+
if (dropTarget) {
|
|
428
|
+
let item = $7b1813d52b80b911$var$dropItems.get(e.target);
|
|
429
|
+
this.setCurrentDropTarget(dropTarget, item);
|
|
430
|
+
this.drop(item);
|
|
431
|
+
}
|
|
1123
432
|
}
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
433
|
+
cancelEvent(e) {
|
|
434
|
+
// Allow default for events that might cancel a click event
|
|
435
|
+
if (!$7b1813d52b80b911$var$CLICK_EVENTS.includes(e.type)) e.preventDefault();
|
|
436
|
+
e.stopPropagation();
|
|
437
|
+
e.stopImmediatePropagation();
|
|
438
|
+
}
|
|
439
|
+
updateValidDropTargets() {
|
|
440
|
+
if (!this.mutationObserver) return;
|
|
441
|
+
this.mutationObserver.disconnect();
|
|
442
|
+
if (this.restoreAriaHidden) this.restoreAriaHidden();
|
|
443
|
+
this.validDropTargets = $7b1813d52b80b911$var$findValidDropTargets(this.dragTarget);
|
|
444
|
+
if (this.currentDropTarget && !this.validDropTargets.includes(this.currentDropTarget)) this.setCurrentDropTarget(this.validDropTargets[0]);
|
|
445
|
+
// Find valid drop items within collections
|
|
446
|
+
let types = $29c8537521cf08fe$export$e1d41611756c6326(this.dragTarget.items);
|
|
447
|
+
let validDropItems = [
|
|
448
|
+
...$7b1813d52b80b911$var$dropItems.values()
|
|
449
|
+
].filter((item)=>{
|
|
450
|
+
if (typeof item.getDropOperation === 'function') return item.getDropOperation(types, this.dragTarget.allowedDropOperations) !== 'cancel';
|
|
451
|
+
return true;
|
|
452
|
+
});
|
|
453
|
+
// Filter out drop targets that contain valid items. We don't want to stop hiding elements
|
|
454
|
+
// other than the drop items that exist inside the collection.
|
|
455
|
+
let visibleDropTargets = this.validDropTargets.filter((target)=>!validDropItems.some((item)=>target.element.contains(item.element)
|
|
456
|
+
)
|
|
457
|
+
);
|
|
458
|
+
this.restoreAriaHidden = $67uu7$reactariaoverlays.ariaHideOutside([
|
|
459
|
+
this.dragTarget.element,
|
|
460
|
+
...validDropItems.map((item)=>item.element
|
|
461
|
+
),
|
|
462
|
+
...visibleDropTargets.map((target)=>target.element
|
|
463
|
+
)
|
|
464
|
+
]);
|
|
465
|
+
this.mutationObserver.observe(document.body, {
|
|
466
|
+
subtree: true,
|
|
467
|
+
attributes: true,
|
|
468
|
+
attributeFilter: [
|
|
469
|
+
'aria-hidden'
|
|
470
|
+
]
|
|
1134
471
|
});
|
|
1135
|
-
}, $db0591c71140b157a950096251935c$var$DROP_ACTIVATE_TIMEOUT);
|
|
1136
|
-
}
|
|
1137
|
-
};
|
|
1138
|
-
|
|
1139
|
-
let onDragEnter = e => {
|
|
1140
|
-
state.dragEnterCount++;
|
|
1141
|
-
|
|
1142
|
-
if (state.dragEnterCount > 1) {
|
|
1143
|
-
return;
|
|
1144
|
-
}
|
|
1145
|
-
|
|
1146
|
-
let allowedOperations = $db0591c71140b157a950096251935c$var$effectAllowedToOperations(e.dataTransfer.effectAllowed);
|
|
1147
|
-
let dropOperation = allowedOperations[0];
|
|
1148
|
-
|
|
1149
|
-
if (typeof options.getDropOperation === 'function') {
|
|
1150
|
-
let types = new $bc29619458500c186021634c18dc$export$DragTypes(e.dataTransfer);
|
|
1151
|
-
dropOperation = options.getDropOperation(types, allowedOperations);
|
|
1152
|
-
}
|
|
1153
|
-
|
|
1154
|
-
if (dropOperation !== 'cancel') {
|
|
1155
|
-
setDropTarget(true);
|
|
1156
|
-
}
|
|
1157
|
-
|
|
1158
|
-
if (typeof options.getDropOperationForPoint === 'function') {
|
|
1159
|
-
let types = new $bc29619458500c186021634c18dc$export$DragTypes(e.dataTransfer);
|
|
1160
|
-
let rect = e.currentTarget.getBoundingClientRect();
|
|
1161
|
-
dropOperation = options.getDropOperationForPoint(types, allowedOperations, e.clientX - rect.x, e.clientY - rect.y);
|
|
1162
472
|
}
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
473
|
+
next() {
|
|
474
|
+
if (!this.currentDropTarget) {
|
|
475
|
+
this.setCurrentDropTarget(this.validDropTargets[0]);
|
|
476
|
+
return;
|
|
477
|
+
}
|
|
478
|
+
let index = this.validDropTargets.indexOf(this.currentDropTarget);
|
|
479
|
+
if (index < 0) {
|
|
480
|
+
this.setCurrentDropTarget(this.validDropTargets[0]);
|
|
481
|
+
return;
|
|
482
|
+
}
|
|
483
|
+
// If we've reached the end of the valid drop targets, cycle back to the original drag target.
|
|
484
|
+
// This lets the user cancel the drag in case they don't have an Escape key (e.g. iPad keyboard case).
|
|
485
|
+
if (index === this.validDropTargets.length - 1) {
|
|
486
|
+
if (!this.dragTarget.element.closest('[aria-hidden="true"]')) {
|
|
487
|
+
this.setCurrentDropTarget(null);
|
|
488
|
+
this.dragTarget.element.focus();
|
|
489
|
+
} else this.setCurrentDropTarget(this.validDropTargets[0]);
|
|
490
|
+
} else this.setCurrentDropTarget(this.validDropTargets[index + 1]);
|
|
491
|
+
}
|
|
492
|
+
previous() {
|
|
493
|
+
if (!this.currentDropTarget) {
|
|
494
|
+
this.setCurrentDropTarget(this.validDropTargets[this.validDropTargets.length - 1]);
|
|
495
|
+
return;
|
|
496
|
+
}
|
|
497
|
+
let index = this.validDropTargets.indexOf(this.currentDropTarget);
|
|
498
|
+
if (index < 0) {
|
|
499
|
+
this.setCurrentDropTarget(this.validDropTargets[this.validDropTargets.length - 1]);
|
|
500
|
+
return;
|
|
501
|
+
}
|
|
502
|
+
// If we've reached the start of the valid drop targets, cycle back to the original drag target.
|
|
503
|
+
// This lets the user cancel the drag in case they don't have an Escape key (e.g. iPad keyboard case).
|
|
504
|
+
if (index === 0) {
|
|
505
|
+
if (!this.dragTarget.element.closest('[aria-hidden="true"]')) {
|
|
506
|
+
this.setCurrentDropTarget(null);
|
|
507
|
+
this.dragTarget.element.focus();
|
|
508
|
+
} else this.setCurrentDropTarget(this.validDropTargets[this.validDropTargets.length - 1]);
|
|
509
|
+
} else this.setCurrentDropTarget(this.validDropTargets[index - 1]);
|
|
510
|
+
}
|
|
511
|
+
setCurrentDropTarget(dropTarget, item) {
|
|
512
|
+
if (dropTarget !== this.currentDropTarget) {
|
|
513
|
+
if (this.currentDropTarget && typeof this.currentDropTarget.onDropExit === 'function') {
|
|
514
|
+
let rect = this.currentDropTarget.element.getBoundingClientRect();
|
|
515
|
+
this.currentDropTarget.onDropExit({
|
|
516
|
+
type: 'dropexit',
|
|
517
|
+
x: rect.left + rect.width / 2,
|
|
518
|
+
y: rect.top + rect.height / 2
|
|
519
|
+
});
|
|
520
|
+
}
|
|
521
|
+
this.currentDropTarget = dropTarget;
|
|
522
|
+
if (dropTarget) {
|
|
523
|
+
if (typeof dropTarget.onDropEnter === 'function') {
|
|
524
|
+
let rect = dropTarget.element.getBoundingClientRect();
|
|
525
|
+
dropTarget.onDropEnter({
|
|
526
|
+
type: 'dropenter',
|
|
527
|
+
x: rect.left + rect.width / 2,
|
|
528
|
+
y: rect.top + rect.height / 2
|
|
529
|
+
}, this.dragTarget);
|
|
530
|
+
}
|
|
531
|
+
if (!item) dropTarget === null || dropTarget === void 0 ? void 0 : dropTarget.element.focus();
|
|
532
|
+
}
|
|
533
|
+
}
|
|
534
|
+
if (item !== this.currentDropItem) {
|
|
535
|
+
if (item && typeof this.currentDropTarget.onDropTargetEnter === 'function') this.currentDropTarget.onDropTargetEnter(item === null || item === void 0 ? void 0 : item.target);
|
|
536
|
+
item === null || item === void 0 ? void 0 : item.element.focus();
|
|
537
|
+
this.currentDropItem = item;
|
|
538
|
+
}
|
|
1174
539
|
}
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
540
|
+
end() {
|
|
541
|
+
this.teardown();
|
|
542
|
+
if (typeof this.dragTarget.onDragEnd === 'function') {
|
|
543
|
+
let target = this.currentDropTarget && this.dropOperation !== 'cancel' ? this.currentDropTarget : this.dragTarget;
|
|
544
|
+
let rect = target.element.getBoundingClientRect();
|
|
545
|
+
this.dragTarget.onDragEnd({
|
|
546
|
+
type: 'dragend',
|
|
547
|
+
x: rect.x + rect.width / 2,
|
|
548
|
+
y: rect.y + rect.height / 2,
|
|
549
|
+
dropOperation: this.dropOperation
|
|
550
|
+
});
|
|
551
|
+
}
|
|
552
|
+
this.setCurrentDropTarget(null);
|
|
553
|
+
$7b1813d52b80b911$var$endDragging();
|
|
1185
554
|
}
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
type: 'dropexit',
|
|
1191
|
-
x: e.clientX - rect.x,
|
|
1192
|
-
y: e.clientY - rect.y
|
|
1193
|
-
});
|
|
555
|
+
cancel() {
|
|
556
|
+
this.end();
|
|
557
|
+
if (!this.dragTarget.element.closest('[aria-hidden="true"]')) this.dragTarget.element.focus();
|
|
558
|
+
$67uu7$reactarialiveannouncer.announce(this.formatMessage('dropCanceled'));
|
|
1194
559
|
}
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
560
|
+
drop(item1) {
|
|
561
|
+
if (!this.currentDropTarget) {
|
|
562
|
+
this.cancel();
|
|
563
|
+
return;
|
|
564
|
+
}
|
|
565
|
+
if (typeof (item1 === null || item1 === void 0 ? void 0 : item1.getDropOperation) === 'function') {
|
|
566
|
+
let types = $29c8537521cf08fe$export$e1d41611756c6326(this.dragTarget.items);
|
|
567
|
+
this.dropOperation = item1.getDropOperation(types, this.dragTarget.allowedDropOperations);
|
|
568
|
+
} else if (typeof this.currentDropTarget.getDropOperation === 'function') {
|
|
569
|
+
let types = $29c8537521cf08fe$export$e1d41611756c6326(this.dragTarget.items);
|
|
570
|
+
this.dropOperation = this.currentDropTarget.getDropOperation(types, this.dragTarget.allowedDropOperations);
|
|
571
|
+
} else // TODO: show menu ??
|
|
572
|
+
this.dropOperation = this.dragTarget.allowedDropOperations[0];
|
|
573
|
+
if (typeof this.currentDropTarget.onDrop === 'function') {
|
|
574
|
+
let items = this.dragTarget.items.map((item)=>({
|
|
575
|
+
kind: 'text',
|
|
576
|
+
types: new Set(Object.keys(item)),
|
|
577
|
+
getText: (type)=>Promise.resolve(item[type])
|
|
578
|
+
})
|
|
579
|
+
);
|
|
580
|
+
let rect = this.currentDropTarget.element.getBoundingClientRect();
|
|
581
|
+
this.currentDropTarget.onDrop({
|
|
582
|
+
type: 'drop',
|
|
583
|
+
x: rect.left + rect.width / 2,
|
|
584
|
+
y: rect.top + rect.height / 2,
|
|
585
|
+
items: items,
|
|
586
|
+
dropOperation: this.dropOperation
|
|
587
|
+
}, item1 === null || item1 === void 0 ? void 0 : item1.target);
|
|
588
|
+
}
|
|
589
|
+
this.end();
|
|
590
|
+
$67uu7$reactarialiveannouncer.announce(this.formatMessage('dropComplete'));
|
|
591
|
+
}
|
|
592
|
+
activate() {
|
|
593
|
+
if (this.currentDropTarget && typeof this.currentDropTarget.onDropActivate === 'function') {
|
|
594
|
+
let rect = this.currentDropTarget.element.getBoundingClientRect();
|
|
595
|
+
this.currentDropTarget.onDropActivate({
|
|
596
|
+
type: 'dropactivate',
|
|
597
|
+
x: rect.left + rect.width / 2,
|
|
598
|
+
y: rect.top + rect.height / 2
|
|
599
|
+
});
|
|
600
|
+
}
|
|
1221
601
|
}
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
602
|
+
constructor(target, formatMessage){
|
|
603
|
+
this.dragTarget = target;
|
|
604
|
+
this.formatMessage = formatMessage;
|
|
605
|
+
this.onKeyDown = this.onKeyDown.bind(this);
|
|
606
|
+
this.onFocus = this.onFocus.bind(this);
|
|
607
|
+
this.onBlur = this.onBlur.bind(this);
|
|
608
|
+
this.onClick = this.onClick.bind(this);
|
|
609
|
+
this.cancelEvent = this.cancelEvent.bind(this);
|
|
1230
610
|
}
|
|
611
|
+
}
|
|
612
|
+
function $7b1813d52b80b911$var$findValidDropTargets(options) {
|
|
613
|
+
let types = $29c8537521cf08fe$export$e1d41611756c6326(options.items);
|
|
614
|
+
return [
|
|
615
|
+
...$7b1813d52b80b911$var$dropTargets.values()
|
|
616
|
+
].filter((target)=>{
|
|
617
|
+
if (target.element.closest('[aria-hidden="true"]')) return false;
|
|
618
|
+
if (typeof target.getDropOperation === 'function') return target.getDropOperation(types, options.allowedDropOperations) !== 'cancel';
|
|
619
|
+
return true;
|
|
620
|
+
});
|
|
621
|
+
}
|
|
1231
622
|
|
|
1232
|
-
state.dragEnterCount = 0;
|
|
1233
|
-
setDropTarget(false);
|
|
1234
|
-
clearTimeout(state.dropActivateTimer);
|
|
1235
|
-
};
|
|
1236
623
|
|
|
1237
|
-
let optionsRef = useRef(options);
|
|
1238
|
-
optionsRef.current = options;
|
|
1239
|
-
useLayoutEffect(() => $a75d092e5c30878812fba78e$export$registerDropTarget({
|
|
1240
|
-
element: optionsRef.current.ref.current,
|
|
1241
|
-
getDropOperation: optionsRef.current.getDropOperation,
|
|
1242
624
|
|
|
1243
|
-
|
|
1244
|
-
|
|
625
|
+
var $6dae25bfb54cafe2$exports = {};
|
|
626
|
+
var $6a4207e9446e3fd6$exports = {};
|
|
627
|
+
$6a4207e9446e3fd6$exports = JSON.parse("{\"dragDescriptionKeyboard\":\"اضغط Enter لبدء السحب.\",\"dragDescriptionTouch\":\"اضغط مرتين لبدء السحب.\",\"dragDescriptionVirtual\":\"انقر لبدء السحب.\",\"dragItem\":\"اسحب {itemText}\",\"dragSelectedItems\":\"اسحب {count, plural, one {# عنصر محدد} other {# عناصر محددة}}\",\"dragStartedKeyboard\":\"بدأ السحب. اضغط Tab للانتقال إلى موضع الإفلات، ثم اضغط Enter للإفلات، أو اضغط Escape للإلغاء.\",\"dragStartedTouch\":\"بدأ السحب. انتقل إلى موضع الإفلات، ثم اضغط مرتين للإفلات.\",\"dragStartedVirtual\":\"بدأ السحب. انتقل إلى مكان الإفلات، ثم انقر أو اضغط Enter للإفلات.\",\"dropCanceled\":\"تم إلغاء الإفلات.\",\"dropComplete\":\"اكتمل الإفلات.\",\"dropDescriptionKeyboard\":\"اضغط Enter للإفلات. اضغط Escape لإلغاء السحب.\",\"dropDescriptionTouch\":\"اضغط مرتين للإفلات.\",\"dropDescriptionVirtual\":\"انقر للإفلات.\",\"dropIndicator\":\"مؤشر الإفلات\",\"dropOnItem\":\"إفلات {itemText}\",\"dropOnRoot\":\"الإفلات\",\"endDragKeyboard\":\"السحب. اضغط Enter لإلغاء السحب.\",\"endDragTouch\":\"السحب. اضغط مرتين لإلغاء السحب.\",\"endDragVirtual\":\"السحب. انقر لإلغاء السحب.\",\"insertAfter\":\"أدخل بعد {itemText}\",\"insertBefore\":\"أدخل قبل {itemText}\",\"insertBetween\":\"أدخل بين {beforeItemText} و {afterItemText}\"}");
|
|
1245
628
|
|
|
1246
|
-
if (typeof optionsRef.current.onDropEnter === 'function') {
|
|
1247
|
-
optionsRef.current.onDropEnter(e);
|
|
1248
|
-
}
|
|
1249
|
-
},
|
|
1250
629
|
|
|
1251
|
-
|
|
1252
|
-
|
|
630
|
+
var $b35a262c6a180bbf$exports = {};
|
|
631
|
+
$b35a262c6a180bbf$exports = JSON.parse("{\"dragDescriptionKeyboard\":\"Натиснете „Enter“, за да започнете да плъзгате.\",\"dragDescriptionTouch\":\"Натиснете двукратно, за да започнете да плъзгате.\",\"dragDescriptionVirtual\":\"Щракнете, за да започнете да плъзгате.\",\"dragItem\":\"Плъзни {itemText}\",\"dragSelectedItems\":\"Плъзни {count, plural, one {# избран елемент} other {# избрани елемента}}\",\"dragStartedKeyboard\":\"Започна плъзгане. Натиснете „Tab“, за да се придвижите до целта, след което натиснете „Enter“ за пускане или натиснете „Escape“ за отмяна.\",\"dragStartedTouch\":\"Започна плъзгане. Придвижете се до целта, след което натиснете двукратно, за да пуснете.\",\"dragStartedVirtual\":\"Започна плъзгане. Придвижете се до целта, след което щракнете или натиснете „Enter“ за пускане.\",\"dropCanceled\":\"Пускането е отменено.\",\"dropComplete\":\"Пускането е завършено.\",\"dropDescriptionKeyboard\":\"Натиснете „Enter“ за пускане. Натиснете „Escape“ за отмяна на плъзгането.\",\"dropDescriptionTouch\":\"Натиснете двукратно за пускане.\",\"dropDescriptionVirtual\":\"Щракнете за пускане.\",\"dropIndicator\":\"индикатор за пускане\",\"dropOnItem\":\"Пусни върху {itemText}\",\"dropOnRoot\":\"Пусни върху\",\"endDragKeyboard\":\"Плъзгане. Натиснете „Enter“ за отмяна на плъзгането.\",\"endDragTouch\":\"Плъзгане. Натиснете двукратно за отмяна на плъзгането.\",\"endDragVirtual\":\"Плъзгане. Щракнете за отмяна.\",\"insertAfter\":\"Вмъкни след {itemText}\",\"insertBefore\":\"Вмъкни преди {itemText}\",\"insertBetween\":\"Вмъкни между {beforeItemText} и {afterItemText}\"}");
|
|
1253
632
|
|
|
1254
|
-
if (typeof optionsRef.current.onDropExit === 'function') {
|
|
1255
|
-
optionsRef.current.onDropExit(e);
|
|
1256
|
-
}
|
|
1257
|
-
},
|
|
1258
633
|
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
optionsRef.current.onDrop(e);
|
|
1262
|
-
}
|
|
1263
|
-
},
|
|
634
|
+
var $2295dfb4d9d6e70f$exports = {};
|
|
635
|
+
$2295dfb4d9d6e70f$exports = JSON.parse("{\"dragDescriptionKeyboard\":\"Stisknutím klávesy Enter začnete s přetahováním.\",\"dragDescriptionTouch\":\"Poklepáním začnete s přetahováním.\",\"dragDescriptionVirtual\":\"Kliknutím začnete s přetahováním.\",\"dragItem\":\"Přetáhnout {itemText}\",\"dragSelectedItems\":\"Přetáhnout {count, plural, one {# vybranou položku} few {# vybrané položky} other {# vybraných položek}}\",\"dragStartedKeyboard\":\"Začněte s přetahováním. Po stisknutí klávesy Tab najděte požadovaný cíl a stisknutím klávesy Enter přetažení dokončete nebo stisknutím klávesy Esc akci zrušte.\",\"dragStartedTouch\":\"Začněte s přetahováním. Najděte požadovaný cíl a poklepáním přetažení dokončete.\",\"dragStartedVirtual\":\"Začněte s přetahováním. Najděte požadovaný cíl a kliknutím nebo stisknutím klávesy Enter přetažení dokončete.\",\"dropCanceled\":\"Přetažení bylo zrušeno.\",\"dropComplete\":\"Přetažení bylo dokončeno.\",\"dropDescriptionKeyboard\":\"Stisknutím klávesy Enter přetažení dokončete nebo stisknutím klávesy Esc akci zrušte.\",\"dropDescriptionTouch\":\"Poklepáním přetažení dokončete.\",\"dropDescriptionVirtual\":\"Kliknutím objekt přetáhněte.\",\"dropIndicator\":\"indikátor přetažení\",\"dropOnItem\":\"Přetáhnout na {itemText}\",\"dropOnRoot\":\"Přetáhnout na\",\"endDragKeyboard\":\"Probíhá přetahování. Stisknutím klávesy Enter přetažení zrušíte.\",\"endDragTouch\":\"Probíhá přetahování. Poklepáním přetažení zrušíte.\",\"endDragVirtual\":\"Probíhá přetahování. Kliknutím přetažení zrušíte.\",\"insertAfter\":\"Vložit za {itemText}\",\"insertBefore\":\"Vložit před {itemText}\",\"insertBetween\":\"Vložit mezi {beforeItemText} a {afterItemText}\"}");
|
|
1264
636
|
|
|
1265
|
-
onDropActivate(e) {
|
|
1266
|
-
if (typeof optionsRef.current.onDropActivate === 'function') {
|
|
1267
|
-
optionsRef.current.onDropActivate(e);
|
|
1268
|
-
}
|
|
1269
|
-
}
|
|
1270
637
|
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
dropProps
|
|
1274
|
-
} = $ca75888e192994dbb11ae05e54$export$useVirtualDrop();
|
|
1275
|
-
return {
|
|
1276
|
-
dropProps: _babelRuntimeHelpersExtends({}, dropProps, {
|
|
1277
|
-
onDragEnter,
|
|
1278
|
-
onDragOver,
|
|
1279
|
-
onDragLeave,
|
|
1280
|
-
onDrop
|
|
1281
|
-
}),
|
|
1282
|
-
isDropTarget
|
|
1283
|
-
};
|
|
1284
|
-
}
|
|
638
|
+
var $fe12c948c93e9e7c$exports = {};
|
|
639
|
+
$fe12c948c93e9e7c$exports = JSON.parse("{\"dragDescriptionKeyboard\":\"Tryk på Enter for at starte med at trække.\",\"dragDescriptionTouch\":\"Dobbelttryk for at starte med at trække.\",\"dragDescriptionVirtual\":\"Klik for at starte med at trække.\",\"dragItem\":\"Træk {itemText}\",\"dragSelectedItems\":\"Træk {count, plural, one {# valgt element} other {# valgte elementer}}\",\"dragStartedKeyboard\":\"Startet med at trække. Tryk på Tab for at gå til et slip-mål, tryk derefter på Enter for at slippe, eller tryk på Escape for at annullere.\",\"dragStartedTouch\":\"Startet med at trække. Gå til et slip-mål, og dobbelttryk derefter for at slippe.\",\"dragStartedVirtual\":\"Startet med at trække. Gå til et slip-mål, og klik eller tryk derefter på enter for at slippe.\",\"dropCanceled\":\"Slip annulleret.\",\"dropComplete\":\"Slip fuldført.\",\"dropDescriptionKeyboard\":\"Tryk på Enter for at slippe. Tryk på Escape for at annullere trækning.\",\"dropDescriptionTouch\":\"Dobbelttryk for at slippe.\",\"dropDescriptionVirtual\":\"Klik for at slippe.\",\"dropIndicator\":\"slip-indikator\",\"dropOnItem\":\"Slip på {itemText}\",\"dropOnRoot\":\"Slip på\",\"endDragKeyboard\":\"Trækning. Tryk på enter for at annullere træk.\",\"endDragTouch\":\"Trækning. Dobbelttryk for at annullere træk.\",\"endDragVirtual\":\"Trækning. Klik for at annullere trækning.\",\"insertAfter\":\"Indsæt efter {itemText}\",\"insertBefore\":\"Indsæt før {itemText}\",\"insertBetween\":\"Indsæt mellem {beforeItemText} og {afterItemText}\"}");
|
|
1285
640
|
|
|
1286
|
-
exports.useDrop = useDrop;
|
|
1287
641
|
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
let allowedOperations = [];
|
|
642
|
+
var $bd463c5fd759bcd3$exports = {};
|
|
643
|
+
$bd463c5fd759bcd3$exports = JSON.parse("{\"dragDescriptionKeyboard\":\"Drücken Sie die Eingabetaste, um den Ziehvorgang zu starten.\",\"dragDescriptionTouch\":\"Tippen Sie doppelt, um den Ziehvorgang zu starten.\",\"dragDescriptionVirtual\":\"Zum Starten des Ziehvorgangs klicken.\",\"dragItem\":\"{itemText} ziehen\",\"dragSelectedItems\":\"{count, plural, one {# ausgewähltes Objekt} other {# ausgewählte Objekte}} ziehen\",\"dragStartedKeyboard\":\"Ziehvorgang gestartet. Drücken Sie die Tabulatortaste, um zu einem Ablegeziel zu navigieren und drücken Sie dann die Eingabetaste, um das Objekt abzulegen, oder Escape, um den Vorgang abzubrechen.\",\"dragStartedTouch\":\"Ziehvorgang gestartet. Navigieren Sie zu einem Ablegeziel und tippen Sie doppelt, um das Objekt abzulegen.\",\"dragStartedVirtual\":\"Ziehvorgang gestartet. Navigieren Sie zu einem Ablegeziel und klicken Sie oder drücken Sie die Eingabetaste, um das Objekt abzulegen.\",\"dropCanceled\":\"Ablegen abgebrochen.\",\"dropComplete\":\"Ablegen abgeschlossen.\",\"dropDescriptionKeyboard\":\"Drücken Sie die Eingabetaste, um das Objekt abzulegen. Drücken Sie Escape, um den Vorgang abzubrechen.\",\"dropDescriptionTouch\":\"Tippen Sie doppelt, um das Objekt abzulegen.\",\"dropDescriptionVirtual\":\"Zum Ablegen klicken.\",\"dropIndicator\":\"Ablegeanzeiger\",\"dropOnItem\":\"Auf {itemText} ablegen\",\"dropOnRoot\":\"Ablegen auf\",\"endDragKeyboard\":\"Ziehvorgang läuft. Drücken Sie die Eingabetaste, um den Vorgang abzubrechen.\",\"endDragTouch\":\"Ziehvorgang läuft. Tippen Sie doppelt, um den Vorgang abzubrechen.\",\"endDragVirtual\":\"Ziehvorgang läuft. Klicken Sie, um den Vorgang abzubrechen.\",\"insertAfter\":\"Nach {itemText} einfügen\",\"insertBefore\":\"Vor {itemText} einfügen\",\"insertBetween\":\"Zwischen {beforeItemText} und {afterItemText} einfügen\"}");
|
|
1291
644
|
|
|
1292
|
-
if (allowedOperationsBits & $b29ea0269b2ea2bf4827b4fa19ddc83e$export$DROP_OPERATION.move) {
|
|
1293
|
-
allowedOperations.push('move');
|
|
1294
|
-
}
|
|
1295
645
|
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
}
|
|
646
|
+
var $c53fec58c9b57aed$exports = {};
|
|
647
|
+
$c53fec58c9b57aed$exports = JSON.parse("{\"dragDescriptionKeyboard\":\"Πατήστε Enter για έναρξη της μεταφοράς.\",\"dragDescriptionTouch\":\"Πατήστε δύο φορές για έναρξη της μεταφοράς.\",\"dragDescriptionVirtual\":\"Κάντε κλικ για να ξεκινήσετε τη μεταφορά.\",\"dragItem\":\"Μεταφορά {itemText}\",\"dragSelectedItems\":\"Μεταφορά σε {count, plural, one {# επιλεγμένο στοιχείο} other {# επιλεγμένα στοιχεία}}\",\"dragStartedKeyboard\":\"Η μεταφορά ξεκίνησε. Πατήστε το πλήκτρο Tab για να μεταβείτε σε έναν προορισμό απόθεσης και, στη συνέχεια, πατήστε Enter για απόθεση ή πατήστε Escape για ακύρωση.\",\"dragStartedTouch\":\"Η μεταφορά ξεκίνησε. Μεταβείτε σε έναν προορισμό απόθεσης και, στη συνέχεια, πατήστε δύο φορές για απόθεση.\",\"dragStartedVirtual\":\"Η μεταφορά ξεκίνησε. Μεταβείτε σε έναν προορισμό απόθεσης και, στη συνέχεια, κάντε κλικ ή πατήστε Enter για απόθεση.\",\"dropCanceled\":\"Η απόθεση ακυρώθηκε.\",\"dropComplete\":\"Η απόθεση ολοκληρώθηκε.\",\"dropDescriptionKeyboard\":\"Πατήστε Enter για απόθεση. Πατήστε Escape για ακύρωση της μεταφοράς.\",\"dropDescriptionTouch\":\"Πατήστε δύο φορές για απόθεση.\",\"dropDescriptionVirtual\":\"Κάντε κλικ για απόθεση.\",\"dropIndicator\":\"δείκτης απόθεσης\",\"dropOnItem\":\"Απόθεση σε {itemText}\",\"dropOnRoot\":\"Απόθεση σε\",\"endDragKeyboard\":\"Μεταφορά σε εξέλιξη. Πατήστε Enter για ακύρωση της μεταφοράς.\",\"endDragTouch\":\"Μεταφορά σε εξέλιξη. Πατήστε δύο φορές για ακύρωση της μεταφοράς.\",\"endDragVirtual\":\"Μεταφορά σε εξέλιξη. Κάντε κλικ για ακύρωση της μεταφοράς.\",\"insertAfter\":\"Εισαγωγή μετά από {itemText}\",\"insertBefore\":\"Εισαγωγή πριν από {itemText}\",\"insertBetween\":\"Εισαγωγή μεταξύ {beforeItemText} και {afterItemText}\"}");
|
|
1299
648
|
|
|
1300
|
-
if (allowedOperationsBits & $b29ea0269b2ea2bf4827b4fa19ddc83e$export$DROP_OPERATION.link) {
|
|
1301
|
-
allowedOperations.push('link');
|
|
1302
|
-
}
|
|
1303
649
|
|
|
1304
|
-
|
|
1305
|
-
}
|
|
650
|
+
var $5203da54239cc53b$exports = {};
|
|
651
|
+
$5203da54239cc53b$exports = JSON.parse("{\"dragItem\":\"Drag {itemText}\",\"dragSelectedItems\":\"Drag {count, plural, one {# selected item} other {# selected items}}\",\"dragDescriptionKeyboard\":\"Press Enter to start dragging.\",\"dragDescriptionTouch\":\"Double tap to start dragging.\",\"dragDescriptionVirtual\":\"Click to start dragging.\",\"dragStartedKeyboard\":\"Started dragging. Press Tab to navigate to a drop target, then press Enter to drop, or press Escape to cancel.\",\"dragStartedTouch\":\"Started dragging. Navigate to a drop target, then double tap to drop.\",\"dragStartedVirtual\":\"Started dragging. Navigate to a drop target, then click or press Enter to drop.\",\"endDragKeyboard\":\"Dragging. Press Enter to cancel drag.\",\"endDragTouch\":\"Dragging. Double tap to cancel drag.\",\"endDragVirtual\":\"Dragging. Click to cancel drag.\",\"dropDescriptionKeyboard\":\"Press Enter to drop. Press Escape to cancel drag.\",\"dropDescriptionTouch\":\"Double tap to drop.\",\"dropDescriptionVirtual\":\"Click to drop.\",\"dropCanceled\":\"Drop canceled.\",\"dropComplete\":\"Drop complete.\",\"dropIndicator\":\"drop indicator\",\"dropOnRoot\":\"Drop on\",\"dropOnItem\":\"Drop on {itemText}\",\"insertBefore\":\"Insert before {itemText}\",\"insertBetween\":\"Insert between {beforeItemText} and {afterItemText}\",\"insertAfter\":\"Insert after {itemText}\"}");
|
|
1306
652
|
|
|
1307
|
-
const $cf2100581419e36b2fe8caccc6dbd4b$var$AUTOSCROLL_AREA_SIZE = 20;
|
|
1308
653
|
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
useEffect(() => {
|
|
1312
|
-
if (ref.current) {
|
|
1313
|
-
scrollableRef.current = getScrollParent(ref.current);
|
|
1314
|
-
}
|
|
1315
|
-
}, [ref]);
|
|
1316
|
-
let state = useRef({
|
|
1317
|
-
timer: null,
|
|
1318
|
-
dx: 0,
|
|
1319
|
-
dy: 0
|
|
1320
|
-
}).current;
|
|
1321
|
-
let scroll = useCallback(() => {
|
|
1322
|
-
scrollableRef.current.scrollLeft += state.dx;
|
|
1323
|
-
scrollableRef.current.scrollTop += state.dy;
|
|
1324
|
-
|
|
1325
|
-
if (state.timer) {
|
|
1326
|
-
state.timer = requestAnimationFrame(scroll);
|
|
1327
|
-
}
|
|
1328
|
-
}, [scrollableRef, state]);
|
|
1329
|
-
return {
|
|
1330
|
-
move(x, y) {
|
|
1331
|
-
// Most browsers auto scroll natively, but WebKit on macOS does not (iOS does 🤷♂️).
|
|
1332
|
-
// https://bugs.webkit.org/show_bug.cgi?id=222636
|
|
1333
|
-
if (!isWebKit() || isIOS() || !scrollableRef.current) {
|
|
1334
|
-
return;
|
|
1335
|
-
}
|
|
654
|
+
var $f8a76c76a7827fc9$exports = {};
|
|
655
|
+
$f8a76c76a7827fc9$exports = JSON.parse("{\"dragDescriptionKeyboard\":\"Pulse Intro para empezar a arrastrar.\",\"dragDescriptionTouch\":\"Pulse dos veces para iniciar el arrastre.\",\"dragDescriptionVirtual\":\"Haga clic para iniciar el arrastre.\",\"dragItem\":\"Arrastrar {itemText}\",\"dragSelectedItems\":\"Arrastrar {count, plural, one {# elemento seleccionado} other {# elementos seleccionados}}\",\"dragStartedKeyboard\":\"Se ha empezado a arrastrar. Pulse el tabulador para ir al destino de colocación y, a continuación, pulse Intro para soltar, o pulse Escape para cancelar.\",\"dragStartedTouch\":\"Se ha empezado a arrastrar. Vaya al destino de colocación y, a continuación, pulse dos veces para soltar.\",\"dragStartedVirtual\":\"Se ha empezado a arrastrar. Vaya al destino de colocación y, a continuación, haga clic o pulse Intro para soltar.\",\"dropCanceled\":\"Se ha cancelado la colocación.\",\"dropComplete\":\"Colocación finalizada.\",\"dropDescriptionKeyboard\":\"Pulse Intro para soltar. Pulse Escape para cancelar el arrastre.\",\"dropDescriptionTouch\":\"Pulse dos veces para soltar.\",\"dropDescriptionVirtual\":\"Haga clic para soltar.\",\"dropIndicator\":\"indicador de colocación\",\"dropOnItem\":\"Soltar en {itemText}\",\"dropOnRoot\":\"Soltar en\",\"endDragKeyboard\":\"Arrastrando. Pulse Intro para cancelar el arrastre.\",\"endDragTouch\":\"Arrastrando. Pulse dos veces para cancelar el arrastre.\",\"endDragVirtual\":\"Arrastrando. Haga clic para cancelar el arrastre.\",\"insertAfter\":\"Insertar después de {itemText}\",\"insertBefore\":\"Insertar antes de {itemText}\",\"insertBetween\":\"Insertar entre {beforeItemText} y {afterItemText}\"}");
|
|
1336
656
|
|
|
1337
|
-
let box = scrollableRef.current.getBoundingClientRect();
|
|
1338
|
-
let left = $cf2100581419e36b2fe8caccc6dbd4b$var$AUTOSCROLL_AREA_SIZE;
|
|
1339
|
-
let top = $cf2100581419e36b2fe8caccc6dbd4b$var$AUTOSCROLL_AREA_SIZE;
|
|
1340
|
-
let bottom = box.height - $cf2100581419e36b2fe8caccc6dbd4b$var$AUTOSCROLL_AREA_SIZE;
|
|
1341
|
-
let right = box.width - $cf2100581419e36b2fe8caccc6dbd4b$var$AUTOSCROLL_AREA_SIZE;
|
|
1342
|
-
|
|
1343
|
-
if (x < left || x > right || y < top || y > bottom) {
|
|
1344
|
-
if (x < left) {
|
|
1345
|
-
state.dx = x - left;
|
|
1346
|
-
} else if (x > right) {
|
|
1347
|
-
state.dx = x - right;
|
|
1348
|
-
}
|
|
1349
657
|
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
} else if (y > bottom) {
|
|
1353
|
-
state.dy = y - bottom;
|
|
1354
|
-
}
|
|
658
|
+
var $18a37c0580c6872d$exports = {};
|
|
659
|
+
$18a37c0580c6872d$exports = JSON.parse("{\"dragDescriptionKeyboard\":\"Lohistamise alustamiseks vajutage klahvi Enter.\",\"dragDescriptionTouch\":\"Topeltpuudutage lohistamise alustamiseks.\",\"dragDescriptionVirtual\":\"Klõpsake lohistamise alustamiseks.\",\"dragItem\":\"Lohista {itemText}\",\"dragSelectedItems\":\"Lohista {count, plural, one {# valitud üksust} other {# valitud üksust}}\",\"dragStartedKeyboard\":\"Alustati lohistamist. Kukutamise sihtmärgi juurde navigeerimiseks vajutage klahvi Tab, seejärel vajutage kukutamiseks klahvi Enter või loobumiseks klahvi Escape.\",\"dragStartedTouch\":\"Alustati lohistamist. Navigeerige kukutamise sihtmärgi juurde ja topeltpuudutage kukutamiseks.\",\"dragStartedVirtual\":\"Alustati lohistamist. Navigeerige kukutamise sihtmärgi juurde ja kukutamiseks klõpsake või vajutage klahvi Enter.\",\"dropCanceled\":\"Lohistamisest loobuti.\",\"dropComplete\":\"Lohistamine on tehtud.\",\"dropDescriptionKeyboard\":\"Kukutamiseks vajutage klahvi Enter. Lohistamisest loobumiseks vajutage klahvi Escape.\",\"dropDescriptionTouch\":\"Kukutamiseks topeltpuudutage.\",\"dropDescriptionVirtual\":\"Kukutamiseks klõpsake.\",\"dropIndicator\":\"lohistamise indikaator\",\"dropOnItem\":\"Kukuta asukohta {itemText}\",\"dropOnRoot\":\"Kukuta asukohta\",\"endDragKeyboard\":\"Lohistamine. Lohistamisest loobumiseks vajutage klahvi Enter.\",\"endDragTouch\":\"Lohistamine. Lohistamisest loobumiseks topeltpuudutage.\",\"endDragVirtual\":\"Lohistamine. Lohistamisest loobumiseks klõpsake.\",\"insertAfter\":\"Sisesta {itemText} järele\",\"insertBefore\":\"Sisesta {itemText} ette\",\"insertBetween\":\"Sisesta {beforeItemText} ja {afterItemText} vahele\"}");
|
|
1355
660
|
|
|
1356
|
-
if (!state.timer) {
|
|
1357
|
-
state.timer = requestAnimationFrame(scroll);
|
|
1358
|
-
}
|
|
1359
|
-
} else {
|
|
1360
|
-
this.stop();
|
|
1361
|
-
}
|
|
1362
|
-
},
|
|
1363
661
|
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
cancelAnimationFrame(state.timer);
|
|
1367
|
-
state.timer = null;
|
|
1368
|
-
}
|
|
1369
|
-
}
|
|
662
|
+
var $c83ae802bb286dd5$exports = {};
|
|
663
|
+
$c83ae802bb286dd5$exports = JSON.parse("{\"dragDescriptionKeyboard\":\"Aloita vetäminen painamalla Enter-näppäintä.\",\"dragDescriptionTouch\":\"Aloita vetäminen kaksoisnapauttamalla.\",\"dragDescriptionVirtual\":\"Aloita vetäminen napsauttamalla.\",\"dragItem\":\"Vedä kohdetta {itemText}\",\"dragSelectedItems\":\"Vedä {count, plural, one {# valittua kohdetta} other {# valittua kohdetta}}\",\"dragStartedKeyboard\":\"Vetäminen aloitettu. Siirry pudotuskohteeseen painamalla sarkainnäppäintä ja sitten pudota painamalla Enter-näppäintä tai peruuta painamalla Escape-näppäintä.\",\"dragStartedTouch\":\"Vetäminen aloitettu. Siirry pudotuskohteeseen ja pudota kaksoisnapauttamalla.\",\"dragStartedVirtual\":\"Vetäminen aloitettu. Siirry pudotuskohteeseen ja pudota napsauttamalla tai painamalla Enter-näppäintä.\",\"dropCanceled\":\"Pudotus peruutettu.\",\"dropComplete\":\"Pudotus suoritettu.\",\"dropDescriptionKeyboard\":\"Pudota painamalla Enter-näppäintä. Peruuta vetäminen painamalla Escape-näppäintä.\",\"dropDescriptionTouch\":\"Pudota kaksoisnapauttamalla.\",\"dropDescriptionVirtual\":\"Pudota napsauttamalla.\",\"dropIndicator\":\"pudotuksen ilmaisin\",\"dropOnItem\":\"Pudota kohteeseen {itemText}\",\"dropOnRoot\":\"Pudota kohteeseen\",\"endDragKeyboard\":\"Vedetään. Peruuta vetäminen painamalla Enter-näppäintä.\",\"endDragTouch\":\"Vedetään. Peruuta vetäminen kaksoisnapauttamalla.\",\"endDragVirtual\":\"Vedetään. Peruuta vetäminen napsauttamalla.\",\"insertAfter\":\"Lisää kohteen {itemText} jälkeen\",\"insertBefore\":\"Lisää ennen kohdetta {itemText}\",\"insertBetween\":\"Lisää kohteiden {beforeItemText} ja {afterItemText} väliin\"}");
|
|
1370
664
|
|
|
1371
|
-
};
|
|
1372
|
-
}
|
|
1373
665
|
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
function useDroppableCollection(props, state, ref) {
|
|
1377
|
-
let localState = useRef({
|
|
1378
|
-
props,
|
|
1379
|
-
state,
|
|
1380
|
-
nextTarget: null,
|
|
1381
|
-
dropOperation: null
|
|
1382
|
-
}).current;
|
|
1383
|
-
localState.props = props;
|
|
1384
|
-
localState.state = state;
|
|
1385
|
-
let autoScroll = $cf2100581419e36b2fe8caccc6dbd4b$export$useAutoScroll(ref);
|
|
1386
|
-
let {
|
|
1387
|
-
dropProps
|
|
1388
|
-
} = useDrop({
|
|
1389
|
-
ref,
|
|
1390
|
-
|
|
1391
|
-
onDropEnter(e) {
|
|
1392
|
-
let target = props.getDropTargetFromPoint(e.x, e.y);
|
|
1393
|
-
state.setTarget(target);
|
|
1394
|
-
},
|
|
666
|
+
var $4f6107d6a00a2dc5$exports = {};
|
|
667
|
+
$4f6107d6a00a2dc5$exports = JSON.parse("{\"dragDescriptionKeyboard\":\"Appuyez sur Entrée pour commencer le déplacement.\",\"dragDescriptionTouch\":\"Touchez deux fois pour commencer le déplacement.\",\"dragDescriptionVirtual\":\"Cliquez pour commencer le déplacement.\",\"dragItem\":\"Déplacer {itemText}\",\"dragSelectedItems\":\"Déplacer {count, plural, one {# élément sélectionné} other {# éléments sélectionnés}}\",\"dragStartedKeyboard\":\"Déplacement commencé. Appuyez sur Tabulation pour accéder à une cible de dépôt, puis appuyez sur Entrée pour déposer, ou appuyez sur Échap pour annuler.\",\"dragStartedTouch\":\"Déplacement commencé. Accédez à une cible de dépôt, puis touchez deux fois pour déposer.\",\"dragStartedVirtual\":\"Déplacement commencé. Accédez à une cible de dépôt, puis cliquez ou appuyez sur Entrée pour déposer.\",\"dropCanceled\":\"Dépôt annulé.\",\"dropComplete\":\"Dépôt terminé.\",\"dropDescriptionKeyboard\":\"Appuyez sur Entrée pour déposer. Appuyez sur Échap pour annuler le déplacement.\",\"dropDescriptionTouch\":\"Touchez deux fois pour déposer.\",\"dropDescriptionVirtual\":\"Cliquez pour déposer.\",\"dropIndicator\":\"indicateur de dépôt\",\"dropOnItem\":\"Déposer sur {itemText}\",\"dropOnRoot\":\"Déposer sur\",\"endDragKeyboard\":\"Déplacement. Appuyez sur Entrée pour annuler le déplacement.\",\"endDragTouch\":\"Déplacement. Touchez deux fois pour annuler le déplacement.\",\"endDragVirtual\":\"Déplacement. Cliquez pour annuler le déplacement.\",\"insertAfter\":\"Insérer après {itemText}\",\"insertBefore\":\"Insérer avant {itemText}\",\"insertBetween\":\"Insérer entre {beforeItemText} et {afterItemText}\"}");
|
|
1395
668
|
|
|
1396
|
-
onDropMove(e) {
|
|
1397
|
-
state.setTarget(localState.nextTarget);
|
|
1398
|
-
autoScroll.move(e.x, e.y);
|
|
1399
|
-
},
|
|
1400
669
|
|
|
1401
|
-
|
|
1402
|
-
|
|
670
|
+
var $f8a8643ec8fb63f3$exports = {};
|
|
671
|
+
$f8a8643ec8fb63f3$exports = JSON.parse("{\"dragDescriptionKeyboard\":\"הקש על Enter כדי להתחיל לגרור.\",\"dragDescriptionTouch\":\"הקש פעמיים כדי להתחיל בגרירה.\",\"dragDescriptionVirtual\":\"לחץ כדי להתחיל לגרור.\",\"dragItem\":\"גרור את {itemText}\",\"dragSelectedItems\":\"גרור {count, plural, one {פריט נבחר #} other {# פריטים שנבחרו}}\",\"dragStartedKeyboard\":\"התחלת לגרור. הקש על Tab כדי לנווט לנקודת הגרירה ולאחר מכן הקש על Enter כדי לשחרר או על Escape כדי לבטל.\",\"dragStartedTouch\":\"התחלת לגרור. נווט לנקודת השחרור ולאחר מכן הקש פעמיים כדי לשחרר.\",\"dragStartedVirtual\":\"התחלת לגרור. נווט לנקודת השחרור ולאחר מכן לחץ או הקש על Enter כדי לשחרר.\",\"dropCanceled\":\"השחרור בוטל.\",\"dropComplete\":\"השחרור הושלם.\",\"dropDescriptionKeyboard\":\"הקש על Enter כדי לשחרר. הקש על Escape כדי לבטל את הגרירה.\",\"dropDescriptionTouch\":\"הקש פעמיים כדי לשחרר.\",\"dropDescriptionVirtual\":\"לחץ כדי לשחרר.\",\"dropIndicator\":\"מחוון שחרור\",\"dropOnItem\":\"שחרר על {itemText}\",\"dropOnRoot\":\"שחרר על\",\"endDragKeyboard\":\"גורר. הקש על Enter כדי לבטל את הגרירה.\",\"endDragTouch\":\"גורר. הקש פעמיים כדי לבטל את הגרירה.\",\"endDragVirtual\":\"גורר. לחץ כדי לבטל את הגרירה.\",\"insertAfter\":\"הוסף אחרי {itemText}\",\"insertBefore\":\"הוסף לפני {itemText}\",\"insertBetween\":\"הוסף בין {beforeItemText} לבין {afterItemText}\"}");
|
|
1403
672
|
|
|
1404
|
-
if (!target) {
|
|
1405
|
-
localState.dropOperation = 'cancel';
|
|
1406
|
-
localState.nextTarget = null;
|
|
1407
|
-
return 'cancel';
|
|
1408
|
-
}
|
|
1409
673
|
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
return localState.dropOperation;
|
|
1413
|
-
}
|
|
674
|
+
var $d625f0563955824c$exports = {};
|
|
675
|
+
$d625f0563955824c$exports = JSON.parse("{\"dragDescriptionKeyboard\":\"Pritisnite Enter da biste počeli povlačiti.\",\"dragDescriptionTouch\":\"Dvaput dodirnite da biste počeli povlačiti.\",\"dragDescriptionVirtual\":\"Kliknite da biste počeli povlačiti.\",\"dragItem\":\"Povucite stavku {itemText}\",\"dragSelectedItems\":\"Povucite {count, plural, one {# odabranu stavku} other {ovoliko odabranih stavki: #}}\",\"dragStartedKeyboard\":\"Počeli ste povlačiti. Pritisnite tipku tabulatora da biste došli do cilja ispuštanja, a zatim Enter da biste ispustili stavku ili Escape da biste prekinuli povlačenje.\",\"dragStartedTouch\":\"Počeli ste povlačiti. Dođite do cilja ispuštanja, a zatim dvaput dodirnite da biste ispustili stavku.\",\"dragStartedVirtual\":\"Počeli ste povlačiti. Dođite do cilja ispuštanja, a zatim kliknite ili pritisnite Enter da biste ispustili stavku.\",\"dropCanceled\":\"Povlačenje je prekinuto.\",\"dropComplete\":\"Ispuštanje je dovršeno.\",\"dropDescriptionKeyboard\":\"Pritisnite Enter da biste ispustili stavku. Pritisnite Escape da biste prekinuli povlačenje.\",\"dropDescriptionTouch\":\"Dvaput dodirnite da biste ispustili stavku.\",\"dropDescriptionVirtual\":\"Kliknite da biste ispustili stavku.\",\"dropIndicator\":\"pokazatelj ispuštanja\",\"dropOnItem\":\"Ispustite na stavku {itemText}\",\"dropOnRoot\":\"Ispustite na\",\"endDragKeyboard\":\"Povlačenje. Pritisnite Enter da biste prekinuli povlačenje.\",\"endDragTouch\":\"Povlačenje. Dvaput dodirnite da biste prekinuli povlačenje.\",\"endDragVirtual\":\"Povlačenje. Kliknite da biste prekinuli povlačenje.\",\"insertAfter\":\"Umetnite iza stavke {itemText}\",\"insertBefore\":\"Ispustite ispred stavke {itemText}\",\"insertBetween\":\"Umetnite između stavki {beforeItemText} i {afterItemText}\"}");
|
|
1414
676
|
|
|
1415
|
-
localState.dropOperation = state.getDropOperation(target, types, allowedOperations); // If the target doesn't accept the drop, see if the root accepts it instead.
|
|
1416
677
|
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
type: 'root'
|
|
1420
|
-
};
|
|
1421
|
-
let dropOperation = state.getDropOperation(rootTarget, types, allowedOperations);
|
|
678
|
+
var $24553ce5446e49c4$exports = {};
|
|
679
|
+
$24553ce5446e49c4$exports = JSON.parse("{\"dragDescriptionKeyboard\":\"Nyomja le az Enter billentyűt a húzás megkezdéséhez.\",\"dragDescriptionTouch\":\"Koppintson duplán a húzás megkezdéséhez.\",\"dragDescriptionVirtual\":\"Kattintson a húzás megkezdéséhez.\",\"dragItem\":\"{itemText} húzása\",\"dragSelectedItems\":\"{count, plural, one {# kijelölt elem} other {# kijelölt elem}} húzása\",\"dragStartedKeyboard\":\"Húzás megkezdve. Nyomja le a Tab billentyűt az elengedési célhoz navigálásához, majd nyomja le az Enter billentyűt az elengedéshez, vagy nyomja le az Escape billentyűt a megszakításhoz.\",\"dragStartedTouch\":\"Húzás megkezdve. Navigáljon egy elengedési célhoz, majd koppintson duplán az elengedéshez.\",\"dragStartedVirtual\":\"Húzás megkezdve. Navigáljon egy elengedési célhoz, majd kattintson vagy nyomja le az Enter billentyűt az elengedéshez.\",\"dropCanceled\":\"Elengedés megszakítva.\",\"dropComplete\":\"Elengedés teljesítve.\",\"dropDescriptionKeyboard\":\"Nyomja le az Enter billentyűt az elengedéshez. Nyomja le az Escape billentyűt a húzás megszakításához.\",\"dropDescriptionTouch\":\"Koppintson duplán az elengedéshez.\",\"dropDescriptionVirtual\":\"Kattintson az elengedéshez.\",\"dropIndicator\":\"elengedésjelző\",\"dropOnItem\":\"Elengedés erre: {itemText}\",\"dropOnRoot\":\"Elengedés erre:\",\"endDragKeyboard\":\"Húzás folyamatban. Nyomja le az Enter billentyűt a húzás megszakításához.\",\"endDragTouch\":\"Húzás folyamatban. Koppintson duplán a húzás megszakításához.\",\"endDragVirtual\":\"Húzás folyamatban. Kattintson a húzás megszakításához.\",\"insertAfter\":\"Beszúrás {itemText} után\",\"insertBefore\":\"Beszúrás {itemText} elé\",\"insertBetween\":\"Beszúrás {beforeItemText} és {afterItemText} közé\"}");
|
|
1422
680
|
|
|
1423
|
-
if (dropOperation !== 'cancel') {
|
|
1424
|
-
target = rootTarget;
|
|
1425
|
-
localState.dropOperation = dropOperation;
|
|
1426
|
-
}
|
|
1427
|
-
}
|
|
1428
681
|
|
|
1429
|
-
|
|
1430
|
-
|
|
1431
|
-
},
|
|
682
|
+
var $950ffefaa2ec3f25$exports = {};
|
|
683
|
+
$950ffefaa2ec3f25$exports = JSON.parse("{\"dragDescriptionKeyboard\":\"Premi Invio per iniziare a trascinare.\",\"dragDescriptionTouch\":\"Tocca due volte per iniziare a trascinare.\",\"dragDescriptionVirtual\":\"Fai clic per iniziare a trascinare.\",\"dragItem\":\"Trascina {itemText}\",\"dragSelectedItems\":\"Trascina {count, plural, one {# altro elemento selezionato} other {# altri elementi selezionati}}\",\"dragStartedKeyboard\":\"Hai iniziato a trascinare. Premi Tab per arrivare sull’area di destinazione, quindi premi Invio per rilasciare o Esc per annullare.\",\"dragStartedTouch\":\"Hai iniziato a trascinare. Arriva sull’area di destinazione, quindi tocca due volte per rilasciare.\",\"dragStartedVirtual\":\"Hai iniziato a trascinare. Arriva sull’area di destinazione, quindi fai clic o premi Invio per rilasciare.\",\"dropCanceled\":\"Rilascio annullato.\",\"dropComplete\":\"Rilascio completato.\",\"dropDescriptionKeyboard\":\"Premi Invio per rilasciare. Premi Esc per annullare.\",\"dropDescriptionTouch\":\"Tocca due volte per rilasciare.\",\"dropDescriptionVirtual\":\"Fai clic per rilasciare.\",\"dropIndicator\":\"indicatore di rilascio\",\"dropOnItem\":\"Rilascia su {itemText}\",\"dropOnRoot\":\"Rilascia su\",\"endDragKeyboard\":\"Trascinamento. Premi Invio per annullare.\",\"endDragTouch\":\"Trascinamento. Tocca due volte per annullare.\",\"endDragVirtual\":\"Trascinamento. Fai clic per annullare.\",\"insertAfter\":\"Inserisci dopo {itemText}\",\"insertBefore\":\"Inserisci prima di {itemText}\",\"insertBetween\":\"Inserisci tra {beforeItemText} e {afterItemText}\"}");
|
|
1432
684
|
|
|
1433
|
-
onDropExit() {
|
|
1434
|
-
state.setTarget(null);
|
|
1435
|
-
autoScroll.stop();
|
|
1436
|
-
},
|
|
1437
685
|
|
|
1438
|
-
|
|
1439
|
-
|
|
686
|
+
var $3da23275963b1c01$exports = {};
|
|
687
|
+
$3da23275963b1c01$exports = JSON.parse("{\"dragDescriptionKeyboard\":\"Enter キーを押してドラッグを開始してください。\",\"dragDescriptionTouch\":\"ダブルタップしてドラッグを開始します。\",\"dragDescriptionVirtual\":\"クリックしてドラッグを開始します。\",\"dragItem\":\"{itemText} をドラッグ\",\"dragSelectedItems\":\"{count, plural, one {# 個の選択項目} other {# 個の選択項目}} をドラッグ\",\"dragStartedKeyboard\":\"ドラッグを開始します。Tab キーを押してドロップターゲットにいどうし、Enter キーを押してドロップするか、Esc キーを押してキャンセルします。\",\"dragStartedTouch\":\"ドラッグを開始しました。ドロップのターゲットに移動し、ダブルタップしてドロップします。\",\"dragStartedVirtual\":\"ドラッグを開始しました。ドロップのターゲットに移動し、クリックまたは Enter キーを押してドロップします。\",\"dropCanceled\":\"ドロップがキャンセルされました。\",\"dropComplete\":\"ドロップが完了しました。\",\"dropDescriptionKeyboard\":\"Enter キーを押してドロップします。Esc キーを押してドラッグをキャンセルします。\",\"dropDescriptionTouch\":\"ダブルタップしてドロップします。\",\"dropDescriptionVirtual\":\"クリックしてドロップします。\",\"dropIndicator\":\"ドロップインジケーター\",\"dropOnItem\":\"{itemText} にドロップ\",\"dropOnRoot\":\"ドロップ場所\",\"endDragKeyboard\":\"ドラッグしています。Enter キーを押してドラッグをキャンセルします。\",\"endDragTouch\":\"ドラッグしています。ダブルタップしてドラッグをキャンセルします。\",\"endDragVirtual\":\"ドラッグしています。クリックしてドラッグをキャンセルします。\",\"insertAfter\":\"{itemText} の後に挿入\",\"insertBefore\":\"{itemText} の前に挿入\",\"insertBetween\":\"{beforeItemText} と {afterItemText} の間に挿入\"}");
|
|
1440
688
|
|
|
1441
|
-
if (((_state$target = state.target) == null ? void 0 : _state$target.type) === 'item' && ((_state$target2 = state.target) == null ? void 0 : _state$target2.dropPosition) === 'on' && typeof props.onDropActivate === 'function') {
|
|
1442
|
-
props.onDropActivate({
|
|
1443
|
-
type: 'dropactivate',
|
|
1444
|
-
x: e.x,
|
|
1445
|
-
// todo
|
|
1446
|
-
y: e.y,
|
|
1447
|
-
target: state.target
|
|
1448
|
-
});
|
|
1449
|
-
}
|
|
1450
|
-
},
|
|
1451
689
|
|
|
1452
|
-
|
|
1453
|
-
|
|
1454
|
-
onDrop(e, state.target);
|
|
1455
|
-
}
|
|
1456
|
-
}
|
|
690
|
+
var $207c86ace90f7cb9$exports = {};
|
|
691
|
+
$207c86ace90f7cb9$exports = JSON.parse("{\"dragDescriptionKeyboard\":\"드래그를 시작하려면 Enter를 누르세요.\",\"dragDescriptionTouch\":\"드래그를 시작하려면 더블 탭하세요.\",\"dragDescriptionVirtual\":\"드래그를 시작하려면 클릭하세요.\",\"dragItem\":\"{itemText} 드래그\",\"dragSelectedItems\":\"{count, plural, one {#개 선택 항목} other {#개 선택 항목}} 드래그\",\"dragStartedKeyboard\":\"드래그가 시작되었습니다. Tab을 눌러 드롭 대상으로 이동한 다음 Enter를 눌러 드롭하거나 Esc를 눌러 취소하세요.\",\"dragStartedTouch\":\"드래그가 시작되었습니다. 드롭 대상으로 이동한 다음 더블 탭하여 드롭하세요.\",\"dragStartedVirtual\":\"드래그가 시작되었습니다. 드롭 대상으로 이동한 다음 클릭하거나 Enter를 눌러 드롭하세요.\",\"dropCanceled\":\"드롭이 취소되었습니다.\",\"dropComplete\":\"드롭이 완료되었습니다.\",\"dropDescriptionKeyboard\":\"드롭하려면 Enter를 누르세요. 드래그를 취소하려면 Esc를 누르세요.\",\"dropDescriptionTouch\":\"더블 탭하여 드롭하세요.\",\"dropDescriptionVirtual\":\"드롭하려면 클릭하세요.\",\"dropIndicator\":\"드롭 표시기\",\"dropOnItem\":\"{itemText}에 드롭\",\"dropOnRoot\":\"드롭 대상\",\"endDragKeyboard\":\"드래그 중입니다. 드래그를 취소하려면 Enter를 누르세요.\",\"endDragTouch\":\"드래그 중입니다. 드래그를 취소하려면 더블 탭하세요.\",\"endDragVirtual\":\"드래그 중입니다. 드래그를 취소하려면 클릭하세요.\",\"insertAfter\":\"{itemText} 이후에 삽입\",\"insertBefore\":\"{itemText} 이전에 삽입\",\"insertBetween\":\"{beforeItemText} 및 {afterItemText} 사이에 삽입\"}");
|
|
1457
692
|
|
|
1458
|
-
});
|
|
1459
|
-
let droppingState = useRef(null);
|
|
1460
|
-
let onDrop = useCallback((e, target) => {
|
|
1461
|
-
let {
|
|
1462
|
-
state
|
|
1463
|
-
} = localState; // Focus the collection.
|
|
1464
|
-
|
|
1465
|
-
state.selectionManager.setFocused(true); // Save some state of the collection/selection before the drop occurs so we can compare later.
|
|
1466
|
-
|
|
1467
|
-
let focusedKey = state.selectionManager.focusedKey;
|
|
1468
|
-
droppingState.current = {
|
|
1469
|
-
timeout: null,
|
|
1470
|
-
focusedKey,
|
|
1471
|
-
collection: state.collection,
|
|
1472
|
-
selectedKeys: state.selectionManager.selectedKeys
|
|
1473
|
-
};
|
|
1474
|
-
localState.props.onDrop({
|
|
1475
|
-
type: 'drop',
|
|
1476
|
-
x: e.x,
|
|
1477
|
-
// todo
|
|
1478
|
-
y: e.y,
|
|
1479
|
-
target,
|
|
1480
|
-
items: e.items,
|
|
1481
|
-
dropOperation: e.dropOperation
|
|
1482
|
-
}); // Wait for a short time period after the onDrop is called to allow the data to be read asynchronously
|
|
1483
|
-
// and for React to re-render. If an insert occurs during this time, it will be selected/focused below.
|
|
1484
|
-
// If items are not "immediately" inserted by the onDrop handler, the application will need to handle
|
|
1485
|
-
// selecting and focusing those items themselves.
|
|
1486
|
-
|
|
1487
|
-
droppingState.current.timeout = setTimeout(() => {
|
|
1488
|
-
// If focus didn't move already (e.g. due to an insert), and the user dropped on an item,
|
|
1489
|
-
// focus that item and show the focus ring to give the user feedback that the drop occurred.
|
|
1490
|
-
// Also show the focus ring if the focused key is not selected, e.g. in case of a reorder.
|
|
1491
|
-
let {
|
|
1492
|
-
state
|
|
1493
|
-
} = localState;
|
|
1494
|
-
|
|
1495
|
-
if (state.selectionManager.focusedKey === focusedKey) {
|
|
1496
|
-
if (target.type === 'item' && target.dropPosition === 'on' && state.collection.getItem(target.key) != null) {
|
|
1497
|
-
state.selectionManager.setFocusedKey(target.key);
|
|
1498
|
-
state.selectionManager.setFocused(true);
|
|
1499
|
-
setInteractionModality('keyboard');
|
|
1500
|
-
} else if (!state.selectionManager.isSelected(focusedKey)) {
|
|
1501
|
-
setInteractionModality('keyboard');
|
|
1502
|
-
}
|
|
1503
|
-
}
|
|
1504
693
|
|
|
1505
|
-
|
|
1506
|
-
|
|
1507
|
-
}, [localState]); // eslint-disable-next-line arrow-body-style
|
|
694
|
+
var $78c91fe39f28d801$exports = {};
|
|
695
|
+
$78c91fe39f28d801$exports = JSON.parse("{\"dragDescriptionKeyboard\":\"Paspauskite „Enter“, kad pradėtumėte vilkti.\",\"dragDescriptionTouch\":\"Palieskite dukart, kad pradėtumėte vilkti.\",\"dragDescriptionVirtual\":\"Spustelėkite, kad pradėtumėte vilkti.\",\"dragItem\":\"Vilkti {itemText}\",\"dragSelectedItems\":\"Vilkti {count, plural, one {# pasirinktą elementą} other {# pasirinktus elementus}}\",\"dragStartedKeyboard\":\"Pradėta vilkti. Paspauskite „Tab“, kad pereitumėte į tiesioginę paskirties vietą, tada paspauskite „Enter“, kad numestumėte, arba „Escape“, kad atšauktumėte.\",\"dragStartedTouch\":\"Pradėta vilkti. Eikite į tiesioginę paskirties vietą, tada palieskite dukart, kad numestumėte.\",\"dragStartedVirtual\":\"Pradėta vilkti. Eikite į tiesioginę paskirties vietą ir spustelėkite arba paspauskite „Enter“, kad numestumėte.\",\"dropCanceled\":\"Numetimas atšauktas.\",\"dropComplete\":\"Numesta.\",\"dropDescriptionKeyboard\":\"Paspauskite „Enter“, kad numestumėte. Paspauskite „Escape“, kad atšauktumėte vilkimą.\",\"dropDescriptionTouch\":\"Palieskite dukart, kad numestumėte.\",\"dropDescriptionVirtual\":\"Spustelėkite, kad numestumėte.\",\"dropIndicator\":\"numetimo indikatorius\",\"dropOnItem\":\"Numesti ant {itemText}\",\"dropOnRoot\":\"Numesti ant\",\"endDragKeyboard\":\"Velkama. Paspauskite „Enter“, kad atšauktumėte vilkimą.\",\"endDragTouch\":\"Velkama. Spustelėkite dukart, kad atšauktumėte vilkimą.\",\"endDragVirtual\":\"Velkama. Spustelėkite, kad atšauktumėte vilkimą.\",\"insertAfter\":\"Įterpti po {itemText}\",\"insertBefore\":\"Įterpti prieš {itemText}\",\"insertBetween\":\"Įterpti tarp {beforeItemText} ir {afterItemText}\"}");
|
|
1508
696
|
|
|
1509
|
-
useEffect(() => {
|
|
1510
|
-
return () => {
|
|
1511
|
-
if (droppingState.current) {
|
|
1512
|
-
clearTimeout(droppingState.current.timeout);
|
|
1513
|
-
}
|
|
1514
|
-
};
|
|
1515
|
-
}, []);
|
|
1516
|
-
useLayoutEffect(() => {
|
|
1517
|
-
// If an insert occurs during a drop, we want to immediately select these items to give
|
|
1518
|
-
// feedback to the user that a drop occurred. Only do this if the selection didn't change
|
|
1519
|
-
// since the drop started so we don't override if the user or application did something.
|
|
1520
|
-
if (droppingState.current && state.selectionManager.isFocused && state.collection.size > droppingState.current.collection.size && state.selectionManager.isSelectionEqual(droppingState.current.selectedKeys)) {
|
|
1521
|
-
let newKeys = new Set();
|
|
1522
|
-
|
|
1523
|
-
for (let key of state.collection.getKeys()) {
|
|
1524
|
-
if (!droppingState.current.collection.getItem(key)) {
|
|
1525
|
-
newKeys.add(key);
|
|
1526
|
-
}
|
|
1527
|
-
}
|
|
1528
697
|
|
|
1529
|
-
|
|
1530
|
-
|
|
1531
|
-
// is some indication that items were added.
|
|
698
|
+
var $10dc7abacb309b1d$exports = {};
|
|
699
|
+
$10dc7abacb309b1d$exports = JSON.parse("{\"dragDescriptionKeyboard\":\"Nospiediet Enter, lai sāktu vilkšanu.\",\"dragDescriptionTouch\":\"Veiciet dubultskārienu, lai sāktu vilkšanu.\",\"dragDescriptionVirtual\":\"Noklikšķiniet, lai sāktu vilkšanu.\",\"dragItem\":\"Velciet {itemText}\",\"dragSelectedItems\":\"Velciet {count, plural, one {# atlasīto vienumu} other {# atlasītos vienumus}}\",\"dragStartedKeyboard\":\"Uzsākta vilkšana. Nospiediet taustiņu Tab, lai pārietu uz nomešanas mērķi, pēc tam nospiediet Enter, lai nomestu, vai nospiediet Escape, lai atceltu.\",\"dragStartedTouch\":\"Uzsākta vilkšana. Pārejiet uz nomešanas mērķi, pēc tam veiciet dubultskārienu, lai nomestu.\",\"dragStartedVirtual\":\"Uzsākta vilkšana. Pārejiet uz nomešanas mērķi, pēc tam nospiediet Enter, lai nomestu.\",\"dropCanceled\":\"Nomešana atcelta.\",\"dropComplete\":\"Nomešana pabeigta.\",\"dropDescriptionKeyboard\":\"Nospiediet Enter, lai nomestu. Nospiediet Escape, lai atceltu vilkšanu.\",\"dropDescriptionTouch\":\"Veiciet dubultskārienu, lai nomestu.\",\"dropDescriptionVirtual\":\"Noklikšķiniet, lai nomestu.\",\"dropIndicator\":\"nomešanas indikators\",\"dropOnItem\":\"Nometiet uz {itemText}\",\"dropOnRoot\":\"Nometiet uz\",\"endDragKeyboard\":\"Notiek vilkšana. Nospiediet Enter, lai atceltu vilkšanu.\",\"endDragTouch\":\"Notiek vilkšana. Veiciet dubultskārienu, lai atceltu vilkšanu.\",\"endDragVirtual\":\"Notiek vilkšana. Noklikšķiniet, lai atceltu vilkšanu.\",\"insertAfter\":\"Ievietojiet pēc {itemText}\",\"insertBefore\":\"Ievietojiet pirms {itemText}\",\"insertBetween\":\"Ievietojiet starp {beforeItemText} un {afterItemText}\"}");
|
|
1532
700
|
|
|
1533
|
-
if (state.selectionManager.focusedKey === droppingState.current.focusedKey) {
|
|
1534
|
-
let first = newKeys.keys().next().value;
|
|
1535
|
-
state.selectionManager.setFocusedKey(first);
|
|
1536
701
|
|
|
1537
|
-
|
|
1538
|
-
|
|
1539
|
-
}
|
|
1540
|
-
}
|
|
702
|
+
var $378f79a263916098$exports = {};
|
|
703
|
+
$378f79a263916098$exports = JSON.parse("{\"dragDescriptionKeyboard\":\"Trykk på Enter for å begynne å dra.\",\"dragDescriptionTouch\":\"Dobbelttrykk for å begynne å dra.\",\"dragDescriptionVirtual\":\"Klikk for å begynne å dra.\",\"dragItem\":\"Dra {itemText}\",\"dragSelectedItems\":\"Dra {count, plural, one {# merket element} other {# merkede elementer}}\",\"dragStartedKeyboard\":\"Begynte å dra. Trykk på Tab for å navigere til et mål, og trykk deretter på Enter for å slippe eller på Esc for å avbryte.\",\"dragStartedTouch\":\"Begynte å dra. Naviger til et mål, og dobbelttrykk for å slippe.\",\"dragStartedVirtual\":\"Begynte å dra. Naviger til et mål, og klikk eller trykk på Enter for å slippe.\",\"dropCanceled\":\"Avbrøt slipping.\",\"dropComplete\":\"Slippingen er fullført.\",\"dropDescriptionKeyboard\":\"Trykk på Enter for å slippe. Trykk på Esc hvis du vil avbryte draingen.\",\"dropDescriptionTouch\":\"Dobbelttrykk for å slippe.\",\"dropDescriptionVirtual\":\"Klikk for å slippe.\",\"dropIndicator\":\"slippeindikator\",\"dropOnItem\":\"Slipp på {itemText}\",\"dropOnRoot\":\"Slipp på\",\"endDragKeyboard\":\"Drar. Trykk på Enter hvis du vil avbryte.\",\"endDragTouch\":\"Drar. Dobbelttrykk hvis du vil avbryte.\",\"endDragVirtual\":\"Drar. Klikk hvis du vil avbryte.\",\"insertAfter\":\"Sett inn etter {itemText}\",\"insertBefore\":\"Sett inn før {itemText}\",\"insertBetween\":\"Sett inn mellom {beforeItemText} og {afterItemText}\"}");
|
|
1541
704
|
|
|
1542
|
-
droppingState.current = null;
|
|
1543
|
-
}
|
|
1544
|
-
});
|
|
1545
|
-
useEffect(() => {
|
|
1546
|
-
let getNextTarget = function getNextTarget(target, wrap) {
|
|
1547
|
-
if (wrap === void 0) {
|
|
1548
|
-
wrap = true;
|
|
1549
|
-
}
|
|
1550
705
|
|
|
1551
|
-
|
|
1552
|
-
|
|
1553
|
-
type: 'root'
|
|
1554
|
-
};
|
|
1555
|
-
}
|
|
706
|
+
var $bb7919a8dd63447a$exports = {};
|
|
707
|
+
$bb7919a8dd63447a$exports = JSON.parse("{\"dragDescriptionKeyboard\":\"Druk op Enter om te slepen.\",\"dragDescriptionTouch\":\"Dubbeltik om te slepen.\",\"dragDescriptionVirtual\":\"Klik om met slepen te starten.\",\"dragItem\":\"{itemText} slepen\",\"dragSelectedItems\":\"{count, plural, one {# geselecteerd item} other {# geselecteerde items}} slepen\",\"dragStartedKeyboard\":\"Begonnen met slepen. Druk op Tab om naar een locatie te gaan. Druk dan op Enter om neer te zetten, of op Esc om te annuleren.\",\"dragStartedTouch\":\"Begonnen met slepen. Ga naar de gewenste locatie en dubbeltik om neer te zetten.\",\"dragStartedVirtual\":\"Begonnen met slepen. Ga naar de gewenste locatie en klik of druk op Enter om neer te zetten.\",\"dropCanceled\":\"Neerzetten geannuleerd.\",\"dropComplete\":\"Neerzetten voltooid.\",\"dropDescriptionKeyboard\":\"Druk op Enter om neer te zetten. Druk op Esc om het slepen te annuleren.\",\"dropDescriptionTouch\":\"Dubbeltik om neer te zetten.\",\"dropDescriptionVirtual\":\"Klik om neer te zetten.\",\"dropIndicator\":\"aanwijzer voor neerzetten\",\"dropOnItem\":\"Neerzetten op {itemText}\",\"dropOnRoot\":\"Neerzetten op\",\"endDragKeyboard\":\"Bezig met slepen. Druk op Enter om te annuleren.\",\"endDragTouch\":\"Bezig met slepen. Dubbeltik om te annuleren.\",\"endDragVirtual\":\"Bezig met slepen. Klik om te annuleren.\",\"insertAfter\":\"Plaatsen na {itemText}\",\"insertBefore\":\"Plaatsen vóór {itemText}\",\"insertBetween\":\"Plaatsen tussen {beforeItemText} en {afterItemText}\"}");
|
|
1556
708
|
|
|
1557
|
-
let {
|
|
1558
|
-
keyboardDelegate
|
|
1559
|
-
} = localState.props;
|
|
1560
|
-
let nextKey = target.type === 'item' ? keyboardDelegate.getKeyBelow(target.key) : keyboardDelegate.getFirstKey();
|
|
1561
|
-
let dropPosition = 'before';
|
|
1562
709
|
|
|
1563
|
-
|
|
1564
|
-
|
|
1565
|
-
let nextDropPosition = $ab6d833b5804400cb02efc69c9302a$var$DROP_POSITIONS[positionIndex + 1];
|
|
710
|
+
var $0dab7c4b200438bb$exports = {};
|
|
711
|
+
$0dab7c4b200438bb$exports = JSON.parse("{\"dragDescriptionKeyboard\":\"Naciśnij Enter, aby rozpocząć przeciąganie.\",\"dragDescriptionTouch\":\"Dotknij dwukrotnie, aby rozpocząć przeciąganie.\",\"dragDescriptionVirtual\":\"Kliknij, aby rozpocząć przeciąganie.\",\"dragItem\":\"Przeciągnij {itemText}\",\"dragSelectedItems\":\"Przeciągnij {count, plural, one {# wybrany element} other {# wybranych elementów}}\",\"dragStartedKeyboard\":\"Rozpoczęto przeciąganie. Naciśnij Tab, aby wybrać miejsce docelowe, a następnie naciśnij Enter, aby upuścić, lub Escape, aby anulować.\",\"dragStartedTouch\":\"Rozpoczęto przeciąganie. Wybierz miejsce, w którym chcesz upuścić element, a następnie dotknij dwukrotnie, aby upuścić.F\",\"dragStartedVirtual\":\"Rozpoczęto przeciąganie. Wybierz miejsce, w którym chcesz upuścić element, a następnie kliknij lub naciśnij Enter, aby upuścić.\",\"dropCanceled\":\"Anulowano upuszczenie.\",\"dropComplete\":\"Zakończono upuszczanie.\",\"dropDescriptionKeyboard\":\"Naciśnij Enter, aby upuścić. Naciśnij Escape, aby anulować przeciągnięcie.\",\"dropDescriptionTouch\":\"Dotknij dwukrotnie, aby upuścić.\",\"dropDescriptionVirtual\":\"Kliknij, aby upuścić.\",\"dropIndicator\":\"wskaźnik upuszczenia\",\"dropOnItem\":\"Upuść na {itemText}\",\"dropOnRoot\":\"Upuść\",\"endDragKeyboard\":\"Przeciąganie. Naciśnij Enter, aby anulować przeciągnięcie.\",\"endDragTouch\":\"Przeciąganie. Kliknij dwukrotnie, aby anulować przeciągnięcie.\",\"endDragVirtual\":\"Przeciąganie. Kliknij, aby anulować przeciąganie.\",\"insertAfter\":\"Umieść za {itemText}\",\"insertBefore\":\"Umieść przed {itemText}\",\"insertBetween\":\"Umieść między {beforeItemText} i {afterItemText}\"}");
|
|
1566
712
|
|
|
1567
|
-
if (positionIndex < $ab6d833b5804400cb02efc69c9302a$var$DROP_POSITIONS.length - 1 && !(nextDropPosition === 'after' && nextKey != null)) {
|
|
1568
|
-
return {
|
|
1569
|
-
type: 'item',
|
|
1570
|
-
key: target.key,
|
|
1571
|
-
dropPosition: nextDropPosition
|
|
1572
|
-
};
|
|
1573
|
-
} // If the last drop position was 'after', then 'before' on the next key is equivalent.
|
|
1574
|
-
// Switch to 'on' instead.
|
|
1575
713
|
|
|
714
|
+
var $320b1b8402761dd9$exports = {};
|
|
715
|
+
$320b1b8402761dd9$exports = JSON.parse("{\"dragDescriptionKeyboard\":\"Pressione Enter para começar a arrastar.\",\"dragDescriptionTouch\":\"Toque duas vezes para começar a arrastar.\",\"dragDescriptionVirtual\":\"Clique para começar a arrastar.\",\"dragItem\":\"Arrastar {itemText}\",\"dragSelectedItems\":\"Arrastar {count, plural, one {# item selecionado} other {# itens selecionados}}\",\"dragStartedKeyboard\":\"Comece a arrastar. Pressione Tab para navegar até um alvo e, em seguida, pressione Enter para soltar ou pressione Escape para cancelar.\",\"dragStartedTouch\":\"Comece a arrastar. Navegue até um alvo e toque duas vezes para soltar.\",\"dragStartedVirtual\":\"Comece a arrastar. Navegue até um alvo e clique ou pressione Enter para soltar.\",\"dropCanceled\":\"Liberação cancelada.\",\"dropComplete\":\"Liberação concluída.\",\"dropDescriptionKeyboard\":\"Pressione Enter para soltar. Pressione Escape para cancelar.\",\"dropDescriptionTouch\":\"Toque duas vezes para soltar.\",\"dropDescriptionVirtual\":\"Clique para soltar.\",\"dropIndicator\":\"indicador de liberação\",\"dropOnItem\":\"Soltar em {itemText}\",\"dropOnRoot\":\"Soltar\",\"endDragKeyboard\":\"Arrastando. Pressione Enter para cancelar.\",\"endDragTouch\":\"Arrastando. Toque duas vezes para cancelar.\",\"endDragVirtual\":\"Arrastando. Clique para cancelar.\",\"insertAfter\":\"Inserir após {itemText}\",\"insertBefore\":\"Inserir antes de {itemText}\",\"insertBetween\":\"Inserir entre {beforeItemText} e {afterItemText}\"}");
|
|
1576
716
|
|
|
1577
|
-
if (target.dropPosition === 'after') {
|
|
1578
|
-
dropPosition = 'on';
|
|
1579
|
-
}
|
|
1580
|
-
}
|
|
1581
717
|
|
|
1582
|
-
|
|
1583
|
-
|
|
1584
|
-
return {
|
|
1585
|
-
type: 'root'
|
|
1586
|
-
};
|
|
1587
|
-
}
|
|
718
|
+
var $076b31123975b967$exports = {};
|
|
719
|
+
$076b31123975b967$exports = JSON.parse("{\"dragDescriptionKeyboard\":\"Prima Enter para iniciar o arrasto.\",\"dragDescriptionTouch\":\"Faça duplo toque para começar a arrastar.\",\"dragDescriptionVirtual\":\"Clique para iniciar o arrasto.\",\"dragItem\":\"Arrastar {itemText}\",\"dragSelectedItems\":\"Arrastar {count, plural, one {# item selecionado} outro {# itens selecionados}}\",\"dragStartedKeyboard\":\"Arrasto iniciado. Prima a tecla de tabulação para navegar para um destino para largar, e em seguida prima Enter para largar ou prima Escape para cancelar.\",\"dragStartedTouch\":\"Arrasto iniciado. Navegue para um destino para largar, e em seguida faça duplo toque para largar.\",\"dragStartedVirtual\":\"Arrasto iniciado. Navegue para um destino para largar, e em seguida clique ou prima Enter para largar.\",\"dropCanceled\":\"Largar cancelado.\",\"dropComplete\":\"Largar completo.\",\"dropDescriptionKeyboard\":\"Prima Enter para largar. Prima Escape para cancelar o arrasto.\",\"dropDescriptionTouch\":\"Faça duplo toque para largar.\",\"dropDescriptionVirtual\":\"Clique para largar.\",\"dropIndicator\":\"Indicador de largar\",\"dropOnItem\":\"Largar em {itemText}\",\"dropOnRoot\":\"Largar em\",\"endDragKeyboard\":\"A arrastar. Prima Enter para cancelar o arrasto.\",\"endDragTouch\":\"A arrastar. Faça duplo toque para cancelar o arrasto.\",\"endDragVirtual\":\"A arrastar. Clique para cancelar o arrasto.\",\"insertAfter\":\"Inserir depois de {itemText}\",\"insertBefore\":\"Inserir antes de {itemText}\",\"insertBetween\":\"Inserir entre {beforeItemText} e {afterItemText}\"}");
|
|
1588
720
|
|
|
1589
|
-
return null;
|
|
1590
|
-
}
|
|
1591
721
|
|
|
1592
|
-
|
|
1593
|
-
|
|
1594
|
-
key: nextKey,
|
|
1595
|
-
dropPosition
|
|
1596
|
-
};
|
|
1597
|
-
};
|
|
722
|
+
var $0e9ee9f78d3f0cd2$exports = {};
|
|
723
|
+
$0e9ee9f78d3f0cd2$exports = JSON.parse("{\"dragDescriptionKeyboard\":\"Apăsați pe Enter pentru a începe glisarea.\",\"dragDescriptionTouch\":\"Atingeți de două ori pentru a începe să glisați.\",\"dragDescriptionVirtual\":\"Faceți clic pentru a începe glisarea.\",\"dragItem\":\"Glisați {itemText}\",\"dragSelectedItems\":\"Glisați {count, plural, one {# element selectat} other {# elemente selectate}}\",\"dragStartedKeyboard\":\"A început glisarea. Apăsați pe Tab pentru a naviga la o țintă de fixare, apoi apăsați pe Enter pentru a fixa sau apăsați pe Escape pentru a anula glisarea.\",\"dragStartedTouch\":\"A început glisarea. Navigați la o țintă de fixare, apoi atingeți de două ori pentru a fixa.\",\"dragStartedVirtual\":\"A început glisarea. Navigați la o țintă de fixare, apoi faceți clic sau apăsați pe Enter pentru a fixa.\",\"dropCanceled\":\"Fixare anulată.\",\"dropComplete\":\"Fixare finalizată.\",\"dropDescriptionKeyboard\":\"Apăsați pe Enter pentru a fixa. Apăsați pe Escape pentru a anula glisarea.\",\"dropDescriptionTouch\":\"Atingeți de două ori pentru a fixa.\",\"dropDescriptionVirtual\":\"Faceți clic pentru a fixa.\",\"dropIndicator\":\"indicator de fixare\",\"dropOnItem\":\"Fixați pe {itemText}\",\"dropOnRoot\":\"Fixare pe\",\"endDragKeyboard\":\"Se glisează. Apăsați pe Enter pentru a anula glisarea.\",\"endDragTouch\":\"Se glisează. Atingeți de două ori pentru a anula glisarea.\",\"endDragVirtual\":\"Se glisează. Faceți clic pentru a anula glisarea.\",\"insertAfter\":\"Inserați după {itemText}\",\"insertBefore\":\"Inserați înainte de {itemText}\",\"insertBetween\":\"Inserați între {beforeItemText} și {afterItemText}\"}");
|
|
1598
724
|
|
|
1599
|
-
let getPreviousTarget = function getPreviousTarget(target, wrap) {
|
|
1600
|
-
if (wrap === void 0) {
|
|
1601
|
-
wrap = true;
|
|
1602
|
-
}
|
|
1603
725
|
|
|
1604
|
-
|
|
1605
|
-
|
|
1606
|
-
} = localState.props;
|
|
1607
|
-
let nextKey = (target == null ? void 0 : target.type) === 'item' ? keyboardDelegate.getKeyAbove(target.key) : keyboardDelegate.getLastKey();
|
|
1608
|
-
let dropPosition = !target || target.type === 'root' ? 'after' : 'on';
|
|
726
|
+
var $75565d05f47f6ccc$exports = {};
|
|
727
|
+
$75565d05f47f6ccc$exports = JSON.parse("{\"dragDescriptionKeyboard\":\"Нажмите клавишу Enter для начала перетаскивания.\",\"dragDescriptionTouch\":\"Дважды нажмите для начала перетаскивания.\",\"dragDescriptionVirtual\":\"Щелкните для начала перетаскивания.\",\"dragItem\":\"Перетащить {itemText}\",\"dragSelectedItems\":\"Перетащить {count, plural, one {# выбранный элемент} other {# выбранных элем}}\",\"dragStartedKeyboard\":\"Начато перетаскивание. Нажмите клавишу Tab для выбора цели, затем нажмите клавишу Enter, чтобы применить перетаскивание, или клавишу Escape для отмены действия.\",\"dragStartedTouch\":\"Начато перетаскивание. Выберите цель, затем дважды нажмите, чтобы применить перетаскивание.\",\"dragStartedVirtual\":\"Начато перетаскивание. Нажмите клавишу Tab для выбора цели, затем нажмите клавишу Enter, чтобы применить перетаскивание.\",\"dropCanceled\":\"Перетаскивание отменено.\",\"dropComplete\":\"Перетаскивание завершено.\",\"dropDescriptionKeyboard\":\"Нажмите клавишу Enter, чтобы применить перетаскивание. Нажмите клавишу Escape для отмены.\",\"dropDescriptionTouch\":\"Дважды нажмите, чтобы применить перетаскивание.\",\"dropDescriptionVirtual\":\"Щелкните, чтобы применить перетаскивание.\",\"dropIndicator\":\"индикатор перетаскивания\",\"dropOnItem\":\"Перетащить на {itemText}\",\"dropOnRoot\":\"Перетащить на\",\"endDragKeyboard\":\"Перетаскивание. Нажмите клавишу Enter для отмены.\",\"endDragTouch\":\"Перетаскивание. Дважды нажмите для отмены.\",\"endDragVirtual\":\"Перетаскивание. Щелкните для отмены.\",\"insertAfter\":\"Вставить после {itemText}\",\"insertBefore\":\"Вставить перед {itemText}\",\"insertBetween\":\"Вставить между {beforeItemText} и {afterItemText}\"}");
|
|
1609
728
|
|
|
1610
|
-
if ((target == null ? void 0 : target.type) === 'item') {
|
|
1611
|
-
let positionIndex = $ab6d833b5804400cb02efc69c9302a$var$DROP_POSITIONS.indexOf(target.dropPosition);
|
|
1612
|
-
let nextDropPosition = $ab6d833b5804400cb02efc69c9302a$var$DROP_POSITIONS[positionIndex - 1];
|
|
1613
729
|
|
|
1614
|
-
|
|
1615
|
-
|
|
1616
|
-
type: 'item',
|
|
1617
|
-
key: target.key,
|
|
1618
|
-
dropPosition: nextDropPosition
|
|
1619
|
-
};
|
|
1620
|
-
} // If the last drop position was 'before', then 'after' on the previous key is equivalent.
|
|
1621
|
-
// Switch to 'on' instead.
|
|
730
|
+
var $33e7643e065740e4$exports = {};
|
|
731
|
+
$33e7643e065740e4$exports = JSON.parse("{\"dragDescriptionKeyboard\":\"Stlačením klávesu Enter začnete presúvanie.\",\"dragDescriptionTouch\":\"Dvojitým kliknutím začnete presúvanie.\",\"dragDescriptionVirtual\":\"Kliknutím začnete presúvanie.\",\"dragItem\":\"Presunúť položku {itemText}\",\"dragSelectedItems\":\"Presunúť {count, plural, one {# vybratú položku} other {# vybraté položky}}\",\"dragStartedKeyboard\":\"Presúvanie sa začalo. Do cieľového umiestnenia prejdete stlačením klávesu Tab. Ak chcete položku umiestniť, stlačte kláves Enter alebo stlačte kláves Esc, ak chcete presúvanie zrušiť.\",\"dragStartedTouch\":\"Presúvanie sa začalo. Prejdite na cieľové umiestnenie a dvojitým kliknutím umiestnite položku.\",\"dragStartedVirtual\":\"Presúvanie sa začalo. Prejdite na cieľové umiestnenie a kliknutím alebo stlačením klávesu Enter umiestnite položku.\",\"dropCanceled\":\"Umiestnenie zrušené.\",\"dropComplete\":\"Umiestnenie dokončené.\",\"dropDescriptionKeyboard\":\"Stlačením klávesu Enter umiestnite položku. Stlačením klávesu Esc zrušíte presúvanie.\",\"dropDescriptionTouch\":\"Dvojitým kliknutím umiestnite položku.\",\"dropDescriptionVirtual\":\"Kliknutím umiestnite položku.\",\"dropIndicator\":\"indikátor umiestnenia\",\"dropOnItem\":\"Umiestniť na položku {itemText}\",\"dropOnRoot\":\"Umiestniť na\",\"endDragKeyboard\":\"Prebieha presúvanie. Ak ho chcete zrušiť, stlačte kláves Enter.\",\"endDragTouch\":\"Prebieha presúvanie. Dvojitým kliknutím ho môžete zrušiť.\",\"endDragVirtual\":\"Prebieha presúvanie.\",\"insertAfter\":\"Vložiť za položku {itemText}\",\"insertBefore\":\"Vložiť pred položku {itemText}\",\"insertBetween\":\"Vložiť medzi položky {beforeItemText} a {afterItemText}\"}");
|
|
1622
732
|
|
|
1623
733
|
|
|
1624
|
-
|
|
1625
|
-
|
|
1626
|
-
}
|
|
1627
|
-
}
|
|
734
|
+
var $f7ca62df85ef8473$exports = {};
|
|
735
|
+
$f7ca62df85ef8473$exports = JSON.parse("{\"dragDescriptionKeyboard\":\"Pritisnite tipko Enter za začetek vlečenja.\",\"dragDescriptionTouch\":\"Dvotapnite za začetek vlečenja.\",\"dragDescriptionVirtual\":\"Kliknite za začetek vlečenja.\",\"dragItem\":\"Povleci {itemText}\",\"dragSelectedItems\":\"Povlecite {count, plural, one {# izbran element} other {izbrane elemente (#)}}\",\"dragStartedKeyboard\":\"Vlečenje se je začelo. Pritisnite tipko Tab za pomik na mesto, kamor želite spustiti elemente, in pritisnite tipko Enter, da jih spustite, ali tipko Escape, da prekličete postopek.\",\"dragStartedTouch\":\"Vlečenje se je začelo. Pomaknite se na mesto, kamor želite spustiti elemente, in dvotapnite, da jih spustite.\",\"dragStartedVirtual\":\"Vlečenje se je začelo. Pomaknite se na mesto, kamor želite spustiti elemente, in kliknite ali pritisnite tipko Enter, da jih spustite.\",\"dropCanceled\":\"Spust je preklican.\",\"dropComplete\":\"Spust je končan.\",\"dropDescriptionKeyboard\":\"Pritisnite tipko Enter, da spustite. Pritisnite tipko Escape, da prekličete vlečenje.\",\"dropDescriptionTouch\":\"Dvotapnite, da spustite.\",\"dropDescriptionVirtual\":\"Kliknite, da spustite.\",\"dropIndicator\":\"indikator spusta\",\"dropOnItem\":\"Spusti na mesto {itemText}\",\"dropOnRoot\":\"Spusti na mesto\",\"endDragKeyboard\":\"Vlečenje. Pritisnite tipko Enter za preklic vlečenja.\",\"endDragTouch\":\"Vlečenje. Dvotapnite za preklic vlečenja.\",\"endDragVirtual\":\"Vlečenje. Kliknite, da prekličete vlečenje.\",\"insertAfter\":\"Vstavi za {itemText}\",\"insertBefore\":\"Vstavi pred {itemText}\",\"insertBetween\":\"Vstavi med {beforeItemText} in {afterItemText}\"}");
|
|
1628
736
|
|
|
1629
|
-
if (nextKey == null) {
|
|
1630
|
-
if (wrap) {
|
|
1631
|
-
return {
|
|
1632
|
-
type: 'root'
|
|
1633
|
-
};
|
|
1634
|
-
}
|
|
1635
737
|
|
|
1636
|
-
|
|
1637
|
-
|
|
738
|
+
var $37058f74c9a3a05d$exports = {};
|
|
739
|
+
$37058f74c9a3a05d$exports = JSON.parse("{\"dragItem\":\"Prevucite {itemText}\",\"dragSelectedItems\":\"Prevucite {count, plural, one {# izabranu stavku} other {# izabrane stavke}}\",\"dragDescriptionKeyboard\":\"Pritisnite Enter da biste započeli prevlačenje..\",\"dragDescriptionTouch\":\"Dvaput dodirnite za otpuštanje.\",\"dragDescriptionVirtual\":\"Kliknite da biste započeli prevlačenje.\",\"dragStartedKeyboard\":\"Prevlačenje je započeto. Pritisnite Tab da biste otišli do cilja za otpuštanje, zatim pritisnite Enter za ispuštanje ili pritisnite Escape za otkazivanje.\",\"dragStartedTouch\":\"Prevlačenje je započeto. Idite do cilja za otpuštanje, a zatim dvaput dodirnite za otpuštanje.\",\"dragStartedVirtual\":\"Prevlačenje je započeto. Idite do cilja za otpuštanje, a zatim kliknite ili pritinite Enter za otpuštanje.\",\"endDragKeyboard\":\"Prevlačenje u toku. Pritisnite Enter da biste otkazali prevlačenje.\",\"endDragTouch\":\"Prevlačenje u toku. Dvaput dodirnite da biste otkazali prevlačenje.\",\"endDragVirtual\":\"Prevlačenje u toku. Kliknite da biste otkazali prevlačenje.\",\"dropDescriptionKeyboard\":\"Pritisnite Enter da biste otpustili. Pritisnite Escape da biste otkazali prevlačenje.\",\"dropDescriptionTouch\":\"Dvaput dodirnite za otpuštanje.\",\"dropDescriptionVirtual\":\"Kliknite za otpuštanje.\",\"dropCanceled\":\"Otpuštanje je otkazano.\",\"dropComplete\":\"Prevlačenje je završeno.\",\"dropIndicator\":\"Indikator otpuštanja\",\"dropOnRoot\":\"Otpusti na\",\"dropOnItem\":\"Otpusti na {itemText}\",\"insertBefore\":\"Umetnite ispred {itemText}\",\"insertBetween\":\"Umetnite između {beforeItemText} i {afterItemText}\",\"insertAfter\":\"Umetnite posle {itemText}\"}");
|
|
1638
740
|
|
|
1639
|
-
return {
|
|
1640
|
-
type: 'item',
|
|
1641
|
-
key: nextKey,
|
|
1642
|
-
dropPosition
|
|
1643
|
-
};
|
|
1644
|
-
};
|
|
1645
741
|
|
|
1646
|
-
|
|
1647
|
-
|
|
1648
|
-
wrap = true;
|
|
1649
|
-
}
|
|
742
|
+
var $8086e3e54a0bdab1$exports = {};
|
|
743
|
+
$8086e3e54a0bdab1$exports = JSON.parse("{\"dragDescriptionKeyboard\":\"Tryck på enter för att börja dra.\",\"dragDescriptionTouch\":\"Dubbeltryck för att börja dra.\",\"dragDescriptionVirtual\":\"Klicka för att börja dra.\",\"dragItem\":\"Dra {itemText}\",\"dragSelectedItems\":\"Dra {count, plural, one {# valt objekt} other {# valda objekt}}\",\"dragStartedKeyboard\":\"Börja dra. Tryck på tabb för att navigera till målet, tryck på enter för att släppa eller på escape för att avbryta.\",\"dragStartedTouch\":\"Börja dra. Navigera till ett mål och dubbeltryck för att släppa.\",\"dragStartedVirtual\":\"Börja dra. Navigera till ett mål och klicka eller tryck på enter för att släppa.\",\"dropCanceled\":\"Släppåtgärd avbröts.\",\"dropComplete\":\"Släppåtgärd klar.\",\"dropDescriptionKeyboard\":\"Tryck på enter för att släppa. Tryck på escape för att avbryta dragåtgärd.\",\"dropDescriptionTouch\":\"Dubbeltryck för att släppa.\",\"dropDescriptionVirtual\":\"Klicka för att släppa.\",\"dropIndicator\":\"släppindikator\",\"dropOnItem\":\"Släpp på {itemText}\",\"dropOnRoot\":\"Släpp på\",\"endDragKeyboard\":\"Drar. Tryck på enter för att avbryta dragåtgärd.\",\"endDragTouch\":\"Drar. Dubbeltryck för att avbryta dragåtgärd.\",\"endDragVirtual\":\"Drar. Klicka för att avbryta dragåtgärd.\",\"insertAfter\":\"Infoga efter {itemText}\",\"insertBefore\":\"Infoga före {itemText}\",\"insertBetween\":\"Infoga mellan {beforeItemText} och {afterItemText}\"}");
|
|
1650
744
|
|
|
1651
|
-
let seenRoot = 0;
|
|
1652
|
-
let operation;
|
|
1653
745
|
|
|
1654
|
-
|
|
1655
|
-
|
|
746
|
+
var $de3f67d6daadf686$exports = {};
|
|
747
|
+
$de3f67d6daadf686$exports = JSON.parse("{\"dragDescriptionKeyboard\":\"Sürüklemeyi başlatmak için Enter'a basın.\",\"dragDescriptionTouch\":\"Sürüklemeyi başlatmak için çift tıklayın.\",\"dragDescriptionVirtual\":\"Sürüklemeyi başlatmak için tıklayın.\",\"dragItem\":\"{itemText}’i sürükle\",\"dragSelectedItems\":\"Sürükle {count, plural, one {# seçili öge} other {# seçili öge}}\",\"dragStartedKeyboard\":\"Sürükleme başlatıldı. Bir bırakma hedefine gitmek için Tab’a basın, ardından bırakmak için Enter’a basın veya iptal etmek için Escape’e basın.\",\"dragStartedTouch\":\"Sürükleme başlatıldı. Bir bırakma hedefine gidin, ardından bırakmak için çift tıklayın.\",\"dragStartedVirtual\":\"Sürükleme başlatıldı. Bir bırakma hedefine gidin, ardından bırakmak için Enter’a tıklayın veya basın.\",\"dropCanceled\":\"Bırakma iptal edildi.\",\"dropComplete\":\"Bırakma tamamlandı.\",\"dropDescriptionKeyboard\":\"Bırakmak için Enter'a basın. Sürüklemeyi iptal etmek için Escape'e basın.\",\"dropDescriptionTouch\":\"Bırakmak için çift tıklayın.\",\"dropDescriptionVirtual\":\"Bırakmak için tıklayın.\",\"dropIndicator\":\"bırakma göstergesi\",\"dropOnItem\":\"{itemText} üzerine bırak\",\"dropOnRoot\":\"Bırakın\",\"endDragKeyboard\":\"Sürükleme. Sürüklemeyi iptal etmek için Enter'a basın.\",\"endDragTouch\":\"Sürükleme. Sürüklemeyi iptal etmek için çift tıklayın.\",\"endDragVirtual\":\"Sürükleme. Sürüklemeyi iptal etmek için tıklayın.\",\"insertAfter\":\"{itemText}’den sonra gir\",\"insertBefore\":\"{itemText}’den önce gir\",\"insertBetween\":\"{beforeItemText} ve {afterItemText} arasına gir\"}");
|
|
1656
748
|
|
|
1657
|
-
if (!nextTarget) {
|
|
1658
|
-
return null;
|
|
1659
|
-
}
|
|
1660
749
|
|
|
1661
|
-
|
|
1662
|
-
|
|
750
|
+
var $f971ade05c1512b7$exports = {};
|
|
751
|
+
$f971ade05c1512b7$exports = JSON.parse("{\"dragDescriptionKeyboard\":\"Натисніть Enter, щоб почати перетягування.\",\"dragDescriptionTouch\":\"Натисніть двічі, щоб почати перетягування.\",\"dragDescriptionVirtual\":\"Натисніть, щоб почати перетягування.\",\"dragItem\":\"Перетягнути {itemText}\",\"dragSelectedItems\":\"Перетягніть {count, plural, one {# вибраний елемент} other {# вибраних елем}}\",\"dragStartedKeyboard\":\"Перетягування почалося. Натисніть Tab, щоб перейти до цілі перетягування, потім натисніть Enter, щоб перетягнути, або Escape, щоб скасувати.\",\"dragStartedTouch\":\"Перетягування почалося. Перейдіть до цілі перетягування, потім натисніть двічі, щоб перетягнути.\",\"dragStartedVirtual\":\"Перетягування почалося. Перейдіть до цілі перетягування, потім натисніть Enter, щоб перетягнути.\",\"dropCanceled\":\"Перетягування скасовано.\",\"dropComplete\":\"Перетягування завершено.\",\"dropDescriptionKeyboard\":\"Натисніть Enter, щоб перетягнути. Натисніть Escape, щоб скасувати перетягування.\",\"dropDescriptionTouch\":\"Натисніть двічі, щоб перетягнути.\",\"dropDescriptionVirtual\":\"Натисніть, щоб перетягнути.\",\"dropIndicator\":\"індикатор перетягування\",\"dropOnItem\":\"Перетягнути на {itemText}\",\"dropOnRoot\":\"Перетягнути на\",\"endDragKeyboard\":\"Триває перетягування. Натисніть Enter, щоб скасувати перетягування.\",\"endDragTouch\":\"Триває перетягування. Натисніть двічі, щоб скасувати перетягування.\",\"endDragVirtual\":\"Триває перетягування. Натисніть, щоб скасувати перетягування.\",\"insertAfter\":\"Вставити після {itemText}\",\"insertBefore\":\"Вставити перед {itemText}\",\"insertBetween\":\"Вставити між {beforeItemText} і {afterItemText}\"}");
|
|
1663
752
|
|
|
1664
|
-
if (target.type === 'root') {
|
|
1665
|
-
seenRoot++;
|
|
1666
|
-
}
|
|
1667
|
-
} while (operation === 'cancel' && !localState.state.isDropTarget(target) && seenRoot < 2);
|
|
1668
753
|
|
|
1669
|
-
|
|
1670
|
-
|
|
1671
|
-
}
|
|
754
|
+
var $4f616c645f352135$exports = {};
|
|
755
|
+
$4f616c645f352135$exports = JSON.parse("{\"dragDescriptionKeyboard\":\"按 Enter 开始拖动。\",\"dragDescriptionTouch\":\"双击开始拖动。\",\"dragDescriptionVirtual\":\"单击开始拖动。\",\"dragItem\":\"拖动 {itemText}\",\"dragSelectedItems\":\"拖动 {count, plural, one {# 选中项目} other {# 选中项目}}\",\"dragStartedKeyboard\":\"已开始拖动。按 Tab 导航到放置目标,然后按 Enter 放置或按 Escape 取消。\",\"dragStartedTouch\":\"已开始拖动。导航到放置目标,然后双击放置。\",\"dragStartedVirtual\":\"已开始拖动。导航到放置目标,然后单击或按 Enter 放置。\",\"dropCanceled\":\"放置已取消。\",\"dropComplete\":\"放置已完成。\",\"dropDescriptionKeyboard\":\"按 Enter 放置。按 Escape 取消拖动。\",\"dropDescriptionTouch\":\"双击放置。\",\"dropDescriptionVirtual\":\"单击放置。\",\"dropIndicator\":\"放置标记\",\"dropOnItem\":\"放置于 {itemText}\",\"dropOnRoot\":\"放置于\",\"endDragKeyboard\":\"正在拖动。按 Enter 取消拖动。\",\"endDragTouch\":\"正在拖动。双击取消拖动。\",\"endDragVirtual\":\"正在拖动。单击取消拖动。\",\"insertAfter\":\"插入到 {itemText} 之后\",\"insertBefore\":\"插入到 {itemText} 之前\",\"insertBetween\":\"插入到 {beforeItemText} 和 {afterItemText} 之间\"}");
|
|
1672
756
|
|
|
1673
|
-
return target;
|
|
1674
|
-
};
|
|
1675
757
|
|
|
1676
|
-
|
|
1677
|
-
|
|
758
|
+
var $731d0feea052bdfb$exports = {};
|
|
759
|
+
$731d0feea052bdfb$exports = JSON.parse("{\"dragDescriptionKeyboard\":\"按 Enter 鍵以開始拖曳。\",\"dragDescriptionTouch\":\"輕點兩下以開始拖曳。\",\"dragDescriptionVirtual\":\"按一下滑鼠以開始拖曳。\",\"dragItem\":\"拖曳「{itemText}」\",\"dragSelectedItems\":\"拖曳 {count, plural, one {# 個選定項目} other {# 個選定項目}}\",\"dragStartedKeyboard\":\"已開始拖曳。按 Tab 鍵以瀏覽至放置目標,然後按 Enter 鍵以放置,或按 Escape 鍵以取消。\",\"dragStartedTouch\":\"已開始拖曳。瀏覽至放置目標,然後輕點兩下以放置。\",\"dragStartedVirtual\":\"已開始拖曳。瀏覽至放置目標,然後按一下滑鼠或按 Enter 鍵以放置。\",\"dropCanceled\":\"放置已取消。\",\"dropComplete\":\"放置已完成。\",\"dropDescriptionKeyboard\":\"按 Enter 鍵以放置。按 Escape 鍵以取消拖曳。\",\"dropDescriptionTouch\":\"輕點兩下以放置。\",\"dropDescriptionVirtual\":\"按一下滑鼠以放置。\",\"dropIndicator\":\"放置指示器\",\"dropOnItem\":\"放置在「{itemText}」上\",\"dropOnRoot\":\"放置在\",\"endDragKeyboard\":\"拖曳中。按 Enter 鍵以取消拖曳。\",\"endDragTouch\":\"拖曳中。輕點兩下以取消拖曳。\",\"endDragVirtual\":\"拖曳中。按一下滑鼠以取消拖曳。\",\"insertAfter\":\"插入至「{itemText}」之後\",\"insertBefore\":\"插入至「{itemText}」之前\",\"insertBetween\":\"插入至「{beforeItemText}」和「{afterItemText}」之間\"}");
|
|
1678
760
|
|
|
1679
|
-
getDropOperation(types, allowedOperations) {
|
|
1680
|
-
if (localState.state.target) {
|
|
1681
|
-
return localState.state.getDropOperation(localState.state.target, types, allowedOperations);
|
|
1682
|
-
} // Check if any of the targets accept the drop.
|
|
1683
|
-
// TODO: should we have a faster way of doing this or e.g. for pagination?
|
|
1684
761
|
|
|
762
|
+
$6dae25bfb54cafe2$exports = {
|
|
763
|
+
"ar-AE": $6a4207e9446e3fd6$exports,
|
|
764
|
+
"bg-BG": $b35a262c6a180bbf$exports,
|
|
765
|
+
"cs-CZ": $2295dfb4d9d6e70f$exports,
|
|
766
|
+
"da-DK": $fe12c948c93e9e7c$exports,
|
|
767
|
+
"de-DE": $bd463c5fd759bcd3$exports,
|
|
768
|
+
"el-GR": $c53fec58c9b57aed$exports,
|
|
769
|
+
"en-US": $5203da54239cc53b$exports,
|
|
770
|
+
"es-ES": $f8a76c76a7827fc9$exports,
|
|
771
|
+
"et-EE": $18a37c0580c6872d$exports,
|
|
772
|
+
"fi-FI": $c83ae802bb286dd5$exports,
|
|
773
|
+
"fr-FR": $4f6107d6a00a2dc5$exports,
|
|
774
|
+
"he-IL": $f8a8643ec8fb63f3$exports,
|
|
775
|
+
"hr-HR": $d625f0563955824c$exports,
|
|
776
|
+
"hu-HU": $24553ce5446e49c4$exports,
|
|
777
|
+
"it-IT": $950ffefaa2ec3f25$exports,
|
|
778
|
+
"ja-JP": $3da23275963b1c01$exports,
|
|
779
|
+
"ko-KR": $207c86ace90f7cb9$exports,
|
|
780
|
+
"lt-LT": $78c91fe39f28d801$exports,
|
|
781
|
+
"lv-LV": $10dc7abacb309b1d$exports,
|
|
782
|
+
"nb-NO": $378f79a263916098$exports,
|
|
783
|
+
"nl-NL": $bb7919a8dd63447a$exports,
|
|
784
|
+
"pl-PL": $0dab7c4b200438bb$exports,
|
|
785
|
+
"pt-BR": $320b1b8402761dd9$exports,
|
|
786
|
+
"pt-PT": $076b31123975b967$exports,
|
|
787
|
+
"ro-RO": $0e9ee9f78d3f0cd2$exports,
|
|
788
|
+
"ru-RU": $75565d05f47f6ccc$exports,
|
|
789
|
+
"sk-SK": $33e7643e065740e4$exports,
|
|
790
|
+
"sl-SI": $f7ca62df85ef8473$exports,
|
|
791
|
+
"sr-SP": $37058f74c9a3a05d$exports,
|
|
792
|
+
"sv-SE": $8086e3e54a0bdab1$exports,
|
|
793
|
+
"tr-TR": $de3f67d6daadf686$exports,
|
|
794
|
+
"uk-UA": $f971ade05c1512b7$exports,
|
|
795
|
+
"zh-CN": $4f616c645f352135$exports,
|
|
796
|
+
"zh-TW": $731d0feea052bdfb$exports
|
|
797
|
+
};
|
|
1685
798
|
|
|
1686
|
-
let target = nextValidTarget(null, types, allowedOperations, getNextTarget);
|
|
1687
|
-
return target ? 'move' : 'cancel';
|
|
1688
|
-
},
|
|
1689
799
|
|
|
1690
|
-
onDropEnter(e, drag) {
|
|
1691
|
-
let types = $bc29619458500c186021634c18dc$export$getTypes(drag.items);
|
|
1692
|
-
let selectionManager = localState.state.selectionManager;
|
|
1693
|
-
let target; // When entering the droppable collection for the first time, the default drop target
|
|
1694
|
-
// is after the focused key.
|
|
1695
800
|
|
|
1696
|
-
let key = selectionManager.focusedKey;
|
|
1697
|
-
let dropPosition = 'after'; // If the focused key is a cell, get the parent item instead.
|
|
1698
|
-
// For now, we assume that individual cells cannot be dropped on.
|
|
1699
801
|
|
|
1700
|
-
let item = localState.state.collection.getItem(key);
|
|
1701
802
|
|
|
1702
|
-
if ((item == null ? void 0 : item.type) === 'cell') {
|
|
1703
|
-
key = item.parentKey;
|
|
1704
|
-
} // If the focused item is also selected, the default drop target is after the last selected item.
|
|
1705
|
-
// But if the focused key is the first selected item, then default to before the first selected item.
|
|
1706
|
-
// This is to make reordering lists slightly easier. If you select top down, we assume you want to
|
|
1707
|
-
// move the items down. If you select bottom up, we assume you want to move the items up.
|
|
1708
803
|
|
|
1709
804
|
|
|
1710
|
-
|
|
1711
|
-
|
|
1712
|
-
|
|
1713
|
-
|
|
1714
|
-
|
|
1715
|
-
|
|
805
|
+
const $e2630e07d35639b3$var$MESSAGES = {
|
|
806
|
+
keyboard: {
|
|
807
|
+
start: 'dragDescriptionKeyboard',
|
|
808
|
+
end: 'endDragKeyboard'
|
|
809
|
+
},
|
|
810
|
+
touch: {
|
|
811
|
+
start: 'dragDescriptionTouch',
|
|
812
|
+
end: 'endDragTouch'
|
|
813
|
+
},
|
|
814
|
+
virtual: {
|
|
815
|
+
start: 'dragDescriptionVirtual',
|
|
816
|
+
end: 'endDragVirtual'
|
|
817
|
+
}
|
|
818
|
+
};
|
|
819
|
+
function $e2630e07d35639b3$export$7941f8aafa4b6021(options) {
|
|
820
|
+
let formatMessage = $67uu7$reactariai18n.useMessageFormatter((/*@__PURE__*/$parcel$interopDefault($6dae25bfb54cafe2$exports)));
|
|
821
|
+
let state = $67uu7$react.useRef({
|
|
822
|
+
options: options,
|
|
823
|
+
x: 0,
|
|
824
|
+
y: 0
|
|
825
|
+
}).current;
|
|
826
|
+
state.options = options;
|
|
827
|
+
let [isDragging, setDragging] = $67uu7$react.useState(false);
|
|
828
|
+
let onDragStart = (e)=>{
|
|
829
|
+
let items = options.getItems();
|
|
830
|
+
$29c8537521cf08fe$export$f9c1490890ddd063(e.dataTransfer, items);
|
|
831
|
+
if (typeof options.getAllowedDropOperations === 'function') {
|
|
832
|
+
let allowedOperations = options.getAllowedDropOperations();
|
|
833
|
+
let allowed = $d7547fb11526b355$export$60b7b4bcf3903d8e.none;
|
|
834
|
+
for (let operation of allowedOperations)allowed |= $d7547fb11526b355$export$60b7b4bcf3903d8e[operation] || $d7547fb11526b355$export$60b7b4bcf3903d8e.none;
|
|
835
|
+
e.dataTransfer.effectAllowed = $d7547fb11526b355$export$dd0165308d8bff45[allowed] || 'none';
|
|
1716
836
|
}
|
|
1717
|
-
|
|
1718
|
-
|
|
1719
|
-
|
|
1720
|
-
|
|
1721
|
-
|
|
1722
|
-
|
|
1723
|
-
|
|
1724
|
-
|
|
1725
|
-
|
|
1726
|
-
|
|
1727
|
-
|
|
1728
|
-
|
|
1729
|
-
|
|
1730
|
-
|
|
837
|
+
// If there is a renderPreview function, use it to render a custom preview image that will
|
|
838
|
+
// appear under the pointer while dragging. If not, the element itself is dragged by the browser.
|
|
839
|
+
if (typeof options.renderPreview === 'function') {
|
|
840
|
+
let preview = options.renderPreview(items);
|
|
841
|
+
if (preview) {
|
|
842
|
+
// Create an off-screen div to render the preview into.
|
|
843
|
+
let node = document.createElement('div');
|
|
844
|
+
node.style.zIndex = '-100';
|
|
845
|
+
node.style.position = 'absolute';
|
|
846
|
+
node.style.top = '0';
|
|
847
|
+
node.style.left = '-100000px';
|
|
848
|
+
document.body.appendChild(node);
|
|
849
|
+
// Call renderPreview to get a JSX element, and render it into the div with React DOM.
|
|
850
|
+
($parcel$interopDefault($67uu7$reactdom)).render(preview, node);
|
|
851
|
+
// Compute the offset that the preview will appear under the mouse.
|
|
852
|
+
// If possible, this is based on the point the user clicked on the target.
|
|
853
|
+
// If the preview is much smaller, then just use the center point of the preview.
|
|
854
|
+
let size = node.getBoundingClientRect();
|
|
855
|
+
let rect = e.currentTarget.getBoundingClientRect();
|
|
856
|
+
let x = e.clientX - rect.x;
|
|
857
|
+
let y = e.clientY - rect.y;
|
|
858
|
+
if (x > size.width || y > size.height) {
|
|
859
|
+
x = size.width / 2;
|
|
860
|
+
y = size.height / 2;
|
|
861
|
+
}
|
|
862
|
+
e.dataTransfer.setDragImage(node, x, y);
|
|
863
|
+
// Remove the preview from the DOM after a frame so the browser has time to paint.
|
|
864
|
+
requestAnimationFrame(()=>{
|
|
865
|
+
document.body.removeChild(node);
|
|
866
|
+
});
|
|
867
|
+
}
|
|
868
|
+
}
|
|
869
|
+
if (typeof options.onDragStart === 'function') options.onDragStart({
|
|
870
|
+
type: 'dragstart',
|
|
871
|
+
x: e.clientX,
|
|
872
|
+
y: e.clientY
|
|
873
|
+
});
|
|
874
|
+
state.x = e.clientX;
|
|
875
|
+
state.y = e.clientY;
|
|
876
|
+
// Wait a frame before we set dragging to true so that the browser has time to
|
|
877
|
+
// render the preview image before we update the element that has been dragged.
|
|
878
|
+
requestAnimationFrame(()=>{
|
|
879
|
+
setDragging(true);
|
|
880
|
+
});
|
|
881
|
+
};
|
|
882
|
+
let onDrag = (e)=>{
|
|
883
|
+
if (e.clientX === state.x && e.clientY === state.y) return;
|
|
884
|
+
if (typeof options.onDragMove === 'function') options.onDragMove({
|
|
885
|
+
type: 'dragmove',
|
|
886
|
+
x: e.clientX,
|
|
887
|
+
y: e.clientY
|
|
888
|
+
});
|
|
889
|
+
state.x = e.clientX;
|
|
890
|
+
state.y = e.clientY;
|
|
891
|
+
};
|
|
892
|
+
let onDragEnd = (e)=>{
|
|
893
|
+
if (typeof options.onDragEnd === 'function') options.onDragEnd({
|
|
894
|
+
type: 'dragend',
|
|
895
|
+
x: e.clientX,
|
|
896
|
+
y: e.clientY,
|
|
897
|
+
dropOperation: $d7547fb11526b355$export$608ecc6f1b23c35d[e.dataTransfer.dropEffect]
|
|
898
|
+
});
|
|
899
|
+
setDragging(false);
|
|
900
|
+
};
|
|
901
|
+
let onPress = (e1)=>{
|
|
902
|
+
if (e1.pointerType !== 'keyboard' && e1.pointerType !== 'virtual') return;
|
|
903
|
+
if (typeof state.options.onDragStart === 'function') {
|
|
904
|
+
let rect = e1.target.getBoundingClientRect();
|
|
905
|
+
state.options.onDragStart({
|
|
906
|
+
type: 'dragstart',
|
|
907
|
+
x: rect.x + rect.width / 2,
|
|
908
|
+
y: rect.y + rect.height / 2
|
|
909
|
+
});
|
|
910
|
+
}
|
|
911
|
+
$7b1813d52b80b911$export$549dbcf8649bf3b2({
|
|
912
|
+
element: e1.target,
|
|
913
|
+
items: state.options.getItems(),
|
|
914
|
+
allowedDropOperations: typeof state.options.getAllowedDropOperations === 'function' ? state.options.getAllowedDropOperations() : [
|
|
915
|
+
'move',
|
|
916
|
+
'copy',
|
|
917
|
+
'link'
|
|
918
|
+
],
|
|
919
|
+
onDragEnd (e) {
|
|
920
|
+
setDragging(false);
|
|
921
|
+
if (typeof state.options.onDragEnd === 'function') state.options.onDragEnd(e);
|
|
922
|
+
}
|
|
923
|
+
}, formatMessage);
|
|
924
|
+
setDragging(true);
|
|
925
|
+
};
|
|
926
|
+
let modality = $29c8537521cf08fe$export$49bac5d6d4b352ea();
|
|
927
|
+
let descriptionProps = $67uu7$reactariautils.useDescription(formatMessage(!isDragging ? $e2630e07d35639b3$var$MESSAGES[modality].start : $e2630e07d35639b3$var$MESSAGES[modality].end));
|
|
928
|
+
return {
|
|
929
|
+
dragProps: {
|
|
930
|
+
draggable: 'true',
|
|
931
|
+
onDragStart: onDragStart,
|
|
932
|
+
onDrag: onDrag,
|
|
933
|
+
onDragEnd: onDragEnd
|
|
934
|
+
},
|
|
935
|
+
dragButtonProps: {
|
|
936
|
+
...descriptionProps,
|
|
937
|
+
onPress: onPress
|
|
938
|
+
},
|
|
939
|
+
isDragging: isDragging
|
|
940
|
+
};
|
|
941
|
+
}
|
|
1731
942
|
|
|
1732
943
|
|
|
1733
|
-
|
|
1734
|
-
target = nextValidTarget(null, types, drag.allowedDropOperations, getNextTarget);
|
|
1735
|
-
}
|
|
944
|
+
var $8946a7288b8c2406$exports = {};
|
|
1736
945
|
|
|
1737
|
-
|
|
1738
|
-
},
|
|
946
|
+
$parcel$export($8946a7288b8c2406$exports, "useDrop", () => $8946a7288b8c2406$export$ccdee5eaf73cf661);
|
|
1739
947
|
|
|
1740
|
-
onDropExit() {
|
|
1741
|
-
localState.state.setTarget(null);
|
|
1742
|
-
},
|
|
1743
948
|
|
|
1744
|
-
onDropTargetEnter(target) {
|
|
1745
|
-
localState.state.setTarget(target);
|
|
1746
|
-
},
|
|
1747
949
|
|
|
1748
|
-
onDropActivate(e) {
|
|
1749
|
-
var _localState$state$tar, _localState$state$tar2;
|
|
1750
950
|
|
|
1751
|
-
if (((_localState$state$tar = localState.state.target) == null ? void 0 : _localState$state$tar.type) === 'item' && ((_localState$state$tar2 = localState.state.target) == null ? void 0 : _localState$state$tar2.dropPosition) === 'on' && typeof localState.props.onDropActivate === 'function') {
|
|
1752
|
-
localState.props.onDropActivate({
|
|
1753
|
-
type: 'dropactivate',
|
|
1754
|
-
x: e.x,
|
|
1755
|
-
// todo
|
|
1756
|
-
y: e.y,
|
|
1757
|
-
target: localState.state.target
|
|
1758
|
-
});
|
|
1759
|
-
}
|
|
1760
|
-
},
|
|
1761
951
|
|
|
1762
|
-
onDrop(e, target) {
|
|
1763
|
-
if (localState.state.target && typeof localState.props.onDrop === 'function') {
|
|
1764
|
-
onDrop(e, target || localState.state.target);
|
|
1765
|
-
}
|
|
1766
|
-
},
|
|
1767
|
-
|
|
1768
|
-
onKeyDown(e, drag) {
|
|
1769
|
-
let {
|
|
1770
|
-
keyboardDelegate
|
|
1771
|
-
} = localState.props;
|
|
1772
|
-
let types = $bc29619458500c186021634c18dc$export$getTypes(drag.items);
|
|
1773
|
-
|
|
1774
|
-
switch (e.key) {
|
|
1775
|
-
case 'ArrowDown':
|
|
1776
|
-
{
|
|
1777
|
-
if (keyboardDelegate.getKeyBelow) {
|
|
1778
|
-
let target = nextValidTarget(localState.state.target, types, drag.allowedDropOperations, getNextTarget);
|
|
1779
|
-
localState.state.setTarget(target);
|
|
1780
|
-
}
|
|
1781
952
|
|
|
1782
|
-
break;
|
|
1783
|
-
}
|
|
1784
953
|
|
|
1785
|
-
case 'ArrowUp':
|
|
1786
|
-
{
|
|
1787
|
-
if (keyboardDelegate.getKeyAbove) {
|
|
1788
|
-
let target = nextValidTarget(localState.state.target, types, drag.allowedDropOperations, getPreviousTarget);
|
|
1789
|
-
localState.state.setTarget(target);
|
|
1790
|
-
}
|
|
1791
954
|
|
|
1792
|
-
break;
|
|
1793
|
-
}
|
|
1794
955
|
|
|
1795
|
-
case 'Home':
|
|
1796
|
-
{
|
|
1797
|
-
if (keyboardDelegate.getFirstKey) {
|
|
1798
|
-
let target = nextValidTarget(null, types, drag.allowedDropOperations, getNextTarget);
|
|
1799
|
-
localState.state.setTarget(target);
|
|
1800
|
-
}
|
|
1801
956
|
|
|
1802
|
-
|
|
957
|
+
const $06a19d9f22d42d75$var$MESSAGES = {
|
|
958
|
+
keyboard: 'dropDescriptionKeyboard',
|
|
959
|
+
touch: 'dropDescriptionTouch',
|
|
960
|
+
virtual: 'dropDescriptionVirtual'
|
|
961
|
+
};
|
|
962
|
+
function $06a19d9f22d42d75$export$62447ad3d2ec7da6() {
|
|
963
|
+
let formatMessage = $67uu7$reactariai18n.useMessageFormatter((/*@__PURE__*/$parcel$interopDefault($6dae25bfb54cafe2$exports)));
|
|
964
|
+
let modality = $29c8537521cf08fe$export$49bac5d6d4b352ea();
|
|
965
|
+
let dragSession = $7b1813d52b80b911$export$418e185dd3f1b968();
|
|
966
|
+
let descriptionProps = $67uu7$reactariautils.useDescription(dragSession ? formatMessage($06a19d9f22d42d75$var$MESSAGES[modality]) : '');
|
|
967
|
+
return {
|
|
968
|
+
dropProps: {
|
|
969
|
+
...descriptionProps,
|
|
970
|
+
// Mobile Safari does not properly bubble click events on elements except links or inputs
|
|
971
|
+
// unless there is an onclick handler bound directly to the element itself. By adding this
|
|
972
|
+
// handler, React will take care of adding that for us, and we are able to handle document
|
|
973
|
+
// level click events in the DragManager.
|
|
974
|
+
// See https://www.quirksmode.org/blog/archives/2010/09/click_event_del.html
|
|
975
|
+
onClick: ()=>{
|
|
1803
976
|
}
|
|
977
|
+
}
|
|
978
|
+
};
|
|
979
|
+
}
|
|
1804
980
|
|
|
1805
|
-
case 'End':
|
|
1806
|
-
{
|
|
1807
|
-
if (keyboardDelegate.getLastKey) {
|
|
1808
|
-
let target = nextValidTarget(null, types, drag.allowedDropOperations, getPreviousTarget);
|
|
1809
|
-
localState.state.setTarget(target);
|
|
1810
|
-
}
|
|
1811
981
|
|
|
1812
|
-
|
|
982
|
+
const $8946a7288b8c2406$var$DROP_ACTIVATE_TIMEOUT = 800;
|
|
983
|
+
function $8946a7288b8c2406$export$ccdee5eaf73cf661(options) {
|
|
984
|
+
let [isDropTarget, setDropTarget] = $67uu7$react.useState(false);
|
|
985
|
+
let state = $67uu7$react.useRef({
|
|
986
|
+
x: 0,
|
|
987
|
+
y: 0,
|
|
988
|
+
dragEnterCount: 0,
|
|
989
|
+
dropEffect: 'none',
|
|
990
|
+
dropActivateTimer: null
|
|
991
|
+
}).current;
|
|
992
|
+
let onDragOver = (e)=>{
|
|
993
|
+
e.preventDefault();
|
|
994
|
+
e.stopPropagation();
|
|
995
|
+
if (e.clientX === state.x && e.clientY === state.y) {
|
|
996
|
+
e.dataTransfer.dropEffect = state.dropEffect;
|
|
997
|
+
return;
|
|
998
|
+
}
|
|
999
|
+
state.x = e.clientX;
|
|
1000
|
+
state.y = e.clientY;
|
|
1001
|
+
if (typeof options.getDropOperationForPoint === 'function') {
|
|
1002
|
+
let allowedOperations = $8946a7288b8c2406$var$effectAllowedToOperations(e.dataTransfer.effectAllowed);
|
|
1003
|
+
let types = new $29c8537521cf08fe$export$7f04ce188c91447c(e.dataTransfer);
|
|
1004
|
+
let rect = e.currentTarget.getBoundingClientRect();
|
|
1005
|
+
let dropOperation = options.getDropOperationForPoint(types, allowedOperations, state.x - rect.x, state.y - rect.y);
|
|
1006
|
+
state.dropEffect = $d7547fb11526b355$export$5eacb0769d26d3b2[dropOperation] || 'none';
|
|
1007
|
+
}
|
|
1008
|
+
e.dataTransfer.dropEffect = state.dropEffect;
|
|
1009
|
+
if (typeof options.onDropMove === 'function') {
|
|
1010
|
+
let rect = e.currentTarget.getBoundingClientRect();
|
|
1011
|
+
options.onDropMove({
|
|
1012
|
+
type: 'dropmove',
|
|
1013
|
+
x: state.x - rect.x,
|
|
1014
|
+
y: state.y - rect.y
|
|
1015
|
+
});
|
|
1016
|
+
}
|
|
1017
|
+
clearTimeout(state.dropActivateTimer);
|
|
1018
|
+
if (typeof options.onDropActivate === 'function' && state.dropEffect !== 'none') {
|
|
1019
|
+
let rect = e.currentTarget.getBoundingClientRect();
|
|
1020
|
+
state.dropActivateTimer = setTimeout(()=>{
|
|
1021
|
+
options.onDropActivate({
|
|
1022
|
+
type: 'dropactivate',
|
|
1023
|
+
x: state.x - rect.x,
|
|
1024
|
+
y: state.y - rect.y
|
|
1025
|
+
});
|
|
1026
|
+
}, $8946a7288b8c2406$var$DROP_ACTIVATE_TIMEOUT);
|
|
1027
|
+
}
|
|
1028
|
+
};
|
|
1029
|
+
let onDragEnter = (e)=>{
|
|
1030
|
+
e.stopPropagation();
|
|
1031
|
+
state.dragEnterCount++;
|
|
1032
|
+
if (state.dragEnterCount > 1) return;
|
|
1033
|
+
let allowedOperations = $8946a7288b8c2406$var$effectAllowedToOperations(e.dataTransfer.effectAllowed);
|
|
1034
|
+
let dropOperation = allowedOperations[0];
|
|
1035
|
+
if (typeof options.getDropOperation === 'function') {
|
|
1036
|
+
let types = new $29c8537521cf08fe$export$7f04ce188c91447c(e.dataTransfer);
|
|
1037
|
+
dropOperation = options.getDropOperation(types, allowedOperations);
|
|
1038
|
+
}
|
|
1039
|
+
if (dropOperation !== 'cancel') setDropTarget(true);
|
|
1040
|
+
if (typeof options.getDropOperationForPoint === 'function') {
|
|
1041
|
+
let types = new $29c8537521cf08fe$export$7f04ce188c91447c(e.dataTransfer);
|
|
1042
|
+
let rect = e.currentTarget.getBoundingClientRect();
|
|
1043
|
+
dropOperation = options.getDropOperationForPoint(types, allowedOperations, e.clientX - rect.x, e.clientY - rect.y);
|
|
1044
|
+
}
|
|
1045
|
+
state.dropEffect = $d7547fb11526b355$export$5eacb0769d26d3b2[dropOperation] || 'none';
|
|
1046
|
+
e.dataTransfer.dropEffect = state.dropEffect;
|
|
1047
|
+
if (typeof options.onDropEnter === 'function' && dropOperation !== 'cancel') {
|
|
1048
|
+
let rect = e.currentTarget.getBoundingClientRect();
|
|
1049
|
+
options.onDropEnter({
|
|
1050
|
+
type: 'dropenter',
|
|
1051
|
+
x: e.clientX - rect.x,
|
|
1052
|
+
y: e.clientY - rect.y
|
|
1053
|
+
});
|
|
1054
|
+
}
|
|
1055
|
+
state.x = e.clientX;
|
|
1056
|
+
state.y = e.clientY;
|
|
1057
|
+
};
|
|
1058
|
+
let onDragLeave = (e)=>{
|
|
1059
|
+
e.stopPropagation();
|
|
1060
|
+
state.dragEnterCount--;
|
|
1061
|
+
if (state.dragEnterCount > 0) return;
|
|
1062
|
+
if (typeof options.onDropExit === 'function' && state.dropEffect !== 'none') {
|
|
1063
|
+
let rect = e.currentTarget.getBoundingClientRect();
|
|
1064
|
+
options.onDropExit({
|
|
1065
|
+
type: 'dropexit',
|
|
1066
|
+
x: e.clientX - rect.x,
|
|
1067
|
+
y: e.clientY - rect.y
|
|
1068
|
+
});
|
|
1069
|
+
}
|
|
1070
|
+
setDropTarget(false);
|
|
1071
|
+
clearTimeout(state.dropActivateTimer);
|
|
1072
|
+
};
|
|
1073
|
+
let onDrop = (e)=>{
|
|
1074
|
+
e.preventDefault();
|
|
1075
|
+
e.stopPropagation();
|
|
1076
|
+
if (typeof options.onDrop === 'function') {
|
|
1077
|
+
let dropOperation = $d7547fb11526b355$export$608ecc6f1b23c35d[state.dropEffect];
|
|
1078
|
+
let items = $29c8537521cf08fe$export$d9e760437831f8b3(e.dataTransfer);
|
|
1079
|
+
let rect = e.currentTarget.getBoundingClientRect();
|
|
1080
|
+
let event = {
|
|
1081
|
+
type: 'drop',
|
|
1082
|
+
x: e.clientX - rect.x,
|
|
1083
|
+
y: e.clientY - rect.y,
|
|
1084
|
+
items: items,
|
|
1085
|
+
dropOperation: dropOperation
|
|
1086
|
+
};
|
|
1087
|
+
// Wait a frame to dispatch the drop event so that we ensure the dragend event fires first.
|
|
1088
|
+
// Otherwise, if onDrop removes the original dragged element from the DOM, dragend will never be fired.
|
|
1089
|
+
// This behavior is consistent across browsers, but see this issue for details:
|
|
1090
|
+
// https://bugzilla.mozilla.org/show_bug.cgi?id=460801
|
|
1091
|
+
setTimeout(()=>{
|
|
1092
|
+
options.onDrop(event);
|
|
1093
|
+
}, 0);
|
|
1094
|
+
}
|
|
1095
|
+
if (typeof options.onDropExit === 'function') {
|
|
1096
|
+
let rect = e.currentTarget.getBoundingClientRect();
|
|
1097
|
+
options.onDropExit({
|
|
1098
|
+
type: 'dropexit',
|
|
1099
|
+
x: e.clientX - rect.x,
|
|
1100
|
+
y: e.clientY - rect.y
|
|
1101
|
+
});
|
|
1102
|
+
}
|
|
1103
|
+
state.dragEnterCount = 0;
|
|
1104
|
+
setDropTarget(false);
|
|
1105
|
+
clearTimeout(state.dropActivateTimer);
|
|
1106
|
+
};
|
|
1107
|
+
let optionsRef = $67uu7$react.useRef(options);
|
|
1108
|
+
optionsRef.current = options;
|
|
1109
|
+
$67uu7$reactariautils.useLayoutEffect(()=>$7b1813d52b80b911$export$c28d9fb4a54e471a({
|
|
1110
|
+
element: optionsRef.current.ref.current,
|
|
1111
|
+
getDropOperation: optionsRef.current.getDropOperation,
|
|
1112
|
+
onDropEnter (e) {
|
|
1113
|
+
setDropTarget(true);
|
|
1114
|
+
if (typeof optionsRef.current.onDropEnter === 'function') optionsRef.current.onDropEnter(e);
|
|
1115
|
+
},
|
|
1116
|
+
onDropExit (e) {
|
|
1117
|
+
setDropTarget(false);
|
|
1118
|
+
if (typeof optionsRef.current.onDropExit === 'function') optionsRef.current.onDropExit(e);
|
|
1119
|
+
},
|
|
1120
|
+
onDrop (e) {
|
|
1121
|
+
if (typeof optionsRef.current.onDrop === 'function') optionsRef.current.onDrop(e);
|
|
1122
|
+
},
|
|
1123
|
+
onDropActivate (e) {
|
|
1124
|
+
if (typeof optionsRef.current.onDropActivate === 'function') optionsRef.current.onDropActivate(e);
|
|
1813
1125
|
}
|
|
1126
|
+
})
|
|
1127
|
+
, [
|
|
1128
|
+
optionsRef
|
|
1129
|
+
]);
|
|
1130
|
+
let { dropProps: dropProps } = $06a19d9f22d42d75$export$62447ad3d2ec7da6();
|
|
1131
|
+
return {
|
|
1132
|
+
dropProps: {
|
|
1133
|
+
...dropProps,
|
|
1134
|
+
onDragEnter: onDragEnter,
|
|
1135
|
+
onDragOver: onDragOver,
|
|
1136
|
+
onDragLeave: onDragLeave,
|
|
1137
|
+
onDrop: onDrop
|
|
1138
|
+
},
|
|
1139
|
+
isDropTarget: isDropTarget
|
|
1140
|
+
};
|
|
1141
|
+
}
|
|
1142
|
+
function $8946a7288b8c2406$var$effectAllowedToOperations(effectAllowed) {
|
|
1143
|
+
let allowedOperationsBits = $d7547fb11526b355$export$9bbdfc78cf083e16[effectAllowed];
|
|
1144
|
+
let allowedOperations = [];
|
|
1145
|
+
if (allowedOperationsBits & $d7547fb11526b355$export$60b7b4bcf3903d8e.move) allowedOperations.push('move');
|
|
1146
|
+
if (allowedOperationsBits & $d7547fb11526b355$export$60b7b4bcf3903d8e.copy) allowedOperations.push('copy');
|
|
1147
|
+
if (allowedOperationsBits & $d7547fb11526b355$export$60b7b4bcf3903d8e.link) allowedOperations.push('link');
|
|
1148
|
+
return allowedOperations;
|
|
1149
|
+
}
|
|
1814
1150
|
|
|
1815
|
-
case 'PageDown':
|
|
1816
|
-
{
|
|
1817
|
-
if (keyboardDelegate.getKeyPageBelow) {
|
|
1818
|
-
var _target;
|
|
1819
1151
|
|
|
1820
|
-
|
|
1152
|
+
var $783cde594bac15e2$exports = {};
|
|
1821
1153
|
|
|
1822
|
-
|
|
1823
|
-
target = nextValidTarget(null, types, drag.allowedDropOperations, getNextTarget);
|
|
1824
|
-
} else {
|
|
1825
|
-
// If on the root, go to the item a page below the top. Otherwise a page below the current item.
|
|
1826
|
-
let nextKey = keyboardDelegate.getKeyPageBelow(target.type === 'item' ? target.key : keyboardDelegate.getFirstKey());
|
|
1827
|
-
let dropPosition = target.type === 'item' ? target.dropPosition : 'after'; // If there is no next key, or we are starting on the last key, jump to the last possible position.
|
|
1154
|
+
$parcel$export($783cde594bac15e2$exports, "useDroppableCollection", () => $783cde594bac15e2$export$f4e2f423c21f7b04);
|
|
1828
1155
|
|
|
1829
|
-
if (nextKey == null || target.type === 'item' && target.key === keyboardDelegate.getLastKey()) {
|
|
1830
|
-
nextKey = keyboardDelegate.getLastKey();
|
|
1831
|
-
dropPosition = 'after';
|
|
1832
|
-
}
|
|
1833
1156
|
|
|
1834
|
-
target = {
|
|
1835
|
-
type: 'item',
|
|
1836
|
-
key: nextKey,
|
|
1837
|
-
dropPosition
|
|
1838
|
-
}; // If the target does not accept the drop, find the next valid target.
|
|
1839
|
-
// If no next valid target, find the previous valid target.
|
|
1840
1157
|
|
|
1841
|
-
let operation = localState.state.getDropOperation(target, types, drag.allowedDropOperations);
|
|
1842
1158
|
|
|
1843
|
-
if (operation === 'cancel') {
|
|
1844
|
-
var _nextValidTarget2;
|
|
1845
1159
|
|
|
1846
|
-
target = (_nextValidTarget2 = nextValidTarget(target, types, drag.allowedDropOperations, getNextTarget, false)) != null ? _nextValidTarget2 : nextValidTarget(target, types, drag.allowedDropOperations, getPreviousTarget, false);
|
|
1847
|
-
}
|
|
1848
|
-
}
|
|
1849
1160
|
|
|
1850
|
-
localState.state.setTarget((_target = target) != null ? _target : localState.state.target);
|
|
1851
|
-
}
|
|
1852
1161
|
|
|
1853
|
-
|
|
1162
|
+
const $e7eb5ef06b31c864$var$AUTOSCROLL_AREA_SIZE = 20;
|
|
1163
|
+
function $e7eb5ef06b31c864$export$6323452ca4533ed8(ref) {
|
|
1164
|
+
let scrollableRef = $67uu7$react.useRef(null);
|
|
1165
|
+
$67uu7$react.useEffect(()=>{
|
|
1166
|
+
if (ref.current) scrollableRef.current = $67uu7$reactariautils.getScrollParent(ref.current);
|
|
1167
|
+
}, [
|
|
1168
|
+
ref
|
|
1169
|
+
]);
|
|
1170
|
+
let state = $67uu7$react.useRef({
|
|
1171
|
+
timer: null,
|
|
1172
|
+
dx: 0,
|
|
1173
|
+
dy: 0
|
|
1174
|
+
}).current;
|
|
1175
|
+
let scroll = $67uu7$react.useCallback(()=>{
|
|
1176
|
+
scrollableRef.current.scrollLeft += state.dx;
|
|
1177
|
+
scrollableRef.current.scrollTop += state.dy;
|
|
1178
|
+
if (state.timer) state.timer = requestAnimationFrame(scroll);
|
|
1179
|
+
}, [
|
|
1180
|
+
scrollableRef,
|
|
1181
|
+
state
|
|
1182
|
+
]);
|
|
1183
|
+
return {
|
|
1184
|
+
move (x, y) {
|
|
1185
|
+
// Most browsers auto scroll natively, but WebKit on macOS does not (iOS does 🤷♂️).
|
|
1186
|
+
// https://bugs.webkit.org/show_bug.cgi?id=222636
|
|
1187
|
+
if (!$67uu7$reactariautils.isWebKit() || $67uu7$reactariautils.isIOS() || !scrollableRef.current) return;
|
|
1188
|
+
let box = scrollableRef.current.getBoundingClientRect();
|
|
1189
|
+
let left = $e7eb5ef06b31c864$var$AUTOSCROLL_AREA_SIZE;
|
|
1190
|
+
let top = $e7eb5ef06b31c864$var$AUTOSCROLL_AREA_SIZE;
|
|
1191
|
+
let bottom = box.height - $e7eb5ef06b31c864$var$AUTOSCROLL_AREA_SIZE;
|
|
1192
|
+
let right = box.width - $e7eb5ef06b31c864$var$AUTOSCROLL_AREA_SIZE;
|
|
1193
|
+
if (x < left || x > right || y < top || y > bottom) {
|
|
1194
|
+
if (x < left) state.dx = x - left;
|
|
1195
|
+
else if (x > right) state.dx = x - right;
|
|
1196
|
+
if (y < top) state.dy = y - top;
|
|
1197
|
+
else if (y > bottom) state.dy = y - bottom;
|
|
1198
|
+
if (!state.timer) state.timer = requestAnimationFrame(scroll);
|
|
1199
|
+
} else this.stop();
|
|
1200
|
+
},
|
|
1201
|
+
stop () {
|
|
1202
|
+
if (state.timer) {
|
|
1203
|
+
cancelAnimationFrame(state.timer);
|
|
1204
|
+
state.timer = null;
|
|
1854
1205
|
}
|
|
1206
|
+
}
|
|
1207
|
+
};
|
|
1208
|
+
}
|
|
1855
1209
|
|
|
1856
|
-
case 'PageUp':
|
|
1857
|
-
{
|
|
1858
|
-
var _target2;
|
|
1859
1210
|
|
|
1860
|
-
if (!keyboardDelegate.getKeyPageAbove) {
|
|
1861
|
-
break;
|
|
1862
|
-
}
|
|
1863
1211
|
|
|
1864
|
-
let target = localState.state.target;
|
|
1865
1212
|
|
|
1866
|
-
|
|
1867
|
-
|
|
1868
|
-
|
|
1869
|
-
|
|
1870
|
-
|
|
1871
|
-
|
|
1213
|
+
const $783cde594bac15e2$var$DROP_POSITIONS = [
|
|
1214
|
+
'before',
|
|
1215
|
+
'on',
|
|
1216
|
+
'after'
|
|
1217
|
+
];
|
|
1218
|
+
function $783cde594bac15e2$export$f4e2f423c21f7b04(props, state1, ref2) {
|
|
1219
|
+
let localState = $67uu7$react.useRef({
|
|
1220
|
+
props: props,
|
|
1221
|
+
state: state1,
|
|
1222
|
+
nextTarget: null,
|
|
1223
|
+
dropOperation: null
|
|
1224
|
+
}).current;
|
|
1225
|
+
localState.props = props;
|
|
1226
|
+
localState.state = state1;
|
|
1227
|
+
let autoScroll = $e7eb5ef06b31c864$export$6323452ca4533ed8(ref2);
|
|
1228
|
+
let { dropProps: dropProps } = $8946a7288b8c2406$export$ccdee5eaf73cf661({
|
|
1229
|
+
ref: ref2,
|
|
1230
|
+
onDropEnter (e) {
|
|
1231
|
+
let target = props.getDropTargetFromPoint(e.x, e.y);
|
|
1232
|
+
state1.setTarget(target);
|
|
1233
|
+
},
|
|
1234
|
+
onDropMove (e) {
|
|
1235
|
+
state1.setTarget(localState.nextTarget);
|
|
1236
|
+
autoScroll.move(e.x, e.y);
|
|
1237
|
+
},
|
|
1238
|
+
getDropOperationForPoint (types, allowedOperations, x, y) {
|
|
1239
|
+
let target = props.getDropTargetFromPoint(x, y);
|
|
1240
|
+
if (!target) {
|
|
1241
|
+
localState.dropOperation = 'cancel';
|
|
1242
|
+
localState.nextTarget = null;
|
|
1243
|
+
return 'cancel';
|
|
1244
|
+
}
|
|
1245
|
+
if (state1.isDropTarget(target)) {
|
|
1246
|
+
localState.nextTarget = target;
|
|
1247
|
+
return localState.dropOperation;
|
|
1248
|
+
}
|
|
1249
|
+
localState.dropOperation = state1.getDropOperation(target, types, allowedOperations);
|
|
1250
|
+
// If the target doesn't accept the drop, see if the root accepts it instead.
|
|
1251
|
+
if (localState.dropOperation === 'cancel') {
|
|
1252
|
+
let rootTarget = {
|
|
1872
1253
|
type: 'root'
|
|
1873
|
-
|
|
1874
|
-
|
|
1875
|
-
|
|
1876
|
-
|
|
1877
|
-
|
|
1878
|
-
if (nextKey == null) {
|
|
1879
|
-
nextKey = keyboardDelegate.getFirstKey();
|
|
1880
|
-
dropPosition = 'before';
|
|
1881
|
-
}
|
|
1882
|
-
|
|
1883
|
-
target = {
|
|
1884
|
-
type: 'item',
|
|
1885
|
-
key: nextKey,
|
|
1886
|
-
dropPosition
|
|
1887
|
-
};
|
|
1888
|
-
} // If the target does not accept the drop, find the previous valid target.
|
|
1889
|
-
// If no next valid target, find the next valid target.
|
|
1890
|
-
|
|
1891
|
-
|
|
1892
|
-
let operation = localState.state.getDropOperation(target, types, drag.allowedDropOperations);
|
|
1893
|
-
|
|
1894
|
-
if (operation === 'cancel') {
|
|
1895
|
-
var _nextValidTarget3;
|
|
1896
|
-
|
|
1897
|
-
target = (_nextValidTarget3 = nextValidTarget(target, types, drag.allowedDropOperations, getPreviousTarget, false)) != null ? _nextValidTarget3 : nextValidTarget(target, types, drag.allowedDropOperations, getNextTarget, false);
|
|
1254
|
+
};
|
|
1255
|
+
let dropOperation = state1.getDropOperation(rootTarget, types, allowedOperations);
|
|
1256
|
+
if (dropOperation !== 'cancel') {
|
|
1257
|
+
target = rootTarget;
|
|
1258
|
+
localState.dropOperation = dropOperation;
|
|
1898
1259
|
}
|
|
1899
|
-
}
|
|
1900
|
-
|
|
1901
|
-
localState.state.setTarget((_target2 = target) != null ? _target2 : localState.state.target);
|
|
1902
|
-
break;
|
|
1903
1260
|
}
|
|
1261
|
+
localState.nextTarget = localState.dropOperation === 'cancel' ? null : target;
|
|
1262
|
+
return localState.dropOperation;
|
|
1263
|
+
},
|
|
1264
|
+
onDropExit () {
|
|
1265
|
+
state1.setTarget(null);
|
|
1266
|
+
autoScroll.stop();
|
|
1267
|
+
},
|
|
1268
|
+
onDropActivate (e) {
|
|
1269
|
+
var ref, ref1;
|
|
1270
|
+
if (((ref = state1.target) === null || ref === void 0 ? void 0 : ref.type) === 'item' && ((ref1 = state1.target) === null || ref1 === void 0 ? void 0 : ref1.dropPosition) === 'on' && typeof props.onDropActivate === 'function') props.onDropActivate({
|
|
1271
|
+
type: 'dropactivate',
|
|
1272
|
+
x: e.x,
|
|
1273
|
+
y: e.y,
|
|
1274
|
+
target: state1.target
|
|
1275
|
+
});
|
|
1276
|
+
},
|
|
1277
|
+
onDrop (e) {
|
|
1278
|
+
if (state1.target && typeof props.onDrop === 'function') onDrop(e, state1.target);
|
|
1904
1279
|
}
|
|
1905
|
-
}
|
|
1906
|
-
|
|
1907
1280
|
});
|
|
1908
|
-
|
|
1909
|
-
|
|
1910
|
-
|
|
1911
|
-
|
|
1912
|
-
|
|
1913
|
-
|
|
1914
|
-
|
|
1915
|
-
|
|
1916
|
-
|
|
1917
|
-
|
|
1918
|
-
|
|
1919
|
-
|
|
1920
|
-
|
|
1921
|
-
|
|
1922
|
-
|
|
1923
|
-
|
|
1924
|
-
|
|
1925
|
-
|
|
1926
|
-
|
|
1927
|
-
|
|
1928
|
-
|
|
1929
|
-
|
|
1930
|
-
|
|
1931
|
-
|
|
1932
|
-
|
|
1933
|
-
|
|
1281
|
+
let droppingState = $67uu7$react.useRef(null);
|
|
1282
|
+
let onDrop = $67uu7$react.useCallback((e, target)=>{
|
|
1283
|
+
let { state: state2 } = localState;
|
|
1284
|
+
// Focus the collection.
|
|
1285
|
+
state2.selectionManager.setFocused(true);
|
|
1286
|
+
// Save some state of the collection/selection before the drop occurs so we can compare later.
|
|
1287
|
+
let focusedKey = state2.selectionManager.focusedKey;
|
|
1288
|
+
droppingState.current = {
|
|
1289
|
+
timeout: null,
|
|
1290
|
+
focusedKey: focusedKey,
|
|
1291
|
+
collection: state2.collection,
|
|
1292
|
+
selectedKeys: state2.selectionManager.selectedKeys
|
|
1293
|
+
};
|
|
1294
|
+
localState.props.onDrop({
|
|
1295
|
+
type: 'drop',
|
|
1296
|
+
x: e.x,
|
|
1297
|
+
y: e.y,
|
|
1298
|
+
target: target,
|
|
1299
|
+
items: e.items,
|
|
1300
|
+
dropOperation: e.dropOperation
|
|
1301
|
+
});
|
|
1302
|
+
// Wait for a short time period after the onDrop is called to allow the data to be read asynchronously
|
|
1303
|
+
// and for React to re-render. If an insert occurs during this time, it will be selected/focused below.
|
|
1304
|
+
// If items are not "immediately" inserted by the onDrop handler, the application will need to handle
|
|
1305
|
+
// selecting and focusing those items themselves.
|
|
1306
|
+
droppingState.current.timeout = setTimeout(()=>{
|
|
1307
|
+
// If focus didn't move already (e.g. due to an insert), and the user dropped on an item,
|
|
1308
|
+
// focus that item and show the focus ring to give the user feedback that the drop occurred.
|
|
1309
|
+
// Also show the focus ring if the focused key is not selected, e.g. in case of a reorder.
|
|
1310
|
+
let { state: state } = localState;
|
|
1311
|
+
if (state.selectionManager.focusedKey === focusedKey) {
|
|
1312
|
+
if (target.type === 'item' && target.dropPosition === 'on' && state.collection.getItem(target.key) != null) {
|
|
1313
|
+
state.selectionManager.setFocusedKey(target.key);
|
|
1314
|
+
state.selectionManager.setFocused(true);
|
|
1315
|
+
$67uu7$reactariainteractions.setInteractionModality('keyboard');
|
|
1316
|
+
} else if (!state.selectionManager.isSelected(focusedKey)) $67uu7$reactariainteractions.setInteractionModality('keyboard');
|
|
1317
|
+
}
|
|
1318
|
+
droppingState.current = null;
|
|
1319
|
+
}, 50);
|
|
1320
|
+
}, [
|
|
1321
|
+
localState
|
|
1322
|
+
]);
|
|
1323
|
+
// eslint-disable-next-line arrow-body-style
|
|
1324
|
+
$67uu7$react.useEffect(()=>{
|
|
1325
|
+
return ()=>{
|
|
1326
|
+
if (droppingState.current) clearTimeout(droppingState.current.timeout);
|
|
1327
|
+
};
|
|
1328
|
+
}, []);
|
|
1329
|
+
$67uu7$reactariautils.useLayoutEffect(()=>{
|
|
1330
|
+
// If an insert occurs during a drop, we want to immediately select these items to give
|
|
1331
|
+
// feedback to the user that a drop occurred. Only do this if the selection didn't change
|
|
1332
|
+
// since the drop started so we don't override if the user or application did something.
|
|
1333
|
+
if (droppingState.current && state1.selectionManager.isFocused && state1.collection.size > droppingState.current.collection.size && state1.selectionManager.isSelectionEqual(droppingState.current.selectedKeys)) {
|
|
1334
|
+
let newKeys = new Set();
|
|
1335
|
+
for (let key of state1.collection.getKeys())if (!droppingState.current.collection.getItem(key)) newKeys.add(key);
|
|
1336
|
+
state1.selectionManager.setSelectedKeys(newKeys);
|
|
1337
|
+
// If the focused item didn't change since the drop occurred, also focus the first
|
|
1338
|
+
// inserted item. If selection is disabled, then also show the focus ring so there
|
|
1339
|
+
// is some indication that items were added.
|
|
1340
|
+
if (state1.selectionManager.focusedKey === droppingState.current.focusedKey) {
|
|
1341
|
+
let first = newKeys.keys().next().value;
|
|
1342
|
+
state1.selectionManager.setFocusedKey(first);
|
|
1343
|
+
if (state1.selectionManager.selectionMode === 'none') $67uu7$reactariainteractions.setInteractionModality('keyboard');
|
|
1344
|
+
}
|
|
1345
|
+
droppingState.current = null;
|
|
1934
1346
|
}
|
|
1935
|
-
|
|
1936
|
-
});
|
|
1937
|
-
}
|
|
1938
|
-
}, [ref, options.target, state]);
|
|
1939
|
-
let dragSession = $a75d092e5c30878812fba78e$export$useDragSession();
|
|
1940
|
-
let isValidDropTarget = dragSession && state.getDropOperation(options.target, $bc29619458500c186021634c18dc$export$getTypes(dragSession.dragTarget.items), dragSession.dragTarget.allowedDropOperations) !== 'cancel';
|
|
1941
|
-
let isDropTarget = state.isDropTarget(options.target);
|
|
1942
|
-
useEffect(() => {
|
|
1943
|
-
if (dragSession && isDropTarget && ref.current) {
|
|
1944
|
-
ref.current.focus();
|
|
1945
|
-
}
|
|
1946
|
-
}, [isDropTarget, dragSession, ref]);
|
|
1947
|
-
return {
|
|
1948
|
-
dropProps: _babelRuntimeHelpersExtends({}, dropProps, {
|
|
1949
|
-
'aria-hidden': !dragSession || isValidDropTarget ? undefined : 'true'
|
|
1950
|
-
})
|
|
1951
|
-
};
|
|
1952
|
-
}
|
|
1953
|
-
|
|
1954
|
-
exports.useDroppableItem = useDroppableItem;
|
|
1955
|
-
// @ts-ignore
|
|
1956
|
-
const $e2ffcaef12f0c83baf595a484787300$var$intlMessages = {
|
|
1957
|
-
"en-US": _babelRuntimeHelpersInteropRequireDefault($ece80d58838919a4624d1c28b393f77$exports).default
|
|
1958
|
-
};
|
|
1959
|
-
|
|
1960
|
-
function useDropIndicator(props, state, ref) {
|
|
1961
|
-
let {
|
|
1962
|
-
target
|
|
1963
|
-
} = props;
|
|
1964
|
-
let {
|
|
1965
|
-
collection
|
|
1966
|
-
} = state;
|
|
1967
|
-
let formatMessage = useMessageFormatter($e2ffcaef12f0c83baf595a484787300$var$intlMessages);
|
|
1968
|
-
let dragSession = $a75d092e5c30878812fba78e$export$useDragSession();
|
|
1969
|
-
let {
|
|
1970
|
-
dropProps
|
|
1971
|
-
} = useDroppableItem(props, state, ref);
|
|
1972
|
-
let id = useId();
|
|
1973
|
-
|
|
1974
|
-
let getText = key => {
|
|
1975
|
-
var _collection$getItem;
|
|
1976
|
-
|
|
1977
|
-
return (_collection$getItem = collection.getItem(key)) == null ? void 0 : _collection$getItem.textValue;
|
|
1978
|
-
};
|
|
1979
|
-
|
|
1980
|
-
let label = '';
|
|
1981
|
-
let labelledBy;
|
|
1982
|
-
|
|
1983
|
-
if (target.type === 'root') {
|
|
1984
|
-
label = formatMessage('dropOnRoot');
|
|
1985
|
-
labelledBy = id + " " + $bc29619458500c186021634c18dc$export$getDroppableCollectionId(state);
|
|
1986
|
-
} else if (target.dropPosition === 'on') {
|
|
1987
|
-
label = formatMessage('dropOnItem', {
|
|
1988
|
-
itemText: getText(target.key)
|
|
1989
1347
|
});
|
|
1990
|
-
|
|
1991
|
-
|
|
1992
|
-
|
|
1993
|
-
|
|
1994
|
-
|
|
1995
|
-
|
|
1996
|
-
|
|
1997
|
-
|
|
1998
|
-
|
|
1999
|
-
|
|
2000
|
-
|
|
2001
|
-
|
|
2002
|
-
|
|
2003
|
-
|
|
2004
|
-
|
|
2005
|
-
|
|
2006
|
-
|
|
2007
|
-
|
|
2008
|
-
|
|
2009
|
-
|
|
2010
|
-
|
|
2011
|
-
|
|
2012
|
-
|
|
2013
|
-
|
|
2014
|
-
|
|
2015
|
-
|
|
2016
|
-
|
|
2017
|
-
|
|
2018
|
-
|
|
2019
|
-
|
|
1348
|
+
$67uu7$react.useEffect(()=>{
|
|
1349
|
+
let getNextTarget1 = (target, wrap = true)=>{
|
|
1350
|
+
if (!target) return {
|
|
1351
|
+
type: 'root'
|
|
1352
|
+
};
|
|
1353
|
+
let { keyboardDelegate: keyboardDelegate } = localState.props;
|
|
1354
|
+
let nextKey = target.type === 'item' ? keyboardDelegate.getKeyBelow(target.key) : keyboardDelegate.getFirstKey();
|
|
1355
|
+
let dropPosition = 'before';
|
|
1356
|
+
if (target.type === 'item') {
|
|
1357
|
+
let positionIndex = $783cde594bac15e2$var$DROP_POSITIONS.indexOf(target.dropPosition);
|
|
1358
|
+
let nextDropPosition = $783cde594bac15e2$var$DROP_POSITIONS[positionIndex + 1];
|
|
1359
|
+
if (positionIndex < $783cde594bac15e2$var$DROP_POSITIONS.length - 1 && !(nextDropPosition === 'after' && nextKey != null)) return {
|
|
1360
|
+
type: 'item',
|
|
1361
|
+
key: target.key,
|
|
1362
|
+
dropPosition: nextDropPosition
|
|
1363
|
+
};
|
|
1364
|
+
// If the last drop position was 'after', then 'before' on the next key is equivalent.
|
|
1365
|
+
// Switch to 'on' instead.
|
|
1366
|
+
if (target.dropPosition === 'after') dropPosition = 'on';
|
|
1367
|
+
}
|
|
1368
|
+
if (nextKey == null) {
|
|
1369
|
+
if (wrap) return {
|
|
1370
|
+
type: 'root'
|
|
1371
|
+
};
|
|
1372
|
+
return null;
|
|
1373
|
+
}
|
|
1374
|
+
return {
|
|
1375
|
+
type: 'item',
|
|
1376
|
+
key: nextKey,
|
|
1377
|
+
dropPosition: dropPosition
|
|
1378
|
+
};
|
|
1379
|
+
};
|
|
1380
|
+
let getPreviousTarget = (target, wrap = true)=>{
|
|
1381
|
+
let { keyboardDelegate: keyboardDelegate } = localState.props;
|
|
1382
|
+
let nextKey = (target === null || target === void 0 ? void 0 : target.type) === 'item' ? keyboardDelegate.getKeyAbove(target.key) : keyboardDelegate.getLastKey();
|
|
1383
|
+
let dropPosition = !target || target.type === 'root' ? 'after' : 'on';
|
|
1384
|
+
if ((target === null || target === void 0 ? void 0 : target.type) === 'item') {
|
|
1385
|
+
let positionIndex = $783cde594bac15e2$var$DROP_POSITIONS.indexOf(target.dropPosition);
|
|
1386
|
+
let nextDropPosition = $783cde594bac15e2$var$DROP_POSITIONS[positionIndex - 1];
|
|
1387
|
+
if (positionIndex > 0 && nextDropPosition !== 'after') return {
|
|
1388
|
+
type: 'item',
|
|
1389
|
+
key: target.key,
|
|
1390
|
+
dropPosition: nextDropPosition
|
|
1391
|
+
};
|
|
1392
|
+
// If the last drop position was 'before', then 'after' on the previous key is equivalent.
|
|
1393
|
+
// Switch to 'on' instead.
|
|
1394
|
+
if (target.dropPosition === 'before') dropPosition = 'on';
|
|
1395
|
+
}
|
|
1396
|
+
if (nextKey == null) {
|
|
1397
|
+
if (wrap) return {
|
|
1398
|
+
type: 'root'
|
|
1399
|
+
};
|
|
1400
|
+
return null;
|
|
1401
|
+
}
|
|
1402
|
+
return {
|
|
1403
|
+
type: 'item',
|
|
1404
|
+
key: nextKey,
|
|
1405
|
+
dropPosition: dropPosition
|
|
1406
|
+
};
|
|
1407
|
+
};
|
|
1408
|
+
let nextValidTarget = (target, types, allowedDropOperations, getNextTarget, wrap = true)=>{
|
|
1409
|
+
let seenRoot = 0;
|
|
1410
|
+
let operation;
|
|
1411
|
+
do {
|
|
1412
|
+
let nextTarget = getNextTarget(target, wrap);
|
|
1413
|
+
if (!nextTarget) return null;
|
|
1414
|
+
target = nextTarget;
|
|
1415
|
+
operation = localState.state.getDropOperation(nextTarget, types, allowedDropOperations);
|
|
1416
|
+
if (target.type === 'root') seenRoot++;
|
|
1417
|
+
}while (operation === 'cancel' && !localState.state.isDropTarget(target) && seenRoot < 2)
|
|
1418
|
+
if (operation === 'cancel') return null;
|
|
1419
|
+
return target;
|
|
1420
|
+
};
|
|
1421
|
+
return $7b1813d52b80b911$export$c28d9fb4a54e471a({
|
|
1422
|
+
element: ref2.current,
|
|
1423
|
+
getDropOperation (types, allowedOperations) {
|
|
1424
|
+
if (localState.state.target) return localState.state.getDropOperation(localState.state.target, types, allowedOperations);
|
|
1425
|
+
// Check if any of the targets accept the drop.
|
|
1426
|
+
// TODO: should we have a faster way of doing this or e.g. for pagination?
|
|
1427
|
+
let target = nextValidTarget(null, types, allowedOperations, getNextTarget1);
|
|
1428
|
+
return target ? 'move' : 'cancel';
|
|
1429
|
+
},
|
|
1430
|
+
onDropEnter (e, drag) {
|
|
1431
|
+
let types = $29c8537521cf08fe$export$e1d41611756c6326(drag.items);
|
|
1432
|
+
let selectionManager = localState.state.selectionManager;
|
|
1433
|
+
let target;
|
|
1434
|
+
// When entering the droppable collection for the first time, the default drop target
|
|
1435
|
+
// is after the focused key.
|
|
1436
|
+
let key = selectionManager.focusedKey;
|
|
1437
|
+
let dropPosition = 'after';
|
|
1438
|
+
// If the focused key is a cell, get the parent item instead.
|
|
1439
|
+
// For now, we assume that individual cells cannot be dropped on.
|
|
1440
|
+
let item = localState.state.collection.getItem(key);
|
|
1441
|
+
if ((item === null || item === void 0 ? void 0 : item.type) === 'cell') key = item.parentKey;
|
|
1442
|
+
// If the focused item is also selected, the default drop target is after the last selected item.
|
|
1443
|
+
// But if the focused key is the first selected item, then default to before the first selected item.
|
|
1444
|
+
// This is to make reordering lists slightly easier. If you select top down, we assume you want to
|
|
1445
|
+
// move the items down. If you select bottom up, we assume you want to move the items up.
|
|
1446
|
+
if (selectionManager.isSelected(key)) {
|
|
1447
|
+
if (selectionManager.selectedKeys.size > 1 && selectionManager.firstSelectedKey === key) dropPosition = 'before';
|
|
1448
|
+
else key = selectionManager.lastSelectedKey;
|
|
1449
|
+
}
|
|
1450
|
+
if (key != null) {
|
|
1451
|
+
target = {
|
|
1452
|
+
type: 'item',
|
|
1453
|
+
key: key,
|
|
1454
|
+
dropPosition: dropPosition
|
|
1455
|
+
};
|
|
1456
|
+
var ref;
|
|
1457
|
+
// If the default target is not valid, find the next one that is.
|
|
1458
|
+
if (localState.state.getDropOperation(target, types, drag.allowedDropOperations) === 'cancel') target = (ref = nextValidTarget(target, types, drag.allowedDropOperations, getNextTarget1, false)) !== null && ref !== void 0 ? ref : nextValidTarget(target, types, drag.allowedDropOperations, getPreviousTarget, false);
|
|
1459
|
+
}
|
|
1460
|
+
// If no focused key, then start from the root.
|
|
1461
|
+
if (!target) target = nextValidTarget(null, types, drag.allowedDropOperations, getNextTarget1);
|
|
1462
|
+
localState.state.setTarget(target);
|
|
1463
|
+
},
|
|
1464
|
+
onDropExit () {
|
|
1465
|
+
localState.state.setTarget(null);
|
|
1466
|
+
},
|
|
1467
|
+
onDropTargetEnter (target) {
|
|
1468
|
+
localState.state.setTarget(target);
|
|
1469
|
+
},
|
|
1470
|
+
onDropActivate (e) {
|
|
1471
|
+
var ref, ref3;
|
|
1472
|
+
if (((ref = localState.state.target) === null || ref === void 0 ? void 0 : ref.type) === 'item' && ((ref3 = localState.state.target) === null || ref3 === void 0 ? void 0 : ref3.dropPosition) === 'on' && typeof localState.props.onDropActivate === 'function') localState.props.onDropActivate({
|
|
1473
|
+
type: 'dropactivate',
|
|
1474
|
+
x: e.x,
|
|
1475
|
+
y: e.y,
|
|
1476
|
+
target: localState.state.target
|
|
1477
|
+
});
|
|
1478
|
+
},
|
|
1479
|
+
onDrop (e, target) {
|
|
1480
|
+
if (localState.state.target && typeof localState.props.onDrop === 'function') onDrop(e, target || localState.state.target);
|
|
1481
|
+
},
|
|
1482
|
+
onKeyDown (e, drag) {
|
|
1483
|
+
let { keyboardDelegate: keyboardDelegate } = localState.props;
|
|
1484
|
+
let types = $29c8537521cf08fe$export$e1d41611756c6326(drag.items);
|
|
1485
|
+
switch(e.key){
|
|
1486
|
+
case 'ArrowDown':
|
|
1487
|
+
if (keyboardDelegate.getKeyBelow) {
|
|
1488
|
+
let target = nextValidTarget(localState.state.target, types, drag.allowedDropOperations, getNextTarget1);
|
|
1489
|
+
localState.state.setTarget(target);
|
|
1490
|
+
}
|
|
1491
|
+
break;
|
|
1492
|
+
case 'ArrowUp':
|
|
1493
|
+
if (keyboardDelegate.getKeyAbove) {
|
|
1494
|
+
let target = nextValidTarget(localState.state.target, types, drag.allowedDropOperations, getPreviousTarget);
|
|
1495
|
+
localState.state.setTarget(target);
|
|
1496
|
+
}
|
|
1497
|
+
break;
|
|
1498
|
+
case 'Home':
|
|
1499
|
+
if (keyboardDelegate.getFirstKey) {
|
|
1500
|
+
let target = nextValidTarget(null, types, drag.allowedDropOperations, getNextTarget1);
|
|
1501
|
+
localState.state.setTarget(target);
|
|
1502
|
+
}
|
|
1503
|
+
break;
|
|
1504
|
+
case 'End':
|
|
1505
|
+
if (keyboardDelegate.getLastKey) {
|
|
1506
|
+
let target = nextValidTarget(null, types, drag.allowedDropOperations, getPreviousTarget);
|
|
1507
|
+
localState.state.setTarget(target);
|
|
1508
|
+
}
|
|
1509
|
+
break;
|
|
1510
|
+
case 'PageDown':
|
|
1511
|
+
if (keyboardDelegate.getKeyPageBelow) {
|
|
1512
|
+
let target = localState.state.target;
|
|
1513
|
+
if (!target) target = nextValidTarget(null, types, drag.allowedDropOperations, getNextTarget1);
|
|
1514
|
+
else {
|
|
1515
|
+
// If on the root, go to the item a page below the top. Otherwise a page below the current item.
|
|
1516
|
+
let nextKey = keyboardDelegate.getKeyPageBelow(target.type === 'item' ? target.key : keyboardDelegate.getFirstKey());
|
|
1517
|
+
let dropPosition = target.type === 'item' ? target.dropPosition : 'after';
|
|
1518
|
+
// If there is no next key, or we are starting on the last key, jump to the last possible position.
|
|
1519
|
+
if (nextKey == null || target.type === 'item' && target.key === keyboardDelegate.getLastKey()) {
|
|
1520
|
+
nextKey = keyboardDelegate.getLastKey();
|
|
1521
|
+
dropPosition = 'after';
|
|
1522
|
+
}
|
|
1523
|
+
target = {
|
|
1524
|
+
type: 'item',
|
|
1525
|
+
key: nextKey,
|
|
1526
|
+
dropPosition: dropPosition
|
|
1527
|
+
};
|
|
1528
|
+
// If the target does not accept the drop, find the next valid target.
|
|
1529
|
+
// If no next valid target, find the previous valid target.
|
|
1530
|
+
let operation = localState.state.getDropOperation(target, types, drag.allowedDropOperations);
|
|
1531
|
+
var ref;
|
|
1532
|
+
if (operation === 'cancel') target = (ref = nextValidTarget(target, types, drag.allowedDropOperations, getNextTarget1, false)) !== null && ref !== void 0 ? ref : nextValidTarget(target, types, drag.allowedDropOperations, getPreviousTarget, false);
|
|
1533
|
+
}
|
|
1534
|
+
localState.state.setTarget(target !== null && target !== void 0 ? target : localState.state.target);
|
|
1535
|
+
}
|
|
1536
|
+
break;
|
|
1537
|
+
case 'PageUp':
|
|
1538
|
+
{
|
|
1539
|
+
if (!keyboardDelegate.getKeyPageAbove) break;
|
|
1540
|
+
let target = localState.state.target;
|
|
1541
|
+
if (!target) target = nextValidTarget(null, types, drag.allowedDropOperations, getPreviousTarget);
|
|
1542
|
+
else if (target.type === 'item') {
|
|
1543
|
+
// If at the top already, switch to the root. Otherwise navigate a page up.
|
|
1544
|
+
if (target.key === keyboardDelegate.getFirstKey()) target = {
|
|
1545
|
+
type: 'root'
|
|
1546
|
+
};
|
|
1547
|
+
else {
|
|
1548
|
+
let nextKey = keyboardDelegate.getKeyPageAbove(target.key);
|
|
1549
|
+
let dropPosition = target.dropPosition;
|
|
1550
|
+
if (nextKey == null) {
|
|
1551
|
+
nextKey = keyboardDelegate.getFirstKey();
|
|
1552
|
+
dropPosition = 'before';
|
|
1553
|
+
}
|
|
1554
|
+
target = {
|
|
1555
|
+
type: 'item',
|
|
1556
|
+
key: nextKey,
|
|
1557
|
+
dropPosition: dropPosition
|
|
1558
|
+
};
|
|
1559
|
+
}
|
|
1560
|
+
// If the target does not accept the drop, find the previous valid target.
|
|
1561
|
+
// If no next valid target, find the next valid target.
|
|
1562
|
+
let operation = localState.state.getDropOperation(target, types, drag.allowedDropOperations);
|
|
1563
|
+
var ref4;
|
|
1564
|
+
if (operation === 'cancel') target = (ref4 = nextValidTarget(target, types, drag.allowedDropOperations, getPreviousTarget, false)) !== null && ref4 !== void 0 ? ref4 : nextValidTarget(target, types, drag.allowedDropOperations, getNextTarget1, false);
|
|
1565
|
+
}
|
|
1566
|
+
localState.state.setTarget(target !== null && target !== void 0 ? target : localState.state.target);
|
|
1567
|
+
break;
|
|
1568
|
+
}
|
|
1569
|
+
}
|
|
1570
|
+
}
|
|
1571
|
+
});
|
|
1572
|
+
}, [
|
|
1573
|
+
localState,
|
|
1574
|
+
ref2,
|
|
1575
|
+
onDrop
|
|
1576
|
+
]);
|
|
1577
|
+
let id = $29c8537521cf08fe$export$b1601eb39394a581(state1);
|
|
1578
|
+
return {
|
|
1579
|
+
collectionProps: $67uu7$reactariautils.mergeProps(dropProps, {
|
|
1580
|
+
id: id,
|
|
1581
|
+
// Remove description from collection element. If dropping on the entire collection,
|
|
1582
|
+
// there should be a drop indicator that has this description, so no need to double announce.
|
|
1583
|
+
'aria-describedby': null
|
|
1584
|
+
})
|
|
1585
|
+
};
|
|
2020
1586
|
}
|
|
2021
1587
|
|
|
2022
|
-
exports.useDropIndicator = useDropIndicator;
|
|
2023
|
-
// @ts-ignore
|
|
2024
|
-
const $a1d519dfa8f428d414c97a867b60c6f$var$intlMessages = {
|
|
2025
|
-
"en-US": _babelRuntimeHelpersInteropRequireDefault($ece80d58838919a4624d1c28b393f77$exports).default
|
|
2026
|
-
};
|
|
2027
|
-
|
|
2028
|
-
function useDraggableItem(props, state) {
|
|
2029
|
-
let formatMessage = useMessageFormatter($a1d519dfa8f428d414c97a867b60c6f$var$intlMessages);
|
|
2030
|
-
let {
|
|
2031
|
-
dragProps,
|
|
2032
|
-
dragButtonProps
|
|
2033
|
-
} = useDrag({
|
|
2034
|
-
getItems() {
|
|
2035
|
-
return state.getItems(props.key);
|
|
2036
|
-
},
|
|
2037
1588
|
|
|
2038
|
-
|
|
2039
|
-
return state.renderPreview(props.key);
|
|
2040
|
-
},
|
|
1589
|
+
var $7862eebad9f285c6$exports = {};
|
|
2041
1590
|
|
|
2042
|
-
|
|
2043
|
-
state.startDrag(props.key, e);
|
|
2044
|
-
},
|
|
1591
|
+
$parcel$export($7862eebad9f285c6$exports, "useDroppableItem", () => $7862eebad9f285c6$export$f7b0c5d28b66b6a5);
|
|
2045
1592
|
|
|
2046
|
-
onDragMove(e) {
|
|
2047
|
-
state.moveDrag(e);
|
|
2048
|
-
},
|
|
2049
1593
|
|
|
2050
|
-
onDragEnd(e) {
|
|
2051
|
-
state.endDrag(e);
|
|
2052
|
-
}
|
|
2053
1594
|
|
|
2054
|
-
});
|
|
2055
|
-
let item = state.collection.getItem(props.key);
|
|
2056
|
-
let numSelectedKeys = state.selectionManager.selectedKeys.size;
|
|
2057
|
-
let isSelected = state.selectionManager.isSelected(props.key);
|
|
2058
|
-
let message;
|
|
2059
|
-
|
|
2060
|
-
if (isSelected && numSelectedKeys > 1) {
|
|
2061
|
-
message = formatMessage('dragSelectedItems', {
|
|
2062
|
-
count: numSelectedKeys
|
|
2063
|
-
});
|
|
2064
|
-
} else {
|
|
2065
|
-
var _item$textValue;
|
|
2066
1595
|
|
|
2067
|
-
|
|
2068
|
-
|
|
2069
|
-
|
|
2070
|
-
|
|
2071
|
-
|
|
2072
|
-
|
|
2073
|
-
|
|
2074
|
-
|
|
2075
|
-
|
|
2076
|
-
|
|
2077
|
-
|
|
1596
|
+
function $7862eebad9f285c6$export$f7b0c5d28b66b6a5(options, state, ref) {
|
|
1597
|
+
let { dropProps: dropProps } = $06a19d9f22d42d75$export$62447ad3d2ec7da6();
|
|
1598
|
+
$67uu7$react.useEffect(()=>{
|
|
1599
|
+
if (ref.current) return $7b1813d52b80b911$export$aef80212ac99c003({
|
|
1600
|
+
element: ref.current,
|
|
1601
|
+
target: options.target,
|
|
1602
|
+
getDropOperation (types, allowedOperations) {
|
|
1603
|
+
return state.getDropOperation(options.target, types, allowedOperations);
|
|
1604
|
+
}
|
|
1605
|
+
});
|
|
1606
|
+
}, [
|
|
1607
|
+
ref,
|
|
1608
|
+
options.target,
|
|
1609
|
+
state
|
|
1610
|
+
]);
|
|
1611
|
+
let dragSession = $7b1813d52b80b911$export$418e185dd3f1b968();
|
|
1612
|
+
let isValidDropTarget = dragSession && state.getDropOperation(options.target, $29c8537521cf08fe$export$e1d41611756c6326(dragSession.dragTarget.items), dragSession.dragTarget.allowedDropOperations) !== 'cancel';
|
|
1613
|
+
let isDropTarget = state.isDropTarget(options.target);
|
|
1614
|
+
$67uu7$react.useEffect(()=>{
|
|
1615
|
+
if (dragSession && isDropTarget && ref.current) ref.current.focus();
|
|
1616
|
+
}, [
|
|
1617
|
+
isDropTarget,
|
|
1618
|
+
dragSession,
|
|
1619
|
+
ref
|
|
1620
|
+
]);
|
|
1621
|
+
return {
|
|
1622
|
+
dropProps: {
|
|
1623
|
+
...dropProps,
|
|
1624
|
+
'aria-hidden': !dragSession || isValidDropTarget ? undefined : 'true'
|
|
1625
|
+
}
|
|
1626
|
+
};
|
|
2078
1627
|
}
|
|
2079
1628
|
|
|
2080
|
-
exports.useDraggableItem = useDraggableItem;
|
|
2081
|
-
const $c1be8e43b63c7fad889cec0e3e2f47d5$var$globalEvents = new Map();
|
|
2082
1629
|
|
|
2083
|
-
|
|
2084
|
-
|
|
1630
|
+
var $dba686f3b740894f$exports = {};
|
|
1631
|
+
|
|
1632
|
+
$parcel$export($dba686f3b740894f$exports, "useDropIndicator", () => $dba686f3b740894f$export$8d0e41d2815afac5);
|
|
2085
1633
|
|
|
2086
|
-
if (!eventData) {
|
|
2087
|
-
let handlers = new Set();
|
|
2088
1634
|
|
|
2089
|
-
let listener = e => {
|
|
2090
|
-
for (let handler of handlers) {
|
|
2091
|
-
handler(e);
|
|
2092
|
-
}
|
|
2093
|
-
};
|
|
2094
1635
|
|
|
2095
|
-
eventData = {
|
|
2096
|
-
listener,
|
|
2097
|
-
handlers
|
|
2098
|
-
};
|
|
2099
|
-
$c1be8e43b63c7fad889cec0e3e2f47d5$var$globalEvents.set(event, eventData);
|
|
2100
|
-
document.addEventListener(event, listener);
|
|
2101
|
-
}
|
|
2102
1636
|
|
|
2103
|
-
eventData.handlers.add(fn);
|
|
2104
|
-
return () => {
|
|
2105
|
-
eventData.handlers.delete(fn);
|
|
2106
1637
|
|
|
2107
|
-
|
|
2108
|
-
|
|
2109
|
-
|
|
1638
|
+
|
|
1639
|
+
function $dba686f3b740894f$export$8d0e41d2815afac5(props, state, ref1) {
|
|
1640
|
+
let { target: target } = props;
|
|
1641
|
+
let { collection: collection } = state;
|
|
1642
|
+
let formatMessage = $67uu7$reactariai18n.useMessageFormatter((/*@__PURE__*/$parcel$interopDefault($6dae25bfb54cafe2$exports)));
|
|
1643
|
+
let dragSession = $7b1813d52b80b911$export$418e185dd3f1b968();
|
|
1644
|
+
let { dropProps: dropProps } = $7862eebad9f285c6$export$f7b0c5d28b66b6a5(props, state, ref1);
|
|
1645
|
+
let id = $67uu7$reactariautils.useId();
|
|
1646
|
+
let getText = (key)=>{
|
|
1647
|
+
var ref;
|
|
1648
|
+
return (ref = collection.getItem(key)) === null || ref === void 0 ? void 0 : ref.textValue;
|
|
1649
|
+
};
|
|
1650
|
+
let label = '';
|
|
1651
|
+
let labelledBy;
|
|
1652
|
+
if (target.type === 'root') {
|
|
1653
|
+
label = formatMessage('dropOnRoot');
|
|
1654
|
+
labelledBy = `${id} ${$29c8537521cf08fe$export$3093291712f09a77(state)}`;
|
|
1655
|
+
} else if (target.dropPosition === 'on') label = formatMessage('dropOnItem', {
|
|
1656
|
+
itemText: getText(target.key)
|
|
1657
|
+
});
|
|
1658
|
+
else {
|
|
1659
|
+
let before = target.dropPosition === 'before' ? collection.getKeyBefore(target.key) : target.key;
|
|
1660
|
+
let after = target.dropPosition === 'after' ? collection.getKeyAfter(target.key) : target.key;
|
|
1661
|
+
if (before && after) label = formatMessage('insertBetween', {
|
|
1662
|
+
beforeItemText: getText(before),
|
|
1663
|
+
afterItemText: getText(after)
|
|
1664
|
+
});
|
|
1665
|
+
else if (before) label = formatMessage('insertAfter', {
|
|
1666
|
+
itemText: getText(before)
|
|
1667
|
+
});
|
|
1668
|
+
else if (after) label = formatMessage('insertBefore', {
|
|
1669
|
+
itemText: getText(after)
|
|
1670
|
+
});
|
|
2110
1671
|
}
|
|
2111
|
-
|
|
1672
|
+
return {
|
|
1673
|
+
dropIndicatorProps: {
|
|
1674
|
+
...dropProps,
|
|
1675
|
+
id: id,
|
|
1676
|
+
'aria-roledescription': formatMessage('dropIndicator'),
|
|
1677
|
+
'aria-label': label,
|
|
1678
|
+
'aria-labelledby': labelledBy,
|
|
1679
|
+
'aria-hidden': !dragSession ? 'true' : dropProps['aria-hidden'],
|
|
1680
|
+
tabIndex: -1
|
|
1681
|
+
}
|
|
1682
|
+
};
|
|
2112
1683
|
}
|
|
2113
1684
|
|
|
2114
|
-
function useClipboard(options) {
|
|
2115
|
-
let ref = useRef(options);
|
|
2116
|
-
ref.current = options;
|
|
2117
|
-
let isFocusedRef = useRef(false);
|
|
2118
|
-
let {
|
|
2119
|
-
focusProps
|
|
2120
|
-
} = useFocus({
|
|
2121
|
-
onFocusChange: isFocused => {
|
|
2122
|
-
isFocusedRef.current = isFocused;
|
|
2123
|
-
}
|
|
2124
|
-
});
|
|
2125
|
-
useEffect(() => {
|
|
2126
|
-
let onBeforeCopy = e => {
|
|
2127
|
-
// Enable the "Copy" menu item in Safari if this element is focused and copying is supported.
|
|
2128
|
-
let options = ref.current;
|
|
2129
1685
|
|
|
2130
|
-
|
|
2131
|
-
e.preventDefault();
|
|
2132
|
-
}
|
|
2133
|
-
};
|
|
1686
|
+
var $0d235029225a739d$exports = {};
|
|
2134
1687
|
|
|
2135
|
-
|
|
2136
|
-
let options = ref.current;
|
|
1688
|
+
$parcel$export($0d235029225a739d$exports, "useDraggableItem", () => $0d235029225a739d$export$b35afafff42da2d9);
|
|
2137
1689
|
|
|
2138
|
-
if (!isFocusedRef.current || !options.getItems) {
|
|
2139
|
-
return;
|
|
2140
|
-
}
|
|
2141
1690
|
|
|
2142
|
-
|
|
2143
|
-
|
|
2144
|
-
|
|
1691
|
+
|
|
1692
|
+
function $0d235029225a739d$export$b35afafff42da2d9(props, state) {
|
|
1693
|
+
let formatMessage = $67uu7$reactariai18n.useMessageFormatter((/*@__PURE__*/$parcel$interopDefault($6dae25bfb54cafe2$exports)));
|
|
1694
|
+
let { dragProps: dragProps , dragButtonProps: dragButtonProps } = $e2630e07d35639b3$export$7941f8aafa4b6021({
|
|
1695
|
+
getItems () {
|
|
1696
|
+
return state.getItems(props.key);
|
|
1697
|
+
},
|
|
1698
|
+
renderPreview () {
|
|
1699
|
+
return state.renderPreview(props.key);
|
|
1700
|
+
},
|
|
1701
|
+
onDragStart (e) {
|
|
1702
|
+
state.startDrag(props.key, e);
|
|
1703
|
+
},
|
|
1704
|
+
onDragMove (e) {
|
|
1705
|
+
state.moveDrag(e);
|
|
1706
|
+
},
|
|
1707
|
+
onDragEnd (e) {
|
|
1708
|
+
state.endDrag(e);
|
|
1709
|
+
}
|
|
1710
|
+
});
|
|
1711
|
+
let item = state.collection.getItem(props.key);
|
|
1712
|
+
let numSelectedKeys = state.selectionManager.selectedKeys.size;
|
|
1713
|
+
let isSelected = state.selectionManager.isSelected(props.key);
|
|
1714
|
+
let message;
|
|
1715
|
+
var ref;
|
|
1716
|
+
if (isSelected && numSelectedKeys > 1) message = formatMessage('dragSelectedItems', {
|
|
1717
|
+
count: numSelectedKeys
|
|
1718
|
+
});
|
|
1719
|
+
else message = formatMessage('dragItem', {
|
|
1720
|
+
itemText: (ref = item === null || item === void 0 ? void 0 : item.textValue) !== null && ref !== void 0 ? ref : ''
|
|
1721
|
+
});
|
|
1722
|
+
return {
|
|
1723
|
+
dragProps: dragProps,
|
|
1724
|
+
dragButtonProps: {
|
|
1725
|
+
...dragButtonProps,
|
|
1726
|
+
'aria-label': message
|
|
1727
|
+
}
|
|
2145
1728
|
};
|
|
1729
|
+
}
|
|
2146
1730
|
|
|
2147
|
-
let onBeforeCut = e => {
|
|
2148
|
-
let options = ref.current;
|
|
2149
1731
|
|
|
2150
|
-
|
|
2151
|
-
e.preventDefault();
|
|
2152
|
-
}
|
|
2153
|
-
};
|
|
1732
|
+
var $15e98f67a3ab1ee9$exports = {};
|
|
2154
1733
|
|
|
2155
|
-
|
|
2156
|
-
let options = ref.current;
|
|
1734
|
+
$parcel$export($15e98f67a3ab1ee9$exports, "useClipboard", () => $15e98f67a3ab1ee9$export$2314ca2a3e892862);
|
|
2157
1735
|
|
|
2158
|
-
if (!isFocusedRef.current || !options.onCut || !options.getItems) {
|
|
2159
|
-
return;
|
|
2160
|
-
}
|
|
2161
1736
|
|
|
2162
|
-
e.preventDefault();
|
|
2163
|
-
$bc29619458500c186021634c18dc$export$writeToDataTransfer(e.clipboardData, options.getItems());
|
|
2164
|
-
options.onCut();
|
|
2165
|
-
};
|
|
2166
1737
|
|
|
2167
|
-
let onBeforePaste = e => {
|
|
2168
|
-
let options = ref.current; // Unfortunately, e.clipboardData.types is not available in this event so we always
|
|
2169
|
-
// have to enable the Paste menu item even if the type of data is unsupported.
|
|
2170
1738
|
|
|
2171
|
-
|
|
2172
|
-
|
|
2173
|
-
|
|
1739
|
+
const $15e98f67a3ab1ee9$var$globalEvents = new Map();
|
|
1740
|
+
function $15e98f67a3ab1ee9$var$addGlobalEventListener(event, fn) {
|
|
1741
|
+
let eventData = $15e98f67a3ab1ee9$var$globalEvents.get(event);
|
|
1742
|
+
if (!eventData) {
|
|
1743
|
+
let handlers = new Set();
|
|
1744
|
+
let listener = (e)=>{
|
|
1745
|
+
for (let handler of handlers)handler(e);
|
|
1746
|
+
};
|
|
1747
|
+
eventData = {
|
|
1748
|
+
listener: listener,
|
|
1749
|
+
handlers: handlers
|
|
1750
|
+
};
|
|
1751
|
+
$15e98f67a3ab1ee9$var$globalEvents.set(event, eventData);
|
|
1752
|
+
document.addEventListener(event, listener);
|
|
1753
|
+
}
|
|
1754
|
+
eventData.handlers.add(fn);
|
|
1755
|
+
return ()=>{
|
|
1756
|
+
eventData.handlers.delete(fn);
|
|
1757
|
+
if (eventData.handlers.size === 0) {
|
|
1758
|
+
document.removeEventListener(event, eventData.listener);
|
|
1759
|
+
$15e98f67a3ab1ee9$var$globalEvents.delete(event);
|
|
1760
|
+
}
|
|
2174
1761
|
};
|
|
1762
|
+
}
|
|
1763
|
+
function $15e98f67a3ab1ee9$export$2314ca2a3e892862(options1) {
|
|
1764
|
+
let ref = $67uu7$react.useRef(options1);
|
|
1765
|
+
ref.current = options1;
|
|
1766
|
+
let isFocusedRef = $67uu7$react.useRef(false);
|
|
1767
|
+
let { focusProps: focusProps } = $67uu7$reactariainteractions.useFocus({
|
|
1768
|
+
onFocusChange: (isFocused)=>{
|
|
1769
|
+
isFocusedRef.current = isFocused;
|
|
1770
|
+
}
|
|
1771
|
+
});
|
|
1772
|
+
$67uu7$react.useEffect(()=>{
|
|
1773
|
+
let onBeforeCopy = (e)=>{
|
|
1774
|
+
// Enable the "Copy" menu item in Safari if this element is focused and copying is supported.
|
|
1775
|
+
let options = ref.current;
|
|
1776
|
+
if (isFocusedRef.current && options.getItems) e.preventDefault();
|
|
1777
|
+
};
|
|
1778
|
+
let onCopy = (e)=>{
|
|
1779
|
+
var ref1;
|
|
1780
|
+
let options = ref.current;
|
|
1781
|
+
if (!isFocusedRef.current || !options.getItems) return;
|
|
1782
|
+
e.preventDefault();
|
|
1783
|
+
$29c8537521cf08fe$export$f9c1490890ddd063(e.clipboardData, options.getItems());
|
|
1784
|
+
(ref1 = options.onCopy) === null || ref1 === void 0 ? void 0 : ref1.call(options);
|
|
1785
|
+
};
|
|
1786
|
+
let onBeforeCut = (e)=>{
|
|
1787
|
+
let options = ref.current;
|
|
1788
|
+
if (isFocusedRef.current && options.onCut && options.getItems) e.preventDefault();
|
|
1789
|
+
};
|
|
1790
|
+
let onCut = (e)=>{
|
|
1791
|
+
let options = ref.current;
|
|
1792
|
+
if (!isFocusedRef.current || !options.onCut || !options.getItems) return;
|
|
1793
|
+
e.preventDefault();
|
|
1794
|
+
$29c8537521cf08fe$export$f9c1490890ddd063(e.clipboardData, options.getItems());
|
|
1795
|
+
options.onCut();
|
|
1796
|
+
};
|
|
1797
|
+
let onBeforePaste = (e)=>{
|
|
1798
|
+
let options = ref.current;
|
|
1799
|
+
// Unfortunately, e.clipboardData.types is not available in this event so we always
|
|
1800
|
+
// have to enable the Paste menu item even if the type of data is unsupported.
|
|
1801
|
+
if (isFocusedRef.current && options.onPaste) e.preventDefault();
|
|
1802
|
+
};
|
|
1803
|
+
let onPaste = (e)=>{
|
|
1804
|
+
let options = ref.current;
|
|
1805
|
+
if (!isFocusedRef.current || !options.onPaste) return;
|
|
1806
|
+
e.preventDefault();
|
|
1807
|
+
let items = $29c8537521cf08fe$export$d9e760437831f8b3(e.clipboardData);
|
|
1808
|
+
options.onPaste(items);
|
|
1809
|
+
};
|
|
1810
|
+
return $67uu7$reactariautils.chain($15e98f67a3ab1ee9$var$addGlobalEventListener('beforecopy', onBeforeCopy), $15e98f67a3ab1ee9$var$addGlobalEventListener('copy', onCopy), $15e98f67a3ab1ee9$var$addGlobalEventListener('beforecut', onBeforeCut), $15e98f67a3ab1ee9$var$addGlobalEventListener('cut', onCut), $15e98f67a3ab1ee9$var$addGlobalEventListener('beforepaste', onBeforePaste), $15e98f67a3ab1ee9$var$addGlobalEventListener('paste', onPaste));
|
|
1811
|
+
}, []);
|
|
1812
|
+
return {
|
|
1813
|
+
clipboardProps: focusProps
|
|
1814
|
+
};
|
|
1815
|
+
}
|
|
2175
1816
|
|
|
2176
|
-
let onPaste = e => {
|
|
2177
|
-
let options = ref.current;
|
|
2178
|
-
|
|
2179
|
-
if (!isFocusedRef.current || !options.onPaste) {
|
|
2180
|
-
return;
|
|
2181
|
-
}
|
|
2182
1817
|
|
|
2183
|
-
|
|
2184
|
-
|
|
2185
|
-
|
|
2186
|
-
|
|
1818
|
+
$parcel$exportWildcard(module.exports, $e2630e07d35639b3$exports);
|
|
1819
|
+
$parcel$exportWildcard(module.exports, $8946a7288b8c2406$exports);
|
|
1820
|
+
$parcel$exportWildcard(module.exports, $783cde594bac15e2$exports);
|
|
1821
|
+
$parcel$exportWildcard(module.exports, $7862eebad9f285c6$exports);
|
|
1822
|
+
$parcel$exportWildcard(module.exports, $dba686f3b740894f$exports);
|
|
1823
|
+
$parcel$exportWildcard(module.exports, $0d235029225a739d$exports);
|
|
1824
|
+
$parcel$exportWildcard(module.exports, $15e98f67a3ab1ee9$exports);
|
|
2187
1825
|
|
|
2188
|
-
return chain($c1be8e43b63c7fad889cec0e3e2f47d5$var$addGlobalEventListener('beforecopy', onBeforeCopy), $c1be8e43b63c7fad889cec0e3e2f47d5$var$addGlobalEventListener('copy', onCopy), $c1be8e43b63c7fad889cec0e3e2f47d5$var$addGlobalEventListener('beforecut', onBeforeCut), $c1be8e43b63c7fad889cec0e3e2f47d5$var$addGlobalEventListener('cut', onCut), $c1be8e43b63c7fad889cec0e3e2f47d5$var$addGlobalEventListener('beforepaste', onBeforePaste), $c1be8e43b63c7fad889cec0e3e2f47d5$var$addGlobalEventListener('paste', onPaste));
|
|
2189
|
-
}, []);
|
|
2190
|
-
return {
|
|
2191
|
-
clipboardProps: focusProps
|
|
2192
|
-
};
|
|
2193
|
-
}
|
|
2194
1826
|
|
|
2195
|
-
exports.useClipboard = useClipboard;
|
|
2196
1827
|
//# sourceMappingURL=main.js.map
|