easy-file-system 2.1.98 → 2.1.99
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 +71 -29
- package/lib/div/item/entry/drag.js +2 -2
- package/lib/explorer.js +56 -20
- package/lib/item/entry/drag.js +4 -4
- package/lib/rubbishBin.js +12 -6
- package/package.json +1 -1
- package/src/div/item/entry/drag.js +1 -1
- package/src/explorer.js +53 -22
- package/src/item/entry/drag.js +3 -3
- package/src/rubbishBin.js +11 -7
package/src/explorer.js
CHANGED
|
@@ -262,28 +262,29 @@ class Explorer extends Element {
|
|
|
262
262
|
return selectedPath;
|
|
263
263
|
}
|
|
264
264
|
|
|
265
|
-
|
|
266
|
-
const
|
|
265
|
+
selectOrDeselectDragEntryItem(dragEntryItem, callHandlers = true) {
|
|
266
|
+
const disabled = this.isDisabled();
|
|
267
267
|
|
|
268
|
-
|
|
268
|
+
if (disabled) {
|
|
269
|
+
return;
|
|
270
|
+
}
|
|
269
271
|
|
|
270
|
-
|
|
272
|
+
let selected = dragEntryItem.isSelected();
|
|
271
273
|
|
|
272
|
-
|
|
273
|
-
const selected = true,
|
|
274
|
-
readOnly = dragEntryItem.isReadOnly(),
|
|
275
|
-
explorer = dragEntryItem.getExplorer();
|
|
274
|
+
const path = dragEntryItem.getPath();
|
|
276
275
|
|
|
277
|
-
|
|
276
|
+
if (selected) {
|
|
277
|
+
dragEntryItem.deselect();
|
|
278
|
+
} else {
|
|
279
|
+
this.deselectAllPaths();
|
|
280
|
+
|
|
281
|
+
this.selectPath(path);
|
|
278
282
|
}
|
|
279
|
-
}
|
|
280
283
|
|
|
281
|
-
|
|
282
|
-
const path = null;
|
|
284
|
+
selected = !selected; ///
|
|
283
285
|
|
|
284
286
|
if (callHandlers) {
|
|
285
|
-
const
|
|
286
|
-
readOnly = dragEntryItem.isReadOnly(),
|
|
287
|
+
const readOnly = dragEntryItem.isReadOnly(),
|
|
287
288
|
explorer = dragEntryItem.getExplorer();
|
|
288
289
|
|
|
289
290
|
this.callSelectHandlers(path, selected, readOnly, explorer);
|
|
@@ -321,16 +322,8 @@ class Explorer extends Element {
|
|
|
321
322
|
explorer = dragEntryItemExplorer; ///
|
|
322
323
|
|
|
323
324
|
this.moveDragEntryItems(pathMaps, explorer, () => {
|
|
324
|
-
const lastPathMap = last(pathMaps),
|
|
325
|
-
{ targetEntryPath } = lastPathMap,
|
|
326
|
-
path = targetEntryPath;
|
|
327
|
-
|
|
328
325
|
this.removeMarker();
|
|
329
326
|
|
|
330
|
-
if (path !== null) {
|
|
331
|
-
this.selectPath(path);
|
|
332
|
-
}
|
|
333
|
-
|
|
334
327
|
done();
|
|
335
328
|
});
|
|
336
329
|
}
|
|
@@ -391,6 +384,22 @@ class Explorer extends Element {
|
|
|
391
384
|
});
|
|
392
385
|
}
|
|
393
386
|
|
|
387
|
+
enable() {
|
|
388
|
+
const disabled = false;
|
|
389
|
+
|
|
390
|
+
this.setDisabled(disabled);
|
|
391
|
+
|
|
392
|
+
this.enableDrag();
|
|
393
|
+
}
|
|
394
|
+
|
|
395
|
+
disable() {
|
|
396
|
+
const disabled = true;
|
|
397
|
+
|
|
398
|
+
this.setDisabled(disabled);
|
|
399
|
+
|
|
400
|
+
this.disableDrag();
|
|
401
|
+
}
|
|
402
|
+
|
|
394
403
|
enableDrag() {
|
|
395
404
|
const dragEntryItems = this.retrieveDragEntryItems();
|
|
396
405
|
|
|
@@ -407,6 +416,26 @@ class Explorer extends Element {
|
|
|
407
416
|
});
|
|
408
417
|
}
|
|
409
418
|
|
|
419
|
+
isDisabled() {
|
|
420
|
+
const { disabled } = this.getState();
|
|
421
|
+
|
|
422
|
+
return disabled;
|
|
423
|
+
}
|
|
424
|
+
|
|
425
|
+
setDisabled(disabled) {
|
|
426
|
+
this.updateState({
|
|
427
|
+
disabled
|
|
428
|
+
});
|
|
429
|
+
}
|
|
430
|
+
|
|
431
|
+
setInitialState() {
|
|
432
|
+
const disabled = false;
|
|
433
|
+
|
|
434
|
+
this.setState({
|
|
435
|
+
disabled
|
|
436
|
+
});
|
|
437
|
+
}
|
|
438
|
+
|
|
410
439
|
didMount() {
|
|
411
440
|
const { onMove, onOpen, onSelect } = this.properties,
|
|
412
441
|
moveHandler = onMove, ///
|
|
@@ -477,6 +506,8 @@ class Explorer extends Element {
|
|
|
477
506
|
|
|
478
507
|
initialise() {
|
|
479
508
|
this.assignContext();
|
|
509
|
+
|
|
510
|
+
this.setInitialState();
|
|
480
511
|
}
|
|
481
512
|
|
|
482
513
|
static EntriesList = EntriesList;
|
package/src/item/entry/drag.js
CHANGED
|
@@ -183,7 +183,7 @@ class DragEntryItem extends EntryItem {
|
|
|
183
183
|
|
|
184
184
|
this.editNameSpan();
|
|
185
185
|
|
|
186
|
-
explorer.
|
|
186
|
+
explorer.disable();
|
|
187
187
|
}
|
|
188
188
|
|
|
189
189
|
edit() {
|
|
@@ -198,7 +198,7 @@ class DragEntryItem extends EntryItem {
|
|
|
198
198
|
|
|
199
199
|
this.editNameSpan();
|
|
200
200
|
|
|
201
|
-
explorer.
|
|
201
|
+
explorer.disable();
|
|
202
202
|
}
|
|
203
203
|
|
|
204
204
|
reset() {
|
|
@@ -209,7 +209,7 @@ class DragEntryItem extends EntryItem {
|
|
|
209
209
|
|
|
210
210
|
this.setCreated(created);
|
|
211
211
|
|
|
212
|
-
explorer.
|
|
212
|
+
explorer.enable();
|
|
213
213
|
}
|
|
214
214
|
|
|
215
215
|
cancel() {
|
package/src/rubbishBin.js
CHANGED
|
@@ -268,6 +268,16 @@ class RubbishBin extends Element {
|
|
|
268
268
|
});
|
|
269
269
|
}
|
|
270
270
|
|
|
271
|
+
setInitialState() {
|
|
272
|
+
const markerEntryItemPath = null,
|
|
273
|
+
markerEntryItemExplorer = null;
|
|
274
|
+
|
|
275
|
+
this.setState({
|
|
276
|
+
markerEntryItemPath,
|
|
277
|
+
markerEntryItemExplorer
|
|
278
|
+
});
|
|
279
|
+
}
|
|
280
|
+
|
|
271
281
|
childElements() {
|
|
272
282
|
const { OpenRubbishBinSVG, ClosedRubbishBinSVG } = this.constructor;
|
|
273
283
|
|
|
@@ -280,15 +290,9 @@ class RubbishBin extends Element {
|
|
|
280
290
|
}
|
|
281
291
|
|
|
282
292
|
initialise() {
|
|
283
|
-
const markerEntryItemPath = null,
|
|
284
|
-
markerEntryItemExplorer = null;
|
|
285
|
-
|
|
286
293
|
this.assignContext();
|
|
287
294
|
|
|
288
|
-
this.
|
|
289
|
-
markerEntryItemPath,
|
|
290
|
-
markerEntryItemExplorer
|
|
291
|
-
});
|
|
295
|
+
this.setInitialState();
|
|
292
296
|
}
|
|
293
297
|
|
|
294
298
|
static OpenRubbishBinSVG = OpenRubbishBinSVG;
|