easy-file-system 1.3.151 → 1.4.1
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/example.js +365 -138
- package/lib/button/svg.js +135 -0
- package/lib/div/background.js +1 -1
- package/lib/div/item/entry/directoryName.js +12 -4
- package/lib/div/item/entry/fileName.js +12 -4
- package/lib/eventTypes.js +39 -0
- package/lib/explorer.js +32 -13
- package/lib/index.js +5 -1
- package/lib/item/entry/drag/directoryName.js +5 -5
- package/lib/item/entry/drag.js +5 -5
- package/lib/rubbishBin.js +11 -10
- package/lib/svg/directoryName.js +1 -1
- package/lib/svg/fileName.js +3 -3
- package/lib/svg/marker.js +1 -1
- package/lib/svg/rubbishBin/closed.js +1 -1
- package/lib/svg/rubbishBin/open.js +1 -1
- package/lib/svg/toggle/down.js +1 -1
- package/lib/svg/toggle/up.js +1 -1
- package/package.json +4 -4
- package/src/button/svg.js +17 -0
- package/src/div/background.js +1 -1
- package/src/div/item/entry/directoryName.js +16 -3
- package/src/div/item/entry/fileName.js +16 -3
- package/src/eventTypes.js +13 -0
- package/src/explorer.js +25 -7
- package/src/index.js +2 -0
- package/src/item/entry/drag/directoryName.js +4 -4
- package/src/item/entry/drag.js +5 -5
- package/src/rubbishBin.js +7 -7
- package/src/svg/directoryName.js +1 -1
- package/src/svg/fileName.js +3 -3
- package/src/svg/marker.js +1 -1
- package/src/svg/rubbishBin/closed.js +1 -1
- package/src/svg/rubbishBin/open.js +1 -1
- package/src/svg/toggle/down.js +1 -1
- package/src/svg/toggle/up.js +1 -1
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
import SVGButton from "../../../button/svg";
|
|
3
4
|
import EntryItemDiv from "../../../div/item/entry";
|
|
4
5
|
import BackgroundDiv from "../../../div/background";
|
|
5
6
|
|
|
6
7
|
export default class FileNameEntryItemDiv extends EntryItemDiv {
|
|
7
|
-
|
|
8
|
+
nameButtonDoubleClickHandler = (event, element) => {
|
|
8
9
|
const explorer = this.getExplorer(),
|
|
9
10
|
parentElement = this.getParentElement(),
|
|
10
11
|
fileNameDragEntryItem = parentElement; ///
|
|
@@ -14,6 +15,16 @@ export default class FileNameEntryItemDiv extends EntryItemDiv {
|
|
|
14
15
|
event.stopPropagation();
|
|
15
16
|
}
|
|
16
17
|
|
|
18
|
+
svgButtonClickHandler = (event, element) => {
|
|
19
|
+
const explorer = this.getExplorer(),
|
|
20
|
+
parentElement = this.getParentElement(),
|
|
21
|
+
nameDragEntryItem = parentElement; ///
|
|
22
|
+
|
|
23
|
+
explorer.selectNameDragEntryItem(nameDragEntryItem);
|
|
24
|
+
|
|
25
|
+
event.stopPropagation();
|
|
26
|
+
}
|
|
27
|
+
|
|
17
28
|
getExplorer() {
|
|
18
29
|
const { explorer } = this.properties;
|
|
19
30
|
|
|
@@ -25,8 +36,10 @@ export default class FileNameEntryItemDiv extends EntryItemDiv {
|
|
|
25
36
|
|
|
26
37
|
return ([
|
|
27
38
|
|
|
28
|
-
<
|
|
29
|
-
|
|
39
|
+
<SVGButton onClick={this.svgButtonClickHandler} >
|
|
40
|
+
<FileNameSVG/>
|
|
41
|
+
</SVGButton>,
|
|
42
|
+
<NameButton onDoubleClick={this.nameButtonDoubleClickHandler} >
|
|
30
43
|
{name}
|
|
31
44
|
</NameButton>,
|
|
32
45
|
<BackgroundDiv/>
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
export const OPEN_EVENT_TYPE = "open";
|
|
4
|
+
export const MOVE_EVENT_TYPE = "move";
|
|
5
|
+
export const REMOVE_EVENT_TYPE = "remove";
|
|
6
|
+
export const SELECT_EVENT_TYPE = "select";
|
|
7
|
+
|
|
8
|
+
export default {
|
|
9
|
+
OPEN_EVENT_TYPE,
|
|
10
|
+
MOVE_EVENT_TYPE,
|
|
11
|
+
REMOVE_EVENT_TYPE,
|
|
12
|
+
SELECT_EVENT_TYPE
|
|
13
|
+
};
|
package/src/explorer.js
CHANGED
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
import withStyle from "easy-with-style"; ///
|
|
4
4
|
|
|
5
|
+
import { Element } from "easy";
|
|
5
6
|
import { dropMixins } from "easy-drag-and-drop";
|
|
6
|
-
import { Element, eventTypes } from "easy";
|
|
7
7
|
import { asynchronousUtilities } from "necessary";
|
|
8
8
|
|
|
9
9
|
import EntriesList from "./list/entries";
|
|
@@ -14,11 +14,11 @@ import DirectoryNameDragEntryItem from "./item/entry/drag/directoryName";
|
|
|
14
14
|
import DirectoryNameMarkerEntryItem from "./item/entry/marker/directoryName";
|
|
15
15
|
|
|
16
16
|
import { explorerPadding } from "./styles";
|
|
17
|
+
import { OPEN_EVENT_TYPE, MOVE_EVENT_TYPE, SELECT_EVENT_TYPE } from "./eventTypes";
|
|
17
18
|
import { FILE_NAME_DRAG_ENTRY_TYPE, DIRECTORY_NAME_DRAG_ENTRY_TYPE } from "./entryTypes";
|
|
18
19
|
import { sourceEntryPathFromDragEntryItemPath, targetEntryPathFromMarkerEntryItemPath } from "./utilities/pathMap";
|
|
19
20
|
|
|
20
|
-
const { forEach } = asynchronousUtilities
|
|
21
|
-
{ OPEN_EVENT_TYPE, MOVE_EVENT_TYPE } = eventTypes;
|
|
21
|
+
const { forEach } = asynchronousUtilities;
|
|
22
22
|
|
|
23
23
|
class Explorer extends Element {
|
|
24
24
|
constructor(selector, mounted) {
|
|
@@ -219,6 +219,12 @@ class Explorer extends Element {
|
|
|
219
219
|
return directoryPaths;
|
|
220
220
|
}
|
|
221
221
|
|
|
222
|
+
selectNameDragEntryItem(nameDragEntryItem) {
|
|
223
|
+
const path = nameDragEntryItem.getPath();
|
|
224
|
+
|
|
225
|
+
this.callSelectHandlers(path);
|
|
226
|
+
}
|
|
227
|
+
|
|
222
228
|
openFileNameDragEntryItem(fileNameDragEntryItem) {
|
|
223
229
|
const fileNameDragEntryItemPath = fileNameDragEntryItem.getPath(),
|
|
224
230
|
filePath = fileNameDragEntryItemPath; ///
|
|
@@ -340,6 +346,18 @@ class Explorer extends Element {
|
|
|
340
346
|
}, done);
|
|
341
347
|
}
|
|
342
348
|
|
|
349
|
+
callSelectHandlers(path) {
|
|
350
|
+
const eventType = OPEN_EVENT_TYPE,
|
|
351
|
+
eventListeners = this.findEventListeners(eventType);
|
|
352
|
+
|
|
353
|
+
eventListeners.forEach((eventListener) => {
|
|
354
|
+
const { handler, element } = eventListener,
|
|
355
|
+
openHandler = handler; ///
|
|
356
|
+
|
|
357
|
+
openHandler.call(element, path, this); ///
|
|
358
|
+
});
|
|
359
|
+
}
|
|
360
|
+
|
|
343
361
|
callOpenHandlers(filePath) {
|
|
344
362
|
const eventType = OPEN_EVENT_TYPE,
|
|
345
363
|
eventListeners = this.findEventListeners(eventType);
|
|
@@ -361,9 +379,9 @@ class Explorer extends Element {
|
|
|
361
379
|
|
|
362
380
|
this.enableDrop();
|
|
363
381
|
|
|
364
|
-
this.onDrop(this.dropHandler
|
|
382
|
+
this.onDrop(this.dropHandler);
|
|
365
383
|
|
|
366
|
-
this.onDragOver(this.dragOverHandler
|
|
384
|
+
this.onDragOver(this.dragOverHandler);
|
|
367
385
|
|
|
368
386
|
moveHandler && this.onMove(moveHandler);
|
|
369
387
|
openHandler && this.onOpen(openHandler);
|
|
@@ -378,9 +396,9 @@ class Explorer extends Element {
|
|
|
378
396
|
|
|
379
397
|
this.disableDrop();
|
|
380
398
|
|
|
381
|
-
this.offDrop(this.dropHandler
|
|
399
|
+
this.offDrop(this.dropHandler);
|
|
382
400
|
|
|
383
|
-
this.offDragOver(this.dragOverHandler
|
|
401
|
+
this.offDragOver(this.dragOverHandler);
|
|
384
402
|
|
|
385
403
|
moveHandler && this.offMove(moveHandler);
|
|
386
404
|
openHandler && this.offOpen(openHandler);
|
package/src/index.js
CHANGED
|
@@ -3,6 +3,8 @@
|
|
|
3
3
|
export { default as Explorer } from "./explorer";
|
|
4
4
|
export { default as RubbishBin } from "./rubbishBin";
|
|
5
5
|
|
|
6
|
+
export { default as eventTypes } from "./eventTypes";
|
|
7
|
+
|
|
6
8
|
export { default as NameButton } from "./button/name";
|
|
7
9
|
export { default as EntriesList } from "./list/entries";
|
|
8
10
|
export { default as ToggleButton } from "./button/toggle";
|
|
@@ -176,9 +176,9 @@ export default class DirectoryNameDragEntryItem extends DragEntryItem {
|
|
|
176
176
|
|
|
177
177
|
this.enableDrop();
|
|
178
178
|
|
|
179
|
-
this.onDrop(this.dropHandler
|
|
179
|
+
this.onDrop(this.dropHandler);
|
|
180
180
|
|
|
181
|
-
this.onDragOver(this.dragOverHandler
|
|
181
|
+
this.onDragOver(this.dragOverHandler);
|
|
182
182
|
|
|
183
183
|
super.didMount();
|
|
184
184
|
}
|
|
@@ -186,9 +186,9 @@ export default class DirectoryNameDragEntryItem extends DragEntryItem {
|
|
|
186
186
|
willUnmount() {
|
|
187
187
|
this.disableDrop();
|
|
188
188
|
|
|
189
|
-
this.offDrop(this.dropHandler
|
|
189
|
+
this.offDrop(this.dropHandler);
|
|
190
190
|
|
|
191
|
-
this.offDragOver(this.dragOverHandler
|
|
191
|
+
this.offDragOver(this.dragOverHandler);
|
|
192
192
|
|
|
193
193
|
super.willUnmount();
|
|
194
194
|
}
|
package/src/item/entry/drag.js
CHANGED
|
@@ -74,17 +74,17 @@ class DragEntryItem extends EntryItem {
|
|
|
74
74
|
}
|
|
75
75
|
|
|
76
76
|
didMount() {
|
|
77
|
-
this.onStartDrag(this.startDragHandler
|
|
77
|
+
this.onStartDrag(this.startDragHandler);
|
|
78
78
|
|
|
79
|
-
this.onStopDrag(this.stopDragHandler
|
|
79
|
+
this.onStopDrag(this.stopDragHandler);
|
|
80
80
|
|
|
81
|
-
|
|
81
|
+
this.enableDrag();
|
|
82
82
|
}
|
|
83
83
|
|
|
84
84
|
willUnmount() {
|
|
85
|
-
this.offStartDrag(this.startDragHandler
|
|
85
|
+
this.offStartDrag(this.startDragHandler);
|
|
86
86
|
|
|
87
|
-
this.offStopDrag(this.stopDragHandler
|
|
87
|
+
this.offStopDrag(this.stopDragHandler);
|
|
88
88
|
|
|
89
89
|
this.disableDrag();
|
|
90
90
|
}
|
package/src/rubbishBin.js
CHANGED
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
import withStyle from "easy-with-style"; ///
|
|
4
4
|
|
|
5
|
+
import { Element } from "easy";
|
|
5
6
|
import { dropMixins } from "easy-drag-and-drop";
|
|
6
|
-
import { Element, eventTypes } from "easy";
|
|
7
7
|
import { asynchronousUtilities } from "necessary";
|
|
8
8
|
|
|
9
9
|
import DragEntryItem from "./item/entry/drag";
|
|
@@ -12,12 +12,12 @@ import ClosedRubbishBinSVG from "./svg/rubbishBin/closed";
|
|
|
12
12
|
import FileNameMarkerEntryItem from "./item/entry/marker/fileName";
|
|
13
13
|
import DirectoryNameMarkerEntryItem from "./item/entry/marker/directoryName";
|
|
14
14
|
|
|
15
|
+
import { REMOVE_EVENT_TYPE } from "./eventTypes";
|
|
15
16
|
import { nonNullPathFromName } from "./utilities/pathMap";
|
|
16
17
|
import { sourceEntryPathFromDragEntryItemPath } from "./utilities/pathMap";
|
|
17
18
|
import { DIRECTORY_NAME_DRAG_ENTRY_TYPE, FILE_NAME_DRAG_ENTRY_TYPE } from "./entryTypes";
|
|
18
19
|
|
|
19
|
-
const { forEach } = asynchronousUtilities
|
|
20
|
-
{ REMOVE_EVENT_TYPE } = eventTypes;
|
|
20
|
+
const { forEach } = asynchronousUtilities;
|
|
21
21
|
|
|
22
22
|
class RubbishBin extends Element {
|
|
23
23
|
dropHandler = (dragElement, aborted, element, done) => {
|
|
@@ -259,9 +259,9 @@ class RubbishBin extends Element {
|
|
|
259
259
|
|
|
260
260
|
this.enableDrop();
|
|
261
261
|
|
|
262
|
-
this.onDrop(this.dropHandler
|
|
262
|
+
this.onDrop(this.dropHandler);
|
|
263
263
|
|
|
264
|
-
this.onDragOver(this.dragOverHandler
|
|
264
|
+
this.onDragOver(this.dragOverHandler);
|
|
265
265
|
|
|
266
266
|
removeHandler && this.onRemove(removeHandler);
|
|
267
267
|
|
|
@@ -274,9 +274,9 @@ class RubbishBin extends Element {
|
|
|
274
274
|
|
|
275
275
|
this.disableDrop();
|
|
276
276
|
|
|
277
|
-
this.offDrop(this.dropHandler
|
|
277
|
+
this.offDrop(this.dropHandler);
|
|
278
278
|
|
|
279
|
-
this.offDragOver(this.dragOverHandler
|
|
279
|
+
this.offDragOver(this.dragOverHandler);
|
|
280
280
|
|
|
281
281
|
removeHandler && this.offRemove(removeHandler);
|
|
282
282
|
}
|
package/src/svg/directoryName.js
CHANGED
package/src/svg/fileName.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict"
|
|
2
2
|
|
|
3
|
-
import withStyle from "easy-with-style";
|
|
3
|
+
import withStyle from "easy-with-style"; ///
|
|
4
4
|
|
|
5
5
|
import { Element } from "easy";
|
|
6
6
|
|
|
@@ -31,10 +31,10 @@ class FileNameSVG extends Element {
|
|
|
31
31
|
|
|
32
32
|
export default withStyle(FileNameSVG)`
|
|
33
33
|
|
|
34
|
-
fill:none;
|
|
34
|
+
fill: none;
|
|
35
35
|
width: auto;
|
|
36
36
|
height: ${fileNameSVGHeight};
|
|
37
|
-
stroke
|
|
37
|
+
stroke: #000000;
|
|
38
38
|
display: inline;
|
|
39
39
|
padding-left: ${fileNameSVGPaddingLeft};
|
|
40
40
|
padding-right: ${fileNameSVGPaddingRight};
|
package/src/svg/marker.js
CHANGED
package/src/svg/toggle/down.js
CHANGED