@devtable/dashboard 4.1.0 → 4.1.1

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 (151) hide show
  1. package/dist/api-caller/index.d.ts +1 -1
  2. package/dist/contexts/layout-state-context.d.ts +0 -1
  3. package/dist/contexts/model-context.d.ts +1384 -1384
  4. package/dist/dashboard.es.js +9871 -7245
  5. package/dist/dashboard.umd.js +17 -17
  6. package/dist/definition-editor/query-editor/form.d.ts +1 -0
  7. package/dist/definition-editor/select-data-source.d.ts +14 -0
  8. package/dist/filter/filter-query-field/index.d.ts +2 -2
  9. package/dist/interactions/attachment-instance-manager.d.ts +14 -0
  10. package/dist/interactions/components/interaction-settings.d.ts +13 -0
  11. package/dist/interactions/components/operation-select.d.ts +11 -0
  12. package/dist/interactions/components/trigger-config-model.d.ts +18 -0
  13. package/dist/interactions/components/trigger-select.d.ts +8 -0
  14. package/dist/interactions/components/variable-list.d.ts +7 -0
  15. package/dist/interactions/hooks/use-current-interaction-manager.d.ts +6 -0
  16. package/dist/interactions/hooks/use-watch-triggers.d.ts +2 -0
  17. package/dist/interactions/interaction-manager.d.ts +14 -0
  18. package/dist/interactions/operation/operation-manager-impl.d.ts +13 -0
  19. package/dist/interactions/operation/operations/console-log.d.ts +5 -0
  20. package/dist/interactions/operation/operations/index.d.ts +2 -0
  21. package/dist/interactions/operation/operations/open-link.d.ts +6 -0
  22. package/dist/interactions/trigger/trigger-manager-impl.d.ts +18 -0
  23. package/dist/model/dashboard.d.ts +916 -916
  24. package/dist/model/filters/filter/common.d.ts +2 -1
  25. package/dist/model/filters/filter/index.d.ts +10 -10
  26. package/dist/model/filters/filter/multi-select.d.ts +5 -4
  27. package/dist/model/filters/filter/select.d.ts +5 -4
  28. package/dist/model/filters/index.d.ts +224 -224
  29. package/dist/panel/settings/common/data-field-selector.d.ts +1 -0
  30. package/dist/panel/settings/common/numbro-format-selector.d.ts +1 -0
  31. package/dist/plugins/color-manager/color-manager.d.ts +7 -0
  32. package/dist/plugins/color-manager/impl.d.ts +10 -0
  33. package/dist/plugins/color-manager/index.d.ts +2 -0
  34. package/dist/plugins/hooks/use-storage-data.d.ts +1 -1
  35. package/dist/plugins/index.d.ts +1 -0
  36. package/dist/plugins/json-plugin-storage.d.ts +2 -2
  37. package/dist/plugins/message-channels.d.ts +1 -1
  38. package/dist/plugins/plugin-context.d.ts +3 -1
  39. package/dist/plugins/plugin-data-migrator/index.d.ts +1 -0
  40. package/dist/plugins/plugin-data-migrator/version-based-migrator.d.ts +18 -0
  41. package/dist/plugins/plugin-manager.d.ts +1 -2
  42. package/dist/plugins/sub-tree-json-plugin-storage.d.ts +10 -0
  43. package/dist/plugins/viz-components/bar-3d-chart/index.d.ts +2 -0
  44. package/dist/plugins/viz-components/bar-3d-chart/type.d.ts +13 -0
  45. package/dist/plugins/viz-components/bar-3d-chart/viz-bar-3d-chart-panel.d.ts +3 -0
  46. package/dist/plugins/viz-components/bar-3d-chart/viz-bar-3d-chart.d.ts +3 -0
  47. package/dist/plugins/viz-components/boxplot-chart/index.d.ts +2 -0
  48. package/dist/plugins/viz-components/boxplot-chart/reference-lines/index.d.ts +9 -0
  49. package/dist/plugins/viz-components/boxplot-chart/reference-lines/reference-line.d.ts +14 -0
  50. package/dist/plugins/viz-components/boxplot-chart/type.d.ts +20 -0
  51. package/dist/plugins/viz-components/boxplot-chart/variables/index.d.ts +10 -0
  52. package/dist/plugins/viz-components/boxplot-chart/variables/variable.d.ts +11 -0
  53. package/dist/plugins/viz-components/boxplot-chart/viz-boxplot-chart-panel.d.ts +3 -0
  54. package/dist/plugins/viz-components/boxplot-chart/viz-boxplot-chart.d.ts +3 -0
  55. package/dist/plugins/viz-components/cartesian/index.d.ts +2 -0
  56. package/dist/plugins/viz-components/cartesian/option/grid.d.ts +5 -0
  57. package/dist/plugins/viz-components/cartesian/option/index.d.ts +2 -0
  58. package/dist/{panel/viz → plugins/viz-components}/cartesian/option/regression.d.ts +0 -0
  59. package/dist/plugins/viz-components/cartesian/option/series.d.ts +2 -0
  60. package/dist/plugins/viz-components/cartesian/option/tooltip.d.ts +5 -0
  61. package/dist/plugins/viz-components/cartesian/option/x-axis.d.ts +2 -0
  62. package/dist/plugins/viz-components/cartesian/option/y-axis.d.ts +15 -0
  63. package/dist/plugins/viz-components/cartesian/panel/regressions/index.d.ts +10 -0
  64. package/dist/{panel/viz → plugins/viz-components}/cartesian/panel/regressions/regression-item.d.ts +0 -0
  65. package/dist/{panel/viz → plugins/viz-components}/cartesian/panel/series/fields.bar.d.ts +0 -0
  66. package/dist/{panel/viz → plugins/viz-components}/cartesian/panel/series/fields.line.d.ts +0 -0
  67. package/dist/{panel/viz → plugins/viz-components}/cartesian/panel/series/fields.scatter.d.ts +0 -0
  68. package/dist/{panel/viz → plugins/viz-components}/cartesian/panel/series/index.d.ts +2 -3
  69. package/dist/{panel/viz → plugins/viz-components}/cartesian/panel/series/series-item.d.ts +0 -0
  70. package/dist/{panel/viz → plugins/viz-components}/cartesian/panel/stats/index.d.ts +0 -0
  71. package/dist/{panel/viz → plugins/viz-components}/cartesian/panel/stats/variable.d.ts +0 -0
  72. package/dist/{panel/viz → plugins/viz-components}/cartesian/panel/y-axes.d.ts +0 -0
  73. package/dist/{panel/viz → plugins/viz-components}/cartesian/type.d.ts +5 -7
  74. package/dist/plugins/viz-components/cartesian/viz-cartesian-chart.d.ts +3 -0
  75. package/dist/plugins/viz-components/cartesian/viz-cartesian-panel.d.ts +3 -0
  76. package/dist/plugins/viz-components/pie-chart/index.d.ts +2 -0
  77. package/dist/plugins/viz-components/pie-chart/type.d.ts +5 -0
  78. package/dist/plugins/viz-components/pie-chart/viz-pie-chart-panel.d.ts +3 -0
  79. package/dist/plugins/viz-components/pie-chart/viz-pie-chart.d.ts +3 -0
  80. package/dist/plugins/viz-components/radar-chart/index.d.ts +2 -0
  81. package/dist/plugins/viz-components/radar-chart/option/index.d.ts +26 -0
  82. package/dist/plugins/viz-components/radar-chart/panel/dimensions.d.ts +10 -0
  83. package/dist/plugins/viz-components/radar-chart/type.d.ts +11 -0
  84. package/dist/plugins/viz-components/radar-chart/viz-radar-chart-panel.d.ts +3 -0
  85. package/dist/plugins/viz-components/radar-chart/viz-radar-chart.d.ts +3 -0
  86. package/dist/plugins/viz-components/regression-chart/index.d.ts +2 -0
  87. package/dist/plugins/viz-components/regression-chart/option/index.d.ts +2 -0
  88. package/dist/plugins/viz-components/regression-chart/option/regression-expression.d.ts +15 -0
  89. package/dist/plugins/viz-components/regression-chart/option/regression-series.d.ts +14 -0
  90. package/dist/plugins/viz-components/regression-chart/regression-item.d.ts +14 -0
  91. package/dist/plugins/viz-components/regression-chart/type.d.ts +12 -0
  92. package/dist/plugins/viz-components/regression-chart/viz-regression-chart-panel.d.ts +3 -0
  93. package/dist/plugins/viz-components/regression-chart/viz-regression-chart.d.ts +3 -0
  94. package/dist/plugins/viz-components/rich-text/hooks.d.ts +8 -0
  95. package/dist/plugins/viz-components/rich-text/index.d.ts +2 -0
  96. package/dist/plugins/viz-components/rich-text/type.d.ts +4 -0
  97. package/dist/plugins/viz-components/rich-text/viz-rich-text-panel.d.ts +3 -0
  98. package/dist/plugins/viz-components/rich-text/viz-rich-text.d.ts +3 -0
  99. package/dist/plugins/viz-components/stats/index.d.ts +2 -0
  100. package/dist/{panel/viz → plugins/viz-components}/stats/panel/variable.d.ts +1 -1
  101. package/dist/{panel/viz → plugins/viz-components}/stats/panel/variables.d.ts +1 -1
  102. package/dist/{panel/viz/stats/types.d.ts → plugins/viz-components/stats/type.d.ts} +2 -1
  103. package/dist/plugins/viz-components/stats/update/index.d.ts +5 -0
  104. package/dist/plugins/viz-components/stats/viz-stats-panel.d.ts +3 -0
  105. package/dist/plugins/viz-components/stats/viz-stats.d.ts +3 -0
  106. package/dist/plugins/viz-components/sunburst/index.d.ts +2 -0
  107. package/dist/plugins/viz-components/sunburst/type.d.ts +5 -0
  108. package/dist/plugins/viz-components/sunburst/viz-sunburst-panel.d.ts +3 -0
  109. package/dist/plugins/viz-components/sunburst/viz-sunburst.d.ts +3 -0
  110. package/dist/plugins/viz-components/table/index.d.ts +1 -1
  111. package/dist/plugins/viz-components/table/triggers/click-cell-content.d.ts +11 -0
  112. package/dist/plugins/viz-components/table/triggers/index.d.ts +1 -0
  113. package/dist/plugins/viz-components/table/value.d.ts +2 -1
  114. package/dist/plugins/viz-components/table/viz-table-panel.d.ts +1 -1
  115. package/dist/plugins/viz-components/table/viz-table.d.ts +2 -2
  116. package/dist/plugins/viz-manager/components.d.ts +3 -3
  117. package/dist/plugins/viz-manager/impl.d.ts +3 -3
  118. package/dist/plugins/viz-manager/types.d.ts +3 -7
  119. package/dist/types/dashboard.d.ts +2 -2
  120. package/dist/types/index.d.ts +1 -0
  121. package/dist/types/plugin/index.d.ts +94 -8
  122. package/dist/types/utils.d.ts +4 -0
  123. package/dist/utils/aggregation.d.ts +9 -1
  124. package/dist/utils/template/editor/index.d.ts +3 -0
  125. package/dist/utils/template/editor/template-input.d.ts +8 -0
  126. package/dist/utils/template/editor/utils.d.ts +2 -0
  127. package/dist/utils/template/editor/variable-field.d.ts +10 -0
  128. package/dist/utils/template/editor/variable-style.d.ts +8 -0
  129. package/dist/utils/template/index.d.ts +4 -0
  130. package/dist/utils/template/render/index.d.ts +2 -0
  131. package/dist/utils/template/{render.d.ts → render/render-jsx.d.ts} +1 -1
  132. package/dist/utils/template/render/render-string.d.ts +2 -0
  133. package/dist/utils/template/utils.d.ts +4 -0
  134. package/package.json +1 -1
  135. package/dist/filter/filter-query-field/select-data-source.d.ts +0 -8
  136. package/dist/panel/viz/bar-3d/index.d.ts +0 -9
  137. package/dist/panel/viz/bar-3d/panel.d.ts +0 -3
  138. package/dist/panel/viz/cartesian/index.d.ts +0 -10
  139. package/dist/panel/viz/cartesian/panel/index.d.ts +0 -3
  140. package/dist/panel/viz/cartesian/panel/regressions/index.d.ts +0 -11
  141. package/dist/panel/viz/pie/index.d.ts +0 -9
  142. package/dist/panel/viz/pie/panel.d.ts +0 -3
  143. package/dist/panel/viz/rich-text/index.d.ts +0 -10
  144. package/dist/panel/viz/rich-text/panel.d.ts +0 -3
  145. package/dist/panel/viz/rich-text/type.d.ts +0 -8
  146. package/dist/panel/viz/stats/index.d.ts +0 -10
  147. package/dist/panel/viz/stats/panel/index.d.ts +0 -10
  148. package/dist/panel/viz/stats/update/index.d.ts +0 -15
  149. package/dist/panel/viz/sunburst/index.d.ts +0 -9
  150. package/dist/panel/viz/sunburst/panel.d.ts +0 -3
  151. package/dist/utils/template/editor.d.ts +0 -16
