@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,83 @@
1
+ /**
2
+ * quick commands forms render
3
+ * // todo rerender check
4
+ */
5
+
6
+ /**
7
+ * bookmark form
8
+ */
9
+
10
+ import {
11
+ Input,
12
+ Form,
13
+ Space,
14
+ Button
15
+ } from 'antd'
16
+ import { formItemLayout } from '../../common/form-layout'
17
+ import { MinusCircleOutlined, PlusOutlined } from '@ant-design/icons'
18
+
19
+ const FormItem = Form.Item
20
+ const FormList = Form.List
21
+ const { prefix } = window
22
+ const t = prefix('quickCommands')
23
+
24
+ export default function useQuickCmds (form, formData) {
25
+ function renderItem (field, i, add, remove) {
26
+ return (
27
+ <Space
28
+ style={{ display: 'flex', marginBottom: '2px' }}
29
+ align='baseline'
30
+ key={field.key}
31
+ >
32
+ <FormItem
33
+ {...field}
34
+ name={[field.name, 'name']}
35
+ fieldKey={[field.fieldKey, 'first']}
36
+ rules={[{ required: true, max: 30 }]}
37
+ >
38
+ <Input placeholder={t('quickCommandName')} />
39
+ </FormItem>
40
+ <FormItem
41
+ {...field}
42
+ name={[field.name, 'command']}
43
+ fieldKey={[field.fieldKey, 'first']}
44
+ rules={[{ required: true, max: 300 }]}
45
+ >
46
+ <Input placeholder={t('quickCommand')} />
47
+ </FormItem>
48
+ <MinusCircleOutlined onClick={() => remove(field.name)} />
49
+ </Space>
50
+ )
51
+ }
52
+ return (
53
+ <FormList
54
+ {...formItemLayout}
55
+ label={t('quickCommands')}
56
+ name='quickCommands'
57
+ >
58
+ {
59
+ (fields, { add, remove }, { errors }) => {
60
+ return (
61
+ <div>
62
+ {
63
+ fields.map((field, i) => {
64
+ return renderItem(field, i, add, remove)
65
+ })
66
+ }
67
+ <FormItem>
68
+ <Button
69
+ type='dashed'
70
+ onClick={() => add()}
71
+ block
72
+ icon={<PlusOutlined />}
73
+ >
74
+ {t('newQuickCommand')}
75
+ </Button>
76
+ </FormItem>
77
+ </div>
78
+ )
79
+ }
80
+ }
81
+ </FormList>
82
+ )
83
+ }
@@ -0,0 +1,77 @@
1
+ /**
2
+ * submit buttons
3
+ */
4
+
5
+ /**
6
+ * bookmark form
7
+ */
8
+
9
+ import {
10
+ Button,
11
+ Form
12
+ } from 'antd'
13
+ import {
14
+ settingMap
15
+ } from '../../common/constants'
16
+ import { tailFormItemLayout } from '../../common/form-layout'
17
+ import useFuncs from './use-form-funcs'
18
+
19
+ const FormItem = Form.Item
20
+ const { prefix } = window
21
+ const e = prefix('form')
22
+
23
+ export default function useBookmarkSubmit (props) {
24
+ const [
25
+ form,
26
+ save,
27
+ saveAndCreateNew,
28
+ connect,
29
+ testConnection,
30
+ handleFinish
31
+ ] = useFuncs(props)
32
+ const ui = (
33
+ <FormItem {...tailFormItemLayout}>
34
+ <p>
35
+ <Button
36
+ type='primary'
37
+ htmlType='submit'
38
+ className='mg1r mg1b'
39
+ >{e('saveAndConnect')}
40
+ </Button>
41
+ {
42
+ settingMap.history === props.type
43
+ ? null
44
+ : (
45
+ <Button
46
+ type='primary'
47
+ className='mg1r mg1b'
48
+ onClick={saveAndCreateNew}
49
+ >{e('saveAndCreateNew')}
50
+ </Button>
51
+ )
52
+ }
53
+ <Button
54
+ type='dashed'
55
+ className='mg1r mg1b'
56
+ onClick={save}
57
+ >{e('save')}
58
+ </Button>
59
+ </p>
60
+ <p>
61
+ <Button
62
+ type='dashed'
63
+ onClick={connect}
64
+ className='mg1r mg1b'
65
+ >{e('connect')}
66
+ </Button>
67
+ <Button
68
+ type='dashed'
69
+ onClick={testConnection}
70
+ className='mg1r mg1b'
71
+ >{e('testConnection')}
72
+ </Button>
73
+ </p>
74
+ </FormItem>
75
+ )
76
+ return [form, handleFinish, ui]
77
+ }
@@ -0,0 +1,82 @@
1
+ /**
2
+ * ui forms render
3
+ */
4
+
5
+ /**
6
+ * bookmark form
7
+ */
8
+
9
+ import {
10
+ Input,
11
+ InputNumber,
12
+ AutoComplete,
13
+ Form
14
+ } from 'antd'
15
+ import { formItemLayout } from '../../common/form-layout'
16
+ import defaultSettings from '../../../app/common/default-setting'
17
+ import mapper from '../../common/auto-complete-data-mapper'
18
+ import { defaultEnvLang } from '../../common/constants'
19
+
20
+ const FormItem = Form.Item
21
+ const { prefix } = window
22
+ const e = prefix('form')
23
+ const s = prefix('setting')
24
+
25
+ export default function useBookmarkFormUI (props) {
26
+ const {
27
+ fontFamily: defaultFontFamily,
28
+ fontSize: defaultFontSize
29
+ } = defaultSettings
30
+ const { terminalTypes } = props.store.config
31
+ return [
32
+ <FormItem
33
+ {...formItemLayout}
34
+ label='ENV:LANG'
35
+ key='envLang'
36
+ rules={[{
37
+ max: 130, message: '130 chars max'
38
+ }]}
39
+ name='envLang'
40
+ >
41
+ <Input placeholder={defaultEnvLang} />
42
+ </FormItem>,
43
+ <FormItem
44
+ {...formItemLayout}
45
+ key='terminalType'
46
+ label={e('terminalType')}
47
+ rules={[{
48
+ required: true, message: 'terminal type required'
49
+ }]}
50
+ normalize={props.trim}
51
+ name='term'
52
+ >
53
+ <AutoComplete
54
+ options={terminalTypes.map(mapper)}
55
+ />
56
+ </FormItem>,
57
+ <FormItem
58
+ {...formItemLayout}
59
+ label={s('fontFamily')}
60
+ key='fontFamily'
61
+ name='fontFamily'
62
+ rules={[{
63
+ max: 130, message: '130 chars max'
64
+ }]}
65
+ >
66
+ <Input placeholder={defaultFontFamily + ''} />
67
+ </FormItem>,
68
+ <FormItem
69
+ key='fontSize'
70
+ {...formItemLayout}
71
+ label={s('fontSize')}
72
+ name='fontSize'
73
+ >
74
+ <InputNumber
75
+ min={9}
76
+ max={65535}
77
+ step={1}
78
+ placeholder={defaultFontSize}
79
+ />
80
+ </FormItem>
81
+ ]
82
+ }
@@ -0,0 +1,23 @@
1
+ /**
2
+ * bookmark form
3
+ */
4
+ import {
5
+ Switch,
6
+ Form
7
+ } from 'antd'
8
+ import { formItemLayout } from '../../common/form-layout'
9
+
10
+ const FormItem = Form.Item
11
+
12
+ export default function renderX11 () {
13
+ return (
14
+ <FormItem
15
+ {...formItemLayout}
16
+ label='x11'
17
+ name='x11'
18
+ valuePropName='checked'
19
+ >
20
+ <Switch />
21
+ </FormItem>
22
+ )
23
+ }
@@ -0,0 +1,37 @@
1
+ /**
2
+ * animate text when text change
3
+ */
4
+
5
+ import React from 'react'
6
+ import uid from '../../common/uid'
7
+ import './animate-text.styl'
8
+
9
+ export default class AnimateText extends React.PureComponent {
10
+ constructor (props) {
11
+ super(props)
12
+ this.uid = 'AnimateText-' + uid()
13
+ }
14
+
15
+ componentDidUpdate () {
16
+ const dom = document.getElementById(this.uid)
17
+ dom.className = (this.props.className || 'animate-text-wrap') + ' animated bounceIn'
18
+ this.timer = setTimeout(() => {
19
+ if (dom) {
20
+ dom.className = this.props.className || 'animate-text-wrap'
21
+ }
22
+ }, 450)
23
+ }
24
+
25
+ componentWillUnmount () {
26
+ clearTimeout(this.timer)
27
+ }
28
+
29
+ render () {
30
+ const { children, className } = this.props
31
+ return (
32
+ <div className={className} id={this.uid}>
33
+ {children}
34
+ </div>
35
+ )
36
+ }
37
+ }
@@ -0,0 +1,54 @@
1
+
2
+ /*!
3
+ * animate.css -http://daneden.me/animate
4
+ * Version - 3.5.2
5
+ * Licensed under the MIT license - http://opensource.org/licenses/MIT
6
+ *
7
+ * Copyright (c) 2017 Daniel Eden
8
+ */
9
+
10
+ .animated {
11
+ animation-duration: 1s;
12
+ animation-fill-mode: both;
13
+ }
14
+
15
+ .animated.bounceIn {
16
+ animation-duration: .45s;
17
+ }
18
+
19
+ @keyframes bounceIn {
20
+ from, 20%, 40%, 60%, 80%, to {
21
+ animation-timing-function: cubic-bezier(0.215, 0.610, 0.355, 1.000);
22
+ }
23
+
24
+ 0% {
25
+ opacity: 0;
26
+ transform: scale3d(.3, .3, .3);
27
+ }
28
+
29
+ 20% {
30
+ transform: scale3d(1.1, 1.1, 1.1);
31
+ }
32
+
33
+ 40% {
34
+ transform: scale3d(.9, .9, .9);
35
+ }
36
+
37
+ 60% {
38
+ opacity: 1;
39
+ transform: scale3d(1.03, 1.03, 1.03);
40
+ }
41
+
42
+ 80% {
43
+ transform: scale3d(.97, .97, .97);
44
+ }
45
+
46
+ to {
47
+ opacity: 1;
48
+ transform: scale3d(1, 1, 1);
49
+ }
50
+ }
51
+
52
+ .bounceIn {
53
+ animation-name: bounceIn;
54
+ }
@@ -0,0 +1,28 @@
1
+ /**
2
+ * external link, will be opened with default browser
3
+ */
4
+
5
+ import { memo } from 'react'
6
+ import { LinkOutlined } from '@ant-design/icons'
7
+
8
+ window.openLink = (url) => {
9
+ window.pre.openExternal(url)
10
+ }
11
+
12
+ function onClick (e, href) {
13
+ e.preventDefault()
14
+ window.pre.openExternal(href)
15
+ }
16
+
17
+ export default memo(props => {
18
+ const { to, children = '', ...rest } = props
19
+ return (
20
+ <a
21
+ href={to}
22
+ onClick={e => onClick(e, to)}
23
+ {...rest}
24
+ >
25
+ {children} <LinkOutlined />
26
+ </a>
27
+ )
28
+ })
@@ -0,0 +1,25 @@
1
+ import { memo } from 'react'
2
+ import Link from './external-link'
3
+ import {
4
+ Tooltip
5
+ } from 'antd'
6
+ import { QuestionCircleOutlined } from '@ant-design/icons'
7
+
8
+ export default memo(props => {
9
+ const { link, title, ...rest } = props
10
+ const cont = title || (
11
+ <span>
12
+ <Link to={link}>{link}</Link>
13
+ </span>
14
+ )
15
+ return (
16
+ <Tooltip
17
+ title={cont}
18
+ {...rest}
19
+ >
20
+ <span className='mg1l'>
21
+ <QuestionCircleOutlined />
22
+ </span>
23
+ </Tooltip>
24
+ )
25
+ })
@@ -0,0 +1,23 @@
1
+ /**
2
+ * highlight keyword in text
3
+ * single keyword only
4
+ */
5
+
6
+ import './highlight.styl'
7
+
8
+ export default (text, keyword) => {
9
+ if (!keyword || !text.includes(keyword)) {
10
+ return text
11
+ }
12
+ const arr = text.split(keyword)
13
+ const len = arr.length
14
+ return arr.reduce((prev, t, i) => {
15
+ return [
16
+ ...prev,
17
+ t,
18
+ i === len - 1
19
+ ? null
20
+ : <span className='highlight'>{keyword}</span>
21
+ ]
22
+ }, [])
23
+ }
@@ -0,0 +1,3 @@
1
+ @require '../../css/includes/theme-default'
2
+ .highlight
3
+ color error
@@ -0,0 +1,68 @@
1
+ /**
2
+ * input with auto focus
3
+ */
4
+
5
+ import { Input } from 'antd'
6
+ import React from 'react'
7
+ import { findLastIndex } from 'lodash-es'
8
+ import uid from '../../common/uid'
9
+
10
+ export default class InputAutoFocus extends React.PureComponent {
11
+ constructor (props) {
12
+ super(props)
13
+ this.uid = 'InputAutoFocus-' + uid()
14
+ }
15
+
16
+ componentDidMount () {
17
+ this.timer = setTimeout(this.doFocus, 50)
18
+ }
19
+
20
+ componentDidUpdate (prevProps) {
21
+ if (!prevProps.selectall) {
22
+ return
23
+ }
24
+ if (prevProps.autofocustrigger !== this.props.autofocustrigger) {
25
+ this.timer = setTimeout(this.doFocus, 50)
26
+ }
27
+ }
28
+
29
+ componentWillUnmount () {
30
+ clearTimeout(this.timer)
31
+ }
32
+
33
+ doFocus = () => {
34
+ const dom = this.getDom()
35
+ if (dom && dom.focus) {
36
+ const { value, selectall = false } = this.props
37
+ const index = findLastIndex(value, v => v === '.')
38
+ const hasExt = index > 0
39
+ if (value && !selectall && hasExt) {
40
+ dom.focus()
41
+ dom.setSelectionRange(0, index)
42
+ } else {
43
+ dom.select()
44
+ }
45
+ }
46
+ }
47
+
48
+ getDom () {
49
+ const root = document.querySelector(`[data-id="${this.uid}"]`)
50
+ const dom = root.tagName === 'INPUT'
51
+ ? root
52
+ : root.querySelector('input')
53
+ return dom
54
+ }
55
+
56
+ render () {
57
+ const { type, ...rest } = this.props
58
+ const Dom = type === 'password'
59
+ ? Input.Password
60
+ : Input
61
+ return (
62
+ <Dom
63
+ {...rest}
64
+ data-id={this.uid}
65
+ />
66
+ )
67
+ }
68
+ }
@@ -0,0 +1,66 @@
1
+ /**
2
+ * input only apply when confirm
3
+ */
4
+ import { PureComponent } from 'react'
5
+ import {
6
+ CheckOutlined
7
+ } from '@ant-design/icons'
8
+ import {
9
+ InputNumber
10
+ } from 'antd'
11
+
12
+ export default class InputNumberConfirm extends PureComponent {
13
+ constructor (props) {
14
+ super(props)
15
+ this.state = {
16
+ v: props.value,
17
+ onEdit: false
18
+ }
19
+ }
20
+
21
+ componentDidUpdate (prevProps) {
22
+ if (prevProps.value !== this.props.value) {
23
+ this.setState({
24
+ v: this.props.value
25
+ })
26
+ }
27
+ }
28
+
29
+ handleChange = (v) => {
30
+ this.setState({ v })
31
+ }
32
+
33
+ handleClick = () => {
34
+ this.setState({ onEdit: true })
35
+ }
36
+
37
+ handleSubmit = () => {
38
+ this.setState({ onEdit: false })
39
+ this.props.onChange(this.state.v)
40
+ }
41
+
42
+ after = () => {
43
+ const { onEdit } = this.state
44
+ if (onEdit) {
45
+ return (
46
+ <CheckOutlined
47
+ className='font16 pointer'
48
+ onClick={this.handleSubmit}
49
+ />
50
+ )
51
+ }
52
+ return this.props.addonAfter
53
+ }
54
+
55
+ render () {
56
+ return (
57
+ <InputNumber
58
+ {...this.props}
59
+ value={this.state.v}
60
+ onClick={this.handleClick}
61
+ onChange={this.handleChange}
62
+ addonAfter={this.after()}
63
+ />
64
+ )
65
+ }
66
+ }
@@ -0,0 +1,22 @@
1
+ import {
2
+ logoPath1,
3
+ logoPath2,
4
+ logoPath3,
5
+ packInfo
6
+ } from '../../common/constants'
7
+ import { Tag } from 'antd'
8
+
9
+ export default function LogoElem () {
10
+ return (
11
+ <h1 className='mg3y font50'>
12
+ <span className='iblock pd3 morph-shape mg1l mg1r'>
13
+ <img src={logoPath2} height={80} className='iblock mwm-100 mg1l mg1r logo-filter' />
14
+ </span>
15
+ <img src={logoPath3} height={80} className='hide' />
16
+ <sup>
17
+ <img src={logoPath1} height={28} className='iblock mwm-100 mg1r' />
18
+ </sup>
19
+ <Tag color='#08c'>{packInfo.version}</Tag>
20
+ </h1>
21
+ )
22
+ }
@@ -0,0 +1,27 @@
1
+ /**
2
+ * render markdown text proper
3
+ */
4
+
5
+ import classnames from 'classnames'
6
+
7
+ export default ({ text = '' }) => {
8
+ const arr = text.split(/[\n\r]+/g)
9
+ function render (txt, i) {
10
+ const empty = txt.trim().length
11
+ const bold = !txt.startsWith('- ') || txt.startsWith('#')
12
+ const cls = classnames({
13
+ bold,
14
+ mg1y: empty || bold
15
+ })
16
+ return (
17
+ <div className={cls} key={'upgrade-info-' + i}>{txt}</div>
18
+ )
19
+ }
20
+ return (
21
+ <div className='pd1y'>
22
+ {
23
+ arr.map(render)
24
+ }
25
+ </div>
26
+ )
27
+ }
@@ -0,0 +1 @@
1
+ export { Component } from 'manate/react'