@electerm/electerm-react 1.60.18 → 1.60.32

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.
Files changed (106) hide show
  1. package/client/common/clipboard.js +1 -14
  2. package/client/common/constants.js +0 -43
  3. package/client/common/data-compare.js +55 -0
  4. package/client/common/default-setting.js +2 -10
  5. package/client/common/resolve.js +18 -22
  6. package/client/common/sftp.js +0 -3
  7. package/client/components/ai/ai-chat.jsx +30 -6
  8. package/client/components/ai/ai-config.jsx +17 -6
  9. package/client/components/batch-op/batch-op.jsx +3 -24
  10. package/client/components/bookmark-form/bookmark-group-tree-format.js +7 -9
  11. package/client/components/bookmark-form/form-ssh-common.jsx +0 -2
  12. package/client/components/bookmark-form/ssh-form.jsx +8 -41
  13. package/client/components/bookmark-form/tree-delete.jsx +1 -13
  14. package/client/components/common/animate-text.jsx +3 -4
  15. package/client/components/common/drag-handle.jsx +59 -45
  16. package/client/components/common/drag-handle.styl +2 -1
  17. package/client/components/common/input-auto-focus.jsx +29 -63
  18. package/client/components/common/ref.js +24 -0
  19. package/client/components/footer/batch-input.jsx +1 -6
  20. package/client/components/footer/footer-entry.jsx +13 -16
  21. package/client/components/footer/footer.styl +0 -5
  22. package/client/components/icons/ai-icon.jsx +17 -0
  23. package/client/components/icons/ai-icon.styl +3 -0
  24. package/client/components/layout/layout-item.jsx +14 -0
  25. package/client/components/main/main.jsx +8 -19
  26. package/client/components/main/upgrade.jsx +13 -25
  27. package/client/components/profile/profile-form-elem.jsx +1 -2
  28. package/client/components/quick-commands/on-drop.js +1 -12
  29. package/client/components/quick-commands/quick-command-transport-mod.jsx +3 -13
  30. package/client/components/quick-commands/quick-commands-form-elem.jsx +1 -2
  31. package/client/components/rdp/rdp-session.jsx +4 -4
  32. package/client/components/session/session.jsx +9 -11
  33. package/client/components/setting-panel/on-tree-drop.js +4 -35
  34. package/client/components/setting-panel/setting-common.jsx +4 -1
  35. package/client/components/setting-panel/setting-modal.jsx +7 -5
  36. package/client/components/setting-panel/tab-settings.jsx +0 -1
  37. package/client/components/setting-sync/setting-sync.jsx +0 -1
  38. package/client/components/sftp/address-bookmark-item.jsx +1 -15
  39. package/client/components/sftp/confirm-modal-store.jsx +2 -2
  40. package/client/components/sftp/{file-mode-modal.jsx → file-info-modal.jsx} +137 -37
  41. package/client/components/sftp/file-item.jsx +156 -192
  42. package/client/components/sftp/file-table-header.jsx +98 -0
  43. package/client/components/sftp/list-table-ui.jsx +125 -416
  44. package/client/components/sftp/sftp-entry.jsx +102 -128
  45. package/client/components/sftp/sftp.styl +6 -22
  46. package/client/components/sftp/transfer-conflict-store.jsx +8 -12
  47. package/client/components/sftp/transport-action-store.jsx +7 -15
  48. package/client/components/shortcuts/shortcut-control.jsx +72 -3
  49. package/client/components/shortcuts/shortcut-handler.js +0 -1
  50. package/client/components/side-panel-r/side-panel-r.jsx +7 -4
  51. package/client/components/sidebar/bookmark-select.jsx +5 -3
  52. package/client/components/sidebar/history.jsx +3 -0
  53. package/client/components/sidebar/index.jsx +1 -1
  54. package/client/components/sidebar/info-modal.jsx +3 -0
  55. package/client/components/sidebar/side-panel.jsx +7 -4
  56. package/client/components/sidebar/sidebar-panel.jsx +1 -1
  57. package/client/components/sidebar/sidebar.styl +3 -3
  58. package/client/components/sys-menu/icons-map.jsx +52 -0
  59. package/client/components/{context-menu → sys-menu}/menu-btn.jsx +33 -45
  60. package/client/components/sys-menu/sys-menu.jsx +163 -0
  61. package/client/components/{context-menu/context-menu.styl → sys-menu/sys-menu.styl} +2 -11
  62. package/client/components/tabs/index.jsx +5 -97
  63. package/client/components/tabs/tab.jsx +121 -73
  64. package/client/components/tabs/tabs.styl +4 -1
  65. package/client/components/terminal/term-search.jsx +16 -28
  66. package/client/components/terminal/terminal-interactive.jsx +0 -2
  67. package/client/components/terminal/{index.jsx → terminal.jsx} +110 -240
  68. package/client/components/terminal-info/base.jsx +21 -46
  69. package/client/components/terminal-info/terminal-info.jsx +3 -0
  70. package/client/components/text-editor/text-editor.jsx +38 -53
  71. package/client/components/theme/theme-form.jsx +0 -2
  72. package/client/components/tree-list/bookmark-toolbar.jsx +23 -47
  73. package/client/components/tree-list/bookmark-transport.jsx +2 -90
  74. package/client/components/tree-list/move-item-modal.jsx +101 -0
  75. package/client/components/tree-list/tree-expander.jsx +2 -3
  76. package/client/components/tree-list/tree-list-item.jsx +8 -11
  77. package/client/components/tree-list/tree-list.jsx +75 -296
  78. package/client/components/vnc/vnc-session.jsx +5 -3
  79. package/client/store/app-upgrade.js +2 -5
  80. package/client/store/bookmark-group.js +116 -51
  81. package/client/store/common.js +36 -54
  82. package/client/store/event.js +4 -37
  83. package/client/store/init-state.js +9 -12
  84. package/client/store/item.js +34 -39
  85. package/client/store/load-data.js +5 -1
  86. package/client/store/quick-command.js +2 -12
  87. package/client/store/session.js +6 -7
  88. package/client/store/setting.js +3 -7
  89. package/client/store/sidebar.js +2 -8
  90. package/client/store/store.js +0 -20
  91. package/client/store/system-menu.js +1 -2
  92. package/client/store/tab.js +29 -1
  93. package/client/store/terminal-theme.js +0 -4
  94. package/client/store/watch.js +26 -4
  95. package/package.json +1 -1
  96. package/client/common/post-msg.js +0 -3
  97. package/client/components/common/native-input.jsx +0 -30
  98. package/client/components/context-menu/context-menu.jsx +0 -339
  99. package/client/components/sftp/file-props-modal.jsx +0 -210
  100. package/client/store/context-menu.js +0 -23
  101. /package/client/components/{context-menu → sys-menu}/boomarks.jsx +0 -0
  102. /package/client/components/{context-menu → sys-menu}/history.jsx +0 -0
  103. /package/client/components/{context-menu → sys-menu}/icon-holder.jsx +0 -0
  104. /package/client/components/{context-menu → sys-menu}/sub-tab-menu.jsx +0 -0
  105. /package/client/components/{context-menu → sys-menu}/tabs.jsx +0 -0
  106. /package/client/components/{context-menu → sys-menu}/zoom.jsx +0 -0
