@gingkoo/pandora-metabase 0.0.30 → 1.0.0-alpha.10

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 +25 -11
  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 +11 -1
  7. package/lib/es/components/dialog/select-join-column/index.d.ts +5 -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/join-data.d.ts +1 -0
  14. package/lib/es/components/modules/permission-table.d.ts +1 -0
  15. package/lib/es/components/modules/row-limit.d.ts +1 -0
  16. package/lib/es/components/modules/sort.d.ts +1 -0
  17. package/lib/es/components/modules/summarize/group-by.d.ts +1 -0
  18. package/lib/es/components/modules/summarize/index.d.ts +1 -0
  19. package/lib/es/components/modules/summarize/select-index.d.ts +1 -0
  20. package/lib/es/components/modules/table-data.d.ts +1 -0
  21. package/lib/es/components/modules/union.d.ts +9 -0
  22. package/lib/es/components/popup.d.ts +8 -2
  23. package/lib/es/index.js +4988 -3789
  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 +51 -16
  28. package/lib/es/types.d.ts +16 -1
  29. package/lib/es/utils/helper-dom.d.ts +4 -3
  30. package/lib/es/utils/helper.d.ts +1 -0
  31. package/lib/es/utils.d.ts +5 -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
+ union = "union"
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,17 +1,22 @@
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' | 'union';
4
4
  export type MetaListType = MetaData | MetaJoin | MetaCustom | MetaFilter | MetaSummarize | MetaSort | MetaLimit | MetaPermissionTable;
5
5
  export type initColumnsType = MetaData_ColumnsType;
6
6
  interface ExpressionsType {
7
7
  operator: string;
8
- left_column: string;
9
- left_column_id: string;
8
+ left_fieldAlias: string;
9
+ left_fieldUuid: string;
10
+ left_quotes: string;
10
11
  left_string: string;
11
- left_isString: boolean;
12
- right_column: string;
13
- right_column_id: string;
12
+ left_type: 'string' | 'constant' | 'field' | '' | null;
13
+ left_constant: string;
14
+ right_fieldAlias: string;
15
+ right_fieldUuid: string;
16
+ right_quotes: string;
14
17
  right_string: string;
18
+ right_type: 'string' | 'constant' | 'field' | '' | null;
19
+ right_constant: string;
15
20
  right_isString: boolean;
16
21
  }
