Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
import { Registry, makeSingleton, OverwritePolicy } from '@superset-ui/core';
import { QueryContext } from '@superset-ui/query';
// Ideally this would be
type BuildQuery = (formData: any) => QueryContext;
class ChartBuildQueryRegistry extends Registry {
constructor() {
super({ name: 'ChartBuildQuery', overwritePolicy: OverwritePolicy.WARN });
}
}
const getInstance = makeSingleton(ChartBuildQueryRegistry);
export default getInstance;
import { Registry, makeSingleton, OverwritePolicy } from '@superset-ui/core';
import ChartMetadata from '../models/ChartMetadata';
class ChartMetadataRegistry extends Registry {
constructor() {
super({ name: 'ChartMetadata', overwritePolicy: OverwritePolicy.WARN });
}
}
const getInstance = makeSingleton(ChartMetadataRegistry);
export default getInstance;
import { Registry, makeSingleton, OverwritePolicy } from '@superset-ui/core';
import { TransformProps } from '../types/TransformFunction';
class ChartTransformPropsRegistry extends Registry {
constructor() {
super({ name: 'ChartTransformProps', overwritePolicy: OverwritePolicy.WARN });
}
}
const getInstance = makeSingleton(ChartTransformPropsRegistry);
export default getInstance;
import { Registry, makeSingleton, OverwritePolicy } from '@superset-ui/core';
import { ChartType } from '../models/ChartPlugin';
class ChartComponentRegistry extends Registry {
constructor() {
super({ name: 'ChartComponent', overwritePolicy: OverwritePolicy.WARN });
}
}
const getInstance = makeSingleton(ChartComponentRegistry);
export default getInstance;
import { makeSingleton } from '@superset-ui/core';
import NumberFormatterRegistry from './NumberFormatterRegistry';
const getInstance = makeSingleton(NumberFormatterRegistry);
export default getInstance;
export function getNumberFormatter(format: string) {
return getInstance().get(format);
}
export function formatNumber(format: string, value: number | null | undefined) {
return getInstance().format(format, value);
}
import { makeSingleton } from '@superset-ui/core';
import ColorSchemeRegistry from './ColorSchemeRegistry';
import SequentialScheme from './SequentialScheme';
import schemes from './colorSchemes/sequential/d3';
class SequentialSchemeRegistry extends ColorSchemeRegistry {
constructor() {
super();
this.registerValue('SUPERSET_DEFAULT', schemes[0]);
}
}
const getInstance = makeSingleton(SequentialSchemeRegistry);
export default getInstance;
import { makeSingleton } from '@superset-ui/core';
import CategoricalScheme from './CategoricalScheme';
import ColorSchemeRegistry from './ColorSchemeRegistry';
import schemes from './colorSchemes/categorical/d3';
class CategoricalSchemeRegistry extends ColorSchemeRegistry {
constructor() {
super();
this.registerValue('SUPERSET_DEFAULT', schemes[0]);
}
}
const getInstance = makeSingleton(CategoricalSchemeRegistry);
export default getInstance;
import { makeSingleton } from '@superset-ui/core';
import TimeFormatterRegistry from './TimeFormatterRegistry';
const getInstance = makeSingleton(TimeFormatterRegistry);
export default getInstance;
export function getTimeFormatter(formatId: string) {
return getInstance().get(formatId);
}
export function formatTime(formatId: string, value: Date | null | undefined) {
return getInstance().format(formatId, value);
}