easy-file-system 2.1.32 → 2.1.33
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 +103 -78
- package/lib/eventTypes.js +6 -6
- package/lib/example/view/explorer/first.js +5 -4
- package/lib/example/view.js +11 -11
- package/lib/explorer.js +22 -19
- package/lib/item/entry/drag/directoryName.js +15 -15
- package/lib/item/entry/drag.js +20 -2
- package/lib/list/entries.js +12 -9
- package/lib/mixins/explorer.js +19 -19
- package/lib/mixins/nameSpan.js +1 -1
- package/package.json +1 -1
- package/src/eventTypes.js +2 -2
- package/src/example/view/explorer/first.js +5 -3
- package/src/example/view.js +14 -14
- package/src/explorer.js +18 -13
- package/src/item/entry/drag/directoryName.js +45 -45
- package/src/item/entry/drag.js +23 -1
- package/src/list/entries.js +11 -11
- package/src/mixins/explorer.js +31 -31
- package/src/mixins/nameSpan.js +2 -2
package/src/eventTypes.js
CHANGED
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
export const OPEN_EVENT_TYPE = "open";
|
|
4
4
|
export const MOVE_EVENT_TYPE = "move";
|
|
5
|
+
export const EDIT_EVENT_TYPE = "edit";
|
|
5
6
|
export const CHANGE_EVENT_TYPE = "change";
|
|
6
7
|
export const CANCEL_EVENT_TYPE = "cancel";
|
|
7
|
-
export const RENAME_EVENT_TYPE = "rename";
|
|
8
8
|
export const REMOVE_EVENT_TYPE = "remove";
|
|
9
9
|
export const SELECT_EVENT_TYPE = "select";
|
|
10
10
|
export const CREATE_EVENT_TYPE = "create";
|
|
@@ -14,7 +14,7 @@ export default {
|
|
|
14
14
|
MOVE_EVENT_TYPE,
|
|
15
15
|
CHANGE_EVENT_TYPE,
|
|
16
16
|
CANCEL_EVENT_TYPE,
|
|
17
|
-
|
|
17
|
+
EDIT_EVENT_TYPE,
|
|
18
18
|
REMOVE_EVENT_TYPE,
|
|
19
19
|
SELECT_EVENT_TYPE,
|
|
20
20
|
CREATE_EVENT_TYPE
|
|
@@ -6,10 +6,12 @@ export default class FirstExplorer extends Explorer {
|
|
|
6
6
|
initialise() {
|
|
7
7
|
super.initialise();
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
this.addFilePath("directory1/file2.txt");
|
|
9
|
+
const readOnly = true;
|
|
11
10
|
|
|
12
|
-
this.
|
|
11
|
+
this.addFilePath("directory1/file1.txt", readOnly);
|
|
12
|
+
this.addFilePath("directory1/file2.txt", readOnly);
|
|
13
|
+
|
|
14
|
+
this.addDirectoryPath("directory1/directory3", readOnly);
|
|
13
15
|
}
|
|
14
16
|
|
|
15
17
|
static defaultProperties = {
|
package/src/example/view.js
CHANGED
|
@@ -11,12 +11,6 @@ import SecondExplorer from "./view/explorer/second";
|
|
|
11
11
|
const { first, second } = arrayUtilities;
|
|
12
12
|
|
|
13
13
|
export default class View extends Element {
|
|
14
|
-
createFilePathButtonClickHandler = (event, element) => {
|
|
15
|
-
const firstExplorer = this.getFirstExplorer();
|
|
16
|
-
|
|
17
|
-
firstExplorer.createFilePath();
|
|
18
|
-
}
|
|
19
|
-
|
|
20
14
|
createDirectoryPathButtonClickHandler = (event, element) => {
|
|
21
15
|
const Explorer = this.getFirstExplorer();
|
|
22
16
|
|
|
@@ -29,24 +23,30 @@ export default class View extends Element {
|
|
|
29
23
|
firstExplorer.editSelectedPath();
|
|
30
24
|
}
|
|
31
25
|
|
|
26
|
+
createFilePathButtonClickHandler = (event, element) => {
|
|
27
|
+
const firstExplorer = this.getFirstExplorer();
|
|
28
|
+
|
|
29
|
+
firstExplorer.createFilePath();
|
|
30
|
+
}
|
|
31
|
+
|
|
32
32
|
openHandler = (filePath, explorer) => {
|
|
33
33
|
console.log("open", filePath)
|
|
34
34
|
}
|
|
35
35
|
|
|
36
|
-
|
|
37
|
-
console.log("
|
|
36
|
+
editHandler = (pathMaps, explorer, done) => {
|
|
37
|
+
console.log("edit", JSON.stringify(pathMaps, null, " "))
|
|
38
38
|
|
|
39
39
|
done();
|
|
40
40
|
}
|
|
41
41
|
|
|
42
|
-
|
|
43
|
-
console.log("
|
|
42
|
+
moveHandler = (pathMaps, explorer, done) => {
|
|
43
|
+
console.log("move", JSON.stringify(pathMaps, null, " "))
|
|
44
44
|
|
|
45
45
|
done();
|
|
46
46
|
}
|
|
47
47
|
|
|
48
|
-
|
|
49
|
-
console.log("
|
|
48
|
+
removeHandler = (pathMaps, explorer, done) => {
|
|
49
|
+
console.log("remove", JSON.stringify(pathMaps, null, " "))
|
|
50
50
|
|
|
51
51
|
done();
|
|
52
52
|
}
|
|
@@ -88,15 +88,15 @@ export default class View extends Element {
|
|
|
88
88
|
<RubbishBin onRemove={this.removeHandler} />,
|
|
89
89
|
<FirstExplorer onOpen={this.openHandler}
|
|
90
90
|
onMove={this.moveHandler}
|
|
91
|
+
onEdit={this.editHandler}
|
|
91
92
|
onRemove={this.removeHandler}
|
|
92
|
-
onRename={this.renameHandler}
|
|
93
93
|
onCreate={this.createHandler}
|
|
94
94
|
onSelect={this.selectHandler}
|
|
95
95
|
/>,
|
|
96
96
|
<SecondExplorer onOpen={this.openHandler}
|
|
97
97
|
onMove={this.moveHandler}
|
|
98
|
+
onEdit={this.editHandler}
|
|
98
99
|
onRemove={this.removeHandler}
|
|
99
|
-
onRename={this.renameHandler}
|
|
100
100
|
onCreate={this.createHandler}
|
|
101
101
|
/>,
|
|
102
102
|
<Button onClick={this.createFilePathButtonClickHandler}>
|
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";
|
|
6
5
|
import { dropMixins } from "easy-drag-and-drop";
|
|
6
|
+
import { Element, window } from "easy";
|
|
7
7
|
import { keyCodes, pathUtilities, arrayUtilities } from "necessary";
|
|
8
8
|
|
|
9
9
|
import EntriesList from "./list/entries";
|
|
@@ -105,9 +105,10 @@ class Explorer extends Element {
|
|
|
105
105
|
|
|
106
106
|
if (selectedDragEntryItem !== null) {
|
|
107
107
|
const dragEntryItem = selectedDragEntryItem, ///
|
|
108
|
+
dragEntryItemReadOnly = dragEntryItem.isReadOnly(),
|
|
108
109
|
dragEntryItemEditable = dragEntryItem.isEditable();
|
|
109
110
|
|
|
110
|
-
if (dragEntryItemEditable) {
|
|
111
|
+
if (dragEntryItemReadOnly || dragEntryItemEditable) {
|
|
111
112
|
return;
|
|
112
113
|
}
|
|
113
114
|
|
|
@@ -307,7 +308,11 @@ class Explorer extends Element {
|
|
|
307
308
|
const selectedDragEntryItem = this.retrieveSelectedDragEntryItem();
|
|
308
309
|
|
|
309
310
|
if (selectedDragEntryItem !== null) {
|
|
310
|
-
selectedDragEntryItem.
|
|
311
|
+
const selectedDragEntryItemReadOnly = selectedDragEntryItem.isReadOnly();
|
|
312
|
+
|
|
313
|
+
if (!selectedDragEntryItemReadOnly) {
|
|
314
|
+
selectedDragEntryItem.edit();
|
|
315
|
+
}
|
|
311
316
|
}
|
|
312
317
|
}
|
|
313
318
|
|
|
@@ -353,13 +358,13 @@ class Explorer extends Element {
|
|
|
353
358
|
}
|
|
354
359
|
}
|
|
355
360
|
|
|
356
|
-
|
|
361
|
+
editDragEntryItem(dragEntryItem, done) {
|
|
357
362
|
const sourceEntryPath = sourceEntryPathFromEntryItem(dragEntryItem),
|
|
358
363
|
targetEntryPath = targetEntryPathFromEntryItem(dragEntryItem),
|
|
359
364
|
pathMaps = dragEntryItem.getPathMaps(sourceEntryPath, targetEntryPath),
|
|
360
365
|
explorer = this; ///
|
|
361
366
|
|
|
362
|
-
this.
|
|
367
|
+
this.editDragEntryItems(pathMaps, explorer, () => {
|
|
363
368
|
done();
|
|
364
369
|
});
|
|
365
370
|
}
|
|
@@ -398,8 +403,8 @@ class Explorer extends Element {
|
|
|
398
403
|
});
|
|
399
404
|
}
|
|
400
405
|
|
|
401
|
-
|
|
402
|
-
this.
|
|
406
|
+
editDragEntryItems(pathMaps, explorer, done) {
|
|
407
|
+
this.callEditHandlersAsync(pathMaps, explorer, () => {
|
|
403
408
|
pathMaps.forEach((pathMap) => {
|
|
404
409
|
this.removeDragEntryItem(pathMap, explorer);
|
|
405
410
|
});
|
|
@@ -412,8 +417,8 @@ class Explorer extends Element {
|
|
|
412
417
|
});
|
|
413
418
|
}
|
|
414
419
|
|
|
415
|
-
|
|
416
|
-
this.
|
|
420
|
+
moveDragEntryItems(pathMaps, explorer, done) {
|
|
421
|
+
this.callMoveHandlersAsync(pathMaps, explorer, () => {
|
|
417
422
|
pathMaps.forEach((pathMap) => {
|
|
418
423
|
this.removeDragEntryItem(pathMap, explorer);
|
|
419
424
|
});
|
|
@@ -426,8 +431,8 @@ class Explorer extends Element {
|
|
|
426
431
|
});
|
|
427
432
|
}
|
|
428
433
|
|
|
429
|
-
|
|
430
|
-
this.
|
|
434
|
+
removeDragEntryItems(pathMaps, explorer, done) {
|
|
435
|
+
this.callRemoveHandlersAsync(pathMaps, explorer, () => {
|
|
431
436
|
pathMaps.forEach((pathMap) => {
|
|
432
437
|
this.removeDragEntryItem(pathMap, explorer);
|
|
433
438
|
});
|
|
@@ -468,7 +473,7 @@ class Explorer extends Element {
|
|
|
468
473
|
|
|
469
474
|
this.onDrop(this.dropHandler);
|
|
470
475
|
|
|
471
|
-
|
|
476
|
+
window.onKeyDown(this.keyDownHandler);
|
|
472
477
|
|
|
473
478
|
moveHandler && this.onMove(moveHandler);
|
|
474
479
|
|
|
@@ -491,7 +496,7 @@ class Explorer extends Element {
|
|
|
491
496
|
|
|
492
497
|
this.offDrop(this.dropHandler);
|
|
493
498
|
|
|
494
|
-
|
|
499
|
+
window.onKeyDown(this.keyDownHandler);
|
|
495
500
|
|
|
496
501
|
moveHandler && this.offMove(moveHandler);
|
|
497
502
|
|
|
@@ -14,7 +14,51 @@ import { FILE_NAME_DRAG_ENTRY_TYPE, FILE_NAME_MARKER_ENTRY_TYPE, DIRECTORY_NAME_
|
|
|
14
14
|
const { concatenatePaths } = pathUtilities;
|
|
15
15
|
|
|
16
16
|
export default class DirectoryNameDragEntryItem extends DragEntryItem {
|
|
17
|
-
|
|
17
|
+
dragOverHandler = (dragElement, element) => {
|
|
18
|
+
const dragElementDragEntryItem = (dragElement instanceof DragEntryItem);
|
|
19
|
+
|
|
20
|
+
if (!dragElementDragEntryItem) {
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
const collapsed = this.isCollapsed();
|
|
25
|
+
|
|
26
|
+
if (collapsed) {
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
const path = this.getPath(),
|
|
31
|
+
explorer = this.getExplorer(),
|
|
32
|
+
dragEntryItem = dragElement, ///
|
|
33
|
+
dragEntryItemExplorer = dragEntryItem.getExplorer(),
|
|
34
|
+
dragEntryItemExplorerIgnored = explorer.isExplorerIgnored(dragEntryItemExplorer);
|
|
35
|
+
|
|
36
|
+
if (dragEntryItemExplorerIgnored) {
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
const markerEntryItem = this.retrieveMarkerEntryItem(),
|
|
41
|
+
dragEntryItemName = dragEntryItem.getName();
|
|
42
|
+
|
|
43
|
+
let markerEntryItemPath = markerEntryItem.getPath(),
|
|
44
|
+
markerEntryItemExplorer = markerEntryItem.getExplorer(),
|
|
45
|
+
previousMarkerEntryItemPath = markerEntryItemPath, ///
|
|
46
|
+
previousMarkerEntryItemExplorer = markerEntryItemExplorer; ///
|
|
47
|
+
|
|
48
|
+
markerEntryItemPath = concatenatePaths(path, dragEntryItemName);
|
|
49
|
+
|
|
50
|
+
markerEntryItemExplorer = explorer; ///
|
|
51
|
+
|
|
52
|
+
if ((markerEntryItemExplorer !== previousMarkerEntryItemExplorer) || (markerEntryItemPath !== previousMarkerEntryItemPath)) {
|
|
53
|
+
const dragEntryItemType = dragEntryItem.getType();
|
|
54
|
+
|
|
55
|
+
previousMarkerEntryItemExplorer.removeMarker();
|
|
56
|
+
|
|
57
|
+
markerEntryItemExplorer.addMarker(markerEntryItemPath, dragEntryItemType);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
dropHandler = (dragElement, aborted, element, done) => {
|
|
18
62
|
const dragElementDragEntryItem = (dragElement instanceof DragEntryItem);
|
|
19
63
|
|
|
20
64
|
if (!dragElementDragEntryItem) {
|
|
@@ -38,50 +82,6 @@ export default class DirectoryNameDragEntryItem extends DragEntryItem {
|
|
|
38
82
|
markerEntryItemExplorer.dropDragEntryItem(dragEntryItem, done);
|
|
39
83
|
}
|
|
40
84
|
|
|
41
|
-
dragOverHandler = (dragElement, element) => {
|
|
42
|
-
const dragElementDragEntryItem = (dragElement instanceof DragEntryItem);
|
|
43
|
-
|
|
44
|
-
if (!dragElementDragEntryItem) {
|
|
45
|
-
return;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
const collapsed = this.isCollapsed();
|
|
49
|
-
|
|
50
|
-
if (collapsed) {
|
|
51
|
-
return;
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
const path = this.getPath(),
|
|
55
|
-
explorer = this.getExplorer(),
|
|
56
|
-
dragEntryItem = dragElement, ///
|
|
57
|
-
dragEntryItemExplorer = dragEntryItem.getExplorer(),
|
|
58
|
-
dragEntryItemExplorerIgnored = explorer.isExplorerIgnored(dragEntryItemExplorer);
|
|
59
|
-
|
|
60
|
-
if (dragEntryItemExplorerIgnored) {
|
|
61
|
-
return;
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
const markerEntryItem = this.retrieveMarkerEntryItem(),
|
|
65
|
-
dragEntryItemName = dragEntryItem.getName();
|
|
66
|
-
|
|
67
|
-
let markerEntryItemPath = markerEntryItem.getPath(),
|
|
68
|
-
markerEntryItemExplorer = markerEntryItem.getExplorer(),
|
|
69
|
-
previousMarkerEntryItemPath = markerEntryItemPath, ///
|
|
70
|
-
previousMarkerEntryItemExplorer = markerEntryItemExplorer; ///
|
|
71
|
-
|
|
72
|
-
markerEntryItemPath = concatenatePaths(path, dragEntryItemName);
|
|
73
|
-
|
|
74
|
-
markerEntryItemExplorer = explorer; ///
|
|
75
|
-
|
|
76
|
-
if ((markerEntryItemExplorer !== previousMarkerEntryItemExplorer) || (markerEntryItemPath !== previousMarkerEntryItemPath)) {
|
|
77
|
-
const dragEntryItemType = dragEntryItem.getType();
|
|
78
|
-
|
|
79
|
-
previousMarkerEntryItemExplorer.removeMarker();
|
|
80
|
-
|
|
81
|
-
markerEntryItemExplorer.addMarker(markerEntryItemPath, dragEntryItemType);
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
|
|
85
85
|
isBefore(entryItem) {
|
|
86
86
|
let before;
|
|
87
87
|
|
package/src/item/entry/drag.js
CHANGED
|
@@ -33,7 +33,7 @@ class DragEntryItem extends EntryItem {
|
|
|
33
33
|
return;
|
|
34
34
|
}
|
|
35
35
|
|
|
36
|
-
explorer.
|
|
36
|
+
explorer.editDragEntryItem(dragEntryItem, () => {
|
|
37
37
|
this.done();
|
|
38
38
|
});
|
|
39
39
|
}
|
|
@@ -81,6 +81,12 @@ class DragEntryItem extends EntryItem {
|
|
|
81
81
|
markerEntryItemExplorer.dropDragEntryItem(dragEntryItem, done);
|
|
82
82
|
}
|
|
83
83
|
|
|
84
|
+
isReadOnly() {
|
|
85
|
+
const { readOnly } = this.properties;
|
|
86
|
+
|
|
87
|
+
return readOnly;
|
|
88
|
+
}
|
|
89
|
+
|
|
84
90
|
getPathMap(sourceEntryPath, targetEntryPath) {
|
|
85
91
|
const name = this.getName(),
|
|
86
92
|
collapsed = this.isCollapsed(),
|
|
@@ -204,6 +210,12 @@ class DragEntryItem extends EntryItem {
|
|
|
204
210
|
}
|
|
205
211
|
|
|
206
212
|
didMount() {
|
|
213
|
+
const readOnly = this.isReadOnly();
|
|
214
|
+
|
|
215
|
+
if (readOnly) {
|
|
216
|
+
return;
|
|
217
|
+
}
|
|
218
|
+
|
|
207
219
|
this.onStopDrag(this.stopDragHandler);
|
|
208
220
|
|
|
209
221
|
this.onStartDrag(this.startDragHandler);
|
|
@@ -216,6 +228,12 @@ class DragEntryItem extends EntryItem {
|
|
|
216
228
|
}
|
|
217
229
|
|
|
218
230
|
willUnmount() {
|
|
231
|
+
const readOnly = this.isReadOnly();
|
|
232
|
+
|
|
233
|
+
if (readOnly) {
|
|
234
|
+
return;
|
|
235
|
+
}
|
|
236
|
+
|
|
219
237
|
this.offStopDrag(this.stopDragHandler);
|
|
220
238
|
|
|
221
239
|
this.offStartDrag(this.startDragHandler);
|
|
@@ -245,6 +263,10 @@ class DragEntryItem extends EntryItem {
|
|
|
245
263
|
|
|
246
264
|
static NameSpan = NameSpan;
|
|
247
265
|
|
|
266
|
+
static ignoredProperties = [
|
|
267
|
+
"readOnly"
|
|
268
|
+
];
|
|
269
|
+
|
|
248
270
|
static defaultProperties = {
|
|
249
271
|
className: "drag"
|
|
250
272
|
};
|
package/src/list/entries.js
CHANGED
|
@@ -104,7 +104,7 @@ class EntriesList extends Element {
|
|
|
104
104
|
}
|
|
105
105
|
}
|
|
106
106
|
|
|
107
|
-
addFilePath(filePath) {
|
|
107
|
+
addFilePath(filePath, readOnly = false) {
|
|
108
108
|
let fileNameDragEntryItem;
|
|
109
109
|
|
|
110
110
|
const topmostDirectoryName = topmostDirectoryNameFromPath(filePath);
|
|
@@ -115,7 +115,7 @@ class EntriesList extends Element {
|
|
|
115
115
|
fileNameDragEntryItem = this.findFileNameDragEntryItem(fileName);
|
|
116
116
|
|
|
117
117
|
if (fileNameDragEntryItem === null) {
|
|
118
|
-
fileNameDragEntryItem = this.createFileNameDragEntryItem(fileName);
|
|
118
|
+
fileNameDragEntryItem = this.createFileNameDragEntryItem(fileName, readOnly);
|
|
119
119
|
|
|
120
120
|
this.addEntryItem(fileNameDragEntryItem);
|
|
121
121
|
}
|
|
@@ -134,7 +134,7 @@ class EntriesList extends Element {
|
|
|
134
134
|
|
|
135
135
|
filePath = filePathWithoutTopmostDirectoryName; ///
|
|
136
136
|
|
|
137
|
-
fileNameDragEntryItem = topmostDirectoryNameDragEntryItem.addFilePath(filePath);
|
|
137
|
+
fileNameDragEntryItem = topmostDirectoryNameDragEntryItem.addFilePath(filePath, readOnly);
|
|
138
138
|
}
|
|
139
139
|
|
|
140
140
|
return fileNameDragEntryItem;
|
|
@@ -183,7 +183,7 @@ class EntriesList extends Element {
|
|
|
183
183
|
});
|
|
184
184
|
}
|
|
185
185
|
|
|
186
|
-
addDirectoryPath(directoryPath, collapsed = true) {
|
|
186
|
+
addDirectoryPath(directoryPath, readOnly = false, collapsed = true) {
|
|
187
187
|
let directoryNameDragEntryItem;
|
|
188
188
|
|
|
189
189
|
const topmostDirectoryName = topmostDirectoryNameFromPath(directoryPath);
|
|
@@ -194,7 +194,7 @@ class EntriesList extends Element {
|
|
|
194
194
|
directoryNameDragEntryItem = this.findDirectoryNameDragEntryItem(directoryName);
|
|
195
195
|
|
|
196
196
|
if (directoryNameDragEntryItem === null) {
|
|
197
|
-
directoryNameDragEntryItem = this.createDirectoryNameDragEntryItem(directoryName, collapsed);
|
|
197
|
+
directoryNameDragEntryItem = this.createDirectoryNameDragEntryItem(directoryName, readOnly, collapsed);
|
|
198
198
|
|
|
199
199
|
this.addEntryItem(directoryNameDragEntryItem);
|
|
200
200
|
} else {
|
|
@@ -206,7 +206,7 @@ class EntriesList extends Element {
|
|
|
206
206
|
let topmostDirectoryNameDragEntryItem = this.findDirectoryNameDragEntryItem(topmostDirectoryName);
|
|
207
207
|
|
|
208
208
|
if (topmostDirectoryNameDragEntryItem === null) {
|
|
209
|
-
topmostDirectoryNameDragEntryItem = this.createDirectoryNameDragEntryItem(topmostDirectoryName, collapsed);
|
|
209
|
+
topmostDirectoryNameDragEntryItem = this.createDirectoryNameDragEntryItem(topmostDirectoryName, readOnly, collapsed);
|
|
210
210
|
|
|
211
211
|
this.addEntryItem(topmostDirectoryNameDragEntryItem);
|
|
212
212
|
}
|
|
@@ -215,7 +215,7 @@ class EntriesList extends Element {
|
|
|
215
215
|
|
|
216
216
|
directoryPath = directoryPathWithoutTopmostDirectoryName; ///
|
|
217
217
|
|
|
218
|
-
directoryNameDragEntryItem = topmostDirectoryNameDragEntryItem.addDirectoryPath(directoryPath, collapsed);
|
|
218
|
+
directoryNameDragEntryItem = topmostDirectoryNameDragEntryItem.addDirectoryPath(directoryPath, readOnly, collapsed);
|
|
219
219
|
}
|
|
220
220
|
|
|
221
221
|
return directoryNameDragEntryItem;
|
|
@@ -366,27 +366,27 @@ class EntriesList extends Element {
|
|
|
366
366
|
});
|
|
367
367
|
}
|
|
368
368
|
|
|
369
|
-
createFileNameDragEntryItem(fileName) {
|
|
369
|
+
createFileNameDragEntryItem(fileName, readOnly) {
|
|
370
370
|
const name = fileName, ///
|
|
371
371
|
explorer = this.getExplorer(),
|
|
372
372
|
FileNameDragEntryItem = explorer.getFileNameDragEntryItem(),
|
|
373
373
|
fileNameDragEntryItem =
|
|
374
374
|
|
|
375
|
-
<FileNameDragEntryItem name={name} explorer={explorer} />
|
|
375
|
+
<FileNameDragEntryItem name={name} readOnly={readOnly} explorer={explorer} />
|
|
376
376
|
|
|
377
377
|
;
|
|
378
378
|
|
|
379
379
|
return fileNameDragEntryItem;
|
|
380
380
|
}
|
|
381
381
|
|
|
382
|
-
createDirectoryNameDragEntryItem(directoryName, collapsed) {
|
|
382
|
+
createDirectoryNameDragEntryItem(directoryName, readOnly, collapsed) {
|
|
383
383
|
const name = directoryName, ///
|
|
384
384
|
topmost = this.isTopmost(),
|
|
385
385
|
explorer = this.getExplorer(),
|
|
386
386
|
DirectoryNameDragEntryItem = explorer.getDirectoryNameDragEntryItem(topmost),
|
|
387
387
|
directoryNameDragEntryItem =
|
|
388
388
|
|
|
389
|
-
<DirectoryNameDragEntryItem name={name} explorer={explorer} collapsed={collapsed} />
|
|
389
|
+
<DirectoryNameDragEntryItem name={name} explorer={explorer} readOnly={readOnly} collapsed={collapsed} />
|
|
390
390
|
|
|
391
391
|
;
|
|
392
392
|
|
package/src/mixins/explorer.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import { asynchronousUtilities } from "necessary";
|
|
4
4
|
|
|
5
|
-
import { MOVE_EVENT_TYPE, OPEN_EVENT_TYPE, REMOVE_EVENT_TYPE,
|
|
5
|
+
import { MOVE_EVENT_TYPE, OPEN_EVENT_TYPE, REMOVE_EVENT_TYPE, EDIT_EVENT_TYPE, SELECT_EVENT_TYPE, CREATE_EVENT_TYPE } from "../eventTypes";
|
|
6
6
|
|
|
7
7
|
const { forEach } = asynchronousUtilities;
|
|
8
8
|
|
|
@@ -20,6 +20,20 @@ function offOpen(openHandler, element) {
|
|
|
20
20
|
this.removeEventListener(eventType, handler, element);
|
|
21
21
|
}
|
|
22
22
|
|
|
23
|
+
function onEdit(renameHandler, element) {
|
|
24
|
+
const eventType = EDIT_EVENT_TYPE,
|
|
25
|
+
handler = renameHandler; ///
|
|
26
|
+
|
|
27
|
+
this.addEventListener(eventType, handler, element);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
function offEdit(renameHandler, element) {
|
|
31
|
+
const eventType = EDIT_EVENT_TYPE,
|
|
32
|
+
handler = renameHandler; ///
|
|
33
|
+
|
|
34
|
+
this.removeEventListener(eventType, handler, element);
|
|
35
|
+
}
|
|
36
|
+
|
|
23
37
|
function onMove(moveHandler, element) {
|
|
24
38
|
const eventType = MOVE_EVENT_TYPE,
|
|
25
39
|
handler = moveHandler; ///
|
|
@@ -48,20 +62,6 @@ function offRemove(removeHandler, element) {
|
|
|
48
62
|
this.removeEventListener(eventType, handler, element);
|
|
49
63
|
}
|
|
50
64
|
|
|
51
|
-
function onRename(renameHandler, element) {
|
|
52
|
-
const eventType = RENAME_EVENT_TYPE,
|
|
53
|
-
handler = renameHandler; ///
|
|
54
|
-
|
|
55
|
-
this.addEventListener(eventType, handler, element);
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
function offRename(renameHandler, element) {
|
|
59
|
-
const eventType = RENAME_EVENT_TYPE,
|
|
60
|
-
handler = renameHandler; ///
|
|
61
|
-
|
|
62
|
-
this.removeEventListener(eventType, handler, element);
|
|
63
|
-
}
|
|
64
|
-
|
|
65
65
|
function onCreate(createHandler, element) {
|
|
66
66
|
const eventType = CREATE_EVENT_TYPE,
|
|
67
67
|
handler = createHandler; ///
|
|
@@ -96,7 +96,7 @@ function callOpenHandlers(filePath, explorer) {
|
|
|
96
96
|
|
|
97
97
|
eventListeners.forEach((eventListener) => {
|
|
98
98
|
const { handler, element } = eventListener,
|
|
99
|
-
|
|
99
|
+
openHandler = handler; ///
|
|
100
100
|
|
|
101
101
|
openHandler.call(element, filePath, explorer, this); ///
|
|
102
102
|
});
|
|
@@ -114,42 +114,42 @@ function callSelectHandlers(path, selected, explorer) {
|
|
|
114
114
|
});
|
|
115
115
|
}
|
|
116
116
|
|
|
117
|
-
function
|
|
118
|
-
const eventType =
|
|
117
|
+
function callEditHandlersAsync(pathMaps, explorer, done) {
|
|
118
|
+
const eventType = EDIT_EVENT_TYPE,
|
|
119
119
|
eventListeners = this.findEventListeners(eventType);
|
|
120
120
|
|
|
121
121
|
forEach(eventListeners, (eventListener, next) => {
|
|
122
122
|
const { handler, element } = eventListener,
|
|
123
|
-
|
|
123
|
+
renameHandler = handler, ///
|
|
124
124
|
done = next; ///
|
|
125
125
|
|
|
126
|
-
|
|
126
|
+
renameHandler.call(element, pathMaps, explorer, done);
|
|
127
127
|
}, done);
|
|
128
128
|
}
|
|
129
129
|
|
|
130
|
-
function
|
|
131
|
-
const eventType =
|
|
130
|
+
function callMoveHandlersAsync(pathMaps, explorer, done) {
|
|
131
|
+
const eventType = MOVE_EVENT_TYPE,
|
|
132
132
|
eventListeners = this.findEventListeners(eventType);
|
|
133
133
|
|
|
134
134
|
forEach(eventListeners, (eventListener, next) => {
|
|
135
135
|
const { handler, element } = eventListener,
|
|
136
|
-
|
|
136
|
+
moveHandler = handler, ///
|
|
137
137
|
done = next; ///
|
|
138
138
|
|
|
139
|
-
|
|
139
|
+
moveHandler.call(element, pathMaps, explorer, done);
|
|
140
140
|
}, done);
|
|
141
141
|
}
|
|
142
142
|
|
|
143
|
-
function
|
|
144
|
-
const eventType =
|
|
143
|
+
function callRemoveHandlersAsync(pathMaps, explorer, done) {
|
|
144
|
+
const eventType = REMOVE_EVENT_TYPE,
|
|
145
145
|
eventListeners = this.findEventListeners(eventType);
|
|
146
146
|
|
|
147
147
|
forEach(eventListeners, (eventListener, next) => {
|
|
148
148
|
const { handler, element } = eventListener,
|
|
149
|
-
|
|
149
|
+
removeHandler = handler, ///
|
|
150
150
|
done = next; ///
|
|
151
151
|
|
|
152
|
-
|
|
152
|
+
removeHandler.call(element, pathMaps, explorer, done);
|
|
153
153
|
}, done);
|
|
154
154
|
}
|
|
155
155
|
|
|
@@ -171,19 +171,19 @@ const explorerMixins = {
|
|
|
171
171
|
offOpen,
|
|
172
172
|
onMove,
|
|
173
173
|
offMove,
|
|
174
|
+
onEdit,
|
|
175
|
+
offEdit,
|
|
174
176
|
onRemove,
|
|
175
177
|
offRemove,
|
|
176
|
-
onRename,
|
|
177
|
-
offRename,
|
|
178
178
|
onCreate,
|
|
179
179
|
offCreate,
|
|
180
180
|
onSelect,
|
|
181
181
|
offSelect,
|
|
182
182
|
callOpenHandlers,
|
|
183
183
|
callSelectHandlers,
|
|
184
|
+
callEditHandlersAsync,
|
|
184
185
|
callMoveHandlersAsync,
|
|
185
186
|
callRemoveHandlersAsync,
|
|
186
|
-
callRenameHandlersAsync,
|
|
187
187
|
callCreateHandlersAsync
|
|
188
188
|
};
|
|
189
189
|
|
package/src/mixins/nameSpan.js
CHANGED
|
@@ -43,8 +43,8 @@ function callChangeHandlers() {
|
|
|
43
43
|
}
|
|
44
44
|
|
|
45
45
|
function callCancelHandlers() {
|
|
46
|
-
|
|
47
|
-
|
|
46
|
+
const eventType = CANCEL_EVENT_TYPE,
|
|
47
|
+
eventListeners = this.findEventListeners(eventType);
|
|
48
48
|
|
|
49
49
|
eventListeners.forEach((eventListener) => {
|
|
50
50
|
const { handler, element } = eventListener,
|