@gingkoo/pandora-metabase 0.0.1-alpha.9 → 0.0.13

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.
@@ -1,4 +1,5 @@
1
1
  import { MetaListType, MetaFilter_Item, MetaSummarize_Group, ParamsStruct } from './types';
2
+ export declare const SummarizeAlias = "source";
2
3
  export declare const filterToSql: (record: MetaFilter_Item) => string;
3
4
  export declare const summarizeToSql: (arr: MetaSummarize_Group[], record: MetaSummarize_Group) => string;
4
5
  export declare const handleSqlStruct: (list: MetaListType[]) => ParamsStruct;
@@ -1,8 +1,19 @@
1
1
  import type { DatasourceType } from '../types';
2
2
  import { TypeEnum, SpecialType, JoinEnum, SQL_COLUMN_TYPE, SortEnum } from './enum';
3
3
  export type ToolbarType = TypeEnum | 'filter' | 'summarize' | 'joinData' | 'permissionTable' | 'customColumn' | 'sort' | 'rowLimit';
4
- export type MetaListType = MetaData | MetaJoin | MetaJoin | MetaCustom | MetaFilter | MetaSummarize | MetaSort | MetaLimit | MetaPermissionTable;
4
+ export type MetaListType = MetaData | MetaJoin | MetaCustom | MetaFilter | MetaSummarize | MetaSort | MetaLimit | MetaPermissionTable;
5
5
  export type initColumnsType = MetaData_ColumnsType;
6
+ interface ExpressionsType {
7
+ operator: string;
8
+ left_column: string;
9
+ left_column_id: string;
10
+ left_string: string;
11
+ left_isString: boolean;
12
+ right_column: string;
13
+ right_column_id: string;
14
+ right_string: string;
15
+ right_isString: boolean;
16
+ }
6
17
  export interface TableColumnsMapType {
7
18
  [tableName: string]: initColumnsType[];
8
19
  }
