@gingkoo/pandora-metabase 1.0.14 → 1.0.15

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 (96) hide show
  1. package/lib/cjs/common/SplitView/index.js +11 -12
  2. package/lib/cjs/components/dialog/custom-column/expression-editor.js +1 -2
  3. package/lib/cjs/components/dialog/custom-column/expressions/suggest.js +1 -1
  4. package/lib/cjs/components/dialog/custom-column/tokenizedI-input.js +1 -2
  5. package/lib/cjs/components/dialog/{select-filter → expression}/index.d.ts +4 -4
  6. package/lib/cjs/components/dialog/{select-filter → expression}/index.js +345 -206
  7. package/lib/cjs/components/dialog/formula-list/enum.d.ts +9 -13
  8. package/lib/cjs/components/dialog/formula-list/enum.js +83 -39
  9. package/lib/cjs/components/dialog/formula-list/index.d.ts +4 -1
  10. package/lib/cjs/components/dialog/formula-list/index.js +110 -126
  11. package/lib/cjs/components/dialog/formula-list/utils.js +77 -46
  12. package/lib/cjs/components/dialog/index.d.ts +2 -2
  13. package/lib/cjs/components/dialog/index.js +20 -20
  14. package/lib/cjs/components/dialog/select-column/index.js +43 -12
  15. package/lib/cjs/components/dialog/select-column-multiple/index.d.ts +54 -0
  16. package/lib/cjs/components/dialog/select-column-multiple/index.js +341 -0
  17. package/lib/cjs/components/dialog/select-column-multiple/index.less +246 -0
  18. package/lib/cjs/components/dialog/select-table/index.js +9 -7
  19. package/lib/cjs/components/icons.js +36 -36
  20. package/lib/cjs/components/metabase/index.js +6 -6
  21. package/lib/cjs/components/metabase/index.less +12 -1
  22. package/lib/cjs/components/modules/components/Wrapper.js +6 -6
  23. package/lib/cjs/components/modules/custom-column.js +12 -14
  24. package/lib/cjs/components/modules/enum/filter-enum.d.ts +34 -0
  25. package/lib/cjs/components/modules/enum/filter-enum.js +137 -0
  26. package/lib/cjs/components/modules/filter.js +43 -460
  27. package/lib/cjs/components/modules/join-data.js +892 -522
  28. package/lib/cjs/components/modules/permission-table.js +4 -0
  29. package/lib/cjs/components/modules/sort.js +102 -91
  30. package/lib/cjs/components/modules/summarize/group-by.js +47 -16
  31. package/lib/cjs/components/modules/summarize/select-index.js +48 -17
  32. package/lib/cjs/components/modules/table-data.js +13 -4
  33. package/lib/cjs/components/popup.js +1 -2
  34. package/lib/cjs/hooks/patch.d.ts +4 -0
  35. package/lib/cjs/hooks/patch.js +464 -0
  36. package/lib/cjs/hooks/use-state.js +73 -138
  37. package/lib/cjs/index.d.ts +0 -1
  38. package/lib/cjs/index.js +3 -21
  39. package/lib/cjs/locale/en.js +10 -3
  40. package/lib/cjs/locale/zh.js +12 -5
  41. package/lib/cjs/store/helper.d.ts +2 -3
  42. package/lib/cjs/store/helper.js +288 -233
  43. package/lib/cjs/store/types.d.ts +94 -71
  44. package/lib/cjs/store/types.js +17 -12
  45. package/lib/cjs/utils.d.ts +3 -3
  46. package/lib/cjs/utils.js +152 -187
  47. package/lib/es/common/SplitView/index.js +10 -10
  48. package/lib/es/components/dialog/custom-column/expressions/suggest.js +1 -1
  49. package/lib/es/components/dialog/{select-filter → expression}/index.d.ts +4 -4
  50. package/lib/es/components/dialog/{select-filter → expression}/index.js +343 -206
  51. package/lib/es/components/dialog/formula-list/enum.d.ts +9 -13
  52. package/lib/es/components/dialog/formula-list/enum.js +82 -38
  53. package/lib/es/components/dialog/formula-list/index.d.ts +4 -1
  54. package/lib/es/components/dialog/formula-list/index.js +115 -131
  55. package/lib/es/components/dialog/formula-list/utils.js +77 -46
  56. package/lib/es/components/dialog/index.d.ts +2 -2
  57. package/lib/es/components/dialog/index.js +3 -3
  58. package/lib/es/components/dialog/select-column/index.js +44 -13
  59. package/lib/es/components/dialog/select-column-multiple/index.d.ts +54 -0
  60. package/lib/es/components/dialog/select-column-multiple/index.js +335 -0
  61. package/lib/es/components/dialog/select-column-multiple/index.less +246 -0
  62. package/lib/es/components/dialog/select-table/index.js +9 -7
  63. package/lib/es/components/icons.js +36 -36
  64. package/lib/es/components/metabase/index.js +6 -6
  65. package/lib/es/components/metabase/index.less +12 -1
  66. package/lib/es/components/modules/components/Wrapper.js +6 -6
  67. package/lib/es/components/modules/custom-column.js +12 -14
  68. package/lib/es/components/modules/enum/filter-enum.d.ts +34 -0
  69. package/lib/es/components/modules/enum/filter-enum.js +131 -0
  70. package/lib/es/components/modules/filter.js +45 -463
  71. package/lib/es/components/modules/join-data.js +894 -524
  72. package/lib/es/components/modules/permission-table.js +4 -0
  73. package/lib/es/components/modules/sort.js +102 -91
  74. package/lib/es/components/modules/summarize/group-by.js +48 -17
  75. package/lib/es/components/modules/summarize/select-index.js +49 -18
  76. package/lib/es/components/modules/table-data.js +13 -4
  77. package/lib/es/hooks/patch.d.ts +4 -0
  78. package/lib/es/hooks/patch.js +457 -0
  79. package/lib/es/hooks/use-state.js +73 -138
  80. package/lib/es/index.d.ts +0 -1
  81. package/lib/es/index.js +1 -1
  82. package/lib/es/locale/en.js +10 -3
  83. package/lib/es/locale/zh.js +12 -5
  84. package/lib/es/store/helper.d.ts +2 -3
  85. package/lib/es/store/helper.js +288 -233
  86. package/lib/es/store/types.d.ts +94 -71
  87. package/lib/es/store/types.js +16 -11
  88. package/lib/es/utils.d.ts +3 -3
  89. package/lib/es/utils.js +154 -190
  90. package/package.json +1 -1
  91. package/lib/cjs/components/modules/filter copy.d.ts +0 -7
  92. package/lib/cjs/components/modules/filter copy.js +0 -178
  93. package/lib/es/components/modules/filter copy.d.ts +0 -7
  94. package/lib/es/components/modules/filter copy.js +0 -171
  95. /package/lib/cjs/components/dialog/{select-filter → expression}/index.less +0 -0
  96. /package/lib/es/components/dialog/{select-filter → expression}/index.less +0 -0
