mirror of
https://github.com/h-sphere/sql-seal-charts.git
synced 2026-07-22 05:37:34 +00:00
fix: added global configs to the advanced mode
This commit is contained in:
parent
4416495b79
commit
c9237858f7
3 changed files with 10 additions and 3 deletions
5
.changeset/moody-candies-post.md
Normal file
5
.changeset/moody-candies-post.md
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
---
|
||||
"sqlseal-charts": patch
|
||||
---
|
||||
|
||||
fixed issue with configs not being exposed in ADVANCED MODE
|
||||
|
|
@ -91,7 +91,7 @@ export class ChartRenderer implements RendererConfig {
|
|||
let parsedConfig: Object = {}
|
||||
if (isAdvancedMode) {
|
||||
try {
|
||||
parsedConfig = parseCodeAdvanced({ functions, variables: allVariables }, config.config)
|
||||
parsedConfig = parseCodeAdvanced({ functions, variables, configs: globalVariables }, config.config)
|
||||
} catch (e) {
|
||||
console.error(e)
|
||||
throw e
|
||||
|
|
|
|||
|
|
@ -3,14 +3,16 @@ import { uniqBy } from "lodash"
|
|||
type Params = {
|
||||
functions: Record<string, any>,
|
||||
variables: Record<string, any>
|
||||
configs: Record<string, any>
|
||||
}
|
||||
|
||||
export const parseCodeAdvanced = ({ functions, variables }: Params, code: string) => {
|
||||
export const parseCodeAdvanced = ({ functions, variables, configs }: Params, code: string) => {
|
||||
const { keys, values } = uniqBy([
|
||||
...Object.entries(functions),
|
||||
...Object.entries({
|
||||
data: variables.data,
|
||||
columns: variables.columns
|
||||
columns: variables.columns,
|
||||
...configs
|
||||
})
|
||||
], 0).reduce(({ keys, values}, [key, value]) => ({
|
||||
keys: [...keys, key],
|
||||
|
|
|
|||
Loading…
Reference in a new issue