@@ -22,6 +33,7 @@ export interface MetaData_ColumnsType {
22
33
  export interface MetaData {
23
34
  metaKey: number;
24
35
  readonly?: boolean;
36
+ hidden?: boolean;
25
37
  type: TypeEnum.data;
26
38
  table: MetaData_TableType;
27
39
  columns: MetaData_ColumnsType[];
@@ -40,9 +52,13 @@ export interface MetaJoin {
40
52
  type: TypeEnum.joinData;
41
53
  joinType: JoinEnum;
42
54
  readonly?: boolean;
55
+ hidden?: boolean;
43
56
  table1: MetaJoin_TalbeType;
44
57
  table2: MetaJoin_TalbeType;
45
58
  columns: MetaData_ColumnsType[];
59
+ expressions: ExpressionsType[];
60
+ isSubquery?: boolean;
61
+ subquery?: any[];
46
62
  }
47
63
  export interface MetaCustom_Item {
48
64
  name: string;
@@ -66,6 +82,7 @@ export interface MetaFilter_Item {
66
82
  export interface MetaFilter {
67
83
  metaKey: number;
68
84
  type: TypeEnum.filter;
85
+ isPermanent?: boolean;
69
86
  filter: MetaFilter_Item[];
70
87
  }
71
88
  export interface MetaSummarize_Group {
package/lib/es/types.d.ts CHANGED
@@ -9,17 +9,19 @@ export interface MetabaseProps {
9
9
  name: string;
10
10
  [key: string]: any;
11
11
  }, datasourceId: string) => Promise<any>;
12
- toolbar?: ToolbarType[] | false;
12
+ toolbar?: ToolbarType[];
13
13
  tableNameTpl?: string;
14
14
  fieldNameTpl?: string;
15
- onOk: (params: any) => Promise<void>;
15
+ onOk?: (params: any) => void;
16
+ value?: MetaListType[];
17
+ sourceList?: DatasourceType[];
18
+ showSubquery?: boolean;
19
+ _showSubquery?: boolean;
16
20
  }
17
21
  export interface DatasourceType {
18
22
  datasourceId: string;
19
23
  datasourceName: string;
20
24
  }
21
25
  export interface SqlVisionBuilderRef {
22
- setDatasource: (list: DatasourceType[]) => void;
23
- setPreData: (data: MetaListType[]) => void;
24
26
  reset: () => void;
25
27
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gingkoo/pandora-metabase",
3
- "version": "0.0.1-alpha.9",
3
+ "version": "0.0.13",
4
4
  "description": "",
5
5
  "main": "lib/es/index.js",
6
6
  "module": "lib/es/index.js",
@@ -25,13 +25,13 @@
25
25
  "react-dom": "^17.0.0 || ^18.0.0"
26
26
  },
27
27
  "dependencies": {
28
- "@gingkoo/pandora": "^1.0.0-alpha.71",
29
- "@gingkoo/pandora-icons": "^0.0.1-alpha.28",
28
+ "@ant-design/icons": "^4.8.0",
29
+ "@gingkoo/pandora": "^1.0.0-alpha.79",
30
30
  "@gingkoo/pandora-hooks": "^1.0.5",
31
+ "@gingkoo/pandora-icons": "^0.0.1-alpha.28",
32
+ "antd": "5.0.7",
31
33
  "dayjs": "^1.11.11",
32
- "@ant-design/icons": "^4.8.0",
33
34
  "lodash": "^4.17.21",
34
- "antd": "^5.0.7",
35
35
  "mobx": "^6.7.0",
36
36
  "mobx-react": "^7.6.0",
37
37
  "react-scroll": "^1.9.0",
@@ -44,17 +44,18 @@
44
44
  "@babel/preset-modules": "^0.1.6",
45
45
  "@babel/preset-react": "^7.23.3",
46
46
  "@babel/preset-typescript": "^7.23.3",
47
+ "@emotion/css": "^11.11.2",
47
48
  "@rollup/plugin-commonjs": "^25.0.7",
48
49
  "@rollup/plugin-image": "^3.0.3",
49
50
  "@rollup/plugin-json": "^6.1.0",
50
51
  "@rollup/plugin-node-resolve": "^15.2.3",
51
52
  "@rollup/plugin-replace": "^5.0.5",
52
53
  "@rollup/plugin-typescript": "^11.1.6",
53
- "@types/underscore": "^1.11.4",
54
54
  "@types/lodash": "^4.14.202",
55
55
  "@types/react": "^18.2.49",
56
56
  "@types/react-dom": "^18.2.18",
57
57
  "@types/styled-components": "^5.1.12",
58
+ "@types/underscore": "^1.11.4",
58
59
  "babel-plugin-dev-expression": "^0.2.3",
59
60
  "cross-env": "^7.0.2",
60
61
  "fs-extra": "^11.2.0",
@@ -62,7 +63,6 @@
62
63
  "postcss": "^8.4.33",
63
64
  "postcss-url": "^10.1.3",
64
65
  "prettier": "^3.2.4",
65
- "@emotion/css": "^11.11.2",
66
66
  "react": "^18.2.0",
67
67
  "react-dom": "^18.2.0",
68
68
  "rimraf": "^5.0.5",
@@ -1,6 +0,0 @@
1
- import React from 'react';
2
- import './locale/en';
3
- import './locale/zh';
4
- import type { MetabaseProps, SqlVisionBuilderRef } from './types';
5
- declare const _default: React.ForwardRefExoticComponent<MetabaseProps & React.RefAttributes<SqlVisionBuilderRef>>;
6
- export default _default;
@@ -1,63 +0,0 @@
1
- import React from 'react';
2
- import { ToolbarType, MetaJoin_TalbeType } from './types';
3
- import type { MetaListType, TableColumnsMapType, initColumnsType, TableType, MetaData_TableType, MetaData_ColumnsType, PopupData } from './types';
4
- import type { DatasourceType } from '../types';
5
- export { observer } from 'mobx-react';
6
- export declare const SummarizeAlias = "source";
7
- export interface TableFieldsType {
8
- dataId: string;
9
- [name: string]: any;
10
- }
11
- declare class SqlVisionStore {
12
- constructor();
13
- showFields: boolean;
14
- toolbar: ToolbarType[];
15
- fieldNameTpl: string;
16
- tableNameTpl: string;
17
- sourceList: DatasourceType[];
18
- _cacheSource2TableMap: {
19
- [datasourceId: string]: TableType[];
20
- };
21
- _cacheColumnsMap: TableColumnsMapType;
22
- metaList: MetaListType[];
23
- popupData: PopupData;
24
- popupClosable: boolean;
25
- get showMainColumn(): boolean;
26
- showToolbar(name: ToolbarType): boolean;
27
- fetchDatasetFn: (id: string) => Promise<any>;
28
- fetchColumnsFn: (table: {
29
- name: string;
30
- [key: string]: any;
31
- }, id: string) => Promise<any>;
32
- setFetchDatasetFn(fn: (id: string) => Promise<any>): void;
33
- setFetchColumnsFn(fn: (table: {
34
- name: string;
35
- [key: string]: any;
36
- }, id: string) => Promise<any>): void;
37
- fetchDataset(datasourceId: string): Promise<any>;
38
- fetchColumns(table: MetaJoin_TalbeType | MetaData_TableType, datasourceId: string, callback: (record: MetaData_ColumnsType[]) => void): Promise<any>;
39
- setPreData(data: MetaListType[]): Promise<void>;
40
- setSourceList(list: DatasourceType[]): void;
41
- addMeta(type: string, index: number): void;
42
- delMeta(meta: any): void;
43
- setMeta(payload: any): void;
44
- setColumns(tableId: string, columns: initColumnsType[]): void;
45
- getColumns(tableId: string): MetaData_ColumnsType[];
46
- setDataset(datasourceId: string, tables: TableType[]): void;
47
- getDataset(datasourceId: string): TableType[];
48
- setPopup(payload: PopupData): void;
49
- setClosable(payload: boolean): void;
50
- setShowFields(show: boolean): void;
51
- setToolbar(toolbar: ToolbarType[]): void;
52
- setFieldNameTpl(tpl: string): void;
53
- setTableNameTpl(tpl: string): void;
54
- reset(): void;
55
- }
56
- export declare const sqlVisionStore: SqlVisionStore;
57
- export declare const Store: React.Context<SqlVisionStore>;
58
- export type SqlVisionStoreType = InstanceType<typeof SqlVisionStore>;
59
- declare const StoreProvide: React.FC<{
60
- children: React.ReactNode;
61
- }>;
62
- export default StoreProvide;
63
- export declare const useStore: () => SqlVisionStore;