@lvce-editor/explorer-view 5.7.0 → 5.9.0

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.
@@ -1059,6 +1059,7 @@ const DeltaY = 'event.deltaY';
1059
1059
  const EventTargetClassName = 'event.target.className';
1060
1060
  const IsTrusted = 'event.isTrusted';
1061
1061
  const ShiftKey = 'event.shiftKey';
1062
+ const TargetName = 'event.target.name';
1062
1063
  const TargetValue = 'event.target.value';
1063
1064
 
1064
1065
  const Enter = 3;
@@ -1839,8 +1840,8 @@ const FileOrFolderAlreadyExists = 'A file or folder **{PH1}** already exists at
1839
1840
  const FileOrFolderNameMustBeProvider = 'A file or folder name must be provided.';
1840
1841
  const FileCannotStartWithBackSlash = 'A file or folder name cannot start with a backslash.';
1841
1842
  const FilesExplorer = 'Files Explorer';
1842
- const NewFile$1 = 'New File...';
1843
- const NewFolder$1 = 'New Folder...';
1843
+ const NewFile$2 = 'New File...';
1844
+ const NewFolder$2 = 'New Folder...';
1844
1845
  const OpenContainingFolder = 'Open Containing Folder';
1845
1846
  const OpenFolder$1 = 'Open folder';
1846
1847
  const OpenInIntegratedTerminal = 'Open in integrated Terminal';
@@ -1852,10 +1853,10 @@ const TypeAFileName = 'Type file name. Press Enter to confirm or Escape to cance
1852
1853
  const YouHaveNotYetOpenedAFolder = 'You have not yet opened a folder';
1853
1854
 
1854
1855
  const newFile$1 = () => {
1855
- return i18nString(NewFile$1);
1856
+ return i18nString(NewFile$2);
1856
1857
  };
1857
1858
  const newFolder$1 = () => {
1858
- return i18nString(NewFolder$1);
1859
+ return i18nString(NewFolder$2);
1859
1860
  };
1860
1861
  const openContainingFolder$1 = () => {
1861
1862
  return i18nString(OpenContainingFolder);
@@ -3438,6 +3439,239 @@ const handleBlur = async state => {
3438
3439
  };
3439
3440
  };
3440
3441
 