@@ -1,210 +0,0 @@
1
- /**
2
- * file props
3
- */
4
-
5
- import { useState, useEffect } from 'react'
6
- import {
7
- Modal,
8
- Button
9
- } from 'antd'
10
- import {
11
- commonActions,
12
- isWin,
13
- typeMap
14
- } from '../../common/constants'
15
- import resolve from '../../common/resolve'
16
- import { mode2permission } from '../../common/mode2permission'
17
- import time from '../../common/time'
18
- import renderPermission from './permission-render'
19
- import FileIcon from './file-icon'
20
- import fs from '../../common/fs'
21
- import postMsg from '../../common/post-msg'
22
- import { filesize } from 'filesize'
23
- import { runCmd } from '../terminal/terminal-apis'
24
-
25
- const e = window.translate
26
- const formatTime = time
27
-
28
- export default function FileInfoModal () {
29
- const [state, setState] = useState({
30
- loading: false
31
- })
32
- function onClose () {
33
- setState({})
34
- }
35
- function onEvent (e) {
36
- const {
37
- action,
38
- data
39
- } = e.data || {}
40
- if (action === commonActions.showFileInfoModal) {
41
- setState(old => {
42
- return {
43
- ...old,
44
- ...data,
45
- size: 0
46
- }
47
- })
48
- }
49
- }
50
- useEffect(() => {
51
- window.addEventListener('message', onEvent)
52
- }, [])
53
- useEffect(() => {
54
- postMsg({
55
- action: commonActions.updateStore,
56
- value: !!state.visible,
57
- prop: 'showEditor'
58
- })
59
- }, [state.visible])
60
- const {
61
- visible,
62
- file,
63
- tab,
64
- uidTree = {},
65
- gidTree = {},
66
- loading
67
- } = state
68
- if (!visible) {
69
- return null
70
- }
71
- const {
72
- name,
73
- size,
74
- owner,
75
- group,
76
- accessTime,
77
- modifyTime,
78
- isDirectory,
79
- isSymbolicLink,
80
- path,
81
- mode,
82
- type
83
- } = file
84
- const {
85
- host,
86
- port,
87
- username
88
- } = tab
89
- const iconType = isDirectory ? 'folder' : 'file'
90
- const ps = {
91
- open: visible,
92
- width: 500,
93
- title: e(iconType) + ` ${e('attributes')}`,
94
- footer: null,
95
- onCancel: onClose
96
- }
97
- const fp = resolve(path, name)
98
- const ffp = type === typeMap.local
99
- ? fp
100
- : `${username}@${host}:${port}:${fp}`
101
- const perms = mode2permission(mode)
102
- function setLoading (loading) {
103
- setState(old => {
104
- return {
105
- ...old,
106
- loading
107
- }
108
- })
109
- }
110
- function renderSize () {
111
- if (isDirectory) {
112
- return state.size || 0
113
- }
114
- return size
115
- }
116
- function getSize (str = '') {
117
- if (isWin) {
118
- const s = (str.stdout || '').split('\n').find(s => s.trim().startsWith('Sum'))
119
- return s ? filesize(parseInt((s.split(':')[1]).trim(), 10)) : 0
120
- } else {
121
- return str.split(/\s+/)[0]
122
- }
123
- }
124
- async function calcLocal (folder) {
125
- const cmd = isWin
126
- ? `Get-ChildItem -Recurse '${folder}' | Measure-Object -Property Length -Sum`
127
- : `du -sh '${folder}'`
128
- const func = isWin ? 'runWinCmd' : 'run'
129
- const res = await fs[func](cmd).catch(window.store.onError)
130
- return getSize(res)
131
- }
132
- async function calcRemote (folder) {
133
- const cmd = `du -sh '${folder}'`
134
- const r = await runCmd(
135
- state.pid,
136
- state.sessionId,
137
- cmd
138
- ).catch(window.store.onError)
139
- return r ? r.split(/\s+/)[0] : 0
140
- }
141
- async function calc () {
142
- setLoading(true)
143
- const size = type === typeMap.local
144
- ? await calcLocal(fp)
145
- : await calcRemote(fp)
146
- setState(old => {
147
- return {
148
- ...old,
149
- loading: false,
150
- size
151
- }
152
- })
153
- }
154
- function renderCalc () {
155
- if (isDirectory) {
156
- return (
157
- <Button
158
- onClick={calc}
159
- loading={loading}
160
- disabled={loading}
161
- className='mg1l'
162
- >
163
- {e('calculate')}
164
- </Button>
165
- )
166
- }
167
- }
168
- return (
169
- <Modal
170
- {...ps}
171
- >
172
- <div className='file-props-wrap relative'>
173
- <FileIcon
174
- className='file-icon'
175
- file={file}
176
- height={50}
177
- />
178
- <div className='file-props'>
179
- <p className='bold'>{e(iconType)} {e('name')}:</p>
180
- <p className='pd1b'>
181
- {
182
- isSymbolicLink
183
- ? <sup className='color-blue symbolic-link-icon'>*</sup>
184
- : null
185
- }
186
- {name}
187
- </p>
188
- <p className='bold'>{e('fullPath')}:</p>
189
- <p className='pd1b'>{ffp}</p>
190
- <p className='bold'>{e('size')}:</p>
191
- <p className='pd1b'>{renderSize()}{renderCalc()}</p>
192
- <p className='bold'>{e('accessTime')}:</p>
193
- <p className='pd1b'>{formatTime(accessTime)}</p>
194
- <p className='bold'>{e('modifyTime')}:</p>
195
- <p className='pd1b'>{formatTime(modifyTime)}</p>
196
- <p className='bold'>{e('owner')}</p>
197
- <p className='pd1b'>{uidTree['' + owner]}</p>
198
- <p className='bold'>{e('group')}</p>
199
- <p className='pd1b'>{gidTree['' + group]}</p>
200
- <p className='bold'>{e('mode')}:</p>
201
- <div className='pd1b'>
202
- {
203
- perms.map(renderPermission)
204
- }
205
- </div>
206
- </div>
207
- </div>
208
- </Modal>
209
- )
210
- }
@@ -1,23 +0,0 @@
1
- /**
2
- * context menu related functions
3
- */
4
-
5
- import postMessage from '../common/post-msg'
6
- import {
7
- commonActions
8
- } from '../common/constants'
9
-
10
- export default Store => {
11
- Store.prototype.openContextMenu = function (data) {
12
- postMessage({
13
- data,
14
- type: commonActions.openContextMenu
15
- })
16
- }
17
-
18
- Store.prototype.closeContextMenu = function () {
19
- postMessage({
20
- action: commonActions.closeContextMenu
21
- })
22
- }
23
- }