Update how grid blocks handle visible columns to ensure conditions work on hidden columns
This commit is contained in:
parent
7faa6188c4
commit
94fec5b62b
|
@ -42,7 +42,6 @@
|
|||
$: currentTheme = $context?.device?.theme
|
||||
$: darkMode = !currentTheme?.includes("light")
|
||||
$: parsedColumns = getParsedColumns(columns)
|
||||
$: columnWhitelist = parsedColumns.filter(x => x.active).map(x => x.field)
|
||||
$: schemaOverrides = getSchemaOverrides(parsedColumns)
|
||||
$: enrichedButtons = enrichButtons(buttons)
|
||||
$: selectedRows = deriveSelectedRows(gridContext)
|
||||
|
@ -98,6 +97,7 @@
|
|||
displayName: column.label,
|
||||
order: idx,
|
||||
conditions: column.conditions,
|
||||
visible: !!column.active,
|
||||
}
|
||||
if (column.width) {
|
||||
overrides[column.field].width = column.width
|
||||
|
@ -170,7 +170,6 @@
|
|||
{initialSortColumn}
|
||||
{initialSortOrder}
|
||||
{fixedRowHeight}
|
||||
{columnWhitelist}
|
||||
{schemaOverrides}
|
||||
canAddRows={allowAddRows}
|
||||
canEditRows={allowEditRows}
|
||||
|
|
|
@ -37,7 +37,6 @@
|
|||
export let API = null
|
||||
export let datasource = null
|
||||
export let schemaOverrides = null
|
||||
export let columnWhitelist = null
|
||||
export let canAddRows = true
|
||||
export let canExpandRows = true
|
||||
export let canEditRows = true
|
||||
|
@ -94,7 +93,6 @@
|
|||
$: props.set({
|
||||
datasource,
|
||||
schemaOverrides,
|
||||
columnWhitelist,
|
||||
canAddRows,
|
||||
canExpandRows,
|
||||
canEditRows,
|
||||
|
|
|
@ -12,7 +12,6 @@ export const createStores = context => {
|
|||
const initialFilter = getProp("initialFilter")
|
||||
const fixedRowHeight = getProp("fixedRowHeight")
|
||||
const schemaOverrides = getProp("schemaOverrides")
|
||||
const columnWhitelist = getProp("columnWhitelist")
|
||||
const notifySuccess = getProp("notifySuccess")
|
||||
const notifyError = getProp("notifyError")
|
||||
const rowConditions = getProp("rowConditions")
|
||||
|
@ -24,7 +23,6 @@ export const createStores = context => {
|
|||
initialFilter,
|
||||
fixedRowHeight,
|
||||
schemaOverrides,
|
||||
columnWhitelist,
|
||||
notifySuccess,
|
||||
notifyError,
|
||||
rowConditions,
|
||||
|
|
|
@ -13,14 +13,8 @@ export const createStores = () => {
|
|||
}
|
||||
|
||||
export const deriveStores = context => {
|
||||
const {
|
||||
API,
|
||||
definition,
|
||||
schemaOverrides,
|
||||
columnWhitelist,
|
||||
datasource,
|
||||
schemaMutations,
|
||||
} = context
|
||||
const { API, definition, schemaOverrides, datasource, schemaMutations } =
|
||||
context
|
||||
|
||||
const schema = derived(definition, $definition => {
|
||||
let schema = getDatasourceSchema({
|
||||
|
@ -46,17 +40,13 @@ export const deriveStores = context => {
|
|||
// Derives the total enriched schema, made up of the saved schema and any
|
||||
// prop and user overrides
|
||||
const enrichedSchema = derived(
|
||||
[schema, schemaOverrides, schemaMutations, columnWhitelist],
|
||||
([$schema, $schemaOverrides, $schemaMutations, $columnWhitelist]) => {
|
||||
[schema, schemaOverrides, schemaMutations],
|
||||
([$schema, $schemaOverrides, $schemaMutations]) => {
|
||||
if (!$schema) {
|
||||
return null
|
||||
}
|
||||
let enrichedSchema = {}
|
||||
Object.keys($schema).forEach(field => {
|
||||
// Apply whitelist if provided
|
||||
if ($columnWhitelist?.length && !$columnWhitelist.includes(field)) {
|
||||
return
|
||||
}
|
||||
enrichedSchema[field] = {
|
||||
...$schema[field],
|
||||
...$schemaOverrides?.[field],
|
||||
|
|
Loading…
Reference in New Issue