@electerm/electerm-react 2.8.6 → 2.8.7

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.
@@ -100,7 +100,7 @@ export default function AIConfigForm ({ initialValues, onSubmit, showAIConfig })
100
100
  className='ai-config-form'
101
101
  >
102
102
  <Form.Item label='API URL' required>
103
- <Space.Compact block>
103
+ <Space.Compact className='width-100'>
104
104
  <Form.Item
105
105
  label='API URL'
106
106
  name='baseURLAI'
@@ -18,7 +18,7 @@ export default function renderRunScripts () {
18
18
  <>
19
19
  <Space
20
20
  align='baseline'
21
- block
21
+ className='width-100'
22
22
  key={field.key}
23
23
  >
24
24
  <FormItem
@@ -0,0 +1,75 @@
1
+ /**
2
+ * Custom Upload component that uses Electron's native file dialog
3
+ * This replaces antd Upload to get absolute file paths instead of browser-based file selection
4
+ */
5
+
6
+ import { PureComponent } from 'react'
7
+ import { getLocalFileInfo } from '../sftp/file-read'
8
+
9
+ /**
10
+ * Open a single file select dialog
11
+ * @returns {Promise<Object|null>} - File object with path info or null if cancelled
12
+ */
13
+ const openFileSelect = async () => {
14
+ const properties = [
15
+ 'openFile',
16
+ 'showHiddenFiles',
17
+ 'noResolveAliases',
18
+ 'treatPackageAsDirectory',
19
+ 'dontAddToRecent'
20
+ ]
21
+ const files = await window.api.openDialog({
22
+ title: 'Choose a file',
23
+ message: 'Choose a file',
24
+ properties
25
+ }).catch(() => false)
26
+ if (!files || !files.length) {
27
+ return null
28
+ }
29
+ const filePath = files[0]
30
+ const stat = await getLocalFileInfo(filePath)
31
+ return { ...stat, filePath, path: filePath }
32
+ }
33
+
34
+ /**
35
+ * Custom Upload component
36
+ * Uses Electron's native file dialog for file selection
37
+ * API compatible with antd Upload for the use cases in this project
38
+ */
39
+ export default class Upload extends PureComponent {
40
+ handleClick = async () => {
41
+ const { beforeUpload, disabled } = this.props
42
+ if (disabled) {
43
+ return
44
+ }
45
+ const file = await openFileSelect()
46
+ if (!file) {
47
+ return
48
+ }
49
+ if (beforeUpload) {
50
+ beforeUpload(file)
51
+ }
52
+ }
53
+
54
+ render () {
55
+ const {
56
+ children,
57
+ className,
58
+ style,
59
+ disabled
60
+ } = this.props
61
+
62
+ return (
63
+ <div
64
+ className={className}
65
+ style={style}
66
+ onClick={this.handleClick}
67
+ role='button'
68
+ tabIndex={disabled ? -1 : 0}
69
+ aria-disabled={disabled}
70
+ >
71
+ {children}
72
+ </div>
73
+ )
74
+ }
75
+ }
@@ -20,9 +20,8 @@ export default function renderQm () {
20
20
  return (
21
21
  <Space.Compact
22
22
  align='center'
23
- block
23
+ className='width-100 mg2b'
24
24
  key={field.key}
25
- className='mg2b'
26
25
  >
27
26
  <Space.Addon>{e('delay')}</Space.Addon>
28
27
  <FormItem
@@ -69,7 +69,7 @@ export default auto(function WorkspaceSaveModal ({ store }) {
69
69
  width={400}
70
70
  >
71
71
  <div className='pd1y'>
72
- <Space direction='vertical' block>
72
+ <Space direction='vertical' className='width-100'>
73
73
  <Radio.Group
74
74
  value={saveMode}
75
75
  onChange={ev => setSaveMode(ev.target.value)}
@@ -130,7 +130,7 @@ export default class TerminalInfoBase extends Component {
130
130
  terminalInfos
131
131
  } = this.props
132
132
  return (
133
- <Space.Compact block>
133
+ <Space.Compact className='width-100'>
134
134
  {
135
135
  defaults.terminalInfos.map(f => {
136
136
  const type = terminalInfos.includes(f) ? 'primary' : 'default'
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@electerm/electerm-react",
3
- "version": "2.8.6",
3
+ "version": "2.8.7",
4
4
  "description": "react components src for electerm",
5
5
  "main": "./client/components/main/main.jsx",
6
6
  "license": "MIT",