perspective designer - checking columns

This commit is contained in:
Jan Prochazka 2022-08-27 12:27:07 +02:00
parent 1a16d7c69e
commit e124291267
2 changed files with 42 additions and 18 deletions

View File

@ -100,10 +100,15 @@
>
{#if settings?.allowColumnOperations}
<CheckboxField
checked={!!(designer.columns || []).find(
checked={settings?.isColumnChecked
? settings?.isColumnChecked(designerId, column.columnName)
: !!(designer.columns || []).find(
x => x.designerId == designerId && x.columnName == column.columnName && x.isOutput
)}
on:change={e => {
if (settings?.setColumnChecked) {
settings?.setColumnChecked(designerId, column.columnName, e.target.checked);
} else {
if (e.target.checked) {
onChangeColumn(
{
@ -121,6 +126,7 @@
col => ({ ...col, isOutput: false })
);
}
}
}}
/>
{/if}

View File

@ -90,6 +90,24 @@
return [{ text: 'Remove', onClick: () => onRemoveReference(reference) }];
},
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}
value={createDesignerModel(config, dbInfos)}