@gingkoo/pandora-metabase 0.0.29 → 1.0.0-alpha.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 (32) hide show
  1. package/README.md +6 -1
  2. package/lib/es/components/dialog/custom-editor/enum.d.ts +43 -0
  3. package/lib/es/components/dialog/custom-editor/index.d.ts +10 -0
  4. package/lib/es/components/dialog/custom-editor/utils.d.ts +8 -0
  5. package/lib/es/components/dialog/select-column/index.d.ts +2 -1
  6. package/lib/es/components/dialog/select-filter/index.d.ts +10 -1
  7. package/lib/es/components/dialog/select-join-column/index.d.ts +4 -0
  8. package/lib/es/components/dialog/select-list/index.d.ts +10 -0
  9. package/lib/es/components/icons.d.ts +1 -0
  10. package/lib/es/components/modules/components/meta-icon.d.ts +1 -0
  11. package/lib/es/components/modules/custom-column.d.ts +1 -0
  12. package/lib/es/components/modules/filter.d.ts +1 -0
  13. package/lib/es/components/modules/group.d.ts +9 -0
  14. package/lib/es/components/modules/join-data.d.ts +1 -0
  15. package/lib/es/components/modules/permission-table.d.ts +1 -0
  16. package/lib/es/components/modules/row-limit.d.ts +1 -0
  17. package/lib/es/components/modules/sort.d.ts +1 -0
  18. package/lib/es/components/modules/summarize/group-by.d.ts +1 -0
  19. package/lib/es/components/modules/summarize/index.d.ts +1 -0
  20. package/lib/es/components/modules/summarize/select-index.d.ts +1 -0
  21. package/lib/es/components/modules/table-data.d.ts +1 -0
  22. package/lib/es/components/popup.d.ts +1 -0
  23. package/lib/es/index.js +4423 -3445
  24. package/lib/es/index.js.map +1 -1
  25. package/lib/es/store/enum.d.ts +6 -1
  26. package/lib/es/store/helper.d.ts +4 -1
  27. package/lib/es/store/types.d.ts +40 -1
  28. package/lib/es/types.d.ts +14 -1
  29. package/lib/es/utils/helper-dom.d.ts +1 -0
  30. package/lib/es/utils/helper.d.ts +1 -0
  31. package/lib/es/utils.d.ts +3 -1
  32. package/package.json +2 -4
@@ -10,13 +10,18 @@ export declare enum TypeEnum {
10
10
  filter = "filter",
11
11
  summarize = "summarize",
12
12
  sort = "sort",
13
- rowLimit = "rowLimit"
13
+ rowLimit = "rowLimit",
14
+ group = "group"
14
15
  }
15
16
  export declare enum JoinEnum {
16
17
  left = "LEFT JOIN",
17
18
  right = "RIGHT JOIN",
18
19
  inner = "INNER JOIN"
19
20
  }
