mirror of
https://github.com/dbgate/dbgate
synced 2024-11-07 20:26:23 +00:00
perspective designer - checking columns
This commit is contained in:
parent
1a16d7c69e
commit
e124291267
@ -100,26 +100,32 @@
|
|||||||
>
|
>
|
||||||
{#if settings?.allowColumnOperations}
|
{#if settings?.allowColumnOperations}
|
||||||
<CheckboxField
|
<CheckboxField
|
||||||
checked={!!(designer.columns || []).find(
|
checked={settings?.isColumnChecked
|
||||||
x => x.designerId == designerId && x.columnName == column.columnName && x.isOutput
|
? settings?.isColumnChecked(designerId, column.columnName)
|
||||||
)}
|
: !!(designer.columns || []).find(
|
||||||
|
x => x.designerId == designerId && x.columnName == column.columnName && x.isOutput
|
||||||
|
)}
|
||||||
on:change={e => {
|
on:change={e => {
|
||||||
if (e.target.checked) {
|
if (settings?.setColumnChecked) {
|
||||||
onChangeColumn(
|
settings?.setColumnChecked(designerId, column.columnName, e.target.checked);
|
||||||
{
|
|
||||||
...column,
|
|
||||||
designerId,
|
|
||||||
},
|
|
||||||
col => ({ ...col, isOutput: true })
|
|
||||||
);
|
|
||||||
} else {
|
} else {
|
||||||
onChangeColumn(
|
if (e.target.checked) {
|
||||||
{
|
onChangeColumn(
|
||||||
...column,
|
{
|
||||||
designerId,
|
...column,
|
||||||
},
|
designerId,
|
||||||
col => ({ ...col, isOutput: false })
|
},
|
||||||
);
|
col => ({ ...col, isOutput: true })
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
onChangeColumn(
|
||||||
|
{
|
||||||
|
...column,
|
||||||
|
designerId,
|
||||||
|
},
|
||||||
|
col => ({ ...col, isOutput: false })
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
|
@ -90,6 +90,24 @@
|
|||||||
return [{ text: 'Remove', onClick: () => onRemoveReference(reference) }];
|
return [{ text: 'Remove', onClick: () => onRemoveReference(reference) }];
|
||||||
},
|
},
|
||||||
createReferenceText: reference => (reference.isAutoGenerated ? 'FK' : 'Custom'),
|
createReferenceText: reference => (reference.isAutoGenerated ? 'FK' : 'Custom'),
|
||||||
|
isColumnChecked: (designerId, columnName) => {
|
||||||
|
return config.nodes.find(x => x.designerId == designerId)?.checkedColumns?.includes(columnName);
|
||||||
|
},
|
||||||
|
setColumnChecked: (designerId, columnName, value) => {
|
||||||
|
onChange(cfg => ({
|
||||||
|
...cfg,
|
||||||
|
nodes: cfg.nodes.map(node =>
|
||||||
|
node.designerId == designerId
|
||||||
|
? {
|
||||||
|
...node,
|
||||||
|
checkedColumns: value
|
||||||
|
? [...(node.checkedColumns || []), columnName]
|
||||||
|
: (node.checkedColumns || []).filter(x => x != columnName),
|
||||||
|
}
|
||||||
|
: node
|
||||||
|
),
|
||||||
|
}));
|
||||||
|
},
|
||||||
}}
|
}}
|
||||||
referenceComponent={QueryDesignerReference}
|
referenceComponent={QueryDesignerReference}
|
||||||
value={createDesignerModel(config, dbInfos)}
|
value={createDesignerModel(config, dbInfos)}
|
||||||
|
Loading…
Reference in New Issue
Block a user