Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
B
baas-ide
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
JIRA
JIRA
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
guxukai
baas-ide
Commits
44f40f51
Commit
44f40f51
authored
Feb 16, 2021
by
ioedeveloper
Committed by
GitHub
Feb 17, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Highlight files on hover
parent
fa1188e9
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
44 additions
and
4 deletions
+44
-4
file-explorer.tsx
libs/remix-ui/file-explorer/src/lib/file-explorer.tsx
+40
-3
index.ts
libs/remix-ui/file-explorer/src/lib/types/index.ts
+2
-1
index.ts
libs/remix-ui/tree-view/src/types/index.ts
+2
-0
No files found.
libs/remix-ui/file-explorer/src/lib/file-explorer.tsx
View file @
44f40f51
...
@@ -55,7 +55,8 @@ export const FileExplorer = (props: FileExplorerProps) => {
...
@@ -55,7 +55,8 @@ export const FileExplorer = (props: FileExplorerProps) => {
handleHide
:
null
handleHide
:
null
},
},
modals
:
[],
modals
:
[],
toasterMsg
:
''
toasterMsg
:
''
,
mouseOverElement
:
null
})
})
const
editRef
=
useRef
(
null
)
const
editRef
=
useRef
(
null
)
...
@@ -858,6 +859,18 @@ export const FileExplorer = (props: FileExplorerProps) => {
...
@@ -858,6 +859,18 @@ export const FileExplorer = (props: FileExplorerProps) => {
}
}
}
}
const
handleMouseOver
=
(
path
:
string
)
=>
{
setState
(
prevState
=>
{
return
{
...
prevState
,
mouseOverElement
:
path
}
})
}
const
handleMouseOut
=
()
=>
{
setState
(
prevState
=>
{
return
{
...
prevState
,
mouseOverElement
:
null
}
})
}
const
label
=
(
file
:
File
)
=>
{
const
label
=
(
file
:
File
)
=>
{
return
(
return
(
<
div
<
div
...
@@ -901,9 +914,17 @@ export const FileExplorer = (props: FileExplorerProps) => {
...
@@ -901,9 +914,17 @@ export const FileExplorer = (props: FileExplorerProps) => {
e
.
stopPropagation
()
e
.
stopPropagation
()
handleContextMenuFolder
(
e
.
pageX
,
e
.
pageY
,
file
.
path
,
e
.
target
.
textContent
)
handleContextMenuFolder
(
e
.
pageX
,
e
.
pageY
,
file
.
path
,
e
.
target
.
textContent
)
}
}
}
}
labelClass=
{
state
.
focusEdit
.
element
===
file
.
path
?
'bg-light'
:
state
.
focusElement
.
findIndex
(
item
=>
item
.
key
===
file
.
path
)
!==
-
1
?
'bg-secondary'
:
''
}
labelClass=
{
state
.
focusEdit
.
element
===
file
.
path
?
'bg-light'
:
state
.
focusElement
.
findIndex
(
item
=>
item
.
key
===
file
.
path
)
!==
-
1
?
'bg-secondary'
:
state
.
mouseOverElement
===
file
.
path
?
'bg-secondary'
:
(
state
.
focusContext
.
element
===
file
.
path
)
&&
(
state
.
focusEdit
.
element
!==
file
.
path
)
?
'bg-secondary'
:
''
}
controlBehaviour=
{
state
.
ctrlKey
}
controlBehaviour=
{
state
.
ctrlKey
}
expand=
{
state
.
expandPath
.
includes
(
file
.
path
)
}
expand=
{
state
.
expandPath
.
includes
(
file
.
path
)
}
onMouseOver=
{
(
e
)
=>
{
e
.
stopPropagation
()
handleMouseOver
(
file
.
path
)
}
}
onMouseOut=
{
(
e
)
=>
{
e
.
stopPropagation
()
if
(
state
.
mouseOverElement
===
file
.
path
)
handleMouseOut
()
}
}
>
>
{
{
file
.
child
?
<
TreeView
id=
{
`treeView${file.path}`
}
key=
{
index
}
>
{
file
.
child
?
<
TreeView
id=
{
`treeView${file.path}`
}
key=
{
index
}
>
{
...
@@ -928,6 +949,10 @@ export const FileExplorer = (props: FileExplorerProps) => {
...
@@ -928,6 +949,10 @@ export const FileExplorer = (props: FileExplorerProps) => {
pageY=
{
state
.
focusContext
.
y
}
pageY=
{
state
.
focusContext
.
y
}
path=
{
file
.
path
}
path=
{
file
.
path
}
type=
'folder'
type=
'folder'
onMouseOver=
{
(
e
)
=>
{
e
.
stopPropagation
()
handleMouseOver
(
file
.
path
)
}
}
/>
/>
}
}
</
div
>
</
div
>
...
@@ -949,7 +974,15 @@ export const FileExplorer = (props: FileExplorerProps) => {
...
@@ -949,7 +974,15 @@ export const FileExplorer = (props: FileExplorerProps) => {
handleContextMenuFile
(
e
.
pageX
,
e
.
pageY
,
file
.
path
,
e
.
target
.
textContent
)
handleContextMenuFile
(
e
.
pageX
,
e
.
pageY
,
file
.
path
,
e
.
target
.
textContent
)
}
}
}
}
icon=
'far fa-file'
icon=
'far fa-file'
labelClass=
{
state
.
focusEdit
.
element
===
file
.
path
?
'bg-light'
:
state
.
focusElement
.
findIndex
(
item
=>
item
.
key
===
file
.
path
)
!==
-
1
?
'bg-secondary'
:
''
}
labelClass=
{
state
.
focusEdit
.
element
===
file
.
path
?
'bg-light'
:
state
.
focusElement
.
findIndex
(
item
=>
item
.
key
===
file
.
path
)
!==
-
1
?
'bg-secondary'
:
state
.
mouseOverElement
===
file
.
path
?
'bg-secondary'
:
(
state
.
focusContext
.
element
===
file
.
path
)
&&
(
state
.
focusEdit
.
element
!==
file
.
path
)
?
'bg-secondary'
:
''
}
onMouseOver=
{
(
e
)
=>
{
e
.
stopPropagation
()
handleMouseOver
(
file
.
path
)
}
}
onMouseOut=
{
(
e
)
=>
{
e
.
stopPropagation
()
if
(
state
.
mouseOverElement
===
file
.
path
)
handleMouseOut
()
}
}
/>
/>
{
((
state
.
focusContext
.
element
===
file
.
path
)
&&
(
state
.
focusEdit
.
element
!==
file
.
path
))
&&
{
((
state
.
focusContext
.
element
===
file
.
path
)
&&
(
state
.
focusEdit
.
element
!==
file
.
path
))
&&
<
FileExplorerContextMenu
<
FileExplorerContextMenu
...
@@ -965,6 +998,10 @@ export const FileExplorer = (props: FileExplorerProps) => {
...
@@ -965,6 +998,10 @@ export const FileExplorer = (props: FileExplorerProps) => {
pageY=
{
state
.
focusContext
.
y
}
pageY=
{
state
.
focusContext
.
y
}
path=
{
file
.
path
}
path=
{
file
.
path
}
type=
'file'
type=
'file'
onMouseOver=
{
(
e
)
=>
{
e
.
stopPropagation
()
handleMouseOver
(
file
.
path
)
}
}
/>
/>
}
}
</
div
>
</
div
>
...
...
libs/remix-ui/file-explorer/src/lib/types/index.ts
View file @
44f40f51
...
@@ -41,5 +41,6 @@ export interface FileExplorerContextMenuProps {
...
@@ -41,5 +41,6 @@ export interface FileExplorerContextMenuProps {
pageX
:
number
,
pageX
:
number
,
pageY
:
number
,
pageY
:
number
,
path
:
string
,
path
:
string
,
type
:
string
type
:
string
,
onMouseOver
?:
(...
args
)
=>
void
}
}
libs/remix-ui/tree-view/src/types/index.ts
View file @
44f40f51
...
@@ -10,6 +10,8 @@ export interface TreeViewItemProps {
...
@@ -10,6 +10,8 @@ export interface TreeViewItemProps {
expand
?:
boolean
,
expand
?:
boolean
,
onClick
?:
(...
args
:
any
)
=>
void
,
onClick
?:
(...
args
:
any
)
=>
void
,
onInput
?:
(...
args
:
any
)
=>
void
,
onInput
?:
(...
args
:
any
)
=>
void
,
onMouseOver
?:
(...
args
)
=>
void
,
onMouseOut
?:
(...
args
)
=>
void
,
className
?:
string
,
className
?:
string
,
iconX
?:
string
,
iconX
?:
string
,
iconY
?:
string
,
iconY
?:
string
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment