fix: 设置页工作区下拉改为 select,不再只剩一个选项
This commit is contained in:
@@ -431,23 +431,33 @@ window.__ModuleLoader__.load({
|
||||
)
|
||||
: null
|
||||
|
||||
const workspacePaths = workspaces.map((item) => item.path).filter(Boolean)
|
||||
const workspaceOptions =
|
||||
workspace && !workspacePaths.includes(workspace) ? [workspace, ...workspacePaths] : workspacePaths
|
||||
const workspaceTitles = Object.fromEntries(workspaces.map((item) => [item.path, item.title]))
|
||||
const workspaceRow = h(
|
||||
'div',
|
||||
{ style: { display: 'grid', gridTemplateColumns: '2fr 1fr', gap: 12, marginTop: 16 } },
|
||||
h(
|
||||
Field,
|
||||
{ label: DICTS.zh.workspace, hint: DICTS.zh.workspaceHint },
|
||||
h('input', {
|
||||
h(
|
||||
'select',
|
||||
{
|
||||
style: inputStyle,
|
||||
value: workspace,
|
||||
list: 'abap-adt-workspaces',
|
||||
onChange: (event) => setWorkspace(event.target.value),
|
||||
onBlur: () => {
|
||||
if (workspace && workspace !== file?.path?.replace(/[\\/]\.dsh-abap-adt[\\/].*$/, '')) load(workspace)
|
||||
onChange: (event) => {
|
||||
const next = event.target.value
|
||||
setWorkspace(next)
|
||||
if (next) load(next)
|
||||
},
|
||||
placeholder: 'D:\\AIagent\\SAP',
|
||||
},
|
||||
workspaceOptions.map((path) => {
|
||||
const title = workspaceTitles[path]
|
||||
return h('option', { key: path, value: path }, title && title !== path ? title + ' — ' + path : path)
|
||||
}),
|
||||
),
|
||||
),
|
||||
h(
|
||||
Field,
|
||||
{ label: DICTS.zh.fileLabel },
|
||||
@@ -457,11 +467,6 @@ window.__ModuleLoader__.load({
|
||||
file?.path ? `${file.path}${file.exists ? '' : DICTS.zh.notExists}` : DICTS.zh.never,
|
||||
),
|
||||
),
|
||||
h(
|
||||
'datalist',
|
||||
{ id: 'abap-adt-workspaces' },
|
||||
workspaces.map((item) => h('option', { key: item.id || item.path, value: item.path }, item.title)),
|
||||
),
|
||||
)
|
||||
|
||||
const destinationCards = destinations.length
|
||||
|
||||
Reference in New Issue
Block a user