easy-file-system 1.5.34 → 1.5.37

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.
@@ -0,0 +1,81 @@
1
+ "use strict";
2
+
3
+ function addDragEntryItem(pathMap, explorer) {
4
+ const { entryDirectory } = pathMap;
5
+
6
+ entryDirectory ?
7
+ this.addDirectoryNameDragEntryItem(pathMap, explorer) :
8
+ this.addFileNameDragEntryItem(pathMap, explorer);
9
+ }
10
+
11
+ function removeDragEntryItem(pathMap, explorer) {
12
+ const { entryDirectory } = pathMap;
13
+
14
+ entryDirectory ?
15
+ this.removeDirectoryNameDragEntryItem(pathMap, explorer) :
16
+ this.removeFileNameDragEntryItem(pathMap, explorer);
17
+ }
18
+
19
+ function addFileNameDragEntryItem(pathMap, explorer) {
20
+ explorer = this; ///
21
+
22
+ const { targetEntryPath } = pathMap;
23
+
24
+ if (targetEntryPath === null) {
25
+ return;
26
+ }
27
+
28
+ const filePath = targetEntryPath; ///
29
+
30
+ explorer.addFilePath(filePath);
31
+ }
32
+
33
+ function removeFileNameDragEntryItem(pathMap, explorer) {
34
+ const { sourceEntryPath } = pathMap;
35
+
36
+ if (sourceEntryPath === null) {
37
+ return;
38
+ }
39
+
40
+ const filePath = sourceEntryPath; ///
41
+
42
+ explorer.removeFilePath(filePath);
43
+ }
44
+
45
+ function addDirectoryNameDragEntryItem(pathMap, explorer) {
46
+ explorer = this; ///
47
+
48
+ const { targetEntryPath } = pathMap;
49
+
50
+ if (targetEntryPath === null) {
51
+ return;
52
+ }
53
+
54
+ const { collapsed } = pathMap,
55
+ directoryPath = targetEntryPath; ///
56
+
57
+ explorer.addDirectoryPath(directoryPath, collapsed);
58
+ }
59
+
60
+ function removeDirectoryNameDragEntryItem(pathMap, explorer) {
61
+ const { sourceEntryPath } = pathMap;
62
+
63
+ if (sourceEntryPath === null) {
64
+ return;
65
+ }
66
+
67
+ const directoryPath = sourceEntryPath; ///
68
+
69
+ explorer.removeDirectoryPath(directoryPath);
70
+ }
71
+
72
+ const dragEntryItemMixins = {
73
+ addDragEntryItem,
74
+ removeDragEntryItem,
75
+ addFileNameDragEntryItem,
76
+ removeFileNameDragEntryItem,
77
+ addDirectoryNameDragEntryItem,
78
+ removeDirectoryNameDragEntryItem
79
+ };
80
+
81
+ export default dragEntryItemMixins;
package/src/rubbishBin.js CHANGED
@@ -9,10 +9,10 @@ import DragEntryItem from "./item/entry/drag";
9
9
  import rubbishBinMixins from "./mixins/rubbishBin";
10
10
  import OpenRubbishBinSVG from "./svg/rubbishBin/open";
11
11
  import ClosedRubbishBinSVG from "./svg/rubbishBin/closed";
12
+ import dragEntryItemMixins from "./mixins/dragEntryItem";
12
13
  import FileNameMarkerEntryItem from "./item/entry/marker/fileName";
13
14
  import DirectoryNameMarkerEntryItem from "./item/entry/marker/directoryName";
14
15
 
15
- import { nonNullPathFromName } from "./utilities/pathMap";
16
16
  import { sourceEntryPathFromEntryItem } from "./utilities/pathMap";
17
17
  import { DIRECTORY_NAME_DRAG_ENTRY_TYPE, FILE_NAME_DRAG_ENTRY_TYPE } from "./entryTypes";
18
18
 
@@ -176,42 +176,12 @@ class RubbishBin extends Element {
176
176
  this.callRemoveHandlersAsync(pathMaps, () => {
177
177
  pathMaps.forEach((pathMap) => this.removeDragEntryItem(pathMap, explorer));
178
178
 
179
+ pathMaps.forEach((pathMap) => this.addDragEntryItem(pathMap, explorer));
180
+
179
181
  done();
180
182
  });
181
183
  }
182
184
 
183
- removeDragEntryItem(pathMap, explorer) {
184
- const { entryDirectory } = pathMap;
185
-
186
- entryDirectory ?
187
- this.removeDirectoryNameDragEntryItem(pathMap, explorer) :
188
- this.removeFileNameDragEntryItem(pathMap, explorer);
189
- }
190
-
191
- removeFileNameDragEntryItem(pathMap, explorer) {
192
- const { sourceEntryPath } = pathMap;
193
-
194
- if (sourceEntryPath === null) {
195
- return;
196
- }
197
-
198
- const filePath = sourceEntryPath; ///
199
-
200
- explorer.removeFilePath(filePath);
201
- }
202
-
203
- removeDirectoryNameDragEntryItem(pathMap, explorer) {
204
- const { sourceEntryPath } = pathMap;
205
-
206
- if (sourceEntryPath === null) {
207
- return;
208
- }
209
-
210
- const directoryPath = sourceEntryPath; ///
211
-
212
- explorer.removeDirectoryPath(directoryPath);
213
- }
214
-
215
185
  open() {
216
186
  this.showOpenRubbishBinSVG();
217
187
  this.hideClosedRubbishBinSVG();
@@ -317,6 +287,7 @@ class RubbishBin extends Element {
317
287
 
318
288
  Object.assign(RubbishBin.prototype, dropMixins);
319
289
  Object.assign(RubbishBin.prototype, rubbishBinMixins);
290
+ Object.assign(RubbishBin.prototype, dragEntryItemMixins);
320
291
 
321
292
  export default withStyle(RubbishBin)`
322
293