easy-file-system 2.1.109 → 2.1.112

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.
@@ -7,10 +7,14 @@ export default class DragEntryItemDiv extends EntryItemDiv {
7
7
  const explorer = this.getExplorer(),
8
8
  dragEntryItem = this.getDragEntryItem();
9
9
 
10
+ console.log("mouse down!", element)
11
+
10
12
  explorer.selectOrDeselectDragEntryItem(dragEntryItem);
11
13
  }
12
14
 
13
15
  didMount() {
16
+ console.log("did mount...")
17
+
14
18
  this.onMouseDown(this.mouseDownHandler);
15
19
 
16
20
  this.onDoubleClick(this.doubleClickHandler);
@@ -8,10 +8,12 @@ export default class FirstExplorer extends Explorer {
8
8
 
9
9
  const readOnly = true;
10
10
 
11
- this.addFilePath("directory1/file1.txt", readOnly);
12
- this.addFilePath("directory1/file2.txt", readOnly);
11
+ this.addFilePath("file.txt", readOnly);
13
12
 
14
- this.addDirectoryPath("directory1/directory3", readOnly);
13
+ // this.addFilePath("directory1/file1.txt", readOnly);
14
+ // this.addFilePath("directory1/file2.txt", readOnly);
15
+ //
16
+ // this.addDirectoryPath("directory1/directory3", readOnly);
15
17
  }
16
18
 
17
19
  static defaultProperties = {
@@ -6,8 +6,8 @@ export default class SecondExplorer extends Explorer {
6
6
  initialise() {
7
7
  super.initialise();
8
8
 
9
- this.addFilePath("directory2/file4.txt");
10
- this.addFilePath("directory2/file5.txt");
9
+ // this.addFilePath("directory2/file4.txt");
10
+ // this.addFilePath("directory2/file5.txt");
11
11
  }
12
12
 
13
13
  static defaultProperties = {
package/src/explorer.js CHANGED
@@ -419,12 +419,24 @@ class Explorer extends Element {
419
419
  });
420
420
  }
421
421
 
422
+ isMounted() {
423
+ const { mounted } = this.getState();
424
+
425
+ return mounted;
426
+ }
427
+
422
428
  isDisabled() {
423
429
  const { disabled } = this.getState();
424
430
 
425
431
  return disabled;
426
432
  }
427
433
 
434
+ setMounted(mounted) {
435
+ this.updateState({
436
+ mounted
437
+ });
438
+ }
439
+
428
440
  setDisabled(disabled) {
429
441
  this.updateState({
430
442
  disabled
@@ -432,9 +444,11 @@ class Explorer extends Element {
432
444
  }
433
445
 
434
446
  setInitialState() {
435
- const disabled = false;
447
+ const mounted = false,
448
+ disabled = false;
436
449
 
437
450
  this.setState({
451
+ mounted,
438
452
  disabled
439
453
  });
440
454
  }
@@ -445,8 +459,6 @@ class Explorer extends Element {
445
459
  openHandler = onOpen, ///
446
460
  selectHandler = onSelect; ///
447
461
 
448
- this.mounted = true;
449
-
450
462
  this.enableDrop();
451
463
 
452
464
  this.onDragOver(this.dragOverHandler);
@@ -458,6 +470,10 @@ class Explorer extends Element {
458
470
  openHandler && this.onOpen(openHandler);
459
471
 
460
472
  selectHandler && this.onSelect(selectHandler);
473
+
474
+ const mounted = true;
475
+
476
+ this.setMounted(mounted);
461
477
  }
462
478
 
463
479
  willUnmount() {
@@ -466,8 +482,6 @@ class Explorer extends Element {
466
482
  openHandler = onOpen, ///
467
483
  selectHandler = onSelect; ///
468
484
 
469
- this.mounted = false;
470
-
471
485
  this.disableDrop();
472
486
 
473
487
  this.offDragOver(this.dragOverHandler);
@@ -479,6 +493,10 @@ class Explorer extends Element {
479
493
  openHandler && this.offOpen(openHandler);
480
494
 
481
495
  selectHandler && this.offSelect(selectHandler);
496
+
497
+ const mounted = false;
498
+
499
+ this.setMounted(mounted);
482
500
  }
483
501
 
484
502
  childElements() {
@@ -253,7 +253,9 @@ class EntriesList extends Element {
253
253
  }
254
254
 
255
255
  addEntryItem(entryItem) {
256
- const nextEntryItem = entryItem, ///
256
+ const explorer = this.getExplorer(),
257
+ mounted = explorer.isMounted(),
258
+ nextEntryItem = entryItem, ///
257
259
  previousEntryItem = this.findEntryItem((entryItem) => {
258
260
  const nextEntryBeforeEntryItem = nextEntryItem.isBefore(entryItem);
259
261
 
@@ -263,14 +265,23 @@ class EntriesList extends Element {
263
265
  });
264
266
 
265
267
  if (previousEntryItem === null) {
266
- this.mount(entryItem);
268
+ mounted ?
269
+ this.mount(entryItem) :
270
+ this.add(entryItem);
267
271
  } else {
268
- entryItem.mountBefore(previousEntryItem);
272
+ mounted ?
273
+ entryItem.mountBefore(previousEntryItem) :
274
+ entryItem.insertBefore(previousEntryItem);
269
275
  }
270
276
  }
271
277
 
272
278
  removeEntryItem(entryItem) {
273
- this.unmount(entryItem);
279
+ const explorer = this.getExplorer(),
280
+ mounted = explorer.isMounted();
281
+
282
+ mounted ?
283
+ this.unmount(entryItem) :
284
+ this.remove(entryItem);
274
285
  }
275
286
 
276
287
  removeEntryItems() {