@gingkoo/pandora-metabase 1.0.45 → 1.0.47
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/formula/index.js +3 -3
- package/lib/cjs/components/dialog/formula/utils.d.ts +1 -1
- package/lib/cjs/components/dialog/formula/utils.js +18 -2
- package/lib/cjs/components/modules/join-data.js +22 -15
- package/lib/cjs/components/modules/table-data.js +20 -13
- package/lib/es/components/dialog/formula/index.js +3 -3
- package/lib/es/components/dialog/formula/utils.d.ts +1 -1
- package/lib/es/components/dialog/formula/utils.js +18 -2
- package/lib/es/components/modules/join-data.js +22 -15
- package/lib/es/components/modules/table-data.js +20 -13
- package/package.json +1 -1
|
@@ -79,11 +79,11 @@ var CaseEditor = function CaseEditor(props) {
|
|
|
79
79
|
};
|
|
80
80
|
// 选择公式名
|
|
81
81
|
var handleFunName = function handleFunName(name) {
|
|
82
|
-
var _formulaList$name;
|
|
82
|
+
var _formulaList$name, _formulaList$name2;
|
|
83
83
|
formulaList === null || formulaList === void 0 || formulaList[name].args;
|
|
84
84
|
setFun((0, _objectSpread2["default"])((0, _objectSpread2["default"])({}, fun), {}, {
|
|
85
|
-
args: (0, _utils2.getTemArgs)(formulaList === null || formulaList === void 0 ? void 0 : formulaList[name].args),
|
|
86
|
-
arity: formulaList === null || formulaList === void 0 || (_formulaList$
|
|
85
|
+
args: (0, _utils2.getTemArgs)(formulaList === null || formulaList === void 0 ? void 0 : formulaList[name].args, formulaList === null || formulaList === void 0 || (_formulaList$name = formulaList[name]) === null || _formulaList$name === void 0 ? void 0 : _formulaList$name.arity),
|
|
86
|
+
arity: formulaList === null || formulaList === void 0 || (_formulaList$name2 = formulaList[name]) === null || _formulaList$name2 === void 0 ? void 0 : _formulaList$name2.arity,
|
|
87
87
|
name: name
|
|
88
88
|
}));
|
|
89
89
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Arity, AtomsItem, AtomsCollection } from '../../../store/types';
|
|
2
2
|
export declare const getObjTem: (arr: any[]) => any;
|
|
3
|
-
export declare const getTemArgs: (temArgs: any[]) => AtomsCollection[];
|
|
3
|
+
export declare const getTemArgs: (temArgs: any[], arity?: Arity) => AtomsCollection[];
|
|
4
4
|
export declare function getParamActions(params: AtomsItem[], arity?: Arity): {
|
|
5
5
|
canAdd: boolean;
|
|
6
6
|
canDel: boolean;
|
|
@@ -19,14 +19,30 @@ var getObjTem = exports.getObjTem = function getObjTem(arr) {
|
|
|
19
19
|
});
|
|
20
20
|
return obj;
|
|
21
21
|
};
|
|
22
|
-
var getTemArgs = exports.getTemArgs = function getTemArgs(temArgs) {
|
|
23
|
-
|
|
22
|
+
var getTemArgs = exports.getTemArgs = function getTemArgs(temArgs, arity) {
|
|
23
|
+
var _temArgs = (temArgs === null || temArgs === void 0 ? void 0 : temArgs.map(function (v) {
|
|
24
24
|
return {
|
|
25
25
|
type: _types.AtomsTypeEnum.COLLECTION,
|
|
26
26
|
quotes: '',
|
|
27
27
|
list: [(0, _utils.getTemplateItem)(v.type)]
|
|
28
28
|
};
|
|
29
29
|
})) || [];
|
|
30
|
+
var minLen = (arity === null || arity === void 0 ? void 0 : arity.min) || (arity === null || arity === void 0 ? void 0 : arity.exact);
|
|
31
|
+
var temLen = _temArgs.length;
|
|
32
|
+
var len = minLen - temLen;
|
|
33
|
+
// 按最小长度添加
|
|
34
|
+
if (len > 0) {
|
|
35
|
+
Array.from({
|
|
36
|
+
length: len
|
|
37
|
+
}).forEach(function () {
|
|
38
|
+
_temArgs.push({
|
|
39
|
+
type: _types.AtomsTypeEnum.COLLECTION,
|
|
40
|
+
quotes: '',
|
|
41
|
+
list: []
|
|
42
|
+
});
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
return _temArgs;
|
|
30
46
|
};
|
|
31
47
|
function getParamActions(params, arity) {
|
|
32
48
|
var len = (params === null || params === void 0 ? void 0 : params.length) || 0;
|
|
@@ -69,7 +69,7 @@ var menuOperator = operators.map(function (v) {
|
|
|
69
69
|
};
|
|
70
70
|
});
|
|
71
71
|
var JoinData = function JoinData(props) {
|
|
72
|
-
var _meta$subquery, _meta$subquery2, _meta$subquery3, _meta$
|
|
72
|
+
var _meta$subquery, _meta$subquery2, _meta$subquery3, _meta$table5, _meta$table6, _meta$table8, _meta$table9, _meta$table0, _meta$table1, _meta$expressions, _meta$table10, _meta$table11, _meta$expressions2, _store$showMainColumn, _store$showMainColumn2;
|
|
73
73
|
var meta = props.meta,
|
|
74
74
|
groupIndex = props.groupIndex;
|
|
75
75
|
var store = (0, _useProvider.useStore)();
|
|
@@ -89,15 +89,22 @@ var JoinData = function JoinData(props) {
|
|
|
89
89
|
setIsDel = _useState2[1];
|
|
90
90
|
var tableIsDel = /*#__PURE__*/function () {
|
|
91
91
|
var _ref = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee() {
|
|
92
|
-
var _meta$table;
|
|
92
|
+
var _meta$table, _meta$table2;
|
|
93
93
|
var tableName, tables, names;
|
|
94
94
|
return _regenerator["default"].wrap(function (_context) {
|
|
95
95
|
while (1) switch (_context.prev = _context.next) {
|
|
96
96
|
case 0:
|
|
97
97
|
tableName = (_meta$table = meta.table2) === null || _meta$table === void 0 ? void 0 : _meta$table.name;
|
|
98
|
-
|
|
99
|
-
|
|
98
|
+
if ((_meta$table2 = meta.table2) !== null && _meta$table2 !== void 0 && _meta$table2.datasourceId) {
|
|
99
|
+
_context.next = 1;
|
|
100
|
+
break;
|
|
101
|
+
}
|
|
102
|
+
setIsDel(false);
|
|
103
|
+
return _context.abrupt("return");
|
|
100
104
|
case 1:
|
|
105
|
+
_context.next = 2;
|
|
106
|
+
return store === null || store === void 0 ? void 0 : store.fetchDataset(meta.table2.datasourceId);
|
|
107
|
+
case 2:
|
|
101
108
|
tables = _context.sent;
|
|
102
109
|
names = (tables === null || tables === void 0 ? void 0 : tables.map(function (v) {
|
|
103
110
|
return v.name;
|
|
@@ -107,7 +114,7 @@ var JoinData = function JoinData(props) {
|
|
|
107
114
|
} else {
|
|
108
115
|
setIsDel(false);
|
|
109
116
|
}
|
|
110
|
-
case
|
|
117
|
+
case 3:
|
|
111
118
|
case "end":
|
|
112
119
|
return _context.stop();
|
|
113
120
|
}
|
|
@@ -1401,11 +1408,11 @@ var JoinData = function JoinData(props) {
|
|
|
1401
1408
|
}
|
|
1402
1409
|
};
|
|
1403
1410
|
var tableIsError = function tableIsError() {
|
|
1404
|
-
var _store$preProps4, _meta$
|
|
1411
|
+
var _store$preProps4, _meta$table3;
|
|
1405
1412
|
var aliass = ((_store$preProps4 = store.preProps) === null || _store$preProps4 === void 0 || (_store$preProps4 = _store$preProps4.notExistsColumns) === null || _store$preProps4 === void 0 ? void 0 : _store$preProps4.map(function (v) {
|
|
1406
1413
|
return v.alias;
|
|
1407
1414
|
})) || [];
|
|
1408
|
-
var tableAlias = (_meta$
|
|
1415
|
+
var tableAlias = (_meta$table3 = meta.table2) === null || _meta$table3 === void 0 ? void 0 : _meta$table3.alias;
|
|
1409
1416
|
if (tableAlias && aliass.includes(tableAlias) || isDel) {
|
|
1410
1417
|
return true;
|
|
1411
1418
|
}
|
|
@@ -1478,12 +1485,12 @@ var JoinData = function JoinData(props) {
|
|
|
1478
1485
|
icon: isDel ? (0, _jsxRuntime.jsx)(_pandoraIcons.ExclamationCircleFill, {}) : 'As',
|
|
1479
1486
|
size: 'small',
|
|
1480
1487
|
onClick: function onClick(e) {
|
|
1481
|
-
var _meta$
|
|
1488
|
+
var _meta$table4;
|
|
1482
1489
|
e.stopPropagation();
|
|
1483
|
-
onChangeTableAlias(((_meta$
|
|
1490
|
+
onChangeTableAlias(((_meta$table4 = meta.table2) === null || _meta$table4 === void 0 ? void 0 : _meta$table4.alias) || '');
|
|
1484
1491
|
}
|
|
1485
1492
|
})
|
|
1486
|
-
}), subQuerySelected ? "".concat(((_meta$subquery2 = meta.subquery) === null || _meta$subquery2 === void 0 ? void 0 : _meta$subquery2[0]).table.datasourceName, ".").concat(((_meta$subquery3 = meta.subquery) === null || _meta$subquery3 === void 0 ? void 0 : _meta$subquery3[0]).table.name, " ").concat((_meta$
|
|
1493
|
+
}), subQuerySelected ? "".concat(((_meta$subquery2 = meta.subquery) === null || _meta$subquery2 === void 0 ? void 0 : _meta$subquery2[0]).table.datasourceName, ".").concat(((_meta$subquery3 = meta.subquery) === null || _meta$subquery3 === void 0 ? void 0 : _meta$subquery3[0]).table.name, " ").concat((_meta$table5 = meta.table2) !== null && _meta$table5 !== void 0 && _meta$table5.alias ? "as ".concat((_meta$table6 = meta.table2) === null || _meta$table6 === void 0 ? void 0 : _meta$table6.alias) : '', " ") : (0, _locale.__)('SqlQueryBuilder.setSubQuery')]
|
|
1487
1494
|
}) : (0, _jsxRuntime.jsxs)("div", {
|
|
1488
1495
|
className: (0, _classnames["default"])("Sqb-TableName", {
|
|
1489
1496
|
notSelected: !table2Selected
|
|
@@ -1508,12 +1515,12 @@ var JoinData = function JoinData(props) {
|
|
|
1508
1515
|
icon: isDel ? (0, _jsxRuntime.jsx)(_pandoraIcons.ExclamationCircleFill, {}) : 'As',
|
|
1509
1516
|
size: 'small',
|
|
1510
1517
|
onClick: function onClick(e) {
|
|
1511
|
-
var _meta$
|
|
1518
|
+
var _meta$table7;
|
|
1512
1519
|
e.stopPropagation();
|
|
1513
|
-
onChangeTableAlias(((_meta$
|
|
1520
|
+
onChangeTableAlias(((_meta$table7 = meta.table2) === null || _meta$table7 === void 0 ? void 0 : _meta$table7.alias) || '');
|
|
1514
1521
|
}
|
|
1515
1522
|
})
|
|
1516
|
-
}), table2Selected ? "".concat(meta.table2.datasourceName, ".").concat(meta.table2.name, " ").concat((_meta$
|
|
1523
|
+
}), table2Selected ? "".concat(meta.table2.datasourceName, ".").concat(meta.table2.name, " ").concat((_meta$table8 = meta.table2) !== null && _meta$table8 !== void 0 && _meta$table8.alias ? "as ".concat((_meta$table9 = meta.table2) === null || _meta$table9 === void 0 ? void 0 : _meta$table9.alias) : '') : (0, _locale.__)('SqlQueryBuilder.pickTable')]
|
|
1517
1524
|
}), store.showSubquery && (0, _jsxRuntime.jsx)(_pandora.Tooltip, {
|
|
1518
1525
|
title: (0, _locale.__)('SqlQueryBuilder.switchSubQuery'),
|
|
1519
1526
|
children: (0, _jsxRuntime.jsx)(_pandora.Button, {
|
|
@@ -1524,7 +1531,7 @@ var JoinData = function JoinData(props) {
|
|
|
1524
1531
|
icon: (0, _jsxRuntime.jsx)(_pandoraIcons.RelatedWork, {}),
|
|
1525
1532
|
onClick: switchSubQuery
|
|
1526
1533
|
})
|
|
1527
|
-
}), ((_meta$
|
|
1534
|
+
}), ((_meta$table0 = meta.table2) === null || _meta$table0 === void 0 ? void 0 : _meta$table0.name) && ((_meta$table1 = meta.table1) === null || _meta$table1 === void 0 ? void 0 : _meta$table1.name) && ((_meta$expressions = meta.expressions) === null || _meta$expressions === void 0 ? void 0 : _meta$expressions.map(function (v, i) {
|
|
1528
1535
|
if (v.type === _types.AtomsTypeEnum.JOIN_DEFAULT) {
|
|
1529
1536
|
return (0, _jsxRuntime.jsxs)("div", {
|
|
1530
1537
|
className: (0, _classnames["default"])("Sqb-where block"),
|
|
@@ -1751,7 +1758,7 @@ var JoinData = function JoinData(props) {
|
|
|
1751
1758
|
})]
|
|
1752
1759
|
}, i);
|
|
1753
1760
|
}
|
|
1754
|
-
})), ((_meta$
|
|
1761
|
+
})), ((_meta$table10 = meta.table2) === null || _meta$table10 === void 0 ? void 0 : _meta$table10.name) && ((_meta$table11 = meta.table1) === null || _meta$table11 === void 0 ? void 0 : _meta$table11.name) && (((_meta$expressions2 = meta.expressions) === null || _meta$expressions2 === void 0 ? void 0 : _meta$expressions2.length) || 0) < 1 && (0, _jsxRuntime.jsx)(_pandora.Tooltip, {
|
|
1755
1762
|
title: (0, _locale.__)('SqlQueryBuilder.add'),
|
|
1756
1763
|
children: (0, _jsxRuntime.jsx)(_pandora.Dropdown, {
|
|
1757
1764
|
trigger: ['click'],
|
|
@@ -29,7 +29,7 @@ var _header = _interopRequireDefault(require("./components/header"));
|
|
|
29
29
|
var _useProvider = require("../../hooks/use-provider");
|
|
30
30
|
var _excluded = ["subToolbar", "notExistsColumns", "isExit", "toolbar"];
|
|
31
31
|
var TableData = function TableData(props) {
|
|
32
|
-
var _meta$subquery, _meta$subquery2, _meta$subquery3, _meta$
|
|
32
|
+
var _meta$subquery, _meta$subquery2, _meta$subquery3, _meta$table5, _meta$table6, _meta$table8, _meta$table9, _store$showMainColumn;
|
|
33
33
|
var meta = props.meta,
|
|
34
34
|
groupIndex = props.groupIndex;
|
|
35
35
|
var store = (0, _useProvider.useStore)();
|
|
@@ -41,15 +41,22 @@ var TableData = function TableData(props) {
|
|
|
41
41
|
setIsDel = _useState2[1];
|
|
42
42
|
var tableIsDel = /*#__PURE__*/function () {
|
|
43
43
|
var _ref = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee() {
|
|
44
|
-
var _meta$table;
|
|
44
|
+
var _meta$table, _meta$table2;
|
|
45
45
|
var tableName, tables, names;
|
|
46
46
|
return _regenerator["default"].wrap(function (_context) {
|
|
47
47
|
while (1) switch (_context.prev = _context.next) {
|
|
48
48
|
case 0:
|
|
49
49
|
tableName = (_meta$table = meta.table) === null || _meta$table === void 0 ? void 0 : _meta$table.name;
|
|
50
|
-
|
|
51
|
-
|
|
50
|
+
if (meta !== null && meta !== void 0 && (_meta$table2 = meta.table) !== null && _meta$table2 !== void 0 && _meta$table2.datasourceId) {
|
|
51
|
+
_context.next = 1;
|
|
52
|
+
break;
|
|
53
|
+
}
|
|
54
|
+
setIsDel(false);
|
|
55
|
+
return _context.abrupt("return");
|
|
52
56
|
case 1:
|
|
57
|
+
_context.next = 2;
|
|
58
|
+
return store === null || store === void 0 ? void 0 : store.fetchDataset(meta.table.datasourceId);
|
|
59
|
+
case 2:
|
|
53
60
|
tables = _context.sent;
|
|
54
61
|
names = (tables === null || tables === void 0 ? void 0 : tables.map(function (v) {
|
|
55
62
|
return v.name;
|
|
@@ -59,7 +66,7 @@ var TableData = function TableData(props) {
|
|
|
59
66
|
} else {
|
|
60
67
|
setIsDel(false);
|
|
61
68
|
}
|
|
62
|
-
case
|
|
69
|
+
case 3:
|
|
63
70
|
case "end":
|
|
64
71
|
return _context.stop();
|
|
65
72
|
}
|
|
@@ -256,11 +263,11 @@ var TableData = function TableData(props) {
|
|
|
256
263
|
store.setMeta(newMetaList, groupIndex);
|
|
257
264
|
};
|
|
258
265
|
var tableIsError = function tableIsError() {
|
|
259
|
-
var _store$preProps3, _meta$
|
|
266
|
+
var _store$preProps3, _meta$table3;
|
|
260
267
|
var aliass = ((_store$preProps3 = store.preProps) === null || _store$preProps3 === void 0 || (_store$preProps3 = _store$preProps3.notExistsColumns) === null || _store$preProps3 === void 0 ? void 0 : _store$preProps3.map(function (v) {
|
|
261
268
|
return v.alias;
|
|
262
269
|
})) || [];
|
|
263
|
-
var tableAlias = (_meta$
|
|
270
|
+
var tableAlias = (_meta$table3 = meta.table) === null || _meta$table3 === void 0 ? void 0 : _meta$table3.alias;
|
|
264
271
|
if (tableAlias && aliass.includes(tableAlias) || isDel) {
|
|
265
272
|
return true;
|
|
266
273
|
}
|
|
@@ -302,12 +309,12 @@ var TableData = function TableData(props) {
|
|
|
302
309
|
icon: isDel ? (0, _jsxRuntime.jsx)(_pandoraIcons.ExclamationCircleFill, {}) : 'As',
|
|
303
310
|
size: 'small',
|
|
304
311
|
onClick: function onClick(e) {
|
|
305
|
-
var _meta$
|
|
312
|
+
var _meta$table4;
|
|
306
313
|
e.stopPropagation();
|
|
307
|
-
onChangeTableAlias(((_meta$
|
|
314
|
+
onChangeTableAlias(((_meta$table4 = meta.table) === null || _meta$table4 === void 0 ? void 0 : _meta$table4.alias) || '');
|
|
308
315
|
}
|
|
309
316
|
})
|
|
310
|
-
}), subQuerySelected ? "".concat(((_meta$subquery2 = meta.subquery) === null || _meta$subquery2 === void 0 ? void 0 : _meta$subquery2[0]).table.datasourceName, ".").concat(((_meta$subquery3 = meta.subquery) === null || _meta$subquery3 === void 0 ? void 0 : _meta$subquery3[0]).table.name, " ").concat((_meta$
|
|
317
|
+
}), subQuerySelected ? "".concat(((_meta$subquery2 = meta.subquery) === null || _meta$subquery2 === void 0 ? void 0 : _meta$subquery2[0]).table.datasourceName, ".").concat(((_meta$subquery3 = meta.subquery) === null || _meta$subquery3 === void 0 ? void 0 : _meta$subquery3[0]).table.name, " ").concat((_meta$table5 = meta.table) !== null && _meta$table5 !== void 0 && _meta$table5.alias ? "as ".concat((_meta$table6 = meta.table) === null || _meta$table6 === void 0 ? void 0 : _meta$table6.alias) : '', " ") : (0, _locale.__)('SqlQueryBuilder.setSubQuery')]
|
|
311
318
|
}) : (0, _jsxRuntime.jsxs)("div", {
|
|
312
319
|
className: (0, _classnames["default"])("Sqb-TableName", {
|
|
313
320
|
notSelected: !selected
|
|
@@ -332,12 +339,12 @@ var TableData = function TableData(props) {
|
|
|
332
339
|
icon: isDel ? (0, _jsxRuntime.jsx)(_pandoraIcons.ExclamationCircleFill, {}) : 'As',
|
|
333
340
|
size: 'small',
|
|
334
341
|
onClick: function onClick(e) {
|
|
335
|
-
var _meta$
|
|
342
|
+
var _meta$table7;
|
|
336
343
|
e.stopPropagation();
|
|
337
|
-
onChangeTableAlias(((_meta$
|
|
344
|
+
onChangeTableAlias(((_meta$table7 = meta.table) === null || _meta$table7 === void 0 ? void 0 : _meta$table7.alias) || '');
|
|
338
345
|
}
|
|
339
346
|
})
|
|
340
|
-
}), selected ? "".concat(meta.table.datasourceName, ".").concat(meta.table.name, " ").concat((_meta$
|
|
347
|
+
}), selected ? "".concat(meta.table.datasourceName, ".").concat(meta.table.name, " ").concat((_meta$table8 = meta.table) !== null && _meta$table8 !== void 0 && _meta$table8.alias ? "as ".concat((_meta$table9 = meta.table) === null || _meta$table9 === void 0 ? void 0 : _meta$table9.alias) : '') : (0, _locale.__)('SqlQueryBuilder.pickTable')]
|
|
341
348
|
}), store.showSubquery && (0, _jsxRuntime.jsx)(_pandora.Tooltip, {
|
|
342
349
|
title: (0, _locale.__)('SqlQueryBuilder.switchSubQuery'),
|
|
343
350
|
children: (0, _jsxRuntime.jsx)(_pandora.Button, {
|
|
@@ -73,11 +73,11 @@ var CaseEditor = function CaseEditor(props) {
|
|
|
73
73
|
};
|
|
74
74
|
// 选择公式名
|
|
75
75
|
var handleFunName = function handleFunName(name) {
|
|
76
|
-
var _formulaList$name;
|
|
76
|
+
var _formulaList$name, _formulaList$name2;
|
|
77
77
|
formulaList === null || formulaList === void 0 || formulaList[name].args;
|
|
78
78
|
setFun(_objectSpread(_objectSpread({}, fun), {}, {
|
|
79
|
-
args: getTemArgs(formulaList === null || formulaList === void 0 ? void 0 : formulaList[name].args),
|
|
80
|
-
arity: formulaList === null || formulaList === void 0 || (_formulaList$
|
|
79
|
+
args: getTemArgs(formulaList === null || formulaList === void 0 ? void 0 : formulaList[name].args, formulaList === null || formulaList === void 0 || (_formulaList$name = formulaList[name]) === null || _formulaList$name === void 0 ? void 0 : _formulaList$name.arity),
|
|
80
|
+
arity: formulaList === null || formulaList === void 0 || (_formulaList$name2 = formulaList[name]) === null || _formulaList$name2 === void 0 ? void 0 : _formulaList$name2.arity,
|
|
81
81
|
name: name
|
|
82
82
|
}));
|
|
83
83
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Arity, AtomsItem, AtomsCollection } from '../../../store/types';
|
|
2
2
|
export declare const getObjTem: (arr: any[]) => any;
|
|
3
|
-
export declare const getTemArgs: (temArgs: any[]) => AtomsCollection[];
|
|
3
|
+
export declare const getTemArgs: (temArgs: any[], arity?: Arity) => AtomsCollection[];
|
|
4
4
|
export declare function getParamActions(params: AtomsItem[], arity?: Arity): {
|
|
5
5
|
canAdd: boolean;
|
|
6
6
|
canDel: boolean;
|
|
@@ -11,14 +11,30 @@ export var getObjTem = function getObjTem(arr) {
|
|
|
11
11
|
});
|
|
12
12
|
return obj;
|
|
13
13
|
};
|
|
14
|
-
export var getTemArgs = function getTemArgs(temArgs) {
|
|
15
|
-
|
|
14
|
+
export var getTemArgs = function getTemArgs(temArgs, arity) {
|
|
15
|
+
var _temArgs = (temArgs === null || temArgs === void 0 ? void 0 : temArgs.map(function (v) {
|
|
16
16
|
return {
|
|
17
17
|
type: AtomsTypeEnum.COLLECTION,
|
|
18
18
|
quotes: '',
|
|
19
19
|
list: [getTemplateItem(v.type)]
|
|
20
20
|
};
|
|
21
21
|
})) || [];
|
|
22
|
+
var minLen = (arity === null || arity === void 0 ? void 0 : arity.min) || (arity === null || arity === void 0 ? void 0 : arity.exact);
|
|
23
|
+
var temLen = _temArgs.length;
|
|
24
|
+
var len = minLen - temLen;
|
|
25
|
+
// 按最小长度添加
|
|
26
|
+
if (len > 0) {
|
|
27
|
+
Array.from({
|
|
28
|
+
length: len
|
|
29
|
+
}).forEach(function () {
|
|
30
|
+
_temArgs.push({
|
|
31
|
+
type: AtomsTypeEnum.COLLECTION,
|
|
32
|
+
quotes: '',
|
|
33
|
+
list: []
|
|
34
|
+
});
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
return _temArgs;
|
|
22
38
|
};
|
|
23
39
|
export function getParamActions(params, arity) {
|
|
24
40
|
var len = (params === null || params === void 0 ? void 0 : params.length) || 0;
|
|
@@ -64,7 +64,7 @@ var menuOperator = operators.map(function (v) {
|
|
|
64
64
|
};
|
|
65
65
|
});
|
|
66
66
|
var JoinData = function JoinData(props) {
|
|
67
|
-
var _meta$subquery, _meta$subquery2, _meta$subquery3, _meta$
|
|
67
|
+
var _meta$subquery, _meta$subquery2, _meta$subquery3, _meta$table5, _meta$table6, _meta$table8, _meta$table9, _meta$table0, _meta$table1, _meta$expressions, _meta$table10, _meta$table11, _meta$expressions2, _store$showMainColumn, _store$showMainColumn2;
|
|
68
68
|
var meta = props.meta,
|
|
69
69
|
groupIndex = props.groupIndex;
|
|
70
70
|
var store = useStore();
|
|
@@ -84,15 +84,22 @@ var JoinData = function JoinData(props) {
|
|
|
84
84
|
setIsDel = _useState2[1];
|
|
85
85
|
var tableIsDel = /*#__PURE__*/function () {
|
|
86
86
|
var _ref = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
87
|
-
var _meta$table;
|
|
87
|
+
var _meta$table, _meta$table2;
|
|
88
88
|
var tableName, tables, names;
|
|
89
89
|
return _regeneratorRuntime.wrap(function (_context) {
|
|
90
90
|
while (1) switch (_context.prev = _context.next) {
|
|
91
91
|
case 0:
|
|
92
92
|
tableName = (_meta$table = meta.table2) === null || _meta$table === void 0 ? void 0 : _meta$table.name;
|
|
93
|
-
|
|
94
|
-
|
|
93
|
+
if ((_meta$table2 = meta.table2) !== null && _meta$table2 !== void 0 && _meta$table2.datasourceId) {
|
|
94
|
+
_context.next = 1;
|
|
95
|
+
break;
|
|
96
|
+
}
|
|
97
|
+
setIsDel(false);
|
|
98
|
+
return _context.abrupt("return");
|
|
95
99
|
case 1:
|
|
100
|
+
_context.next = 2;
|
|
101
|
+
return store === null || store === void 0 ? void 0 : store.fetchDataset(meta.table2.datasourceId);
|
|
102
|
+
case 2:
|
|
96
103
|
tables = _context.sent;
|
|
97
104
|
names = (tables === null || tables === void 0 ? void 0 : tables.map(function (v) {
|
|
98
105
|
return v.name;
|
|
@@ -102,7 +109,7 @@ var JoinData = function JoinData(props) {
|
|
|
102
109
|
} else {
|
|
103
110
|
setIsDel(false);
|
|
104
111
|
}
|
|
105
|
-
case
|
|
112
|
+
case 3:
|
|
106
113
|
case "end":
|
|
107
114
|
return _context.stop();
|
|
108
115
|
}
|
|
@@ -1396,11 +1403,11 @@ var JoinData = function JoinData(props) {
|
|
|
1396
1403
|
}
|
|
1397
1404
|
};
|
|
1398
1405
|
var tableIsError = function tableIsError() {
|
|
1399
|
-
var _store$preProps4, _meta$
|
|
1406
|
+
var _store$preProps4, _meta$table3;
|
|
1400
1407
|
var aliass = ((_store$preProps4 = store.preProps) === null || _store$preProps4 === void 0 || (_store$preProps4 = _store$preProps4.notExistsColumns) === null || _store$preProps4 === void 0 ? void 0 : _store$preProps4.map(function (v) {
|
|
1401
1408
|
return v.alias;
|
|
1402
1409
|
})) || [];
|
|
1403
|
-
var tableAlias = (_meta$
|
|
1410
|
+
var tableAlias = (_meta$table3 = meta.table2) === null || _meta$table3 === void 0 ? void 0 : _meta$table3.alias;
|
|
1404
1411
|
if (tableAlias && aliass.includes(tableAlias) || isDel) {
|
|
1405
1412
|
return true;
|
|
1406
1413
|
}
|
|
@@ -1473,12 +1480,12 @@ var JoinData = function JoinData(props) {
|
|
|
1473
1480
|
icon: isDel ? _jsx(ExclamationCircleFill, {}) : 'As',
|
|
1474
1481
|
size: 'small',
|
|
1475
1482
|
onClick: function onClick(e) {
|
|
1476
|
-
var _meta$
|
|
1483
|
+
var _meta$table4;
|
|
1477
1484
|
e.stopPropagation();
|
|
1478
|
-
onChangeTableAlias(((_meta$
|
|
1485
|
+
onChangeTableAlias(((_meta$table4 = meta.table2) === null || _meta$table4 === void 0 ? void 0 : _meta$table4.alias) || '');
|
|
1479
1486
|
}
|
|
1480
1487
|
})
|
|
1481
|
-
}), subQuerySelected ? "".concat(((_meta$subquery2 = meta.subquery) === null || _meta$subquery2 === void 0 ? void 0 : _meta$subquery2[0]).table.datasourceName, ".").concat(((_meta$subquery3 = meta.subquery) === null || _meta$subquery3 === void 0 ? void 0 : _meta$subquery3[0]).table.name, " ").concat((_meta$
|
|
1488
|
+
}), subQuerySelected ? "".concat(((_meta$subquery2 = meta.subquery) === null || _meta$subquery2 === void 0 ? void 0 : _meta$subquery2[0]).table.datasourceName, ".").concat(((_meta$subquery3 = meta.subquery) === null || _meta$subquery3 === void 0 ? void 0 : _meta$subquery3[0]).table.name, " ").concat((_meta$table5 = meta.table2) !== null && _meta$table5 !== void 0 && _meta$table5.alias ? "as ".concat((_meta$table6 = meta.table2) === null || _meta$table6 === void 0 ? void 0 : _meta$table6.alias) : '', " ") : __('SqlQueryBuilder.setSubQuery')]
|
|
1482
1489
|
}) : _jsxs("div", {
|
|
1483
1490
|
className: cx("Sqb-TableName", {
|
|
1484
1491
|
notSelected: !table2Selected
|
|
@@ -1503,12 +1510,12 @@ var JoinData = function JoinData(props) {
|
|
|
1503
1510
|
icon: isDel ? _jsx(ExclamationCircleFill, {}) : 'As',
|
|
1504
1511
|
size: 'small',
|
|
1505
1512
|
onClick: function onClick(e) {
|
|
1506
|
-
var _meta$
|
|
1513
|
+
var _meta$table7;
|
|
1507
1514
|
e.stopPropagation();
|
|
1508
|
-
onChangeTableAlias(((_meta$
|
|
1515
|
+
onChangeTableAlias(((_meta$table7 = meta.table2) === null || _meta$table7 === void 0 ? void 0 : _meta$table7.alias) || '');
|
|
1509
1516
|
}
|
|
1510
1517
|
})
|
|
1511
|
-
}), table2Selected ? "".concat(meta.table2.datasourceName, ".").concat(meta.table2.name, " ").concat((_meta$
|
|
1518
|
+
}), table2Selected ? "".concat(meta.table2.datasourceName, ".").concat(meta.table2.name, " ").concat((_meta$table8 = meta.table2) !== null && _meta$table8 !== void 0 && _meta$table8.alias ? "as ".concat((_meta$table9 = meta.table2) === null || _meta$table9 === void 0 ? void 0 : _meta$table9.alias) : '') : __('SqlQueryBuilder.pickTable')]
|
|
1512
1519
|
}), store.showSubquery && _jsx(Tooltip, {
|
|
1513
1520
|
title: __('SqlQueryBuilder.switchSubQuery'),
|
|
1514
1521
|
children: _jsx(Button, {
|
|
@@ -1519,7 +1526,7 @@ var JoinData = function JoinData(props) {
|
|
|
1519
1526
|
icon: _jsx(RelatedWork, {}),
|
|
1520
1527
|
onClick: switchSubQuery
|
|
1521
1528
|
})
|
|
1522
|
-
}), ((_meta$
|
|
1529
|
+
}), ((_meta$table0 = meta.table2) === null || _meta$table0 === void 0 ? void 0 : _meta$table0.name) && ((_meta$table1 = meta.table1) === null || _meta$table1 === void 0 ? void 0 : _meta$table1.name) && ((_meta$expressions = meta.expressions) === null || _meta$expressions === void 0 ? void 0 : _meta$expressions.map(function (v, i) {
|
|
1523
1530
|
if (v.type === AtomsTypeEnum.JOIN_DEFAULT) {
|
|
1524
1531
|
return _jsxs("div", {
|
|
1525
1532
|
className: cx("Sqb-where block"),
|
|
@@ -1746,7 +1753,7 @@ var JoinData = function JoinData(props) {
|
|
|
1746
1753
|
})]
|
|
1747
1754
|
}, i);
|
|
1748
1755
|
}
|
|
1749
|
-
})), ((_meta$
|
|
1756
|
+
})), ((_meta$table10 = meta.table2) === null || _meta$table10 === void 0 ? void 0 : _meta$table10.name) && ((_meta$table11 = meta.table1) === null || _meta$table11 === void 0 ? void 0 : _meta$table11.name) && (((_meta$expressions2 = meta.expressions) === null || _meta$expressions2 === void 0 ? void 0 : _meta$expressions2.length) || 0) < 1 && _jsx(Tooltip, {
|
|
1750
1757
|
title: __('SqlQueryBuilder.add'),
|
|
1751
1758
|
children: _jsx(Dropdown, {
|
|
1752
1759
|
trigger: ['click'],
|
|
@@ -23,7 +23,7 @@ import Header from './components/header';
|
|
|
23
23
|
import { ExclamationCircleFill } from '@gingkoo/pandora-icons';
|
|
24
24
|
import { useStore } from '../../hooks/use-provider';
|
|
25
25
|
var TableData = function TableData(props) {
|
|
26
|
-
var _meta$subquery, _meta$subquery2, _meta$subquery3, _meta$
|
|
26
|
+
var _meta$subquery, _meta$subquery2, _meta$subquery3, _meta$table5, _meta$table6, _meta$table8, _meta$table9, _store$showMainColumn;
|
|
27
27
|
var meta = props.meta,
|
|
28
28
|
groupIndex = props.groupIndex;
|
|
29
29
|
var store = useStore();
|
|
@@ -35,15 +35,22 @@ var TableData = function TableData(props) {
|
|
|
35
35
|
setIsDel = _useState2[1];
|
|
36
36
|
var tableIsDel = /*#__PURE__*/function () {
|
|
37
37
|
var _ref = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
38
|
-
var _meta$table;
|
|
38
|
+
var _meta$table, _meta$table2;
|
|
39
39
|
var tableName, tables, names;
|
|
40
40
|
return _regeneratorRuntime.wrap(function (_context) {
|
|
41
41
|
while (1) switch (_context.prev = _context.next) {
|
|
42
42
|
case 0:
|
|
43
43
|
tableName = (_meta$table = meta.table) === null || _meta$table === void 0 ? void 0 : _meta$table.name;
|
|
44
|
-
|
|
45
|
-
|
|
44
|
+
if (meta !== null && meta !== void 0 && (_meta$table2 = meta.table) !== null && _meta$table2 !== void 0 && _meta$table2.datasourceId) {
|
|
45
|
+
_context.next = 1;
|
|
46
|
+
break;
|
|
47
|
+
}
|
|
48
|
+
setIsDel(false);
|
|
49
|
+
return _context.abrupt("return");
|
|
46
50
|
case 1:
|
|
51
|
+
_context.next = 2;
|
|
52
|
+
return store === null || store === void 0 ? void 0 : store.fetchDataset(meta.table.datasourceId);
|
|
53
|
+
case 2:
|
|
47
54
|
tables = _context.sent;
|
|
48
55
|
names = (tables === null || tables === void 0 ? void 0 : tables.map(function (v) {
|
|
49
56
|
return v.name;
|
|
@@ -53,7 +60,7 @@ var TableData = function TableData(props) {
|
|
|
53
60
|
} else {
|
|
54
61
|
setIsDel(false);
|
|
55
62
|
}
|
|
56
|
-
case
|
|
63
|
+
case 3:
|
|
57
64
|
case "end":
|
|
58
65
|
return _context.stop();
|
|
59
66
|
}
|
|
@@ -250,11 +257,11 @@ var TableData = function TableData(props) {
|
|
|
250
257
|
store.setMeta(newMetaList, groupIndex);
|
|
251
258
|
};
|
|
252
259
|
var tableIsError = function tableIsError() {
|
|
253
|
-
var _store$preProps3, _meta$
|
|
260
|
+
var _store$preProps3, _meta$table3;
|
|
254
261
|
var aliass = ((_store$preProps3 = store.preProps) === null || _store$preProps3 === void 0 || (_store$preProps3 = _store$preProps3.notExistsColumns) === null || _store$preProps3 === void 0 ? void 0 : _store$preProps3.map(function (v) {
|
|
255
262
|
return v.alias;
|
|
256
263
|
})) || [];
|
|
257
|
-
var tableAlias = (_meta$
|
|
264
|
+
var tableAlias = (_meta$table3 = meta.table) === null || _meta$table3 === void 0 ? void 0 : _meta$table3.alias;
|
|
258
265
|
if (tableAlias && aliass.includes(tableAlias) || isDel) {
|
|
259
266
|
return true;
|
|
260
267
|
}
|
|
@@ -296,12 +303,12 @@ var TableData = function TableData(props) {
|
|
|
296
303
|
icon: isDel ? _jsx(ExclamationCircleFill, {}) : 'As',
|
|
297
304
|
size: 'small',
|
|
298
305
|
onClick: function onClick(e) {
|
|
299
|
-
var _meta$
|
|
306
|
+
var _meta$table4;
|
|
300
307
|
e.stopPropagation();
|
|
301
|
-
onChangeTableAlias(((_meta$
|
|
308
|
+
onChangeTableAlias(((_meta$table4 = meta.table) === null || _meta$table4 === void 0 ? void 0 : _meta$table4.alias) || '');
|
|
302
309
|
}
|
|
303
310
|
})
|
|
304
|
-
}), subQuerySelected ? "".concat(((_meta$subquery2 = meta.subquery) === null || _meta$subquery2 === void 0 ? void 0 : _meta$subquery2[0]).table.datasourceName, ".").concat(((_meta$subquery3 = meta.subquery) === null || _meta$subquery3 === void 0 ? void 0 : _meta$subquery3[0]).table.name, " ").concat((_meta$
|
|
311
|
+
}), subQuerySelected ? "".concat(((_meta$subquery2 = meta.subquery) === null || _meta$subquery2 === void 0 ? void 0 : _meta$subquery2[0]).table.datasourceName, ".").concat(((_meta$subquery3 = meta.subquery) === null || _meta$subquery3 === void 0 ? void 0 : _meta$subquery3[0]).table.name, " ").concat((_meta$table5 = meta.table) !== null && _meta$table5 !== void 0 && _meta$table5.alias ? "as ".concat((_meta$table6 = meta.table) === null || _meta$table6 === void 0 ? void 0 : _meta$table6.alias) : '', " ") : __('SqlQueryBuilder.setSubQuery')]
|
|
305
312
|
}) : _jsxs("div", {
|
|
306
313
|
className: cx("Sqb-TableName", {
|
|
307
314
|
notSelected: !selected
|
|
@@ -326,12 +333,12 @@ var TableData = function TableData(props) {
|
|
|
326
333
|
icon: isDel ? _jsx(ExclamationCircleFill, {}) : 'As',
|
|
327
334
|
size: 'small',
|
|
328
335
|
onClick: function onClick(e) {
|
|
329
|
-
var _meta$
|
|
336
|
+
var _meta$table7;
|
|
330
337
|
e.stopPropagation();
|
|
331
|
-
onChangeTableAlias(((_meta$
|
|
338
|
+
onChangeTableAlias(((_meta$table7 = meta.table) === null || _meta$table7 === void 0 ? void 0 : _meta$table7.alias) || '');
|
|
332
339
|
}
|
|
333
340
|
})
|
|
334
|
-
}), selected ? "".concat(meta.table.datasourceName, ".").concat(meta.table.name, " ").concat((_meta$
|
|
341
|
+
}), selected ? "".concat(meta.table.datasourceName, ".").concat(meta.table.name, " ").concat((_meta$table8 = meta.table) !== null && _meta$table8 !== void 0 && _meta$table8.alias ? "as ".concat((_meta$table9 = meta.table) === null || _meta$table9 === void 0 ? void 0 : _meta$table9.alias) : '') : __('SqlQueryBuilder.pickTable')]
|
|
335
342
|
}), store.showSubquery && _jsx(Tooltip, {
|
|
336
343
|
title: __('SqlQueryBuilder.switchSubQuery'),
|
|
337
344
|
children: _jsx(Button, {
|