@electerm/electerm-react 1.60.16 → 1.60.29

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 (104) 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 +6 -15
  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/history.jsx +3 -0
  52. package/client/components/sidebar/index.jsx +1 -1
  53. package/client/components/sidebar/info-modal.jsx +3 -0
  54. package/client/components/sidebar/side-panel.jsx +7 -4
  55. package/client/components/sidebar/sidebar-panel.jsx +1 -1
  56. package/client/components/sidebar/sidebar.styl +3 -3
  57. package/client/components/sys-menu/icons-map.jsx +52 -0
  58. package/client/components/{context-menu → sys-menu}/menu-btn.jsx +33 -45
  59. package/client/components/sys-menu/sys-menu.jsx +163 -0
  60. package/client/components/{context-menu/context-menu.styl → sys-menu/sys-menu.styl} +2 -11
  61. package/client/components/tabs/index.jsx +5 -97
  62. package/client/components/tabs/tab.jsx +121 -73
  63. package/client/components/tabs/tabs.styl +4 -1
  64. package/client/components/terminal/term-search.jsx +16 -28
  65. package/client/components/terminal/terminal-interactive.jsx +0 -2
  66. package/client/components/terminal/{index.jsx → terminal.jsx} +126 -248
  67. package/client/components/terminal-info/base.jsx +21 -46
  68. package/client/components/terminal-info/terminal-info.jsx +3 -0
  69. package/client/components/text-editor/text-editor.jsx +38 -53
  70. package/client/components/theme/theme-form.jsx +0 -2
  71. package/client/components/tree-list/bookmark-toolbar.jsx +23 -47
  72. package/client/components/tree-list/bookmark-transport.jsx +2 -90
  73. package/client/components/tree-list/move-item-modal.jsx +101 -0
  74. package/client/components/tree-list/tree-list-item.jsx +6 -8
  75. package/client/components/tree-list/tree-list.jsx +48 -273
  76. package/client/components/vnc/vnc-session.jsx +5 -3
  77. package/client/store/app-upgrade.js +2 -5
  78. package/client/store/bookmark-group.js +74 -28
  79. package/client/store/common.js +36 -54
  80. package/client/store/event.js +4 -37
  81. package/client/store/init-state.js +9 -12
  82. package/client/store/item.js +34 -39
  83. package/client/store/load-data.js +5 -1
  84. package/client/store/quick-command.js +2 -12
  85. package/client/store/session.js +6 -7
  86. package/client/store/setting.js +3 -7
  87. package/client/store/sidebar.js +2 -8
  88. package/client/store/store.js +0 -20
  89. package/client/store/system-menu.js +1 -2
  90. package/client/store/tab.js +29 -1
  91. package/client/store/terminal-theme.js +0 -4
  92. package/client/store/watch.js +26 -4
  93. package/package.json +1 -1
  94. package/client/common/post-msg.js +0 -3
  95. package/client/components/common/native-input.jsx +0 -30
  96. package/client/components/context-menu/context-menu.jsx +0 -339
  97. package/client/components/sftp/file-props-modal.jsx +0 -210
  98. package/client/store/context-menu.js +0 -23
  99. /package/client/components/{context-menu → sys-menu}/boomarks.jsx +0 -0
  100. /package/client/components/{context-menu → sys-menu}/history.jsx +0 -0
  101. /package/client/components/{context-menu → sys-menu}/icon-holder.jsx +0 -0
  102. /package/client/components/{context-menu → sys-menu}/sub-tab-menu.jsx +0 -0
  103. /package/client/components/{context-menu → sys-menu}/tabs.jsx +0 -0
  104. /package/client/components/{context-menu → sys-menu}/zoom.jsx +0 -0
@@ -2,13 +2,18 @@
2
2
  * file section
3
3
  */
4
4
 
5
- import { Component } from 'react'
5
+ import { Component, createRef } from 'react'
6
+ import { refs } from '../common/ref'
6
7
  import {
7
8
  CloseOutlined,
8
9
  Loading3QuartersOutlined,
9
10
  BorderlessTableOutlined
10
11
  } from '@ant-design/icons'
11
- import { Tooltip, message } from 'antd'
12
+ import {
13
+ Tooltip,
14
+ message,
15
+ Dropdown
16
+ } from 'antd'
12
17
  import classnames from 'classnames'
13
18
  import { pick } from 'lodash-es'
14
19
  import Input from '../common/input-auto-focus'
@@ -16,6 +21,7 @@ import createName from '../../common/create-title'
16
21
  import { addClass, removeClass } from '../../common/class'
17
22
  import isDark from '../../common/is-color-dark'
18
23
  import { action } from 'manate'
24
+ import iconsMap from '../sys-menu/icons-map.jsx'
19
25
  import { shortcutDescExtend } from '../shortcuts/shortcut-handler.js'
