@gingkoo/pandora-metabase 1.0.118 → 1.0.119
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/lib/cjs/common/Portal/index.js +0 -2
- package/lib/cjs/common/SplitView/index.d.ts +0 -4
- package/lib/cjs/common/SplitView/index.js +0 -10
- package/lib/cjs/components/dialog/custom-column/config.js +4 -48
- package/lib/cjs/components/dialog/custom-column/expression-editor.js +3 -14
- package/lib/cjs/components/dialog/custom-column/expressions/suggest.d.ts +2 -34
- package/lib/cjs/components/dialog/custom-column/expressions/suggest.js +2 -43
- package/lib/cjs/components/dialog/custom-column/expressions/tokenizer.js +8 -65
- package/lib/cjs/components/dialog/custom-column/index.js +2 -4
- package/lib/cjs/components/dialog/custom-column/tokenized-expression.js +2 -3
- package/lib/cjs/components/dialog/custom-column/tokenizedI-input.js +1 -1
- package/lib/cjs/components/dialog/custom-editor/index.js +2 -7
- package/lib/cjs/components/dialog/diff-viewer/index copy.js +1 -16
- package/lib/cjs/components/dialog/expression/date-format-picker.js +2 -20
- package/lib/cjs/components/dialog/expression/date-format.js +2 -8
- package/lib/cjs/components/dialog/expression/index.d.ts +0 -3
- package/lib/cjs/components/dialog/expression/index.js +2 -83
- package/lib/cjs/components/dialog/formula/index.js +1 -30
- package/lib/cjs/components/dialog/formula/utils.js +2 -10
- package/lib/cjs/components/dialog/formula-list/CaseWhenGroup.d.ts +19 -0
- package/lib/cjs/components/dialog/formula-list/CaseWhenGroup.js +109 -0
- package/lib/cjs/components/dialog/formula-list/LogicGroup.d.ts +9 -0
- package/lib/cjs/components/dialog/formula-list/LogicGroup.js +43 -0
- package/lib/cjs/components/dialog/formula-list/index.d.ts +3 -0
- package/lib/cjs/components/dialog/formula-list/index.js +967 -503
- package/lib/cjs/components/dialog/formula-list/index.less +724 -0
- package/lib/cjs/components/dialog/formula-list/utils.d.ts +0 -7
- package/lib/cjs/components/dialog/formula-list/utils.js +117 -113
- package/lib/cjs/components/dialog/select-column/index.d.ts +0 -6
- package/lib/cjs/components/dialog/select-column/index.js +4 -15
- package/lib/cjs/components/dialog/select-column-multiple/index.d.ts +0 -8
- package/lib/cjs/components/dialog/select-column-multiple/index.js +6 -45
- package/lib/cjs/components/dialog/select-join/index.d.ts +0 -5
- package/lib/cjs/components/dialog/select-join/index.js +0 -6
- package/lib/cjs/components/dialog/select-join-column/index.d.ts +0 -8
- package/lib/cjs/components/dialog/select-join-column/index.js +7 -21
- package/lib/cjs/components/dialog/select-join-column-multiple/index.d.ts +0 -8
- package/lib/cjs/components/dialog/select-join-column-multiple/index.js +5 -35
- package/lib/cjs/components/dialog/select-permission-table/index.d.ts +0 -5
- package/lib/cjs/components/dialog/select-permission-table/index.js +0 -6
- package/lib/cjs/components/dialog/select-summarize/index.d.ts +3 -3
- package/lib/cjs/components/dialog/select-summarize/index.js +105 -18
- package/lib/cjs/components/dialog/select-summarize/index.less +23 -0
- package/lib/cjs/components/dialog/select-table/index.d.ts +0 -6
- package/lib/cjs/components/dialog/select-table/index.js +1 -9
- package/lib/cjs/components/metabase/index.js +72 -86
- package/lib/cjs/components/metabase/index.less +7 -7
- package/lib/cjs/components/modules/components/Wrapper.js +1 -1
- package/lib/cjs/components/modules/components/header.js +2 -2
- package/lib/cjs/components/modules/components/meta-icon.d.ts +0 -3
- package/lib/cjs/components/modules/components/meta-icon.js +2 -47
- package/lib/cjs/components/modules/custom-column.js +3 -29
- package/lib/cjs/components/modules/enum/filter-enum.js +9 -88
- package/lib/cjs/components/modules/filter.js +2 -20
- package/lib/cjs/components/modules/index.d.ts +4 -2
- package/lib/cjs/components/modules/index.js +24 -1
- package/lib/cjs/components/modules/join-data.js +13 -291
- package/lib/cjs/components/modules/row-limit.js +0 -1
- package/lib/cjs/components/modules/sort.js +1 -61
- package/lib/cjs/components/modules/summarize/group-by.d.ts +0 -5
- package/lib/cjs/components/modules/summarize/group-by.js +231 -76
- package/lib/cjs/components/modules/summarize/select-index.js +96 -46
- package/lib/cjs/components/modules/table-data.js +11 -64
- package/lib/cjs/components/popup.js +26 -32
- package/lib/cjs/hooks/patch.d.ts +1 -0
- package/lib/cjs/hooks/patch.js +104 -6
- package/lib/cjs/hooks/patch2.js +3 -165
- package/lib/cjs/hooks/use-provider.js +0 -3
- package/lib/cjs/hooks/use-state.js +55 -135
- package/lib/cjs/index.js +0 -15
- package/lib/cjs/locale/en.js +5 -0
- package/lib/cjs/locale/index.js +1 -4
- package/lib/cjs/locale/zh.js +5 -0
- package/lib/cjs/sql-formula.js +0 -1
- package/lib/cjs/store/enum.d.ts +6 -6
- package/lib/cjs/store/enum.js +0 -13
- package/lib/cjs/store/helper.d.ts +2 -1
- package/lib/cjs/store/helper.js +15 -225
- package/lib/cjs/store/types.d.ts +45 -67
- package/lib/cjs/store/types.js +3 -49
- package/lib/cjs/types.d.ts +1 -0
- package/lib/cjs/utils/cookies.js +0 -3
- package/lib/cjs/utils/event.js +1 -1
- package/lib/cjs/utils/helper-dom.d.ts +1 -0
- package/lib/cjs/utils/helper-dom.js +17 -10
- package/lib/cjs/utils/helper.js +1 -24
- package/lib/cjs/utils/keydown.js +4 -7
- package/lib/cjs/utils/platform.d.ts +0 -9
- package/lib/cjs/utils/platform.js +0 -10
- package/lib/cjs/utils/selection.js +0 -6
- package/lib/cjs/utils/storage.d.ts +0 -9
- package/lib/cjs/utils/storage.js +1 -11
- package/lib/cjs/utils/transformSql.d.ts +5 -0
- package/lib/cjs/utils/transformSql.js +42 -113
- package/lib/cjs/utils.d.ts +1 -6
- package/lib/cjs/utils.js +115 -255
- package/lib/es/common/Portal/index.js +0 -2
- package/lib/es/common/SplitView/index.d.ts +0 -4
- package/lib/es/common/SplitView/index.js +0 -10
- package/lib/es/components/dialog/custom-column/config.js +4 -48
- package/lib/es/components/dialog/custom-column/expression-editor.js +3 -14
- package/lib/es/components/dialog/custom-column/expressions/suggest.d.ts +2 -34
- package/lib/es/components/dialog/custom-column/expressions/suggest.js +2 -43
- package/lib/es/components/dialog/custom-column/expressions/tokenizer.js +8 -65
- package/lib/es/components/dialog/custom-column/index.js +2 -4
- package/lib/es/components/dialog/custom-column/tokenized-expression.js +1 -3
- package/lib/es/components/dialog/custom-column/tokenizedI-input.js +1 -1
- package/lib/es/components/dialog/custom-editor/index.js +1 -7
- package/lib/es/components/dialog/diff-viewer/index copy.js +1 -15
- package/lib/es/components/dialog/expression/date-format-picker.js +2 -20
- package/lib/es/components/dialog/expression/date-format.js +2 -8
- package/lib/es/components/dialog/expression/index.d.ts +0 -3
- package/lib/es/components/dialog/expression/index.js +2 -82
- package/lib/es/components/dialog/formula/index.js +0 -30
- package/lib/es/components/dialog/formula/utils.js +2 -10
- package/lib/es/components/dialog/formula-list/CaseWhenGroup.d.ts +19 -0
- package/lib/es/components/dialog/formula-list/CaseWhenGroup.js +102 -0
- package/lib/es/components/dialog/formula-list/LogicGroup.d.ts +9 -0
- package/lib/es/components/dialog/formula-list/LogicGroup.js +36 -0
- package/lib/es/components/dialog/formula-list/index.d.ts +3 -0
- package/lib/es/components/dialog/formula-list/index.js +966 -503
- package/lib/es/components/dialog/formula-list/index.less +724 -0
- package/lib/es/components/dialog/formula-list/utils.d.ts +0 -7
- package/lib/es/components/dialog/formula-list/utils.js +117 -113
- package/lib/es/components/dialog/index.js +3 -3
- package/lib/es/components/dialog/select-column/index.d.ts +0 -6
- package/lib/es/components/dialog/select-column/index.js +4 -14
- package/lib/es/components/dialog/select-column-multiple/index.d.ts +0 -8
- package/lib/es/components/dialog/select-column-multiple/index.js +7 -47
- package/lib/es/components/dialog/select-join/index.d.ts +0 -5
- package/lib/es/components/dialog/select-join/index.js +0 -5
- package/lib/es/components/dialog/select-join-column/index.d.ts +0 -8
- package/lib/es/components/dialog/select-join-column/index.js +7 -20
- package/lib/es/components/dialog/select-join-column-multiple/index.d.ts +0 -8
- package/lib/es/components/dialog/select-join-column-multiple/index.js +5 -34
- package/lib/es/components/dialog/select-permission-table/index.d.ts +0 -5
- package/lib/es/components/dialog/select-permission-table/index.js +0 -5
- package/lib/es/components/dialog/select-summarize/index.d.ts +3 -3
- package/lib/es/components/dialog/select-summarize/index.js +106 -18
- package/lib/es/components/dialog/select-summarize/index.less +23 -0
- package/lib/es/components/dialog/select-table/index.d.ts +0 -6
- package/lib/es/components/dialog/select-table/index.js +1 -8
- package/lib/es/components/metabase/index.js +72 -87
- package/lib/es/components/metabase/index.less +7 -7
- package/lib/es/components/modules/components/Wrapper.js +1 -1
- package/lib/es/components/modules/components/header.js +2 -2
- package/lib/es/components/modules/components/meta-icon.d.ts +0 -3
- package/lib/es/components/modules/components/meta-icon.js +2 -46
- package/lib/es/components/modules/custom-column.js +3 -29
- package/lib/es/components/modules/enum/filter-enum.js +9 -88
- package/lib/es/components/modules/filter.js +2 -19
- package/lib/es/components/modules/index.d.ts +4 -2
- package/lib/es/components/modules/index.js +24 -1
- package/lib/es/components/modules/join-data.js +13 -291
- package/lib/es/components/modules/row-limit.js +0 -1
- package/lib/es/components/modules/sort.js +1 -61
- package/lib/es/components/modules/summarize/group-by.d.ts +0 -5
- package/lib/es/components/modules/summarize/group-by.js +233 -78
- package/lib/es/components/modules/summarize/select-index.js +96 -46
- package/lib/es/components/modules/table-data.js +11 -64
- package/lib/es/components/popup.js +27 -33
- package/lib/es/hooks/patch.d.ts +1 -0
- package/lib/es/hooks/patch.js +103 -5
- package/lib/es/hooks/patch2.js +2 -164
- package/lib/es/hooks/use-provider.js +0 -3
- package/lib/es/hooks/use-state.js +55 -135
- package/lib/es/index.js +0 -14
- package/lib/es/locale/en.js +5 -0
- package/lib/es/locale/index.js +1 -4
- package/lib/es/locale/zh.js +5 -0
- package/lib/es/sql-formula.js +0 -1
- package/lib/es/store/enum.d.ts +6 -6
- package/lib/es/store/enum.js +0 -13
- package/lib/es/store/helper.d.ts +2 -1
- package/lib/es/store/helper.js +13 -224
- package/lib/es/store/types.d.ts +45 -67
- package/lib/es/store/types.js +3 -49
- package/lib/es/types.d.ts +1 -0
- package/lib/es/types.js +1 -18
- package/lib/es/utils/cookies.js +0 -3
- package/lib/es/utils/event.js +1 -1
- package/lib/es/utils/helper-dom.d.ts +1 -0
- package/lib/es/utils/helper-dom.js +16 -9
- package/lib/es/utils/helper.js +1 -24
- package/lib/es/utils/keydown.js +4 -7
- package/lib/es/utils/platform.d.ts +0 -9
- package/lib/es/utils/platform.js +0 -10
- package/lib/es/utils/selection.js +0 -6
- package/lib/es/utils/storage.d.ts +0 -9
- package/lib/es/utils/storage.js +1 -10
- package/lib/es/utils/transformSql.d.ts +5 -0
- package/lib/es/utils/transformSql.js +42 -112
- package/lib/es/utils.d.ts +1 -6
- package/lib/es/utils.js +116 -255
- package/package.json +1 -1
package/lib/es/locale/zh.js
CHANGED
|
@@ -62,6 +62,11 @@ export default register('zh', {
|
|
|
62
62
|
'customColumn.cancel': '取消',
|
|
63
63
|
'customColumn.somethingAwesomeToDocument': '一些超棒的、值得记录的东西',
|
|
64
64
|
'customColumn.expression': '表达式',
|
|
65
|
+
'customColumn.caseWhen': 'CASE WHEN',
|
|
66
|
+
'customColumn.andOr': 'AND / OR',
|
|
67
|
+
'customColumn.logicStart': '逻辑开始',
|
|
68
|
+
'customColumn.caseCondition': '判断',
|
|
69
|
+
'customColumn.caseResult': '结果',
|
|
65
70
|
'customColumn.selectField': '选择列',
|
|
66
71
|
'customColumn.selectOperator': '选择操作符',
|
|
67
72
|
'customColumn.pleaseSelect': '请选择',
|
package/lib/es/sql-formula.js
CHANGED
package/lib/es/store/enum.d.ts
CHANGED
|
@@ -5,7 +5,7 @@ export declare enum SortEnum {
|
|
|
5
5
|
export declare enum TypeEnum {
|
|
6
6
|
data = "data",
|
|
7
7
|
joinData = "joinData",
|
|
8
|
-
permissionTable = "permissionTable"
|
|
8
|
+
permissionTable = "permissionTable",
|
|
9
9
|
customColumn = "customColumn",
|
|
10
10
|
filter = "filter",
|
|
11
11
|
summarize = "summarize",
|
|
@@ -44,13 +44,13 @@ export declare enum SQL_GROUP_TYPE {
|
|
|
44
44
|
DATE = "date"
|
|
45
45
|
}
|
|
46
46
|
export declare enum DataTypeEnum {
|
|
47
|
-
float = "float"
|
|
48
|
-
string = "string"
|
|
49
|
-
date = "date"
|
|
50
|
-
long = "long"
|
|
47
|
+
float = "float",
|
|
48
|
+
string = "string",
|
|
49
|
+
date = "date",
|
|
50
|
+
long = "long",
|
|
51
51
|
currency = "currency"
|
|
52
52
|
}
|
|
53
53
|
export declare enum EleComponentEnum {
|
|
54
|
-
text = "text"
|
|
54
|
+
text = "text",
|
|
55
55
|
select = "select"
|
|
56
56
|
}
|
package/lib/es/store/enum.js
CHANGED
|
@@ -45,24 +45,12 @@ export var SQL_COLUMN_TYPE;
|
|
|
45
45
|
SQL_COLUMN_TYPE["LONG"] = "LONG";
|
|
46
46
|
SQL_COLUMN_TYPE["CURRENCY"] = "CURRENCY";
|
|
47
47
|
})(SQL_COLUMN_TYPE || (SQL_COLUMN_TYPE = {}));
|
|
48
|
-
// 之前的 SQL_COLUMN_TYPE
|
|
49
|
-
// export enum SQL_COLUMN_TYPE {
|
|
50
|
-
// BIGINT = 'BIGINT',
|
|
51
|
-
// SMALLINT = 'SMALLINT',
|
|
52
|
-
// DOUBLE = 'DOUBLE',
|
|
53
|
-
// INTEGER = 'INTEGER',
|
|
54
|
-
// CLOB = 'CLOB',
|
|
55
|
-
// CHAR = 'CHAR',
|
|
56
|
-
// VARCHAR = 'VARCHAR',
|
|
57
|
-
// TIMESTAMP = 'TIMESTAMP',
|
|
58
|
-
// }
|
|
59
48
|
export var SQL_GROUP_TYPE;
|
|
60
49
|
(function (SQL_GROUP_TYPE) {
|
|
61
50
|
SQL_GROUP_TYPE["NUMBER"] = "number";
|
|
62
51
|
SQL_GROUP_TYPE["STRING"] = "string";
|
|
63
52
|
SQL_GROUP_TYPE["DATE"] = "date";
|
|
64
53
|
})(SQL_GROUP_TYPE || (SQL_GROUP_TYPE = {}));
|
|
65
|
-
// 字段数据类型
|
|
66
54
|
export var DataTypeEnum;
|
|
67
55
|
(function (DataTypeEnum) {
|
|
68
56
|
DataTypeEnum["float"] = "float";
|
|
@@ -71,7 +59,6 @@ export var DataTypeEnum;
|
|
|
71
59
|
DataTypeEnum["long"] = "long";
|
|
72
60
|
DataTypeEnum["currency"] = "currency";
|
|
73
61
|
})(DataTypeEnum || (DataTypeEnum = {}));
|
|
74
|
-
// 字段控件类型
|
|
75
62
|
export var EleComponentEnum;
|
|
76
63
|
(function (EleComponentEnum) {
|
|
77
64
|
EleComponentEnum["text"] = "text";
|
package/lib/es/store/helper.d.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { MetaListType, MetaSummarize_Group } from './types';
|
|
1
|
+
import { MetaListType, MetaSummarize_Group, MetaSummarize_By } from './types';
|
|
2
2
|
export declare const SummarizeAlias = "source";
|
|
3
3
|
export declare const summarizeToSql: (arr: MetaSummarize_Group[], record: MetaSummarize_Group) => {
|
|
4
4
|
sql: string;
|
|
5
5
|
fieldAlias: string;
|
|
6
6
|
};
|
|
7
|
+
export declare const summarizeByToSql: (record: MetaSummarize_By) => string;
|
|
7
8
|
export declare const compressionStructure: (data: MetaListType[]) => string;
|
|
8
9
|
export declare const restoreStructure: (data: string) => MetaListType[];
|
package/lib/es/store/helper.js
CHANGED
|
@@ -2,120 +2,14 @@ import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
|
2
2
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
3
3
|
var _excluded = ["children"],
|
|
4
4
|
_excluded2 = ["metaKey"];
|
|
5
|
-
// import { SummarizeAlias } from './index';
|
|
6
5
|
import { TypeEnum, SQL_COLUMN_TYPE } from './enum';
|
|
6
|
+
import { handleBaseType2Sql } from '../utils/transformSql';
|
|
7
7
|
export var SummarizeAlias = 'source';
|
|
8
8
|
var NUMBER_GROUP = [SQL_COLUMN_TYPE.FLOAT, SQL_COLUMN_TYPE.LONG, SQL_COLUMN_TYPE.CURRENCY];
|
|
9
9
|
var STRING_GROUP = [SQL_COLUMN_TYPE.STRING];
|
|
10
10
|
var DATE_GROUP = [SQL_COLUMN_TYPE.DATE];
|
|
11
|
-
// 过滤器对象转sql语句
|
|
12
|
-
// export const filterToSql = (record: AtomsItem): string => {
|
|
13
|
-
// let { alias, name, condition, val, groupSql, database_type } = record;
|
|
14
|
-
// let [condition_1, condition_2] = val;
|
|
15
|
-
// let columnName: string;
|
|
16
|
-
// if (alias === SummarizeAlias) {
|
|
17
|
-
// columnName = `${alias}.${groupSql?.split(' AS ')?.[1] || ''}`;
|
|
18
|
-
// } else {
|
|
19
|
-
// columnName = `${alias}.${name}`;
|
|
20
|
-
// }
|
|
21
|
-
// let sql: string = '';
|
|
22
|
-
// let group: SQL_GROUP_TYPE = SQL_GROUP_TYPE.STRING;
|
|
23
|
-
// if (~NUMBER_GROUP.indexOf(database_type as SQL_COLUMN_TYPE)) {
|
|
24
|
-
// group = SQL_GROUP_TYPE.NUMBER;
|
|
25
|
-
// }
|
|
26
|
-
// if (~DATE_GROUP.indexOf(database_type as SQL_COLUMN_TYPE)) {
|
|
27
|
-
// group = SQL_GROUP_TYPE.DATE;
|
|
28
|
-
// }
|
|
29
|
-
// if (group === SQL_GROUP_TYPE.STRING) {
|
|
30
|
-
// switch (condition) {
|
|
31
|
-
// // string
|
|
32
|
-
// case '是':
|
|
33
|
-
// sql = `${columnName} = '${condition_1}'`;
|
|
34
|
-
// break;
|
|
35
|
-
// case '不是':
|
|
36
|
-
// sql = `${columnName} <> '${condition_1}'`;
|
|
37
|
-
// break;
|
|
38
|
-
// case '包含':
|
|
39
|
-
// sql = `(${columnName} like '%${condition_1}%')`;
|
|
40
|
-
// break;
|
|
41
|
-
// case '不包含':
|
|
42
|
-
// sql = `(NOT ${columnName} like '%${condition_1}%')`;
|
|
43
|
-
// break;
|
|
44
|
-
// case '为空':
|
|
45
|
-
// sql = `${columnName} IS NULL`;
|
|
46
|
-
// break;
|
|
47
|
-
// case '不为空':
|
|
48
|
-
// sql = `${columnName} IS NOT NULL`;
|
|
49
|
-
// break;
|
|
50
|
-
// case '以...开始':
|
|
51
|
-
// sql = `(${columnName} like '${condition_1}%')`;
|
|
52
|
-
// break;
|
|
53
|
-
// case '以...结束':
|
|
54
|
-
// sql = `(${columnName} like '%${condition_1}')`;
|
|
55
|
-
// break;
|
|
56
|
-
// }
|
|
57
|
-
// }
|
|
58
|
-
// if (group === SQL_GROUP_TYPE.NUMBER) {
|
|
59
|
-
// switch (condition) {
|
|
60
|
-
// // number
|
|
61
|
-
// case '等于':
|
|
62
|
-
// sql = `${columnName} = ${condition_1}`;
|
|
63
|
-
// break;
|
|
64
|
-
// case '不等于':
|
|
65
|
-
// sql = `${columnName} <> ${condition_1}`;
|
|
66
|
-
// break;
|
|
67
|
-
// case '大于':
|
|
68
|
-
// sql = `${columnName} > ${condition_1}`;
|
|
69
|
-
// break;
|
|
70
|
-
// case '小于':
|
|
71
|
-
// sql = `${columnName} < ${condition_1}`;
|
|
72
|
-
// break;
|
|
73
|
-
// case '介于之间':
|
|
74
|
-
// sql = `${columnName} BETWEEN ${condition_1} AND ${condition_2}`;
|
|
75
|
-
// break;
|
|
76
|
-
// case '大于或等于':
|
|
77
|
-
// sql = `${columnName} >= ${condition_1}`;
|
|
78
|
-
// break;
|
|
79
|
-
// case '小于或等于':
|
|
80
|
-
// sql = `${columnName} <= ${condition_1}`;
|
|
81
|
-
// break;
|
|
82
|
-
// case '为空':
|
|
83
|
-
// sql = `${columnName} IS NULL`;
|
|
84
|
-
// break;
|
|
85
|
-
// case '不为空':
|
|
86
|
-
// sql = `${columnName} IS NOT NULL`;
|
|
87
|
-
// break;
|
|
88
|
-
// }
|
|
89
|
-
// }
|
|
90
|
-
// if (group === SQL_GROUP_TYPE.DATE) {
|
|
91
|
-
// function transformDate(dataStr: string) {
|
|
92
|
-
// return dataStr.replace(/-/g, '').replace(/:/g, '').replace(' ', '') + '00';
|
|
93
|
-
// }
|
|
94
|
-
// let c_1 = transformDate(condition_1 || '');
|
|
95
|
-
// let c_2 = transformDate(condition_2 || '');
|
|
96
|
-
// switch (condition) {
|
|
97
|
-
// // date
|
|
98
|
-
// case '早于':
|
|
99
|
-
// sql = `${columnName} < '${c_1}'`;
|
|
100
|
-
// break;
|
|
101
|
-
// case '晚于':
|
|
102
|
-
// sql = `${columnName} >= '${c_1}'`;
|
|
103
|
-
// break;
|
|
104
|
-
// case '介于之间':
|
|
105
|
-
// sql = `(${columnName} >= '${c_1}' AND ${columnName} < '${c_2}')`;
|
|
106
|
-
// break;
|
|
107
|
-
// case '是空的':
|
|
108
|
-
// sql = `${columnName} IS NULL`;
|
|
109
|
-
// break;
|
|
110
|
-
// case '不是空的':
|
|
111
|
-
// sql = `${columnName} IS NOT NULL`;
|
|
112
|
-
// break;
|
|
113
|
-
// }
|
|
114
|
-
// }
|
|
115
|
-
// return sql;
|
|
116
|
-
// };
|
|
117
|
-
// 聚合转sql语句
|
|
118
11
|
export var summarizeToSql = function summarizeToSql(arr, record) {
|
|
12
|
+
var _record$atoms;
|
|
119
13
|
var condition = record.condition,
|
|
120
14
|
alias = record.alias,
|
|
121
15
|
name = record.name,
|
|
@@ -126,6 +20,9 @@ export var summarizeToSql = function summarizeToSql(arr, record) {
|
|
|
126
20
|
var sql = '';
|
|
127
21
|
var as = '';
|
|
128
22
|
var field = "".concat(alias, ".").concat(realName || name);
|
|
23
|
+
if ((_record$atoms = record.atoms) !== null && _record$atoms !== void 0 && _record$atoms.length && !['总行数', '累积行数'].includes(condition)) {
|
|
24
|
+
field = handleBaseType2Sql(record.atoms).sql.trim() || field;
|
|
25
|
+
}
|
|
129
26
|
switch (condition) {
|
|
130
27
|
case '总行数':
|
|
131
28
|
case '累积行数':
|
|
@@ -182,10 +79,17 @@ export var summarizeToSql = function summarizeToSql(arr, record) {
|
|
|
182
79
|
as = as + (count ? '_' + (count + 1) : '');
|
|
183
80
|
return {
|
|
184
81
|
sql: sql,
|
|
185
|
-
// + ' AS ' + as,
|
|
186
82
|
fieldAlias: as
|
|
187
83
|
};
|
|
188
84
|
};
|
|
85
|
+
export var summarizeByToSql = function summarizeByToSql(record) {
|
|
86
|
+
var _record$atoms2;
|
|
87
|
+
var sql = "".concat(record.alias, ".").concat(record.realName || record.name);
|
|
88
|
+
if ((_record$atoms2 = record.atoms) !== null && _record$atoms2 !== void 0 && _record$atoms2.length) {
|
|
89
|
+
sql = handleBaseType2Sql(record.atoms).sql.trim() || sql;
|
|
90
|
+
}
|
|
91
|
+
return sql;
|
|
92
|
+
};
|
|
189
93
|
var _flatArr2 = function _flatArr(data, arr) {
|
|
190
94
|
var children = data.children,
|
|
191
95
|
res = _objectWithoutProperties(data, _excluded);
|
|
@@ -201,18 +105,15 @@ var _recursionArr2 = function _recursionArr(arr) {
|
|
|
201
105
|
}
|
|
202
106
|
return obj;
|
|
203
107
|
};
|
|
204
|
-
// 反转顺序 - (将原本嵌套的顺序完全反转 最内层变成最外层)别问为什么 问就是接口需要
|
|
205
108
|
var reverseData = function reverseData(data) {
|
|
206
109
|
var arr = [];
|
|
207
110
|
_flatArr2(data, arr);
|
|
208
111
|
return _recursionArr2(arr.reverse());
|
|
209
112
|
};
|
|
210
|
-
// 分层 - (将原本平铺的格式转成 嵌套的格式)
|
|
211
113
|
var _layeredData = function layeredData(list) {
|
|
212
114
|
var res = {};
|
|
213
115
|
for (var i = 0; i < list.length; i++) {
|
|
214
116
|
var meta = list[i];
|
|
215
|
-
// @ts-ignore
|
|
216
117
|
if (meta.type === TypeEnum.joinData) {
|
|
217
118
|
if (res[meta.type]) {
|
|
218
119
|
res[meta.type].push(meta);
|
|
@@ -220,15 +121,12 @@ var _layeredData = function layeredData(list) {
|
|
|
220
121
|
res[meta.type] = [meta];
|
|
221
122
|
}
|
|
222
123
|
} else {
|
|
223
|
-
// @ts-ignore
|
|
224
124
|
res[meta.type] = meta;
|
|
225
125
|
}
|
|
226
126
|
if (meta.type === TypeEnum.summarize) {
|
|
227
127
|
var nextMeta = list[i + 1];
|
|
228
128
|
var nextNextMeta = list[i + 2];
|
|
229
129
|
var nextNextNextMeta = list[i + 3];
|
|
230
|
-
// 将sort 和 rowLimit 归到上一层 (虽然他们两在 summarize 后面)
|
|
231
|
-
// 处理完 sort 和 rowLimit 之后 如果数组后面还有元素则进入下一层循环
|
|
232
130
|
if (nextMeta) {
|
|
233
131
|
if (nextMeta.type === TypeEnum.rowLimit) {
|
|
234
132
|
res[nextMeta.type] = nextMeta;
|
|
@@ -256,115 +154,6 @@ var _layeredData = function layeredData(list) {
|
|
|
256
154
|
}
|
|
257
155
|
return res;
|
|
258
156
|
};
|
|
259
|
-
// 处理数据格式 - (这里才是真正处理成后端需要的格式 前面两步都是准备工作)
|
|
260
|
-
// const handleNesting = (data: LooseObject): ParamsStruct => {
|
|
261
|
-
// let hasInnerSql = Boolean(data.children);
|
|
262
|
-
// let obj: ParamsStruct = {
|
|
263
|
-
// hasInnerSql,
|
|
264
|
-
// innerSqlStruct: hasInnerSql ? handleNesting(data.children as LooseObject) : null,
|
|
265
|
-
// };
|
|
266
|
-
// let tableData: MetaData | undefined = data[TypeEnum.data];
|
|
267
|
-
// let joinData: MetaJoin[] = data[TypeEnum.joinData] || [];
|
|
268
|
-
// let permissionTable: MetaPermissionTable | undefined = data[TypeEnum.permissionTable];
|
|
269
|
-
// let customColumn: MetaCustom | undefined = data[TypeEnum.customColumn];
|
|
270
|
-
// let filterData: MetaFilter | undefined = data[TypeEnum.filter];
|
|
271
|
-
// let summarize: MetaSummarize | undefined = data[TypeEnum.summarize];
|
|
272
|
-
// let sortData: MetaSort | undefined = data[TypeEnum.sort];
|
|
273
|
-
// let rowLimit: MetaLimit | undefined = data[TypeEnum.rowLimit];
|
|
274
|
-
// if (tableData) {
|
|
275
|
-
// obj.alias = tableData.table.alias;
|
|
276
|
-
// obj.tableName = tableData.table.name;
|
|
277
|
-
// obj.datasourceId = tableData.table.datasourceId;
|
|
278
|
-
// if (!summarize || (!summarize.group.length && !summarize.by.length)) {
|
|
279
|
-
// obj.queryColumns = tableData.columns
|
|
280
|
-
// .filter((v) => v.select)
|
|
281
|
-
// .map((v) => `${tableData?.table?.alias}.${v.name}`);
|
|
282
|
-
// }
|
|
283
|
-
// } else {
|
|
284
|
-
// if (!summarize || (!summarize.group.length && !summarize.by.length)) {
|
|
285
|
-
// obj.alias = SummarizeAlias;
|
|
286
|
-
// }
|
|
287
|
-
// }
|
|
288
|
-
// if (joinData.length) {
|
|
289
|
-
// obj.joinTables = joinData
|
|
290
|
-
// .filter((v) => v.table2.name)
|
|
291
|
-
// .map((v) => {
|
|
292
|
-
// let joinCondition: string;
|
|
293
|
-
// if (v.table1.alias === SummarizeAlias) {
|
|
294
|
-
// joinCondition = `ON ${SummarizeAlias}.${v.table1.groupSql} = ${v.table2.alias}.${v.table2.column}`;
|
|
295
|
-
// } else {
|
|
296
|
-
// joinCondition = `ON ${v.table1.alias}.${v.table1.column} = ${v.table2.alias}.${v.table2.column}`;
|
|
297
|
-
// }
|
|
298
|
-
// return {
|
|
299
|
-
// alias: v.table2.alias,
|
|
300
|
-
// tableName: v.table2.name,
|
|
301
|
-
// datasourceId: v.table2.datasourceId || '',
|
|
302
|
-
// joinCondition,
|
|
303
|
-
// joinType: v.joinType,
|
|
304
|
-
// queryColumns: v.columns.filter((o) => o.select).map((o) => `${v.table2.alias}.${o.name}`),
|
|
305
|
-
// };
|
|
306
|
-
// });
|
|
307
|
-
// }
|
|
308
|
-
// if (customColumn && customColumn.customColumn.length) {
|
|
309
|
-
// obj.customColumns = customColumn.customColumn.map((v) => {
|
|
310
|
-
// return {
|
|
311
|
-
// alias: v.name,
|
|
312
|
-
// // formula: v.formula.replace(/\[.*?\]/g, (column: string): string => {
|
|
313
|
-
// // let str = column.substr(1, column.length - 2);
|
|
314
|
-
// // if (~str.indexOf('->')) {
|
|
315
|
-
// // let _str = str.replace(/ /g, '').split('->');
|
|
316
|
-
// // return `${_str[0]}.${_str[1]}`;
|
|
317
|
-
// // }
|
|
318
|
-
// // return str;
|
|
319
|
-
// // }),
|
|
320
|
-
// };
|
|
321
|
-
// });
|
|
322
|
-
// }
|
|
323
|
-
// if (filterData && filterData.filter.length) {
|
|
324
|
-
// obj.filters = 'WHERE ' + filterData.filter.map((v) => filterToSql(v)).join(' AND ');
|
|
325
|
-
// if (permissionTable) {
|
|
326
|
-
// obj.filters += ` @{_DATA_I_PRIV_COND:${permissionTable.table.alias}}`;
|
|
327
|
-
// }
|
|
328
|
-
// }
|
|
329
|
-
// if (summarize && (summarize.group.length || summarize.by.length)) {
|
|
330
|
-
// obj.groupBy = {
|
|
331
|
-
// calcColumns: [],
|
|
332
|
-
// groupColumns: [],
|
|
333
|
-
// };
|
|
334
|
-
// let queryColumns: string[] = [];
|
|
335
|
-
// if (summarize.group.length) {
|
|
336
|
-
// obj.groupBy.calcColumns = summarize.group.map((v) => {
|
|
337
|
-
// return v.sql;
|
|
338
|
-
// });
|
|
339
|
-
// queryColumns = [...obj.groupBy.calcColumns];
|
|
340
|
-
// }
|
|
341
|
-
// if (summarize.by.length) {
|
|
342
|
-
// obj.groupBy.groupColumns = summarize.by.map((v) => {
|
|
343
|
-
// queryColumns.push(`${v.sql}`);
|
|
344
|
-
// return `${v.alias}.${v.realName || v.name}`;
|
|
345
|
-
// });
|
|
346
|
-
// }
|
|
347
|
-
// obj.queryColumns = queryColumns;
|
|
348
|
-
// if (!tableData) {
|
|
349
|
-
// obj.alias = summarize.alias;
|
|
350
|
-
// }
|
|
351
|
-
// }
|
|
352
|
-
// if (sortData && sortData.sort.length) {
|
|
353
|
-
// obj.orderInfos = `ORDER BY ${sortData.sort
|
|
354
|
-
// .map((v: MetaSort_Item) => `${v.sql} ${v.sort}`)
|
|
355
|
-
// .join(', ')}`;
|
|
356
|
-
// }
|
|
357
|
-
// if (rowLimit) {
|
|
358
|
-
// obj.limit = Number(rowLimit.limit);
|
|
359
|
-
// }
|
|
360
|
-
// if (permissionTable) {
|
|
361
|
-
// obj.privilegeTable = `@{_DATA_I_PRIV_COND:${permissionTable.table.alias}}`;
|
|
362
|
-
// }
|
|
363
|
-
// return obj;
|
|
364
|
-
// };
|
|
365
|
-
// export const handleSqlStruct = (list: MetaListType[]) =>
|
|
366
|
-
// handleNesting(reverseData(layeredData(list)));
|
|
367
|
-
// 压缩结构
|
|
368
157
|
export var compressionStructure = function compressionStructure(data) {
|
|
369
158
|
var _data = JSON.parse(JSON.stringify(data)).map(function (v) {
|
|
370
159
|
var metaKey = v.metaKey,
|
package/lib/es/store/types.d.ts
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
import type { DatasourceType } from '../types';
|
|
2
2
|
import { TypeEnum, SpecialType, JoinEnum, SQL_COLUMN_TYPE, SortEnum } from './enum';
|
|
3
3
|
export declare enum FormulaTypeEnum {
|
|
4
|
-
CUSTOM = "custom"
|
|
5
|
-
FILTER = "filter"
|
|
6
|
-
FORMULA = "formula"
|
|
7
|
-
JOIN_DATA = "joinData"
|
|
4
|
+
CUSTOM = "custom",
|
|
5
|
+
FILTER = "filter",
|
|
6
|
+
FORMULA = "formula",
|
|
7
|
+
JOIN_DATA = "joinData",
|
|
8
8
|
ALL = "all"
|
|
9
9
|
}
|
|
10
10
|
export declare enum ChangeType {
|
|
11
|
-
fieldAlias = "fieldAlias"
|
|
12
|
-
tableAlias = "tableAlias"
|
|
13
|
-
customColumn = "customColumn"
|
|
11
|
+
fieldAlias = "fieldAlias",
|
|
12
|
+
tableAlias = "tableAlias",
|
|
13
|
+
customColumn = "customColumn",
|
|
14
14
|
formula = "formula",
|
|
15
|
-
field = "field"
|
|
16
|
-
expressions = "expressions"
|
|
15
|
+
field = "field",
|
|
16
|
+
expressions = "expressions",
|
|
17
17
|
table1 = "table1",
|
|
18
18
|
table2 = "table2",
|
|
19
19
|
joinType = "joinType",
|
|
@@ -26,21 +26,23 @@ export declare enum ChangeType {
|
|
|
26
26
|
group = "group"
|
|
27
27
|
}
|
|
28
28
|
export declare enum AtomsTypeEnum {
|
|
29
|
-
JOIN_DEFAULT = "joinDefault"
|
|
30
|
-
EXISTS = "exists"
|
|
31
|
-
NOT_EXISTS = "notExists"
|
|
32
|
-
FIELD = "field"
|
|
33
|
-
EXPRESSION = "expression"
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
29
|
+
JOIN_DEFAULT = "joinDefault",
|
|
30
|
+
EXISTS = "exists",
|
|
31
|
+
NOT_EXISTS = "notExists",
|
|
32
|
+
FIELD = "field",
|
|
33
|
+
EXPRESSION = "expression",
|
|
34
|
+
CASE_WHEN = "caseWhen",
|
|
35
|
+
AND_OR = "andOr",
|
|
36
|
+
INPUT_STRING = "inputString",
|
|
37
|
+
INPUT_STRING_LIST = "inputStringList",
|
|
38
|
+
INPUT_NUMBER_LIST = "inputNumberList",
|
|
39
|
+
INPUT_NUMBER = "inputNumber",
|
|
40
|
+
CONSTANT = "constant",
|
|
41
|
+
OPERATOR = "operator",
|
|
42
|
+
UNKNOWN = "unknown",
|
|
43
|
+
SELECT = "select",
|
|
42
44
|
FORMULA = "FORMULA",
|
|
43
|
-
SUB_QUERY = "subquery"
|
|
45
|
+
SUB_QUERY = "subquery",
|
|
44
46
|
COLLECTION = "collection"
|
|
45
47
|
}
|
|
46
48
|
export interface AtomsSubQuery {
|
|
@@ -83,6 +85,23 @@ export interface AtomsExpression {
|
|
|
83
85
|
formula?: Filter_Formula;
|
|
84
86
|
type: AtomsTypeEnum.EXPRESSION;
|
|
85
87
|
}
|
|
88
|
+
export interface AtomsCaseWhenBranch {
|
|
89
|
+
when: AtomsItem[];
|
|
90
|
+
then: AtomsItem[];
|
|
91
|
+
}
|
|
92
|
+
export interface AtomsCaseWhen {
|
|
93
|
+
caseValue?: AtomsItem[];
|
|
94
|
+
branches: AtomsCaseWhenBranch[];
|
|
95
|
+
elseValue?: AtomsItem[];
|
|
96
|
+
quotes: string;
|
|
97
|
+
type: AtomsTypeEnum.CASE_WHEN;
|
|
98
|
+
}
|
|
99
|
+
export interface AtomsAndOr {
|
|
100
|
+
operator: 'and' | 'or';
|
|
101
|
+
list: AtomsItem[];
|
|
102
|
+
quotes: string;
|
|
103
|
+
type: AtomsTypeEnum.AND_OR;
|
|
104
|
+
}
|
|
86
105
|
export interface AtomsJoinDefault {
|
|
87
106
|
lhs: AtomsItem[];
|
|
88
107
|
condition: string;
|
|
@@ -151,7 +170,7 @@ export interface AtomsSelect {
|
|
|
151
170
|
fixed?: boolean;
|
|
152
171
|
type: AtomsTypeEnum.SELECT;
|
|
153
172
|
}
|
|
154
|
-
export type AtomsItem = AtomsSubQuery | AtomsNotExists | AtomsExists | AtomsJoinDefault | AtomsExpression | AtomsFormula | AtomsField | AtomsInputString | AtomsInputStringList | AtomsInputNumberList | AtomsInputNumber | AtomsOprator | AtomsConstant | AtomsUnknown | AtomsCollection | AtomsSelect;
|
|
173
|
+
export type AtomsItem = AtomsSubQuery | AtomsNotExists | AtomsExists | AtomsJoinDefault | AtomsExpression | AtomsCaseWhen | AtomsAndOr | AtomsFormula | AtomsField | AtomsInputString | AtomsInputStringList | AtomsInputNumberList | AtomsInputNumber | AtomsOprator | AtomsConstant | AtomsUnknown | AtomsCollection | AtomsSelect;
|
|
155
174
|
export type ToolbarType = TypeEnum | 'filter' | 'summarize' | 'joinData' | 'permissionTable' | 'customColumn' | 'sort' | 'rowLimit' | 'union';
|
|
156
175
|
export type MetaListType = MetaData | MetaJoin | MetaCustom | MetaFilter | MetaSummarize | MetaSort | MetaLimit | MetaPermissionTable | MetaUnion;
|
|
157
176
|
export type initColumnsType = MetaData_ColumnsType;
|
|
@@ -264,6 +283,7 @@ export interface MetaSummarize_Group {
|
|
|
264
283
|
quotes: string;
|
|
265
284
|
datasourceId: string;
|
|
266
285
|
datasourceName: string;
|
|
286
|
+
atoms?: AtomsItem[];
|
|
267
287
|
summarizeType: MetaSummarize_Enum;
|
|
268
288
|
[params: string]: any;
|
|
269
289
|
}
|
|
@@ -285,6 +305,7 @@ export interface MetaSummarize_By {
|
|
|
285
305
|
database_type: SQL_COLUMN_TYPE | '';
|
|
286
306
|
condition: string;
|
|
287
307
|
quotes: string;
|
|
308
|
+
atoms?: AtomsItem[];
|
|
288
309
|
summarizeType: MetaSummarize_Enum;
|
|
289
310
|
}
|
|
290
311
|
export interface MetaSummarize {
|
|
@@ -386,46 +407,3 @@ export interface FormulaTemplates {
|
|
|
386
407
|
children: FormulaTemplatesItem[];
|
|
387
408
|
}
|
|
388
409
|
export {};
|
|
389
|
-
/**
|
|
390
|
-
let a = {
|
|
391
|
-
"idxId": "string",
|
|
392
|
-
"sqlStruct": {
|
|
393
|
-
"alias": "string",// 主表别名 只有最外层可以没有
|
|
394
|
-
"tableName": "string",// 主表名 除了最内层 都可以没有
|
|
395
|
-
"queryColumns": [
|
|
396
|
-
"string"// 第一层放 主表选择的字段,其他的放 groupby 的两个字段别名
|
|
397
|
-
],
|
|
398
|
-
"groupBy": {// 聚合
|
|
399
|
-
"calcColumns": [// 左边
|
|
400
|
-
"string"
|
|
401
|
-
],
|
|
402
|
-
"groupColumns": [// 右边
|
|
403
|
-
"string"
|
|
404
|
-
]
|
|
405
|
-
},
|
|
406
|
-
"customColumns": [// 自定义列
|
|
407
|
-
{
|
|
408
|
-
"alias": "string",
|
|
409
|
-
"formula": "string"
|
|
410
|
-
}
|
|
411
|
-
],
|
|
412
|
-
"filters": "string",// filter 用 on 分隔
|
|
413
|
-
"hasInnerSql": false,// 是否有嵌套
|
|
414
|
-
"innerSqlStruct": {},// 嵌套内容
|
|
415
|
-
"joinTables": [// 关联
|
|
416
|
-
{
|
|
417
|
-
"alias": "string",
|
|
418
|
-
"joinCondition": "a.a = b.b",
|
|
419
|
-
"joinType": "string",
|
|
420
|
-
"queryColumns": [
|
|
421
|
-
"string"
|
|
422
|
-
],
|
|
423
|
-
"tableName": "string"
|
|
424
|
-
}
|
|
425
|
-
],
|
|
426
|
-
"limit": 0,
|
|
427
|
-
"orderInfos": "string",
|
|
428
|
-
|
|
429
|
-
},
|
|
430
|
-
}
|
|
431
|
-
*/
|
package/lib/es/store/types.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
// 表达式类型
|
|
2
1
|
export var FormulaTypeEnum;
|
|
3
2
|
(function (FormulaTypeEnum) {
|
|
4
3
|
FormulaTypeEnum["CUSTOM"] = "custom";
|
|
@@ -7,7 +6,6 @@ export var FormulaTypeEnum;
|
|
|
7
6
|
FormulaTypeEnum["JOIN_DATA"] = "joinData";
|
|
8
7
|
FormulaTypeEnum["ALL"] = "all";
|
|
9
8
|
})(FormulaTypeEnum || (FormulaTypeEnum = {}));
|
|
10
|
-
// 修改类型
|
|
11
9
|
export var ChangeType;
|
|
12
10
|
(function (ChangeType) {
|
|
13
11
|
ChangeType["fieldAlias"] = "fieldAlias";
|
|
@@ -27,7 +25,6 @@ export var ChangeType;
|
|
|
27
25
|
ChangeType["by"] = "by";
|
|
28
26
|
ChangeType["group"] = "group";
|
|
29
27
|
})(ChangeType || (ChangeType = {}));
|
|
30
|
-
// 表达式类型
|
|
31
28
|
export var AtomsTypeEnum;
|
|
32
29
|
(function (AtomsTypeEnum) {
|
|
33
30
|
AtomsTypeEnum["JOIN_DEFAULT"] = "joinDefault";
|
|
@@ -35,7 +32,8 @@ export var AtomsTypeEnum;
|
|
|
35
32
|
AtomsTypeEnum["NOT_EXISTS"] = "notExists";
|
|
36
33
|
AtomsTypeEnum["FIELD"] = "field";
|
|
37
34
|
AtomsTypeEnum["EXPRESSION"] = "expression";
|
|
38
|
-
|
|
35
|
+
AtomsTypeEnum["CASE_WHEN"] = "caseWhen";
|
|
36
|
+
AtomsTypeEnum["AND_OR"] = "andOr";
|
|
39
37
|
AtomsTypeEnum["INPUT_STRING"] = "inputString";
|
|
40
38
|
AtomsTypeEnum["INPUT_STRING_LIST"] = "inputStringList";
|
|
41
39
|
AtomsTypeEnum["INPUT_NUMBER_LIST"] = "inputNumberList";
|
|
@@ -48,52 +46,8 @@ export var AtomsTypeEnum;
|
|
|
48
46
|
AtomsTypeEnum["SUB_QUERY"] = "subquery";
|
|
49
47
|
AtomsTypeEnum["COLLECTION"] = "collection";
|
|
50
48
|
})(AtomsTypeEnum || (AtomsTypeEnum = {}));
|
|
51
|
-
// ----------- 第五个模块 聚合模块 ------------
|
|
52
49
|
export var MetaSummarize_Enum;
|
|
53
50
|
(function (MetaSummarize_Enum) {
|
|
54
51
|
MetaSummarize_Enum["GROUP"] = "group";
|
|
55
52
|
MetaSummarize_Enum["BY"] = "by";
|
|
56
|
-
})(MetaSummarize_Enum || (MetaSummarize_Enum = {}));
|
|
57
|
-
/**
|
|
58
|
-
let a = {
|
|
59
|
-
"idxId": "string",
|
|
60
|
-
"sqlStruct": {
|
|
61
|
-
"alias": "string",// 主表别名 只有最外层可以没有
|
|
62
|
-
"tableName": "string",// 主表名 除了最内层 都可以没有
|
|
63
|
-
"queryColumns": [
|
|
64
|
-
"string"// 第一层放 主表选择的字段,其他的放 groupby 的两个字段别名
|
|
65
|
-
],
|
|
66
|
-
"groupBy": {// 聚合
|
|
67
|
-
"calcColumns": [// 左边
|
|
68
|
-
"string"
|
|
69
|
-
],
|
|
70
|
-
"groupColumns": [// 右边
|
|
71
|
-
"string"
|
|
72
|
-
]
|
|
73
|
-
},
|
|
74
|
-
"customColumns": [// 自定义列
|
|
75
|
-
{
|
|
76
|
-
"alias": "string",
|
|
77
|
-
"formula": "string"
|
|
78
|
-
}
|
|
79
|
-
],
|
|
80
|
-
"filters": "string",// filter 用 on 分隔
|
|
81
|
-
"hasInnerSql": false,// 是否有嵌套
|
|
82
|
-
"innerSqlStruct": {},// 嵌套内容
|
|
83
|
-
"joinTables": [// 关联
|
|
84
|
-
{
|
|
85
|
-
"alias": "string",
|
|
86
|
-
"joinCondition": "a.a = b.b",
|
|
87
|
-
"joinType": "string",
|
|
88
|
-
"queryColumns": [
|
|
89
|
-
"string"
|
|
90
|
-
],
|
|
91
|
-
"tableName": "string"
|
|
92
|
-
}
|
|
93
|
-
],
|
|
94
|
-
"limit": 0,
|
|
95
|
-
"orderInfos": "string",
|
|
96
|
-
|
|
97
|
-
},
|
|
98
|
-
}
|
|
99
|
-
*/
|
|
53
|
+
})(MetaSummarize_Enum || (MetaSummarize_Enum = {}));
|
package/lib/es/types.d.ts
CHANGED
package/lib/es/types.js
CHANGED
|
@@ -1,18 +1 @@
|
|
|
1
|
-
export {};
|
|
2
|
-
// {
|
|
3
|
-
// name: 'LENGTH', // 函数名
|
|
4
|
-
// args: [
|
|
5
|
-
// {
|
|
6
|
-
// type: 'field', // 参数类型
|
|
7
|
-
// check: 'string', // null 啥都可以, string 字符串, number 数字, (默认不传是 null)
|
|
8
|
-
// },
|
|
9
|
-
// {
|
|
10
|
-
// type: 'constant', // 参数类型
|
|
11
|
-
// check: null, // null 啥都可以, string 字符串, number 数字, (默认不传是 null)
|
|
12
|
-
// },
|
|
13
|
-
// ],
|
|
14
|
-
// arity: { max: 4 },
|
|
15
|
-
// output: 'number', // string | number| null (默认是 null)
|
|
16
|
-
// description: '返回字符串的长度',
|
|
17
|
-
// example: 'LENGTH("hello")',
|
|
18
|
-
// },
|
|
1
|
+
export {};
|
package/lib/es/utils/cookies.js
CHANGED
|
@@ -1,9 +1,6 @@
|
|
|
1
|
-
//获取指定名称的cookie值
|
|
2
1
|
export function getCookie(name) {
|
|
3
|
-
// (^| )name=([^;]*)(;|$),match[0]为与整个正则表达式匹配的字符串,match[i]为正则表达式捕获数组相匹配的数组;
|
|
4
2
|
var arr = document.cookie.match(new RegExp('(^| )' + name + '=([^;]*)(;|$)'));
|
|
5
3
|
if (arr != null) {
|
|
6
|
-
console.log(arr);
|
|
7
4
|
return arr[2];
|
|
8
5
|
}
|
|
9
6
|
return null;
|