@devtable/dashboard 2.5.0 → 2.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/api-caller/index.d.ts +26 -0
- package/dist/api-caller/request.d.ts +5 -0
- package/dist/api-caller/types.d.ts +11 -0
- package/dist/contexts/dashboard-action-context.d.ts +9 -0
- package/dist/contexts/index.d.ts +3 -0
- package/dist/contexts/layout-state-context.d.ts +11 -0
- package/dist/contexts/model-context.d.ts +24165 -0
- package/dist/contexts/panel-context.d.ts +16 -0
- package/dist/dashboard.es.js +1696 -1644
- package/dist/dashboard.umd.js +16 -16
- package/dist/definition-editor/data-editor-modal.d.ts +7 -0
- package/dist/definition-editor/global-variables-guide.d.ts +8 -0
- package/dist/definition-editor/index.d.ts +1 -0
- package/dist/definition-editor/query-editor/data-preview.d.ts +4 -0
- package/dist/definition-editor/query-editor/editor.d.ts +7 -0
- package/dist/definition-editor/query-editor/form.d.ts +7 -0
- package/dist/definition-editor/query-editor/index.d.ts +5 -0
- package/dist/definition-editor/query-editor/preview-sql.d.ts +6 -0
- package/dist/definition-editor/query-editor/select-or-add-query.d.ts +7 -0
- package/dist/definition-editor/sql-snippet-editor/editor.d.ts +5 -0
- package/dist/definition-editor/sql-snippet-editor/index.d.ts +5 -0
- package/dist/definition-editor/sql-snippet-editor/preview-snippet.d.ts +6 -0
- package/dist/filter/filter-checkbox/editor.d.ts +8 -0
- package/dist/filter/filter-checkbox/render.d.ts +10 -0
- package/dist/filter/filter-date-range/editor.d.ts +7 -0
- package/dist/filter/filter-date-range/render.d.ts +10 -0
- package/dist/filter/filter-multi-select/editor.d.ts +7 -0
- package/dist/filter/filter-multi-select/render.d.ts +10 -0
- package/dist/filter/filter-query-field/index.d.ts +8 -0
- package/dist/filter/filter-query-field/select-data-source.d.ts +8 -0
- package/dist/filter/filter-query-field/test-query.d.ts +7 -0
- package/dist/filter/filter-select/editor.d.ts +7 -0
- package/dist/filter/filter-select/render.d.ts +10 -0
- package/dist/filter/filter-settings/filter-setting.d.ts +8 -0
- package/dist/filter/filter-settings/filter-settings.d.ts +5 -0
- package/dist/filter/filter-settings/index.d.ts +7 -0
- package/dist/filter/filter-settings/preview-filter.d.ts +7 -0
- package/dist/filter/filter-text-input/editor.d.ts +7 -0
- package/dist/filter/filter-text-input/render.d.ts +10 -0
- package/dist/filter/filter.d.ts +9 -0
- package/dist/filter/index.d.ts +5 -0
- package/dist/index.d.ts +6 -0
- package/dist/layout/index.d.ts +12 -0
- package/dist/layout/read-only.d.ts +9 -0
- package/dist/main/actions.d.ts +12 -0
- package/dist/main/full-screen-panel.d.ts +6 -0
- package/dist/main/index.d.ts +2 -0
- package/dist/main/main.d.ts +12 -0
- package/dist/main/read-only.d.ts +11 -0
- package/dist/main/toggle-mode.d.ts +8 -0
- package/dist/main/use-panel-full-screen.d.ts +7 -0
- package/dist/main/use-sticky-area-style.d.ts +1 -0
- package/dist/main/view-schema-modal.d.ts +8 -0
- package/dist/model/context.d.ts +11 -0
- package/dist/model/dashboard.d.ts +15998 -0
- package/dist/model/filters/filter/checkbox.d.ts +16 -0
- package/dist/model/filters/filter/common.d.ts +14 -0
- package/dist/model/filters/filter/date-range.d.ts +28 -0
- package/dist/model/filters/filter/index.d.ts +172 -0
- package/dist/model/filters/filter/multi-select.d.ts +81 -0
- package/dist/model/filters/filter/select.d.ts +95 -0
- package/dist/model/filters/filter/text-input.d.ts +22 -0
- package/dist/model/filters/index.d.ts +3542 -0
- package/dist/model/index.d.ts +5 -0
- package/dist/model/queries/index.d.ts +116 -0
- package/dist/model/queries/mute-query.d.ts +17 -0
- package/dist/model/queries/query.d.ts +31 -0
- package/dist/model/queries/types.d.ts +5 -0
- package/dist/model/sql-snippets/index.d.ts +26 -0
- package/dist/model/sql-snippets/sql-snippet.d.ts +9 -0
- package/dist/panel/error-boundary.d.ts +13 -0
- package/dist/panel/index.d.ts +7 -0
- package/dist/panel/panel-description.d.ts +5 -0
- package/dist/panel/settings/common/aggregation-selector.d.ts +9 -0
- package/dist/panel/settings/common/color-array-input.d.ts +8 -0
- package/dist/panel/settings/common/data-field-selector.d.ts +12 -0
- package/dist/panel/settings/common/mantine-color.d.ts +7 -0
- package/dist/panel/settings/common/mantine-font-weight.d.ts +8 -0
- package/dist/panel/settings/common/numbro-format-selector.d.ts +13 -0
- package/dist/panel/settings/common/text-array-input.d.ts +8 -0
- package/dist/panel/settings/index.d.ts +7 -0
- package/dist/panel/settings/panel-config/description.d.ts +2 -0
- package/dist/panel/settings/panel-config/index.d.ts +5 -0
- package/dist/panel/settings/panel-config/preview-panel.d.ts +2 -0
- package/dist/panel/settings/panel-config/title.d.ts +2 -0
- package/dist/panel/settings/pick-query/index.d.ts +5 -0
- package/dist/panel/settings/viz-config/index.d.ts +5 -0
- package/dist/panel/settings/viz-config/preview-viz.d.ts +5 -0
- package/dist/panel/settings/viz-config/viz-conf.d.ts +2 -0
- package/dist/panel/title-bar.d.ts +5 -0
- package/dist/panel/viz/bar-3d/index.d.ts +9 -0
- package/dist/panel/viz/bar-3d/panel.d.ts +3 -0
- package/dist/panel/viz/cartesian/index.d.ts +10 -0
- package/dist/panel/viz/cartesian/option/regression.d.ts +20 -0
- package/dist/panel/viz/cartesian/panel/index.d.ts +3 -0
- package/dist/panel/viz/cartesian/panel/regressions/index.d.ts +11 -0
- package/dist/panel/viz/cartesian/panel/regressions/regression-item.d.ts +16 -0
- package/dist/panel/viz/cartesian/panel/series/fields.bar.d.ts +9 -0
- package/dist/panel/viz/cartesian/panel/series/fields.line.d.ts +9 -0
- package/dist/panel/viz/cartesian/panel/series/fields.scatter.d.ts +9 -0
- package/dist/panel/viz/cartesian/panel/series/index.d.ts +11 -0
- package/dist/panel/viz/cartesian/panel/series/series-item.d.ts +16 -0
- package/dist/panel/viz/cartesian/panel/stats/index.d.ts +10 -0
- package/dist/panel/viz/cartesian/panel/stats/variable.d.ts +11 -0
- package/dist/panel/viz/cartesian/panel/y-axes.d.ts +9 -0
- package/dist/panel/viz/cartesian/type.d.ts +58 -0
- package/dist/panel/viz/index.d.ts +9 -0
- package/dist/panel/viz/pie/index.d.ts +9 -0
- package/dist/panel/viz/pie/panel.d.ts +3 -0
- package/dist/panel/viz/rich-text/index.d.ts +10 -0
- package/dist/panel/viz/rich-text/panel.d.ts +3 -0
- package/dist/panel/viz/rich-text/type.d.ts +8 -0
- package/dist/panel/viz/stats/index.d.ts +10 -0
- package/dist/panel/viz/stats/panel/index.d.ts +10 -0
- package/dist/panel/viz/stats/panel/variable.d.ts +11 -0
- package/dist/panel/viz/stats/panel/variables.d.ts +10 -0
- package/dist/panel/viz/stats/types.d.ts +6 -0
- package/dist/panel/viz/stats/update/index.d.ts +15 -0
- package/dist/panel/viz/sunburst/index.d.ts +9 -0
- package/dist/panel/viz/sunburst/panel.d.ts +3 -0
- package/dist/panel/viz/table/index.d.ts +10 -0
- package/dist/panel/viz/table/panel.d.ts +3 -0
- package/dist/panel/viz/table/type.d.ts +21 -0
- package/dist/panel/viz/table/value-type-selector.d.ts +10 -0
- package/dist/panel/viz/table/value.d.ts +8 -0
- package/dist/plugins/json-plugin-storage.d.ts +8 -0
- package/dist/plugins/message-channels.d.ts +8 -0
- package/dist/plugins/plugin-context.d.ts +12 -0
- package/dist/plugins/plugin-manager.d.ts +18 -0
- package/dist/plugins/viz-manager/components.d.ts +23 -0
- package/dist/plugins/viz-manager/impl.d.ts +10 -0
- package/dist/plugins/viz-manager/index.d.ts +3 -0
- package/dist/plugins/viz-manager/types.d.ts +12 -0
- package/dist/style.css +1 -1
- package/dist/types/dashboard.d.ts +41 -0
- package/dist/types/filter.d.ts +7 -0
- package/dist/types/index.d.ts +3 -0
- package/dist/types/plugin/index.d.ts +97 -0
- package/dist/types/viz-panel.d.ts +6 -0
- package/dist/utils/aggregation.d.ts +2 -0
- package/dist/utils/color-mapping.d.ts +9 -0
- package/dist/utils/download.d.ts +6 -0
- package/dist/utils/sql.d.ts +9 -0
- package/dist/utils/template/editor.d.ts +16 -0
- package/dist/utils/template/render.d.ts +3 -0
- package/dist/utils/template/types.d.ts +21 -0
- package/dist/vite-env.d.ts +1 -0
- package/package.json +3 -2
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { IRichTextConf } from './type';
|
|
3
|
+
interface IRichText {
|
|
4
|
+
conf: IRichTextConf;
|
|
5
|
+
data: any[];
|
|
6
|
+
width: number;
|
|
7
|
+
height: number;
|
|
8
|
+
}
|
|
9
|
+
export declare function VizRichText({ conf, width, height }: IRichText): JSX.Element | null;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { IVizStatsConf } from './types';
|
|
3
|
+
interface IVizStats {
|
|
4
|
+
conf: IVizStatsConf;
|
|
5
|
+
data: any;
|
|
6
|
+
width: number;
|
|
7
|
+
height: number;
|
|
8
|
+
}
|
|
9
|
+
export declare function VizStats({ conf: { template, variables, align }, data }: IVizStats): JSX.Element;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { IVizPanelProps } from '../../../../types/viz-panel';
|
|
3
|
+
import { IVizStatsConf } from '../types';
|
|
4
|
+
import { ILegacyStatsConf } from '../update';
|
|
5
|
+
interface IVizStatsPanel extends Omit<IVizPanelProps, 'conf' | 'setConf'> {
|
|
6
|
+
conf: IVizStatsConf | ILegacyStatsConf;
|
|
7
|
+
setConf: (conf: IVizStatsConf) => void;
|
|
8
|
+
}
|
|
9
|
+
export declare function VizStatsPanel({ conf, setConf, data }: IVizStatsPanel): JSX.Element;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { Control, UseFieldArrayRemove } from 'react-hook-form';
|
|
3
|
+
import { IVizStatsConf } from '../types';
|
|
4
|
+
interface VariableField {
|
|
5
|
+
control: Control<IVizStatsConf, any>;
|
|
6
|
+
index: number;
|
|
7
|
+
remove: UseFieldArrayRemove;
|
|
8
|
+
data: any[];
|
|
9
|
+
}
|
|
10
|
+
export declare function VariableField({ control, index, remove, data }: VariableField): JSX.Element;
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { Control, UseFormWatch } from 'react-hook-form';
|
|
3
|
+
import { IVizStatsConf } from '../types';
|
|
4
|
+
interface IVariablesField {
|
|
5
|
+
control: Control<IVizStatsConf, any>;
|
|
6
|
+
watch: UseFormWatch<IVizStatsConf>;
|
|
7
|
+
data: any[];
|
|
8
|
+
}
|
|
9
|
+
export declare function VariablesField({ control, watch, data }: IVariablesField): JSX.Element;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { TNumbroFormat } from '../../../settings/common/numbro-format-selector';
|
|
2
|
+
import { IVizStatsConf } from '../types';
|
|
3
|
+
export interface ILegacyStatsConf {
|
|
4
|
+
align: 'center';
|
|
5
|
+
size: string;
|
|
6
|
+
weight: string;
|
|
7
|
+
color: any;
|
|
8
|
+
content: {
|
|
9
|
+
prefix: string;
|
|
10
|
+
data_field: string;
|
|
11
|
+
formatter: TNumbroFormat;
|
|
12
|
+
postfix: string;
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
export declare function updateSchema(legacyConf: IVizStatsConf | ILegacyStatsConf): IVizStatsConf;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { ITableConf } from './type';
|
|
3
|
+
interface IVizTable {
|
|
4
|
+
conf: ITableConf;
|
|
5
|
+
data: any;
|
|
6
|
+
width: number;
|
|
7
|
+
height: number;
|
|
8
|
+
}
|
|
9
|
+
export declare function VizTable({ conf, data, width, height }: IVizTable): JSX.Element;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export declare enum ValueType {
|
|
2
|
+
string = "string",
|
|
3
|
+
number = "number",
|
|
4
|
+
eloc = "eloc",
|
|
5
|
+
percentage = "percentage"
|
|
6
|
+
}
|
|
7
|
+
export interface IColumnConf {
|
|
8
|
+
label: string;
|
|
9
|
+
value_field: string;
|
|
10
|
+
value_type: ValueType;
|
|
11
|
+
}
|
|
12
|
+
export interface ITableConf {
|
|
13
|
+
id_field: string;
|
|
14
|
+
use_raw_columns: boolean;
|
|
15
|
+
columns: IColumnConf[];
|
|
16
|
+
fontSize: string;
|
|
17
|
+
horizontalSpacing: string;
|
|
18
|
+
verticalSpacing: string;
|
|
19
|
+
striped: boolean;
|
|
20
|
+
highlightOnHover: boolean;
|
|
21
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { Sx } from '@mantine/core';
|
|
3
|
+
interface IValueTypeSelector {
|
|
4
|
+
label: string;
|
|
5
|
+
value: string;
|
|
6
|
+
onChange: (value: string) => void;
|
|
7
|
+
sx?: Sx;
|
|
8
|
+
}
|
|
9
|
+
export declare function ValueTypeSelector({ label, value, onChange, sx }: IValueTypeSelector): JSX.Element;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { PluginStorage } from '../types/plugin';
|
|
2
|
+
export declare class JsonPluginStorage implements PluginStorage {
|
|
3
|
+
private root;
|
|
4
|
+
constructor(root: Record<string, any>);
|
|
5
|
+
deleteItem(key: string): Promise<void>;
|
|
6
|
+
getItem<T>(key: string): Promise<T>;
|
|
7
|
+
setItem<T>(key: string, item: T): Promise<T>;
|
|
8
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import EventEmitter2 from 'eventemitter2';
|
|
2
|
+
import { IMessageChannels } from '../types/plugin';
|
|
3
|
+
export declare class MessageChannels implements IMessageChannels {
|
|
4
|
+
private channels;
|
|
5
|
+
globalChannel: EventEmitter2;
|
|
6
|
+
getChannel(name: string): EventEmitter2;
|
|
7
|
+
close(name: string): void;
|
|
8
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { IPluginManager } from '../types/plugin';
|
|
3
|
+
import { PluginManager } from './plugin-manager';
|
|
4
|
+
import { VizManager } from './viz-manager';
|
|
5
|
+
interface IPluginContextProps {
|
|
6
|
+
pluginManager: IPluginManager;
|
|
7
|
+
vizManager: VizManager;
|
|
8
|
+
}
|
|
9
|
+
export declare const pluginManager: PluginManager;
|
|
10
|
+
export declare const createPluginContext: () => IPluginContextProps;
|
|
11
|
+
export declare const PluginContext: import("react").Context<IPluginContextProps>;
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { IDashboardPlugin, IPluginManager, VizComponent } from '../types/plugin';
|
|
2
|
+
export declare class PluginManager implements IPluginManager {
|
|
3
|
+
/**
|
|
4
|
+
* Id to plugin map
|
|
5
|
+
* @private
|
|
6
|
+
*/
|
|
7
|
+
private plugins;
|
|
8
|
+
/**
|
|
9
|
+
* Name to component map
|
|
10
|
+
*/
|
|
11
|
+
private vizComponents;
|
|
12
|
+
constructor();
|
|
13
|
+
factory: {
|
|
14
|
+
viz: (name: string) => VizComponent;
|
|
15
|
+
};
|
|
16
|
+
install(plugin: IDashboardPlugin): void;
|
|
17
|
+
get installedPlugins(): IDashboardPlugin[];
|
|
18
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { IPanelInfoEditor } from '../../types/plugin';
|
|
3
|
+
import { IPanelInfo, IVizManager } from './types';
|
|
4
|
+
export declare type IViewPanelInfo = IPanelInfo & {
|
|
5
|
+
layout: {
|
|
6
|
+
w: number;
|
|
7
|
+
h: number;
|
|
8
|
+
};
|
|
9
|
+
};
|
|
10
|
+
export declare type IViewComponentProps<TDebug = {}> = {
|
|
11
|
+
panel: IViewPanelInfo;
|
|
12
|
+
data: any;
|
|
13
|
+
vizManager: IVizManager;
|
|
14
|
+
} & TDebug;
|
|
15
|
+
export declare const VizViewComponent: <T>(props: IViewComponentProps<T>) => JSX.Element;
|
|
16
|
+
declare type IConfigComponentProps<TDebug = {}> = {
|
|
17
|
+
panel: IPanelInfo;
|
|
18
|
+
panelInfoEditor: IPanelInfoEditor;
|
|
19
|
+
vizManager: IVizManager;
|
|
20
|
+
data: any;
|
|
21
|
+
} & TDebug;
|
|
22
|
+
export declare const VizConfigComponent: <T>(props: IConfigComponentProps<T>) => JSX.Element;
|
|
23
|
+
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { IPluginManager, VizComponent } from '../../types/plugin';
|
|
2
|
+
import { IPanelInfo, IVizManager, VizInstanceInfo } from './types';
|
|
3
|
+
export declare class VizManager implements IVizManager {
|
|
4
|
+
private pluginManager;
|
|
5
|
+
private instances;
|
|
6
|
+
constructor(pluginManager: IPluginManager);
|
|
7
|
+
get availableVizList(): VizComponent[];
|
|
8
|
+
resolveComponent(name: string): VizComponent;
|
|
9
|
+
getOrCreateInstance(panel: IPanelInfo): VizInstanceInfo;
|
|
10
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { IDashboardPanel } from '../../types';
|
|
2
|
+
import { IMessageChannels, PluginStorage, VizComponent, VizInstance } from '../../types/plugin';
|
|
3
|
+
export declare type IPanelInfo = Omit<IDashboardPanel, 'layout'>;
|
|
4
|
+
export interface IVizManager {
|
|
5
|
+
readonly availableVizList: VizComponent[];
|
|
6
|
+
resolveComponent(type: string): VizComponent;
|
|
7
|
+
getOrCreateInstance(panel: IPanelInfo): VizInstanceInfo;
|
|
8
|
+
}
|
|
9
|
+
export interface VizInstanceInfo extends VizInstance {
|
|
10
|
+
messageChannels: IMessageChannels;
|
|
11
|
+
instanceData: PluginStorage;
|
|
12
|
+
}
|
package/dist/style.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.viz-root{width:100%;overflow:scroll;padding-top:5px;height:calc(100% - 25px);background-color:#fff}.panel-title-wrapper{text-align:center;transition:background-color .3s ease}.panel-title-wrapper:hover{cursor:pointer;background-color:#6464640d}.panel-root{padding:5px;height:100%;width:100%;max-width:100%;background:transparent;border-radius:5px;box-shadow:0 0 10px #0003}.
|
|
1
|
+
.viz-root{width:100%;overflow:scroll;padding-top:5px;height:calc(100% - 25px);background-color:#fff}.panel-title-wrapper{text-align:center;transition:background-color .3s ease}.panel-title-wrapper:hover{cursor:pointer;background-color:#6464640d}.panel-root{padding:5px;height:100%;width:100%;max-width:100%;background:transparent;border-radius:5px;box-shadow:0 0 10px #0003}.panel-settings-tabs{width:100%;height:100%}.panel-settings-tabs .mantine-Tabs-panel{height:calc(100% - 25px)}.panel-settings-tabs .mantine-Tabs-tabsListWrapper{flex:0}.panel-settings-tabs .mantine-Tabs-body{flex:1;overflow:scroll}.dashboard-layout{margin-left:-10px;margin-right:-10px}.react-grid-item{padding:0}.remove-panel{position:absolute;right:2px;top:0;cursor:pointer}.code-textarea textarea{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace}.filter-settings-tabs{width:100%;height:100%}.filter-settings-tabs .mantine-Tabs-panel{height:calc(100% - 25px)}.filter-settings-tabs .mantine-Tabs-tabsListWrapper{flex:0}.filter-settings-tabs .mantine-Tabs-body{flex:1;overflow:scroll}.dashboard-root{overflow:scroll;padding:0 10px 10px}.dashboard-sticky-area{z-index:100;background:white;margin:0 -10px;padding:0 10px 10px}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { FilterModelInstance } from '../model';
|
|
2
|
+
import { QueryModelInstance } from '../model/queries';
|
|
3
|
+
import { SQLSnippetModelInstance } from '../model/sql-snippets';
|
|
4
|
+
export interface IVizConfig {
|
|
5
|
+
type: string;
|
|
6
|
+
conf: Record<string, any>;
|
|
7
|
+
}
|
|
8
|
+
export interface IDashboardPanel {
|
|
9
|
+
id: string;
|
|
10
|
+
title: string;
|
|
11
|
+
description: string;
|
|
12
|
+
layout: {
|
|
13
|
+
x: number;
|
|
14
|
+
y: number;
|
|
15
|
+
w: number;
|
|
16
|
+
h: number;
|
|
17
|
+
moved?: boolean;
|
|
18
|
+
static?: boolean;
|
|
19
|
+
};
|
|
20
|
+
queryID: string;
|
|
21
|
+
viz: IVizConfig;
|
|
22
|
+
}
|
|
23
|
+
export declare enum DashboardMode {
|
|
24
|
+
Use = "use",
|
|
25
|
+
Layout = "layout",
|
|
26
|
+
Edit = "edit"
|
|
27
|
+
}
|
|
28
|
+
export interface IDashboardDefinition {
|
|
29
|
+
sqlSnippets: SQLSnippetModelInstance[];
|
|
30
|
+
queries: QueryModelInstance[];
|
|
31
|
+
}
|
|
32
|
+
export interface IDashboard {
|
|
33
|
+
id: string;
|
|
34
|
+
name: string;
|
|
35
|
+
definition: IDashboardDefinition;
|
|
36
|
+
panels: IDashboardPanel[];
|
|
37
|
+
filters: FilterModelInstance[];
|
|
38
|
+
}
|
|
39
|
+
export interface IDashboardConfig {
|
|
40
|
+
apiBaseURL: string;
|
|
41
|
+
}
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import EventEmitter2 from 'eventemitter2';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
/**
|
|
4
|
+
* Basic information of a viz component instance
|
|
5
|
+
*/
|
|
6
|
+
export interface VizInstance {
|
|
7
|
+
id: string;
|
|
8
|
+
name: string;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Props to render the view of viz component
|
|
12
|
+
*/
|
|
13
|
+
export interface VizViewProps {
|
|
14
|
+
instance: VizInstance;
|
|
15
|
+
context: VizViewContext;
|
|
16
|
+
}
|
|
17
|
+
export interface PluginStorage {
|
|
18
|
+
getItem<T>(key: string): Promise<T>;
|
|
19
|
+
setItem<T>(key: string, item: T): Promise<T>;
|
|
20
|
+
deleteItem(key: string): Promise<void>;
|
|
21
|
+
}
|
|
22
|
+
export interface ColorPaletteItem {
|
|
23
|
+
name: string;
|
|
24
|
+
type: string;
|
|
25
|
+
category: string;
|
|
26
|
+
}
|
|
27
|
+
export interface SingleColor extends ColorPaletteItem {
|
|
28
|
+
type: 'single';
|
|
29
|
+
value: string;
|
|
30
|
+
}
|
|
31
|
+
export interface ColorInterpolation extends ColorPaletteItem {
|
|
32
|
+
type: 'interpolation';
|
|
33
|
+
interpolation: (value: number) => string;
|
|
34
|
+
}
|
|
35
|
+
export interface ColorPalette {
|
|
36
|
+
getColor(colorInfo: ColorPaletteItem): (value: unknown) => string;
|
|
37
|
+
}
|
|
38
|
+
export interface IMessageChannels {
|
|
39
|
+
globalChannel: EventEmitter2;
|
|
40
|
+
getChannel(name: string): EventEmitter2;
|
|
41
|
+
close(name: string): void;
|
|
42
|
+
}
|
|
43
|
+
export interface VizContext {
|
|
44
|
+
pluginData: PluginStorage;
|
|
45
|
+
instanceData: PluginStorage;
|
|
46
|
+
colorPalette: ColorPalette;
|
|
47
|
+
locale: string;
|
|
48
|
+
msgChannels: IMessageChannels;
|
|
49
|
+
data: unknown;
|
|
50
|
+
}
|
|
51
|
+
declare type Setter<T> = (val: string) => void;
|
|
52
|
+
export interface IPanelInfoEditor {
|
|
53
|
+
setTitle: Setter<string>;
|
|
54
|
+
setDescription: Setter<string>;
|
|
55
|
+
setQueryID: Setter<string>;
|
|
56
|
+
}
|
|
57
|
+
export interface VizConfigContext extends VizContext {
|
|
58
|
+
panelInfoEditor: IPanelInfoEditor;
|
|
59
|
+
}
|
|
60
|
+
export interface VizViewContext extends VizContext {
|
|
61
|
+
viewport: {
|
|
62
|
+
width: number;
|
|
63
|
+
height: number;
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
export interface VizConfigProps {
|
|
67
|
+
instance: VizInstance;
|
|
68
|
+
context: VizConfigContext;
|
|
69
|
+
}
|
|
70
|
+
export interface VizComponentMigrationContext {
|
|
71
|
+
pluginData: PluginStorage;
|
|
72
|
+
instanceData: PluginStorage;
|
|
73
|
+
}
|
|
74
|
+
export interface VizComponent {
|
|
75
|
+
name: string;
|
|
76
|
+
displayName?: string;
|
|
77
|
+
viewRender: React.ComponentType<VizViewProps>;
|
|
78
|
+
configRender: React.ComponentType<VizConfigProps>;
|
|
79
|
+
migration: (ctx: VizComponentMigrationContext) => Promise<void>;
|
|
80
|
+
}
|
|
81
|
+
export interface IPluginManifest {
|
|
82
|
+
viz: VizComponent[];
|
|
83
|
+
color: ColorPaletteItem[];
|
|
84
|
+
}
|
|
85
|
+
export interface IDashboardPlugin {
|
|
86
|
+
id: string;
|
|
87
|
+
version: string;
|
|
88
|
+
manifest: IPluginManifest;
|
|
89
|
+
}
|
|
90
|
+
export interface IPluginManager {
|
|
91
|
+
install(plugin: IDashboardPlugin): void;
|
|
92
|
+
installedPlugins: IDashboardPlugin[];
|
|
93
|
+
factory: {
|
|
94
|
+
viz: (name: string) => VizComponent;
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export interface InterpolateColorOption {
|
|
2
|
+
valueRange: number[];
|
|
3
|
+
colorRange: string[];
|
|
4
|
+
}
|
|
5
|
+
export declare class InterpolateColor {
|
|
6
|
+
mapper: (v: number) => string;
|
|
7
|
+
constructor({ valueRange, colorRange }: InterpolateColorOption);
|
|
8
|
+
getColor(value: number): string;
|
|
9
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { FilterValuesType } from '../model';
|
|
2
|
+
import { ContextInfoType } from '../model/context';
|
|
3
|
+
import { SQLSnippetModelInstance } from '../model/sql-snippets';
|
|
4
|
+
export declare function explainSQLSnippet(snippet: string, context: ContextInfoType): any;
|
|
5
|
+
export declare function formatSQL(sql: string, params: Record<string, any>): any;
|
|
6
|
+
export declare function getSQLParams(context: ContextInfoType, sqlSnippets: SQLSnippetModelInstance[], filterValues: FilterValuesType): Record<string, any> & ContextInfoType & {
|
|
7
|
+
filters: FilterValuesType;
|
|
8
|
+
};
|
|
9
|
+
export declare function explainSQL(sql: string, context: ContextInfoType, sqlSnippets: SQLSnippetModelInstance[], filterValues: FilterValuesType): any;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { TextInputProps } from '@mantine/core';
|
|
2
|
+
import React, { ChangeEventHandler } from 'react';
|
|
3
|
+
import { ITemplateVariable } from './types';
|
|
4
|
+
export declare function getANewVariable(): ITemplateVariable;
|
|
5
|
+
interface ITemplateInput extends Omit<TextInputProps, 'value' | 'onChange'> {
|
|
6
|
+
value: string;
|
|
7
|
+
onChange: ChangeEventHandler<HTMLInputElement>;
|
|
8
|
+
}
|
|
9
|
+
export declare const TemplateInput: React.ForwardRefExoticComponent<ITemplateInput & React.RefAttributes<unknown>>;
|
|
10
|
+
interface ITemplateVariableField {
|
|
11
|
+
value: ITemplateVariable;
|
|
12
|
+
onChange: (v: ITemplateVariable) => void;
|
|
13
|
+
data: any[];
|
|
14
|
+
}
|
|
15
|
+
export declare const TemplateVariableField: React.ForwardRefExoticComponent<ITemplateVariableField & React.RefAttributes<unknown>>;
|
|
16
|
+
export {};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { TNumbroFormat } from '../../panel/settings/common/numbro-format-selector';
|
|
2
|
+
import { AggregationType } from '../aggregation';
|
|
3
|
+
export declare type ColorConfType = {
|
|
4
|
+
type: 'static';
|
|
5
|
+
staticColor: string;
|
|
6
|
+
} | {
|
|
7
|
+
type: 'continuous';
|
|
8
|
+
valueRange: number[];
|
|
9
|
+
colorRange: string[];
|
|
10
|
+
} | {
|
|
11
|
+
type: 'piecewise';
|
|
12
|
+
};
|
|
13
|
+
export interface ITemplateVariable {
|
|
14
|
+
name: string;
|
|
15
|
+
data_field: string;
|
|
16
|
+
aggregation: AggregationType;
|
|
17
|
+
formatter: TNumbroFormat;
|
|
18
|
+
color: ColorConfType;
|
|
19
|
+
size: string;
|
|
20
|
+
weight: string;
|
|
21
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
/// <reference types="vite/client" />
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@devtable/dashboard",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.6.0",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public",
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -32,6 +32,7 @@
|
|
|
32
32
|
"dependencies": {
|
|
33
33
|
"eventemitter2": "^6.4.6",
|
|
34
34
|
"file-saver": "2.0.5",
|
|
35
|
+
"stickybits": "3.7.11",
|
|
35
36
|
"jszip": "3.10.1",
|
|
36
37
|
"popmotion": "^11.0.3"
|
|
37
38
|
},
|
|
@@ -100,4 +101,4 @@
|
|
|
100
101
|
"react-hook-form": "^7.31.2",
|
|
101
102
|
"tabler-icons-react": "^1.48.0"
|
|
102
103
|
}
|
|
103
|
-
}
|
|
104
|
+
}
|