17
22
  export interface TableColumnsMapType {
@@ -21,18 +26,22 @@ export interface TableType {
21
26
  name: string;
22
27
  id: string;
23
28
  alias: string;
29
+ tableUuid: string;
24
30
  }
25
31
  export type MetaData_TableType = TableType & DatasourceType;
26
32
  export interface MetaData_ColumnsType {
27
33
  name: string;
28
34
  id: string;
29
35
  name_zh?: string;
36
+ fieldAlias: string;
37
+ fieldUuid: string;
30
38
  realName?: string;
31
39
  database_type: SQL_COLUMN_TYPE | '';
32
40
  special_type: SpecialType | '';
33
41
  datasourceId: string;
34
42
  datasourceName: string;
35
43
  select: boolean;
44
+ summarizeType?: MetaSummarize_Enum;
36
45
  }
37
46
  export interface MetaData {
38
47
  metaKey: number;
@@ -45,13 +54,14 @@ export interface MetaData {
45
54
  export interface MetaJoin_TalbeType {
46
55
  name: string;
47
56
  id: string;
57
+ tableUuid: string;
48
58
  alias: string;
49
59
  datasourceName: string;
50
60
  datasourceId: string;
51
- column: string;
52
- column_id: string;
61
+ fieldAlias: string;
62
+ fieldUuid: string;
53
63
  groupSql?: string;
54
- [name: string]: any;
64
+ quotes?: string;
55
65
  }
56
66
  export interface MetaJoin {
57
67
  metaKey: number;
@@ -68,7 +78,8 @@ export interface MetaJoin {
68
78
  }
69
79
  export interface MetaCustom_Item {
70
80
  name: string;
71
- formula: string;
81
+ type?: string;
82
+ formulaList?: any[];
72
83
  }
73
84
  export interface MetaCustom {
74
85
  metaKey: number;
@@ -79,9 +90,16 @@ export interface Filter_Formula {
79
90
  type?: string;
80
91
  params?: string[] | number[];
81
92
  }
93
+ export declare enum Filter_TypeEnum {
94
+ EXPRESSION = "expression",
95
+ NOT_EXISTS = "notExists"
96
+ }
82
97
  export interface MetaFilter_Item {
83
98
  table: string;
84
99
  tableId: string;
100
+ tableUuid: string;
101
+ fieldUuid: string;
102
+ fieldAlias: string;
85
103
  alias: string;
86
104
  name: string;
87
105
  id: string;
@@ -93,8 +111,15 @@ export interface MetaFilter_Item {
93
111
  datasourceId: string;
94
112
  datasourceName: string;
95
113
  isField?: boolean;
96
- table2?: Omit<MetaJoin_TalbeType, 'column' | 'column_id'> | null;
114
+ valType?: 'field' | 'string' | 'constant' | '';
115
+ constantName?: string;
116
+ table2?: MetaJoin_TalbeType | null;
97
117
  formula?: Filter_Formula;
118
+ subquery?: any[];
119
+ type?: Filter_TypeEnum;
120
+ summarizeType?: MetaSummarize_Enum;
121
+ sql?: string;
122
+ realName?: string;
98
123
  }
99
124
  export interface MetaFilter {
100
125
  metaKey: number;
@@ -102,48 +127,59 @@ export interface MetaFilter {
102
127
  isPermanent?: boolean;
103
128
  filter: MetaFilter_Item[];
104
129
  }
130
+ export declare enum MetaSummarize_Enum {
131
+ GROUP = "group",
132
+ BY = "by"
133
+ }
105
134
  export interface MetaSummarize_Group {
106
135
  table: string;
107
136
  tableId: string;
137
+ tableUuid: string;
108
138
  alias?: string;
109
139
  name: string;
110
140
  id: string;
111
141
  realName?: string;
112
142
  database_type?: SQL_COLUMN_TYPE | '';
113
143
  sql: string;
144
+ fieldAlias: string;
145
+ fieldUuid: string;
114
146
  condition: string;
115
147
  quotes: string;
116
148
  datasourceId: string;
117
149
  datasourceName: string;
118
- column: string;
119
- column_id: string;
150
+ summarizeType: MetaSummarize_Enum;
120
151
  [params: string]: any;
121
152
  }
122
153
  export interface MetaSummarize_By {
123
154
  table: string;
124
155
  tableId: string;
156
+ tableUuid: string;
125
157
  alias: string;
158
+ fieldAlias: string;
159
+ fieldUuid: string;
126
160
  name: string;
127
161
  id: string;
128
162
  datasourceId: string;
129
163
  datasourceName: string;
130
- column: string;
131
- column_id: string;
132
164
  realName?: string;
133
165
  sql: string;
134
166
  database_type: SQL_COLUMN_TYPE | '';
135
167
  condition: string;
136
168
  quotes: string;
169
+ summarizeType: MetaSummarize_Enum;
137
170
  }
138
171
  export interface MetaSummarize {
139
172
  metaKey: number;
140
173
  type: TypeEnum.summarize;
141
174
  alias: string;
175
+ tableUuid: string;
142
176
  group: MetaSummarize_Group[];
143
177
  by: MetaSummarize_By[];
144
178
  }
145
179
  export interface MetaSort_Item {
146
180
  table: string;
181
+ tableId: string;
182
+ tableUuid: string;
147
183
  alias: string;
148
184
  name: string;
149
185
  sql: string;
@@ -177,7 +213,6 @@ export interface LooseObject {
177
213
  }
178
214
  interface ParamsCustomColumns {
179
215
  alias: string;
180
- formula: string;
181
216
  }
182
217
  interface ParamsJoinTables {
183
218
  alias: string;
package/lib/es/types.d.ts CHANGED
@@ -1,4 +1,12 @@
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' | 'union';
6
+ union?: UnionEnum;
7
+ subquery?: MetaListType[];
8
+ list: MetaListType[];
9
+ }
2
10
  export interface MetabaseProps {
3
11
  loading?: boolean;
4
12
  btnText?: string;
@@ -17,7 +25,14 @@ export interface MetabaseProps {
17
25
  value?: MetaListType[];
18
26
  sourceList?: DatasourceType[];
19
27
  showSubquery?: boolean;
20
- _showSubquery?: boolean;
28
+ subShowSubquery?: boolean;
29
+ constantList?: OptionItem[];
30
+ notExistsToolbar?: ToolbarType[];
31
+ }
32
+ export interface OptionItem {
33
+ value?: string;
34
+ label: string;
35
+ icon?: React.ReactNode;
21
36
  }
22
37
  export interface DatasourceType {
23
38
  datasourceId: string;
@@ -2,9 +2,10 @@ export declare const getComputedTranslate: (obj: any) => {
2
2
  x: number;
3
3
  y: number;
4
4
  };
5
- export declare const getElementTop: (elem: HTMLElement) => number;
6
- export declare const getElementLeft: (elem: HTMLElement) => number;
7
- export declare const getScrollTop: () => number;
5
+ export declare const getElementTop: (elem?: HTMLElement) => number;
6
+ export declare const getElementLeft: (elem?: HTMLElement) => number;
7
+ export declare const getContainerVisibleHeight: (container?: HTMLElement) => number;
8
+ export declare const getScrollTop: (elem?: HTMLElement) => number;
8
9
  export declare const getWindowSize: () => {
9
10
  width: number;
10
11
  height: number;
@@ -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,8 @@ 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[];
19
+ export declare function splitByUnion(data: any): any[];
20
+ export declare function reassembleByUnion(target: any[]): any[];
17
21
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gingkoo/pandora-metabase",
3
- "version": "0.0.30",
3
+ "version": "1.0.0-alpha.10",
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",