@devtable/dashboard 2.0.0 → 2.3.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 +11 -3
- package/dist/api-caller/types.d.ts +11 -0
- package/dist/contexts/filter-values-context.d.ts +4 -0
- package/dist/contexts/index.d.ts +1 -0
- package/dist/dashboard.es.js +1521 -850
- package/dist/dashboard.umd.js +12 -23
- package/dist/definition-editor/global-variables-guide.d.ts +8 -0
- package/dist/filter/filter-checkbox/editor.d.ts +10 -0
- package/dist/filter/filter-checkbox/render.d.ts +9 -0
- package/dist/filter/filter-date-range/editor.d.ts +10 -0
- package/dist/filter/filter-date-range/render.d.ts +9 -0
- package/dist/filter/filter-multi-select/editor.d.ts +11 -0
- package/dist/filter/filter-multi-select/render.d.ts +9 -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-select/editor.d.ts +11 -0
- package/dist/filter/filter-select/render.d.ts +9 -0
- package/dist/filter/filter-settings/filter-setting.d.ts +11 -0
- package/dist/filter/filter-settings/filter-settings.d.ts +8 -0
- package/dist/filter/filter-settings/index.d.ts +10 -0
- package/dist/filter/filter-settings/preview-filter.d.ts +11 -0
- package/dist/filter/filter-settings/types.d.ts +4 -0
- package/dist/filter/filter-text-input/editor.d.ts +10 -0
- package/dist/filter/filter-text-input/render.d.ts +9 -0
- package/dist/filter/filter.d.ts +9 -0
- package/dist/filter/index.d.ts +9 -0
- package/dist/main/actions.d.ts +4 -2
- package/dist/main/use-filters.d.ts +8 -0
- package/dist/panel/panel-description.d.ts +1 -3
- package/dist/style.css +1 -1
- package/dist/types/dashboard.d.ts +2 -0
- package/dist/types/filter.d.ts +39 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/utils/sql.d.ts +5 -3
- package/dist/utils/template/editor.d.ts +1 -1
- package/package.json +19 -18
- package/dist/definition-editor/query-editor/context-and-snippets.d.ts +0 -5
- package/dist/definition-editor/sql-snippet-editor/context-info.d.ts +0 -5
- package/dist/definition-editor/sql-snippet-editor/guide.d.ts +0 -2
- package/dist/panel/viz/text/index.d.ts +0 -9
- package/dist/panel/viz/text/panel.d.ts +0 -3
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { IDashboardFilter, IFilterConfig_Select } from "../../types";
|
|
3
|
+
interface IFilterSelect extends Omit<IDashboardFilter, 'type' | 'config'> {
|
|
4
|
+
config: IFilterConfig_Select;
|
|
5
|
+
value: any;
|
|
6
|
+
onChange: (v: any) => void;
|
|
7
|
+
}
|
|
8
|
+
export declare function FilterSelect({ label, config, value, onChange }: IFilterSelect): JSX.Element;
|
|
9
|
+
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { Control, FieldArrayWithId, UseFormWatch } from "react-hook-form";
|
|
3
|
+
import { IFilterSettingsForm } from "./types";
|
|
4
|
+
interface IFilterSetting {
|
|
5
|
+
field: FieldArrayWithId<IFilterSettingsForm, "filters", "id">;
|
|
6
|
+
index: number;
|
|
7
|
+
control: Control<IFilterSettingsForm, object>;
|
|
8
|
+
watch: UseFormWatch<IFilterSettingsForm>;
|
|
9
|
+
}
|
|
10
|
+
export declare function FilterSetting({ field, index, control, watch }: IFilterSetting): JSX.Element;
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { IDashboardFilter } from "../../types";
|
|
3
|
+
interface FilterSettings {
|
|
4
|
+
filters: IDashboardFilter[];
|
|
5
|
+
setFilters: (v: IDashboardFilter[]) => void;
|
|
6
|
+
}
|
|
7
|
+
export declare function FilterSettings({ filters, setFilters }: FilterSettings): JSX.Element;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { IDashboardFilter } from "../../types";
|
|
3
|
+
interface FilterSettingsModal {
|
|
4
|
+
opened: boolean;
|
|
5
|
+
close: () => void;
|
|
6
|
+
filters: IDashboardFilter[];
|
|
7
|
+
setFilters: (v: IDashboardFilter[]) => void;
|
|
8
|
+
}
|
|
9
|
+
export declare function FilterSettingsModal({ opened, close, filters, setFilters }: FilterSettingsModal): JSX.Element;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { IDashboardFilter } from "../../types";
|
|
3
|
+
import { UseFormWatch } from "react-hook-form";
|
|
4
|
+
import { IFilterSettingsForm } from "./types";
|
|
5
|
+
interface IPreviewFilter {
|
|
6
|
+
filter: IDashboardFilter;
|
|
7
|
+
index: number;
|
|
8
|
+
watch: UseFormWatch<IFilterSettingsForm>;
|
|
9
|
+
}
|
|
10
|
+
export declare function PreviewFilter({ filter, index, watch }: IPreviewFilter): JSX.Element;
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { Control, FieldArrayWithId } from "react-hook-form";
|
|
3
|
+
import { IFilterSettingsForm } from "../filter-settings/types";
|
|
4
|
+
interface IFilterEditorTextInput {
|
|
5
|
+
field: FieldArrayWithId<IFilterSettingsForm, "filters", "id">;
|
|
6
|
+
index: number;
|
|
7
|
+
control: Control<IFilterSettingsForm, object>;
|
|
8
|
+
}
|
|
9
|
+
export declare function FilterEditorTextInput({ field, index, control }: IFilterEditorTextInput): JSX.Element;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { IDashboardFilter, IFilterConfig_TextInput } from "../../types";
|
|
3
|
+
interface IFilterTextInput extends Omit<IDashboardFilter, 'type' | 'config'> {
|
|
4
|
+
config: IFilterConfig_TextInput;
|
|
5
|
+
value: any;
|
|
6
|
+
onChange: (v: any) => void;
|
|
7
|
+
}
|
|
8
|
+
export declare function FilterTextInput({ label, config, value, onChange }: IFilterTextInput): JSX.Element;
|
|
9
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { IDashboardFilter } from "../types";
|
|
3
|
+
interface IFilter {
|
|
4
|
+
filter: IDashboardFilter;
|
|
5
|
+
value: any;
|
|
6
|
+
onChange: (v: any) => void;
|
|
7
|
+
}
|
|
8
|
+
export declare const Filter: React.ForwardRefExoticComponent<IFilter & React.RefAttributes<unknown>>;
|
|
9
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { IDashboardFilter } from "../types";
|
|
3
|
+
interface IFilters {
|
|
4
|
+
filters: IDashboardFilter[];
|
|
5
|
+
filterValues: Record<string, any>;
|
|
6
|
+
setFilterValues: (v: Record<string, any>) => void;
|
|
7
|
+
}
|
|
8
|
+
export declare function Filters({ filters, filterValues, setFilterValues }: IFilters): JSX.Element | null;
|
|
9
|
+
export {};
|
package/dist/main/actions.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import { DashboardMode } from "../types";
|
|
2
|
+
import { DashboardMode, IDashboardFilter } from "../types";
|
|
3
3
|
interface IDashboardActions {
|
|
4
4
|
mode: DashboardMode;
|
|
5
5
|
setMode: React.Dispatch<React.SetStateAction<DashboardMode>>;
|
|
@@ -7,6 +7,8 @@ interface IDashboardActions {
|
|
|
7
7
|
saveChanges: () => void;
|
|
8
8
|
revertChanges: () => void;
|
|
9
9
|
getCurrentSchema: () => any;
|
|
10
|
+
filters: IDashboardFilter[];
|
|
11
|
+
setFilters: (v: IDashboardFilter[]) => void;
|
|
10
12
|
}
|
|
11
|
-
export declare function DashboardActions({ mode, setMode, hasChanges, saveChanges, revertChanges, getCurrentSchema, }: IDashboardActions): JSX.Element;
|
|
13
|
+
export declare function DashboardActions({ mode, setMode, hasChanges, saveChanges, revertChanges, getCurrentSchema, filters, setFilters, }: IDashboardActions): JSX.Element;
|
|
12
14
|
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { IDashboard, IDashboardFilter } from "../types";
|
|
3
|
+
export declare function useFilters(dashboard: IDashboard): {
|
|
4
|
+
filters: IDashboardFilter[];
|
|
5
|
+
setFilters: React.Dispatch<React.SetStateAction<IDashboardFilter[]>>;
|
|
6
|
+
filterValues: Record<string, any>;
|
|
7
|
+
setFilterValues: React.Dispatch<React.SetStateAction<Record<string, any>>>;
|
|
8
|
+
};
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
interface IDescriptionPopover {
|
|
3
|
-
position?: 'top' | 'left' | 'bottom' | 'right';
|
|
4
|
-
trigger?: 'hover' | 'click';
|
|
5
3
|
}
|
|
6
|
-
export declare function DescriptionPopover({
|
|
4
|
+
export declare function DescriptionPopover({}: IDescriptionPopover): JSX.Element | null;
|
|
7
5
|
export {};
|
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}.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}.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,3 +1,4 @@
|
|
|
1
|
+
import { IDashboardFilter } from "./filter";
|
|
1
2
|
export interface IVizConfig {
|
|
2
3
|
type: string;
|
|
3
4
|
conf: Record<string, any>;
|
|
@@ -41,6 +42,7 @@ export interface IDashboard {
|
|
|
41
42
|
name: string;
|
|
42
43
|
definition: IDashboardDefinition;
|
|
43
44
|
panels: IDashboardPanel[];
|
|
45
|
+
filters: IDashboardFilter[];
|
|
44
46
|
}
|
|
45
47
|
export interface IDashboardConfig {
|
|
46
48
|
apiBaseURL: string;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
export interface IDashboardFilterOption {
|
|
2
|
+
label: string;
|
|
3
|
+
value: string;
|
|
4
|
+
}
|
|
5
|
+
export interface IDashboardFilterOptionQuery {
|
|
6
|
+
type: 'postgresql';
|
|
7
|
+
key: string;
|
|
8
|
+
sql: string;
|
|
9
|
+
}
|
|
10
|
+
export interface IFilterConfig_Select {
|
|
11
|
+
required: boolean;
|
|
12
|
+
default_value: string;
|
|
13
|
+
static_options: IDashboardFilterOption[];
|
|
14
|
+
options_query: IDashboardFilterOptionQuery;
|
|
15
|
+
}
|
|
16
|
+
export interface IFilterConfig_MultiSelect {
|
|
17
|
+
default_value: string[];
|
|
18
|
+
static_options: IDashboardFilterOption[];
|
|
19
|
+
options_query: IDashboardFilterOptionQuery;
|
|
20
|
+
}
|
|
21
|
+
export interface IFilterConfig_TextInput {
|
|
22
|
+
required: boolean;
|
|
23
|
+
default_value: string;
|
|
24
|
+
}
|
|
25
|
+
export interface IFilterConfig_DateRange {
|
|
26
|
+
inputFormat: 'YYYY' | 'YYYY-MM' | 'YYYY-MM-DD';
|
|
27
|
+
clearable: boolean;
|
|
28
|
+
required: boolean;
|
|
29
|
+
}
|
|
30
|
+
export interface IFilterConfig_Checkbox {
|
|
31
|
+
default_value: boolean;
|
|
32
|
+
}
|
|
33
|
+
export interface IDashboardFilter {
|
|
34
|
+
key: string;
|
|
35
|
+
label: string;
|
|
36
|
+
order: number;
|
|
37
|
+
type: 'select' | 'multi-select' | 'text-input' | 'checkbox' | 'date-range';
|
|
38
|
+
config: IFilterConfig_Select | IFilterConfig_MultiSelect | IFilterConfig_TextInput | IFilterConfig_DateRange | IFilterConfig_Checkbox;
|
|
39
|
+
}
|
package/dist/types/index.d.ts
CHANGED
package/dist/utils/sql.d.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
import { ContextInfoContextType } from "../contexts";
|
|
1
|
+
import { ContextInfoContextType, FilterValuesContextType } from "../contexts";
|
|
2
2
|
import { IDashboardDefinition } from "../types";
|
|
3
3
|
export declare function explainSQLSnippet(snippet: string, context: ContextInfoContextType): any;
|
|
4
4
|
export declare function formatSQL(sql: string, params: Record<string, any>): any;
|
|
5
|
-
export declare function getSQLParams(context: ContextInfoContextType, definitions: IDashboardDefinition): Record<string, any> & ContextInfoContextType
|
|
6
|
-
|
|
5
|
+
export declare function getSQLParams(context: ContextInfoContextType, definitions: IDashboardDefinition, filterValues: FilterValuesContextType): Record<string, any> & ContextInfoContextType & {
|
|
6
|
+
filters: FilterValuesContextType;
|
|
7
|
+
};
|
|
8
|
+
export declare function explainSQL(sql: string, context: ContextInfoContextType, definitions: IDashboardDefinition, filterValues: FilterValuesContextType): any;
|
|
@@ -12,5 +12,5 @@ interface ITemplateVariableField {
|
|
|
12
12
|
onChange: (v: ITemplateVariable) => void;
|
|
13
13
|
data: any[];
|
|
14
14
|
}
|
|
15
|
-
export declare
|
|
15
|
+
export declare const TemplateVariableField: React.ForwardRefExoticComponent<ITemplateVariableField & React.RefAttributes<unknown>>;
|
|
16
16
|
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@devtable/dashboard",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.3.0",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public",
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
}
|
|
23
23
|
},
|
|
24
24
|
"scripts": {
|
|
25
|
-
"dev": "vite",
|
|
25
|
+
"dev-build": "tsc && vite build --watch",
|
|
26
26
|
"build": "tsc && vite build",
|
|
27
27
|
"preview": "vite preview"
|
|
28
28
|
},
|
|
@@ -30,14 +30,14 @@
|
|
|
30
30
|
"popmotion": "^11.0.3"
|
|
31
31
|
},
|
|
32
32
|
"devDependencies": {
|
|
33
|
-
"@mantine/core": "^
|
|
34
|
-
"@mantine/dates": "^
|
|
35
|
-
"@mantine/form": "^
|
|
36
|
-
"@mantine/hooks": "^
|
|
37
|
-
"@mantine/modals": "^
|
|
38
|
-
"@mantine/notifications": "^
|
|
39
|
-
"@mantine/prism": "^
|
|
40
|
-
"@mantine/rte": "^
|
|
33
|
+
"@mantine/core": "^5.0.2",
|
|
34
|
+
"@mantine/dates": "^5.0.2",
|
|
35
|
+
"@mantine/form": "^5.0.2",
|
|
36
|
+
"@mantine/hooks": "^5.0.2",
|
|
37
|
+
"@mantine/modals": "^5.0.2",
|
|
38
|
+
"@mantine/notifications": "^5.0.2",
|
|
39
|
+
"@mantine/prism": "^5.0.2",
|
|
40
|
+
"@mantine/rte": "^5.0.2",
|
|
41
41
|
"@types/lodash": "^4.14.182",
|
|
42
42
|
"@types/react": "^18.0.0",
|
|
43
43
|
"@types/react-dom": "^18.0.0",
|
|
@@ -60,14 +60,15 @@
|
|
|
60
60
|
"vite-plugin-dts": "^1.1.1"
|
|
61
61
|
},
|
|
62
62
|
"peerDependencies": {
|
|
63
|
-
"@
|
|
64
|
-
"@mantine/
|
|
65
|
-
"@mantine/
|
|
66
|
-
"@mantine/
|
|
67
|
-
"@mantine/
|
|
68
|
-
"@mantine/
|
|
69
|
-
"@mantine/
|
|
70
|
-
"@mantine/
|
|
63
|
+
"@emotion/react": "11.10.0",
|
|
64
|
+
"@mantine/core": "^5.0.2",
|
|
65
|
+
"@mantine/dates": "^5.0.2",
|
|
66
|
+
"@mantine/form": "^5.0.2",
|
|
67
|
+
"@mantine/hooks": "^5.0.2",
|
|
68
|
+
"@mantine/modals": "^5.0.2",
|
|
69
|
+
"@mantine/notifications": "^5.0.2",
|
|
70
|
+
"@mantine/prism": "^5.0.2",
|
|
71
|
+
"@mantine/rte": "^5.0.2",
|
|
71
72
|
"ahooks": "^3.3.11",
|
|
72
73
|
"axios": "^0.27.2",
|
|
73
74
|
"echarts": "^5.3.2",
|