@electerm/electerm-react 1.40.20 → 1.50.31

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/constants.js +57 -7
  2. package/client/common/new-terminal.js +2 -2
  3. package/client/components/auth/login.jsx +34 -57
  4. package/client/components/batch-op/batch-op.jsx +12 -11
  5. package/client/components/bookmark-form/index.jsx +2 -2
  6. package/client/components/bookmark-form/ssh-form.jsx +4 -1
  7. package/client/components/bookmark-form/tree-delete.jsx +5 -5
  8. package/client/components/context-menu/boomarks.jsx +8 -12
  9. package/client/components/context-menu/context-menu.jsx +10 -10
  10. package/client/components/context-menu/history.jsx +21 -24
  11. package/client/components/context-menu/menu-btn.jsx +11 -11
  12. package/client/components/context-menu/tabs.jsx +15 -19
  13. package/client/components/context-menu/zoom.jsx +25 -29
  14. package/client/components/footer/footer-entry.jsx +56 -56
  15. package/client/components/icons/split-icons.jsx +77 -0
  16. package/client/components/layout/layout-alg.js +260 -0
  17. package/client/components/layout/layout-item.jsx +94 -0
  18. package/client/components/layout/layout.jsx +167 -0
  19. package/client/components/layout/layout.styl +8 -0
  20. package/client/components/layout/layouts.jsx +72 -0
  21. package/client/components/layout/session-size-alg.js +31 -0
  22. package/client/components/main/custom-css.jsx +1 -1
  23. package/client/components/main/main.jsx +184 -110
  24. package/client/components/main/ui-theme.jsx +1 -1
  25. package/client/components/main/wrapper.styl +2 -4
  26. package/client/components/profile/profile-list.jsx +1 -3
  27. package/client/components/profile/profile-transport-mod.jsx +1 -1
  28. package/client/components/profile/profile-transport.jsx +6 -9
  29. package/client/components/quick-commands/quick-command-transport.jsx +6 -9
  30. package/client/components/quick-commands/quick-commands-box.jsx +144 -153
  31. package/client/components/quick-commands/quick-commands-select.jsx +10 -3
  32. package/client/components/rdp/rdp-session.jsx +3 -23
  33. package/client/components/rdp/resolution-edit.jsx +40 -42
  34. package/client/components/session/session.jsx +63 -328
  35. package/client/components/session/session.styl +1 -5
  36. package/client/components/session/sessions.jsx +140 -111
  37. package/client/components/setting-panel/bookmark-tree-list.jsx +1 -1
  38. package/client/components/setting-panel/setting-common.jsx +6 -4
  39. package/client/components/setting-panel/setting-modal.jsx +31 -31
  40. package/client/components/setting-panel/start-session-select.jsx +4 -4
  41. package/client/components/setting-panel/tab-settings.jsx +27 -5
  42. package/client/components/setting-sync/data-import.jsx +36 -39
  43. package/client/components/setting-sync/setting-sync-form.jsx +10 -10
  44. package/client/components/setting-sync/setting-sync.jsx +50 -52
  45. package/client/components/sftp/address-bookmark.jsx +57 -58
  46. package/client/components/sftp/confirm-modal-store.jsx +34 -40
  47. package/client/components/sftp/file-item.jsx +14 -3
  48. package/client/components/sftp/file-mode-modal.jsx +3 -0
  49. package/client/components/sftp/list-table-ui.jsx +4 -4
  50. package/client/components/sftp/sftp-entry.jsx +2 -2
  51. package/client/components/sftp/transfer-conflict-store.jsx +13 -17
  52. package/client/components/sftp/transport-action-store.jsx +38 -31
  53. package/client/components/sftp/transports-action-store.jsx +3 -3
  54. package/client/components/sftp/transports-ui-store.jsx +18 -23
  55. package/client/components/shortcuts/shortcut-handler.js +1 -0
  56. package/client/components/shortcuts/shortcuts-defaults.js +5 -5
  57. package/client/components/shortcuts/shortcuts.jsx +9 -12
  58. package/client/components/side-panel-r/right-side-panel.styl +40 -0
  59. package/client/components/side-panel-r/side-panel-r.jsx +102 -0
  60. package/client/components/sidebar/bookmark-select.jsx +40 -40
  61. package/client/components/sidebar/bookmark.jsx +63 -65
  62. package/client/components/sidebar/history.jsx +53 -50
  63. package/client/components/sidebar/index.jsx +195 -184
  64. package/client/components/sidebar/info-modal.jsx +202 -202
  65. package/client/components/sidebar/sidebar.styl +8 -2
  66. package/client/components/sidebar/transfer-history-modal.jsx +95 -100
  67. package/client/components/sidebar/transfer-list-control.jsx +2 -2
  68. package/client/components/sidebar/transfer-list.jsx +45 -42
  69. package/client/components/sidebar/transfer-modal.jsx +49 -52
  70. package/client/components/sidebar/transport-ui.jsx +1 -1
  71. package/client/components/tabs/index.jsx +261 -49
  72. package/client/components/tabs/tab.jsx +48 -66
  73. package/client/components/tabs/tabs.styl +6 -1
  74. package/client/components/tabs/window-control.jsx +46 -48
  75. package/client/components/terminal/attach-addon-custom.js +1 -1
  76. package/client/components/terminal/index.jsx +111 -113
  77. package/client/components/terminal/term-search.jsx +26 -24
  78. package/client/components/terminal-info/run-cmd.jsx +0 -25
  79. package/client/components/terminal-info/terminal-info.jsx +60 -0
  80. package/client/components/terminal-info/terminal-info.styl +1 -1
  81. package/client/components/tree-list/bookmark-transport.jsx +8 -9
  82. package/client/components/tree-list/tree-list.jsx +36 -26
  83. package/client/components/vnc/vnc-session.jsx +1 -6
  84. package/client/components/web/address-bar.jsx +50 -0
  85. package/client/components/web/web-session.jsx +32 -10
  86. package/client/entry/index.jsx +5 -6
  87. package/client/store/common.js +1 -1
  88. package/client/store/db-upgrade.js +1 -1
  89. package/client/store/event.js +2 -2
  90. package/client/store/index.js +21 -32
  91. package/client/store/init-state.js +15 -3
  92. package/client/store/load-data.js +1 -1
  93. package/client/store/quick-command.js +4 -4
  94. package/client/store/session.js +1 -1
  95. package/client/store/setting.js +10 -6
  96. package/client/store/system-menu.js +1 -10
  97. package/client/store/tab.js +91 -1
  98. package/client/store/transfer-list.js +5 -6
  99. package/client/store/watch.js +11 -6
  100. package/package.json +1 -1
  101. package/client/components/common/react-subx.jsx +0 -1
  102. package/client/components/common/resize-wrap.jsx +0 -222
  103. package/client/components/common/resize-wrap.styl +0 -9
  104. package/client/components/terminal-info/content.jsx +0 -152