20
26
 
21
27
  const e = window.translate
@@ -23,8 +29,15 @@ const onDragCls = 'ondrag-tab'
23
29
  const onDragOverCls = 'dragover-tab'
24
30
 
25
31
  class Tab extends Component {
32
+ state = {
33
+ terminalOnData: false
34
+ }
35
+
36
+ tabRef = createRef()
37
+
26
38
  componentDidMount () {
27
- this.dom = document.getElementById('tab-' + this.props.tab.id)
39
+ this.id = 'tab-' + this.props.tab.id
40
+ refs.add(this.id, this)
28
41
  window.addEventListener('message', this.onEvent)
29
42
  }
30
43
 
@@ -38,7 +51,26 @@ class Tab extends Component {
38
51
  }
39
52
 
40
53
  componentWillUnmount () {
41
- this.dom = null
54
+ refs.remove(this.id)
55
+ clearTimeout(this.timer)
56
+ this.timer = null
57
+ }
58
+
59
+ notifyOnData = () => {
60
+ if (this.timer) {
61
+ clearTimeout(this.timer)
62
+ this.timer = null
63
+ }
64
+ this.setState({
65
+ terminalOnData: true
66
+ })
67
+ this.timer = setTimeout(this.clearTerminalOnData, 4000)
68
+ }
69
+
70
+ clearTerminalOnData = () => {
71
+ this.setState({
72
+ terminalOnData: false
73
+ })
42
74
  }
43
75
 
44
76
  // shouldComponentUpdate (nextProps) {
@@ -74,12 +106,12 @@ class Tab extends Component {
74
106
  }
75
107
 
76
108
  onDrag = () => {
77
- addClass(this.dom, onDragCls)
109
+ addClass(this.tabRef.current, onDragCls)
78
110
  }
79
111
 
80
112
  onDragEnter = () => {
81
113
  this.clearCls()
82
- addClass(this.dom, onDragOverCls)
114
+ addClass(this.tabRef.current, onDragOverCls)
83
115
  }
84
116
 
85
117
  onDragExit = () => {
@@ -97,7 +129,7 @@ class Tab extends Component {
97
129
  onDragOver = e => {
98
130
  // debug('ondragover')
99
131
  // debug(e.target)
100
- // removeClass(this.dom, 'sftp-dragover')
132
+ // removeClass(this.tabRef.current, 'sftp-dragover')
101
133
  e.preventDefault()
102
134
  }
103
135
 
@@ -168,7 +200,7 @@ class Tab extends Component {
168
200
  }
169
201
 
170
202
  onDragEnd = e => {
171
- removeClass(this.dom, onDragCls)
203
+ removeClass(this.tabRef.current, onDragCls)
172
204
  this.clearCls()
173
205
  e && e.dataTransfer && e.dataTransfer.clearData()
174
206
  }
@@ -229,60 +261,64 @@ class Tab extends Component {
229
261
  const len = tabs.length
230
262
  const index = tabIndex
231
263
  const noRight = index >= len - 1
232
- const res = []
233
264
  const reloadShortcut = this.getShortcut('app_reloadCurrentTab')
234
265
  const closeShortcut = this.getShortcut('app_closeCurrentTab')
235
266
  const cloneToNextShortcut = this.getShortcut('app_cloneToNextLayout')
236
- res.push({
237
- func: 'handleClose',
238
- icon: 'CloseOutlined',
239
- text: e('close'),
240
- subText: closeShortcut
241
- })
242
- res.push({
243
- func: 'closeOther',
244
- icon: 'CloseOutlined',
245
- text: e('closeOtherTabs')
246
- })
247
- if (!noRight) {
248
- res.push({
249
- func: 'closeTabsRight',
250
- icon: 'CloseOutlined',
251
- text: e('closeTabRight')
252
- })
253
- }
254
- res.push({
255
- func: 'newTab',
256
- icon: 'CodeOutlined',
257
- text: e('newTab')
258
- })
259
- res.push({
260
- func: 'handleDup',
261
- icon: 'CopyOutlined',
262
- text: e('duplicate')
263
- })
264
- res.push({
265
- func: 'cloneToNextLayout',
266
- icon: 'CopyOutlined',
267
- text: e('cloneToNextLayout'),
268
- subText: cloneToNextShortcut
269
- })
270
- res.push({
271
- func: 'doRename',
272
- icon: 'EditOutlined',
273
- text: e('rename')
274
- })
275
- res.push({
276
- func: 'handleReloadTab',
277
- icon: 'Loading3QuartersOutlined',
278
- text: e('reload'),
279
- subText: reloadShortcut
280
- })
281
- return res
267
+
268
+ const x = [
269
+ {
270
+ key: 'handleClose',
271
+ icon: <iconsMap.CloseCircleOutlined />,
272
+ label: e('close'),
273
+ extra: closeShortcut
274
+ },
275
+ {
276
+ key: 'closeOther',
277
+ icon: <iconsMap.CloseCircleOutlined />,
278
+ label: e('closeOtherTabs')
279
+ },
280
+ !noRight && {
281
+ key: 'closeTabsRight',
282
+ icon: <iconsMap.CloseCircleOutlined />,
283
+ label: e('closeTabRight')
284
+ },
285
+ {
286
+ key: 'newTab',
287
+ icon: <iconsMap.CodeOutlined />,
288
+ label: e('newTab')
289
+ },
290
+ {
291
+ key: 'handleDup',
292
+ icon: <iconsMap.CopyOutlined />,
293
+ label: e('duplicate')
294
+ },
295
+ {
296
+ key: 'cloneToNextLayout',
297
+ icon: <iconsMap.CopyOutlined />,
298
+ label: e('cloneToNextLayout'),
299
+ extra: cloneToNextShortcut
300
+ },
301
+ {
302
+ key: 'doRename',
303
+ icon: <iconsMap.EditOutlined />,
304
+ label: e('rename')
305
+ },
306
+ {
307
+ key: 'handleReloadTab',
308
+ icon: <iconsMap.ReloadOutlined />,
309
+ label: e('reload'),
310
+ extra: reloadShortcut
311
+ }
312
+ ].filter(Boolean)
313
+ return x
314
+ }
315
+
316
+ onContextMenu = ({ key }) => {
317
+ this[key]()
282
318
  }
283
319
 
284
320
  handleContextMenu = () => {
285
- const rect = this.dom.getBoundingClientRect()
321
+ const rect = this.tabRef.current.getBoundingClientRect()
286
322
  const items = this.renderContext()
287
323
  window.store.openContextMenu({
288
324
  items,
@@ -353,7 +389,7 @@ class Tab extends Component {
353
389
  }
354
390
 
355
391
  render () {
356
- const { isLast, terminalOnData, tab, currentBatchTabId } = this.props
392
+ const { isLast, tab, currentBatchTabId } = this.props
357
393
  const {
358
394
  id,
359
395
  isEditting,
@@ -361,6 +397,9 @@ class Tab extends Component {
361
397
  isTransporting,
362
398
  sshTunnelResults
363
399
  } = tab
400
+ const {
401
+ terminalOnData
402
+ } = this.state
364
403
  const active = id === currentBatchTabId
365
404
  const cls = classnames(
366
405
  `tab-${id}`,
@@ -385,6 +424,13 @@ class Tab extends Component {
385
424
  if (isEditting) {
386
425
  return this.renderEditting(tab, cls)
387
426
  }
427
+ const dropdownProps = {
428
+ menu: {
429
+ items: this.renderContext(),
430
+ onClick: this.onContextMenu
431
+ },
432
+ trigger: ['contextMenu']
433
+ }
388
434
  const { tabCount, color = '#0088cc' } = tab
389
435
  const styleTag = color
390
436
  ? {
@@ -400,7 +446,7 @@ class Tab extends Component {
400
446
  <div
401
447
  className={cls}
402
448
  draggable
403
- id={'tab-' + id}
449
+ ref={this.tabRef}
404
450
  data-id={id}
405
451
  {...pick(this, [
406
452
  'onDrag',
@@ -413,21 +459,23 @@ class Tab extends Component {
413
459
  'onDragEnd'
414
460
  ])}
415
461
  >
416
- <div
417
- className='tab-title elli pd1x'
418
- onClick={this.handleClick}
419
- onDoubleClick={this.handleDup}
420
- >
421
- <Loading3QuartersOutlined
422
- className='pointer tab-reload mg1r'
423
- onClick={this.handleReloadTab}
424
- title={e('reload')}
425
- />
426
- <span className='tab-title'>
427
- <span className='iblock mg1r tab-count' style={styleTag}>{tabCount}</span>
428
- <span className='mg1r'>{title}</span>
429
- </span>
430
- </div>
462
+ <Dropdown {...dropdownProps}>
463
+ <div
464
+ className='tab-title elli pd1x'
465
+ onClick={this.handleClick}
466
+ onDoubleClick={this.handleDup}
467
+ >
468
+ <Loading3QuartersOutlined
469
+ className='pointer tab-reload mg1r'
470
+ onClick={this.handleReloadTab}
471
+ title={e('reload')}
472
+ />
473
+ <span className='tab-title'>
474
+ <span className='iblock mg1r tab-count' style={styleTag}>{tabCount}</span>
475
+ <span className='mg1r'>{title}</span>
476
+ </span>
477
+ </div>
478
+ </Dropdown>
431
479
  <div className={'tab-status ' + status} />
432
480
  <div className='tab-traffic' />
433
481
  <BorderlessTableOutlined className='tab-terminal-feed' />
@@ -225,7 +225,7 @@
225
225
  bottom 0
226
226
  z-index 11
227
227
  .tab-count
228
- border-radius 10px 2px 2px 2px
228
+ border-radius 10px 2px 2px 10px
229
229
  padding 0 4px
230
230
  height 20px
231
231
  line-height 21px
@@ -235,3 +235,6 @@
235
235
  bottom 80px
236
236
  left 0
237
237
  right 0
238
+ .sidebar-panel-history .pd2x
239
+ width 400px
240
+ margin 0 auto
@@ -8,19 +8,18 @@ import {
8
8
  ArrowRightOutlined,
9
9
  CloseCircleOutlined
10
10
  } from '@ant-design/icons'
11
- import { paneMap, terminalActions } from '../../common/constants'
12
- import postMessage from '../../common/post-msg'
11
+ import { paneMap } from '../../common/constants'
13
12
  import { MatchCaseIcon } from '../icons/match-case'
14
13
  import { MatchWholWordIcon } from '../icons/match-whole-word'
15
14
  import { RegularExpIcon } from '../icons/regular-exp'
16
15
  import classNames from 'classnames'
17
16
  import copy from 'json-deep-copy'
18
- import { shortcutExtend } from '../shortcuts/shortcut-handler.js'
17
+ import { refsStatic, refs } from '../common/ref'
19
18
  import './term-search.styl'
20
19
 
21
20
  const e = window.translate
22
21
 
23
- class TermSearch extends PureComponent {
22
+ export default class TermSearch extends PureComponent {
24
23
  searchControls = [{
25
24
  id: 'matchCase',
26
25
  icon: MatchCaseIcon,
@@ -50,7 +49,7 @@ class TermSearch extends PureComponent {
50
49
  }]
51
50
 
52
51
  componentDidMount () {
53
- window.addEventListener('keydown', this.handleKeyboardEvent.bind(this))
52
+ refsStatic.add('term-search', this)
54
53
  }
55
54
 
56
55
  toggleSearch = () => {
@@ -61,32 +60,25 @@ class TermSearch extends PureComponent {
61
60
  setTimeout(window.store.focus, 200)
62
61
  }
63
62
 
64
- searchShortcut = (e) => {
65
- e.stopPropagation()
66
- this.toggleSearch()
67
- }
68
-
69
63
  prev = () => {
70
64
  const {
71
65
  activeTabId,
72
66
  termSearch,
73
67
  termSearchOptions
74
68
  } = this.props
75
- postMessage({
76
- action: terminalActions.doSearchPrev,
77
- keyword: termSearch,
78
- activeTabId,
79
- options: copy(termSearchOptions)
80
- })
69
+ refs.get('term-' + activeTabId)
70
+ ?.searchPrev(
71
+ termSearch,
72
+ copy(termSearchOptions)
73
+ )
81
74
  }
82
75
 
83
76
  next = () => {
84
- postMessage({
85
- action: terminalActions.doSearchNext,
86
- activeTabId: this.props.activeTabId,
87
- keyword: this.props.termSearch,
88
- options: copy(this.props.termSearchOptions)
89
- })
77
+ refs.get('term-' + this.props.activeTabId)
78
+ ?.searchNext(
79
+ this.props.termSearch,
80
+ copy(this.props.termSearchOptions)
81
+ )
90
82
  }
91
83
 
92
84
  handleChange = e => {
@@ -95,10 +87,8 @@ class TermSearch extends PureComponent {
95
87
  }
96
88
 
97
89
  clearSearch = () => {
98
- postMessage({
99
- action: terminalActions.clearSearch,
100
- activeTabId: this.props.activeTabId
101
- })
90
+ refs.get('term-' + this.props.activeTabId)
91
+ ?.searchAddon.clearDecorations()
102
92
  }
103
93
 
104
94
  close = () => {
@@ -222,5 +212,3 @@ class TermSearch extends PureComponent {
222
212
  )
223
213
  }
224
214
  }
225
-
226
- export default shortcutExtend(TermSearch)
@@ -11,7 +11,6 @@ const e = window.translate
11
11
  const FormItem = Form.Item
12
12
 
13
13
  export default function TermInteractive () {
14
- const [trigger] = useState(0)
15
14
  const [opts, setter] = useState(null)
16
15
  const [form] = Form.useForm()
17
16
  function updateTab (data) {
@@ -84,7 +83,6 @@ export default function TermInteractive () {
84
83
  <FormItem noStyle name={'item' + i}>
85
84
  <InputAutoFocus
86
85
  type={type}
87
- autofocustrigger={trigger}
88
86
  placeholder={note}
89
87
  />
90
88
  </FormItem>