mirror of
https://github.com/h-sphere/sql-seal-charts.git
synced 2026-07-22 12:00:28 +00:00
Merge pull request #12 from h-sphere/fix/global-config-in-advanced-mode
Fix: global config in advanced mode
This commit is contained in:
commit
7c854f22b6
5 changed files with 14 additions and 9 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
|
||||
|
|
|
|||
|
|
@ -82,7 +82,7 @@ export class SQLSealChartsSettingTab extends PluginSettingTab {
|
|||
const headerRow = thead.createEl('tr');
|
||||
headerRow.createEl('th', { text: 'Name' });
|
||||
headerRow.createEl('th', { text: 'Preview' });
|
||||
headerRow.createEl('th', { text: 'Actions' });
|
||||
headerRow.createEl('th', { text: '' });
|
||||
|
||||
// Table body
|
||||
const tbody = table.createEl('tbody');
|
||||
|
|
|
|||
|
|
@ -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],
|
||||
|
|
|
|||
|
|
@ -134,11 +134,13 @@
|
|||
|
||||
.sqlseal-config-actions {
|
||||
white-space: nowrap;
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
.sqlseal-action-button {
|
||||
padding: 4px 12px;
|
||||
margin-right: 8px;
|
||||
border: none;
|
||||
border-radius: var(--radius-s);
|
||||
cursor: pointer;
|
||||
|
|
@ -146,10 +148,6 @@
|
|||
transition: background-color 0.2s ease;
|
||||
}
|
||||
|
||||
.sqlseal-action-button:last-child {
|
||||
margin-right: 0;
|
||||
}
|
||||
|
||||
.sqlseal-empty-state {
|
||||
text-align: center;
|
||||
color: var(--text-muted);
|
||||
|
|
|
|||
Loading…
Reference in a new issue