@gingkoo/pandora-metabase 0.0.1-alpha.4 → 0.0.1-alpha.6
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/README.md +61 -26
- package/lib/es/index.js +136 -33
- package/lib/es/index.js.map +1 -1
- package/lib/es/store/index.d.ts +10 -0
- package/lib/es/store/types.d.ts +3 -1
- package/lib/es/types.d.ts +6 -1
- package/lib/es/utils/helper.d.ts +3 -0
- package/package.json +1 -1
package/lib/es/store/index.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
import { ToolbarType } from './types';
|
|
2
3
|
import type { MetaListType, TableColumnsMapType, initColumnsType, TableType, MetaData_ColumnsType, PopupData } from './types';
|
|
3
4
|
import type { DatasourceType } from '../types';
|
|
4
5
|
export { observer } from 'mobx-react';
|
|
@@ -10,6 +11,10 @@ export interface TableFieldsType {
|
|
|
10
11
|
declare class SqlVisionStore {
|
|
11
12
|
constructor();
|
|
12
13
|
showPermissionTable: boolean;
|
|
14
|
+
showFields: boolean;
|
|
15
|
+
toolbar: ToolbarType[];
|
|
16
|
+
fieldNameTpl: string;
|
|
17
|
+
tableNameTpl: string;
|
|
13
18
|
sourceList: DatasourceType[];
|
|
14
19
|
_cacheSource2TableMap: {
|
|
15
20
|
[datasourceId: string]: TableType[];
|
|
@@ -37,9 +42,14 @@ declare class SqlVisionStore {
|
|
|
37
42
|
setPopup(payload: PopupData): void;
|
|
38
43
|
setClosable(payload: boolean): void;
|
|
39
44
|
setShowPermissionTable(show: boolean): void;
|
|
45
|
+
setShowFields(show: boolean): void;
|
|
46
|
+
setToolbar(toolbar: ToolbarType[]): void;
|
|
47
|
+
setFieldNameTpl(tpl: string): void;
|
|
48
|
+
setTableNameTpl(tpl: string): void;
|
|
40
49
|
}
|
|
41
50
|
export declare const sqlVisionStore: SqlVisionStore;
|
|
42
51
|
export declare const Store: React.Context<SqlVisionStore>;
|
|
52
|
+
export type SqlVisionStoreType = InstanceType<typeof SqlVisionStore>;
|
|
43
53
|
declare const StoreProvide: React.FC<{
|
|
44
54
|
children: React.ReactNode;
|
|
45
55
|
}>;
|
package/lib/es/store/types.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { DatasourceType } from '../types';
|
|
2
2
|
import { TypeEnum, SpecialType, JoinEnum, SQL_COLUMN_TYPE, SortEnum } from './enum';
|
|
3
|
+
export type ToolbarType = TypeEnum | 'filter' | 'summarize' | 'joinData' | 'permissionTable' | 'customColumn' | 'sort' | 'rowLimit';
|
|
3
4
|
export type MetaListType = MetaData | MetaJoin | MetaJoin | MetaCustom | MetaFilter | MetaSummarize | MetaSort | MetaLimit | MetaPermissionTable;
|
|
4
5
|
export type initColumnsType = MetaData_ColumnsType;
|
|
5
6
|
export interface TableColumnsMapType {
|
|
@@ -12,7 +13,7 @@ export interface TableType {
|
|
|
12
13
|
export type MetaData_TableType = TableType & DatasourceType;
|
|
13
14
|
export interface MetaData_ColumnsType {
|
|
14
15
|
name: string;
|
|
15
|
-
name_zh
|
|
16
|
+
name_zh?: string;
|
|
16
17
|
realName?: string;
|
|
17
18
|
database_type: SQL_COLUMN_TYPE | '';
|
|
18
19
|
special_type: SpecialType | '';
|
|
@@ -73,6 +74,7 @@ export interface MetaSummarize_Group {
|
|
|
73
74
|
sql: string;
|
|
74
75
|
condition: string;
|
|
75
76
|
quotes: string;
|
|
77
|
+
[params: string]: any;
|
|
76
78
|
}
|
|
77
79
|
export interface MetaSummarize_By {
|
|
78
80
|
table: string;
|
package/lib/es/types.d.ts
CHANGED
|
@@ -1,11 +1,15 @@
|
|
|
1
|
-
import type { MetaListType } from './store/types';
|
|
1
|
+
import type { MetaListType, ToolbarType } from './store/types';
|
|
2
2
|
export interface MetabaseProps {
|
|
3
3
|
loading?: boolean;
|
|
4
4
|
btnText?: string;
|
|
5
5
|
showPermissionTable?: boolean;
|
|
6
|
+
showFields?: boolean;
|
|
6
7
|
readonly?: boolean;
|
|
7
8
|
getTables: (datasourceId: string) => Promise<any>;
|
|
8
9
|
getColumns: (table: string, datasourceId: string) => Promise<any>;
|
|
10
|
+
toolbar?: ToolbarType[] | false;
|
|
11
|
+
tableNameTpl?: string;
|
|
12
|
+
fieldNameTpl?: string;
|
|
9
13
|
onOk: (params: any) => Promise<void>;
|
|
10
14
|
}
|
|
11
15
|
export interface DatasourceType {
|
|
@@ -15,4 +19,5 @@ export interface DatasourceType {
|
|
|
15
19
|
export interface SqlVisionBuilderRef {
|
|
16
20
|
setDatasource: (list: DatasourceType[]) => void;
|
|
17
21
|
setPreData: (data: MetaListType[]) => void;
|
|
22
|
+
reset: () => void;
|
|
18
23
|
}
|
package/lib/es/utils/helper.d.ts
CHANGED
|
@@ -11,3 +11,6 @@ export declare const getUrlParams: () => any;
|
|
|
11
11
|
export declare const sleep: (wait?: number) => Promise<unknown>;
|
|
12
12
|
export declare const flatArray: (arr: any[]) => any[];
|
|
13
13
|
export declare const mobx2Object: (mobxObj: any, defaultType?: any) => any;
|
|
14
|
+
export declare const replaceTpl: (inputString: string, values: {
|
|
15
|
+
[key: string]: any;
|
|
16
|
+
}) => string;
|