@electerm/electerm-react 1.51.3 → 1.51.18
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/client/common/constants.js +15 -1
- package/client/common/db.js +10 -9
- package/client/common/default-setting.js +0 -1
- package/client/common/is-color-dark.js +15 -11
- package/client/common/new-terminal.js +2 -5
- package/client/common/reverse-color.js +12 -0
- package/client/common/ws.js +4 -1
- package/client/components/batch-op/batch-op.jsx +16 -5
- package/client/components/bookmark-form/index.jsx +1 -1
- package/client/components/bookmark-form/render-connection-hopping.jsx +25 -2
- package/client/components/bookmark-form/ssh-form.jsx +4 -25
- package/client/components/bookmark-form/tree-delete.jsx +5 -10
- package/client/components/bookmark-form/use-submit.jsx +6 -15
- package/client/components/bookmark-form/use-ui.jsx +1 -2
- package/client/components/common/connection-hopping-warning-text.jsx +36 -0
- package/client/components/common/drag-handle.jsx +60 -0
- package/client/components/common/drag-handle.styl +12 -0
- package/client/components/context-menu/context-menu.styl +5 -5
- package/client/components/context-menu/history.jsx +2 -11
- package/client/components/context-menu/sub-tab-menu.jsx +1 -1
- package/client/components/footer/footer-entry.jsx +1 -6
- package/client/components/layout/layout-item.jsx +2 -2
- package/client/components/layout/layout.jsx +3 -2
- package/client/components/main/connection-hopping-warnning.jsx +45 -0
- package/client/components/main/error-wrapper.jsx +120 -5
- package/client/components/main/main.jsx +32 -8
- package/client/components/main/upgrade.jsx +4 -9
- package/client/components/main/wrapper.styl +2 -1
- package/client/components/profile/profile-form-ssh.jsx +1 -1
- package/client/components/rdp/resolution-edit.jsx +3 -5
- package/client/components/session/session.jsx +22 -3
- package/client/components/session/session.styl +3 -2
- package/client/components/setting-panel/list.styl +0 -1
- package/client/components/setting-panel/on-tree-drop.js +5 -5
- package/client/components/setting-panel/setting-common.jsx +28 -7
- package/client/components/setting-panel/setting-modal.jsx +0 -12
- package/client/components/setting-panel/setting-terminal.jsx +7 -4
- package/client/components/sftp/confirm-modal-store.jsx +3 -11
- package/client/components/sftp/file-mode-modal.jsx +2 -2
- package/client/components/sftp/sftp-entry.jsx +4 -7
- package/client/components/sftp/transfer-conflict-store.jsx +70 -69
- package/client/components/sftp/transport-action-store.jsx +42 -49
- package/client/components/sftp/transports-action-store.jsx +15 -15
- package/client/components/sftp/transports-ui-store.jsx +9 -5
- package/client/components/side-panel-r/side-panel-r.jsx +13 -40
- package/client/components/sidebar/bookmark-select.jsx +1 -4
- package/client/components/sidebar/bookmark.jsx +4 -63
- package/client/components/sidebar/history-item.jsx +34 -0
- package/client/components/sidebar/history.jsx +17 -52
- package/client/components/sidebar/index.jsx +5 -40
- package/client/components/sidebar/side-panel.jsx +27 -51
- package/client/components/sidebar/sidebar-panel.jsx +107 -0
- package/client/components/sidebar/sidebar.styl +14 -9
- package/client/components/sidebar/transfer-list-control.jsx +1 -0
- package/client/components/sidebar/transfer.styl +1 -1
- package/client/components/sidebar/transport-ui.jsx +179 -37
- package/client/components/ssh-config/load-ssh-configs.jsx +106 -0
- package/client/components/ssh-config/ssh-config-item.jsx +26 -0
- package/client/components/ssh-config/ssh-config-load-notify.jsx +60 -0
- package/client/components/tabs/index.jsx +4 -4
- package/client/components/tabs/tab.jsx +28 -20
- package/client/components/tabs/tabs.styl +6 -1
- package/client/components/terminal/index.jsx +4 -18
- package/client/components/tree-list/bookmark-toolbar.jsx +203 -0
- package/client/components/tree-list/bookmark-transport.jsx +2 -0
- package/client/components/tree-list/tree-list.jsx +33 -42
- package/client/entry/worker.js +5 -3
- package/client/store/bookmark-group.js +5 -18
- package/client/store/bookmark.js +43 -1
- package/client/store/common.js +13 -9
- package/client/store/db-upgrade.js +0 -2
- package/client/store/index.js +45 -53
- package/client/store/init-state.js +20 -23
- package/client/store/item.js +0 -19
- package/client/store/load-data.js +7 -10
- package/client/store/setting.js +10 -66
- package/client/store/sidebar.js +7 -8
- package/client/store/sync.js +7 -8
- package/client/store/tab.js +93 -14
- package/client/store/terminal-theme.js +1 -1
- package/client/store/transfer-history.js +3 -9
- package/client/store/transfer-list.js +67 -75
- package/client/store/ui-theme.js +0 -9
- package/client/store/watch.js +17 -9
- package/package.json +1 -1
- package/client/components/setting-panel/tab-history.jsx +0 -43
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import React, {
|
|
1
|
+
import React, { memo } from 'react'
|
|
2
|
+
import DragHandle from '../common/drag-handle'
|
|
2
3
|
import './right-side-panel.styl'
|
|
3
4
|
import {
|
|
4
5
|
CloseCircleOutlined,
|
|
@@ -17,43 +18,12 @@ export default memo(function RightSidePanel (
|
|
|
17
18
|
return null
|
|
18
19
|
}
|
|
19
20
|
|
|
20
|
-
|
|
21
|
-
const clientX = useRef(0)
|
|
22
|
-
|
|
23
|
-
function handleMousedown (e) {
|
|
24
|
-
dragStart.current = true
|
|
25
|
-
clientX.current = e.clientX
|
|
26
|
-
document.body.addEventListener('mouseup', handleMouseup)
|
|
27
|
-
document.body.addEventListener('mousemove', handleMousemove)
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
function handleMouseup (e) {
|
|
31
|
-
dragStart.current = false
|
|
32
|
-
const {
|
|
33
|
-
clientX: cx
|
|
34
|
-
} = e
|
|
35
|
-
let nw = clientX.current - cx + rightPanelWidth
|
|
36
|
-
if (nw < 400) {
|
|
37
|
-
nw = 400
|
|
38
|
-
} else if (nw > 1000) {
|
|
39
|
-
nw = 1000
|
|
40
|
-
}
|
|
21
|
+
function onDragEnd (nw) {
|
|
41
22
|
window.store.setRightSidePanelWidth(nw)
|
|
42
|
-
document.body.removeEventListener('mouseup', handleMouseup)
|
|
43
|
-
document.body.removeEventListener('mousemove', handleMousemove)
|
|
44
23
|
}
|
|
45
24
|
|
|
46
|
-
function
|
|
47
|
-
const {
|
|
48
|
-
clientX: cx
|
|
49
|
-
} = e
|
|
25
|
+
function onDragMove (nw) {
|
|
50
26
|
const el = document.getElementById('right-side-panel')
|
|
51
|
-
let nw = clientX.current - cx + rightPanelWidth
|
|
52
|
-
if (nw < 400) {
|
|
53
|
-
nw = 400
|
|
54
|
-
} else if (nw > 1000) {
|
|
55
|
-
nw = 1000
|
|
56
|
-
}
|
|
57
27
|
el.style.width = nw + 'px'
|
|
58
28
|
}
|
|
59
29
|
|
|
@@ -77,16 +47,19 @@ export default memo(function RightSidePanel (
|
|
|
77
47
|
className: 'right-side-panel-pin right-side-panel-controls' + (rightPanelPinned ? ' pinned' : ''),
|
|
78
48
|
onClick: togglePin
|
|
79
49
|
}
|
|
80
|
-
|
|
50
|
+
const dragProps = {
|
|
51
|
+
min: 400,
|
|
52
|
+
max: 1000,
|
|
53
|
+
width: rightPanelWidth,
|
|
54
|
+
onDragEnd,
|
|
55
|
+
onDragMove,
|
|
56
|
+
left: false
|
|
57
|
+
}
|
|
81
58
|
return (
|
|
82
59
|
<div
|
|
83
60
|
{...panelProps}
|
|
84
61
|
>
|
|
85
|
-
<
|
|
86
|
-
className='drag-handle'
|
|
87
|
-
onMouseDown={handleMousedown}
|
|
88
|
-
draggable={false}
|
|
89
|
-
/>
|
|
62
|
+
<DragHandle {...dragProps} />
|
|
90
63
|
<CloseCircleOutlined
|
|
91
64
|
className='right-side-panel-close right-side-panel-controls'
|
|
92
65
|
onClick={onClose}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* bookmark select
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
5
|
import { auto } from 'manate/react'
|
|
@@ -29,9 +29,6 @@ export default auto(function BookmarkSelect (props) {
|
|
|
29
29
|
listStyle,
|
|
30
30
|
staticList: true
|
|
31
31
|
}
|
|
32
|
-
if (!store.config.hideSshConfig) {
|
|
33
|
-
base.bookmarks.push(...store.sshConfigItems)
|
|
34
|
-
}
|
|
35
32
|
const propsTree = {
|
|
36
33
|
...base,
|
|
37
34
|
shouldConfirmDel: true,
|
|
@@ -1,77 +1,18 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* bookmark select
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
|
-
import { memo } from 'react'
|
|
6
5
|
import BookmarkSelect from './bookmark-select'
|
|
7
|
-
import { pick } from 'lodash-es'
|
|
8
|
-
import { ArrowsAltOutlined, EditOutlined, PlusCircleOutlined, ShrinkOutlined, PushpinOutlined } from '@ant-design/icons'
|
|
9
|
-
import { Tooltip } from 'antd'
|
|
10
6
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
export default memo(function BookmarkPanel (props) {
|
|
14
|
-
const { pinned } = props
|
|
15
|
-
const prps = {
|
|
16
|
-
className: 'font16 mg1x mg2l pointer iblock control-icon'
|
|
17
|
-
}
|
|
18
|
-
const prps1 = {
|
|
19
|
-
className: prps.className + (pinned ? ' pinned' : '')
|
|
20
|
-
}
|
|
7
|
+
export default function BookmarkPanel (props) {
|
|
21
8
|
const { store } = window
|
|
22
|
-
const pop1 = {
|
|
23
|
-
...prps,
|
|
24
|
-
onClick: store.onNewSsh
|
|
25
|
-
}
|
|
26
|
-
const pop2 = {
|
|
27
|
-
...prps,
|
|
28
|
-
onClick: store.expandBookmarks
|
|
29
|
-
}
|
|
30
|
-
const pop3 = {
|
|
31
|
-
...prps,
|
|
32
|
-
onClick: store.collapseBookmarks
|
|
33
|
-
}
|
|
34
9
|
return (
|
|
35
10
|
<div
|
|
36
|
-
className='sidebar-panel
|
|
37
|
-
{...pick(props, ['onMouseEnter', 'onMouseLeave'])}
|
|
11
|
+
className='sidebar-panel-bookmarks'
|
|
38
12
|
>
|
|
39
|
-
<div className='pd1y pd2t pd2x'>
|
|
40
|
-
<div className='fix'>
|
|
41
|
-
<div className='fleft'>{e('bookmarks')}</div>
|
|
42
|
-
<div className='fright'>
|
|
43
|
-
<Tooltip title={e('newBookmark')}>
|
|
44
|
-
<PlusCircleOutlined
|
|
45
|
-
{...pop1}
|
|
46
|
-
/>
|
|
47
|
-
</Tooltip>
|
|
48
|
-
<Tooltip title={`${e('edit')} ${e('bookmarks')}`}>
|
|
49
|
-
<EditOutlined
|
|
50
|
-
{...pop1}
|
|
51
|
-
/>
|
|
52
|
-
</Tooltip>
|
|
53
|
-
<Tooltip title={e('expandAll')}>
|
|
54
|
-
<ArrowsAltOutlined
|
|
55
|
-
{...pop2}
|
|
56
|
-
/>
|
|
57
|
-
</Tooltip>
|
|
58
|
-
<Tooltip title={e('collapseAll')}>
|
|
59
|
-
<ShrinkOutlined
|
|
60
|
-
{...pop3}
|
|
61
|
-
/>
|
|
62
|
-
</Tooltip>
|
|
63
|
-
<Tooltip title={e('pin')}>
|
|
64
|
-
<PushpinOutlined
|
|
65
|
-
{...prps1}
|
|
66
|
-
onClick={store.handlePin}
|
|
67
|
-
/>
|
|
68
|
-
</Tooltip>
|
|
69
|
-
</div>
|
|
70
|
-
</div>
|
|
71
|
-
</div>
|
|
72
13
|
<div className='pd2l sidebar-inner'>
|
|
73
14
|
<BookmarkSelect store={store} from='sidebar' />
|
|
74
15
|
</div>
|
|
75
16
|
</div>
|
|
76
17
|
)
|
|
77
|
-
}
|
|
18
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import createTitle, { createTitleWithTag } from '../../common/create-title'
|
|
2
|
+
import { DeleteOutlined } from '@ant-design/icons'
|
|
3
|
+
|
|
4
|
+
export default function HistoryItem (props) {
|
|
5
|
+
const { store } = window
|
|
6
|
+
const {
|
|
7
|
+
item,
|
|
8
|
+
index
|
|
9
|
+
} = props
|
|
10
|
+
function handleClick () {
|
|
11
|
+
store.onSelectHistory(item.tab)
|
|
12
|
+
}
|
|
13
|
+
function handleDelete (e) {
|
|
14
|
+
e.stopPropagation()
|
|
15
|
+
store.history.splice(index, 1)
|
|
16
|
+
}
|
|
17
|
+
const title = createTitleWithTag(item.tab)
|
|
18
|
+
const tt = createTitle(item.tab)
|
|
19
|
+
return (
|
|
20
|
+
<div
|
|
21
|
+
className='item-list-unit'
|
|
22
|
+
title={tt}
|
|
23
|
+
onClick={handleClick}
|
|
24
|
+
>
|
|
25
|
+
<div className='elli pd1y pd2x'>
|
|
26
|
+
{title}
|
|
27
|
+
</div>
|
|
28
|
+
<DeleteOutlined
|
|
29
|
+
className='list-item-edit'
|
|
30
|
+
onClick={handleDelete}
|
|
31
|
+
/>
|
|
32
|
+
</div>
|
|
33
|
+
)
|
|
34
|
+
}
|
|
@@ -2,65 +2,30 @@
|
|
|
2
2
|
* history select
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
|
-
import {
|
|
6
|
-
import
|
|
7
|
-
import { pick } from 'lodash-es'
|
|
8
|
-
import { EditOutlined, PushpinOutlined } from '@ant-design/icons'
|
|
9
|
-
import { Tooltip } from 'antd'
|
|
5
|
+
import { auto } from 'manate/react'
|
|
6
|
+
import HistoryItem from './history-item'
|
|
10
7
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
export default memo(function HistoryPanel (props) {
|
|
8
|
+
export default auto(function HistoryPanel (props) {
|
|
14
9
|
const { store } = window
|
|
15
10
|
const {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
history,
|
|
19
|
-
activeItemId
|
|
20
|
-
} = props
|
|
21
|
-
if (openedSideBar !== 'history') {
|
|
22
|
-
return null
|
|
23
|
-
}
|
|
24
|
-
const prps = {
|
|
25
|
-
className: 'font16 mg1x mg2l pointer iblock control-icon'
|
|
26
|
-
}
|
|
27
|
-
const prps1 = {
|
|
28
|
-
className: prps.className + (pinned ? ' pinned' : '')
|
|
29
|
-
}
|
|
30
|
-
function handleClickItem (item) {
|
|
31
|
-
store.onSelectHistory(item.id)
|
|
32
|
-
}
|
|
11
|
+
history
|
|
12
|
+
} = store
|
|
33
13
|
return (
|
|
34
14
|
<div
|
|
35
|
-
className='sidebar-panel
|
|
36
|
-
{...pick(props, ['onMouseEnter', 'onMouseLeave'])}
|
|
15
|
+
className='sidebar-panel-history'
|
|
37
16
|
>
|
|
38
|
-
<div className='pd1y pd2t pd2x'>
|
|
39
|
-
<div className='fix'>
|
|
40
|
-
<div className='fleft'>{e('history')}</div>
|
|
41
|
-
<div className='fleft'>
|
|
42
|
-
<Tooltip title={`${e('edit')} ${e('history')}`}>
|
|
43
|
-
<EditOutlined
|
|
44
|
-
className='font16 mg1x mg2l pointer iblock control-icon icon-do-edit'
|
|
45
|
-
onClick={store.handleEditHistory}
|
|
46
|
-
/>
|
|
47
|
-
</Tooltip>
|
|
48
|
-
<Tooltip title={e('pin')}>
|
|
49
|
-
<PushpinOutlined
|
|
50
|
-
{...prps1}
|
|
51
|
-
onClick={store.handlePin}
|
|
52
|
-
/>
|
|
53
|
-
</Tooltip>
|
|
54
|
-
</div>
|
|
55
|
-
</div>
|
|
56
|
-
</div>
|
|
57
17
|
<div className='pd2x'>
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
18
|
+
{
|
|
19
|
+
history.map((item, i) => {
|
|
20
|
+
return (
|
|
21
|
+
<HistoryItem
|
|
22
|
+
key={item.id}
|
|
23
|
+
index={i}
|
|
24
|
+
item={item}
|
|
25
|
+
/>
|
|
26
|
+
)
|
|
27
|
+
})
|
|
28
|
+
}
|
|
64
29
|
</div>
|
|
65
30
|
</div>
|
|
66
31
|
)
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import {
|
|
2
2
|
BookOutlined,
|
|
3
|
-
ClockCircleOutlined,
|
|
4
3
|
CloudSyncOutlined,
|
|
5
4
|
InfoCircleOutlined,
|
|
6
5
|
PictureOutlined,
|
|
@@ -11,8 +10,7 @@ import {
|
|
|
11
10
|
} from '@ant-design/icons'
|
|
12
11
|
import { useRef, memo } from 'react'
|
|
13
12
|
import { Tooltip } from 'antd'
|
|
14
|
-
import
|
|
15
|
-
import HistoryWrap from './history'
|
|
13
|
+
import SideBarPanel from './sidebar-panel'
|
|
16
14
|
import TransferList from './transfer-list'
|
|
17
15
|
import MenuBtn from '../context-menu/menu-btn'
|
|
18
16
|
import {
|
|
@@ -43,7 +41,7 @@ export default memo(function Sidebar (props) {
|
|
|
43
41
|
transferTab,
|
|
44
42
|
showModal,
|
|
45
43
|
showInfoModal,
|
|
46
|
-
|
|
44
|
+
sidebarPanelTab
|
|
47
45
|
} = props
|
|
48
46
|
|
|
49
47
|
const { store } = window
|
|
@@ -66,21 +64,8 @@ export default memo(function Sidebar (props) {
|
|
|
66
64
|
store.setOpenedSideBar('bookmarks')
|
|
67
65
|
}
|
|
68
66
|
|
|
69
|
-
const handleMouseEnterHistory = () => {
|
|
70
|
-
if (pinned) {
|
|
71
|
-
return false
|
|
72
|
-
}
|
|
73
|
-
clearTimeout(handler.current)
|
|
74
|
-
store.setOpenedSideBar('history')
|
|
75
|
-
}
|
|
76
|
-
|
|
77
67
|
const handleShowUpgrade = () => {
|
|
78
|
-
store.
|
|
79
|
-
_upgradeInfo: JSON.stringify({
|
|
80
|
-
...props.store.upgradeInfo,
|
|
81
|
-
showUpgradeModal: true
|
|
82
|
-
})
|
|
83
|
-
})
|
|
68
|
+
window.store.upgradeInfo.showUpgradeModal = true
|
|
84
69
|
}
|
|
85
70
|
|
|
86
71
|
const {
|
|
@@ -90,7 +75,6 @@ export default memo(function Sidebar (props) {
|
|
|
90
75
|
openSettingSync,
|
|
91
76
|
openTerminalThemes,
|
|
92
77
|
onClickBookmark,
|
|
93
|
-
onClickHistory,
|
|
94
78
|
toggleBatchOp,
|
|
95
79
|
setLeftSidePanelWidth
|
|
96
80
|
} = store
|
|
@@ -105,7 +89,6 @@ export default memo(function Sidebar (props) {
|
|
|
105
89
|
const settingActive = showSetting && settingTab === settingMap.setting && settingItem.id === 'setting-common'
|
|
106
90
|
const syncActive = showSetting && settingTab === settingMap.setting && settingItem.id === 'setting-sync'
|
|
107
91
|
const themeActive = showSetting && settingTab === settingMap.terminalThemes
|
|
108
|
-
const historyActive = showSetting && settingTab === settingMap.history
|
|
109
92
|
const bookmarksActive = showSetting && settingTab === settingMap.bookmarks
|
|
110
93
|
const sideProps = openedSideBar
|
|
111
94
|
? {
|
|
@@ -154,17 +137,6 @@ export default memo(function Sidebar (props) {
|
|
|
154
137
|
className='font20 iblock control-icon'
|
|
155
138
|
/>
|
|
156
139
|
</SideIcon>
|
|
157
|
-
<SideIcon
|
|
158
|
-
title={e(settingMap.history)}
|
|
159
|
-
active={historyActive}
|
|
160
|
-
>
|
|
161
|
-
<ClockCircleOutlined
|
|
162
|
-
onMouseEnter={handleMouseEnterHistory}
|
|
163
|
-
onMouseLeave={handleMouseLeave}
|
|
164
|
-
onClick={onClickHistory}
|
|
165
|
-
className='font20 iblock control-icon'
|
|
166
|
-
/>
|
|
167
|
-
</SideIcon>
|
|
168
140
|
<TransferList {...transferProps} />
|
|
169
141
|
<SideIcon
|
|
170
142
|
title={e(settingMap.terminalThemes)}
|
|
@@ -231,19 +203,12 @@ export default memo(function Sidebar (props) {
|
|
|
231
203
|
setLeftSidePanelWidth={setLeftSidePanelWidth}
|
|
232
204
|
leftSidebarWidth={leftSidebarWidth}
|
|
233
205
|
>
|
|
234
|
-
<
|
|
206
|
+
<SideBarPanel
|
|
235
207
|
pinned={pinned}
|
|
208
|
+
sidebarPanelTab={sidebarPanelTab}
|
|
236
209
|
onMouseEnter={handleMouseEnterBookmark}
|
|
237
210
|
onMouseLeave={handleMouseLeave}
|
|
238
211
|
/>
|
|
239
|
-
<HistoryWrap
|
|
240
|
-
history={props.history}
|
|
241
|
-
openedSideBar={openedSideBar}
|
|
242
|
-
onMouseEnter={handleMouseEnterHistory}
|
|
243
|
-
onMouseLeave={handleMouseLeave}
|
|
244
|
-
activeItemId={activeItemId}
|
|
245
|
-
pinned={pinned}
|
|
246
|
-
/>
|
|
247
212
|
</SidePanel>
|
|
248
213
|
</div>
|
|
249
214
|
)
|
|
@@ -1,62 +1,38 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
handleMousedown = (e) => {
|
|
4
|
-
e.stopPropagation()
|
|
5
|
-
this.dragStart = true
|
|
6
|
-
this.clientX = e.clientX
|
|
7
|
-
window.addEventListener('mouseup', this.handleMouseup)
|
|
8
|
-
window.addEventListener('mousemove', this.handleMousemove)
|
|
9
|
-
}
|
|
1
|
+
import { useCallback } from 'react'
|
|
2
|
+
import DragHandle from '../common/drag-handle'
|
|
10
3
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
clientX
|
|
15
|
-
} = e
|
|
16
|
-
let nw = clientX - this.clientX + this.props.leftSidebarWidth
|
|
17
|
-
if (nw < 150) {
|
|
18
|
-
nw = 150
|
|
19
|
-
} else if (nw > 600) {
|
|
20
|
-
nw = 600
|
|
21
|
-
}
|
|
22
|
-
this.props.setLeftSidePanelWidth(nw)
|
|
4
|
+
export default function SidePanel (props) {
|
|
5
|
+
const onDragEnd = useCallback((nw) => {
|
|
6
|
+
props.setLeftSidePanelWidth(nw)
|
|
23
7
|
window.store.onResize()
|
|
24
|
-
|
|
25
|
-
window.removeEventListener('mousemove', this.handleMousemove)
|
|
26
|
-
}
|
|
8
|
+
}, [props])
|
|
27
9
|
|
|
28
|
-
|
|
29
|
-
const {
|
|
30
|
-
clientX
|
|
31
|
-
} = e
|
|
10
|
+
const onDragMove = useCallback((nw) => {
|
|
32
11
|
const el = document.getElementById('side-panel')
|
|
33
|
-
let nw = clientX - this.clientX + this.props.leftSidebarWidth
|
|
34
|
-
if (nw < 343) {
|
|
35
|
-
nw = 343
|
|
36
|
-
} else if (nw > 600) {
|
|
37
|
-
nw = 600
|
|
38
|
-
}
|
|
39
12
|
el.style.width = nw + 'px'
|
|
40
13
|
const el1 = document.querySelector('.sessions')
|
|
41
14
|
if (el1) {
|
|
42
15
|
el1.style.left = (nw + 43) + 'px'
|
|
43
16
|
}
|
|
17
|
+
}, [props.leftSidebarWidth])
|
|
18
|
+
const dragProps = {
|
|
19
|
+
min: 343,
|
|
20
|
+
max: 600,
|
|
21
|
+
width: props.leftSidebarWidth,
|
|
22
|
+
onDragEnd,
|
|
23
|
+
onDragMove,
|
|
24
|
+
left: true
|
|
44
25
|
}
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
/>
|
|
58
|
-
{this.props.children}
|
|
59
|
-
</div>
|
|
60
|
-
)
|
|
61
|
-
}
|
|
26
|
+
return (
|
|
27
|
+
<div
|
|
28
|
+
{...props.sideProps}
|
|
29
|
+
id='side-panel'
|
|
30
|
+
draggable={false}
|
|
31
|
+
>
|
|
32
|
+
<DragHandle
|
|
33
|
+
{...dragProps}
|
|
34
|
+
/>
|
|
35
|
+
{props.children}
|
|
36
|
+
</div>
|
|
37
|
+
)
|
|
62
38
|
}
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* bookmark select
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import { memo } from 'react'
|
|
6
|
+
import BookmarkWrap from './bookmark'
|
|
7
|
+
import History from './history'
|
|
8
|
+
import { pick } from 'lodash-es'
|
|
9
|
+
import { Tabs, Tooltip } from 'antd'
|
|
10
|
+
import { ArrowsAltOutlined, EditOutlined, PlusCircleOutlined, ShrinkOutlined, PushpinOutlined } from '@ant-design/icons'
|
|
11
|
+
|
|
12
|
+
const e = window.translate
|
|
13
|
+
|
|
14
|
+
export default memo(function SidebarPanel (props) {
|
|
15
|
+
const { sidebarPanelTab, pinned } = props
|
|
16
|
+
const { store } = window
|
|
17
|
+
const prps = {
|
|
18
|
+
className: 'font16 mg1x mg2l pointer iblock control-icon'
|
|
19
|
+
}
|
|
20
|
+
const prps1 = {
|
|
21
|
+
className: prps.className + (pinned ? ' pinned' : '')
|
|
22
|
+
}
|
|
23
|
+
const tabsProps = {
|
|
24
|
+
activeKey: sidebarPanelTab,
|
|
25
|
+
onChange: store.handleSidebarPanelTab,
|
|
26
|
+
items: [
|
|
27
|
+
{
|
|
28
|
+
key: 'bookmarks',
|
|
29
|
+
label: e('bookmarks'),
|
|
30
|
+
children: null
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
key: 'history',
|
|
34
|
+
label: e('history'),
|
|
35
|
+
children: null
|
|
36
|
+
}
|
|
37
|
+
]
|
|
38
|
+
}
|
|
39
|
+
const pop1 = {
|
|
40
|
+
...prps,
|
|
41
|
+
onClick: store.onNewSsh
|
|
42
|
+
}
|
|
43
|
+
const pop2 = {
|
|
44
|
+
...prps,
|
|
45
|
+
onClick: store.expandBookmarks
|
|
46
|
+
}
|
|
47
|
+
const pop3 = {
|
|
48
|
+
...prps,
|
|
49
|
+
onClick: store.collapseBookmarks
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
function renderExpandIcons () {
|
|
53
|
+
if (sidebarPanelTab !== 'bookmarks') {
|
|
54
|
+
return null
|
|
55
|
+
}
|
|
56
|
+
return [
|
|
57
|
+
<Tooltip title={e('expandAll')} key='expand'>
|
|
58
|
+
<ArrowsAltOutlined
|
|
59
|
+
{...pop2}
|
|
60
|
+
/>
|
|
61
|
+
</Tooltip>,
|
|
62
|
+
<Tooltip title={e('collapseAll')} key='collapse'>
|
|
63
|
+
<ShrinkOutlined
|
|
64
|
+
{...pop3}
|
|
65
|
+
/>
|
|
66
|
+
</Tooltip>
|
|
67
|
+
]
|
|
68
|
+
}
|
|
69
|
+
return (
|
|
70
|
+
<div
|
|
71
|
+
className='sidebar-panel bookmarks-panel animate-fast'
|
|
72
|
+
{...pick(props, ['onMouseEnter', 'onMouseLeave'])}
|
|
73
|
+
>
|
|
74
|
+
<div className='sidebar-pin-top'>
|
|
75
|
+
<div className='pd1y pd2t pd2x sidebar-panel-control'>
|
|
76
|
+
<Tooltip title={e('newBookmark')}>
|
|
77
|
+
<PlusCircleOutlined
|
|
78
|
+
{...pop1}
|
|
79
|
+
/>
|
|
80
|
+
</Tooltip>
|
|
81
|
+
<Tooltip title={`${e('edit')} ${e('bookmarks')}`}>
|
|
82
|
+
<EditOutlined
|
|
83
|
+
{...pop1}
|
|
84
|
+
/>
|
|
85
|
+
</Tooltip>
|
|
86
|
+
{
|
|
87
|
+
renderExpandIcons()
|
|
88
|
+
}
|
|
89
|
+
<Tooltip title={e('pin')}>
|
|
90
|
+
<PushpinOutlined
|
|
91
|
+
{...prps1}
|
|
92
|
+
onClick={store.handlePin}
|
|
93
|
+
/>
|
|
94
|
+
</Tooltip>
|
|
95
|
+
</div>
|
|
96
|
+
<div className='pd1y pd2x'>
|
|
97
|
+
<Tabs {...tabsProps} />
|
|
98
|
+
</div>
|
|
99
|
+
</div>
|
|
100
|
+
{
|
|
101
|
+
sidebarPanelTab === 'bookmarks'
|
|
102
|
+
? <BookmarkWrap {...props} />
|
|
103
|
+
: <History store={store} />
|
|
104
|
+
}
|
|
105
|
+
</div>
|
|
106
|
+
)
|
|
107
|
+
})
|
|
@@ -26,6 +26,20 @@
|
|
|
26
26
|
box-shadow 0px 0px 3px 3px alpha(main, .1)
|
|
27
27
|
.item-list
|
|
28
28
|
padding-right 0
|
|
29
|
+
.sidebar-pin-top
|
|
30
|
+
position absolute
|
|
31
|
+
left 0
|
|
32
|
+
right 0
|
|
33
|
+
top 36px
|
|
34
|
+
height 112px
|
|
35
|
+
.sidebar-panel-bookmarks
|
|
36
|
+
.sidebar-panel-history
|
|
37
|
+
position absolute
|
|
38
|
+
left 0
|
|
39
|
+
right 0
|
|
40
|
+
top 148px
|
|
41
|
+
bottom 0
|
|
42
|
+
overflow-y scroll
|
|
29
43
|
.not-system-ui.is-mac
|
|
30
44
|
.sidebar-bar
|
|
31
45
|
margin-top 20px
|
|
@@ -79,15 +93,6 @@
|
|
|
79
93
|
&:hover
|
|
80
94
|
color text-light
|
|
81
95
|
|
|
82
|
-
.drag-handle
|
|
83
|
-
position absolute
|
|
84
|
-
right 0
|
|
85
|
-
top 0
|
|
86
|
-
width 3px
|
|
87
|
-
bottom 0
|
|
88
|
-
cursor ew-resize
|
|
89
|
-
display none
|
|
90
|
-
z-index 201
|
|
91
96
|
// Hover.css (http://ianlunn.github.io/Hover/)
|
|
92
97
|
// Version: 2.3.2
|
|
93
98
|
// Author: Ian Lunn @IanLunn
|