@electerm/electerm-react 1.40.20 → 1.50.21

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 (96) 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 +26 -0
  18. package/client/components/layout/layout.jsx +167 -0
  19. package/client/components/layout/layout.styl +5 -0
  20. package/client/components/layout/layouts.jsx +71 -0
  21. package/client/components/layout/session-size-alg.js +31 -0
  22. package/client/components/main/main.jsx +183 -109
  23. package/client/components/main/wrapper.styl +2 -4
  24. package/client/components/profile/profile-list.jsx +1 -3
  25. package/client/components/profile/profile-transport-mod.jsx +1 -1
  26. package/client/components/profile/profile-transport.jsx +6 -9
  27. package/client/components/quick-commands/quick-command-transport.jsx +6 -9
  28. package/client/components/quick-commands/quick-commands-box.jsx +144 -153
  29. package/client/components/quick-commands/quick-commands-select.jsx +10 -3
  30. package/client/components/rdp/rdp-session.jsx +3 -23
  31. package/client/components/rdp/resolution-edit.jsx +40 -42
  32. package/client/components/session/session.jsx +62 -317
  33. package/client/components/session/session.styl +1 -5
  34. package/client/components/session/sessions.jsx +99 -105
  35. package/client/components/setting-panel/bookmark-tree-list.jsx +1 -1
  36. package/client/components/setting-panel/setting-common.jsx +6 -4
  37. package/client/components/setting-panel/setting-modal.jsx +31 -31
  38. package/client/components/setting-panel/start-session-select.jsx +4 -4
  39. package/client/components/setting-panel/tab-settings.jsx +27 -5
  40. package/client/components/setting-sync/data-import.jsx +36 -39
  41. package/client/components/setting-sync/setting-sync-form.jsx +9 -9
  42. package/client/components/setting-sync/setting-sync.jsx +50 -52
  43. package/client/components/sftp/address-bookmark.jsx +57 -58
  44. package/client/components/sftp/confirm-modal-store.jsx +34 -40
  45. package/client/components/sftp/file-item.jsx +14 -3
  46. package/client/components/sftp/file-mode-modal.jsx +3 -0
  47. package/client/components/sftp/list-table-ui.jsx +4 -4
  48. package/client/components/sftp/sftp-entry.jsx +2 -2
  49. package/client/components/sftp/transfer-conflict-store.jsx +13 -17
  50. package/client/components/sftp/transport-action-store.jsx +38 -31
  51. package/client/components/sftp/transports-action-store.jsx +3 -3
  52. package/client/components/sftp/transports-ui-store.jsx +18 -23
  53. package/client/components/shortcuts/shortcut-handler.js +1 -0
  54. package/client/components/shortcuts/shortcuts.jsx +9 -12
  55. package/client/components/side-panel-r/right-side-panel.styl +40 -0
  56. package/client/components/side-panel-r/side-panel-r.jsx +102 -0
  57. package/client/components/sidebar/bookmark-select.jsx +40 -40
  58. package/client/components/sidebar/bookmark.jsx +63 -65
  59. package/client/components/sidebar/history.jsx +53 -50
  60. package/client/components/sidebar/index.jsx +195 -184
  61. package/client/components/sidebar/info-modal.jsx +202 -202
  62. package/client/components/sidebar/sidebar.styl +8 -2
  63. package/client/components/sidebar/transfer-history-modal.jsx +95 -100
  64. package/client/components/sidebar/transfer-list-control.jsx +2 -2
  65. package/client/components/sidebar/transfer-list.jsx +45 -42
  66. package/client/components/sidebar/transfer-modal.jsx +49 -52
  67. package/client/components/sidebar/transport-ui.jsx +1 -1
  68. package/client/components/tabs/index.jsx +261 -49
  69. package/client/components/tabs/tab.jsx +60 -65
  70. package/client/components/tabs/tabs.styl +6 -1
  71. package/client/components/tabs/window-control.jsx +46 -48
  72. package/client/components/terminal/index.jsx +101 -104
  73. package/client/components/terminal/term-search.jsx +26 -24
  74. package/client/components/terminal-info/run-cmd.jsx +0 -25
  75. package/client/components/terminal-info/terminal-info.jsx +60 -0
  76. package/client/components/terminal-info/terminal-info.styl +1 -1
  77. package/client/components/tree-list/bookmark-transport.jsx +8 -9
  78. package/client/components/tree-list/tree-list.jsx +36 -26
  79. package/client/components/vnc/vnc-session.jsx +1 -6
  80. package/client/store/common.js +1 -1
  81. package/client/store/event.js +2 -2
  82. package/client/store/index.js +21 -32
  83. package/client/store/init-state.js +15 -3
  84. package/client/store/load-data.js +1 -1
  85. package/client/store/quick-command.js +4 -4
  86. package/client/store/session.js +1 -1
  87. package/client/store/setting.js +9 -5
  88. package/client/store/system-menu.js +1 -10
  89. package/client/store/tab.js +66 -1
  90. package/client/store/transfer-list.js +5 -6
  91. package/client/store/watch.js +11 -6
  92. package/package.json +1 -1
  93. package/client/components/common/react-subx.jsx +0 -1
  94. package/client/components/common/resize-wrap.jsx +0 -222
  95. package/client/components/common/resize-wrap.styl +0 -9
  96. package/client/components/terminal-info/content.jsx +0 -152
