@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.
Files changed (148) hide show
  1. package/dist/api-caller/index.d.ts +26 -0
  2. package/dist/api-caller/request.d.ts +5 -0
  3. package/dist/api-caller/types.d.ts +11 -0
  4. package/dist/contexts/dashboard-action-context.d.ts +9 -0
  5. package/dist/contexts/index.d.ts +3 -0
  6. package/dist/contexts/layout-state-context.d.ts +11 -0
  7. package/dist/contexts/model-context.d.ts +24165 -0
  8. package/dist/contexts/panel-context.d.ts +16 -0
  9. package/dist/dashboard.es.js +1696 -1644
  10. package/dist/dashboard.umd.js +16 -16
  11. package/dist/definition-editor/data-editor-modal.d.ts +7 -0
  12. package/dist/definition-editor/global-variables-guide.d.ts +8 -0
  13. package/dist/definition-editor/index.d.ts +1 -0
  14. package/dist/definition-editor/query-editor/data-preview.d.ts +4 -0
  15. package/dist/definition-editor/query-editor/editor.d.ts +7 -0
  16. package/dist/definition-editor/query-editor/form.d.ts +7 -0
  17. package/dist/definition-editor/query-editor/index.d.ts +5 -0
  18. package/dist/definition-editor/query-editor/preview-sql.d.ts +6 -0
  19. package/dist/definition-editor/query-editor/select-or-add-query.d.ts +7 -0
  20. package/dist/definition-editor/sql-snippet-editor/editor.d.ts +5 -0
  21. package/dist/definition-editor/sql-snippet-editor/index.d.ts +5 -0
  22. package/dist/definition-editor/sql-snippet-editor/preview-snippet.d.ts +6 -0
  23. package/dist/filter/filter-checkbox/editor.d.ts +8 -0
  24. package/dist/filter/filter-checkbox/render.d.ts +10 -0
  25. package/dist/filter/filter-date-range/editor.d.ts +7 -0
  26. package/dist/filter/filter-date-range/render.d.ts +10 -0
  27. package/dist/filter/filter-multi-select/editor.d.ts +7 -0
  28. package/dist/filter/filter-multi-select/render.d.ts +10 -0
  29. package/dist/filter/filter-query-field/index.d.ts +8 -0
  30. package/dist/filter/filter-query-field/select-data-source.d.ts +8 -0
  31. package/dist/filter/filter-query-field/test-query.d.ts +7 -0
  32. package/dist/filter/filter-select/editor.d.ts +7 -0
  33. package/dist/filter/filter-select/render.d.ts +10 -0
  34. package/dist/filter/filter-settings/filter-setting.d.ts +8 -0
  35. package/dist/filter/filter-settings/filter-settings.d.ts +5 -0
  36. package/dist/filter/filter-settings/index.d.ts +7 -0
  37. package/dist/filter/filter-settings/preview-filter.d.ts +7 -0
  38. package/dist/filter/filter-text-input/editor.d.ts +7 -0
  39. package/dist/filter/filter-text-input/render.d.ts +10 -0
  40. package/dist/filter/filter.d.ts +9 -0
  41. package/dist/filter/index.d.ts +5 -0
  42. package/dist/index.d.ts +6 -0
  43. package/dist/layout/index.d.ts +12 -0
  44. package/dist/layout/read-only.d.ts +9 -0
  45. package/dist/main/actions.d.ts +12 -0
  46. package/dist/main/full-screen-panel.d.ts +6 -0
  47. package/dist/main/index.d.ts +2 -0
  48. package/dist/main/main.d.ts +12 -0
  49. package/dist/main/read-only.d.ts +11 -0
  50. package/dist/main/toggle-mode.d.ts +8 -0
  51. package/dist/main/use-panel-full-screen.d.ts +7 -0
  52. package/dist/main/use-sticky-area-style.d.ts +1 -0
  53. package/dist/main/view-schema-modal.d.ts +8 -0
  54. package/dist/model/context.d.ts +11 -0
  55. package/dist/model/dashboard.d.ts +15998 -0
  56. package/dist/model/filters/filter/checkbox.d.ts +16 -0
  57. package/dist/model/filters/filter/common.d.ts +14 -0
  58. package/dist/model/filters/filter/date-range.d.ts +28 -0
  59. package/dist/model/filters/filter/index.d.ts +172 -0
  60. package/dist/model/filters/filter/multi-select.d.ts +81 -0
  61. package/dist/model/filters/filter/select.d.ts +95 -0
  62. package/dist/model/filters/filter/text-input.d.ts +22 -0
  63. package/dist/model/filters/index.d.ts +3542 -0
  64. package/dist/model/index.d.ts +5 -0
  65. package/dist/model/queries/index.d.ts +116 -0
  66. package/dist/model/queries/mute-query.d.ts +17 -0
  67. package/dist/model/queries/query.d.ts +31 -0
  68. package/dist/model/queries/types.d.ts +5 -0
  69. package/dist/model/sql-snippets/index.d.ts +26 -0
  70. package/dist/model/sql-snippets/sql-snippet.d.ts +9 -0
  71. package/dist/panel/error-boundary.d.ts +13 -0
  72. package/dist/panel/index.d.ts +7 -0
  73. package/dist/panel/panel-description.d.ts +5 -0
  74. package/dist/panel/settings/common/aggregation-selector.d.ts +9 -0
  75. package/dist/panel/settings/common/color-array-input.d.ts +8 -0
  76. package/dist/panel/settings/common/data-field-selector.d.ts +12 -0
  77. package/dist/panel/settings/common/mantine-color.d.ts +7 -0
  78. package/dist/panel/settings/common/mantine-font-weight.d.ts +8 -0
  79. package/dist/panel/settings/common/numbro-format-selector.d.ts +13 -0
  80. package/dist/panel/settings/common/text-array-input.d.ts +8 -0
  81. package/dist/panel/settings/index.d.ts +7 -0
  82. package/dist/panel/settings/panel-config/description.d.ts +2 -0
  83. package/dist/panel/settings/panel-config/index.d.ts +5 -0
  84. package/dist/panel/settings/panel-config/preview-panel.d.ts +2 -0
  85. package/dist/panel/settings/panel-config/title.d.ts +2 -0
  86. package/dist/panel/settings/pick-query/index.d.ts +5 -0
  87. package/dist/panel/settings/viz-config/index.d.ts +5 -0
  88. package/dist/panel/settings/viz-config/preview-viz.d.ts +5 -0
  89. package/dist/panel/settings/viz-config/viz-conf.d.ts +2 -0
  90. package/dist/panel/title-bar.d.ts +5 -0
  91. package/dist/panel/viz/bar-3d/index.d.ts +9 -0
  92. package/dist/panel/viz/bar-3d/panel.d.ts +3 -0
  93. package/dist/panel/viz/cartesian/index.d.ts +10 -0
  94. package/dist/panel/viz/cartesian/option/regression.d.ts +20 -0
  95. package/dist/panel/viz/cartesian/panel/index.d.ts +3 -0
  96. package/dist/panel/viz/cartesian/panel/regressions/index.d.ts +11 -0
  97. package/dist/panel/viz/cartesian/panel/regressions/regression-item.d.ts +16 -0
  98. package/dist/panel/viz/cartesian/panel/series/fields.bar.d.ts +9 -0
  99. package/dist/panel/viz/cartesian/panel/series/fields.line.d.ts +9 -0
  100. package/dist/panel/viz/cartesian/panel/series/fields.scatter.d.ts +9 -0
  101. package/dist/panel/viz/cartesian/panel/series/index.d.ts +11 -0
  102. package/dist/panel/viz/cartesian/panel/series/series-item.d.ts +16 -0
  103. package/dist/panel/viz/cartesian/panel/stats/index.d.ts +10 -0
  104. package/dist/panel/viz/cartesian/panel/stats/variable.d.ts +11 -0
  105. package/dist/panel/viz/cartesian/panel/y-axes.d.ts +9 -0
  106. package/dist/panel/viz/cartesian/type.d.ts +58 -0
  107. package/dist/panel/viz/index.d.ts +9 -0
  108. package/dist/panel/viz/pie/index.d.ts +9 -0
  109. package/dist/panel/viz/pie/panel.d.ts +3 -0
  110. package/dist/panel/viz/rich-text/index.d.ts +10 -0
  111. package/dist/panel/viz/rich-text/panel.d.ts +3 -0
  112. package/dist/panel/viz/rich-text/type.d.ts +8 -0
  113. package/dist/panel/viz/stats/index.d.ts +10 -0
  114. package/dist/panel/viz/stats/panel/index.d.ts +10 -0
  115. package/dist/panel/viz/stats/panel/variable.d.ts +11 -0
  116. package/dist/panel/viz/stats/panel/variables.d.ts +10 -0
  117. package/dist/panel/viz/stats/types.d.ts +6 -0
  118. package/dist/panel/viz/stats/update/index.d.ts +15 -0
  119. package/dist/panel/viz/sunburst/index.d.ts +9 -0
  120. package/dist/panel/viz/sunburst/panel.d.ts +3 -0
  121. package/dist/panel/viz/table/index.d.ts +10 -0
  122. package/dist/panel/viz/table/panel.d.ts +3 -0
  123. package/dist/panel/viz/table/type.d.ts +21 -0
  124. package/dist/panel/viz/table/value-type-selector.d.ts +10 -0
  125. package/dist/panel/viz/table/value.d.ts +8 -0
  126. package/dist/plugins/json-plugin-storage.d.ts +8 -0
  127. package/dist/plugins/message-channels.d.ts +8 -0
  128. package/dist/plugins/plugin-context.d.ts +12 -0
  129. package/dist/plugins/plugin-manager.d.ts +18 -0
  130. package/dist/plugins/viz-manager/components.d.ts +23 -0
  131. package/dist/plugins/viz-manager/impl.d.ts +10 -0
  132. package/dist/plugins/viz-manager/index.d.ts +3 -0
  133. package/dist/plugins/viz-manager/types.d.ts +12 -0
  134. package/dist/style.css +1 -1
  135. package/dist/types/dashboard.d.ts +41 -0
  136. package/dist/types/filter.d.ts +7 -0
  137. package/dist/types/index.d.ts +3 -0
  138. package/dist/types/plugin/index.d.ts +97 -0
  139. package/dist/types/viz-panel.d.ts +6 -0
  140. package/dist/utils/aggregation.d.ts +2 -0
  141. package/dist/utils/color-mapping.d.ts +9 -0
  142. package/dist/utils/download.d.ts +6 -0
  143. package/dist/utils/sql.d.ts +9 -0
  144. package/dist/utils/template/editor.d.ts +16 -0
  145. package/dist/utils/template/render.d.ts +3 -0
  146. package/dist/utils/template/types.d.ts +21 -0
  147. package/dist/vite-env.d.ts +1 -0
  148. package/package.json +3 -2