@@ -1,31 +1,97 @@
1
1
  import type { DatasourceType } from '../types';
2
2
  import { TypeEnum, SpecialType, JoinEnum, SQL_COLUMN_TYPE, SortEnum } from './enum';
3
+ export declare enum AtomsTypeEnum {
4
+ JOIN_DEFAULT = "joinDefault",// join默认
5
+ EXISTS = "exists",// notExists
6
+ NOT_EXISTS = "notExists",// notExists
7
+ FIELD = "field",// 字段
8
+ EXPRESSION = "expression",// 表达式
9
+ INPUT_STRING = "inputString",// 字符串输入框
10
+ INPUT_STRING_LIST = "inputStringList",// 字符串输入框
11
+ INPUT_NUMBER_LIST = "inputNumberList",// 数字输入框
12
+ INPUT_NUMBER = "inputNumber",// 数字输入框
13
+ CONSTANT = "constant",// 常量
14
+ OPERATOR = "operator",// 运算符
15
+ UNKNOWN = "unknown"
16
+ }
17
+ export interface AtomsNotExists {
18
+ quotes: string;
19
+ notExists?: MetaListType[];
20
+ type: AtomsTypeEnum.NOT_EXISTS;
21
+ }
22
+ export interface AtomsExists {
23
+ quotes: string;
24
+ notExists?: MetaListType[];
25
+ type: AtomsTypeEnum.EXISTS;
26
+ }
27
+ export interface AtomsExpression {
28
+ lhs: AtomsItem[];
29
+ rhs: AtomsItem[];
30
+ database_type?: SQL_COLUMN_TYPE | '';
31
+ condition: string;
32
+ quotes: string;
33
+ formula?: Filter_Formula;
34
+ type: AtomsTypeEnum.EXPRESSION;
35
+ }
36
+ export interface AtomsJoinDefault {
37
+ lhs: AtomsItem[];
38
+ condition: string;
39
+ rhs: AtomsItem[];
40
+ type: AtomsTypeEnum.JOIN_DEFAULT;
41
+ }
42
+ export interface AtomsField {
43
+ fieldName: string;
44
+ fieldNameZh: string;
45
+ fieldAlias: string;
46
+ fieldUuid: string;
47
+ fieldId: string;
48
+ tableName: string;
49
+ tableNameZh: string;
50
+ tableId: string;
51
+ tableAlias: string;
52
+ tableUuid: string;
53
+ datasourceName: string;
54
+ datasourceId: string;
55
+ type: AtomsTypeEnum.FIELD;
56
+ }
57
+ export interface AtomsInputString {
58
+ val: string;
59
+ type: AtomsTypeEnum.INPUT_STRING;
60
+ }
61
+ export interface AtomsInputStringList {
62
+ val: string[];
63
+ type: AtomsTypeEnum.INPUT_STRING_LIST;
64
+ }
65
+ export interface AtomsInputNumberList {
66
+ val: number[];
67
+ type: AtomsTypeEnum.INPUT_NUMBER_LIST;
68
+ }
69
+ export interface AtomsInputNumber {
70
+ val: number;
71
+ type: AtomsTypeEnum.INPUT_NUMBER;
72
+ }
73
+ export interface AtomsConstant {
74
+ val: string;
75
+ type: AtomsTypeEnum.CONSTANT;
76
+ }
77
+ export interface AtomsOprator {
78
+ val: string;
79
+ type: AtomsTypeEnum.OPERATOR;
80
+ }
81
+ export interface AtomsUnknown {
82
+ val: string;
83
+ type: AtomsTypeEnum.UNKNOWN;
84
+ }
85
+ export type AtomsItem = AtomsNotExists | AtomsExists | AtomsJoinDefault | AtomsExpression | AtomsField | AtomsInputString | AtomsInputStringList | AtomsInputNumberList | AtomsInputNumber | AtomsOprator | AtomsConstant | AtomsUnknown;
3
86
  export type ToolbarType = TypeEnum | 'filter' | 'summarize' | 'joinData' | 'permissionTable' | 'customColumn' | 'sort' | 'rowLimit' | 'union';