@@ -1,36 +1,36 @@
1
- import { Component } from '../common/react-subx'
2
- import Session from './session'
1
+ import { Component } from 'react'
2
+ import Session from './session.jsx'
3
3
  import WebSession from '../web/web-session.jsx'
4
4
  import { findIndex, pick } from 'lodash-es'
5
5
  import classNames from 'classnames'
6
- import generate from '../../common/uid'
6
+ import generate from '../../common/id-with-stamp'
7
7
  import copy from 'json-deep-copy'
8
- import wait from '../../common/wait'
9
- import Tabs from '../tabs'
8
+ import wait from '../../common/wait.js'
9
+ import Tabs from '../tabs/index.jsx'
10
10
  import {
11
- commonActions,
12
11
  tabActions,
13
- termInitId,
14
12
  paneMap,
15
13
  statusMap,
16
- terminalWebType
17
- } from '../../common/constants'
18
- import newTerm, { updateCount } from '../../common/new-terminal'
19
- import postMsg from '../../common/post-msg'
20
- import TermSearch from '../terminal/term-search'
21
- import Footer from '../footer/footer-entry'
22
- import QuickCommandsFooterBox from '../quick-commands/quick-commands-box'
23
- import LogoElem from '../common/logo-elem'
14
+ terminalWebType,
15
+ termControlHeight
16
+ } from '../../common/constants.js'
17
+ import newTerm, { updateCount } from '../../common/new-terminal.js'
18
+ import LogoElem from '../common/logo-elem.jsx'
24
19
  import { Button } from 'antd'
25
- import toSimpleObj from '../../common/to-simple-obj'
20
+ import toSimpleObj from '../../common/to-simple-obj.js'
26
21
  import { shortcutExtend } from '../shortcuts/shortcut-handler.js'