21
+ export declare enum UnionEnum {
22
+ union = "UNION",
23
+ unionAll = "UNION ALL"
24
+ }
20
25
  export declare enum ColumnsPopupThemeEnum {
21
26
  skyBlue = "skyBlue",
22
27
  greenGrass = "greenGrass",
@@ -1,7 +1,10 @@
1
1
  import { MetaListType, MetaFilter_Item, MetaSummarize_Group, ParamsStruct } from './types';
2
2
  export declare const SummarizeAlias = "source";
3
3
  export declare const filterToSql: (record: MetaFilter_Item) => string;
4
- export declare const summarizeToSql: (arr: MetaSummarize_Group[], record: MetaSummarize_Group) => string;
4
+ export declare const summarizeToSql: (arr: MetaSummarize_Group[], record: MetaSummarize_Group) => {
5
+ sql: string;
6
+ fieldAlias: string;
7
+ };
5
8
  export declare const handleSqlStruct: (list: MetaListType[]) => ParamsStruct;
6
9
  export declare const compressionStructure: (data: MetaListType[]) => string;
7
10
  export declare const restoreStructure: (data: string) => MetaListType[];
@@ -1,6 +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
+ export type ToolbarType = TypeEnum | 'filter' | 'summarize' | 'joinData' | 'permissionTable' | 'customColumn' | 'sort' | 'rowLimit' | 'group';
4
4
  export type MetaListType = MetaData | MetaJoin | MetaCustom | MetaFilter | MetaSummarize | MetaSort | MetaLimit | MetaPermissionTable;
5
5
  export type initColumnsType = MetaData_ColumnsType;
6
6
  interface ExpressionsType {
@@ -9,9 +9,13 @@ interface ExpressionsType {
9
9
  left_column_id: string;
10
10
  left_string: string;
11
11
  left_isString: boolean;
12
+ left_type: 'string' | 'constant' | 'field' | '' | null;
13
+ left_constant: string;
12
14
  right_column: string;
13
15
  right_column_id: string;
14
16
  right_string: string;
17
+ right_type: 'string' | 'constant' | 'field' | '' | null;
18
+ right_constant: string;
15
19
  right_isString: boolean;
16
20
  }
17
21
  export interface TableColumnsMapType {
@@ -21,12 +25,15 @@ export interface TableType {
21
25
  name: string;
22
26
  id: string;
23
27
  alias: string;
28
+ tableUuid: string;
24
29
  }
25
30
  export type MetaData_TableType = TableType & DatasourceType;
26
31
  export interface MetaData_ColumnsType {
27
32
  name: string;
28
33
  id: string;
29
34
  name_zh?: string;
35
+ fieldAlias: string;
36
+ fieldUuid: string;
30
37
  realName?: string;
31
38
  database_type: SQL_COLUMN_TYPE | '';
32
39
  special_type: SpecialType | '';
@@ -45,6 +52,7 @@ export interface MetaData {
45
52
  export interface MetaJoin_TalbeType {
46
53
  name: string;
47
54
  id: string;
55
+ tableUuid: string;
48
56
  alias: string;
49
57
  datasourceName: string;
50
58
  datasourceId: string;
@@ -69,6 +77,8 @@ export interface MetaJoin {
69
77
  export interface MetaCustom_Item {
70
78
  name: string;
71
79
  formula: string;
80
+ type?: string;
81
+ formulaList?: any[];
72
82
  }
73
83
  export interface MetaCustom {
74
84
  metaKey: number;
@@ -79,9 +89,16 @@ export interface Filter_Formula {
79
89
  type?: string;
80
90
  params?: string[] | number[];
81
91
  }
92
+ export declare enum Filter_TypeEnum {
93
+ EXPRESSION = "expression",
94
+ NOT_EXISTS = "notExists"
95
+ }
82
96
  export interface MetaFilter_Item {
83
97
  table: string;
84
98
  tableId: string;
99
+ tableUuid: string;
100
+ fieldUuid: string;
101
+ fieldAlias: string;
85
102
  alias: string;
86
103
  name: string;
87
104
  id: string;
@@ -93,8 +110,15 @@ export interface MetaFilter_Item {
93
110
  datasourceId: string;
94
111
  datasourceName: string;
95
112
  isField?: boolean;
113
+ valType?: 'field' | 'string' | 'constant' | '';
114
+ constantName?: string;
96
115
  table2?: Omit<MetaJoin_TalbeType, 'column' | 'column_id'> | null;
97
116
  formula?: Filter_Formula;
117
+ subquery?: any[];
118
+ type?: Filter_TypeEnum;
119
+ summarizeType?: MetaSummarize_Enum;
120
+ sql?: string;
121
+ realName?: string;
98
122
  }
99
123
  export interface MetaFilter {
100
124
  metaKey: number;
@@ -102,27 +126,38 @@ export interface MetaFilter {
102
126
  isPermanent?: boolean;
103
127
  filter: MetaFilter_Item[];
104
128
  }
129
+ export declare enum MetaSummarize_Enum {
130
+ GROUP = "group",
131
+ BY = "by"
132
+ }
105
133
  export interface MetaSummarize_Group {
106
134
  table: string;
107
135
  tableId: string;
136
+ tableUuid: string;
108
137
  alias?: string;
109
138
  name: string;
110
139
  id: string;
111
140
  realName?: string;
112
141
  database_type?: SQL_COLUMN_TYPE | '';
113
142
  sql: string;
143
+ fieldAlias: string;
144
+ fieldUuid: string;
114
145
  condition: string;
115
146
  quotes: string;
116
147
  datasourceId: string;
117
148
  datasourceName: string;
118
149
  column: string;
119
150
  column_id: string;
151
+ summarizeType: MetaSummarize_Enum;
120
152
  [params: string]: any;
121
153
  }
122
154
  export interface MetaSummarize_By {
123
155
  table: string;
124
156
  tableId: string;
157
+ tableUuid: string;
125
158
  alias: string;
159
+ fieldAlias: string;
160
+ fieldUuid: string;
126
161
  name: string;
127
162
  id: string;
128
163
  datasourceId: string;
@@ -134,16 +169,20 @@ export interface MetaSummarize_By {
134
169
  database_type: SQL_COLUMN_TYPE | '';
135
170
  condition: string;
136
171
  quotes: string;
172
+ summarizeType: MetaSummarize_Enum;
137
173
  }
138
174
  export interface MetaSummarize {
139
175
  metaKey: number;
140
176
  type: TypeEnum.summarize;
141
177
  alias: string;
178
+ tableUuid: string;
142
179
  group: MetaSummarize_Group[];
143
180
  by: MetaSummarize_By[];
144
181
  }
145
182
  export interface MetaSort_Item {
146
183
  table: string;
184
+ tableId: string;
185
+ tableUuid: string;
147
186
  alias: string;
148
187
  name: string;
149
188
  sql: string;
package/lib/es/types.d.ts CHANGED
@@ -1,4 +1,11 @@
1
1
  import type { MetaListType, ToolbarType } from './store/types';
2
+ import { UnionEnum } from './store/enum';
3
+ export interface MetaListProps {
4
+ name: string;
5
+ type: 'group' | 'operator';
6
+ operator?: UnionEnum;
7
+ list: MetaListType[];
8
+ }
2
9
  export interface MetabaseProps {
3
10
  loading?: boolean;
4
11
  btnText?: string;
@@ -17,7 +24,13 @@ export interface MetabaseProps {
17
24
  value?: MetaListType[];
18
25
  sourceList?: DatasourceType[];
19
26
  showSubquery?: boolean;
20
- _showSubquery?: boolean;
27
+ subShowSubquery?: boolean;
28
+ constantList?: OptionItem[];
29
+ }
30
+ export interface OptionItem {
31
+ value?: string;
32
+ label: string;
33
+ icon?: React.ReactNode;
21
34
  }
22
35
  export interface DatasourceType {
23
36
  datasourceId: string;
@@ -9,3 +9,4 @@ export declare const getWindowSize: () => {
9
9
  width: number;
10
10
  height: number;
11
11
  };
12
+ export declare const getMaxZIndexInParents: (element: any) => number | "auto";
@@ -14,3 +14,4 @@ export declare const mobx2Object: (mobxObj: any, defaultType?: any) => any;
14
14
  export declare const replaceTpl: (inputString: string, values: {
15
15
  [key: string]: any;
16
16
  }) => string;
17
+ export declare const uuidv4: (prefix?: string) => string;
package/lib/es/utils.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { TypeEnum } from './store/enum';
2
- import { MetaListType, MetaSummarize } from './store/types';
2
+ import { MetaListType, MetaSummarize, MetaData_TableType, MetaData_ColumnsType } from './store/types';
3
3
  import { DataType } from './components/dialog/select-join-column';
4
4
  export declare const findIndex: <T>(arr: T[], item: T) => number;
5
5
  interface HelperResultType {
@@ -14,4 +14,6 @@ interface HelperResultType {
14
14
  }
15
15
  export declare const getHelper: (list: MetaListType[], item: MetaListType) => HelperResultType;
16
16
  export declare const getSubColumns: (metaList: any) => DataType[];
17
+ export declare const changeTableAlias: (list: MetaListType[], curObj: MetaData_TableType) => MetaListType[];
18
+ export declare const changeFieldAlias: (list: MetaListType[], curObj: MetaData_ColumnsType) => MetaListType[];
17
19
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gingkoo/pandora-metabase",
3
- "version": "0.0.29",
3
+ "version": "1.0.0-alpha.1",
4
4
  "description": "",
5
5
  "main": "lib/es/index.js",
6
6
  "module": "lib/es/index.js",
@@ -25,11 +25,9 @@
25
25
  "react-dom": "^17.0.0 || ^18.0.0"
26
26
  },
27
27
  "dependencies": {
28
- "@ant-design/icons": "^4.8.0",
29
- "@gingkoo/pandora": "^1.0.0-alpha.79",
28
+ "@gingkoo/pandora": "^1.0.5",
30
29
  "@gingkoo/pandora-hooks": "^1.0.5",
31
30
  "@gingkoo/pandora-icons": "^0.0.1-alpha.28",
32
- "antd": "5.0.7",
33
31
  "dayjs": "^1.11.11",
34
32
  "lodash": "^4.17.21",
35
33
  "mobx": "^6.7.0",