3442
+ const CollapseAll$1 = 'CollapseAll';
3443
+ const ExplorerInput = 'ExplorerInput';
3444
+ const NewFile$1 = 'NewFile';
3445
+ const NewFolder$1 = 'NewFolder';
3446
+ const OpenFolder = 'OpenFolder';
3447
+ const Refresh$1 = 'Refresh';
3448
+
3449
+ const getNewChildDirentsForNewDirent = async (items, depth, parentPath, direntType) => {
3450
+ // Get existing children or query them if they don't exist
3451
+ let existingChildren = items.filter(item => item.depth === depth && item.path.startsWith(parentPath));
3452
+ if (existingChildren.length === 0) {
3453
+ const childDirents = await readDirWithFileTypes(parentPath);
3454
+ existingChildren = childDirents.map((dirent, index) => ({
3455
+ depth,
3456
+ icon: '',
3457
+ name: dirent.name,
3458
+ path: join2(parentPath, dirent.name),
3459
+ posInSet: index + 1,
3460
+ selected: false,
3461
+ setSize: childDirents.length,
3462
+ type: dirent.type
3463
+ }));
3464
+ }
3465
+ const updatedChildren = existingChildren.map((child, index) => ({
3466
+ ...child,
3467
+ posInSet: index + 1,
3468
+ setSize: existingChildren.length + 2
3469
+ }));
3470
+ const newDirent = {
3471
+ depth,
3472
+ icon: '',
3473
+ name: '',
3474
+ path: parentPath,
3475
+ posInSet: updatedChildren.length + 1,
3476
+ selected: false,
3477
+ setSize: existingChildren.length + 2,
3478
+ type: direntType
3479
+ };
3480
+ const allChildDirents = [...updatedChildren, newDirent];
3481
+ return allChildDirents;
3482
+ };
3483
+
3484
+ const getNewDirentsForNewDirent = async (items, focusedIndex, type, root) => {
3485
+ if (items.length === 0 || focusedIndex === -1) {
3486
+ const newDirent = {
3487
+ depth: 0,
3488
+ icon: '',
3489
+ name: '',
3490
+ path: root,
3491
+ posInSet: 1,
3492
+ selected: false,
3493
+ setSize: 1,
3494
+ type
3495
+ };
3496
+ return [...items, newDirent];
3497
+ }
3498
+ const focusedItem = items[focusedIndex];
3499
+ if (!focusedItem) {
3500
+ return items;
3501
+ }
3502
+ const parentPath = focusedItem.path;
3503
+ const depth = focusedItem.depth + 1;
3504
+ const updatedChildren = await getNewChildDirentsForNewDirent(items, depth, parentPath, type);
3505
+
3506
+ // Create new array with updated items
3507
+ const parentIndex = focusedIndex;
3508
+ const itemsBeforeParent = items.slice(0, parentIndex);
3509
+ const itemsAfterChildren = items.slice(parentIndex + updatedChildren.length);
3510
+ const updatedParent = {
3511
+ ...items[parentIndex],
3512
+ setSize: (items[parentIndex]?.setSize || 0) + 1
3513
+ };
3514
+ return [...itemsBeforeParent, updatedParent, ...updatedChildren, ...itemsAfterChildren];
3515
+ };
3516
+
3517
+ const getNewDirentType = editingType => {
3518
+ switch (editingType) {
3519
+ case CreateFile:
3520
+ return EditingFile;
3521
+ case CreateFolder:
3522
+ return EditingFolder;
3523
+ default:
3524
+ return File;
3525
+ }
3526
+ };
3527
+
3528
+ const isFolder = direntType => {
3529
+ return direntType === Directory || direntType === DirectoryExpanded || direntType === SymLinkFolder;
3530
+ };
3531
+ const getFittingIndex = (dirents, startIndex) => {
3532
+ for (let i = startIndex; i >= 0; i--) {
3533
+ const dirent = dirents[i];
3534
+ if (isFolder(dirent.type)) {
3535
+ return i;
3536
+ }
3537
+ }
3538
+ return -1;
3539
+ };
3540
+ const newDirent = async (state, editingType) => {
3541
+ // TODO do it like vscode, select position between folders and files
3542
+ const {
3543
+ focusedIndex,
3544
+ items,
3545
+ root
3546
+ } = state;
3547
+ const index = getFittingIndex(items, focusedIndex);
3548
+ const direntType = getNewDirentType(editingType);
3549
+ const newDirents = await getNewDirentsForNewDirent(items, index, direntType, root);
3550
+ const editingIndex = newDirents.findIndex(item => item.type === EditingFile || item.type === EditingFolder);
3551
+ return {
3552
+ ...state,
3553
+ editingIndex,
3554
+ editingType,
3555
+ editingValue: '',
3556
+ focus: Input$1,
3557
+ focusedIndex: editingIndex,
3558
+ items: newDirents
3559
+ };
3560
+ };
3561
+
3562
+ // TODO much shared logic with newFolder
3563
+ const newFile = state => {
3564
+ return newDirent(state, CreateFile);
3565
+ };
3566
+
3567
+ const newFolder = state => {
3568
+ return newDirent(state, CreateFolder);
3569
+ };
3570
+
3571
+ const isExpanded = item => {
3572
+ return item.type === DirectoryExpanded || item.type === DirectoryExpanding;
3573
+ };
3574
+
3575
+ const getExpandedDirents = items => {
3576
+ return items.filter(isExpanded);
3577
+ };
3578
+
3579
+ const getPathDirentsMap = async allPaths => {
3580
+ const pathToDirents = Object.create(null);
3581
+ await Promise.all(allPaths.map(async path => {
3582
+ try {
3583
+ const dirents = await readDirWithFileTypes(path);
3584
+ pathToDirents[path] = dirents;
3585
+ } catch {
3586
+ // ignore
3587
+ }
3588
+ }));
3589
+ return pathToDirents;
3590
+ };
3591
+
3592
+ const restoreDirentType = (rawDirentType, path, expandedPaths) => {
3593
+ if (rawDirentType === Directory && expandedPaths.includes(path)) {
3594
+ return DirectoryExpanded;
3595
+ }
3596
+ return rawDirentType;
3597
+ };
3598
+
3599
+ const getProtoMapInternal = (root, pathToDirents, expandedPaths, depth) => {
3600
+ if (!(root in pathToDirents)) {
3601
+ return [];
3602
+ }
3603
+ const items = pathToDirents[root] || [];
3604
+ const protoMap = [];
3605
+ for (let i = 0; i < items.length; i++) {
3606
+ const item = items[i];
3607
+ const path = join2(root, item.name);
3608
+ const displayDirent = {
3609
+ depth,
3610
+ icon: '',
3611
+ name: item.name,
3612
+ path,
3613
+ posInSet: i + 1,
3614
+ selected: false,
3615
+ setSize: items.length,
3616
+ type: restoreDirentType(item.type, path, expandedPaths)
3617
+ };
3618
+ const children = getProtoMapInternal(path, pathToDirents, expandedPaths, depth + 1);
3619
+ protoMap.push(displayDirent, ...children);
3620
+ }
3621
+ return protoMap;
3622
+ };
3623
+
3624
+ const getProtoMap = (root, pathToDirents, expandedPaths) => {
3625
+ return getProtoMapInternal(root, pathToDirents, expandedPaths, 1);
3626
+ };
3627
+
3628
+ const sortPathDirentsMap = map => {
3629
+ const sortedMap = Object.create(null);
3630
+ for (const [key, value] of Object.entries(map)) {
3631
+ const sorted = sortExplorerItems(value);
3632
+ sortedMap[key] = sorted;
3633
+ }
3634
+ return sortedMap;
3635
+ };
3636
+
3637
+ const refresh = async state => {
3638
+ const {
3639
+ focusedIndex,
3640
+ items,
3641
+ root
3642
+ } = state;
3643
+ const expandedDirents = getExpandedDirents(items);
3644
+ const expandedPaths = getPaths(expandedDirents);
3645
+ const allPaths = [root, ...expandedPaths];
3646
+ const pathToDirents = await getPathDirentsMap(allPaths);
3647
+ const sortedPathDirents = sortPathDirentsMap(pathToDirents);
3648
+ const newItems = getProtoMap(root, sortedPathDirents, expandedPaths);
3649
+ let newFocusedIndex = focusedIndex;
3650
+ if (focusedIndex >= newItems.length) {
3651
+ newFocusedIndex = newItems.length - 1;
3652
+ }
3653
+ return {
3654
+ ...state,
3655
+ focusedIndex: newFocusedIndex,
3656
+ items: newItems
3657
+ };
3658
+ };
3659
+
3660
+ const handleButtonClick = async (state, name) => {
3661
+ switch (name) {
3662
+ case CollapseAll$1:
3663
+ return collapseAll(state);
3664
+ case NewFile$1:
3665
+ return newFile(state);
3666
+ case NewFolder$1:
3667
+ return newFolder(state);
3668
+ case Refresh$1:
3669
+ return refresh(state);
3670
+ default:
3671
+ return state;
3672
+ }
3673
+ };
3674
+
3441
3675
  class ExplorerError extends Error {
3442
3676
  constructor(message) {
3443
3677
  super(message);
@@ -3528,13 +3762,12 @@ const resetEditing = {
3528
3762
 
3529
3763
  const handleClick = async (state, index, keepFocus = false) => {
3530
3764
  const {
3531
- items,
3532
- minLineY
3765
+ items
3533
3766
  } = state;
3534
3767
  if (index === -1) {
3535
3768
  return focusIndex(state, -1);
3536
3769
  }
3537
- const actualIndex = index + minLineY;
3770
+ const actualIndex = index;
3538
3771
  const dirent = items[actualIndex];
3539
3772
  if (!dirent) {
3540
3773
  console.warn(`[explorer] dirent at index ${actualIndex} not found`, state);
@@ -3563,6 +3796,7 @@ const getIndexFromPosition = (state, eventX, eventY) => {
3563
3796
  const {
3564
3797
  itemHeight,
3565
3798
  items,
3799
+ minLineY,
3566
3800
  y
3567
3801
  } = state;
3568
3802
  const index = Math.floor((eventY - y) / itemHeight);
@@ -3572,7 +3806,7 @@ const getIndexFromPosition = (state, eventX, eventY) => {
3572
3806
  if (index >= items.length) {
3573
3807
  return -1;
3574
3808
  }
3575
- return index;
3809
+ return index + minLineY;
3576
3810
  };
3577
3811
 
3578
3812
  /**
@@ -3636,7 +3870,7 @@ const handleClickAt = async (state, defaultPrevented, button, ctrlKey, shiftKey,
3636
3870
  return state;
3637
3871
  }
3638
3872
  const index = getIndexFromPosition(state, eventX, eventY);
3639
- if (index === -1) {
3873
+ if (index === -1 || index >= state.items.length) {
3640
3874
  return {
3641
3875
  ...state,
3642
3876
  focused: true,
@@ -3774,6 +4008,13 @@ const handleCut = async state => {
3774
4008
  };
3775
4009
  };
3776
4010
 
4011
+ const handleDragEnd = state => {
4012
+ return {
4013
+ ...state,
4014
+ dropTargets: []
4015
+ };
4016
+ };
4017
+
3777
4018
  const handleDragLeave = state => {
3778
4019
  return state;
3779
4020
  };
@@ -3859,95 +4100,6 @@ const handleDragStart = state => {
3859
4100
  return state;
3860
4101
  };
3861
4102
 
3862
- const isExpanded = item => {
3863
- return item.type === DirectoryExpanded || item.type === DirectoryExpanding;
3864
- };
3865
-
3866
- const getExpandedDirents = items => {
3867
- return items.filter(isExpanded);
3868
- };
3869
-
3870
- const getPathDirentsMap = async allPaths => {
3871
- const pathToDirents = Object.create(null);
3872
- await Promise.all(allPaths.map(async path => {
3873
- try {
3874
- const dirents = await readDirWithFileTypes(path);
3875
- pathToDirents[path] = dirents;
3876
- } catch {
3877
- // ignore
3878
- }
3879
- }));
3880
- return pathToDirents;
3881
- };
3882
-
3883
- const restoreDirentType = (rawDirentType, path, expandedPaths) => {
3884
- if (rawDirentType === Directory && expandedPaths.includes(path)) {
3885
- return DirectoryExpanded;
3886
- }
3887
- return rawDirentType;
3888
- };
3889
-
3890
- const getProtoMapInternal = (root, pathToDirents, expandedPaths, depth) => {
3891
- if (!(root in pathToDirents)) {
3892
- return [];
3893
- }
3894
- const items = pathToDirents[root] || [];
3895
- const protoMap = [];
3896
- for (let i = 0; i < items.length; i++) {
3897
- const item = items[i];
3898
- const path = join2(root, item.name);
3899
- const displayDirent = {
3900
- depth,
3901
- icon: '',
3902
- name: item.name,
3903
- path,
3904
- posInSet: i + 1,
3905
- selected: false,
3906
- setSize: items.length,
3907
- type: restoreDirentType(item.type, path, expandedPaths)
3908
- };
3909
- const children = getProtoMapInternal(path, pathToDirents, expandedPaths, depth + 1);
3910
- protoMap.push(displayDirent, ...children);
3911
- }
3912
- return protoMap;
3913
- };
3914
-
3915
- const getProtoMap = (root, pathToDirents, expandedPaths) => {
3916
- return getProtoMapInternal(root, pathToDirents, expandedPaths, 1);
3917
- };
3918
-
3919
- const sortPathDirentsMap = map => {
3920
- const sortedMap = Object.create(null);
3921
- for (const [key, value] of Object.entries(map)) {
3922
- const sorted = sortExplorerItems(value);
3923
- sortedMap[key] = sorted;
3924
- }
3925
- return sortedMap;
3926
- };
3927
-
3928
- const refresh = async state => {
3929
- const {
3930
- focusedIndex,
3931
- items,
3932
- root
3933
- } = state;
3934
- const expandedDirents = getExpandedDirents(items);
3935
- const expandedPaths = getPaths(expandedDirents);
3936
- const allPaths = [root, ...expandedPaths];
3937
- const pathToDirents = await getPathDirentsMap(allPaths);
3938
- const sortedPathDirents = sortPathDirentsMap(pathToDirents);
3939
- const newItems = getProtoMap(root, sortedPathDirents, expandedPaths);
3940
- let newFocusedIndex = focusedIndex;
3941
- if (focusedIndex >= newItems.length) {
3942
- newFocusedIndex = newItems.length - 1;
3943
- }
3944
- return {
3945
- ...state,
3946
- focusedIndex: newFocusedIndex,
3947
- items: newItems
3948
- };
3949
- };
3950
-
3951
4103
  const getChildHandles = async fileHandle => {
3952
4104
  // @ts-ignore
3953
4105
  const values = fileHandle.values();
@@ -4952,128 +5104,6 @@ const initialize = async () => {
4952
5104
  await Promise.all([initializeFileSystemWorker(), initializeIconThemeWorker(), initializeSourceControlWorker()]);
4953
5105
  };
4954
5106
 
4955
- const getNewChildDirentsForNewDirent = async (items, depth, parentPath, direntType) => {
4956
- // Get existing children or query them if they don't exist
4957
- let existingChildren = items.filter(item => item.depth === depth && item.path.startsWith(parentPath));
4958
- if (existingChildren.length === 0) {
4959
- const childDirents = await readDirWithFileTypes(parentPath);
4960
- existingChildren = childDirents.map((dirent, index) => ({
4961
- depth,
4962
- icon: '',
4963
- name: dirent.name,
4964
- path: join2(parentPath, dirent.name),
4965
- posInSet: index + 1,
4966
- selected: false,
4967
- setSize: childDirents.length,
4968
- type: dirent.type
4969
- }));
4970
- }
4971
- const updatedChildren = existingChildren.map((child, index) => ({
4972
- ...child,
4973
- posInSet: index + 1,
4974
- setSize: existingChildren.length + 2
4975
- }));
4976
- const newDirent = {
4977
- depth,
4978
- icon: '',
4979
- name: '',
4980
- path: parentPath,
4981
- posInSet: updatedChildren.length + 1,
4982
- selected: false,
4983
- setSize: existingChildren.length + 2,
4984
- type: direntType
4985
- };
4986
- const allChildDirents = [...updatedChildren, newDirent];
4987
- return allChildDirents;
4988
- };
4989
-
4990
- const getNewDirentsForNewDirent = async (items, focusedIndex, type, root) => {
4991
- if (items.length === 0 || focusedIndex === -1) {
4992
- const newDirent = {
4993
- depth: 0,
4994
- icon: '',
4995
- name: '',
4996
- path: root,
4997
- posInSet: 1,
4998
- selected: false,
4999
- setSize: 1,
5000
- type
5001
- };
5002
- return [...items, newDirent];
5003
- }
5004
- const focusedItem = items[focusedIndex];
5005
- if (!focusedItem) {
5006
- return items;
5007
- }
5008
- const parentPath = focusedItem.path;
5009
- const depth = focusedItem.depth + 1;
5010
- const updatedChildren = await getNewChildDirentsForNewDirent(items, depth, parentPath, type);
5011
-
5012
- // Create new array with updated items
5013
- const parentIndex = focusedIndex;
5014
- const itemsBeforeParent = items.slice(0, parentIndex);
5015
- const itemsAfterChildren = items.slice(parentIndex + updatedChildren.length);
5016
- const updatedParent = {
5017
- ...items[parentIndex],
5018
- setSize: (items[parentIndex]?.setSize || 0) + 1
5019
- };
5020
- return [...itemsBeforeParent, updatedParent, ...updatedChildren, ...itemsAfterChildren];
5021
- };
5022
-
5023
- const getNewDirentType = editingType => {
5024
- switch (editingType) {
5025
- case CreateFile:
5026
- return EditingFile;
5027
- case CreateFolder:
5028
- return EditingFolder;
5029
- default:
5030
- return File;
5031
- }
5032
- };
5033
-
5034
- const isFolder = direntType => {
5035
- return direntType === Directory || direntType === DirectoryExpanded || direntType === SymLinkFolder;
5036
- };
5037
- const getFittingIndex = (dirents, startIndex) => {
5038
- for (let i = startIndex; i >= 0; i--) {
5039
- const dirent = dirents[i];
5040
- if (isFolder(dirent.type)) {
5041
- return i;
5042
- }
5043
- }
5044
- return -1;
5045
- };
5046
- const newDirent = async (state, editingType) => {
5047
- // TODO do it like vscode, select position between folders and files
5048
- const {
5049
- focusedIndex,
5050
- items,
5051
- root
5052
- } = state;
5053
- const index = getFittingIndex(items, focusedIndex);
5054
- const direntType = getNewDirentType(editingType);
5055
- const newDirents = await getNewDirentsForNewDirent(items, index, direntType, root);
5056
- const editingIndex = newDirents.findIndex(item => item.type === EditingFile || item.type === EditingFolder);
5057
- return {
5058
- ...state,
5059
- editingIndex,
5060
- editingType,
5061
- editingValue: '',
5062
- focus: Input$1,
5063
- focusedIndex: editingIndex,
5064
- items: newDirents
5065
- };
5066
- };
5067
-
5068
- // TODO much shared logic with newFolder
5069
- const newFile = state => {
5070
- return newDirent(state, CreateFile);
5071
- };
5072
-
5073
- const newFolder = state => {
5074
- return newDirent(state, CreateFolder);
5075
- };
5076
-
5077
5107
  const getContainingFolder = (root, dirents, focusedIndex, pathSeparator) => {
5078
5108
  if (focusedIndex < 0) {
5079
5109
  return root;
@@ -5318,9 +5348,6 @@ const renderDragData = (oldState, newState) => {
5318
5348
  return ['Viewlet.setDragData', newState.uid, dragData];
5319
5349
  };
5320
5350
 
5321
- const ExplorerInput = 'ExplorerInput';
5322
- const OpenFolder = 'OpenFolder';
5323
-
5324
5351
  const renderEditingSelection = (oldState, newState) => {
5325
5352
  const {
5326
5353
  editingSelectionEnd,
@@ -5378,11 +5405,14 @@ const getErrorMessageDom = errorMessage => {
5378
5405
  }, text(errorMessage)];
5379
5406
  };
5380
5407
 
5408
+ const HandleButtonClick = 18;
5381
5409
  const HandleClick = 1;
5382
5410
  const HandleClickOpenFolder = 2;
5383
5411
  const HandleContextMenu = 3;
5412
+ const HandleDragEnd = 19;
5384
5413
  const HandleDragLeave = 4;
5385
5414
  const HandleDragOver = 5;
5415
+ const HandleDragStart = 17;
5386
5416
  const HandleDrop = 6;
5387
5417
  const HandleEditingInput = 7;
5388
5418
  const HandleInputBlur = 8;
@@ -5391,7 +5421,6 @@ const HandleListBlur = 11;
5391
5421
  const HandleListFocus = 12;
5392
5422
  const HandlePointerDown = 14;
5393
5423
  const HandleWheel = 15;
5394
- const HandleDragStart = 17;
5395
5424
 
5396
5425
  const getExplorerWelcomeVirtualDom = isWide => {
5397
5426
  return [{
@@ -5549,6 +5578,7 @@ const getListItemsVirtualDom = (visibleItems, focusedIndex, focused, dropTargets
5549
5578
  onBlur: HandleListBlur,
5550
5579
  onClick: HandleClick,
5551
5580
  onContextMenu: HandleContextMenu,
5581
+ onDragEnd: HandleDragEnd,
5552
5582
  onDragLeave: HandleDragLeave,
5553
5583
  onDragOver: HandleDragOver,
5554
5584
  onDragStart: HandleDragStart,
@@ -5713,21 +5743,25 @@ const getActions = root => {
5713
5743
  command: 'newFile',
5714
5744
  icon: NewFile,
5715
5745
  id: newFile$1(),
5746
+ name: NewFile$1,
5716
5747
  type: Button
5717
5748
  }, {
5718
5749
  command: 'newFolder',
5719
5750
  icon: NewFolder,
5720
5751
  id: newFolder$1(),
5752
+ name: NewFolder$1,
5721
5753
  type: Button
5722
5754
  }, {
5723
5755
  command: 'refresh',
5724
5756
  icon: Refresh,
5725
5757
  id: refresh$1(),
5758
+ name: Refresh$1,
5726
5759
  type: Button
5727
5760
  }, {
5728
5761
  command: 'collapseAll',
5729
5762
  icon: CollapseAll,
5730
5763
  id: collapseAll$1(),
5764
+ name: CollapseAll$1,
5731
5765
  type: Button
5732
5766
  }];
5733
5767
  };
@@ -5743,14 +5777,14 @@ const getIconVirtualDom = (icon, type = Div) => {
5743
5777
 
5744
5778
  const getActionButtonVirtualDom = action => {
5745
5779
  const {
5746
- command,
5747
5780
  icon,
5748
- id
5781
+ id,
5782
+ name
5749
5783
  } = action;
5750
5784
  return [{
5751
5785
  childCount: 1,
5752
5786
  className: IconButton,
5753
- 'data-command': command,
5787
+ name,
5754
5788
  title: id,
5755
5789
  type: Button$1
5756
5790
  }, getIconVirtualDom(icon || '')];
@@ -5769,6 +5803,7 @@ const getActionsVirtualDom = actions => {
5769
5803
  return [{
5770
5804
  childCount: actions.length,
5771
5805
  className: Actions,
5806
+ onClick: HandleButtonClick,
5772
5807
  role: ToolBar,
5773
5808
  type: Div
5774
5809
  }, ...actions.flatMap(getActionVirtualDom)];
@@ -5830,6 +5865,12 @@ const renderEventListeners = () => {
5830
5865
  }, {
5831
5866
  name: HandleDragLeave,
5832
5867
  params: ['handleDragLeave']
5868
+ }, {
5869
+ name: HandleButtonClick,
5870
+ params: ['handleButtonClick', TargetName]
5871
+ }, {
5872
+ name: HandleDragEnd,
5873
+ params: ['handleDragEnd']
5833
5874
  }, {
5834
5875
  // @ts-ignore
5835
5876
  dragEffect: 'copyMove',
@@ -6150,6 +6191,7 @@ const commandMap = {
6150
6191
  'Explorer.handleArrowLeft': wrapListItemCommand(handleArrowLeft),
6151
6192
  'Explorer.handleArrowRight': wrapListItemCommand(handleArrowRight),
6152
6193
  'Explorer.handleBlur': wrapListItemCommand(handleBlur),
6194
+ 'Explorer.handleButtonClick': wrapListItemCommand(handleButtonClick),
6153
6195
  'Explorer.handleClick': wrapListItemCommand(handleClick),
6154
6196
  'Explorer.handleClickAt': wrapListItemCommand(handleClickAt),
6155
6197
  'Explorer.handleClickCurrent': wrapListItemCommand(handleClickCurrent),
@@ -6159,6 +6201,7 @@ const commandMap = {
6159
6201
  'Explorer.handleContextMenuKeyboard': wrapListItemCommand(handleContextMenuKeyboard),
6160
6202
  'Explorer.handleCopy': wrapListItemCommand(handleCopy),
6161
6203
  'Explorer.handleCut': wrapListItemCommand(handleCut),
6204
+ 'Explorer.handleDragEnd': wrapListItemCommand(handleDragEnd),
6162
6205
  'Explorer.handleDragLeave': wrapListItemCommand(handleDragLeave),
6163
6206
  'Explorer.handleDragOver': wrapListItemCommand(handleDragOver),
6164
6207
  'Explorer.handleDragOverIndex': wrapListItemCommand(handleDragOverIndex),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/explorer-view",
3
- "version": "5.7.0",
3
+ "version": "5.9.0",
4
4
  "description": "Explorer Worker",
5
5
  "repository": {
6
6
  "type": "git",