@electerm/electerm-react 1.34.30

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 (273) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +31 -0
  3. package/client/common/auto-complete-data-mapper.js +6 -0
  4. package/client/common/byte-format.js +14 -0
  5. package/client/common/class.js +52 -0
  6. package/client/common/clipboard.js +49 -0
  7. package/client/common/constants.js +308 -0
  8. package/client/common/create-lang-edit-link.js +7 -0
  9. package/client/common/create-title.js +29 -0
  10. package/client/common/db-fix.js +24 -0
  11. package/client/common/db.js +155 -0
  12. package/client/common/download-mirrors.js +10 -0
  13. package/client/common/download.js +16 -0
  14. package/client/common/error-handler.jsx +27 -0
  15. package/client/common/fetch-from-server.js +47 -0
  16. package/client/common/fetch.jsx +71 -0
  17. package/client/common/find-bookmark-group-id.js +15 -0
  18. package/client/common/find-parent.js +30 -0
  19. package/client/common/form-layout.js +27 -0
  20. package/client/common/fs.js +21 -0
  21. package/client/common/get-proxy.js +8 -0
  22. package/client/common/id-with-stamp.js +10 -0
  23. package/client/common/index-sorter.js +4 -0
  24. package/client/common/init-setting-item.js +32 -0
  25. package/client/common/is-absolute-path.js +3 -0
  26. package/client/common/is-ip.js +16 -0
  27. package/client/common/is-valid-path.js +7 -0
  28. package/client/common/key-control-pressed.js +13 -0
  29. package/client/common/key-pressed.js +13 -0
  30. package/client/common/key-shift-pressed.js +7 -0
  31. package/client/common/mode2permission.js +81 -0
  32. package/client/common/new-terminal.js +31 -0
  33. package/client/common/parse-int10.js +3 -0
  34. package/client/common/parse-json-safe.js +11 -0
  35. package/client/common/pass-enc.js +25 -0
  36. package/client/common/post-msg.js +3 -0
  37. package/client/common/pre.js +156 -0
  38. package/client/common/promise-timeout.js +27 -0
  39. package/client/common/resolve.js +31 -0
  40. package/client/common/run-idle.js +1 -0
  41. package/client/common/safe-local-storage.js +35 -0
  42. package/client/common/safe-name.js +19 -0
  43. package/client/common/sftp.js +74 -0
  44. package/client/common/terminal-theme.js +158 -0
  45. package/client/common/test-connection.js +12 -0
  46. package/client/common/time.js +30 -0
  47. package/client/common/to-simple-obj.js +5 -0
  48. package/client/common/track.js +7 -0
  49. package/client/common/transfer.js +76 -0
  50. package/client/common/trzsz.js +62 -0
  51. package/client/common/ui-theme.js +44 -0
  52. package/client/common/uid.js +5 -0
  53. package/client/common/update-check.js +79 -0
  54. package/client/common/upgrade.js +68 -0
  55. package/client/common/wait.js +8 -0
  56. package/client/common/ws.js +161 -0
  57. package/client/components/batch-op/batch-op.jsx +650 -0
  58. package/client/components/bookmark-form/bookmark-form.styl +8 -0
  59. package/client/components/bookmark-form/bookmark-group-tree-format.js +39 -0
  60. package/client/components/bookmark-form/encodes.js +44 -0
  61. package/client/components/bookmark-form/form-ssh-common.jsx +208 -0
  62. package/client/components/bookmark-form/form-tabs.jsx +69 -0
  63. package/client/components/bookmark-form/index.jsx +159 -0
  64. package/client/components/bookmark-form/local-form-ui.jsx +152 -0
  65. package/client/components/bookmark-form/local-form.jsx +16 -0
  66. package/client/components/bookmark-form/proxy.jsx +49 -0
  67. package/client/components/bookmark-form/quick-command-list.jsx +31 -0
  68. package/client/components/bookmark-form/quick-command.jsx +228 -0
  69. package/client/components/bookmark-form/render-auth-ssh.jsx +104 -0
  70. package/client/components/bookmark-form/render-connection-hopping.jsx +229 -0
  71. package/client/components/bookmark-form/render-delayed-scripts.jsx +88 -0
  72. package/client/components/bookmark-form/render-ssh-tunnel.jsx +116 -0
  73. package/client/components/bookmark-form/serial-form-ui.jsx +311 -0
  74. package/client/components/bookmark-form/serial-form.jsx +20 -0
  75. package/client/components/bookmark-form/sftp-enable.jsx +33 -0
  76. package/client/components/bookmark-form/ssh-form-ui.jsx +100 -0
  77. package/client/components/bookmark-form/ssh-form.jsx +348 -0
  78. package/client/components/bookmark-form/telnet-form-ui.jsx +154 -0
  79. package/client/components/bookmark-form/telnet-form.jsx +16 -0
  80. package/client/components/bookmark-form/tree-delete.jsx +87 -0
  81. package/client/components/bookmark-form/use-form-funcs.jsx +50 -0
  82. package/client/components/bookmark-form/use-quick-commands.jsx +83 -0
  83. package/client/components/bookmark-form/use-submit.jsx +77 -0
  84. package/client/components/bookmark-form/use-ui.jsx +82 -0
  85. package/client/components/bookmark-form/x11.jsx +23 -0
  86. package/client/components/common/animate-text.jsx +37 -0
  87. package/client/components/common/animate-text.styl +54 -0
  88. package/client/components/common/external-link.jsx +28 -0
  89. package/client/components/common/help-icon.jsx +25 -0
  90. package/client/components/common/highlight.jsx +23 -0
  91. package/client/components/common/highlight.styl +3 -0
  92. package/client/components/common/input-auto-focus.jsx +68 -0
  93. package/client/components/common/input-confirm.jsx +66 -0
  94. package/client/components/common/logo-elem.jsx +22 -0
  95. package/client/components/common/markdown.jsx +27 -0
  96. package/client/components/common/react-subx.jsx +1 -0
  97. package/client/components/common/resize-wrap.jsx +222 -0
  98. package/client/components/common/resize-wrap.styl +9 -0
  99. package/client/components/common/search.jsx +9 -0
  100. package/client/components/common/show-item.jsx +27 -0
  101. package/client/components/context-menu/boomarks.jsx +15 -0
  102. package/client/components/context-menu/context-menu.jsx +340 -0
  103. package/client/components/context-menu/context-menu.styl +90 -0
  104. package/client/components/context-menu/history.jsx +27 -0
  105. package/client/components/context-menu/icon-holder.jsx +5 -0
  106. package/client/components/context-menu/menu-btn.jsx +224 -0
  107. package/client/components/context-menu/sub-tab-menu.jsx +23 -0
  108. package/client/components/context-menu/tabs.jsx +22 -0
  109. package/client/components/context-menu/zoom.jsx +40 -0
  110. package/client/components/footer/batch-input.jsx +177 -0
  111. package/client/components/footer/footer-entry.jsx +141 -0
  112. package/client/components/footer/footer.styl +47 -0
  113. package/client/components/icons/match-case.jsx +10 -0
  114. package/client/components/icons/match-whole-word.jsx +13 -0
  115. package/client/components/icons/regular-exp.jsx +10 -0
  116. package/client/components/main/css-overwrite.jsx +92 -0
  117. package/client/components/main/error-wrapper.jsx +59 -0
  118. package/client/components/main/index.jsx +11 -0
  119. package/client/components/main/loading.jsx +25 -0
  120. package/client/components/main/main.jsx +149 -0
  121. package/client/components/main/term-fullscreen-control.jsx +21 -0
  122. package/client/components/main/term-fullscreen.styl +27 -0
  123. package/client/components/main/ui-theme.jsx +31 -0
  124. package/client/components/main/upgrade.jsx +351 -0
  125. package/client/components/main/upgrade.styl +27 -0
  126. package/client/components/main/wrapper.styl +41 -0
  127. package/client/components/quick-commands/qm.styl +29 -0
  128. package/client/components/quick-commands/quick-command-item.jsx +36 -0
  129. package/client/components/quick-commands/quick-command-transport-mod.jsx +54 -0
  130. package/client/components/quick-commands/quick-command-transport.jsx +12 -0
  131. package/client/components/quick-commands/quick-commands-box.jsx +233 -0
  132. package/client/components/quick-commands/quick-commands-form-elem.jsx +119 -0
  133. package/client/components/quick-commands/quick-commands-form.jsx +33 -0
  134. package/client/components/quick-commands/quick-commands-list.jsx +128 -0
  135. package/client/components/quick-commands/quick-commands-select.jsx +38 -0
  136. package/client/components/session/session.jsx +533 -0
  137. package/client/components/session/session.styl +53 -0
  138. package/client/components/session/sessions.jsx +445 -0
  139. package/client/components/setting-panel/bookmark-transport.jsx +148 -0
  140. package/client/components/setting-panel/bookmark-tree-list.jsx +14 -0
  141. package/client/components/setting-panel/col.jsx +18 -0
  142. package/client/components/setting-panel/list.jsx +186 -0
  143. package/client/components/setting-panel/list.styl +33 -0
  144. package/client/components/setting-panel/on-tree-drop.js +222 -0
  145. package/client/components/setting-panel/setting-modal.jsx +163 -0
  146. package/client/components/setting-panel/setting-wrap.jsx +37 -0
  147. package/client/components/setting-panel/setting-wrap.styl +52 -0
  148. package/client/components/setting-panel/setting.jsx +858 -0
  149. package/client/components/setting-panel/setting.styl +4 -0
  150. package/client/components/setting-panel/start-session-select.jsx +91 -0
  151. package/client/components/setting-panel/tab-bookmarks.jsx +37 -0
  152. package/client/components/setting-panel/tab-history.jsx +44 -0
  153. package/client/components/setting-panel/tab-quick-commands.jsx +38 -0
  154. package/client/components/setting-panel/tab-settings.jsx +42 -0
  155. package/client/components/setting-panel/tab-themes.jsx +34 -0
  156. package/client/components/setting-panel/tree-list.jsx +978 -0
  157. package/client/components/setting-panel/tree-list.styl +57 -0
  158. package/client/components/setting-sync/data-import.jsx +65 -0
  159. package/client/components/setting-sync/setting-sync-form.jsx +271 -0
  160. package/client/components/setting-sync/setting-sync.jsx +81 -0
  161. package/client/components/setting-sync/sync.styl +7 -0
  162. package/client/components/sftp/address-bar.jsx +139 -0
  163. package/client/components/sftp/address-bookmark-item.jsx +47 -0
  164. package/client/components/sftp/address-bookmark.jsx +81 -0
  165. package/client/components/sftp/address-bookmark.styl +8 -0
  166. package/client/components/sftp/confirm-modal.jsx +184 -0
  167. package/client/components/sftp/file-icon.jsx +22 -0
  168. package/client/components/sftp/file-item.jsx +1226 -0
  169. package/client/components/sftp/file-mode-modal.jsx +205 -0
  170. package/client/components/sftp/file-props-modal.jsx +211 -0
  171. package/client/components/sftp/file-read.js +81 -0
  172. package/client/components/sftp/list-table-ui.jsx +547 -0
  173. package/client/components/sftp/owner-list.js +97 -0
  174. package/client/components/sftp/paged-list.jsx +60 -0
  175. package/client/components/sftp/permission-render.jsx +42 -0
  176. package/client/components/sftp/sftp-entry.jsx +1069 -0
  177. package/client/components/sftp/sftp.styl +217 -0
  178. package/client/components/sftp/transfer-common.js +9 -0
  179. package/client/components/sftp/transfer-conflict.jsx +315 -0
  180. package/client/components/sftp/transfer-speed-format.js +60 -0
  181. package/client/components/sftp/transfer-tag.jsx +40 -0
  182. package/client/components/sftp/transfer-tag.styl +11 -0
  183. package/client/components/sftp/transfer.styl +55 -0
  184. package/client/components/sftp/transport-action.jsx +410 -0
  185. package/client/components/sftp/transport-entry.jsx +108 -0
  186. package/client/components/sftp/transport-types.js +8 -0
  187. package/client/components/sftp/transports-action.jsx +111 -0
  188. package/client/components/sftp/transports-ui.jsx +93 -0
  189. package/client/components/sftp/zip.js +42 -0
  190. package/client/components/sidebar/bookmark-select.jsx +48 -0
  191. package/client/components/sidebar/bookmark.jsx +82 -0
  192. package/client/components/sidebar/history.jsx +66 -0
  193. package/client/components/sidebar/index.jsx +230 -0
  194. package/client/components/sidebar/info-modal.jsx +250 -0
  195. package/client/components/sidebar/info.styl +27 -0
  196. package/client/components/sidebar/side-icon.jsx +25 -0
  197. package/client/components/sidebar/sidebar.styl +128 -0
  198. package/client/components/sidebar/transfer-history-modal.jsx +110 -0
  199. package/client/components/sidebar/transfer-history.styl +3 -0
  200. package/client/components/sidebar/transfer-list-control.jsx +205 -0
  201. package/client/components/sidebar/transfer-list.jsx +55 -0
  202. package/client/components/sidebar/transfer-modal.jsx +76 -0
  203. package/client/components/sidebar/transfer.styl +8 -0
  204. package/client/components/sidebar/transport-ui.jsx +109 -0
  205. package/client/components/tabs/index.jsx +320 -0
  206. package/client/components/tabs/tab.jsx +427 -0
  207. package/client/components/tabs/tabs.styl +220 -0
  208. package/client/components/tabs/window-control.jsx +55 -0
  209. package/client/components/terminal/attach-addon-custom.js +70 -0
  210. package/client/components/terminal/build-ls-term-id.js +5 -0
  211. package/client/components/terminal/index.jsx +1358 -0
  212. package/client/components/terminal/normal-buffer.jsx +33 -0
  213. package/client/components/terminal/term-search.jsx +224 -0
  214. package/client/components/terminal/term-search.styl +15 -0
  215. package/client/components/terminal/terminal-apis.js +31 -0
  216. package/client/components/terminal/terminal-interactive.jsx +148 -0
  217. package/client/components/terminal/terminal.styl +96 -0
  218. package/client/components/terminal/xterm-zmodem.js +48 -0
  219. package/client/components/terminal/zmodem-transfer.jsx +98 -0
  220. package/client/components/terminal/zmodem.styl +14 -0
  221. package/client/components/terminal-info/activity.jsx +54 -0
  222. package/client/components/terminal-info/base.jsx +25 -0
  223. package/client/components/terminal-info/content.jsx +101 -0
  224. package/client/components/terminal-info/data-cols-parser.jsx +50 -0
  225. package/client/components/terminal-info/disk.jsx +29 -0
  226. package/client/components/terminal-info/index.jsx +25 -0
  227. package/client/components/terminal-info/network.jsx +114 -0
  228. package/client/components/terminal-info/resource.jsx +80 -0
  229. package/client/components/terminal-info/run-cmd.jsx +273 -0
  230. package/client/components/terminal-info/terminal-info.styl +29 -0
  231. package/client/components/terminal-info/up.jsx +15 -0
  232. package/client/components/terminal-theme/index.jsx +264 -0
  233. package/client/components/terminal-theme/terminal-theme-list.styl +3 -0
  234. package/client/components/terminal-theme/theme-list.jsx +146 -0
  235. package/client/components/text-editor/text-editor-form.jsx +97 -0
  236. package/client/components/text-editor/text-editor.jsx +182 -0
  237. package/client/css/antd-overwrite.styl +14 -0
  238. package/client/css/basic.styl +38 -0
  239. package/client/css/includes/box.styl +154 -0
  240. package/client/css/includes/font-size.styl +6 -0
  241. package/client/css/includes/index.styl +3 -0
  242. package/client/css/includes/text.styl +31 -0
  243. package/client/css/includes/theme-default.styl +20 -0
  244. package/client/entry/basic.js +58 -0
  245. package/client/entry/index.jsx +15 -0
  246. package/client/entry/worker.js +137 -0
  247. package/client/store/address-bookmark.js +25 -0
  248. package/client/store/app-upgrade.js +23 -0
  249. package/client/store/batch-input-history.js +26 -0
  250. package/client/store/bookmark-group.js +128 -0
  251. package/client/store/bookmark.js +22 -0
  252. package/client/store/common.js +140 -0
  253. package/client/store/context-menu.js +23 -0
  254. package/client/store/db-upgrade.js +43 -0
  255. package/client/store/event.js +70 -0
  256. package/client/store/index.js +335 -0
  257. package/client/store/init-state.js +191 -0
  258. package/client/store/item.js +120 -0
  259. package/client/store/load-data.js +198 -0
  260. package/client/store/quick-command.js +43 -0
  261. package/client/store/session.js +54 -0
  262. package/client/store/setting.js +208 -0
  263. package/client/store/sidebar.js +48 -0
  264. package/client/store/sync.js +390 -0
  265. package/client/store/system-menu.js +120 -0
  266. package/client/store/tab.js +74 -0
  267. package/client/store/terminal-theme.js +116 -0
  268. package/client/store/transfer-history.js +27 -0
  269. package/client/store/transfer-list.js +20 -0
  270. package/client/store/ui-theme.js +71 -0
  271. package/client/store/watch.js +116 -0
  272. package/client/views/index.pug +58 -0
  273. package/package.json +34 -0
