fix: 设置页工作区下拉改为 select,不再只剩一个选项
This commit is contained in:
@@ -431,22 +431,32 @@ window.__ModuleLoader__.load({
|
|||||||
)
|
)
|
||||||
: null
|
: 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(
|
const workspaceRow = h(
|
||||||
'div',
|
'div',
|
||||||
{ style: { display: 'grid', gridTemplateColumns: '2fr 1fr', gap: 12, marginTop: 16 } },
|
{ style: { display: 'grid', gridTemplateColumns: '2fr 1fr', gap: 12, marginTop: 16 } },
|
||||||
h(
|
h(
|
||||||
Field,
|
Field,
|
||||||
{ label: DICTS.zh.workspace, hint: DICTS.zh.workspaceHint },
|
{ label: DICTS.zh.workspace, hint: DICTS.zh.workspaceHint },
|
||||||
h('input', {
|
h(
|
||||||
style: inputStyle,
|
'select',
|
||||||
value: workspace,
|
{
|
||||||
list: 'abap-adt-workspaces',
|
style: inputStyle,
|
||||||
onChange: (event) => setWorkspace(event.target.value),
|
value: workspace,
|
||||||
onBlur: () => {
|
onChange: (event) => {
|
||||||
if (workspace && workspace !== file?.path?.replace(/[\\/]\.dsh-abap-adt[\\/].*$/, '')) load(workspace)
|
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(
|
h(
|
||||||
Field,
|
Field,
|
||||||
@@ -457,11 +467,6 @@ window.__ModuleLoader__.load({
|
|||||||
file?.path ? `${file.path}${file.exists ? '' : DICTS.zh.notExists}` : DICTS.zh.never,
|
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
|
const destinationCards = destinations.length
|
||||||
|
|||||||
Reference in New Issue
Block a user