@@ -2,7 +2,7 @@
2
2
  * quick commands footer selection wrap
3
3
  */
4
4
 
5
- import { Component } from '../common/react-subx'
5
+ import { useState, useRef } from 'react'
6
6
  import { quickCommandLabelsLsKey } from '../../common/constants'
7
7
  import { sortBy } from 'lodash-es'
8
8
  import { Button, Input, Select, Space } from 'antd'
@@ -14,41 +14,40 @@ import {
14
14
  PushpinOutlined
15
15
  } from '@ant-design/icons'
16
16
  import classNames from 'classnames'
17
- import onDrop from './on-drop'
17
+ import onDropFunc from './on-drop'
18
18
  import './qm.styl'
19
19
 
20
20
  const e = window.translate
21
21
  const addQuickCommands = 'addQuickCommands'
22
22
  const { Option } = Select
23
23
 
24
- export default class QuickCommandsFooterBox extends Component {
25
- state = {
26
- keyword: '',
27
- labels: ls.getItemJSON(quickCommandLabelsLsKey, [])
28
- }
24
+ export default function QuickCommandsFooterBox (props) {
25
+ const [keyword, setKeyword] = useState('')
26
+ const [labels, setLabels] = useState(ls.getItemJSON(quickCommandLabelsLsKey, []))
27
+ const timer = useRef(null)
29
28
 
30
- handleMouseLeave = () => {
31
- this.timer = setTimeout(() => {
32
- this.toggle(false)
29
+ function handleMouseLeave () {
30
+ timer.current = setTimeout(() => {
31
+ toggle(false)
33
32
  }, 500)
34
33
  }
35
34
 
36
- handleMouseEnter = () => {
37
- clearTimeout(this.timer)
35
+ function handleMouseEnter () {
36
+ clearTimeout(timer.current)
38
37
  }
39
38
 
40
- toggle = (openQuickCommandBar) => {
41
- this.props.store.openQuickCommandBar = openQuickCommandBar
39
+ function toggle (openQuickCommandBar) {
40
+ window.store.openQuickCommandBar = openQuickCommandBar
42
41
  }
43
42
 
44
- handleTogglePinned = () => {
45
- this.props.store.pinnedQuickCommandBar = !this.props.store.pinnedQuickCommandBar
43
+ function handleTogglePinned () {
44
+ window.store.pinnedQuickCommandBar = !window.store.pinnedQuickCommandBar
46
45
  }
47
46
 
48
- handleSelect = async (id) => {
47
+ async function handleSelect (id) {
49
48
  const {
50
49
  store
51
- } = this.props
50
+ } = window
52
51
  if (id === addQuickCommands) {
53
52
  store.handleOpenQuickCommandsSetting()
54
53
  } else {
@@ -56,50 +55,45 @@ export default class QuickCommandsFooterBox extends Component {
56
55
  }
57
56
  }
58
57
 
59
- handleClose = () => {
60
- this.props.store.pinnedQuickCommandBar = false
61
- this.props.store.openQuickCommandBar = false
58
+ function handleClose () {
59
+ window.store.pinnedQuickCommandBar = false
60
+ window.store.openQuickCommandBar = false
62
61
  }
63
62
 
64
- handleChange = e => {
65
- this.setState({
66
- keyword: e.target.value
67
- })
63
+ function handleChange (e) {
64
+ setKeyword(e.target.value)
68
65
  }
69
66
 
70
- handleChangeLabels = (v) => {
67
+ function handleChangeLabels (v) {
71
68
  ls.setItemJSON(quickCommandLabelsLsKey, v)
72
- this.setState({
73
- labels: v
74
- })
69
+ setLabels(v)
75
70
  }
76
71
 
77
- filterFunc = (v, opt) => {
78
- const c = opt.props.children.toLowerCase()
79
- const m = opt.props.cmd.toLowerCase()
80
- const vv = v.toLowerCase()
81
- return c.includes(vv) || m.includes(vv)
82
- }
72
+ // function filterFunc (v, opt) {
73
+ // const c = opt.props.children.toLowerCase()
74
+ // const m = opt.props.cmd.toLowerCase()
75
+ // const vv = v.toLowerCase()
76
+ // return c.includes(vv) || m.includes(vv)
77
+ // }
83
78
 
84
- onDragOver = e => {
79
+ function onDragOver (e) {
85
80
  e.preventDefault()
86
81
  }
87
82
 
88
- onDragStart = e => {
83
+ function onDragStart (e) {
89
84
  e.dataTransfer.setData('idDragged', e.target.getAttribute('data-id'))
90
85
  }
91
86
 
92
- // sort quick commands array when drop, so that the dragged item will be placed at the right position, e.target.getAttribute('data-id') would target item id, e.dataTransfer.getData('idDragged') would target dragged item id, then set window.store.quickCommands use window.store.setItems
93
- onDrop = e => {
94
- onDrop(e, '.qm-item')
87
+ function onDrop (e) {
88
+ onDropFunc(e, '.qm-item')
95
89
  }
96
90
 
97
- renderNoCmd = () => {
91
+ function renderNoCmd () {
98
92
  return (
99
93
  <div className='pd1'>
100
94
  <Button
101
95
  type='primary'
102
- onClick={this.props.store.handleOpenQuickCommandsSetting}
96
+ onClick={window.store.handleOpenQuickCommandsSetting}
103
97
  >
104
98
  {e(addQuickCommands)}
105
99
  </Button>
@@ -107,24 +101,24 @@ export default class QuickCommandsFooterBox extends Component {
107
101
  )
108
102
  }
109
103
 
110
- renderItem = (item) => {
104
+ function renderItem (item) {
111
105
  const {
112
106
  qmSortByFrequency
113
- } = this.props.store
107
+ } = props
114
108
  return (
115
109
  <CmdItem
116
110
  item={item}
117
111
  key={item.id}
118
- onSelect={this.handleSelect}
112
+ onSelect={handleSelect}
119
113
  draggable={!qmSortByFrequency}
120
- handleDragOver={this.onDragOver}
121
- handleDragStart={this.onDragStart}
122
- handleDrop={this.onDrop}
114
+ handleDragOver={onDragOver}
115
+ handleDragStart={onDragStart}
116
+ handleDrop={onDrop}
123
117
  />
124
118
  )
125
119
  }
126
120
 
127
- renderTag = tag => {
121
+ function renderTag (tag) {
128
122
  return (
129
123
  <Option
130
124
  value={tag}
@@ -135,7 +129,7 @@ export default class QuickCommandsFooterBox extends Component {
135
129
  )
136
130
  }
137
131
 
138
- sortArray (array, keyword, labels, qmSortByFrequency) {
132
+ function sortArray (array, keyword, labels, qmSortByFrequency) {
139
133
  const sorters = [
140
134
  (obj) => !(keyword && obj.name.toLowerCase().includes(keyword)),
141
135
  (obj) => !labels.some((label) => (obj.labels || []).includes(label))
@@ -146,113 +140,110 @@ export default class QuickCommandsFooterBox extends Component {
146
140
  return sortBy(array, sorters)
147
141
  }
148
142
 
149
- render () {
150
- const {
151
- openQuickCommandBar,
152
- pinnedQuickCommandBar,
153
- qmSortByFrequency,
154
- inActiveTerminal,
155
- leftSidebarWidth,
156
- openedSideBar
157
- } = this.props.store
158
- if ((!openQuickCommandBar && !pinnedQuickCommandBar) || !inActiveTerminal) {
159
- return null
160
- }
161
- const all = this.props.store.currentQuickCommands
162
- if (!all.length) {
163
- return this.renderNoCmd()
164
- }
165
- const keyword = this.state.keyword.toLowerCase()
166
- const { labels } = this.state
167
- const filtered = this.sortArray(all, keyword, labels, qmSortByFrequency)
168
- .map(d => {
169
- return {
170
- ...d,
171
- nameMatch: keyword && d.name.toLowerCase().includes(keyword),
172
- labelMatch: labels.some((label) => (d.labels || []).includes(label))
173
- }
174
- })
175
- const sprops = {
176
- value: labels,
177
- mode: 'multiple',
178
- onChange: this.handleChangeLabels,
179
- placeholder: e('labels'),
180
- className: 'iblock',
181
- style: {
182
- minWidth: '100px'
143
+ const {
144
+ openQuickCommandBar,
145
+ pinnedQuickCommandBar,
146
+ qmSortByFrequency,
147
+ inActiveTerminal,
148
+ leftSidebarWidth,
149
+ openedSideBar
150
+ } = props
151
+ if ((!openQuickCommandBar && !pinnedQuickCommandBar) || !inActiveTerminal) {
152
+ return null
153
+ }
154
+ const all = props.currentQuickCommands
155
+ if (!all.length) {
156
+ return renderNoCmd()
157
+ }
158
+ const keyword0 = keyword.toLowerCase()
159
+ const filtered = sortArray(all, keyword0, labels, qmSortByFrequency)
160
+ .map(d => {
161
+ return {
162
+ ...d,
163
+ nameMatch: keyword && d.name.toLowerCase().includes(keyword),
164
+ labelMatch: labels.some((label) => (d.labels || []).includes(label))
183
165
  }
166
+ })
167
+ const sprops = {
168
+ value: labels,
169
+ mode: 'multiple',
170
+ onChange: handleChangeLabels,
171
+ placeholder: e('labels'),
172
+ className: 'iblock',
173
+ style: {
174
+ minWidth: '100px'
184
175
  }
185
- const tp = pinnedQuickCommandBar
186
- ? 'primary'
187
- : 'ghost'
188
- const cls = classNames(
189
- 'qm-list-wrap',
190
- { 'fil-label': !!this.state.labels.length },
191
- { 'fil-keyword': !!keyword }
192
- )
193
- const type = qmSortByFrequency ? 'primary' : 'default'
194
- const w = openedSideBar ? 43 + leftSidebarWidth : 43
195
- const qmProps = {
196
- className: 'qm-wrap-tooltip',
197
- style: {
198
- left: w
199
- },
200
- onMouseLeave: this.handleMouseLeave,
201
- onMouseEnter: this.handleMouseEnter
202
- }
203
- return (
204
- <div
205
- {...qmProps}
206
- >
207
- <div className='pd2'>
208
- <div className='pd2b fix'>
209
- <span className='fleft'>
210
- <Input.Search
211
- value={this.state.keyword}
212
- onChange={this.handleChange}
213
- placeholder=''
214
- className='iblock qm-search-input'
176
+ }
177
+ const tp = pinnedQuickCommandBar
178
+ ? 'primary'
179
+ : 'ghost'
180
+ const cls = classNames(
181
+ 'qm-list-wrap',
182
+ { 'fil-label': !!labels.length },
183
+ { 'fil-keyword': !!keyword }
184
+ )
185
+ const type = qmSortByFrequency ? 'primary' : 'default'
186
+ const w = openedSideBar ? 43 + leftSidebarWidth : 43
187
+ const qmProps = {
188
+ className: 'qm-wrap-tooltip',
189
+ style: {
190
+ left: w
191
+ },
192
+ onMouseLeave: handleMouseLeave,
193
+ onMouseEnter: handleMouseEnter
194
+ }
195
+ return (
196
+ <div
197
+ {...qmProps}
198
+ >
199
+ <div className='pd2'>
200
+ <div className='pd2b fix'>
201
+ <span className='fleft'>
202
+ <Input.Search
203
+ value={keyword}
204
+ onChange={handleChange}
205
+ placeholder=''
206
+ className='iblock qm-search-input'
207
+ />
208
+ </span>
209
+ <span className='fleft mg1l'>
210
+ <Select
211
+ {...sprops}
212
+ >
213
+ {props.quickCommandTags.map(
214
+ renderTag
215
+ )}
216
+ </Select>
217
+ <Button
218
+ className='mg1l iblock'
219
+ type={type}
220
+ onClick={window.store.handleSortByFrequency}
221
+ >
222
+ {e('sortByFrequency')}
223
+ </Button>
224
+ </span>
225
+ <span className='fright'>
226
+ <Space.Compact>
227
+ <Button
228
+ onClick={handleTogglePinned}
229
+ icon={<PushpinOutlined />}
230
+ type={tp}
231
+ />
232
+ <Button
233
+ onClick={window.store.handleOpenQuickCommandsSetting}
234
+ icon={<EditOutlined />}
215
235
  />
216
- </span>
217
- <span className='fleft mg1l'>
218
- <Select
219
- {...sprops}
220
- >
221
- {this.props.store.quickCommandTags.map(
222
- this.renderTag
223
- )}
224
- </Select>
225
236
  <Button
226
- className='mg1l iblock'
227
- type={type}
228
- onClick={this.props.store.handleSortByFrequency}
229
- >
230
- {e('sortByFrequency')}
231
- </Button>
232
- </span>
233
- <span className='fright'>
234
- <Space.Compact>
235
- <Button
236
- onClick={this.handleTogglePinned}
237
- icon={<PushpinOutlined />}
238
- type={tp}
239
- />
240
- <Button
241
- onClick={this.props.store.handleOpenQuickCommandsSetting}
242
- icon={<EditOutlined />}
243
- />
244
- <Button
245
- onClick={this.handleClose}
246
- icon={<CloseCircleOutlined />}
247
- />
248
- </Space.Compact>
249
- </span>
250
- </div>
251
- <div className={cls}>
252
- {filtered.map(this.renderItem)}
253
- </div>
237
+ onClick={handleClose}
238
+ icon={<CloseCircleOutlined />}
239
+ />
240
+ </Space.Compact>
241
+ </span>
242
+ </div>
243
+ <div className={cls}>
244
+ {filtered.map(renderItem)}
254
245
  </div>
255
246
  </div>
256
- )
257
- }
247
+ </div>
248
+ )
258
249
  }
@@ -9,6 +9,11 @@ import './qm.styl'
9
9
  const e = window.translate
10
10
 
11
11
  export default class QuickCommandsFooter extends PureComponent {
12
+ componentWillUnmount () {
13
+ clearTimeout(this.timer)
14
+ this.timer = null
15
+ }
16
+
12
17
  handleOpen = () => {
13
18
  this.timer = setTimeout(this.act, 500)
14
19
  }
@@ -23,11 +28,13 @@ export default class QuickCommandsFooter extends PureComponent {
23
28
 
24
29
  render () {
25
30
  return (
26
- <div className='fleft relative'>
31
+ <div
32
+ className='fleft relative'
33
+ onMouseEnter={this.handleOpen}
34
+ onMouseLeave={this.handleMouseLeave}
35
+ >
27
36
  <Button
28
37
  size='small'
29
- onMouseEnter={this.handleOpen}
30
- onMouseLeave={this.handleMouseLeave}
31
38
  type='ghost'
32
39
  >
33
40
  <span className='w500'>{e('quickCommands')}</span>
@@ -1,4 +1,4 @@
1
- import { Component } from '../common/react-subx'
1
+ import { PureComponent } from 'react'
2
2
  import { createTerm } from '../terminal/terminal-apis'
3
3
  import deepCopy from 'json-deep-copy'
4
4
  import clone from '../../common/to-simple-obj'
@@ -22,7 +22,7 @@ import resolutions from './resolutions'
22
22
 
23
23
  const { Option } = Select
24
24
 
25
- export default class RdpSession extends Component {
25
+ export default class RdpSession extends PureComponent {
26
26
  constructor (props) {
27
27
  const id = `rdp-reso-${props.tab.host}`
28
28
  const resObj = ls.getItemJSON(id, resolutions[0])
@@ -55,21 +55,6 @@ export default class RdpSession extends Component {
55
55
  })
56
56
  }
57
57
 
58
- computeProps = () => {
59
- const {
60
- height,
61
- width,
62
- tabsHeight,
63
- leftSidebarWidth,
64
- pinned,
65
- openedSideBar
66
- } = this.props
67
- return {
68
- width: width - (pinned && openedSideBar ? leftSidebarWidth : 0) - 42,
69
- height: height - tabsHeight
70
- }
71
- }
72
-
73
58
  remoteInit = async (term = this.term) => {
74
59
  this.setState({
75
60
  loading: true
@@ -202,8 +187,6 @@ export default class RdpSession extends Component {
202
187
  }
203
188
 
204
189
  handleCanvasEvent = e => {
205
- // e.preventDefault()
206
- // console.log('e', e)
207
190
  const {
208
191
  type,
209
192
  clientX,
@@ -215,7 +198,6 @@ export default class RdpSession extends Component {
215
198
  } = e.target.getBoundingClientRect()
216
199
  const x = clientX - left
217
200
  const y = clientY - top
218
- // console.log('x,y', x, y, left, top, clientX, clientY, pageX, pageY)
219
201
  const keyCode = this.getKeyCode(e)
220
202
  const action = type.startsWith('key')
221
203
  ? 'sendKeyEventScancode'
@@ -230,7 +212,6 @@ export default class RdpSession extends Component {
230
212
  const isHorizontal = false
231
213
  const delta = isHorizontal ? e.deltaX : e.deltaY
232
214
  const step = Math.round(Math.abs(delta) * 15 / 8)
233
- // console.log(x, y, step, delta, isHorizontal)
234
215
  params = [x, y, step, delta > 0, isHorizontal]
235
216
  } else if (type === 'keydown' || type === 'keyup') {
236
217
  params = [keyCode, pressed]
@@ -242,7 +223,6 @@ export default class RdpSession extends Component {
242
223
  }
243
224
 
244
225
  onData = async (msg) => {
245
- // console.log('msg', msg.data)
246
226
  let { data } = msg
247
227
  data = JSON.parse(data)
248
228
  if (data.action === 'session-rdp-connected') {
@@ -409,7 +389,7 @@ export default class RdpSession extends Component {
409
389
  }
410
390
 
411
391
  render () {
412
- const { width: w, height: h } = this.computeProps()
392
+ const { width: w, height: h } = this.props
413
393
  const rdpProps = {
414
394
  style: {
415
395
  width: w + 'px',
@@ -1,63 +1,61 @@
1
- import { Component } from '../common/react-subx'
1
+ // import { memo } from 'react'
2
2
  import ResolutionForm from './resolution-form'
3
3
  import {
4
4
  Modal
5
5
  } from 'antd'
6
6
  import uid from '../../common/uid'
7
7
 
8
- export default class Resolutions extends Component {
9
- remove = id => {
10
- const { store } = this.props
11
- const { resolutions } = store
8
+ export default function Resolutions (props) {
9
+ function remove (id) {
10
+ const { resolutions } = props
12
11
  const index = resolutions.findIndex(d => d.id === id)
13
12
  if (index < 0) {
14
13
  return
15
14
  }
16
15
  resolutions.splice(index, 1)
17
- store.setState('resolutions', resolutions)
16
+ window.store.setState('resolutions', resolutions)
18
17
  }
19
18
 
20
- submit = (data) => {
21
- const { store } = this.props
22
- const { resolutions } = store
19
+ function submit (data) {
20
+ const { resolutions } = props
23
21
  resolutions.push({
24
22
  ...data,
25
23
  id: uid()
26
24
  })
27
- store.setState('resolutions', resolutions)
25
+ window.store.setState('resolutions', resolutions)
28
26
  }
29
27
 
30
- render () {
31
- const {
32
- openResolutionEdit,
33
- toggleResolutionEdit,
34
- resolutions
35
- } = this.props.store
36
- if (!openResolutionEdit) {
37
- return null
38
- }
39
- const modalProps = {
40
- footer: null,
41
- visible: true,
42
- onCancel: () => toggleResolutionEdit()
43
- }
44
- const resList = {
45
- list: resolutions,
46
- initialValues: {
47
- width: 1600,
48
- height: 900
49
- },
50
- remove: this.remove,
51
- submit: this.submit
52
- }
53
- return (
54
- <Modal
55
- {...modalProps}
56
- >
57
- <ResolutionForm
58
- {...resList}
59
- />
60
- </Modal>
61
- )
28
+ const {
29
+ resolutions
30
+ } = props
31
+ const {
32
+ openResolutionEdit,
33
+ toggleResolutionEdit
34
+ } = window.store
35
+ if (!openResolutionEdit) {
36
+ return null
37
+ }
38
+ const modalProps = {
39
+ footer: null,
40
+ visible: true,
41
+ onCancel: () => toggleResolutionEdit()
42
+ }
43
+ const resList = {
44
+ list: resolutions,
45
+ initialValues: {
46
+ width: 1600,
47
+ height: 900
48
+ },
49
+ remove,
50
+ submit
62
51
  }
52
+ return (
53
+ <Modal
54
+ {...modalProps}
55
+ >
56
+ <ResolutionForm
57
+ {...resList}
58
+ />
59
+ </Modal>
60
+ )
63
61
  }