@@ -0,0 +1,27 @@
1
+ import { Component } from '../common/react-subx'
2
+ import createTitle from '../../common/create-title'
3
+
4
+ export default class HistorySubMenu extends Component {
5
+ render () {
6
+ const { store } = this.props
7
+ return (
8
+ <div className='sub-context-menu'>
9
+ {
10
+ store.history.map(item => {
11
+ const title = createTitle(item)
12
+ return (
13
+ <div
14
+ className='sub-context-menu-item'
15
+ title={title}
16
+ key={item.id}
17
+ onClick={() => store.onSelectHistory(item.id)}
18
+ >
19
+ {title}
20
+ </div>
21
+ )
22
+ })
23
+ }
24
+ </div>
25
+ )
26
+ }
27
+ }
@@ -0,0 +1,5 @@
1
+ export default function IconHolder () {
2
+ return (
3
+ <span className='icon-holder mg1r' />
4
+ )
5
+ }
@@ -0,0 +1,224 @@
1
+ /**
2
+ * btns
3
+ */
4
+
5
+ import { Component } from '../common/react-subx'
6
+ import logoRef from '@electerm/electerm-resource/res/imgs/electerm.svg'
7
+ import { commonActions, ctrlOrCmd } from '../../common/constants'
8
+ import generate from '../../common/uid'
9
+
10
+ const { prefix } = window
11
+ const e = prefix('control')
12
+ const m = prefix('menu')
13
+ const c = prefix('common')
14
+ const t = prefix('tabs')
15
+ const s = prefix('setting')
16
+ const logo = logoRef.replace(/^\//, '')
17
+
18
+ export default class MenuBtn extends Component {
19
+ state = {
20
+ opened: false
21
+ }
22
+
23
+ onContextAction = e => {
24
+ const {
25
+ action,
26
+ id,
27
+ args = [],
28
+ func
29
+ } = e.data || {}
30
+ if (
31
+ action !== commonActions.clickContextMenu ||
32
+ id !== this.uid ||
33
+ !this[func]
34
+ ) {
35
+ return false
36
+ }
37
+ window.removeEventListener('message', this.onContextAction)
38
+ this[func](...args)
39
+ }
40
+
41
+ openMenu = () => {
42
+ const items = this.renderContext()
43
+ this.uid = generate()
44
+ this.props.store.openContextMenu({
45
+ items,
46
+ pos: {
47
+ left: 40,
48
+ top: 10
49
+ },
50
+ id: this.uid
51
+ })
52
+ window.addEventListener('message', this.onContextAction)
53
+ this.setState({
54
+ opened: true
55
+ })
56
+ }
57
+
58
+ onNewSsh = () => {
59
+ this.props.store.onNewSsh()
60
+ }
61
+
62
+ addTab = () => {
63
+ this.props.store.addTab()
64
+ }
65
+
66
+ onNewWindow = () => {
67
+ this.props.store.onNewWindow()
68
+ }
69
+
70
+ openAbout = () => {
71
+ this.props.store.openAbout()
72
+ }
73
+
74
+ openSetting = () => {
75
+ this.props.store.openSetting()
76
+ }
77
+
78
+ openDevTools = () => {
79
+ window.pre.runGlobalAsync('openDevTools')
80
+ }
81
+
82
+ minimize = () => {
83
+ window.pre.runGlobalAsync('minimize')
84
+ }
85
+
86
+ maximize = () => {
87
+ window.pre.runGlobalAsync('maximize')
88
+ }
89
+
90
+ reload = () => {
91
+ window.location.reload()
92
+ }
93
+
94
+ onCheckUpdate = () => {
95
+ this.props.store.onCheckUpdate()
96
+ }
97
+
98
+ restart = () => {
99
+ this.props.store.restart()
100
+ }
101
+
102
+ close = () => {
103
+ this.props.store.exit()
104
+ }
105
+
106
+ renderContext = () => {
107
+ return [
108
+ {
109
+ func: 'onNewSsh',
110
+ icon: 'CodeFilled',
111
+ text: e('newBookmark'),
112
+ subText: `${ctrlOrCmd}+N`
113
+ },
114
+ {
115
+ func: 'addTab',
116
+ icon: 'RightSquareFilled',
117
+ text: t('newTab')
118
+ },
119
+ {
120
+ func: 'onNewWindow',
121
+ icon: 'WindowsOutlined',
122
+ text: e('newWindow')
123
+ },
124
+ // {
125
+ // type: 'hr'
126
+ // },
127
+ {
128
+ noCloseMenu: true,
129
+ icon: 'BookOutlined',
130
+ text: c('bookmarks'),
131
+ submenu: 'Bookmark'
132
+ },
133
+ {
134
+ noCloseMenu: true,
135
+ icon: 'ClockCircleOutlined',
136
+ text: c('history'),
137
+ submenu: 'History'
138
+ },
139
+ {
140
+ noCloseMenu: true,
141
+ icon: 'BarsOutlined',
142
+ text: t('sessions'),
143
+ submenu: 'Tabs'
144
+ },
145
+ // {
146
+ // type: 'hr'
147
+ // },
148
+ {
149
+ func: 'openAbout',
150
+ icon: 'InfoCircleOutlined',
151
+ text: m('about')
152
+ },
153
+ {
154
+ func: 'openSetting',
155
+ icon: 'SettingOutlined',
156
+ text: s('settings')
157
+ },
158
+ {
159
+ func: 'openDevTools',
160
+ icon: 'LeftSquareFilled',
161
+ text: m('toggledevtools')
162
+ },
163
+ // {
164
+ // type: 'hr'
165
+ // },
166
+ {
167
+ module: 'Zoom'
168
+ },
169
+ {
170
+ func: 'minimize',
171
+ icon: 'SwitcherFilled',
172
+ text: m('minimize')
173
+ },
174
+ {
175
+ func: 'maximize',
176
+ icon: 'LayoutFilled',
177
+ text: m('maximize')
178
+ },
179
+ {
180
+ func: 'reload',
181
+ icon: 'ReloadOutlined',
182
+ text: m('reload')
183
+ },
184
+ // {
185
+ // type: 'hr'
186
+ // },
187
+ {
188
+ func: 'onCheckUpdate',
189
+ icon: 'UpCircleOutlined',
190
+ text: e('checkForUpdate')
191
+ },
192
+ // {
193
+ // type: 'hr'
194
+ // },
195
+ {
196
+ func: 'restart',
197
+ icon: 'RedoOutlined',
198
+ text: m('restart')
199
+ },
200
+ {
201
+ func: 'close',
202
+ icon: 'CloseOutlined',
203
+ text: m('close')
204
+ }
205
+ ]
206
+ }
207
+
208
+ render () {
209
+ const pops = {
210
+ className: 'menu-control',
211
+ onMouseDown: evt => evt.preventDefault(),
212
+ onClick: this.openMenu,
213
+ title: e('menu')
214
+ }
215
+ return (
216
+ <div
217
+ key='menu-control'
218
+ {...pops}
219
+ >
220
+ <img src={logo} width={28} height={28} />
221
+ </div>
222
+ )
223
+ }
224
+ }
@@ -0,0 +1,23 @@
1
+ import { PureComponent } from 'react'
2
+ import createTitle from '../../common/create-title'
3
+
4
+ export default class TabsSubMenuChild extends PureComponent {
5
+ handleClick = () => {
6
+ window.store.onChangeTabId(this.props.item.id)
7
+ }
8
+
9
+ render () {
10
+ const { item } = this.props
11
+ const title = createTitle(item)
12
+ return (
13
+ <div
14
+ className='sub-context-menu-item'
15
+ title={title}
16
+ key={item.id}
17
+ onClick={this.handleClick}
18
+ >
19
+ {title}
20
+ </div>
21
+ )
22
+ }
23
+ }
@@ -0,0 +1,22 @@
1
+ import { Component } from '../common/react-subx'
2
+ import TabsSubMenuChild from './sub-tab-menu'
3
+
4
+ export default class TabsSubMenu extends Component {
5
+ render () {
6
+ const { store } = this.props
7
+ return (
8
+ <div className='sub-context-menu'>
9
+ {
10
+ store.getTabs().map(item => {
11
+ return (
12
+ <TabsSubMenuChild
13
+ key={item.id}
14
+ item={item}
15
+ />
16
+ )
17
+ })
18
+ }
19
+ </div>
20
+ )
21
+ }
22
+ }
@@ -0,0 +1,40 @@
1
+ import { Component } from '../common/react-subx'
2
+ import InputNumberConfirm from '../common/input-confirm'
3
+
4
+ import {
5
+ MinusCircleOutlined,
6
+ PlusCircleOutlined
7
+ } from '@ant-design/icons'
8
+
9
+ export default class ZoomMenu extends Component {
10
+ handleChange = (v) => {
11
+ const { store } = this.props
12
+ store.zoom(v / 100)
13
+ }
14
+
15
+ render () {
16
+ const { store } = this.props
17
+ return (
18
+ <InputNumberConfirm
19
+ value={parseInt(store.config.zoom * 100, 10)}
20
+ onChange={this.handleChange}
21
+ step={1}
22
+ min={25}
23
+ max={500}
24
+ addonAfter='%'
25
+ addonBefore={
26
+ <div>
27
+ <PlusCircleOutlined
28
+ onClick={() => store.zoom(0.25, true)}
29
+ className='mg1r pointer font16'
30
+ />
31
+ <MinusCircleOutlined
32
+ onClick={() => store.zoom(-0.25, true)}
33
+ className='pointer font16'
34
+ />
35
+ </div>
36
+ }
37
+ />
38
+ )
39
+ }
40
+ }
@@ -0,0 +1,177 @@
1
+ /**
2
+ * batch input module
3
+ */
4
+
5
+ import { Component } from 'react'
6
+ import {
7
+ AutoComplete,
8
+ Input,
9
+ Switch,
10
+ Tooltip
11
+ } from 'antd'
12
+ import { batchInputLsKey, commonActions } from '../../common/constants'
13
+ import postMsg from '../../common/post-msg'
14
+ import classNames from 'classnames'
15
+
16
+ const { prefix } = window
17
+ const e = prefix('ssh')
18
+
19
+ export default class BatchInput extends Component {
20
+ state = {
21
+ cmd: '',
22
+ toAll: false,
23
+ open: false,
24
+ enter: false
25
+ }
26
+
27
+ componentWillUnmount () {
28
+ clearTimeout(this.timer)
29
+ }
30
+
31
+ handleEnter = (e) => {
32
+ const { cmd, toAll } = this.state
33
+ if (!cmd.trim()) {
34
+ return
35
+ }
36
+ window.store.addBatchInput(cmd)
37
+ this.props.input(cmd, toAll)
38
+ this.setState({
39
+ cmd: '',
40
+ open: false
41
+ })
42
+ e.stopPropagation()
43
+ }
44
+
45
+ handleChange = (v = '') => {
46
+ let vv = v.replace(/^\d+:/, '').replace(/\n$/, '')
47
+ if (vv === batchInputLsKey) {
48
+ postMsg({
49
+ action: commonActions.updateStore,
50
+ func: 'clearBatchInput'
51
+ })
52
+ vv = ''
53
+ }
54
+ this.setState({
55
+ cmd: vv,
56
+ open: false
57
+ })
58
+ }
59
+
60
+ handleClick = () => {
61
+ this.setState({
62
+ open: true
63
+ })
64
+ }
65
+
66
+ handleChangeAll = toAll => {
67
+ this.setState({
68
+ toAll
69
+ })
70
+ }
71
+
72
+ handleBlur = () => {
73
+ this.setState({
74
+ open: false
75
+ })
76
+ }
77
+
78
+ mapper = (v, i) => {
79
+ return {
80
+ value: `${i}:${v}`,
81
+ label: v
82
+ }
83
+ }
84
+
85
+ renderClear = () => {
86
+ return {
87
+ value: batchInputLsKey,
88
+ label: e('clear')
89
+ }
90
+ }
91
+
92
+ buildOptions = () => {
93
+ const arr = this.props.batchInputs.map(this.mapper)
94
+ if (arr.length) {
95
+ return [
96
+ ...arr,
97
+ this.renderClear()
98
+ ]
99
+ }
100
+ return []
101
+ }
102
+
103
+ handleMouseEnter = () => {
104
+ clearTimeout(this.timer)
105
+ this.setState({
106
+ enter: true
107
+ })
108
+ }
109
+
110
+ leave = () => {
111
+ this.setState({
112
+ enter: false
113
+ })
114
+ }
115
+
116
+ handleMouseLeave = () => {
117
+ this.timer = setTimeout(this.leave, 5000)
118
+ }
119
+
120
+ render () {
121
+ const { cmd, open, toAll, enter } = this.state
122
+ const opts = {
123
+ options: this.buildOptions(),
124
+ placeholder: e('batchInput'),
125
+ value: cmd,
126
+ onChange: this.handleChange,
127
+ defaultOpen: false,
128
+ open,
129
+ allowClear: true,
130
+ className: 'batch-input-wrap'
131
+ }
132
+ const cls = classNames(
133
+ 'batch-input-outer',
134
+ {
135
+ 'bi-show': open || enter
136
+ }
137
+ )
138
+ const inputProps = {
139
+ size: 'small',
140
+ placeholder: e('batchInput'),
141
+ className: 'batch-input-holder'
142
+ }
143
+ return (
144
+ <span
145
+ className={cls}
146
+ onMouseEnter={this.handleMouseEnter}
147
+ onMouseLeave={this.handleMouseLeave}
148
+ >
149
+ <span className='bi-compact'>
150
+ <Input
151
+ {...inputProps}
152
+ />
153
+ </span>
154
+ <span className='bi-full'>
155
+ <AutoComplete
156
+ {...opts}
157
+ >
158
+ <Input.TextArea
159
+ onPressEnter={this.handleEnter}
160
+ onClick={this.handleClick}
161
+ onBlur={this.handleBlur}
162
+ size='small'
163
+ row={1}
164
+ />
165
+ </AutoComplete>
166
+ <Tooltip title={e('runInAllTerminals')}>
167
+ <Switch
168
+ className='mg1l'
169
+ checked={toAll}
170
+ onChange={this.handleChangeAll}
171
+ />
172
+ </Tooltip>
173
+ </span>
174
+ </span>
175
+ )
176
+ }
177
+ }
@@ -0,0 +1,141 @@
1
+ import { Component } from '../common/react-subx'
2
+ import {
3
+ Tooltip,
4
+ Select
5
+ } from 'antd'
6
+ import { InfoCircleOutlined } from '@ant-design/icons'
7
+ import './footer.styl'
8
+ import { paneMap, terminalActions, statusMap } from '../../common/constants'
9
+ import postMessage from '../../common/post-msg'
10
+ import BatchInput from './batch-input'
11
+ import encodes from '../bookmark-form/encodes'
12
+ import Qm from '../quick-commands/quick-commands-select'
13
+
14
+ const {
15
+ Option
16
+ } = Select
17
+
18
+ const { prefix } = window
19
+ const f = prefix('form')
20
+
21
+ export default class SystemMenu extends Component {
22
+ handleInfoPanel = () => {
23
+ const { activeTerminalId } = this.props.store
24
+ postMessage({
25
+ action: terminalActions.showInfoPanel,
26
+ activeSplitId: activeTerminalId
27
+ })
28
+ }
29
+
30
+ batchInput = (cmd, toAll) => {
31
+ const { activeTerminalId } = this.props.store
32
+ postMessage({
33
+ action: terminalActions.batchInput,
34
+ activeSplitId: activeTerminalId,
35
+ toAll,
36
+ cmd
37
+ })
38
+ }
39
+
40
+ handleSwitchEncoding = encode => {
41
+ const { activeTerminalId } = this.props.store
42
+ postMessage({
43
+ encode,
44
+ action: terminalActions.changeEncode,
45
+ activeSplitId: activeTerminalId
46
+ })
47
+ }
48
+
49
+ isLoading = () => {
50
+ const { currentTab } = this.props.store
51
+ if (!currentTab) {
52
+ return true
53
+ }
54
+ const {
55
+ status
56
+ } = currentTab
57
+ return status !== statusMap.success
58
+ }
59
+
60
+ renderBatchInputs () {
61
+ return (
62
+ <div className='terminal-footer-unit terminal-footer-center'>
63
+ <BatchInput
64
+ input={this.batchInput}
65
+ batchInputs={this.props.store.batchInputs}
66
+ />
67
+ </div>
68
+ )
69
+ }
70
+
71
+ renderQuickCommands () {
72
+ return (
73
+ <div className='terminal-footer-unit terminal-footer-qm'>
74
+ <Qm />
75
+ </div>
76
+ )
77
+ }
78
+
79
+ renderEncodingInfo () {
80
+ return (
81
+ <div className='terminal-footer-unit terminal-footer-info'>
82
+ <div className='fleft relative'>
83
+ <Select
84
+ style={{ minWidth: 100 }}
85
+ placeholder={f('encode')}
86
+ defaultValue={this.props.currentTab?.encode}
87
+ onSelect={this.handleSwitchEncoding}
88
+ size='small'
89
+ >
90
+ {
91
+ encodes.map(k => {
92
+ return (
93
+ <Option key={k} value={k}>
94
+ {k}
95
+ </Option>
96
+ )
97
+ })
98
+ }
99
+ </Select>
100
+ </div>
101
+ </div>
102
+ )
103
+ }
104
+
105
+ renderInfoIcon () {
106
+ const loading = this.isLoading()
107
+ if (loading) {
108
+ return null
109
+ }
110
+ return (
111
+ <div className='terminal-footer-unit terminal-footer-info'>
112
+ <Tooltip
113
+ title='Terminal Info'
114
+ >
115
+ <InfoCircleOutlined
116
+ onClick={this.handleInfoPanel}
117
+ className='pointer font18 terminal-info-icon'
118
+ />
119
+ </Tooltip>
120
+ </div>
121
+ )
122
+ }
123
+
124
+ render () {
125
+ const { tabs } = this.props.store
126
+ const pane = this.props.store.currentTab?.pane
127
+ if (pane === paneMap.fileManager || !tabs.length) {
128
+ return null
129
+ }
130
+ return (
131
+ <div className='main-footer'>
132
+ <div className='terminal-footer-flex'>
133
+ {this.renderQuickCommands()}
134
+ {this.renderBatchInputs()}
135
+ {this.renderEncodingInfo()}
136
+ {this.renderInfoIcon()}
137
+ </div>
138
+ </div>
139
+ )
140
+ }
141
+ }
@@ -0,0 +1,47 @@
1
+ @require '../../css/includes/theme-default'
2
+
3
+ .main-footer
4
+ background main
5
+ height 36px
6
+ position absolute
7
+ left 43px
8
+ right 0
9
+ bottom 0
10
+ color text
11
+ z-index 200
12
+ .pinned
13
+ .main-footer
14
+ .qm-wrap-tooltip
15
+ left 343px
16
+
17
+
18
+ .terminal-footer-flex
19
+ display flex
20
+ .terminal-footer-unit .ant-select-selector .ant-select-selection-placeholder
21
+ line-height 24px
22
+ .terminal-footer-unit
23
+ margin-left 10px
24
+ line-height 34px
25
+ textarea.ant-input
26
+ min-height 26px
27
+ height 26px
28
+ margin-bottom -2px
29
+ resize none
30
+ &::-webkit-scrollbar
31
+ width 0
32
+
33
+ .terminal-footer-center
34
+ flex-grow 1
35
+ .terminal-footer-info
36
+ margin-right 10px
37
+ line-height 39px
38
+ .batch-input-outer
39
+ .bi-full
40
+ display none
41
+ &.bi-show
42
+ .bi-full
43
+ display inline
44
+ .bi-compact
45
+ display none
46
+ .batch-input-holder
47
+ width 100px