@electerm/electerm-react 2.3.126 → 2.3.151
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 +2 -1
- package/client/common/db.js +2 -1
- package/client/common/download.jsx +15 -0
- package/client/common/init-setting-item.js +5 -0
- package/client/components/ai/ai-cache.jsx +1 -1
- package/client/components/batch-op/batch-op.jsx +4 -9
- package/client/components/bookmark-form/common/bookmark-group-tree-format.js +4 -3
- package/client/components/bookmark-form/common/color-picker.jsx +16 -5
- package/client/components/bookmark-form/common/color-picker.styl +1 -2
- package/client/components/bookmark-form/common/connection-hopping.jsx +1 -0
- package/client/components/bookmark-form/common/ssh-host-selector.jsx +1 -1
- package/client/components/bookmark-form/common/ssh-tunnels.jsx +1 -0
- package/client/components/bookmark-form/config/common-fields.js +1 -0
- package/client/components/bookmark-form/tree-delete.jsx +18 -15
- package/client/components/common/drawer.jsx +62 -0
- package/client/components/common/drawer.styl +34 -0
- package/client/components/common/input-auto-focus.jsx +16 -3
- package/client/components/common/logo-elem.jsx +1 -1
- package/client/components/common/password.jsx +1 -1
- package/client/components/footer/footer.styl +1 -0
- package/client/components/main/main.jsx +4 -1
- package/client/components/profile/profile-form.jsx +1 -1
- package/client/components/quick-commands/qm.styl +21 -1
- package/client/components/quick-commands/quick-commands-box.jsx +28 -36
- package/client/components/quick-commands/quick-commands-form.jsx +1 -1
- package/client/components/quick-commands/quick-commands-list-form.jsx +1 -0
- package/client/components/quick-commands/quick-commands-select.jsx +1 -1
- package/client/components/session/session.jsx +1 -1
- package/client/components/setting-panel/deep-link-control.jsx +1 -0
- package/client/components/setting-panel/list.jsx +1 -1
- package/client/components/setting-panel/list.styl +1 -1
- package/client/components/setting-panel/setting-common.jsx +2 -1
- package/client/components/setting-panel/setting-modal.jsx +13 -0
- package/client/components/setting-panel/setting-terminal.jsx +1 -1
- package/client/components/setting-panel/setting-wrap.jsx +5 -11
- package/client/components/setting-panel/setting-wrap.styl +8 -6
- package/client/components/setting-panel/start-session-select.jsx +3 -3
- package/client/components/setting-panel/tab-widgets.jsx +35 -0
- package/client/components/sftp/address-bookmark-item.jsx +1 -1
- package/client/components/sftp/paged-list.jsx +2 -1
- package/client/components/sftp/permission-render.jsx +1 -1
- package/client/components/sftp/sftp-entry.jsx +1 -1
- package/client/components/sftp/sftp.styl +13 -0
- package/client/components/sidebar/index.jsx +12 -2
- package/client/components/sidebar/transfer-history-modal.jsx +1 -1
- package/client/components/theme/theme-list-item.jsx +4 -3
- package/client/components/tree-list/move-item-modal.jsx +171 -36
- package/client/components/tree-list/tree-list.jsx +3 -15
- package/client/components/tree-list/tree-list.styl +6 -1
- package/client/components/vnc/vnc-session.jsx +1 -1
- package/client/components/widgets/widget-control.jsx +64 -0
- package/client/components/widgets/widget-form.jsx +115 -0
- package/client/components/widgets/widget-instance.jsx +46 -0
- package/client/components/widgets/widget-instances.jsx +10 -0
- package/client/components/widgets/widgets-list.jsx +155 -0
- package/client/store/init-state.js +9 -1
- package/client/store/setting.js +1 -3
- package/client/store/store.js +2 -0
- package/client/store/widgets.js +59 -0
- package/package.json +1 -1
|
@@ -66,7 +66,7 @@ export default class SettingCommon extends Component {
|
|
|
66
66
|
this.setState({
|
|
67
67
|
ready: true
|
|
68
68
|
})
|
|
69
|
-
},
|
|
69
|
+
}, 0)
|
|
70
70
|
}
|
|
71
71
|
|
|
72
72
|
componentWillUnmount () {
|
|
@@ -600,6 +600,7 @@ export default class SettingCommon extends Component {
|
|
|
600
600
|
<Tag
|
|
601
601
|
color={main}
|
|
602
602
|
className='mg1l'
|
|
603
|
+
variant='solid'
|
|
603
604
|
style={
|
|
604
605
|
{
|
|
605
606
|
color: text
|
|
@@ -15,6 +15,7 @@ import TabQuickCommands from './tab-quick-commands'
|
|
|
15
15
|
import TabSettings from './tab-settings'
|
|
16
16
|
import TabThemes from './tab-themes'
|
|
17
17
|
import TabProfiles from './tab-profiles'
|
|
18
|
+
import TabWidgets from './tab-widgets'
|
|
18
19
|
|
|
19
20
|
const e = window.translate
|
|
20
21
|
|
|
@@ -92,6 +93,11 @@ export default auto(function SettingModalWrap (props) {
|
|
|
92
93
|
key: settingMap.profiles,
|
|
93
94
|
label: e(settingMap.profiles),
|
|
94
95
|
children: null
|
|
96
|
+
},
|
|
97
|
+
{
|
|
98
|
+
key: settingMap.widgets,
|
|
99
|
+
label: <>{e(settingMap.widgets)} <sup>Beta</sup></>,
|
|
100
|
+
children: null
|
|
95
101
|
}
|
|
96
102
|
]
|
|
97
103
|
const tabsProps = {
|
|
@@ -141,6 +147,13 @@ export default auto(function SettingModalWrap (props) {
|
|
|
141
147
|
store={store}
|
|
142
148
|
settingTab={settingTab}
|
|
143
149
|
/>
|
|
150
|
+
<TabWidgets
|
|
151
|
+
listProps={props0}
|
|
152
|
+
settingItem={settingItem}
|
|
153
|
+
formProps={formProps}
|
|
154
|
+
store={store}
|
|
155
|
+
settingTab={settingTab}
|
|
156
|
+
/>
|
|
144
157
|
</>
|
|
145
158
|
)
|
|
146
159
|
}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
5
|
import { Component } from 'react'
|
|
6
|
-
import
|
|
6
|
+
import Drawer from '../common/drawer'
|
|
7
7
|
import { CloseCircleOutlined } from '@ant-design/icons'
|
|
8
8
|
import { sidebarWidth } from '../../common/constants'
|
|
9
9
|
import AppDrag from '../tabs/app-drag'
|
|
@@ -21,15 +21,9 @@ export default class SettingWrap extends Component {
|
|
|
21
21
|
open: this.props.visible,
|
|
22
22
|
onClose: this.props.onCancel,
|
|
23
23
|
className: 'setting-wrap',
|
|
24
|
-
|
|
24
|
+
size: this.props.innerWidth - sidebarWidth,
|
|
25
25
|
zIndex: 888,
|
|
26
|
-
placement: 'left'
|
|
27
|
-
destroyOnHidden: true,
|
|
28
|
-
styles: {
|
|
29
|
-
header: {
|
|
30
|
-
display: 'none'
|
|
31
|
-
}
|
|
32
|
-
}
|
|
26
|
+
placement: 'left'
|
|
33
27
|
}
|
|
34
28
|
return (
|
|
35
29
|
<Drawer
|
|
@@ -40,13 +34,13 @@ export default class SettingWrap extends Component {
|
|
|
40
34
|
onClick={this.props.onCancel}
|
|
41
35
|
/>
|
|
42
36
|
<CloseCircleOutlined
|
|
43
|
-
className='close-setting-wrap
|
|
37
|
+
className='close-setting-wrap alt-close-setting-wrap'
|
|
44
38
|
onClick={this.props.onCancel}
|
|
45
39
|
/>
|
|
46
40
|
{
|
|
47
41
|
this.props.useSystemTitleBar ? null : <AppDrag />
|
|
48
42
|
}
|
|
49
|
-
{this.props.
|
|
43
|
+
{this.props.children}
|
|
50
44
|
</Drawer>
|
|
51
45
|
)
|
|
52
46
|
}
|
|
@@ -1,18 +1,20 @@
|
|
|
1
1
|
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
.close-setting-wrap-icon
|
|
2
|
+
|
|
3
|
+
.close-setting-wrap
|
|
5
4
|
position absolute
|
|
6
5
|
top 70px
|
|
7
6
|
font-size 16px
|
|
8
7
|
cursor pointer
|
|
9
8
|
z-index 889
|
|
9
|
+
right 20px
|
|
10
10
|
&:hover
|
|
11
11
|
color var(--success)
|
|
12
12
|
.alt-close-setting-wrap
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
13
|
+
left 20px
|
|
14
|
+
right auto
|
|
15
|
+
.batch-op-wrap .close-setting-wrap
|
|
16
|
+
top 40px
|
|
17
|
+
right 30px
|
|
16
18
|
.setting-row
|
|
17
19
|
position absolute
|
|
18
20
|
top 127px
|
|
@@ -64,9 +64,9 @@ export default class StartSessionSelect extends PureComponent {
|
|
|
64
64
|
...(d.bookmarkIds || []).map(buildLeaf)
|
|
65
65
|
].filter(d => d)
|
|
66
66
|
}
|
|
67
|
-
if (!r.children.length) {
|
|
68
|
-
|
|
69
|
-
}
|
|
67
|
+
// if (!r.children.length) {
|
|
68
|
+
// return ''
|
|
69
|
+
// }
|
|
70
70
|
return r
|
|
71
71
|
}).filter(d => d)
|
|
72
72
|
return level1
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import SettingCol from './col'
|
|
2
|
+
import WidgetControl from '../widgets/widget-control'
|
|
3
|
+
import WidgetList from '../widgets/widgets-list'
|
|
4
|
+
import {
|
|
5
|
+
settingMap
|
|
6
|
+
} from '../../common/constants'
|
|
7
|
+
|
|
8
|
+
export default function TabWidgets (props) {
|
|
9
|
+
const {
|
|
10
|
+
settingTab
|
|
11
|
+
} = props
|
|
12
|
+
if (settingTab !== settingMap.widgets) {
|
|
13
|
+
return null
|
|
14
|
+
}
|
|
15
|
+
const {
|
|
16
|
+
settingItem,
|
|
17
|
+
listProps,
|
|
18
|
+
formProps
|
|
19
|
+
} = props
|
|
20
|
+
return (
|
|
21
|
+
<div
|
|
22
|
+
className='setting-tabs-profile'
|
|
23
|
+
>
|
|
24
|
+
<SettingCol>
|
|
25
|
+
<WidgetList
|
|
26
|
+
{...listProps}
|
|
27
|
+
/>
|
|
28
|
+
<WidgetControl
|
|
29
|
+
{...formProps}
|
|
30
|
+
key={settingItem.id}
|
|
31
|
+
/>
|
|
32
|
+
</SettingCol>
|
|
33
|
+
</div>
|
|
34
|
+
)
|
|
35
|
+
}
|
|
@@ -37,8 +37,9 @@ export default class ScrollFiles extends Component {
|
|
|
37
37
|
current: this.state.page,
|
|
38
38
|
pageSize: this.state.pageSize,
|
|
39
39
|
total: this.props.list.length,
|
|
40
|
+
showLessItems: true,
|
|
40
41
|
showSizeChanger: false,
|
|
41
|
-
simple:
|
|
42
|
+
simple: false,
|
|
42
43
|
onChange: this.onChange
|
|
43
44
|
}
|
|
44
45
|
return (
|
|
@@ -164,6 +164,19 @@
|
|
|
164
164
|
.pager-wrap
|
|
165
165
|
z-index 4
|
|
166
166
|
position relative
|
|
167
|
+
|
|
168
|
+
.sftp-has-pager
|
|
169
|
+
.sftp-table-content
|
|
170
|
+
position static
|
|
171
|
+
padding-bottom 42px
|
|
172
|
+
.pager-wrap
|
|
173
|
+
position absolute
|
|
174
|
+
bottom 0
|
|
175
|
+
left 0
|
|
176
|
+
width 100%
|
|
177
|
+
background var(--main)
|
|
178
|
+
border-top 1px solid var(--main-darker)
|
|
179
|
+
|
|
167
180
|
.file-header-context-menu
|
|
168
181
|
position fixed
|
|
169
182
|
z-index 999
|
|
@@ -6,7 +6,8 @@ import {
|
|
|
6
6
|
PlusCircleOutlined,
|
|
7
7
|
SettingOutlined,
|
|
8
8
|
UpCircleOutlined,
|
|
9
|
-
BarsOutlined
|
|
9
|
+
BarsOutlined,
|
|
10
|
+
AppstoreOutlined
|
|
10
11
|
} from '@ant-design/icons'
|
|
11
12
|
import { Tooltip } from 'antd'
|
|
12
13
|
import SideBarPanel from './sidebar-panel'
|
|
@@ -39,7 +40,8 @@ export default function Sidebar (props) {
|
|
|
39
40
|
transferTab,
|
|
40
41
|
showModal,
|
|
41
42
|
showInfoModal,
|
|
42
|
-
sidebarPanelTab
|
|
43
|
+
sidebarPanelTab,
|
|
44
|
+
openWidgetsModal
|
|
43
45
|
} = props
|
|
44
46
|
|
|
45
47
|
const { store } = window
|
|
@@ -100,6 +102,7 @@ export default function Sidebar (props) {
|
|
|
100
102
|
const syncActive = showSetting && settingTab === settingMap.setting && settingItem.id === 'setting-sync'
|
|
101
103
|
const themeActive = showSetting && settingTab === settingMap.terminalThemes
|
|
102
104
|
const bookmarksActive = showSetting && settingTab === settingMap.bookmarks
|
|
105
|
+
const widgetsActive = showSetting && settingTab === settingMap.widgets
|
|
103
106
|
const sideProps = openedSideBar
|
|
104
107
|
? {
|
|
105
108
|
className: 'sidebar-list',
|
|
@@ -177,6 +180,13 @@ export default function Sidebar (props) {
|
|
|
177
180
|
>
|
|
178
181
|
<BarsOutlined className='iblock font20 control-icon' onClick={toggleBatchOp} />
|
|
179
182
|
</SideIcon>
|
|
183
|
+
<SideIcon
|
|
184
|
+
title={e('widgets')}
|
|
185
|
+
active={widgetsActive}
|
|
186
|
+
>
|
|
187
|
+
<AppstoreOutlined className='iblock font20 control-icon' onClick={openWidgetsModal} />
|
|
188
|
+
</SideIcon>
|
|
189
|
+
|
|
180
190
|
<SideIcon
|
|
181
191
|
title={e('about')}
|
|
182
192
|
active={showInfoModal}
|
|
@@ -62,7 +62,7 @@ export default function ThemeListItem (props) {
|
|
|
62
62
|
|
|
63
63
|
function renderTooltipContent () {
|
|
64
64
|
return (
|
|
65
|
-
<Space>
|
|
65
|
+
<Space.Compact>
|
|
66
66
|
<Button
|
|
67
67
|
size='small'
|
|
68
68
|
icon={<EyeOutlined />}
|
|
@@ -79,7 +79,7 @@ export default function ThemeListItem (props) {
|
|
|
79
79
|
>
|
|
80
80
|
{e('apply')}
|
|
81
81
|
</Button>
|
|
82
|
-
</Space>
|
|
82
|
+
</Space.Compact>
|
|
83
83
|
)
|
|
84
84
|
}
|
|
85
85
|
|
|
@@ -116,7 +116,8 @@ export default function ThemeListItem (props) {
|
|
|
116
116
|
return (
|
|
117
117
|
<Tag
|
|
118
118
|
color={main}
|
|
119
|
-
className='
|
|
119
|
+
className='mg1r'
|
|
120
|
+
variant='solid'
|
|
120
121
|
style={
|
|
121
122
|
{
|
|
122
123
|
color: text
|
|
@@ -1,28 +1,144 @@
|
|
|
1
|
-
// render bookmark select, use antd tree
|
|
2
|
-
import { useState } from 'react'
|
|
1
|
+
// render bookmark select, use antd tree
|
|
2
|
+
import { useState, useEffect } from 'react'
|
|
3
|
+
import {
|
|
4
|
+
MergeOutlined,
|
|
5
|
+
SearchOutlined
|
|
6
|
+
} from '@ant-design/icons'
|
|
3
7
|
import buildGroupData from '../bookmark-form/common/bookmark-group-tree-format'
|
|
4
|
-
import {
|
|
8
|
+
import { Tree, Modal, Button, Input } from 'antd'
|
|
9
|
+
import { auto } from 'manate/react'
|
|
5
10
|
const e = window.translate
|
|
6
11
|
|
|
7
|
-
|
|
12
|
+
const rootId = '__root__'
|
|
13
|
+
|
|
14
|
+
// Helper function to filter tree data based on search text
|
|
15
|
+
function filterTreeData (data, searchText) {
|
|
16
|
+
if (!searchText) {
|
|
17
|
+
return data
|
|
18
|
+
}
|
|
19
|
+
const lowerSearch = searchText.toLowerCase()
|
|
20
|
+
|
|
21
|
+
function filterNodes (nodes) {
|
|
22
|
+
return nodes.reduce((acc, node) => {
|
|
23
|
+
const titleText = typeof node.title === 'string'
|
|
24
|
+
? node.title
|
|
25
|
+
: (node.title?.props?.children?.[1] || node.title?.props?.children || '')
|
|
26
|
+
const titleStr = String(titleText).toLowerCase()
|
|
27
|
+
const children = node.children ? filterNodes(node.children) : []
|
|
28
|
+
|
|
29
|
+
if (titleStr.includes(lowerSearch) || children.length > 0) {
|
|
30
|
+
acc.push({
|
|
31
|
+
...node,
|
|
32
|
+
children: children.length > 0 ? children : node.children
|
|
33
|
+
})
|
|
34
|
+
}
|
|
35
|
+
return acc
|
|
36
|
+
}, [])
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
return filterNodes(data)
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
// Helper function to get all keys from tree data
|
|
43
|
+
function getAllKeys (data) {
|
|
44
|
+
const keys = []
|
|
45
|
+
function traverse (nodes) {
|
|
46
|
+
for (const node of nodes) {
|
|
47
|
+
keys.push(node.key)
|
|
48
|
+
if (node.children) {
|
|
49
|
+
traverse(node.children)
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
traverse(data)
|
|
54
|
+
return keys
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
export default auto(function MoveItemModal (props) {
|
|
8
58
|
const [groupId, setGroupId] = useState(undefined)
|
|
59
|
+
const [searchText, setSearchText] = useState('')
|
|
9
60
|
const {
|
|
10
61
|
openMoveModal,
|
|
11
62
|
moveItem,
|
|
12
63
|
moveItemIsGroup,
|
|
13
64
|
bookmarkGroups
|
|
14
|
-
} = props
|
|
65
|
+
} = props.store
|
|
66
|
+
|
|
67
|
+
function onCancelMoveItem () {
|
|
68
|
+
window.store.storeAssign({
|
|
69
|
+
openMoveModal: false,
|
|
70
|
+
moveItem: null,
|
|
71
|
+
moveItemIsGroup: false
|
|
72
|
+
})
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
// Reset groupId and search when modal opens
|
|
76
|
+
useEffect(() => {
|
|
77
|
+
if (openMoveModal) {
|
|
78
|
+
setGroupId(undefined)
|
|
79
|
+
setSearchText('')
|
|
80
|
+
}
|
|
81
|
+
}, [openMoveModal])
|
|
82
|
+
|
|
15
83
|
if (!openMoveModal) {
|
|
16
84
|
return null
|
|
17
85
|
}
|
|
18
|
-
|
|
86
|
+
|
|
87
|
+
// Find current parent folder
|
|
88
|
+
const currentParent = bookmarkGroups.find(bg => {
|
|
89
|
+
if (moveItemIsGroup) {
|
|
90
|
+
return (bg.bookmarkGroupIds || []).includes(moveItem.id)
|
|
91
|
+
}
|
|
92
|
+
return (bg.bookmarkIds || []).includes(moveItem.id)
|
|
93
|
+
})
|
|
94
|
+
const currentParentId = currentParent?.id
|
|
95
|
+
|
|
96
|
+
// Build tree data with disabled folder for self and current parent
|
|
97
|
+
const data = buildGroupData(bookmarkGroups, moveItemIsGroup ? moveItem.id : null, false, currentParentId)
|
|
98
|
+
|
|
99
|
+
// if it is a group and can move to root, add root option
|
|
100
|
+
if (moveItemIsGroup && currentParentId) {
|
|
101
|
+
const title = <span><MergeOutlined /> {e('ROOT')}</span>
|
|
102
|
+
data.unshift({
|
|
103
|
+
title,
|
|
104
|
+
value: rootId,
|
|
105
|
+
key: rootId,
|
|
106
|
+
disabled: false
|
|
107
|
+
})
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
// Filter tree data based on search
|
|
111
|
+
const filteredData = filterTreeData(data, searchText)
|
|
112
|
+
const expandedKeys = getAllKeys(filteredData)
|
|
113
|
+
|
|
114
|
+
function onTreeSelect (selectedKeys) {
|
|
115
|
+
if (selectedKeys.length > 0) {
|
|
116
|
+
// Find the node to check if it's disabled
|
|
117
|
+
const findNode = (nodes, key) => {
|
|
118
|
+
for (const node of nodes) {
|
|
119
|
+
if (node.key === key) return node
|
|
120
|
+
if (node.children) {
|
|
121
|
+
const found = findNode(node.children, key)
|
|
122
|
+
if (found) return found
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
return null
|
|
126
|
+
}
|
|
127
|
+
const node = findNode(data, selectedKeys[0])
|
|
128
|
+
if (node && !node.disabled) {
|
|
129
|
+
setGroupId(selectedKeys[0])
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
|
|
19
134
|
function onSelect () {
|
|
20
135
|
const {
|
|
21
136
|
bookmarkGroups
|
|
22
137
|
} = window.store
|
|
138
|
+
|
|
23
139
|
const groupMap = new Map(bookmarkGroups.map(d => [d.id, d]))
|
|
24
140
|
const group = groupMap.get(groupId)
|
|
25
|
-
if (!group) {
|
|
141
|
+
if (!group && groupId !== rootId) {
|
|
26
142
|
return
|
|
27
143
|
}
|
|
28
144
|
// Find and update the original parent group
|
|
@@ -45,7 +161,13 @@ export default function MoveItemModal (props) {
|
|
|
45
161
|
)
|
|
46
162
|
}
|
|
47
163
|
}
|
|
164
|
+
if (groupId === rootId) {
|
|
165
|
+
delete moveItem.level
|
|
166
|
+
return onCancelMoveItem()
|
|
167
|
+
}
|
|
168
|
+
|
|
48
169
|
if (moveItemIsGroup) {
|
|
170
|
+
moveItem.level = (group.level || 1) + 1
|
|
49
171
|
group.bookmarkGroupIds = [
|
|
50
172
|
moveItem.id,
|
|
51
173
|
...(group.bookmarkGroupIds || [])
|
|
@@ -56,46 +178,59 @@ export default function MoveItemModal (props) {
|
|
|
56
178
|
...(group.bookmarkIds || [])
|
|
57
179
|
]
|
|
58
180
|
}
|
|
59
|
-
|
|
181
|
+
onCancelMoveItem()
|
|
60
182
|
}
|
|
183
|
+
|
|
184
|
+
const footer = (
|
|
185
|
+
<>
|
|
186
|
+
<Button
|
|
187
|
+
type='primary'
|
|
188
|
+
onClick={onSelect}
|
|
189
|
+
disabled={!groupId}
|
|
190
|
+
>
|
|
191
|
+
{e('ok')}
|
|
192
|
+
</Button>
|
|
193
|
+
<Button
|
|
194
|
+
onClick={onCancelMoveItem}
|
|
195
|
+
className='mg1l'
|
|
196
|
+
>
|
|
197
|
+
{e('cancel')}
|
|
198
|
+
</Button>
|
|
199
|
+
</>
|
|
200
|
+
)
|
|
201
|
+
|
|
61
202
|
const modalProps = {
|
|
62
203
|
open: openMoveModal,
|
|
63
204
|
title: e('moveTo'),
|
|
64
|
-
footer
|
|
65
|
-
onCancel:
|
|
205
|
+
footer,
|
|
206
|
+
onCancel: onCancelMoveItem
|
|
66
207
|
}
|
|
208
|
+
|
|
67
209
|
const treeProps = {
|
|
68
|
-
treeData:
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
treeDefaultExpandAll: true,
|
|
75
|
-
className: 'width-100'
|
|
210
|
+
treeData: filteredData,
|
|
211
|
+
onSelect: onTreeSelect,
|
|
212
|
+
selectedKeys: groupId ? [groupId] : [],
|
|
213
|
+
expandedKeys,
|
|
214
|
+
autoExpandParent: true,
|
|
215
|
+
className: 'width-100 move-item-tree'
|
|
76
216
|
}
|
|
217
|
+
|
|
77
218
|
return (
|
|
78
219
|
<Modal {...modalProps}>
|
|
79
|
-
<div className='
|
|
80
|
-
<
|
|
81
|
-
{
|
|
220
|
+
<div className='pd1b'>
|
|
221
|
+
<Input
|
|
222
|
+
placeholder={e('search')}
|
|
223
|
+
prefix={<SearchOutlined />}
|
|
224
|
+
value={searchText}
|
|
225
|
+
onChange={e => setSearchText(e.target.value)}
|
|
226
|
+
allowClear
|
|
82
227
|
/>
|
|
83
228
|
</div>
|
|
84
|
-
<div className='
|
|
85
|
-
<
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
disabled={!groupId}
|
|
89
|
-
>
|
|
90
|
-
{e('ok')}
|
|
91
|
-
</Button>
|
|
92
|
-
<Button
|
|
93
|
-
onClick={props.onCancelMoveItem}
|
|
94
|
-
className='mg1l'
|
|
95
|
-
>
|
|
96
|
-
{e('cancel')}
|
|
97
|
-
</Button>
|
|
229
|
+
<div className='move-item-tree-wrap'>
|
|
230
|
+
<Tree
|
|
231
|
+
{...treeProps}
|
|
232
|
+
/>
|
|
98
233
|
</div>
|
|
99
234
|
</Modal>
|
|
100
235
|
)
|
|
101
|
-
}
|
|
236
|
+
})
|
|
@@ -27,7 +27,6 @@ import './tree-list.styl'
|
|
|
27
27
|
import TreeExpander from './tree-expander'
|
|
28
28
|
import TreeListItem from './tree-list-item'
|
|
29
29
|
import TreeSearch from './tree-search'
|
|
30
|
-
import MoveItemModal from './move-item-modal'
|
|
31
30
|
import { CategoryColorPicker } from './category-color-picker.jsx'
|
|
32
31
|
import { getRandomDefaultColor } from '../../common/rand-hex-color.js'
|
|
33
32
|
|
|
@@ -39,9 +38,6 @@ export default class ItemListTree extends Component {
|
|
|
39
38
|
keyword: '',
|
|
40
39
|
parentId: '',
|
|
41
40
|
showNewBookmarkGroupForm: false,
|
|
42
|
-
openMoveModal: false,
|
|
43
|
-
moveItem: null,
|
|
44
|
-
moveItemIsGroup: false,
|
|
45
41
|
bookmarkGroupTitle: '',
|
|
46
42
|
bookmarkGroupColor: '',
|
|
47
43
|
categoryTitle: '',
|
|
@@ -59,7 +55,7 @@ export default class ItemListTree extends Component {
|
|
|
59
55
|
this.setState({
|
|
60
56
|
ready: true
|
|
61
57
|
})
|
|
62
|
-
},
|
|
58
|
+
}, 0)
|
|
63
59
|
}
|
|
64
60
|
|
|
65
61
|
componentWillUnmount () {
|
|
@@ -174,7 +170,7 @@ export default class ItemListTree extends Component {
|
|
|
174
170
|
|
|
175
171
|
openMoveModal = (e, item, isGroup) => {
|
|
176
172
|
e.stopPropagation()
|
|
177
|
-
|
|
173
|
+
window.store.storeAssign({
|
|
178
174
|
openMoveModal: true,
|
|
179
175
|
moveItem: item,
|
|
180
176
|
moveItemIsGroup: isGroup
|
|
@@ -832,7 +828,7 @@ export default class ItemListTree extends Component {
|
|
|
832
828
|
}
|
|
833
829
|
|
|
834
830
|
render () {
|
|
835
|
-
const { ready
|
|
831
|
+
const { ready } = this.state
|
|
836
832
|
if (!ready) {
|
|
837
833
|
return (
|
|
838
834
|
<div className='pd3 aligncenter'>
|
|
@@ -846,13 +842,6 @@ export default class ItemListTree extends Component {
|
|
|
846
842
|
staticList,
|
|
847
843
|
listStyle = {}
|
|
848
844
|
} = this.props
|
|
849
|
-
const moveProps = {
|
|
850
|
-
openMoveModal,
|
|
851
|
-
moveItem,
|
|
852
|
-
moveItemIsGroup,
|
|
853
|
-
bookmarkGroups,
|
|
854
|
-
onCancelMoveItem: this.onCancelMoveItem
|
|
855
|
-
}
|
|
856
845
|
const level1Bookgroups = ready
|
|
857
846
|
? bookmarkGroups.filter(
|
|
858
847
|
d => !d.level || d.level < 2
|
|
@@ -860,7 +849,6 @@ export default class ItemListTree extends Component {
|
|
|
860
849
|
: []
|
|
861
850
|
return (
|
|
862
851
|
<div className={`tree-list item-type-${type}`}>
|
|
863
|
-
<MoveItemModal {...moveProps} />
|
|
864
852
|
{
|
|
865
853
|
staticList
|
|
866
854
|
? null
|