@electerm/electerm-react 3.9.15 → 3.11.0

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 (33) hide show
  1. package/client/common/bookmark-schemas.js +164 -0
  2. package/client/common/default-setting.js +3 -2
  3. package/client/common/ws.js +25 -6
  4. package/client/common/zod.js +180 -0
  5. package/client/components/ai/agent-tool-call-card.jsx +90 -0
  6. package/client/components/ai/agent-tools.js +193 -0
  7. package/client/components/ai/agent.js +159 -0
  8. package/client/components/ai/ai-chat-entry.jsx +11 -0
  9. package/client/components/ai/ai-chat-history-item.jsx +48 -2
  10. package/client/components/ai/ai-chat.jsx +25 -6
  11. package/client/components/ai/ai-config.jsx +54 -5
  12. package/client/components/ai/ai.styl +73 -0
  13. package/client/components/batch-op/batch-op-runner.jsx +1 -2
  14. package/client/components/bookmark-form/common/bookmark-group-tree-format.js +1 -1
  15. package/client/components/bookmark-form/common/bookmark-select.jsx +1 -1
  16. package/client/components/bookmark-form/tree-select.jsx +1 -1
  17. package/client/components/main/main.jsx +3 -3
  18. package/client/components/rdp/file-transfer.js +3 -0
  19. package/client/components/setting-panel/setting-terminal.jsx +12 -0
  20. package/client/components/setting-panel/start-session-select.jsx +1 -1
  21. package/client/components/terminal/drop-file-modal.jsx +3 -3
  22. package/client/components/terminal/terminal-apis.js +8 -0
  23. package/client/components/terminal/terminal-error-handle.jsx +1 -1
  24. package/client/components/terminal/terminal-interactive-ui.jsx +157 -0
  25. package/client/components/terminal/terminal-interactive.jsx +65 -125
  26. package/client/components/terminal/terminal.jsx +28 -14
  27. package/client/components/terminal-info/base.jsx +25 -14
  28. package/client/components/terminal-info/log-path-edit.jsx +86 -0
  29. package/client/components/terminal-info/terminal-info-entry.jsx +11 -0
  30. package/client/components/text-editor/text-editor-entry.jsx +11 -0
  31. package/client/components/widgets/widget-form.jsx +30 -2
  32. package/client/entry/worker.js +9 -5
  33. package/package.json +1 -1
@@ -0,0 +1,11 @@
1
+ import { lazy, Suspense } from 'react'
2
+
3
+ const TextEditor = lazy(() => import('./text-editor'))
4
+
5
+ export default function TextEditorEntry (props) {
6
+ return (
7
+ <Suspense fallback={null}>
8
+ <TextEditor {...props} />
9
+ </Suspense>
10
+ )
11
+ }
@@ -2,9 +2,10 @@
2
2
  * Widget form component
3
3
  */
4
4
  import React, { useState, useEffect } from 'react'
5
- import { Form, Input, InputNumber, Switch, Select, Button, Tooltip, Alert } from 'antd'
5
+ import { Form, Input, InputNumber, Switch, Select, Button, Tooltip, Alert, Space } from 'antd'
6
6
  import { formItemLayout, tailFormItemLayout } from '../../common/form-layout'
7
7
  import HelpIcon from '../common/help-icon'
8
+ import { nanoid } from 'nanoid'
8
9
  import BatchOpEditor from '../batch-op/batch-op-editor'
9
10
 
10
11
  export default function WidgetForm ({ widget, onSubmit, loading, hasRunningInstance }) {
@@ -43,12 +44,39 @@ export default function WidgetForm ({ widget, onSubmit, loading, hasRunningInsta
43
44
  }
44
45
 
45
46
  const renderFormItem = (config) => {
46
- const { name, type, description, choices } = config
47
+ const { name, type, description, choices, showGenerator } = config
47
48
  let control = null
48
49
 
49
50
  switch (type) {
50
51
  case 'string':
51
52
  control = <Input placeholder={description} />
53
+ if (showGenerator) {
54
+ return (
55
+ <Form.Item
56
+ key={name}
57
+ {...formItemLayout}
58
+ label={name}
59
+ tooltip={description}
60
+ >
61
+ <Space.Compact style={{ width: '100%' }}>
62
+ <Form.Item
63
+ noStyle
64
+ name={name}
65
+ >
66
+ <Input placeholder={description} />
67
+ </Form.Item>
68
+ <Button
69
+ onClick={() => form.setFieldValue(name, 'ett_' + nanoid())}
70
+ >
71
+ Generate
72
+ </Button>
73
+ </Space.Compact>
74
+ </Form.Item>
75
+ )
76
+ }
77
+ break
78
+ case 'textarea':
79
+ control = <Input.TextArea autoSize={{ minRows: 3 }} placeholder={description} />
52
80
  break
53
81
  case 'number':
54
82
  control = <InputNumber style={{ width: '100%' }} placeholder={description} />
@@ -114,7 +114,10 @@ async function onMsg (e) {
114
114
  } else if (action === 'addEventListener') {
115
115
  const ws = self.insts[wsId]
116
116
  if (ws) {
117
- ws.cb = (e) => {
117
+ if (!ws.cbs) {
118
+ ws.cbs = {}
119
+ }
120
+ const cb = (e) => {
118
121
  send({
119
122
  wsId,
120
123
  id,
@@ -123,13 +126,14 @@ async function onMsg (e) {
123
126
  }
124
127
  })
125
128
  }
126
- ws.addEventListener(type, ws.cb)
129
+ ws.cbs[id] = cb
130
+ ws.addEventListener(type, cb)
127
131
  }
128
132
  } else if (action === 'removeEventListener') {
129
133
  const ws = self.insts[wsId]
130
- if (ws) {
131
- ws.removeEventListener(type, ws.cb)
132
- delete ws.cb
134
+ if (ws && ws.cbs && ws.cbs[id]) {
135
+ ws.removeEventListener(type, ws.cbs[id])
136
+ delete ws.cbs[id]
133
137
  }
134
138
  }
135
139
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@electerm/electerm-react",
3
- "version": "3.9.15",
3
+ "version": "3.11.0",
4
4
  "description": "react components src for electerm",
5
5
  "main": "./client/components/main/main.jsx",
6
6
  "license": "MIT",