@@ -1,4 +1,5 @@
1
- import { ITemplateVariable } from '../../../utils/template/types';
1
+ import { ITemplateVariable } from '~/utils/template';
2
+ export declare const DEFAULT_CONFIG: IVizStatsConf;
2
3
  export interface IVizStatsConf {
3
4
  align: 'center';
4
5
  template: string;
@@ -0,0 +1,5 @@
1
+ import { VersionBasedMigrator } from '~/plugins/plugin-data-migrator';
2
+ export declare class VizStatsMigrator extends VersionBasedMigrator {
3
+ readonly VERSION = 1;
4
+ configVersions(): void;
5
+ }
@@ -0,0 +1,3 @@
1
+ /// <reference types="react" />
2
+ import { VizConfigProps } from '~/types/plugin';
3
+ export declare function VizStatsPanel({ context }: VizConfigProps): JSX.Element;
@@ -0,0 +1,3 @@
1
+ /// <reference types="react" />
2
+ import { VizViewProps } from '~/types/plugin';
3
+ export declare function VizStats({ context }: VizViewProps): JSX.Element;
@@ -0,0 +1,2 @@
1
+ import { VizComponent } from '~/types/plugin';
2
+ export declare const SunburstVizComponent: VizComponent;
@@ -0,0 +1,5 @@
1
+ export interface ISunburstConf {
2
+ label_field: string;
3
+ value_field: string;
4
+ }
5
+ export declare const DEFAULT_CONFIG: ISunburstConf;
@@ -0,0 +1,3 @@
1
+ /// <reference types="react" />
2
+ import { VizConfigProps } from '~/types/plugin';
3
+ export declare function VizSunburstPanel({ context }: VizConfigProps): JSX.Element;
@@ -0,0 +1,3 @@
1
+ /// <reference types="react" />
2
+ import { VizViewProps } from '~/types/plugin';
3
+ export declare function VizSunburst({ context }: VizViewProps): JSX.Element;
@@ -1,2 +1,2 @@
1
- import { VizComponent } from '../../../types/plugin';
1
+ import { VizComponent } from '~/types/plugin';
2
2
  export declare const TableVizComponent: VizComponent;
@@ -0,0 +1,11 @@
1
+ /// <reference types="react" />
2
+ import { ITriggerConfigProps, ITriggerSchema } from '~/types/plugin';
3
+ export declare const ClickCellContent: ITriggerSchema;
4
+ export interface IClickCellContentConfig {
5
+ /**
6
+ * string for the field name,
7
+ * number for the column index
8
+ */
9
+ column: string | number;
10
+ }
11
+ export declare function ClickCellContentSettings(props: ITriggerConfigProps): JSX.Element;
@@ -0,0 +1 @@
1
+ export { ClickCellContent } from './click-cell-content';
@@ -3,6 +3,7 @@ import { ValueType } from './type';
3
3
  interface ICellValue {
4
4
  value: any;
5
5
  type: ValueType;
6
+ onContentClick?: () => void;
6
7
  }
7
- export declare function CellValue({ value, type }: ICellValue): JSX.Element;
8
+ export declare function CellValue(props: ICellValue): JSX.Element;
8
9
  export {};
@@ -1,3 +1,3 @@
1
1
  /// <reference types="react" />
2
- import { VizConfigProps } from '../../../types/plugin';
2
+ import { VizConfigProps } from '~/types/plugin';
3
3
  export declare function VizTablePanel({ context }: VizConfigProps): JSX.Element;
@@ -1,3 +1,3 @@
1
1
  /// <reference types="react" />
2
- import { VizViewProps } from '../../../types/plugin';
3
- export declare function VizTable({ context }: VizViewProps): JSX.Element;
2
+ import { VizViewProps } from '~/types/plugin';
3
+ export declare function VizTable({ context, instance }: VizViewProps): JSX.Element;
@@ -1,5 +1,5 @@
1
1
  /// <reference types="react" />
2
- import { IPanelInfoEditor } from '../../types/plugin';
2
+ import { IPanelInfoEditor } from '~/types/plugin';
3
3
  import { IPanelInfo, IVizManager } from './types';
4
4
  export declare type IViewPanelInfo = IPanelInfo & {
5
5
  layout: {
@@ -7,13 +7,13 @@ export declare type IViewPanelInfo = IPanelInfo & {
7
7
  h: number;
8
8
  };
9
9
  };
10
- export declare type IViewComponentProps<TDebug = {}> = {
10
+ export declare type IViewComponentProps<TDebug = Record<string, unknown>> = {
11
11
  panel: IViewPanelInfo;
12
12
  data: any;
13
13
  vizManager: IVizManager;
14
14
  } & TDebug;
15
15
  export declare const VizViewComponent: <T>(props: IViewComponentProps<T>) => JSX.Element;
16
- export declare type IConfigComponentProps<TDebug = {}> = {
16
+ export declare type IConfigComponentProps<TDebug = Record<string, unknown>> = {
17
17
  panel: IPanelInfo;
18
18
  panelInfoEditor: IPanelInfoEditor;
19
19
  vizManager: IVizManager;
@@ -1,10 +1,10 @@
1
- import { IPluginManager, VizComponent } from '../../types/plugin';
2
- import { IPanelInfo, IVizManager, VizInstanceInfo } from './types';
1
+ import { IPluginManager, VizComponent, VizInstance } from '~/types/plugin';
2
+ import { IPanelInfo, IVizManager } from './types';
3
3
  export declare class VizManager implements IVizManager {
4
4
  private pluginManager;
5
5
  private instances;
6
6
  constructor(pluginManager: IPluginManager);
7
7
  get availableVizList(): VizComponent[];
8
8
  resolveComponent(name: string): VizComponent;
9
- getOrCreateInstance(panel: IPanelInfo): VizInstanceInfo;
9
+ getOrCreateInstance(panel: IPanelInfo): VizInstance;
10
10
  }
@@ -1,12 +1,8 @@
1
- import { IDashboardPanel } from '../../types';
2
- import { IMessageChannels, PluginStorage, VizComponent, VizInstance } from '../../types/plugin';
1
+ import { IDashboardPanel } from '~/types';
2
+ import { VizComponent, VizInstance } from '~/types/plugin';
3
3
  export declare type IPanelInfo = Omit<IDashboardPanel, 'layout'>;
4
4
  export interface IVizManager {
5
5
  readonly availableVizList: VizComponent[];
6
6
  resolveComponent(type: string): VizComponent;
7
- getOrCreateInstance(panel: IPanelInfo): VizInstanceInfo;
8
- }
9
- export interface VizInstanceInfo extends VizInstance {
10
- messageChannels: IMessageChannels;
11
- instanceData: PluginStorage;
7
+ getOrCreateInstance(panel: IPanelInfo): VizInstance;
12
8
  }
@@ -1,9 +1,10 @@
1
+ import { AnyObject } from '~/types/utils';
1
2
  import { FilterModelInstance } from '../model';
2
3
  import { QueryModelInstance } from '../model/queries';
3
4
  import { SQLSnippetModelInstance } from '../model/sql-snippets';
4
5
  export interface IVizConfig {
5
6
  type: string;
6
- conf: Record<string, any>;
7
+ conf: AnyObject;
7
8
  }
8
9
  export interface IDashboardPanel {
9
10
  id: string;
@@ -22,7 +23,6 @@ export interface IDashboardPanel {
22
23
  }
23
24
  export declare enum DashboardMode {
24
25
  Use = "use",
25
- Layout = "layout",
26
26
  Edit = "edit"
27
27
  }
28
28
  export interface IDashboardDefinition {
@@ -1,3 +1,4 @@
1
1
  export * from './dashboard';
2
2
  export * from './filter';
3
3
  export * from './viz-panel';
4
+ export type { AnyObject, Ready } from './utils';
@@ -1,5 +1,7 @@
1
- import EventEmitter2 from 'eventemitter2';
1
+ import { EventEmitter2 } from 'eventemitter2';
2
2
  import React from 'react';
3
+ import { IVizManager } from '~/plugins';
4
+ import { AnyObject } from '~/types';
3
5
  /**
4
6
  * Basic information of a viz component instance
5
7
  */
@@ -7,6 +9,8 @@ export interface VizInstance {
7
9
  id: string;
8
10
  name: string;
9
11
  type: string;
12
+ messageChannels: IMessageChannels;
13
+ instanceData: PluginStorage;
10
14
  }
11
15
  /**
12
16
  * Props to render the view of viz component
@@ -15,27 +19,30 @@ export interface VizViewProps {
15
19
  instance: VizInstance;
16
20
  context: VizViewContext;
17
21
  }
22
+ export interface IWatchOptions {
23
+ fireImmediately?: boolean;
24
+ }
18
25
  export interface PluginStorage {
19
26
  getItem<T>(key: string | null): Promise<T>;
20
27
  setItem<T>(key: string | null, item: T): Promise<T>;
21
28
  deleteItem(key: string): Promise<void>;
22
- watchItem<T>(key: string | null, callback: (value: T, previous?: T) => void): () => void;
29
+ watchItem<T>(key: string | null, callback: (value: T, previous?: T) => void, options?: IWatchOptions): () => void;
23
30
  }
24
- export interface ColorPaletteItem {
31
+ export interface IColorPaletteItem {
25
32
  name: string;
26
33
  type: string;
27
34
  category: string;
28
35
  }
29
- export interface SingleColor extends ColorPaletteItem {
36
+ export interface ISingleColor extends IColorPaletteItem {
30
37
  type: 'single';
31
38
  value: string;
32
39
  }
33
- export interface ColorInterpolation extends ColorPaletteItem {
40
+ export interface ColorInterpolation extends IColorPaletteItem {
34
41
  type: 'interpolation';
35
42
  interpolation: (value: number) => string;
36
43
  }
37
44
  export interface ColorPalette {
38
- getColor(colorInfo: ColorPaletteItem): (value: unknown) => string;
45
+ getColor(colorInfo: IColorPaletteItem): (value: unknown) => string;
39
46
  }
40
47
  export interface IMessageChannels {
41
48
  globalChannel: EventEmitter2;
@@ -48,8 +55,9 @@ export interface VizContext {
48
55
  locale: string;
49
56
  msgChannels: IMessageChannels;
50
57
  data: unknown;
58
+ vizManager: IVizManager;
51
59
  }
52
- declare type Setter<T> = (val: string) => void;
60
+ declare type Setter<T> = (val: T) => void;
53
61
  export interface IPanelInfoEditor {
54
62
  setTitle: Setter<string>;
55
63
  setDescription: Setter<string>;
@@ -77,6 +85,8 @@ export interface VizComponent {
77
85
  viewRender: React.ComponentType<VizViewProps>;
78
86
  configRender: React.ComponentType<VizConfigProps>;
79
87
  migrator: IVizComponentMigrator;
88
+ createConfig: () => AnyObject;
89
+ triggers?: ITriggerSchema[];
80
90
  }
81
91
  export interface IVizComponentMigrator {
82
92
  needMigration(ctx: VizComponentMigrationContext): Promise<boolean>;
@@ -84,7 +94,7 @@ export interface IVizComponentMigrator {
84
94
  }
85
95
  export interface IPluginManifest {
86
96
  viz: VizComponent[];
87
- color: ColorPaletteItem[];
97
+ color: IColorPaletteItem[];
88
98
  }
89
99
  export interface IDashboardPlugin {
90
100
  id: string;
@@ -98,4 +108,80 @@ export interface IPluginManager {
98
108
  viz: (name: string) => VizComponent;
99
109
  };
100
110
  }
111
+ export interface IPayloadVariableSchema {
112
+ name: string;
113
+ description: string;
114
+ valueType: 'string' | 'number' | 'object';
115
+ }
116
+ export interface IInteractionConfigProps {
117
+ instance: VizInstance;
118
+ }
119
+ export interface ITriggerConfigProps extends IInteractionConfigProps {
120
+ trigger: ITrigger;
121
+ sampleData: Record<string, unknown>[];
122
+ }
123
+ export interface IOperationConfigProps extends IInteractionConfigProps {
124
+ operation: IDashboardOperation;
125
+ variables: IPayloadVariableSchema[];
126
+ }
127
+ export interface ITriggerSchema {
128
+ id: string;
129
+ displayName: string;
130
+ payload: IPayloadVariableSchema[];
131
+ configRender: React.ComponentType<ITriggerConfigProps>;
132
+ nameRender: React.ComponentType<Omit<ITriggerConfigProps, 'sampleData'>>;
133
+ }
134
+ export interface ITrigger {
135
+ id: string;
136
+ schemaRef: string;
137
+ triggerData: PluginStorage;
138
+ }
139
+ /**
140
+ * A readonly snapshot of a trigger
141
+ */
142
+ export interface ITriggerSnapshot<TConfig> {
143
+ id: string;
144
+ schemaRef: string;
145
+ config: TConfig;
146
+ }
147
+ export interface IVizTriggerManager {
148
+ getTriggerSchemaList(): ITriggerSchema[];
149
+ getTriggerList(): Promise<ITrigger[]>;
150
+ removeTrigger(triggerId: string): Promise<void>;
151
+ createOrGetTrigger(id: string, schema: ITriggerSchema): Promise<ITrigger>;
152
+ retrieveTrigger(id: string): Promise<ITrigger | undefined>;
153
+ watchTriggerSnapshotList(callback: (triggerList: ITriggerSnapshot<AnyObject>[]) => void): () => void;
154
+ }
155
+ export interface IDashboardOperationSchema {
156
+ id: string;
157
+ displayName: string;
158
+ configRender: React.ComponentType<IOperationConfigProps>;
159
+ run: (payload: Record<string, unknown>, operation: IDashboardOperation) => Promise<void>;
160
+ }
161
+ export interface IDashboardOperation {
162
+ id: string;
163
+ schemaRef: string;
164
+ operationData: PluginStorage;
165
+ }
166
+ export interface IVizOperationManager {
167
+ getOperationSchemaList(): IDashboardOperationSchema[];
168
+ getOperationList(): Promise<IDashboardOperation[]>;
169
+ removeOperation(operationId: string): Promise<void>;
170
+ createOrGetOperation(id: string, schema: IDashboardOperationSchema): Promise<IDashboardOperation>;
171
+ runOperation(operationId: string, payload: Record<string, unknown>): Promise<void>;
172
+ retrieveTrigger(operationId: string): Promise<IDashboardOperation | undefined>;
173
+ }
174
+ export interface IVizInteraction {
175
+ id: string;
176
+ triggerRef: string;
177
+ operationRef: string;
178
+ }
179
+ export interface IVizInteractionManager {
180
+ triggerManager: IVizTriggerManager;
181
+ operationManager: IVizOperationManager;
182
+ getInteractionList(): Promise<IVizInteraction[]>;
183
+ addInteraction(trigger: ITrigger, operation: IDashboardOperation): Promise<void>;
184
+ removeInteraction(interactionId: string): Promise<void>;
185
+ runInteraction(triggerId: string, payload: Record<string, unknown>): Promise<void>;
186
+ }
101
187
  export {};
@@ -0,0 +1,4 @@
1
+ export declare type AnyObject = Record<string, any>;
2
+ export declare type Ready<T, TK extends keyof T> = T & {
3
+ [P in TK]-?: NonNullable<T[P]>;
4
+ };
@@ -1,2 +1,10 @@
1
- export declare type AggregationType = 'none' | 'sum' | 'mean' | 'median' | 'max' | 'min';
1
+ export declare type AggregationType = {
2
+ type: 'none' | 'sum' | 'mean' | 'median' | 'max' | 'min';
3
+ config: Record<any, never>;
4
+ } | {
5
+ type: 'quantile';
6
+ config: {
7
+ p: number;
8
+ };
9
+ };
2
10
  export declare function aggregateValue(data: Record<string, number>[], data_field: string, aggregation: AggregationType): number;
@@ -0,0 +1,3 @@
1
+ export * from './template-input';
2
+ export * from './utils';
3
+ export * from './variable-field';
@@ -0,0 +1,8 @@
1
+ import { TextInputProps } from '@mantine/core';
2
+ import { ChangeEventHandler } from 'react';
3
+ interface ITemplateInput extends Omit<TextInputProps, 'value' | 'onChange'> {
4
+ value: string;
5
+ onChange: ChangeEventHandler<HTMLInputElement>;
6
+ }
7
+ export declare const TemplateInput: import("react").ForwardRefExoticComponent<ITemplateInput & import("react").RefAttributes<unknown>>;
8
+ export {};
@@ -0,0 +1,2 @@
1
+ import { ITemplateVariable } from '../types';
2
+ export declare function getANewVariable(): ITemplateVariable;
@@ -0,0 +1,10 @@
1
+ import React from 'react';
2
+ import { ITemplateVariable } from '../types';
3
+ interface ITemplateVariableField {
4
+ value: ITemplateVariable;
5
+ onChange: (v: ITemplateVariable) => void;
6
+ data: any[];
7
+ withStyle?: boolean;
8
+ }
9
+ export declare const TemplateVariableField: React.ForwardRefExoticComponent<ITemplateVariableField & React.RefAttributes<unknown>>;
10
+ export {};
@@ -0,0 +1,8 @@
1
+ import React from 'react';
2
+ import { ITemplateVariable } from '../types';
3
+ interface ITemplateVariableStyleField {
4
+ value: ITemplateVariable;
5
+ onChange: (v: ITemplateVariable) => void;
6
+ }
7
+ export declare const TemplateVariableStyleField: React.ForwardRefExoticComponent<ITemplateVariableStyleField & React.RefAttributes<unknown>>;
8
+ export {};
@@ -0,0 +1,4 @@
1
+ export * from './editor';
2
+ export * from './render';
3
+ export * from './types';
4
+ export * from './utils';
@@ -0,0 +1,2 @@
1
+ export * from './render-jsx';
2
+ export * from './render-string';
@@ -1,3 +1,3 @@
1
1
  /// <reference types="react" />
2
- import { ITemplateVariable } from './types';
2
+ import { ITemplateVariable } from '../types';
3
3
  export declare function templateToJSX(template: string, variables: ITemplateVariable[], data: Record<string, number>[]): (JSX.Element | import("react").ReactNode[])[];
@@ -0,0 +1,2 @@
1
+ import { ITemplateVariable } from '../types';
2
+ export declare function templateToString(template: string, variables: ITemplateVariable[], data: Record<string, number>[]): string;
@@ -0,0 +1,4 @@
1
+ import { ITemplateVariable } from './types';
2
+ export declare function getNonStatsDataText(data: any): any;
3
+ export declare function getAggregatedValue({ data_field, aggregation }: ITemplateVariable, data: Record<string, number>[]): number;
4
+ export declare function formatAggregatedValue({ formatter }: ITemplateVariable, value: number | string): any;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@devtable/dashboard",
3
- "version": "4.1.0",
3
+ "version": "4.1.1",
4
4
  "publishConfig": {
5
5
  "access": "public",
6
6
  "registry": "https://registry.npmjs.org/"
@@ -1,8 +0,0 @@
1
- import React from 'react';
2
- import { IFilterOptionQuery } from '../../model/filters/filter/common';
3
- interface ISelectDataSource {
4
- value: IFilterOptionQuery;
5
- onChange: (v: IFilterOptionQuery) => void;
6
- }
7
- export declare const SelectDataSource: React.FunctionComponent<ISelectDataSource>;
8
- export {};
@@ -1,9 +0,0 @@
1
- /// <reference types="react" />
2
- interface IVizBar3D {
3
- conf: any;
4
- data: any[];
5
- width: number;
6
- height: number;
7
- }
8
- export declare function VizBar3D({ conf, data, width, height }: IVizBar3D): JSX.Element;
9
- export {};
@@ -1,3 +0,0 @@
1
- /// <reference types="react" />
2
- import { IVizPanelProps } from '../../../types';
3
- export declare function VizBar3DPanel({ conf, setConf, data }: IVizPanelProps): JSX.Element;
@@ -1,10 +0,0 @@
1
- /// <reference types="react" />
2
- import { ICartesianChartConf } from './type';
3
- interface ICartesianChart {
4
- conf: ICartesianChartConf;
5
- data: any[];
6
- width: number;
7
- height: number;
8
- }
9
- export declare function VizCartesianChart({ conf, data, width, height }: ICartesianChart): JSX.Element;
10
- export {};
@@ -1,3 +0,0 @@
1
- /// <reference types="react" />
2
- import { IVizCartesianChartPanel } from '../type';
3
- export declare function VizCartesianChartPanel({ conf, setConf, data }: IVizCartesianChartPanel): JSX.Element;
@@ -1,11 +0,0 @@
1
- /// <reference types="react" />
2
- import { Control, UseFormGetValues, UseFormWatch } from 'react-hook-form';
3
- import { ICartesianChartConf } from '../../type';
4
- interface IRegressionsField {
5
- control: Control<ICartesianChartConf, any>;
6
- watch: UseFormWatch<ICartesianChartConf>;
7
- getValues: UseFormGetValues<ICartesianChartConf>;
8
- data: any[];
9
- }
10
- export declare function RegressionsField({ control, watch, getValues, data }: IRegressionsField): JSX.Element;
11
- export {};
@@ -1,9 +0,0 @@
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 {};
@@ -1,3 +0,0 @@
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;
@@ -1,10 +0,0 @@
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 {};
@@ -1,3 +0,0 @@
1
- /// <reference types="react" />
2
- import { IVizRichTextPanel } from './type';
3
- export declare function VizRichTextPanel({ conf, setConf }: IVizRichTextPanel): JSX.Element;
@@ -1,8 +0,0 @@
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
- }
@@ -1,10 +0,0 @@
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 {};
@@ -1,10 +0,0 @@
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 {};
@@ -1,15 +0,0 @@
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;
@@ -1,9 +0,0 @@
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 {};
@@ -1,3 +0,0 @@
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;
@@ -1,16 +0,0 @@
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 {};