mirror of
https://github.com/olehomelchenko/astrolabe.git
synced 2026-08-08 02:02:33 +00:00
Modal system: break import cycles — component map moves to the shell
This commit is contained in:
@@ -56,7 +56,7 @@ import {
|
||||
type TimeUnit,
|
||||
} from '@core/chart-builder';
|
||||
import { referencedFields, validateExpression } from '@core/expr-validate';
|
||||
import { tabularRows } from '@core/dataset';
|
||||
import { cellText, tabularRows } from '@core/dataset';
|
||||
import type { ColumnType } from '@core/type-inference';
|
||||
import { DatasetNotFoundError, prepareSpecForRender } from '@core/rendering';
|
||||
import { chartConfigFor } from '@core/vega-themes';
|
||||
@@ -179,13 +179,6 @@ const PREVIEW_ROW_LIMIT = 50;
|
||||
*/
|
||||
const VEGA_EXPRESSION_DOCS_URL = 'https://vega.github.io/vega/docs/expressions/';
|
||||
|
||||
/** One preview cell's text: blank for empty, the string as-is, else JSON. */
|
||||
function cellText(value: unknown): string {
|
||||
if (value == null) return '';
|
||||
if (typeof value === 'string') return value;
|
||||
return JSON.stringify(value);
|
||||
}
|
||||
|
||||
/** A safe `datum` accessor for a column name (dot for identifiers, bracket otherwise). */
|
||||
function datumRef(name: string): string {
|
||||
return /^[A-Za-z_$][\w$]*$/.test(name) ? `datum.${name}` : `datum[${JSON.stringify(name)}]`;
|
||||
@@ -1425,7 +1418,10 @@ export function ChartBuilderModal() {
|
||||
className={`${styles.action} ${styles.primary}`}
|
||||
disabled={!valid}
|
||||
aria-describedby={!valid ? 'cb-create-hint' : undefined}
|
||||
onClick={() => runCreate()}
|
||||
// The create is the user's confirmation — close with no discard prompt.
|
||||
onClick={() => {
|
||||
if (runCreate()) void closeModal(true);
|
||||
}}
|
||||
>
|
||||
Create Snippet
|
||||
</button>
|
||||
|
||||
Reference in New Issue
Block a user