@electerm/electerm-react 1.100.60 → 1.101.16

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 (79) hide show
  1. package/client/components/bookmark-form/{bookmark-select.jsx → common/bookmark-select.jsx} +11 -44
  2. package/client/components/bookmark-form/{bookmark-category-select.jsx → common/category-select.jsx} +10 -4
  3. package/client/components/bookmark-form/{color-picker-item.jsx → common/color-picker-item.jsx} +2 -3
  4. package/client/components/bookmark-form/{color-picker.jsx → common/color-picker.jsx} +10 -46
  5. package/client/components/bookmark-form/{render-connection-hopping.jsx → common/connection-hopping.jsx} +7 -7
  6. package/client/components/bookmark-form/common/fields.jsx +202 -0
  7. package/client/components/bookmark-form/common/hex-input.jsx +22 -0
  8. package/client/components/bookmark-form/common/init-values.js +83 -0
  9. package/client/components/bookmark-form/common/profile-item.jsx +34 -0
  10. package/client/components/bookmark-form/{proxy.jsx → common/proxy.jsx} +1 -1
  11. package/client/components/bookmark-form/{use-quick-commands.jsx → common/quick-commands.jsx} +1 -1
  12. package/client/components/bookmark-form/common/rdp-alert.jsx +13 -0
  13. package/client/components/bookmark-form/common/render-auth-ssh.jsx +119 -0
  14. package/client/components/bookmark-form/{render-delayed-scripts.jsx → common/run-scripts.jsx} +6 -2
  15. package/client/components/bookmark-form/common/serial-path-selector.jsx +39 -0
  16. package/client/components/bookmark-form/{render-auth-ssh.jsx → common/ssh-auth-selector.jsx} +3 -4
  17. package/client/components/bookmark-form/common/ssh-auth-type-selector.jsx +38 -0
  18. package/client/components/bookmark-form/common/ssh-host-selector.jsx +61 -0
  19. package/client/components/bookmark-form/{render-ssh-tunnel.jsx → common/ssh-tunnels.jsx} +4 -4
  20. package/client/components/bookmark-form/common/submit-buttons.jsx +42 -0
  21. package/client/components/bookmark-form/{render-bg.jsx → common/terminal-background.jsx} +2 -2
  22. package/client/components/bookmark-form/{x11.jsx → common/x11.jsx} +2 -2
  23. package/client/components/bookmark-form/config/common-fields.js +305 -0
  24. package/client/components/bookmark-form/config/ftp.js +40 -0
  25. package/client/components/bookmark-form/config/local.js +96 -0
  26. package/client/components/bookmark-form/config/rdp.js +39 -0
  27. package/client/components/bookmark-form/config/serial.js +69 -0
  28. package/client/components/bookmark-form/config/session-config.js +23 -0
  29. package/client/components/bookmark-form/config/ssh.js +47 -0
  30. package/client/components/bookmark-form/config/telnet.js +40 -0
  31. package/client/components/bookmark-form/config/vnc.js +44 -0
  32. package/client/components/bookmark-form/config/web.js +45 -0
  33. package/client/components/bookmark-form/form-renderer.jsx +328 -0
  34. package/client/components/bookmark-form/index.jsx +32 -91
  35. package/client/components/bookmark-form/render-form.jsx +11 -0
  36. package/client/components/footer/footer-entry.jsx +1 -1
  37. package/client/components/main/main.jsx +12 -2
  38. package/client/components/profile/profile-form-ftp.jsx +35 -0
  39. package/client/components/profile/profile-form-ssh.jsx +3 -3
  40. package/client/components/profile/profile-form-telnet.jsx +1 -1
  41. package/client/components/profile/profile-tabs.jsx +4 -0
  42. package/client/components/setting-panel/setting-modal.jsx +1 -1
  43. package/client/components/setting-panel/setting-wrap.jsx +1 -1
  44. package/client/components/setting-panel/text-bg-modal.jsx +2 -2
  45. package/client/components/theme/theme-edit-slot.jsx +1 -1
  46. package/client/components/tree-list/category-color-picker.jsx +1 -1
  47. package/client/components/tree-list/move-item-modal.jsx +1 -1
  48. package/client/store/load-data.js +1 -1
  49. package/package.json +1 -1
  50. package/client/components/bookmark-form/form-ssh-common.jsx +0 -219
  51. package/client/components/bookmark-form/form-tabs.jsx +0 -66
  52. package/client/components/bookmark-form/ftp-form-ui.jsx +0 -160
  53. package/client/components/bookmark-form/ftp-form.jsx +0 -16
  54. package/client/components/bookmark-form/hex-input.jsx +0 -39
  55. package/client/components/bookmark-form/local-form-ui.jsx +0 -151
  56. package/client/components/bookmark-form/local-form.jsx +0 -16
  57. package/client/components/bookmark-form/profile-form-item.jsx +0 -43
  58. package/client/components/bookmark-form/quick-command-list.jsx +0 -31
  59. package/client/components/bookmark-form/quick-command.jsx +0 -227
  60. package/client/components/bookmark-form/rdp-form-ui.jsx +0 -179
  61. package/client/components/bookmark-form/rdp-form.jsx +0 -16
  62. package/client/components/bookmark-form/render-profile-item.jsx +0 -0
  63. package/client/components/bookmark-form/serial-form-ui.jsx +0 -309
  64. package/client/components/bookmark-form/serial-form.jsx +0 -20
  65. package/client/components/bookmark-form/sftp-enable.jsx +0 -41
  66. package/client/components/bookmark-form/ssh-form-ui.jsx +0 -121
  67. package/client/components/bookmark-form/ssh-form.jsx +0 -292
  68. package/client/components/bookmark-form/telnet-form-ui.jsx +0 -140
  69. package/client/components/bookmark-form/telnet-form.jsx +0 -16
  70. package/client/components/bookmark-form/use-form-funcs.jsx +0 -50
  71. package/client/components/bookmark-form/use-submit.jsx +0 -67
  72. package/client/components/bookmark-form/use-ui.jsx +0 -97
  73. package/client/components/bookmark-form/vnc-form-ui.jsx +0 -213
  74. package/client/components/bookmark-form/vnc-form.jsx +0 -16
  75. package/client/components/bookmark-form/web-form-ui.jsx +0 -143
  76. package/client/components/bookmark-form/web-form.jsx +0 -16
  77. /package/client/components/bookmark-form/{bookmark-group-tree-format.js → common/bookmark-group-tree-format.js} +0 -0
  78. /package/client/components/bookmark-form/{color-picker.styl → common/color-picker.styl} +0 -0
  79. /package/client/components/bookmark-form/{encodes.js → common/encodes.js} +0 -0
