@gingkoo/pandora-metabase 1.0.157-alpha.7 → 1.0.157-alpha.9
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/components/dialog/custom-editor/index.js +4 -3
- package/lib/cjs/components/dialog/expression/index.js +21 -18
- package/lib/cjs/components/dialog/formula-list/index.d.ts +2 -1
- package/lib/cjs/components/dialog/formula-list/index.js +984 -212
- package/lib/cjs/components/dialog/formula-list/index.less +322 -58
- package/lib/cjs/components/dialog/formula-list/utils.d.ts +1 -0
- package/lib/cjs/components/dialog/formula-list/utils.js +2 -2
- package/lib/cjs/components/dialog/select-table/index.d.ts +4 -1
- package/lib/cjs/components/dialog/select-table/index.js +51 -7
- package/lib/cjs/components/dialog/select-table/index.less +20 -0
- package/lib/cjs/components/metabase/index.less +12 -14
- package/lib/cjs/components/modules/components/meta-icon.js +6 -4
- package/lib/cjs/index.d.ts +2 -2
- package/lib/cjs/locale/en.js +24 -0
- package/lib/cjs/locale/index.js +10 -6
- package/lib/cjs/locale/zh.js +24 -0
- package/lib/cjs/types.d.ts +31 -0
- package/lib/cjs/utils/transformSql.js +2 -0
- package/lib/cjs/utils.js +2 -2
- package/lib/es/components/dialog/custom-editor/index.js +4 -3
- package/lib/es/components/dialog/expression/index.js +22 -19
- package/lib/es/components/dialog/formula-list/index.d.ts +2 -1
- package/lib/es/components/dialog/formula-list/index.js +986 -214
- package/lib/es/components/dialog/formula-list/index.less +322 -58
- package/lib/es/components/dialog/formula-list/utils.d.ts +1 -0
- package/lib/es/components/dialog/formula-list/utils.js +1 -1
- package/lib/es/components/dialog/select-table/index.d.ts +4 -1
- package/lib/es/components/dialog/select-table/index.js +51 -7
- package/lib/es/components/dialog/select-table/index.less +20 -0
- package/lib/es/components/metabase/index.less +12 -14
- package/lib/es/components/modules/components/meta-icon.js +6 -4
- package/lib/es/index.d.ts +2 -2
- package/lib/es/locale/en.js +24 -0
- package/lib/es/locale/index.js +10 -6
- package/lib/es/locale/zh.js +24 -0
- package/lib/es/types.d.ts +31 -0
- package/lib/es/utils/transformSql.js +2 -0
- package/lib/es/utils.js +2 -2
- package/package.json +1 -1
|
@@ -66,7 +66,7 @@ var CaseEditor = function CaseEditor(props) {
|
|
|
66
66
|
};
|
|
67
67
|
var parseFormulaSql = (_store$preProps = store.preProps) === null || _store$preProps === void 0 ? void 0 : _store$preProps.parseFormulaSql;
|
|
68
68
|
var handleParseSql = function () {
|
|
69
|
-
var _ref = (0, _asyncToGenerator2["default"])(_regenerator["default"].mark(function _callee(sql) {
|
|
69
|
+
var _ref = (0, _asyncToGenerator2["default"])(_regenerator["default"].mark(function _callee(sql, availableTables, tableScope) {
|
|
70
70
|
var normalizedSql, result, _t;
|
|
71
71
|
return _regenerator["default"].wrap(function (_context) {
|
|
72
72
|
while (1) switch (_context.prev = _context.next) {
|
|
@@ -82,7 +82,8 @@ var CaseEditor = function CaseEditor(props) {
|
|
|
82
82
|
_context.next = 2;
|
|
83
83
|
return parseFormulaSql({
|
|
84
84
|
sql: normalizedSql,
|
|
85
|
-
availableTables: data
|
|
85
|
+
availableTables: availableTables !== null && availableTables !== void 0 && availableTables.length ? availableTables : data,
|
|
86
|
+
tableScope: tableScope
|
|
86
87
|
});
|
|
87
88
|
case 2:
|
|
88
89
|
result = _context.sent;
|
|
@@ -110,7 +111,7 @@ var CaseEditor = function CaseEditor(props) {
|
|
|
110
111
|
}
|
|
111
112
|
}, _callee, null, [[1, 4]]);
|
|
112
113
|
}));
|
|
113
|
-
return function handleParseSql(_x) {
|
|
114
|
+
return function handleParseSql(_x, _x2, _x3) {
|
|
114
115
|
return _ref.apply(this, arguments);
|
|
115
116
|
};
|
|
116
117
|
}();
|
|
@@ -144,9 +144,10 @@ var SelectFilterColumn = function SelectFilterColumn(_ref) {
|
|
|
144
144
|
if (~['无需结果'].indexOf(condition)) {
|
|
145
145
|
return false;
|
|
146
146
|
}
|
|
147
|
-
if (
|
|
147
|
+
if (_utils.EMPTY_RHS_CONDITIONS.has(condition)) {
|
|
148
148
|
return false;
|
|
149
149
|
}
|
|
150
|
+
if (!rhsVal.length) return true;
|
|
150
151
|
var isOk = rhsVal.every(function (v) {
|
|
151
152
|
if (v.type === _types.AtomsTypeEnum.INPUT_STRING || v.type === _types.AtomsTypeEnum.INPUT_NUMBER || v.type === _types.AtomsTypeEnum.CONSTANT) {
|
|
152
153
|
return v.val || v.val === 0;
|
|
@@ -206,6 +207,7 @@ var SelectFilterColumn = function SelectFilterColumn(_ref) {
|
|
|
206
207
|
早于: 'filter.earlierThan',
|
|
207
208
|
晚于: 'filter.laterThan',
|
|
208
209
|
是空的: 'filter.isEmpty',
|
|
210
|
+
不是空的: 'filter.notEmpty',
|
|
209
211
|
In: 'filter.within',
|
|
210
212
|
'Not In': 'filter.withnotin',
|
|
211
213
|
无需结果: 'filter.notresults',
|
|
@@ -213,7 +215,18 @@ var SelectFilterColumn = function SelectFilterColumn(_ref) {
|
|
|
213
215
|
}[v];
|
|
214
216
|
};
|
|
215
217
|
function generateQuotes(val, curColumn) {
|
|
216
|
-
|
|
218
|
+
if (_utils.EMPTY_RHS_CONDITIONS.has(condition)) {
|
|
219
|
+
var lhsName = getQuotesName(curColumn.lhs);
|
|
220
|
+
var isEmptyCondition = condition === '为空' || condition === '是空的';
|
|
221
|
+
if (_locale.isEn) {
|
|
222
|
+
return "".concat(lhsName, " ").concat(isEmptyCondition ? 'is empty' : 'not empty');
|
|
223
|
+
}
|
|
224
|
+
return "".concat(lhsName, " ").concat(isEmptyCondition ? '为空' : '不为空');
|
|
225
|
+
}
|
|
226
|
+
var _val = val[0] || {
|
|
227
|
+
val: '',
|
|
228
|
+
type: _types.AtomsTypeEnum.INPUT_STRING
|
|
229
|
+
};
|
|
217
230
|
var firstVal = '',
|
|
218
231
|
secondVal = '';
|
|
219
232
|
if (_val.type === _types.AtomsTypeEnum.INPUT_STRING) {
|
|
@@ -275,18 +288,6 @@ var SelectFilterColumn = function SelectFilterColumn(_ref) {
|
|
|
275
288
|
} else {
|
|
276
289
|
quotes = getQuotesName(curColumn.lhs) + ' 是 ' + firstVal;
|
|
277
290
|
}
|
|
278
|
-
} else if (condition === '是空的') {
|
|
279
|
-
if (_locale.isEn) {
|
|
280
|
-
quotes = getQuotesName(curColumn.lhs) + ' is empty';
|
|
281
|
-
} else {
|
|
282
|
-
quotes = getQuotesName(curColumn.lhs) + ' 为空';
|
|
283
|
-
}
|
|
284
|
-
} else if (condition === '不是空的') {
|
|
285
|
-
if (_locale.isEn) {
|
|
286
|
-
quotes = getQuotesName(curColumn.lhs) + ' not empty';
|
|
287
|
-
} else {
|
|
288
|
-
quotes = getQuotesName(curColumn.lhs) + ' 不为空';
|
|
289
|
-
}
|
|
290
291
|
} else if (condition === '当前') {
|
|
291
292
|
if (firstVal === '天') {
|
|
292
293
|
if (_locale.isEn) {
|
|
@@ -350,7 +351,8 @@ var SelectFilterColumn = function SelectFilterColumn(_ref) {
|
|
|
350
351
|
if (isCustom) {
|
|
351
352
|
conditions = ['无需结果'].concat((0, _toConsumableArray2["default"])(conditions));
|
|
352
353
|
}
|
|
353
|
-
|
|
354
|
+
var isCompatibleDateEmptyCondition = type === _enum.SQL_GROUP_TYPE.DATE && (condition === '为空' || condition === '不是空的');
|
|
355
|
+
if (!conditions.includes(condition) && !isCompatibleDateEmptyCondition) {
|
|
354
356
|
setDefaultVal(conditions[0]);
|
|
355
357
|
}
|
|
356
358
|
return {
|
|
@@ -360,6 +362,9 @@ var SelectFilterColumn = function SelectFilterColumn(_ref) {
|
|
|
360
362
|
};
|
|
361
363
|
}
|
|
362
364
|
function renderFilter(type, conditionText) {
|
|
365
|
+
if (_utils.EMPTY_RHS_CONDITIONS.has(conditionText)) {
|
|
366
|
+
return null;
|
|
367
|
+
}
|
|
363
368
|
var _val = rhsVal[0];
|
|
364
369
|
var firstVal = '',
|
|
365
370
|
secondVal = '';
|
|
@@ -373,9 +378,7 @@ var SelectFilterColumn = function SelectFilterColumn(_ref) {
|
|
|
373
378
|
firstVal = _val.val[0] || '';
|
|
374
379
|
secondVal = _val.val[1] || '';
|
|
375
380
|
}
|
|
376
|
-
if (
|
|
377
|
-
return null;
|
|
378
|
-
} else if (conditionText === '介于之间') {
|
|
381
|
+
if (conditionText === '介于之间') {
|
|
379
382
|
if (type === _enum.SQL_GROUP_TYPE.NUMBER) {
|
|
380
383
|
return (0, _jsxRuntime.jsxs)("div", {
|
|
381
384
|
style: {
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import './index.less';
|
|
3
3
|
import { AtomsItem } from '../../../store/types';
|
|
4
|
+
import type { FormulaSqlTableScopeItem } from '../../../types';
|
|
4
5
|
interface PropsType {
|
|
5
6
|
customTypes?: any[];
|
|
6
7
|
otherTypes?: any[];
|
|
@@ -17,7 +18,7 @@ interface PropsType {
|
|
|
17
18
|
enableCopy?: boolean;
|
|
18
19
|
enableZoom?: boolean;
|
|
19
20
|
parentPopupChannel?: 'primary' | 'secondary';
|
|
20
|
-
onAddSql?: (sql: string) => Promise<void | (() => void)> | void | (() => void);
|
|
21
|
+
onAddSql?: (sql: string, availableTables?: any[], tableScope?: FormulaSqlTableScopeItem[]) => Promise<void | (() => void)> | void | (() => void);
|
|
21
22
|
}
|
|
22
23
|
declare const FormulaList: React.ForwardRefExoticComponent<PropsType & React.RefAttributes<unknown>>;
|
|
23
24
|
export default FormulaList;
|