@gingkoo/pandora-metabase 1.0.23 → 1.0.25
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/SplitView/index.js +12 -11
- package/lib/cjs/components/dialog/custom-column/expression-editor.js +2 -1
- package/lib/cjs/components/dialog/custom-column/tokenizedI-input.js +2 -1
- package/lib/cjs/components/dialog/custom-editor/index.js +2 -1
- package/lib/cjs/components/dialog/expression/index.js +13 -12
- package/lib/cjs/components/dialog/formula/index.d.ts +10 -0
- package/lib/cjs/components/dialog/formula/index.js +242 -0
- package/lib/cjs/components/dialog/formula/index.less +81 -0
- package/lib/cjs/components/dialog/formula/utils.d.ts +7 -0
- package/lib/cjs/components/dialog/formula/utils.js +45 -0
- package/lib/cjs/components/dialog/formula-list/index.d.ts +3 -1
- package/lib/cjs/components/dialog/formula-list/index.js +107 -43
- package/lib/cjs/components/dialog/formula-list/utils.d.ts +14 -1
- package/lib/cjs/components/dialog/formula-list/utils.js +159 -2
- package/lib/cjs/components/dialog/index.d.ts +1 -0
- package/lib/cjs/components/dialog/index.js +9 -2
- package/lib/cjs/components/dialog/select-column/index.js +6 -13
- package/lib/cjs/components/dialog/select-column-multiple/index.js +0 -1
- package/lib/cjs/components/dialog/select-table/index.js +7 -7
- package/lib/cjs/components/icons.js +36 -36
- package/lib/cjs/components/metabase/index.js +6 -6
- package/lib/cjs/components/metabase/index.less +10 -0
- package/lib/cjs/components/modules/components/Wrapper.js +6 -6
- package/lib/cjs/components/modules/custom-column.js +4 -4
- package/lib/cjs/components/modules/enum/filter-enum.d.ts +7 -2
- package/lib/cjs/components/modules/enum/filter-enum.js +8 -2
- package/lib/cjs/components/modules/join-data.js +78 -36
- package/lib/cjs/components/modules/summarize/group-by.js +6 -13
- package/lib/cjs/components/modules/summarize/select-index.js +6 -13
- package/lib/cjs/components/modules/table-data.js +9 -16
- package/lib/cjs/components/popup.js +2 -1
- package/lib/cjs/hooks/patch.js +106 -76
- package/lib/cjs/hooks/use-state.js +100 -65
- package/lib/cjs/index.js +5 -2
- package/lib/cjs/locale/en.js +6 -3
- package/lib/cjs/locale/zh.js +6 -3
- package/lib/cjs/store/helper.d.ts +1 -2
- package/lib/cjs/store/helper.js +1 -76
- package/lib/cjs/store/types.d.ts +36 -2
- package/lib/cjs/store/types.js +3 -0
- package/lib/cjs/types.d.ts +2 -1
- package/lib/cjs/utils.d.ts +1 -0
- package/lib/cjs/utils.js +16 -2
- package/lib/es/common/SplitView/index.js +10 -10
- package/lib/es/components/dialog/custom-editor/index.js +2 -1
- package/lib/es/components/dialog/expression/index.js +11 -11
- package/lib/es/components/dialog/formula/index.d.ts +10 -0
- package/lib/es/components/dialog/formula/index.js +236 -0
- package/lib/es/components/dialog/formula/index.less +81 -0
- package/lib/es/components/dialog/formula/utils.d.ts +7 -0
- package/lib/es/components/dialog/formula/utils.js +37 -0
- package/lib/es/components/dialog/formula-list/index.d.ts +3 -1
- package/lib/es/components/dialog/formula-list/index.js +104 -40
- package/lib/es/components/dialog/formula-list/utils.d.ts +14 -1
- package/lib/es/components/dialog/formula-list/utils.js +160 -2
- package/lib/es/components/dialog/index.d.ts +1 -0
- package/lib/es/components/dialog/index.js +2 -1
- package/lib/es/components/dialog/select-column/index.js +7 -14
- package/lib/es/components/dialog/select-column-multiple/index.js +0 -1
- package/lib/es/components/dialog/select-table/index.js +7 -7
- package/lib/es/components/icons.js +36 -36
- package/lib/es/components/metabase/index.js +6 -6
- package/lib/es/components/metabase/index.less +10 -0
- package/lib/es/components/modules/components/Wrapper.js +6 -6
- package/lib/es/components/modules/custom-column.js +4 -4
- package/lib/es/components/modules/enum/filter-enum.d.ts +7 -2
- package/lib/es/components/modules/enum/filter-enum.js +8 -2
- package/lib/es/components/modules/join-data.js +78 -36
- package/lib/es/components/modules/summarize/group-by.js +7 -14
- package/lib/es/components/modules/summarize/select-index.js +7 -14
- package/lib/es/components/modules/table-data.js +10 -17
- package/lib/es/hooks/patch.js +105 -75
- package/lib/es/hooks/use-state.js +101 -66
- package/lib/es/index.js +3 -1
- package/lib/es/locale/en.js +6 -3
- package/lib/es/locale/zh.js +6 -3
- package/lib/es/store/helper.d.ts +1 -2
- package/lib/es/store/helper.js +0 -75
- package/lib/es/store/types.d.ts +36 -2
- package/lib/es/store/types.js +3 -0
- package/lib/es/types.d.ts +2 -1
- package/lib/es/types.js +18 -1
- package/lib/es/utils.d.ts +1 -0
- package/lib/es/utils.js +13 -1
- package/package.json +2 -2
- package/lib/cjs/components/dialog/formula-list/enum.d.ts +0 -39
- package/lib/cjs/components/dialog/formula-list/enum.js +0 -123
- package/lib/es/components/dialog/formula-list/enum.d.ts +0 -39
- package/lib/es/components/dialog/formula-list/enum.js +0 -117
package/lib/es/store/helper.js
CHANGED
|
@@ -2,7 +2,6 @@ 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 { AtomsTypeEnum } from './types';
|
|
6
5
|
// import { SummarizeAlias } from './index';
|
|
7
6
|
import { TypeEnum, SQL_COLUMN_TYPE } from './enum';
|
|
8
7
|
export var SummarizeAlias = 'source';
|
|
@@ -416,78 +415,4 @@ export var restoreStructure = function restoreStructure(data) {
|
|
|
416
415
|
} catch (e) {
|
|
417
416
|
return [];
|
|
418
417
|
}
|
|
419
|
-
};
|
|
420
|
-
export var getTemItem = function getTemItem(type) {
|
|
421
|
-
var temItem;
|
|
422
|
-
// 字段
|
|
423
|
-
if (type === AtomsTypeEnum.FIELD) {
|
|
424
|
-
temItem = {
|
|
425
|
-
fieldName: '',
|
|
426
|
-
// 字段名
|
|
427
|
-
fieldNameZh: '',
|
|
428
|
-
// 字段中文名
|
|
429
|
-
fieldAlias: '',
|
|
430
|
-
// 别名
|
|
431
|
-
fieldUuid: '',
|
|
432
|
-
// uuid
|
|
433
|
-
fieldId: '',
|
|
434
|
-
// 字段id
|
|
435
|
-
// quotes?: string; // 字段展示的 不知道有没有用
|
|
436
|
-
tableName: '',
|
|
437
|
-
// 表名
|
|
438
|
-
tableNameZh: '',
|
|
439
|
-
tableId: '',
|
|
440
|
-
// 表名
|
|
441
|
-
tableAlias: '',
|
|
442
|
-
// 别名
|
|
443
|
-
tableUuid: '',
|
|
444
|
-
// 表唯一标识
|
|
445
|
-
datasourceName: '',
|
|
446
|
-
// 数据源名
|
|
447
|
-
datasourceId: '',
|
|
448
|
-
// 数据源id
|
|
449
|
-
type: AtomsTypeEnum.FIELD
|
|
450
|
-
};
|
|
451
|
-
}
|
|
452
|
-
// 表达式
|
|
453
|
-
else if (type === AtomsTypeEnum.EXPRESSION || type === AtomsTypeEnum.JOIN_DEFAULT) {
|
|
454
|
-
return {
|
|
455
|
-
lhs: [],
|
|
456
|
-
rhs: [],
|
|
457
|
-
condition: '',
|
|
458
|
-
quotes: '',
|
|
459
|
-
type: type
|
|
460
|
-
};
|
|
461
|
-
} else if (type === AtomsTypeEnum.EXISTS || type === AtomsTypeEnum.NOT_EXISTS) {
|
|
462
|
-
return {
|
|
463
|
-
quotes: '',
|
|
464
|
-
// 展示用户看的 组装的文字
|
|
465
|
-
notExists: [],
|
|
466
|
-
type: type
|
|
467
|
-
};
|
|
468
|
-
} else if (type === AtomsTypeEnum.UNKNOWN) {
|
|
469
|
-
return {
|
|
470
|
-
// quotes: '', // 展示用户看的 组装的文字
|
|
471
|
-
// notExists: [],
|
|
472
|
-
val: '',
|
|
473
|
-
type: type
|
|
474
|
-
};
|
|
475
|
-
} else if (type === AtomsTypeEnum.INPUT_NUMBER) {
|
|
476
|
-
return {
|
|
477
|
-
val: 0,
|
|
478
|
-
type: type
|
|
479
|
-
};
|
|
480
|
-
} else if (type === AtomsTypeEnum.INPUT_NUMBER_LIST || type === AtomsTypeEnum.INPUT_STRING_LIST) {
|
|
481
|
-
temItem = {
|
|
482
|
-
val: [],
|
|
483
|
-
type: type
|
|
484
|
-
};
|
|
485
|
-
} else {
|
|
486
|
-
// 其他
|
|
487
|
-
temItem = {
|
|
488
|
-
val: '',
|
|
489
|
-
type: type
|
|
490
|
-
};
|
|
491
|
-
}
|
|
492
|
-
return temItem;
|
|
493
418
|
};
|
package/lib/es/store/types.d.ts
CHANGED
|
@@ -12,7 +12,9 @@ export declare enum AtomsTypeEnum {
|
|
|
12
12
|
INPUT_NUMBER = "inputNumber",// 数字输入框
|
|
13
13
|
CONSTANT = "constant",// 常量
|
|
14
14
|
OPERATOR = "operator",// 运算符
|
|
15
|
-
UNKNOWN = "unknown"
|
|
15
|
+
UNKNOWN = "unknown",//未选具体类型
|
|
16
|
+
FORMULA = "FORMULA",
|
|
17
|
+
COLLECTION = "collection"
|
|
16
18
|
}
|
|
17
19
|
export interface AtomsNotExists {
|
|
18
20
|
quotes: string;
|
|
@@ -24,6 +26,21 @@ export interface AtomsExists {
|
|
|
24
26
|
notExists?: MetaListType[];
|
|
25
27
|
type: AtomsTypeEnum.EXISTS;
|
|
26
28
|
}
|
|
29
|
+
export type Arity = {
|
|
30
|
+
exact: number;
|
|
31
|
+
} | {
|
|
32
|
+
min: number;
|
|
33
|
+
} | {
|
|
34
|
+
min: number;
|
|
35
|
+
max: number;
|
|
36
|
+
};
|
|
37
|
+
export interface AtomsFormula {
|
|
38
|
+
args: AtomsItem[];
|
|
39
|
+
arity?: Arity;
|
|
40
|
+
quotes: string;
|
|
41
|
+
name: string;
|
|
42
|
+
type: AtomsTypeEnum.FORMULA;
|
|
43
|
+
}
|
|
27
44
|
export interface AtomsExpression {
|
|
28
45
|
lhs: AtomsItem[];
|
|
29
46
|
rhs: AtomsItem[];
|
|
@@ -82,7 +99,12 @@ export interface AtomsUnknown {
|
|
|
82
99
|
val: string;
|
|
83
100
|
type: AtomsTypeEnum.UNKNOWN;
|
|
84
101
|
}
|
|
85
|
-
export
|
|
102
|
+
export interface AtomsCollection {
|
|
103
|
+
list: AtomsItem[];
|
|
104
|
+
quotes: string;
|
|
105
|
+
type: AtomsTypeEnum.COLLECTION;
|
|
106
|
+
}
|
|
107
|
+
export type AtomsItem = AtomsNotExists | AtomsExists | AtomsJoinDefault | AtomsExpression | AtomsFormula | AtomsField | AtomsInputString | AtomsInputStringList | AtomsInputNumberList | AtomsInputNumber | AtomsOprator | AtomsConstant | AtomsUnknown | AtomsCollection;
|
|
86
108
|
export type ToolbarType = TypeEnum | 'filter' | 'summarize' | 'joinData' | 'permissionTable' | 'customColumn' | 'sort' | 'rowLimit' | 'union';
|
|
87
109
|
export type MetaListType = MetaData | MetaJoin | MetaCustom | MetaFilter | MetaSummarize | MetaSort | MetaLimit | MetaPermissionTable | MetaUnion;
|
|
88
110
|
export type initColumnsType = MetaData_ColumnsType;
|
|
@@ -293,10 +315,22 @@ export interface ParamsType {
|
|
|
293
315
|
code: string;
|
|
294
316
|
}
|
|
295
317
|
export interface PopupData {
|
|
318
|
+
container?: any;
|
|
296
319
|
visible: boolean;
|
|
297
320
|
node?: any;
|
|
298
321
|
content?: any;
|
|
299
322
|
}
|
|
323
|
+
export interface FormulaTemplatesItem {
|
|
324
|
+
name: string;
|
|
325
|
+
args: {
|
|
326
|
+
type: AtomsTypeEnum;
|
|
327
|
+
check?: string | null;
|
|
328
|
+
}[];
|
|
329
|
+
arity?: Arity;
|
|
330
|
+
output?: string;
|
|
331
|
+
description?: string;
|
|
332
|
+
example?: string;
|
|
333
|
+
}
|
|
300
334
|
export {};
|
|
301
335
|
/**
|
|
302
336
|
let a = {
|
package/lib/es/store/types.js
CHANGED
|
@@ -6,6 +6,7 @@ export var AtomsTypeEnum;
|
|
|
6
6
|
AtomsTypeEnum["NOT_EXISTS"] = "notExists";
|
|
7
7
|
AtomsTypeEnum["FIELD"] = "field";
|
|
8
8
|
AtomsTypeEnum["EXPRESSION"] = "expression";
|
|
9
|
+
// FUNCTION = 'function', // 函数
|
|
9
10
|
AtomsTypeEnum["INPUT_STRING"] = "inputString";
|
|
10
11
|
AtomsTypeEnum["INPUT_STRING_LIST"] = "inputStringList";
|
|
11
12
|
AtomsTypeEnum["INPUT_NUMBER_LIST"] = "inputNumberList";
|
|
@@ -13,6 +14,8 @@ export var AtomsTypeEnum;
|
|
|
13
14
|
AtomsTypeEnum["CONSTANT"] = "constant";
|
|
14
15
|
AtomsTypeEnum["OPERATOR"] = "operator";
|
|
15
16
|
AtomsTypeEnum["UNKNOWN"] = "unknown";
|
|
17
|
+
AtomsTypeEnum["FORMULA"] = "FORMULA";
|
|
18
|
+
AtomsTypeEnum["COLLECTION"] = "collection";
|
|
16
19
|
})(AtomsTypeEnum || (AtomsTypeEnum = {}));
|
|
17
20
|
// ----------- 第五个模块 聚合模块 ------------
|
|
18
21
|
export var MetaSummarize_Enum;
|
package/lib/es/types.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { MetaListType, ToolbarType } from './store/types';
|
|
1
|
+
import type { MetaListType, ToolbarType, FormulaTemplatesItem } from './store/types';
|
|
2
2
|
import { UnionEnum } from './store/enum';
|
|
3
3
|
import { DataType } from './components/dialog/select-join-column';
|
|
4
4
|
export interface MetaListProps {
|
|
@@ -32,6 +32,7 @@ export interface MetabaseProps {
|
|
|
32
32
|
ignoreGroupByType?: boolean;
|
|
33
33
|
filterCustomType?: boolean;
|
|
34
34
|
notExistsColumns?: DataType[];
|
|
35
|
+
formulaTemplates?: FormulaTemplatesItem[];
|
|
35
36
|
}
|
|
36
37
|
export interface OptionItem {
|
|
37
38
|
value?: string;
|
package/lib/es/types.js
CHANGED
|
@@ -1 +1,18 @@
|
|
|
1
|
-
export {};
|
|
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
|
+
// },
|
package/lib/es/utils.d.ts
CHANGED
|
@@ -14,6 +14,7 @@ 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 function isValidSQLAlias(str: string): boolean;
|
|
17
18
|
export declare const changeTableAlias: (list: MetaListType[] | [], curObj: Pick<MetaData_TableType, "tableUuid" | "alias">) => MetaListType[];
|
|
18
19
|
export declare const changeFieldAlias: (list: MetaListType[], curObj: Pick<MetaData_ColumnsType, "fieldUuid" | "fieldAlias">) => MetaListType[];
|
|
19
20
|
export declare function splitByUnion(data: any): any[];
|
package/lib/es/utils.js
CHANGED
|
@@ -241,11 +241,22 @@ var _changeAlias = function changeAlias(items, val, type) {
|
|
|
241
241
|
});
|
|
242
242
|
}
|
|
243
243
|
return v;
|
|
244
|
+
} else if (v.type === AtomsTypeEnum.FORMULA) {
|
|
245
|
+
v.args = _changeAlias(v.args, val, type);
|
|
246
|
+
return v;
|
|
247
|
+
} else if (v.type === AtomsTypeEnum.COLLECTION) {
|
|
248
|
+
v.list = _changeAlias(v.list, val, type);
|
|
249
|
+
return v;
|
|
244
250
|
} else {
|
|
245
251
|
return v;
|
|
246
252
|
}
|
|
247
253
|
});
|
|
248
254
|
};
|
|
255
|
+
export function isValidSQLAlias(str) {
|
|
256
|
+
if (!str) return false;
|
|
257
|
+
var regex = /^[A-Za-z_][A-Za-z0-9_]{0,29}$/;
|
|
258
|
+
return regex.test(str);
|
|
259
|
+
}
|
|
249
260
|
export var changeTableAlias = function changeTableAlias(list, curObj) {
|
|
250
261
|
var _cloneDeep = cloneDeep(curObj),
|
|
251
262
|
tableUuid = _cloneDeep.tableUuid,
|
|
@@ -439,6 +450,7 @@ export function splitByUnion(data) {
|
|
|
439
450
|
return result;
|
|
440
451
|
}
|
|
441
452
|
export var patchData = function patchData(metas) {
|
|
453
|
+
return metas;
|
|
442
454
|
var mainTable = metas[0] || {};
|
|
443
455
|
var version = (mainTable === null || mainTable === void 0 ? void 0 : mainTable.patchVersion) || '';
|
|
444
456
|
if (version != '1.0.0') {
|
|
@@ -584,7 +596,7 @@ export var buildSqlQuery = function buildSqlQuery() {
|
|
|
584
596
|
var filterStrings = item.filter.map(function (f) {
|
|
585
597
|
if (f.type === AtomsTypeEnum.FIELD) {
|
|
586
598
|
return f.fieldName;
|
|
587
|
-
} else if (f.type === AtomsTypeEnum.EXPRESSION || f.type === AtomsTypeEnum.EXISTS || f.type === AtomsTypeEnum.NOT_EXISTS) {
|
|
599
|
+
} else if (f.type === AtomsTypeEnum.EXPRESSION || f.type === AtomsTypeEnum.EXISTS || f.type === AtomsTypeEnum.NOT_EXISTS || f.type === AtomsTypeEnum.FORMULA || f.type === AtomsTypeEnum.COLLECTION) {
|
|
588
600
|
return f.quotes;
|
|
589
601
|
} else if (f.type === AtomsTypeEnum.JOIN_DEFAULT) {
|
|
590
602
|
return '';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gingkoo/pandora-metabase",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.25",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "lib/es/index.js",
|
|
6
6
|
"module": "lib/es/index.js",
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
"react-dom": "^17.0.0 || ^18.0.0"
|
|
28
28
|
},
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"@gingkoo/pandora": "1.2.
|
|
30
|
+
"@gingkoo/pandora": "1.2.3",
|
|
31
31
|
"@gingkoo/pandora-hooks": "1.0.5",
|
|
32
32
|
"@gingkoo/pandora-icons": "0.0.1-alpha.28",
|
|
33
33
|
"dayjs": "^1.11.11",
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import { AtomsTypeEnum } from '../../../store/types';
|
|
2
|
-
export declare enum FunctionEnum {
|
|
3
|
-
LOWER = "lower",
|
|
4
|
-
UPPER = "upper",
|
|
5
|
-
SUBSTRING = "substring",
|
|
6
|
-
REGEX_MATCH_FIRST = "regex-match-first",
|
|
7
|
-
'CONCAT' = "concat",
|
|
8
|
-
'REPLACE' = "replace",
|
|
9
|
-
'TRIM' = "trim",
|
|
10
|
-
'RTRIM' = "RTRIM",
|
|
11
|
-
'LTRIM' = "rtrim",
|
|
12
|
-
'LENGTH' = "length",
|
|
13
|
-
'ABS' = "abs",
|
|
14
|
-
'FLOOR' = "floor",
|
|
15
|
-
'CEIL' = "ceil",
|
|
16
|
-
'ROUND' = "round",
|
|
17
|
-
'SQRT' = "sqrt",
|
|
18
|
-
'POWER' = "power",
|
|
19
|
-
'LOG' = "log",
|
|
20
|
-
'EXP' = "exp",
|
|
21
|
-
'CONTAINS' = "contains",
|
|
22
|
-
'ENDS_WITH' = "ends-with",
|
|
23
|
-
'STARTS_WITH' = "starts-with",
|
|
24
|
-
'BETWEEN' = "between",
|
|
25
|
-
'TIME_INTERVAL' = "time-interval",
|
|
26
|
-
'IS_NULL' = "is-null",
|
|
27
|
-
'IS_EMPTY' = "is-empty",
|
|
28
|
-
'COALESCE' = "coalesce"
|
|
29
|
-
}
|
|
30
|
-
export declare const operatorList: string[];
|
|
31
|
-
export declare const customTypes: ({
|
|
32
|
-
value: AtomsTypeEnum;
|
|
33
|
-
label: any;
|
|
34
|
-
children?: undefined;
|
|
35
|
-
} | {
|
|
36
|
-
value: AtomsTypeEnum;
|
|
37
|
-
label: any;
|
|
38
|
-
children: string[];
|
|
39
|
-
})[];
|
|
@@ -1,123 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.operatorList = exports.customTypes = exports.FunctionEnum = void 0;
|
|
7
|
-
var _locale = require("../../../locale");
|
|
8
|
-
var _types = require("../../../store/types");
|
|
9
|
-
// export enum OptionsTypeEnum {
|
|
10
|
-
// // CONSTANT = 'constant', // 常量
|
|
11
|
-
// NOT_EXISTS = 'notExists', // 输入框
|
|
12
|
-
// INPUT = 'input', // 输入框
|
|
13
|
-
// FIELD = 'field', // 字段
|
|
14
|
-
// OPERATOR = 'operator', // 运算符
|
|
15
|
-
// EXPRESSION = 'expression', // 公式
|
|
16
|
-
// OTHER = 'other', // 其他
|
|
17
|
-
// }
|
|
18
|
-
var FunctionEnum;
|
|
19
|
-
(function (FunctionEnum) {
|
|
20
|
-
FunctionEnum["LOWER"] = "lower";
|
|
21
|
-
FunctionEnum["UPPER"] = "upper";
|
|
22
|
-
FunctionEnum["SUBSTRING"] = "substring";
|
|
23
|
-
FunctionEnum["REGEX_MATCH_FIRST"] = "regex-match-first";
|
|
24
|
-
FunctionEnum["CONCAT"] = "concat";
|
|
25
|
-
FunctionEnum["REPLACE"] = "replace";
|
|
26
|
-
FunctionEnum["TRIM"] = "trim";
|
|
27
|
-
FunctionEnum["RTRIM"] = "RTRIM";
|
|
28
|
-
FunctionEnum["LTRIM"] = "rtrim";
|
|
29
|
-
FunctionEnum["LENGTH"] = "length";
|
|
30
|
-
// NUMBER
|
|
31
|
-
FunctionEnum["ABS"] = "abs";
|
|
32
|
-
FunctionEnum["FLOOR"] = "floor";
|
|
33
|
-
FunctionEnum["CEIL"] = "ceil";
|
|
34
|
-
FunctionEnum["ROUND"] = "round";
|
|
35
|
-
FunctionEnum["SQRT"] = "sqrt";
|
|
36
|
-
FunctionEnum["POWER"] = "power";
|
|
37
|
-
FunctionEnum["LOG"] = "log";
|
|
38
|
-
FunctionEnum["EXP"] = "exp";
|
|
39
|
-
// BOOLEAN
|
|
40
|
-
FunctionEnum["CONTAINS"] = "contains";
|
|
41
|
-
FunctionEnum["ENDS_WITH"] = "ends-with";
|
|
42
|
-
FunctionEnum["STARTS_WITH"] = "starts-with";
|
|
43
|
-
FunctionEnum["BETWEEN"] = "between";
|
|
44
|
-
FunctionEnum["TIME_INTERVAL"] = "time-interval";
|
|
45
|
-
FunctionEnum["IS_NULL"] = "is-null";
|
|
46
|
-
FunctionEnum["IS_EMPTY"] = "is-empty";
|
|
47
|
-
// OTHER
|
|
48
|
-
FunctionEnum["COALESCE"] = "coalesce";
|
|
49
|
-
})(FunctionEnum || (exports.FunctionEnum = FunctionEnum = {}));
|
|
50
|
-
var operatorList = exports.operatorList = ['and', 'or', '(', ')', ',', '+', '-', '*', '/', '!=', '<=', '>=', '<', '>', '=', 'case', 'when', 'then', 'else', 'end', 'DESC', 'ASC', 'OVER', 'PARTITION BY', 'ORDER BY', 'RANK()', 'DENSE_RANK()', 'ROW_NUMBER()'];
|
|
51
|
-
// export const otherList = [
|
|
52
|
-
// 'case',
|
|
53
|
-
// 'when',
|
|
54
|
-
// 'then',
|
|
55
|
-
// 'else',
|
|
56
|
-
// 'end',
|
|
57
|
-
// 'RANK()',
|
|
58
|
-
// 'DENSE_RANK()',
|
|
59
|
-
// 'ROW_NUMBER()',
|
|
60
|
-
// ];
|
|
61
|
-
// export const functionList = [
|
|
62
|
-
// 'lower',
|
|
63
|
-
// 'upper',
|
|
64
|
-
// 'substring',
|
|
65
|
-
// 'regex-match-first',
|
|
66
|
-
// 'concat',
|
|
67
|
-
// 'replace',
|
|
68
|
-
// 'trim',
|
|
69
|
-
// 'rtrim',
|
|
70
|
-
// 'ltrim',
|
|
71
|
-
// 'length',
|
|
72
|
-
// // number
|
|
73
|
-
// 'abs',
|
|
74
|
-
// 'floor',
|
|
75
|
-
// 'ceil',
|
|
76
|
-
// 'round',
|
|
77
|
-
// 'sqrt',
|
|
78
|
-
// 'power',
|
|
79
|
-
// 'log',
|
|
80
|
-
// 'exp',
|
|
81
|
-
// // boolean
|
|
82
|
-
// 'contains',
|
|
83
|
-
// 'ends-with',
|
|
84
|
-
// 'starts-with',
|
|
85
|
-
// 'between',
|
|
86
|
-
// 'time-interval',
|
|
87
|
-
// 'is-null',
|
|
88
|
-
// 'is-empty',
|
|
89
|
-
// // other
|
|
90
|
-
// 'coalesce',
|
|
91
|
-
// ];
|
|
92
|
-
var customTypes = exports.customTypes = [
|
|
93
|
-
// 字段
|
|
94
|
-
{
|
|
95
|
-
value: _types.AtomsTypeEnum.FIELD,
|
|
96
|
-
label: (0, _locale.__)('customColumn.field')
|
|
97
|
-
},
|
|
98
|
-
// 表达式
|
|
99
|
-
{
|
|
100
|
-
value: _types.AtomsTypeEnum.EXPRESSION,
|
|
101
|
-
label: (0, _locale.__)('customColumn.expression')
|
|
102
|
-
},
|
|
103
|
-
// 输入框
|
|
104
|
-
{
|
|
105
|
-
value: _types.AtomsTypeEnum.INPUT_STRING,
|
|
106
|
-
label: (0, _locale.__)('SqlQueryBuilder.input')
|
|
107
|
-
},
|
|
108
|
-
// 数字输入框
|
|
109
|
-
{
|
|
110
|
-
value: _types.AtomsTypeEnum.INPUT_NUMBER,
|
|
111
|
-
label: (0, _locale.__)('SqlQueryBuilder.numberInput')
|
|
112
|
-
},
|
|
113
|
-
// 数字输入框
|
|
114
|
-
{
|
|
115
|
-
value: _types.AtomsTypeEnum.CONSTANT,
|
|
116
|
-
label: (0, _locale.__)('customColumn.constant')
|
|
117
|
-
},
|
|
118
|
-
// 连接符
|
|
119
|
-
{
|
|
120
|
-
value: _types.AtomsTypeEnum.OPERATOR,
|
|
121
|
-
label: (0, _locale.__)('customColumn.operator'),
|
|
122
|
-
children: operatorList
|
|
123
|
-
}];
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import { AtomsTypeEnum } from '../../../store/types';
|
|
2
|
-
export declare enum FunctionEnum {
|
|
3
|
-
LOWER = "lower",
|
|
4
|
-
UPPER = "upper",
|
|
5
|
-
SUBSTRING = "substring",
|
|
6
|
-
REGEX_MATCH_FIRST = "regex-match-first",
|
|
7
|
-
'CONCAT' = "concat",
|
|
8
|
-
'REPLACE' = "replace",
|
|
9
|
-
'TRIM' = "trim",
|
|
10
|
-
'RTRIM' = "RTRIM",
|
|
11
|
-
'LTRIM' = "rtrim",
|
|
12
|
-
'LENGTH' = "length",
|
|
13
|
-
'ABS' = "abs",
|
|
14
|
-
'FLOOR' = "floor",
|
|
15
|
-
'CEIL' = "ceil",
|
|
16
|
-
'ROUND' = "round",
|
|
17
|
-
'SQRT' = "sqrt",
|
|
18
|
-
'POWER' = "power",
|
|
19
|
-
'LOG' = "log",
|
|
20
|
-
'EXP' = "exp",
|
|
21
|
-
'CONTAINS' = "contains",
|
|
22
|
-
'ENDS_WITH' = "ends-with",
|
|
23
|
-
'STARTS_WITH' = "starts-with",
|
|
24
|
-
'BETWEEN' = "between",
|
|
25
|
-
'TIME_INTERVAL' = "time-interval",
|
|
26
|
-
'IS_NULL' = "is-null",
|
|
27
|
-
'IS_EMPTY' = "is-empty",
|
|
28
|
-
'COALESCE' = "coalesce"
|
|
29
|
-
}
|
|
30
|
-
export declare const operatorList: string[];
|
|
31
|
-
export declare const customTypes: ({
|
|
32
|
-
value: AtomsTypeEnum;
|
|
33
|
-
label: any;
|
|
34
|
-
children?: undefined;
|
|
35
|
-
} | {
|
|
36
|
-
value: AtomsTypeEnum;
|
|
37
|
-
label: any;
|
|
38
|
-
children: string[];
|
|
39
|
-
})[];
|
|
@@ -1,117 +0,0 @@
|
|
|
1
|
-
import { __ } from '../../../locale';
|
|
2
|
-
import { AtomsTypeEnum } from '../../../store/types';
|
|
3
|
-
// export enum OptionsTypeEnum {
|
|
4
|
-
// // CONSTANT = 'constant', // 常量
|
|
5
|
-
// NOT_EXISTS = 'notExists', // 输入框
|
|
6
|
-
// INPUT = 'input', // 输入框
|
|
7
|
-
// FIELD = 'field', // 字段
|
|
8
|
-
// OPERATOR = 'operator', // 运算符
|
|
9
|
-
// EXPRESSION = 'expression', // 公式
|
|
10
|
-
// OTHER = 'other', // 其他
|
|
11
|
-
// }
|
|
12
|
-
export var FunctionEnum;
|
|
13
|
-
(function (FunctionEnum) {
|
|
14
|
-
FunctionEnum["LOWER"] = "lower";
|
|
15
|
-
FunctionEnum["UPPER"] = "upper";
|
|
16
|
-
FunctionEnum["SUBSTRING"] = "substring";
|
|
17
|
-
FunctionEnum["REGEX_MATCH_FIRST"] = "regex-match-first";
|
|
18
|
-
FunctionEnum["CONCAT"] = "concat";
|
|
19
|
-
FunctionEnum["REPLACE"] = "replace";
|
|
20
|
-
FunctionEnum["TRIM"] = "trim";
|
|
21
|
-
FunctionEnum["RTRIM"] = "RTRIM";
|
|
22
|
-
FunctionEnum["LTRIM"] = "rtrim";
|
|
23
|
-
FunctionEnum["LENGTH"] = "length";
|
|
24
|
-
// NUMBER
|
|
25
|
-
FunctionEnum["ABS"] = "abs";
|
|
26
|
-
FunctionEnum["FLOOR"] = "floor";
|
|
27
|
-
FunctionEnum["CEIL"] = "ceil";
|
|
28
|
-
FunctionEnum["ROUND"] = "round";
|
|
29
|
-
FunctionEnum["SQRT"] = "sqrt";
|
|
30
|
-
FunctionEnum["POWER"] = "power";
|
|
31
|
-
FunctionEnum["LOG"] = "log";
|
|
32
|
-
FunctionEnum["EXP"] = "exp";
|
|
33
|
-
// BOOLEAN
|
|
34
|
-
FunctionEnum["CONTAINS"] = "contains";
|
|
35
|
-
FunctionEnum["ENDS_WITH"] = "ends-with";
|
|
36
|
-
FunctionEnum["STARTS_WITH"] = "starts-with";
|
|
37
|
-
FunctionEnum["BETWEEN"] = "between";
|
|
38
|
-
FunctionEnum["TIME_INTERVAL"] = "time-interval";
|
|
39
|
-
FunctionEnum["IS_NULL"] = "is-null";
|
|
40
|
-
FunctionEnum["IS_EMPTY"] = "is-empty";
|
|
41
|
-
// OTHER
|
|
42
|
-
FunctionEnum["COALESCE"] = "coalesce";
|
|
43
|
-
})(FunctionEnum || (FunctionEnum = {}));
|
|
44
|
-
export var operatorList = ['and', 'or', '(', ')', ',', '+', '-', '*', '/', '!=', '<=', '>=', '<', '>', '=', 'case', 'when', 'then', 'else', 'end', 'DESC', 'ASC', 'OVER', 'PARTITION BY', 'ORDER BY', 'RANK()', 'DENSE_RANK()', 'ROW_NUMBER()'];
|
|
45
|
-
// export const otherList = [
|
|
46
|
-
// 'case',
|
|
47
|
-
// 'when',
|
|
48
|
-
// 'then',
|
|
49
|
-
// 'else',
|
|
50
|
-
// 'end',
|
|
51
|
-
// 'RANK()',
|
|
52
|
-
// 'DENSE_RANK()',
|
|
53
|
-
// 'ROW_NUMBER()',
|
|
54
|
-
// ];
|
|
55
|
-
// export const functionList = [
|
|
56
|
-
// 'lower',
|
|
57
|
-
// 'upper',
|
|
58
|
-
// 'substring',
|
|
59
|
-
// 'regex-match-first',
|
|
60
|
-
// 'concat',
|
|
61
|
-
// 'replace',
|
|
62
|
-
// 'trim',
|
|
63
|
-
// 'rtrim',
|
|
64
|
-
// 'ltrim',
|
|
65
|
-
// 'length',
|
|
66
|
-
// // number
|
|
67
|
-
// 'abs',
|
|
68
|
-
// 'floor',
|
|
69
|
-
// 'ceil',
|
|
70
|
-
// 'round',
|
|
71
|
-
// 'sqrt',
|
|
72
|
-
// 'power',
|
|
73
|
-
// 'log',
|
|
74
|
-
// 'exp',
|
|
75
|
-
// // boolean
|
|
76
|
-
// 'contains',
|
|
77
|
-
// 'ends-with',
|
|
78
|
-
// 'starts-with',
|
|
79
|
-
// 'between',
|
|
80
|
-
// 'time-interval',
|
|
81
|
-
// 'is-null',
|
|
82
|
-
// 'is-empty',
|
|
83
|
-
// // other
|
|
84
|
-
// 'coalesce',
|
|
85
|
-
// ];
|
|
86
|
-
export var customTypes = [
|
|
87
|
-
// 字段
|
|
88
|
-
{
|
|
89
|
-
value: AtomsTypeEnum.FIELD,
|
|
90
|
-
label: __('customColumn.field')
|
|
91
|
-
},
|
|
92
|
-
// 表达式
|
|
93
|
-
{
|
|
94
|
-
value: AtomsTypeEnum.EXPRESSION,
|
|
95
|
-
label: __('customColumn.expression')
|
|
96
|
-
},
|
|
97
|
-
// 输入框
|
|
98
|
-
{
|
|
99
|
-
value: AtomsTypeEnum.INPUT_STRING,
|
|
100
|
-
label: __('SqlQueryBuilder.input')
|
|
101
|
-
},
|
|
102
|
-
// 数字输入框
|
|
103
|
-
{
|
|
104
|
-
value: AtomsTypeEnum.INPUT_NUMBER,
|
|
105
|
-
label: __('SqlQueryBuilder.numberInput')
|
|
106
|
-
},
|
|
107
|
-
// 数字输入框
|
|
108
|
-
{
|
|
109
|
-
value: AtomsTypeEnum.CONSTANT,
|
|
110
|
-
label: __('customColumn.constant')
|
|
111
|
-
},
|
|
112
|
-
// 连接符
|
|
113
|
-
{
|
|
114
|
-
value: AtomsTypeEnum.OPERATOR,
|
|
115
|
-
label: __('customColumn.operator'),
|
|
116
|
-
children: operatorList
|
|
117
|
-
}];
|