@@ -0,0 +1,35 @@
1
+ import {
2
+ Form,
3
+ Input
4
+ } from 'antd'
5
+ import { formItemLayout } from '../../common/form-layout'
6
+ import Password from '../common/password'
7
+
8
+ const FormItem = Form.Item
9
+ const e = window.translate
10
+
11
+ export default function ProfileFormSsh (props) {
12
+ return (
13
+ <>
14
+ <FormItem
15
+ {...formItemLayout}
16
+ label={e('username')}
17
+ hasFeedback
18
+ name={['ftp', 'user']}
19
+ rules={[{
20
+ max: 128, message: '128 chars max'
21
+ }]}
22
+ >
23
+ <Input />
24
+ </FormItem>
25
+ <FormItem
26
+ {...formItemLayout}
27
+ label={e('password')}
28
+ hasFeedback
29
+ name={['rdp', 'password']}
30
+ >
31
+ <Password />
32
+ </FormItem>
33
+ </>
34
+ )
35
+ }
@@ -2,7 +2,7 @@ import {
2
2
  Form,
3
3
  Input
4
4
  } from 'antd'
5
- import renderAuth from '../bookmark-form/render-auth-ssh'
5
+ import renderAuth from '../bookmark-form/common/render-auth-ssh'
6
6
  import { formItemLayout } from '../../common/form-layout'