4
87
  export type MetaListType = MetaData | MetaJoin | MetaCustom | MetaFilter | MetaSummarize | MetaSort | MetaLimit | MetaPermissionTable;
5
88
  export type initColumnsType = MetaData_ColumnsType;
6
- interface ExpressionsType {
7
- operator: string;
8
- comparison_operator: string;
9
- left_fieldAlias: string;
10
- left_fieldUuid: string;
11
- left_quotes: string;
12
- left_string: string;
13
- left_type: 'string' | 'constant' | 'field' | '' | null;
14
- left_constant: string;
15
- left_fields: MetaJoin_Field[];
16
- right_fieldAlias: string;
17
- right_fieldUuid: string;
18
- right_quotes: string;
19
- right_fields: MetaJoin_Field[];
20
- right_string: string;
21
- right_type: 'string' | 'constant' | 'field' | '' | null;
22
- right_constant: string;
23
- }
24
89
  export interface TableColumnsMapType {
25
90
  [tableName: string]: initColumnsType[];
26
91
  }
27
92
  export interface TableType {
28
93
  name: string;
94
+ name_zh: string;
29
95
  id: string;
30
96
  alias: string;
31
97
  tableUuid: string;
@@ -56,24 +122,22 @@ export interface MetaData {
56
122
  subquery?: MetaListType[];
57
123
  }
58
124
  export interface MetaJoin_Field {
125
+ fieldName: string;
59
126
  fieldAlias: string;
60
127
  fieldUuid: string;
128
+ fieldId: string;
61
129
  quotes?: string;
62
130
  }
63
131
  export interface MetaJoin_TalbeType {
64
132
  name: string;
133
+ name_zh: string;
65
134
  id: string;
66
135
  tableUuid: string;
67
136
  alias: string;
68
137
  datasourceName: string;
69
138
  datasourceId: string;
70
- column_id?: string;
71
- column?: string;
72
- fieldAlias: string;
73
- fieldUuid: string;
74
- groupSql?: string;
75
139
  quotes?: string;
76
- fields: MetaJoin_Field[];
140
+ columns?: MetaData_ColumnsType[];
77
141
  }
78
142
  export interface MetaJoin {
79
143
  metaKey: number;
@@ -85,14 +149,14 @@ export interface MetaJoin {
85
149
  table1: MetaJoin_TalbeType;
86
150
  table2: MetaJoin_TalbeType;
87
151
  columns: MetaData_ColumnsType[];
88
- expressions: ExpressionsType[];
152
+ expressions: AtomsItem[];
89
153
  isSubquery?: boolean;
90
154
  subquery?: MetaListType[];
91
155
  }
92
156
  export interface MetaCustom_Item {
93
157
  name: string;
94
158
  type?: string;
95
- formulaList?: any[];
159
+ formulaList?: AtomsItem[];
96
160
  }
97
161
  export interface MetaCustom {
98
162
  metaKey: number;
@@ -103,49 +167,11 @@ export interface Filter_Formula {
103
167
  type?: string;
104
168
  params?: string[] | number[];
105
169
  }
106
- export declare enum Filter_TypeEnum {
107
- EXISTS = "exists",
108
- CONSTANT = "constant",// 常量
109
- INPUT = "input",// 输入框
110
- FIELD = "field",// 字段
111
- OPERATOR = "operator",// 运算符
112
- EXPRESSION = "expression",// 表达式
113
- NOT_EXISTS = "notExists"
114
- }
115
- export interface MetaFilter_Item {
116
- table: string;
117
- tableId: string;
118
- tableUuid: string;
119
- fieldUuid: string;
120
- fieldAlias: string;
121
- alias: string;
122
- name: string;
123
- id: string;
124
- groupSql?: string;
125
- database_type: SQL_COLUMN_TYPE | '';
126
- val: string[];
127
- operator?: string;
128
- condition: string;
129
- special_type?: SQL_COLUMN_TYPE | '';
130
- quotes: string;
131
- datasourceId: string;
132
- datasourceName: string;
133
- isField?: boolean;
134
- valType?: 'field' | 'string' | 'constant' | '';
135
- constantName?: string;
136
- table2?: Omit<MetaJoin_TalbeType, 'fields'> | null;
137
- formula?: Filter_Formula;
138
- notExists?: MetaListType[];
139
- type?: Filter_TypeEnum;
140
- summarizeType?: MetaSummarize_Enum;
141
- sql?: string;
142
- realName?: string;
143
- }
144
170
  export interface MetaFilter {
145
171
  metaKey: number;
146
172
  type: TypeEnum.filter;
147
173
  isPermanent?: boolean;
148
- filter: MetaFilter_Item[];
174
+ filter: AtomsItem[];
149
175
  }
150
176
  export declare enum MetaSummarize_Enum {
151
177
  GROUP = "group",
@@ -177,7 +203,9 @@ export interface MetaSummarize_By {
177
203
  alias: string;
178
204
  fieldAlias: string;
179
205
  fieldUuid: string;
206
+ fieldId: string;
180
207
  name: string;
208
+ name_zh?: string;
181
209
  id: string;
182
210
  datasourceId: string;
183
211
  datasourceName: string;
@@ -197,12 +225,7 @@ export interface MetaSummarize {
197
225
  by: MetaSummarize_By[];
198
226
  }
199
227
  export interface MetaSort_Item {
200
- table: string;
201
- tableId: string;
202
- tableUuid: string;
203
- alias: string;
204
- name: string;
205
- sql: string;
228
+ expression: AtomsItem[];
206
229
  sort: SortEnum;
207
230
  }
208
231
  export interface MetaSort {
@@ -1,14 +1,19 @@
1
- // 过滤器类型
2
- export var Filter_TypeEnum;
3
- (function (Filter_TypeEnum) {
4
- Filter_TypeEnum["EXISTS"] = "exists";
5
- Filter_TypeEnum["CONSTANT"] = "constant";
6
- Filter_TypeEnum["INPUT"] = "input";
7
- Filter_TypeEnum["FIELD"] = "field";
8
- Filter_TypeEnum["OPERATOR"] = "operator";
9
- Filter_TypeEnum["EXPRESSION"] = "expression";
10
- Filter_TypeEnum["NOT_EXISTS"] = "notExists";
11
- })(Filter_TypeEnum || (Filter_TypeEnum = {}));
1
+ // 表达式类型
2
+ export var AtomsTypeEnum;
3
+ (function (AtomsTypeEnum) {
4
+ AtomsTypeEnum["JOIN_DEFAULT"] = "joinDefault";
5
+ AtomsTypeEnum["EXISTS"] = "exists";
6
+ AtomsTypeEnum["NOT_EXISTS"] = "notExists";
7
+ AtomsTypeEnum["FIELD"] = "field";
8
+ AtomsTypeEnum["EXPRESSION"] = "expression";
9
+ AtomsTypeEnum["INPUT_STRING"] = "inputString";
10
+ AtomsTypeEnum["INPUT_STRING_LIST"] = "inputStringList";
11
+ AtomsTypeEnum["INPUT_NUMBER_LIST"] = "inputNumberList";
12
+ AtomsTypeEnum["INPUT_NUMBER"] = "inputNumber";
13
+ AtomsTypeEnum["CONSTANT"] = "constant";
14
+ AtomsTypeEnum["OPERATOR"] = "operator";
15
+ AtomsTypeEnum["UNKNOWN"] = "unknown";
16
+ })(AtomsTypeEnum || (AtomsTypeEnum = {}));
12
17
  // ----------- 第五个模块 聚合模块 ------------
13
18
  export var MetaSummarize_Enum;
14
19
  (function (MetaSummarize_Enum) {
package/lib/es/utils.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { TypeEnum } from './store/enum';
2
2
  import { MetaListType, MetaSummarize, MetaData_TableType, MetaData_ColumnsType } from './store/types';
3
- import { DataType } from './components/dialog/select-join-column';
3
+ import { DataType } from './components/dialog/select-column-multiple';
4
4
  export declare const findIndex: <T>(arr: T[], item: T) => number;
5
5
  interface HelperResultType {
6
6
  ExistAboveGroupBy: boolean;
@@ -14,8 +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[];
17
+ export declare const changeTableAlias: (list: MetaListType[] | [], curObj: Pick<MetaData_TableType, "tableUuid" | "alias">) => MetaListType[];
18
+ export declare const changeFieldAlias: (list: MetaListType[], curObj: Pick<MetaData_ColumnsType, "fieldUuid" | "fieldAlias">) => MetaListType[];
19
19
  export declare function splitByUnion(data: any): any[];
20
20
  export declare function reassembleByUnion(target?: any[]): any[];
21
21
  export declare const buildSqlQuery: (data: MetaListType[] | undefined, type: string) => string;