Remove cache dependency
This commit is contained in:
parent
77be1cd869
commit
26db79d421
|
@ -12,7 +12,7 @@
|
||||||
export let columns
|
export let columns
|
||||||
export let fromRelationshipField
|
export let fromRelationshipField
|
||||||
|
|
||||||
const { datasource, dispatch, cache, config } = getContext("grid")
|
const { datasource, dispatch, config } = getContext("grid")
|
||||||
|
|
||||||
$: canSetRelationshipSchemas = $config.canSetRelationshipSchemas
|
$: canSetRelationshipSchemas = $config.canSetRelationshipSchemas
|
||||||
|
|
||||||
|
@ -114,29 +114,19 @@
|
||||||
return { ...c, options }
|
return { ...c, options }
|
||||||
})
|
})
|
||||||
|
|
||||||
let relationshipPanelColumns = []
|
$: relationshipPanelColumns = Object.entries(
|
||||||
async function fetchRelationshipPanelColumns(relationshipField) {
|
relationshipField?.columns || {}
|
||||||
relationshipPanelColumns = []
|
).map(([name, column]) => {
|
||||||
if (!relationshipField) {
|
return {
|
||||||
return
|
name: name,
|
||||||
|
label: name,
|
||||||
|
schema: {
|
||||||
|
type: column.type,
|
||||||
|
visible: column.visible,
|
||||||
|
readonly: column.readonly,
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
})
|
||||||
const table = await cache.actions.getTable(relationshipField.tableId)
|
|
||||||
relationshipPanelColumns = Object.entries(
|
|
||||||
relationshipField?.columns || {}
|
|
||||||
).map(([name, column]) => {
|
|
||||||
return {
|
|
||||||
name: name,
|
|
||||||
label: name,
|
|
||||||
schema: {
|
|
||||||
type: table.schema[name].type,
|
|
||||||
visible: column.visible,
|
|
||||||
readonly: column.readonly,
|
|
||||||
},
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
$: fetchRelationshipPanelColumns(relationshipField)
|
|
||||||
|
|
||||||
async function toggleColumn(column, permission) {
|
async function toggleColumn(column, permission) {
|
||||||
const visible = permission !== FieldPermissions.HIDDEN
|
const visible = permission !== FieldPermissions.HIDDEN
|
||||||
|
|
Loading…
Reference in New Issue