7
7
 
8
8
  const FormItem = Form.Item
@@ -25,14 +25,14 @@ export default function ProfileFormSsh (props) {
25
25
  </FormItem>
26
26
  {
27
27
  renderAuth({
28
- store: props.store,
28
+ store: window.store,
29
29
  form,
30
30
  authType: 'password'
31
31
  })
32
32
  }
33
33
  {
34
34
  renderAuth({
35
- store: props.store,
35
+ store: window.store,
36
36
  form
37
37
  })
38
38
  }
@@ -3,7 +3,7 @@ import {
3
3
  Input
4
4
  } from 'antd'
5
5
  import { formItemLayout } from '../../common/form-layout'
6
- import renderAuth from '../bookmark-form/render-auth-ssh'
6
+ import renderAuth from '../bookmark-form/common/render-auth-ssh'
7
7
 
8
8
  const FormItem = Form.Item
9
9
  const e = window.translate
@@ -2,6 +2,7 @@ import { Tabs } from 'antd'
2
2
  import ProfileFormSsh from './profile-form-ssh'
3
3
  import ProfileFormRdp from './profile-form-rdp'
4
4
  import ProfileFormVnc from './profile-form-vnc'
5
+ import ProfileFormFtp from './profile-form-ftp'
5
6
  import ProfileFormTelnet from './profile-form-telnet'
6
7
 
7
8
  const { TabPane } = Tabs
@@ -26,6 +27,9 @@ export default function ProfileTabs (props) {
26
27
  <TabPane tab='rdp' key='rdp' forceRender>
27
28
  <ProfileFormRdp />
28
29
  </TabPane>
30
+ <TabPane tab='ftp' key='ftp' forceRender>
31
+ <ProfileFormFtp />
32
+ </TabPane>
29
33
  </Tabs>
30
34
 
31
35
  )
@@ -99,7 +99,7 @@ export default auto(function SettingModalWrap (props) {
99
99
  animated: false,
100
100
  items,
101
101
  onChange: store.handleChangeSettingTab,
102
- destroyInactiveTabPane: true,
102
+ destroyOnHidden: true,
103
103
  className: 'setting-tabs',
104
104
  type: 'card'
105
105
  }
@@ -24,7 +24,7 @@ export default class SettingWrap extends Component {
24
24
  width: this.props.innerWidth - sidebarWidth,
25
25
  zIndex: 888,
26
26
  placement: 'left',
27
- destroyOnClose: true,
27
+ destroyOnHidden: true,
28
28
  styles: {
29
29
  header: {
30
30
  display: 'none'
@@ -7,7 +7,7 @@ import {
7
7
  Typography,
8
8
  Select
9
9
  } from 'antd'
10
- import { ColorPicker } from '../bookmark-form/color-picker.jsx'
10
+ import { ColorPicker } from '../bookmark-form/common/color-picker.jsx'
11
11
 
12
12
  const { TextArea } = Input
13
13
  const { Title } = Typography
@@ -54,7 +54,7 @@ export default function TextBgModal ({
54
54
  onOk={handleOk}
55
55
  onCancel={handleCancel}
56
56
  width={500}
57
- destroyOnClose
57
+ destroyOnHidden
58
58
  >
59
59
  <div className='pd1'>
60
60
  <Space direction='vertical' size='large' style={{ width: '100%' }}>
@@ -1,4 +1,4 @@
1
- import { ColorPicker } from '../bookmark-form/color-picker'
1
+ import { ColorPicker } from '../bookmark-form/common/color-picker'
2
2
 
3
3
  export default function ThemeEditSlot (props) {
4
4
  const {
@@ -1,5 +1,5 @@
1
1
  import React from 'react'
2
- import { ColorPicker } from '../bookmark-form/color-picker.jsx'
2
+ import { ColorPicker } from '../bookmark-form/common/color-picker.jsx'
3
3
 
4
4
  export function CategoryColorPicker ({ value, onChange }) {
5
5
  return (
@@ -1,6 +1,6 @@
1
1
  // render bookmark select, use antd tree select
2
2
  import { useState } from 'react'
3
- import buildGroupData from '../bookmark-form/bookmark-group-tree-format'
3
+ import buildGroupData from '../bookmark-form/common/bookmark-group-tree-format'
4
4
  import { TreeSelect, Modal, Button } from 'antd'
5
5
  const e = window.translate
6
6
 
@@ -8,7 +8,7 @@ import { infoTabs, statusMap, defaultEnvLang } from '../common/constants'
8
8
  import fs from '../common/fs'
9
9
  import generate from '../common/id-with-stamp'
10
10
  import defaultSettings from '../common/default-setting'
11
- import encodes from '../components/bookmark-form/encodes'
11
+ import encodes from '../components/bookmark-form/common/encodes'
12
12
  import { initWsCommon } from '../common/fetch-from-server'
13
13
  import safeParse from '../common/parse-json-safe'
14
14
  import initWatch from './watch'
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@electerm/electerm-react",
3
- "version": "1.100.60",
3
+ "version": "1.101.16",
4
4
  "description": "react components src for electerm",
5
5
  "main": "./client/components/main/main.jsx",
6
6
  "license": "MIT",
@@ -1,219 +0,0 @@
1
- /**
2
- * bookmark form
3
- */
4
- import {
5
- Input,
6
- InputNumber,
7
- Radio,
8
- Select,
9
- Form
10
- } from 'antd'
11
- import {
12
- authTypeMap
13
- } from '../../common/constants'
14
- import { formItemLayout, tailFormItemLayout } from '../../common/form-layout'
15
- import InputAutoFocus from '../common/input-auto-focus'
16
- import encodes from './encodes'
17
- import renderRunScripts from './render-delayed-scripts.jsx'
18
- import { ColorPickerItem } from './color-picker-item.jsx'
19
- import BookmarkCategorySelect from './bookmark-category-select.jsx'
20
-
21
- import './bookmark-form.styl'
22
-
23
- const authTypes = Object.keys(authTypeMap).map(k => {
24
- return k
25
- })
26
- const RadioButton = Radio.Button
27
- const RadioGroup = Radio.Group
28
- const FormItem = Form.Item
29
- const { Option } = Select
30
- const e = window.translate
31
-
32
- export default function renderCommon (props) {
33
- const {
34
- bookmarkGroups = [],
35
- ips,
36
- form,
37
- onChangeAuthType,
38
- filterAuthType = a => a
39
- } = props
40
- const authTypesFiltered = authTypes.filter(filterAuthType)
41
-
42
- // ips is ipaddress string[]
43
- function renderIps () {
44
- return ips.map(ip => {
45
- return (
46
- <div
47
- key={ip}
48
- className='iblock mg2r pointer ip-item'
49
- onClick={() => props.useIp(form, ip)}
50
- >
51
- <b>{ip}</b>
52
- <span
53
- className='mg1l item-item-use'
54
- >
55
- {e('use')}
56
- </span>
57
- </div>
58
- )
59
- })
60
- }
61
- return (
62
- <>
63
- <FormItem
64
- {...formItemLayout}
65
- label={e('host')}
66
- hasFeedback
67
- rules={[{
68
- max: 520, message: '520 chars max'
69
- }, {
70
- required: true, message: 'host required'
71
- }]}
72
- normalize={props.trim}
73
- >
74
- {
75
- ips.length
76
- ? renderIps()
77
- : (
78
- <div className='dns-section'>
79
- hostname or ip
80
- </div>
81
- )
82
- }
83
- <FormItem noStyle name='host'>
84
- <InputAutoFocus
85
- name='host'
86
- onBlur={props.onBlur}
87
- onPaste={e => props.onPaste(e, form)}
88
- addonBefore={<ColorPickerItem />}
89
- />
90
- </FormItem>
91
- </FormItem>
92
- <FormItem
93
- {...formItemLayout}
94
- label={e('username')}
95
- hasFeedback
96
- name='username'
97
- rules={[{
98
- max: 128, message: '128 chars max'
99
- }]}
100
- normalize={props.trim}
101
- >
102
- <Input />
103
- </FormItem>
104
- <FormItem
105
- {...tailFormItemLayout}
106
- className='mg1b'
107
- name='authType'
108
- >
109
- <RadioGroup
110
- size='small'
111
- onChange={onChangeAuthType}
112
- buttonStyle='solid'
113
- >
114
- {
115
- authTypesFiltered.map(t => {
116
- return (
117
- <RadioButton value={t} key={t}>
118
- {e(t)}
119
- </RadioButton>
120
- )
121
- })
122
- }
123
- </RadioGroup>
124
- </FormItem>
125
- {props.renderAuth(props)}
126
- <FormItem
127
- {...formItemLayout}
128
- label={e('port')}
129
- name='port'
130
- rules={[{
131
- required: true, message: 'port required'
132
- }]}
133
- >
134
- <InputNumber
135
- placeholder={e('port')}
136
- min={1}
137
- max={65535}
138
- step={1}
139
- />
140
- </FormItem>
141
- <BookmarkCategorySelect
142
- bookmarkGroups={bookmarkGroups}
143
- form={form}
144
- formItemLayout={formItemLayout}
145
- />
146
- <FormItem
147
- {...formItemLayout}
148
- label={e('title')}
149
- hasFeedback
150
- name='title'
151
- >
152
- <Input />
153
- </FormItem>
154
- <FormItem
155
- {...formItemLayout}
156
- label={e('description')}
157
- name='description'
158
- hasFeedback
159
- >
160
- <Input.TextArea autoSize={{ minRows: 1 }} />
161
- </FormItem>
162
- <FormItem
163
- {...formItemLayout}
164
- name='setEnv'
165
- label='SetEnv'
166
- >
167
- <Input placeholder='SEC=xxx BEC=xxxx' />
168
- </FormItem>
169
- <FormItem
170
- {...formItemLayout}
171
- name='startDirectoryLocal'
172
- label={`${e('startDirectory')}:${e('local')}`}
173
- >
174
- <Input />
175
- </FormItem>
176
- <FormItem
177
- {...formItemLayout}
178
- name='startDirectory'
179
- label={`${e('startDirectory')}:${e('remote')}`}
180
- >
181
- <Input />
182
- </FormItem>
183
- <FormItem
184
- {...formItemLayout}
185
- label={e('interactiveValues')}
186
- name='interactiveValues'
187
- hasFeedback
188
- >
189
- <Input.TextArea
190
- autoSize={{ minRows: 1 }}
191
- />
192
- </FormItem>
193
- {renderRunScripts()}
194
- <FormItem
195
- {...formItemLayout}
196
- key='encode-select'
197
- label={e('encode')}
198
- name='encode'
199
- >
200
- <Select
201
- showSearch
202
- >
203
- {
204
- encodes.map(k => {
205
- return (
206
- <Option
207
- value={k}
208
- key={k}
209
- >
210
- {k.toUpperCase()}
211
- </Option>
212
- )
213
- })
214
- }
215
- </Select>
216
- </FormItem>
217
- </>
218
- )
219
- }
@@ -1,66 +0,0 @@
1
- /**
2
- * bookmark form
3
- */
4
- import {
5
- Tabs
6
- } from 'antd'
7
- import { sshTunnelHelpLink } from '../../common/constants'
8
- import HelpIcon from '../common/help-icon'
9
-
10
- const e = window.translate
11
-
12
- export default function renderTabs (props) {
13
- const tunnelTag = (
14
- <span>
15
- {e('sshTunnel')}
16
- <HelpIcon
17
- link={sshTunnelHelpLink}
18
- />
19
- </span>
20
- )
21
- const items = [
22
- {
23
- key: 'auth',
24
- label: e('auth'),
25
- forceRender: true,
26
- children: props.renderCommon(props)
27
- },
28
- {
29
- key: 'settings',
30
- label: e('settings'),
31
- forceRender: true,
32
- children: (
33
- <>
34
- {props.renderEnableSftp()}
35
- {props.uis}
36
- {props.renderProxy(props)}
37
- {props.renderX11(props.form)}
38
- {props.renderTermBg(props.form)}
39
- </>
40
- )
41
- },
42
- {
43
- key: 'quickCommands',
44
- label: e('quickCommands'),
45
- forceRender: true,
46
- children: props.qms
47
- },
48
- {
49
- key: 'tunnel',
50
- label: tunnelTag,
51
- forceRender: true,
52
- children: props.renderSshTunnel(props)
53
- },
54
- {
55
- key: 'connectionHopping',
56
- label: e('connectionHopping'),
57
- forceRender: true,
58
- children: props.renderConnectionHopping(props)
59
- }
60
- ]
61
- return (
62
- <Tabs
63
- items={items}
64
- />
65
- )
66
- }
@@ -1,160 +0,0 @@
1
- /**
2
- * web form
3
- */
4
-
5
- import { useEffect } from 'react'
6
- import {
7
- Input,
8
- Form,
9
- InputNumber,
10
- Switch
11
- } from 'antd'
12
- import { formItemLayout } from '../../common/form-layout'
13
- import {
14
- newBookmarkIdPrefix,
15
- terminalFtpType
16
- } from '../../common/constants'
17
- import useSubmit from './use-submit'
18
- import copy from 'json-deep-copy'
19
- import { defaults, isEmpty } from 'lodash-es'
20
- import { ColorPickerItem } from './color-picker-item.jsx'
21
- import Password from '../common/password'
22
- import { getColorFromCategory } from '../../common/get-category-color.js'
23
- import findBookmarkGroupId from '../../common/find-bookmark-group-id'
24
- import ProfileItem from './profile-form-item'
25
- import BookmarkCategorySelect from './bookmark-category-select.jsx'
26
-
27
- const FormItem = Form.Item
28
- const e = window.translate
29
-
30
- export default function FtpFormUi (props) {
31
- const [
32
- form,
33
- handleFinish,
34
- submitUi
35
- ] = useSubmit(props)
36
- useEffect(() => {
37
- if (props.formData.id.startsWith(newBookmarkIdPrefix)) {
38
- form.setFieldsValue({
39
- category: props.currentBookmarkGroupId
40
- })
41
- }
42
- }, [props.currentBookmarkGroupId])
43
- const {
44
- id = ''
45
- } = props.formData
46
- const {
47
- bookmarkGroups = [],
48
- currentBookmarkGroupId
49
- } = props
50
- let initialValues = copy(props.formData)
51
- const initBookmarkGroupId = !id.startsWith(newBookmarkIdPrefix)
52
- ? findBookmarkGroupId(bookmarkGroups, id)
53
- : currentBookmarkGroupId
54
- const defaultValues = {
55
- type: terminalFtpType,
56
- port: 21,
57
- category: initBookmarkGroupId,
58
- color: getColorFromCategory(bookmarkGroups, currentBookmarkGroupId),
59
- user: '',
60
- password: '',
61
- secure: false
62
- }
63
- initialValues = defaults(initialValues, defaultValues)
64
-
65
- function renderCommon () {
66
- const {
67
- bookmarkGroups = []
68
- } = props
69
- return (
70
- <div className='pd1x'>
71
- <FormItem
72
- {...formItemLayout}
73
- label={e('title')}
74
- hasFeedback
75
- >
76
- <FormItem noStyle name='title'>
77
- <Input addonBefore={<ColorPickerItem />} />
78
- </FormItem>
79
- </FormItem>
80
- <FormItem
81
- {...formItemLayout}
82
- label={e('host')}
83
- hasFeedback
84
- name='host'
85
- required
86
- >
87
- <Input />
88
- </FormItem>
89
- <FormItem
90
- {...formItemLayout}
91
- label={e('port')}
92
- hasFeedback
93
- name='port'
94
- rules={[{
95
- required: true, message: 'port required'
96
- }]}
97
- >
98
- <InputNumber
99
- placeholder={e('port')}
100
- min={1}
101
- max={65535}
102
- step={1}
103
- />
104
- </FormItem>
105
- <ProfileItem
106
- store={props.store}
107
- profileFilter={d => !isEmpty(d.vnc)}
108
- />
109
- <FormItem
110
- {...formItemLayout}
111
- label={e('username')}
112
- hasFeedback
113
- name='user'
114
- >
115
- <Input />
116
- </FormItem>
117
- <FormItem
118
- {...formItemLayout}
119
- label={e('password')}
120
- hasFeedback
121
- name='password'
122
- >
123
- <Password />
124
- </FormItem>
125
- <FormItem
126
- {...formItemLayout}
127
- label={e('secure')}
128
- name='secure'
129
- valuePropName='secure'
130
- >
131
- <Switch />
132
- </FormItem>
133
- <BookmarkCategorySelect
134
- bookmarkGroups={bookmarkGroups}
135
- form={form}
136
- />
137
- <FormItem
138
- {...formItemLayout}
139
- label='type'
140
- name='type'
141
- className='hide'
142
- >
143
- <Input />
144
- </FormItem>
145
- </div>
146
- )
147
- }
148
-
149
- return (
150
- <Form
151
- form={form}
152
- onFinish={handleFinish}
153
- initialValues={initialValues}
154
- name='vnc-form'
155
- >
156
- {renderCommon()}
157
- {submitUi}
158
- </Form>
159
- )
160
- }
@@ -1,16 +0,0 @@
1
- /**
2
- * bookmark form
3
- */
4
- import BookmarkForm from './ssh-form'
5
- import FtpFormUi from './ftp-form-ui'
6
-
7
- export default class FtpForm extends BookmarkForm {
8
- render () {
9
- return (
10
- <FtpFormUi
11
- {...this.props}
12
- {...this.getProps()}
13
- />
14
- )
15
- }
16
- }
@@ -1,39 +0,0 @@
1
- import { Input } from 'antd'
2
- import { useState } from 'react'
3
- import {
4
- CheckOutlined
5
- } from '@ant-design/icons'
6
-
7
- export const HexInput = (props) => {
8
- const [v, setV] = useState(props.value.replace('#', ''))
9
- const handleChange = (event) => {
10
- const vv = event.target.value
11
- const hexRegex = /^[0-9a-fA-F]{0,6}$/
12
- if (hexRegex.test(vv)) {
13
- setV(vv)
14
- }
15
- }
16
- function submit () {
17
- props.onChange('#' + v)
18
- }
19
- function renderAfter () {
20
- if (!/^[0-9a-fA-F]{6}$/.test(v)) {
21
- return null
22
- }
23
- return (
24
- <CheckOutlined
25
- className='pointer'
26
- onClick={submit}
27
- />
28
- )
29
- }
30
- return (
31
- <Input
32
- addonBefore='#'
33
- {...props}
34
- value={v}
35
- onChange={handleChange}
36
- addonAfter={renderAfter()}
37
- />
38
- )
39
- }