@@ -0,0 +1,9 @@
1
+ /// <reference types="react" />
2
+ interface IVizPie {
3
+ conf: any;
4
+ data: any[];
5
+ width: number;
6
+ height: number;
7
+ }
8
+ export declare function VizPie({ conf, data, width, height }: IVizPie): JSX.Element;
9
+ export {};
@@ -0,0 +1,3 @@
1
+ /// <reference types="react" />
2
+ import { IVizPanelProps } from '../../../types/viz-panel';
3
+ export declare function VizPiePanel({ conf: { label_field, value_field }, setConf, data }: IVizPanelProps): JSX.Element;
@@ -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,3 @@
1
+ /// <reference types="react" />
2
+ import { IVizRichTextPanel } from './type';
3
+ export declare function VizRichTextPanel({ conf, setConf }: IVizRichTextPanel): JSX.Element;
@@ -0,0 +1,8 @@
1
+ import { IVizPanelProps } from '../../../types';
2
+ export interface IRichTextConf {
3
+ content: '';
4
+ }
5
+ export interface IVizRichTextPanel extends Omit<IVizPanelProps, 'conf' | 'setConf'> {
6
+ conf: IRichTextConf;
7
+ setConf: (values: IRichTextConf) => void;
8
+ }
@@ -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,6 @@
1
+ import { ITemplateVariable } from '../../../utils/template/types';
2
+ export interface IVizStatsConf {
3
+ align: 'center';
4
+ template: string;
5
+ variables: ITemplateVariable[];
6
+ }
@@ -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,9 @@
1
+ /// <reference types="react" />
2
+ interface ISunbrust {
3
+ conf: any;
4
+ data: any[];
5
+ width: number;
6
+ height: number;
7
+ }
8
+ export declare function Sunbrust({ conf, data, width, height }: ISunbrust): JSX.Element;
9
+ export {};
@@ -0,0 +1,3 @@
1
+ /// <reference types="react" />
2
+ import { IVizPanelProps } from '../../../types/viz-panel';
3
+ export declare function SunburstPanel({ conf: { label_field, value_field }, setConf, data }: IVizPanelProps): JSX.Element;
@@ -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,3 @@
1
+ /// <reference types="react" />
2
+ import { IVizPanelProps } from '../../../types/viz-panel';
3
+ export declare function VizTablePanel({ conf: { columns, ...restConf }, setConf, data }: IVizPanelProps): JSX.Element;
@@ -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
+ /// <reference types="react" />
2
+ import { ValueType } from './type';
3
+ interface ICellValue {
4
+ value: any;
5
+ type: ValueType;
6
+ }
7
+ export declare function CellValue({ value, type }: ICellValue): JSX.Element;
8
+ 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,3 @@
1
+ export { VizManager } from './impl';
2
+ export type { IVizManager, IPanelInfo } from './types';
3
+ export { VizConfigComponent, VizViewComponent } from './components';
@@ -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}.mantine-Tabs-root{width:100%;height:calc(100% - 25px);overflow:hidden;display:flex;justify-content:flex-start;flex-direction:column;flex-wrap:nowrap}.mantine-Tabs-tabsListWrapper{flex:0}.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}
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,7 @@
1
+ export declare enum DashboardFilterType {
2
+ Select = "select",
3
+ MultiSelect = "multi-select",
4
+ TextInput = "text-input",
5
+ Checkbox = "checkbox",
6
+ DateRange = "date-range"
7
+ }
@@ -0,0 +1,3 @@
1
+ export * from './dashboard';
2
+ export * from './filter';
3
+ export * from './viz-panel';
@@ -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,6 @@
1
+ import { IVizConfig } from './dashboard';
2
+ export interface IVizPanelProps {
3
+ conf: IVizConfig['conf'];
4
+ setConf: (conf: IVizConfig['conf']) => void;
5
+ data: any[];
6
+ }
@@ -0,0 +1,2 @@
1
+ export declare type AggregationType = 'none' | 'sum' | 'mean' | 'median' | 'max' | 'min';
2
+ export declare function aggregateValue(data: Record<string, number>[], data_field: string, aggregation: AggregationType): number;
@@ -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,6 @@
1
+ export declare function downloadCSV(id: string, csv: string): void;
2
+ export declare function downloadDataListAsZip(idDataList: Array<{
3
+ id: string;
4
+ data: any[];
5
+ }>): void;
6
+ export declare function makeCSV(data: any | any[]): string;
@@ -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,3 @@
1
+ /// <reference types="react" />
2
+ import { ITemplateVariable } from './types';
3
+ export declare function templateToJSX(template: string, variables: ITemplateVariable[], data: Record<string, number>[]): (JSX.Element | import("react").ReactNode[])[];
@@ -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.5.0",
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
+ }