22
+ import deepEqual from 'fast-deep-equal'
27
23
 
28
24
  const e = window.translate
29
25
 
30
26
  class Sessions extends Component {
31
- state = {
32
- tabs: [],
33
- currentTabId: ''
27
+ constructor (props) {
28
+ super(props)
29
+ this.state = {
30
+ tabs: copy(props.tabs || []),
31
+ currentTabId: props.currentTabId
32
+ }
33
+ this.bindHandleKeyboardEvent = this.handleKeyboardEvent.bind(this)
34
34
  }
35
35
 
36
36
  componentDidMount () {
@@ -38,11 +38,45 @@ class Sessions extends Component {
38
38
  this.initShortcuts()
39
39
  }
40
40
 
41
+ componentDidUpdate (prevProps) {
42
+ if (
43
+ this.props.tabs &&
44
+ !deepEqual(prevProps.tabs, this.props.tabs)
45
+ ) {
46
+ this.updateTabs(this.props.tabs)
47
+ }
48
+ }
49
+
50
+ componentWillUnmount () {
51
+ window.removeEventListener('message', this.onEvent)
52
+ window.removeEventListener('keydown', this.bindHandleKeyboardEvent)
53
+ this.timer && clearTimeout(this.timer)
54
+ this.timer = null
55
+ }
56
+
57
+ updateTabs = (propTabs) => {
58
+ const update = {
59
+ tabs: copy(propTabs)
60
+ }
61
+ const currentTab = propTabs.find(t => t.id === this.state.currentTabId)
62
+ if (!currentTab) {
63
+ update.currentTabId = propTabs[0]?.id
64
+ }
65
+ this.setState(update)
66
+ }
67
+
41
68
  initShortcuts () {
42
- window.addEventListener('keydown', this.handleKeyboardEvent.bind(this))
69
+ window.addEventListener('keydown', this.bindHandleKeyboardEvent)
70
+ }
71
+
72
+ notCurrentTab = (tab) => {
73
+ return this.state.currentTabId !== window.store.currentTabId
43
74
  }
44
75
 
45
76
  closeCurrentTabShortcut = (e) => {
77
+ if (this.notCurrentTab()) {
78
+ return
79
+ }
46
80
  e.stopPropagation()
47
81
  this.delTab(
48
82
  this.state.currentTabId
@@ -50,30 +84,43 @@ class Sessions extends Component {
50
84
  }
51
85
 
52
86
  reloadCurrentTabShortcut = (e) => {
87
+ if (this.notCurrentTab()) {
88
+ return
89
+ }
53
90
  e.stopPropagation()
54
91
  this.reloadTab(
55
92
  this.getCurrentTab()
56
93
  )
57
94
  }
58
95
 
96
+ cloneToNextLayoutShortcut = (e) => {
97
+ if (this.notCurrentTab()) {
98
+ return
99
+ }
100
+ e.stopPropagation()
101
+ window.store.cloneToNextLayout()
102
+ }
103
+
59
104
  watch = () => {
60
105
  window.addEventListener('message', this.onEvent)
61
106
  }
62
107
 
63
108
  updateStoreTabs = (tabs) => {
64
- postMsg({
65
- action: commonActions.updateStore,
66
- func: 'setTabs',
67
- args: [copy(tabs)]
68
- })
109
+ window.store.updateStoreTabs(tabs, this.props.batch)
69
110
  }
70
111
 
71
112
  updateStoreCurrentTabId = id => {
72
- postMsg({
73
- action: commonActions.updateStore,
74
- value: id,
75
- prop: 'currentTabId'
76
- })
113
+ if (id) {
114
+ window.store.storeAssign({
115
+ currentTabId: id,
116
+ [id + this.props.batch]: id
117
+ })
118
+ this.setState({
119
+ currentTabId: id
120
+ })
121
+ } else {
122
+ document.querySelector('.tab.active').click()
123
+ }
77
124
  }
78
125
 
79
126
  getCurrentTab = () => {
@@ -113,6 +160,7 @@ class Sessions extends Component {
113
160
  } else {
114
161
  updateCount(tab)
115
162
  }
163
+ tab.batch = this.props.batch
116
164
  tabs.splice(index, 0, tab)
117
165
  this.updateStoreTabs(tabs)
118
166
  this.updateStoreCurrentTabId(tab.id)
@@ -134,7 +182,7 @@ class Sessions extends Component {
134
182
  })
135
183
  i = i ? i - 1 : i + 1
136
184
  const next = tabs[i] || {}
137
- up.currentTabId = next.id
185
+ up.currentTabId = next.id || ''
138
186
  this.updateStoreCurrentTabId(next.id)
139
187
  }
140
188
  up.tabs = tabs.filter(t => {
@@ -147,24 +195,13 @@ class Sessions extends Component {
147
195
 
148
196
  initFirstTab = () => {
149
197
  const tab = newTerm()
150
- tab.terminals = [{
151
- id: termInitId,
152
- position: 0
153
- }]
198
+ const { batch } = this.props
199
+ tab.batch = batch
154
200
  this.addTab(tab)
155
201
  }
156
202
 
157
- processTerminals = (tab) => {
158
- if (!tab.terminals) {
159
- return tab
160
- }
161
- tab.terminals = tab.terminals.map(t => {
162
- return {
163
- ...t,
164
- stateId: t.id,
165
- id: generate()
166
- }
167
- })
203
+ handleClick = () => {
204
+ window.store.currentTabId = this.state.currentTabId
168
205
  }
169
206
 
170
207
  reloadTab = async (tabToReload) => {
@@ -173,7 +210,6 @@ class Sessions extends Component {
173
210
  tabToReload
174
211
  )
175
212
  tab.pane = paneMap.terminal
176
- this.processTerminals(tab)
177
213
  const { id } = tab
178
214
  const tabs = copy(oldState.tabs)
179
215
  tab.id = generate()
@@ -185,12 +221,11 @@ class Sessions extends Component {
185
221
  })
186
222
  }
187
223
 
188
- onDuplicateTab = async (tabToDup) => {
189
- this.setState(async oldState => {
224
+ onDuplicateTab = (tabToDup) => {
225
+ this.setState(oldState => {
190
226
  const defaultStatus = statusMap.processing
191
227
  let tab = copy(tabToDup)
192
228
  updateCount(tab)
193
- this.processTerminals(tab)
194
229
  const tabs = copy(oldState.tabs)
195
230
  const index = findIndex(
196
231
  tabs,
@@ -208,6 +243,11 @@ class Sessions extends Component {
208
243
  }
209
244
 
210
245
  onChangeTabId = id => {
246
+ const matchedTab = this.state.tabs.find(t => t.id === id)
247
+ if (!matchedTab) {
248
+ return
249
+ }
250
+ this.timer = setTimeout(window.store.triggerResize, 500)
211
251
  this.updateStoreCurrentTabId(id)
212
252
  this.setState({
213
253
  currentTabId: id
@@ -260,6 +300,7 @@ class Sessions extends Component {
260
300
  update,
261
301
  tab,
262
302
  index,
303
+ batch,
263
304
  tabIds
264
305
  } = e.data || {}
265
306
  if (
@@ -270,7 +311,7 @@ class Sessions extends Component {
270
311
  this.onChangeTabId(currentTabId)
271
312
  } else if (action === tabActions.updateTabs) {
272
313
  this.editTab(id, update)
273
- } else if (action === tabActions.addTab) {
314
+ } else if (action === tabActions.addTab && (batch ?? tab.batch) === this.props.batch) {
274
315
  this.addTab(tab, index)
275
316
  } else if (action === tabActions.initFirstTab) {
276
317
  this.initFirstTab()
@@ -284,21 +325,22 @@ class Sessions extends Component {
284
325
  }
285
326
 
286
327
  postChange = () => {
287
- this.props.store.triggerResize()
328
+ window.store.currentLayoutBatch = this.props.batch
329
+ window.store.triggerResize()
288
330
  }
289
331
 
290
332
  handleNewTab = () => {
291
- this.props.store.initFirstTab()
333
+ this.initFirstTab()
292
334
  }
293
335
 
294
336
  handleNewSsh = () => {
295
- this.props.store.onNewSsh()
337
+ window.store.onNewSsh()
296
338
  }
297
339
 
298
340
  renderNoSession = () => {
299
341
  const props = {
300
342
  style: {
301
- height: this.props.store.height + 'px'
343
+ height: this.props.height + 'px'
302
344
  }
303
345
  }
304
346
  return (
@@ -306,7 +348,7 @@ class Sessions extends Component {
306
348
  <Button
307
349
  onClick={this.handleNewTab}
308
350
  size='large'
309
- className='mg1r mg1b'
351
+ className='mg1r mg1b add-new-tab-btn'
310
352
  >
311
353
  {e('newTab')}
312
354
  </Button>
@@ -324,15 +366,24 @@ class Sessions extends Component {
324
366
  )
325
367
  }
326
368
 
369
+ computeHeight = () => {
370
+ const {
371
+ tabsHeight
372
+ } = this.props
373
+ return this.props.height -
374
+ tabsHeight -
375
+ termControlHeight
376
+ }
377
+
327
378
  renderSessions () {
328
379
  const {
329
- store, config
380
+ config, width, height
330
381
  } = this.props
331
382
  const {
332
383
  currentTabId,
333
384
  tabs
334
385
  } = this.state
335
- if (!tabs.length) {
386
+ if (!tabs || !tabs.length) {
336
387
  return this.renderNoSession()
337
388
  }
338
389
  return tabs.map((tab) => {
@@ -346,19 +397,17 @@ class Sessions extends Component {
346
397
  const sessProps = {
347
398
  currentTabId,
348
399
  tab: toSimpleObj(tab),
349
- ...pick(store, [
400
+ width,
401
+ height,
402
+ ...pick(this.props, [
403
+ 'batch',
350
404
  'resolutions',
351
405
  'hideDelKeyTip',
352
406
  'fileOperation',
353
407
  'file',
354
- 'height',
355
- 'width',
356
- 'activeTerminalId',
357
408
  'pinnedQuickCommandBar',
358
409
  'tabsHeight',
359
410
  'appPath',
360
- 'topMenuHeight',
361
- 'rightSidebarWidth',
362
411
  'leftSidebarWidth',
363
412
  'pinned',
364
413
  'openedSideBar'
@@ -368,6 +417,7 @@ class Sessions extends Component {
368
417
  'onChangeTabId',
369
418
  'onDuplicateTab',
370
419
  'reloadTab',
420
+ 'computeHeight',
371
421
  'delTab',
372
422
  'addTab',
373
423
  'editTab'
@@ -375,7 +425,12 @@ class Sessions extends Component {
375
425
  }
376
426
  if (type === terminalWebType) {
377
427
  const webProps = {
378
- tab
428
+ tab,
429
+ width,
430
+ height: this.computeHeight(),
431
+ ...pick(this, [
432
+ 'reloadTab'
433
+ ])
379
434
  }
380
435
  return (
381
436
  <div className={cls} key={id}>
@@ -397,22 +452,25 @@ class Sessions extends Component {
397
452
 
398
453
  renderTabs = () => {
399
454
  const {
400
- store,
401
- config
455
+ config,
456
+ width,
457
+ height,
458
+ batch,
459
+ layout,
460
+ isMaximized
402
461
  } = this.props
403
462
  const {
404
463
  tabs,
405
464
  currentTabId
406
465
  } = this.state
407
466
  const tabsProps = {
467
+ batch,
408
468
  currentTabId,
409
469
  config,
410
- ...pick(store, [
411
- 'height',
412
- 'width',
413
- 'activeTerminalId',
414
- 'isMaximized'
415
- ]),
470
+ width,
471
+ height,
472
+ layout,
473
+ isMaximized,
416
474
  tabs,
417
475
  ...pick(this, [
418
476
  'setTabs',
@@ -426,29 +484,18 @@ class Sessions extends Component {
426
484
  }
427
485
  return (
428
486
  <Tabs
429
- key='main-tabs'
487
+ key={'main-tabs' + batch}
430
488
  {...tabsProps}
431
489
  />
432
490
  )
433
491
  }
434
492
 
435
493
  renderSessionsWrap = () => {
436
- const { leftSidebarWidth, openedSideBar } = this.props.store
437
- const w = leftSidebarWidth + 42
438
- const ptp = openedSideBar
439
- ? {
440
- className: 'sessions',
441
- style: {
442
- marginLeft: `${w}px`
443
- }
444
- }
445
- : {
446
- className: 'sessions'
447
- }
448
494
  return (
449
495
  <div
450
- {...ptp}
496
+ className='sessions'
451
497
  key='main-sess'
498
+ onClick={this.handleClick}
452
499
  >
453
500
  {this.renderSessions()}
454
501
  </div>
@@ -456,30 +503,12 @@ class Sessions extends Component {
456
503
  }
457
504
 
458
505
  render () {
459
- const { store, config } = this.props
460
- const currentTab = this.getCurrentTab()
461
- const termProps = {
462
- currentTab,
463
- store,
464
- config
465
- }
466
- return [
467
- this.renderTabs(),
468
- this.renderSessionsWrap(),
469
- <TermSearch
470
- key='TermSearch'
471
- {...termProps}
472
- />,
473
- <QuickCommandsFooterBox
474
- key='QuickCommandsFooterBox'
475
- store={store}
476
- />,
477
- <Footer
478
- key='Footer'
479
- store={store}
480
- currentTab={currentTab}
481
- />
482
- ]
506
+ return (
507
+ <div>
508
+ {this.renderTabs()}
509
+ {this.renderSessionsWrap()}
510
+ </div>
511
+ )
483
512
  }
484
513
  }
485
514
 
@@ -5,7 +5,7 @@ export default function BookmarkTreeList (props) {
5
5
  return props.bookmarkSelectMode
6
6
  ? (
7
7
  <BookmarkTreeDelete
8
- store={props.store}
8
+ {...props}
9
9
  />
10
10
  )
11
11
  : (
@@ -493,20 +493,22 @@ export default class SettingCommon extends Component {
493
493
  </div>
494
494
  )
495
495
  }
496
+ const { props } = this
496
497
  const {
497
498
  hotkey,
498
499
  language,
499
500
  theme,
500
501
  customCss
501
- } = this.props.config
502
+ } = props.config
502
503
  const {
503
504
  langs
504
505
  } = this.props.store
505
- const terminalThemes = this.props.store.getSidebarList(settingMap.terminalThemes)
506
+ const terminalThemes = props.store.getSidebarList(settingMap.terminalThemes)
506
507
  const [modifier, key] = hotkey.split('+')
507
508
  const pops = {
508
- onStartSessions: this.props.config.onStartSessions,
509
- store: this.props.store,
509
+ onStartSessions: props.config.onStartSessions,
510
+ bookmarks: props.bookmarks,
511
+ bookmarkGroups: props.bookmarkGroups,
510
512
  onChangeStartSessions: this.onChangeStartSessions
511
513
  }
512
514
  return (
@@ -2,7 +2,7 @@
2
2
  * hisotry/bookmark/setting modal
3
3
  */
4
4
 
5
- import { Component } from '../common/react-subx'
5
+ import { auto } from 'manate/react'
6
6
  import { pick } from 'lodash-es'
7
7
  import { Tabs } from 'antd'
8
8
  import SettingModal from './setting-wrap'
@@ -19,14 +19,13 @@ import TabProfiles from './tab-profiles'
19
19
 
20
20
  const e = window.translate
21
21
 
22
- export default class SettingModalWrap extends Component {
23
- selectItem = (item) => {
24
- const { store } = this.props
25
- store.setSettingItem(item)
22
+ export default auto(function SettingModalWrap (props) {
23
+ const selectItem = (item) => {
24
+ window.store.setSettingItem(item)
26
25
  }
27
26
 
28
- renderTabs () {
29
- const { store } = this.props
27
+ function renderTabs () {
28
+ const { store } = props
30
29
  const tabsShouldConfirmDel = [
31
30
  settingMap.bookmarks,
32
31
  settingMap.terminalThemes
@@ -36,7 +35,7 @@ export default class SettingModalWrap extends Component {
36
35
  store,
37
36
  activeItemId: settingItem.id,
38
37
  type: settingTab,
39
- onClickItem: this.selectItem,
38
+ onClickItem: selectItem,
40
39
  shouldConfirmDel: tabsShouldConfirmDel.includes(settingTab),
41
40
  list: settingSidebarList
42
41
  }
@@ -62,7 +61,10 @@ export default class SettingModalWrap extends Component {
62
61
  ...pick(store, [
63
62
  'currentBookmarkGroupId',
64
63
  'autofocustrigger',
65
- 'config'
64
+ 'config',
65
+ 'checkedKeys',
66
+ 'expandedKeys',
67
+ 'leftSidebarWidth'
66
68
  ])
67
69
  }
68
70
  const items = [
@@ -153,26 +155,24 @@ export default class SettingModalWrap extends Component {
153
155
  )
154
156
  }
155
157
 
156
- render () {
157
- const {
158
- showModal,
159
- hideSettingModal,
160
- innerWidth,
161
- useSystemTitleBar
162
- } = this.props.store
163
- const show = showModal === modals.setting
164
- if (!show) {
165
- return null
166
- }
167
- return (
168
- <SettingModal
169
- onCancel={hideSettingModal}
170
- visible={show}
171
- useSystemTitleBar={useSystemTitleBar}
172
- innerWidth={innerWidth}
173
- >
174
- {this.renderTabs()}
175
- </SettingModal>
176
- )
158
+ const {
159
+ showModal,
160
+ hideSettingModal,
161
+ innerWidth,
162
+ useSystemTitleBar
163
+ } = props.store
164
+ const show = showModal === modals.setting
165
+ if (!show) {
166
+ return null
177
167
  }
178
- }
168
+ return (
169
+ <SettingModal
170
+ onCancel={hideSettingModal}
171
+ visible={show}
172
+ useSystemTitleBar={useSystemTitleBar}
173
+ innerWidth={innerWidth}
174
+ >
175
+ {renderTabs()}
176
+ </SettingModal>
177
+ )
178
+ })
@@ -1,15 +1,15 @@
1
1
  import { TreeSelect } from 'antd'
2
- import { Component } from '../common/react-subx'
2
+ import { PureComponent } from 'react'
3
3
  import copy from 'json-deep-copy'
4
4
  import { createTitleWithTag } from '../../common/create-title'
5
5
 
6
6
  const e = window.translate
7
7
  const { SHOW_CHILD } = TreeSelect
8
8
 
9
- export default class StartSessionSelect extends Component {
9
+ export default class StartSessionSelect extends PureComponent {
10
10
  buildData = () => {
11
- const cats = this.props.store.bookmarkGroups
12
- const tree = this.props.store.bookmarks
11
+ const cats = this.props.bookmarkGroups
12
+ const tree = this.props.bookmarks
13
13
  .reduce((p, k) => {
14
14
  return {
15
15
  ...p,
@@ -1,3 +1,4 @@
1
+ import { auto } from 'manate/react'
1
2
  import SettingCommon from './setting-common'
2
3
  import SettingTerminal from './setting-terminal'
3
4
  import SettingCol from './col'
@@ -10,8 +11,9 @@ import {
10
11
  settingTerminalId,
11
12
  settingShortcutsId
12
13
  } from '../../common/constants'
14
+ import { pick } from 'lodash-es'
13
15
 
14
- export default function TabSettings (props) {
16
+ export default auto(function TabSettings (props) {
15
17
  const {
16
18
  settingTab
17
19
  } = props
@@ -26,14 +28,34 @@ export default function TabSettings (props) {
26
28
  let elem = null
27
29
  const sid = settingItem.id
28
30
  if (sid === settingSyncId) {
29
- elem = <SyncSetting store={store} />
31
+ const syncProps = pick(store, [
32
+ 'config',
33
+ 'autofocustrigger',
34
+ 'isSyncingSetting',
35
+ 'isSyncDownload',
36
+ 'isSyncUpload',
37
+ 'syncType'
38
+ ])
39
+ elem = <SyncSetting {...syncProps} />
30
40
  } else if (sid === settingTerminalId) {
31
41
  elem = <SettingTerminal {...listProps} config={store.config} />
32
42
  } else if (sid === settingShortcutsId) {
33
- elem = <Shortcuts store={store} />
43
+ const shortcutsProps = {
44
+ quickCommands: store.quickCommands,
45
+ config: store.config
46
+ }
47
+ elem = <Shortcuts {...shortcutsProps} />
34
48
  } else {
35
- elem = <SettingCommon {...listProps} config={store.config} />
49
+ elem = (
50
+ <SettingCommon
51
+ {...listProps}
52
+ config={store.config}
53
+ bookmarks={store.bookmarks}
54
+ bookmarkGroups={store.bookmarkGroups}
55
+ />
56
+ )
36
57
  }
58
+
37
59
  return (
38
60
  <div
39
61
  className='setting-tabs-setting'
@@ -46,4 +68,4 @@ export default function TabSettings (props) {
46
68
  </SettingCol>
47
69
  </div>
48
70
  )
49
- }
71
+ })