@gingkoo/pandora-metabase 1.0.155-alpha.1 → 1.0.156
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/metabase/index.less +3 -3
- package/lib/cjs/components/modules/join-data.js +77 -83
- package/lib/cjs/components/modules/summarize/group-by.js +21 -15
- package/lib/cjs/components/modules/summarize/select-index.js +21 -15
- package/lib/cjs/components/modules/table-data.js +55 -64
- package/lib/cjs/locale/en.js +4 -0
- package/lib/cjs/locale/zh.js +4 -0
- package/lib/es/components/metabase/index.less +3 -3
- package/lib/es/components/modules/join-data.js +77 -84
- package/lib/es/components/modules/summarize/group-by.js +21 -15
- package/lib/es/components/modules/summarize/select-index.js +21 -15
- package/lib/es/components/modules/table-data.js +55 -65
- package/lib/es/locale/en.js +4 -0
- package/lib/es/locale/zh.js +4 -0
- package/package.json +1 -1
|
@@ -326,9 +326,9 @@
|
|
|
326
326
|
padding: 0;
|
|
327
327
|
border: none;
|
|
328
328
|
border-radius: 999px;
|
|
329
|
-
width:
|
|
330
|
-
height:
|
|
331
|
-
min-height:
|
|
329
|
+
width: 18px;
|
|
330
|
+
height: 18px;
|
|
331
|
+
min-height: 18px;
|
|
332
332
|
font-size: 10px;
|
|
333
333
|
display: inline-flex;
|
|
334
334
|
align-items: center;
|
|
@@ -1384,90 +1384,84 @@ var JoinData = function JoinData(props) {
|
|
|
1384
1384
|
cursor: 'pointer'
|
|
1385
1385
|
}
|
|
1386
1386
|
})
|
|
1387
|
-
}), meta.isSubquery ? (0, _jsxRuntime.jsx)(
|
|
1388
|
-
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
|
|
1420
|
-
|
|
1421
|
-
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
|
|
1426
|
-
|
|
1427
|
-
}) : null;
|
|
1428
|
-
}()
|
|
1429
|
-
}), 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$table4 = meta.table2) !== null && _meta$table4 !== void 0 && _meta$table4.alias && store.tableEnableAlias ? "as ".concat((_meta$table5 = meta.table2) === null || _meta$table5 === void 0 ? void 0 : _meta$table5.alias) : '', " ") : (0, _locale.__)('SqlQueryBuilder.setSubQuery')]
|
|
1387
|
+
}), meta.isSubquery ? (0, _jsxRuntime.jsx)(_itemName["default"], {
|
|
1388
|
+
isError: !store.tableEnableAlias && tableIsError(),
|
|
1389
|
+
message: (0, _locale.__)(isDel ? 'metabase.verify' : 'SqlQueryBuilder.repeatAlias'),
|
|
1390
|
+
children: (0, _jsxRuntime.jsx)(_rightClickValue["default"], {
|
|
1391
|
+
value: meta,
|
|
1392
|
+
children: (0, _jsxRuntime.jsxs)("div", {
|
|
1393
|
+
className: (0, _classnames["default"])("Sqb-TableName", {
|
|
1394
|
+
notSelected: !subQuerySelected
|
|
1395
|
+
}),
|
|
1396
|
+
"data-sqb-snapshot-allow": 'true',
|
|
1397
|
+
onClick: function onClick() {
|
|
1398
|
+
showSubQuery(meta.subquery);
|
|
1399
|
+
},
|
|
1400
|
+
children: [subQuerySelected && (0, _jsxRuntime.jsx)(_jsxRuntime.Fragment, {
|
|
1401
|
+
children: function () {
|
|
1402
|
+
var showButton = !store.snapshotMode && store.tableEnableAlias;
|
|
1403
|
+
return !store.snapshotMode ? (0, _jsxRuntime.jsx)(_jsxRuntime.Fragment, {
|
|
1404
|
+
children: showButton && (0, _jsxRuntime.jsx)(_pandora.Tooltip, {
|
|
1405
|
+
title: (0, _locale.__)(tableIsError() ? isDel ? store.tableEnableAlias ? 'metabase.verifyAliasAction' : 'metabase.verify' : store.tableEnableAlias ? 'SqlQueryBuilder.repeatAliasAction' : 'SqlQueryBuilder.repeatAlias' : 'SqlQueryBuilder.alias'),
|
|
1406
|
+
children: (0, _jsxRuntime.jsx)(_pandora.Button, {
|
|
1407
|
+
danger: tableIsError(),
|
|
1408
|
+
className: (0, _classnames["default"])(':Sqb-TableName-as', {
|
|
1409
|
+
isError: tableIsError()
|
|
1410
|
+
}),
|
|
1411
|
+
shape: 'circle',
|
|
1412
|
+
iconOnly: true,
|
|
1413
|
+
primary: true,
|
|
1414
|
+
icon: 'As',
|
|
1415
|
+
size: 'small',
|
|
1416
|
+
onClick: function onClick(e) {
|
|
1417
|
+
var _meta$table3;
|
|
1418
|
+
e.stopPropagation();
|
|
1419
|
+
onChangeTableAlias(((_meta$table3 = meta.table2) === null || _meta$table3 === void 0 ? void 0 : _meta$table3.alias) || '');
|
|
1420
|
+
}
|
|
1421
|
+
})
|
|
1422
|
+
})
|
|
1423
|
+
}) : null;
|
|
1424
|
+
}()
|
|
1425
|
+
}), 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$table4 = meta.table2) !== null && _meta$table4 !== void 0 && _meta$table4.alias && store.tableEnableAlias ? "as ".concat((_meta$table5 = meta.table2) === null || _meta$table5 === void 0 ? void 0 : _meta$table5.alias) : '', " ") : (0, _locale.__)('SqlQueryBuilder.setSubQuery')]
|
|
1426
|
+
})
|
|
1430
1427
|
})
|
|
1431
|
-
}) : (0, _jsxRuntime.jsx)(
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
|
|
1436
|
-
|
|
1437
|
-
|
|
1438
|
-
|
|
1439
|
-
|
|
1440
|
-
|
|
1441
|
-
|
|
1442
|
-
|
|
1443
|
-
|
|
1444
|
-
|
|
1445
|
-
|
|
1446
|
-
|
|
1447
|
-
|
|
1448
|
-
|
|
1449
|
-
|
|
1450
|
-
|
|
1451
|
-
|
|
1452
|
-
|
|
1453
|
-
|
|
1454
|
-
|
|
1455
|
-
|
|
1456
|
-
|
|
1457
|
-
|
|
1458
|
-
|
|
1459
|
-
|
|
1460
|
-
|
|
1461
|
-
|
|
1462
|
-
|
|
1463
|
-
|
|
1464
|
-
|
|
1465
|
-
|
|
1466
|
-
|
|
1467
|
-
|
|
1468
|
-
}) : null;
|
|
1469
|
-
}()
|
|
1470
|
-
}), table2Selected ? "".concat(meta.table2.datasourceName, ".").concat(meta.table2.name, " ").concat((_meta$table7 = meta.table2) !== null && _meta$table7 !== void 0 && _meta$table7.alias && store.tableEnableAlias ? "as ".concat((_meta$table8 = meta.table2) === null || _meta$table8 === void 0 ? void 0 : _meta$table8.alias) : '') : (0, _locale.__)('SqlQueryBuilder.pickTable')]
|
|
1428
|
+
}) : (0, _jsxRuntime.jsx)(_itemName["default"], {
|
|
1429
|
+
isError: !store.tableEnableAlias && tableIsError(),
|
|
1430
|
+
message: (0, _locale.__)(isDel ? 'metabase.verify' : 'SqlQueryBuilder.repeatAlias'),
|
|
1431
|
+
children: (0, _jsxRuntime.jsx)(_rightClickValue["default"], {
|
|
1432
|
+
value: meta.table2,
|
|
1433
|
+
children: (0, _jsxRuntime.jsxs)("div", {
|
|
1434
|
+
className: (0, _classnames["default"])("Sqb-TableName", {
|
|
1435
|
+
notSelected: !table2Selected
|
|
1436
|
+
}),
|
|
1437
|
+
onClick: selectTable,
|
|
1438
|
+
children: [table2Selected && (0, _jsxRuntime.jsx)(_jsxRuntime.Fragment, {
|
|
1439
|
+
children: function () {
|
|
1440
|
+
var showButton = !store.snapshotMode && store.tableEnableAlias;
|
|
1441
|
+
return !store.snapshotMode ? (0, _jsxRuntime.jsx)(_jsxRuntime.Fragment, {
|
|
1442
|
+
children: showButton && (0, _jsxRuntime.jsx)(_pandora.Tooltip, {
|
|
1443
|
+
title: (0, _locale.__)(tableIsError() ? isDel ? store.tableEnableAlias ? 'metabase.verifyAliasAction' : 'metabase.verify' : store.tableEnableAlias ? 'SqlQueryBuilder.repeatAliasAction' : 'SqlQueryBuilder.repeatAlias' : 'SqlQueryBuilder.alias'),
|
|
1444
|
+
children: (0, _jsxRuntime.jsx)(_pandora.Button, {
|
|
1445
|
+
danger: tableIsError(),
|
|
1446
|
+
className: (0, _classnames["default"])(':Sqb-TableName-as', {
|
|
1447
|
+
isError: tableIsError()
|
|
1448
|
+
}),
|
|
1449
|
+
shape: 'circle',
|
|
1450
|
+
iconOnly: true,
|
|
1451
|
+
primary: true,
|
|
1452
|
+
icon: 'As',
|
|
1453
|
+
size: 'small',
|
|
1454
|
+
onClick: function onClick(e) {
|
|
1455
|
+
var _meta$table6;
|
|
1456
|
+
e.stopPropagation();
|
|
1457
|
+
onChangeTableAlias(((_meta$table6 = meta.table2) === null || _meta$table6 === void 0 ? void 0 : _meta$table6.alias) || '');
|
|
1458
|
+
}
|
|
1459
|
+
})
|
|
1460
|
+
})
|
|
1461
|
+
}) : null;
|
|
1462
|
+
}()
|
|
1463
|
+
}), table2Selected ? "".concat(meta.table2.datasourceName, ".").concat(meta.table2.name, " ").concat((_meta$table7 = meta.table2) !== null && _meta$table7 !== void 0 && _meta$table7.alias && store.tableEnableAlias ? "as ".concat((_meta$table8 = meta.table2) === null || _meta$table8 === void 0 ? void 0 : _meta$table8.alias) : '') : (0, _locale.__)('SqlQueryBuilder.pickTable')]
|
|
1464
|
+
})
|
|
1471
1465
|
})
|
|
1472
1466
|
}), store.showSubquery && (!store.snapshotMode || meta.isSubquery) && (0, _jsxRuntime.jsx)(_pandora.Tooltip, {
|
|
1473
1467
|
title: (0, _locale.__)('SqlQueryBuilder.switchSubQuery'),
|
|
@@ -6,7 +6,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
});
|
|
7
7
|
exports["default"] = void 0;
|
|
8
8
|
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
9
|
-
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/defineProperty"));
|
|
10
9
|
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/toConsumableArray"));
|
|
11
10
|
var _createForOfIteratorHelper2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/createForOfIteratorHelper"));
|
|
12
11
|
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/asyncToGenerator"));
|
|
@@ -520,8 +519,10 @@ var GroupBy = function GroupBy(props) {
|
|
|
520
519
|
};
|
|
521
520
|
return (0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
522
521
|
children: [meta.by.map(function (v, i) {
|
|
522
|
+
var existsError = (0, _utils.isExistsError)([getErrorCheckField(v)], store.existsError);
|
|
523
|
+
var aliasError = !(0, _utils.isValidSQLAlias)(v === null || v === void 0 ? void 0 : v.fieldAlias);
|
|
523
524
|
return (0, _jsxRuntime.jsx)(_itemName["default"], {
|
|
524
|
-
isError:
|
|
525
|
+
isError: existsError && !store.groupByEnableAlias,
|
|
525
526
|
children: (0, _jsxRuntime.jsx)(_rightClickValue["default"], {
|
|
526
527
|
value: v,
|
|
527
528
|
children: (0, _jsxRuntime.jsxs)("div", {
|
|
@@ -531,19 +532,24 @@ var GroupBy = function GroupBy(props) {
|
|
|
531
532
|
return handleUpdate(e, i);
|
|
532
533
|
},
|
|
533
534
|
children: [v.quotes && (0, _jsxRuntime.jsx)(_jsxRuntime.Fragment, {
|
|
534
|
-
children: store.groupByEnableAlias && !store.snapshotMode && (0, _jsxRuntime.jsx)(
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
535
|
+
children: store.groupByEnableAlias && !store.snapshotMode && (0, _jsxRuntime.jsx)(_jsxRuntime.Fragment, {
|
|
536
|
+
children: (0, _jsxRuntime.jsx)(_pandora.Tooltip, {
|
|
537
|
+
title: (0, _locale.__)(existsError ? 'SqlQueryBuilder.existsErrorAliasAction' : aliasError ? 'SqlQueryBuilder.aliasForRulesAction' : 'SqlQueryBuilder.alias'),
|
|
538
|
+
children: (0, _jsxRuntime.jsx)(_pandora.Button, {
|
|
539
|
+
danger: existsError || aliasError,
|
|
540
|
+
className: (0, _classnames["default"])(':Sqb-TableName-as :Sqb-TableName green-name', {
|
|
541
|
+
isError: existsError || aliasError
|
|
542
|
+
}),
|
|
543
|
+
shape: 'circle',
|
|
544
|
+
iconOnly: true,
|
|
545
|
+
primary: true,
|
|
546
|
+
icon: 'As',
|
|
547
|
+
size: 'small',
|
|
548
|
+
onClick: function onClick(e) {
|
|
549
|
+
e.stopPropagation();
|
|
550
|
+
onChangeFieldAlias((v === null || v === void 0 ? void 0 : v.fieldAlias) || '', i);
|
|
551
|
+
}
|
|
552
|
+
})
|
|
547
553
|
})
|
|
548
554
|
})
|
|
549
555
|
}), "".concat(v.quotes, " ").concat(v.fieldAlias ? "as ".concat(v.fieldAlias) : ''), !store.snapshotMode && (0, _jsxRuntime.jsx)("span", {
|
|
@@ -6,7 +6,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
});
|
|
7
7
|
exports["default"] = void 0;
|
|
8
8
|
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
9
|
-
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/defineProperty"));
|
|
10
9
|
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/toConsumableArray"));
|
|
11
10
|
var _createForOfIteratorHelper2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/createForOfIteratorHelper"));
|
|
12
11
|
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/asyncToGenerator"));
|
|
@@ -418,8 +417,10 @@ var SelectIndex = function SelectIndex(props) {
|
|
|
418
417
|
};
|
|
419
418
|
return (0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
420
419
|
children: [meta.group.map(function (v, i) {
|
|
420
|
+
var existsError = (0, _utils.isExistsError)([getErrorCheckField(v)], store.existsError);
|
|
421
|
+
var aliasError = !(0, _utils.isValidSQLAlias)(v === null || v === void 0 ? void 0 : v.fieldAlias);
|
|
421
422
|
return (0, _jsxRuntime.jsx)(_itemName["default"], {
|
|
422
|
-
isError:
|
|
423
|
+
isError: existsError && !store.groupByEnableAlias,
|
|
423
424
|
children: (0, _jsxRuntime.jsx)(_rightClickValue["default"], {
|
|
424
425
|
value: v,
|
|
425
426
|
children: (0, _jsxRuntime.jsxs)("div", {
|
|
@@ -429,19 +430,24 @@ var SelectIndex = function SelectIndex(props) {
|
|
|
429
430
|
return handleUpdate(e, i);
|
|
430
431
|
},
|
|
431
432
|
children: [v.quotes && (0, _jsxRuntime.jsx)(_jsxRuntime.Fragment, {
|
|
432
|
-
children: store.groupByEnableAlias && !store.snapshotMode && (0, _jsxRuntime.jsx)(
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
433
|
+
children: store.groupByEnableAlias && !store.snapshotMode && (0, _jsxRuntime.jsx)(_jsxRuntime.Fragment, {
|
|
434
|
+
children: (0, _jsxRuntime.jsx)(_pandora.Tooltip, {
|
|
435
|
+
title: (0, _locale.__)(existsError ? 'SqlQueryBuilder.existsErrorAliasAction' : aliasError ? 'SqlQueryBuilder.aliasForRulesAction' : 'SqlQueryBuilder.alias'),
|
|
436
|
+
children: (0, _jsxRuntime.jsx)(_pandora.Button, {
|
|
437
|
+
danger: existsError || aliasError,
|
|
438
|
+
className: (0, _classnames["default"])(':Sqb-TableName-as :Sqb-TableName green-name', {
|
|
439
|
+
isError: existsError || aliasError
|
|
440
|
+
}),
|
|
441
|
+
shape: 'circle',
|
|
442
|
+
iconOnly: true,
|
|
443
|
+
primary: true,
|
|
444
|
+
icon: 'As',
|
|
445
|
+
size: 'small',
|
|
446
|
+
onClick: function onClick(e) {
|
|
447
|
+
e.stopPropagation();
|
|
448
|
+
onChangeFieldAlias((v === null || v === void 0 ? void 0 : v.fieldAlias) || '', i);
|
|
449
|
+
}
|
|
450
|
+
})
|
|
445
451
|
})
|
|
446
452
|
})
|
|
447
453
|
}), "".concat(v.quotes, " ").concat(v.fieldAlias ? "as ".concat(v.fieldAlias) : ''), !store.snapshotMode && (0, _jsxRuntime.jsx)("span", {
|
|
@@ -299,7 +299,8 @@ var TableData = function TableData(props) {
|
|
|
299
299
|
children: (0, _jsxRuntime.jsxs)("div", {
|
|
300
300
|
className: "Sqb-NotebookCell",
|
|
301
301
|
children: [meta.isSubquery ? (0, _jsxRuntime.jsx)(_itemName["default"], {
|
|
302
|
-
isError: (0, _utils.isExistsError)(meta.subquery || [], store.existsError),
|
|
302
|
+
isError: (0, _utils.isExistsError)(meta.subquery || [], store.existsError) || !store.tableEnableAlias && tableIsError(),
|
|
303
|
+
message: !store.tableEnableAlias && tableIsError() ? (0, _locale.__)(isDel ? 'metabase.verify' : 'SqlQueryBuilder.repeatAlias') : undefined,
|
|
303
304
|
children: (0, _jsxRuntime.jsx)(_rightClickValue["default"], {
|
|
304
305
|
value: meta,
|
|
305
306
|
children: (0, _jsxRuntime.jsxs)("div", {
|
|
@@ -312,79 +313,69 @@ var TableData = function TableData(props) {
|
|
|
312
313
|
},
|
|
313
314
|
children: [subQuerySelected && (0, _jsxRuntime.jsx)(_jsxRuntime.Fragment, {
|
|
314
315
|
children: function () {
|
|
315
|
-
var showButton = !store.snapshotMode &&
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
} : {},
|
|
331
|
-
iconOnly: true,
|
|
332
|
-
primary: !isDel,
|
|
333
|
-
icon: icon,
|
|
334
|
-
size: 'small',
|
|
335
|
-
onClick: function onClick(e) {
|
|
336
|
-
if (store.tableEnableAlias) {
|
|
316
|
+
var showButton = !store.snapshotMode && store.tableEnableAlias;
|
|
317
|
+
return !store.snapshotMode ? (0, _jsxRuntime.jsx)(_jsxRuntime.Fragment, {
|
|
318
|
+
children: showButton && (0, _jsxRuntime.jsx)(_pandora.Tooltip, {
|
|
319
|
+
title: (0, _locale.__)(tableIsError() ? isDel ? store.tableEnableAlias ? 'metabase.verifyAliasAction' : 'metabase.verify' : store.tableEnableAlias ? 'SqlQueryBuilder.repeatAliasAction' : 'SqlQueryBuilder.repeatAlias' : 'SqlQueryBuilder.alias'),
|
|
320
|
+
children: (0, _jsxRuntime.jsx)(_pandora.Button, {
|
|
321
|
+
danger: tableIsError(),
|
|
322
|
+
className: (0, _classnames["default"])(':Sqb-TableName-as', {
|
|
323
|
+
isError: tableIsError()
|
|
324
|
+
}),
|
|
325
|
+
shape: 'circle',
|
|
326
|
+
iconOnly: true,
|
|
327
|
+
primary: true,
|
|
328
|
+
icon: 'As',
|
|
329
|
+
size: 'small',
|
|
330
|
+
onClick: function onClick(e) {
|
|
337
331
|
var _meta$table3;
|
|
338
332
|
e.stopPropagation();
|
|
339
333
|
onChangeTableAlias(((_meta$table3 = meta.table) === null || _meta$table3 === void 0 ? void 0 : _meta$table3.alias) || '');
|
|
340
334
|
}
|
|
341
|
-
}
|
|
335
|
+
})
|
|
342
336
|
})
|
|
343
337
|
}) : null;
|
|
344
338
|
}()
|
|
345
339
|
}), 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$table4 = meta.table) !== null && _meta$table4 !== void 0 && _meta$table4.alias && store.tableEnableAlias ? "as ".concat((_meta$table5 = meta.table) === null || _meta$table5 === void 0 ? void 0 : _meta$table5.alias) : '', " ") : (0, _locale.__)('SqlQueryBuilder.setSubQuery')]
|
|
346
340
|
})
|
|
347
341
|
})
|
|
348
|
-
}) : (0, _jsxRuntime.jsx)(
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
}) : null;
|
|
386
|
-
}()
|
|
387
|
-
}), selected ? "".concat(meta.table.datasourceName, ".").concat(meta.table.name, " ").concat((_meta$table7 = meta.table) !== null && _meta$table7 !== void 0 && _meta$table7.alias && store.tableEnableAlias ? "as ".concat((_meta$table8 = meta.table) === null || _meta$table8 === void 0 ? void 0 : _meta$table8.alias) : '') : (0, _locale.__)('SqlQueryBuilder.pickTable')]
|
|
342
|
+
}) : (0, _jsxRuntime.jsx)(_itemName["default"], {
|
|
343
|
+
isError: !store.tableEnableAlias && tableIsError(),
|
|
344
|
+
message: (0, _locale.__)(isDel ? 'metabase.verify' : 'SqlQueryBuilder.repeatAlias'),
|
|
345
|
+
children: (0, _jsxRuntime.jsx)(_rightClickValue["default"], {
|
|
346
|
+
value: meta.table,
|
|
347
|
+
children: (0, _jsxRuntime.jsxs)("div", {
|
|
348
|
+
className: (0, _classnames["default"])("Sqb-TableName", {
|
|
349
|
+
notSelected: !selected
|
|
350
|
+
}),
|
|
351
|
+
onClick: selectTable,
|
|
352
|
+
children: [selected && (0, _jsxRuntime.jsx)(_jsxRuntime.Fragment, {
|
|
353
|
+
children: function () {
|
|
354
|
+
var showButton = !store.snapshotMode && store.tableEnableAlias;
|
|
355
|
+
return !store.snapshotMode ? (0, _jsxRuntime.jsx)(_jsxRuntime.Fragment, {
|
|
356
|
+
children: showButton && (0, _jsxRuntime.jsx)(_pandora.Tooltip, {
|
|
357
|
+
title: (0, _locale.__)(tableIsError() ? isDel ? store.tableEnableAlias ? 'metabase.verifyAliasAction' : 'metabase.verify' : store.tableEnableAlias ? 'SqlQueryBuilder.repeatAliasAction' : 'SqlQueryBuilder.repeatAlias' : 'SqlQueryBuilder.alias'),
|
|
358
|
+
children: (0, _jsxRuntime.jsx)(_pandora.Button, {
|
|
359
|
+
danger: tableIsError(),
|
|
360
|
+
className: (0, _classnames["default"])(':Sqb-TableName-as', {
|
|
361
|
+
isError: tableIsError()
|
|
362
|
+
}),
|
|
363
|
+
shape: 'circle',
|
|
364
|
+
iconOnly: true,
|
|
365
|
+
primary: true,
|
|
366
|
+
icon: 'As',
|
|
367
|
+
size: 'small',
|
|
368
|
+
onClick: function onClick(e) {
|
|
369
|
+
var _meta$table6;
|
|
370
|
+
e.stopPropagation();
|
|
371
|
+
onChangeTableAlias(((_meta$table6 = meta.table) === null || _meta$table6 === void 0 ? void 0 : _meta$table6.alias) || '');
|
|
372
|
+
}
|
|
373
|
+
})
|
|
374
|
+
})
|
|
375
|
+
}) : null;
|
|
376
|
+
}()
|
|
377
|
+
}), selected ? "".concat(meta.table.datasourceName, ".").concat(meta.table.name, " ").concat((_meta$table7 = meta.table) !== null && _meta$table7 !== void 0 && _meta$table7.alias && store.tableEnableAlias ? "as ".concat((_meta$table8 = meta.table) === null || _meta$table8 === void 0 ? void 0 : _meta$table8.alias) : '') : (0, _locale.__)('SqlQueryBuilder.pickTable')]
|
|
378
|
+
})
|
|
388
379
|
})
|
|
389
380
|
}), store.showSubquery && (!store.snapshotMode || meta.isSubquery) && (0, _jsxRuntime.jsx)(_pandora.Tooltip, {
|
|
390
381
|
title: (0, _locale.__)('SqlQueryBuilder.switchSubQuery'),
|
package/lib/cjs/locale/en.js
CHANGED
|
@@ -56,9 +56,12 @@ var _default = exports["default"] = (0, _index.register)('en', {
|
|
|
56
56
|
'SqlQueryBuilder.selectColumnAll': 'select all',
|
|
57
57
|
'SqlQueryBuilder.alias': 'alias',
|
|
58
58
|
'SqlQueryBuilder.aliasForRules': 'The alias only supports a combination of letters, numbers, and underscores. It must start with a letter and cannot exceed 30 bytes',
|
|
59
|
+
'SqlQueryBuilder.aliasForRulesAction': 'Invalid alias: use only letters, numbers, and underscores; start with a letter and keep it within 30 bytes. Click to modify the alias',
|
|
59
60
|
'SqlQueryBuilder.nameForRules': 'The name only supports a combination of letters, numbers, and underscores. It must start with a letter and cannot exceed 30 bytes',
|
|
60
61
|
'SqlQueryBuilder.pleaseSelectTable': 'The currently dependent table is empty or has been deleted',
|
|
61
62
|
'SqlQueryBuilder.repeatAlias': 'If there are duplicate names, please modify them',
|
|
63
|
+
'SqlQueryBuilder.repeatAliasAction': 'Duplicate alias. Click to modify the alias',
|
|
64
|
+
'SqlQueryBuilder.existsErrorAliasAction': 'Field validation error. Click to modify the alias',
|
|
62
65
|
'customColumn.operator': 'operator',
|
|
63
66
|
'customColumn.collection': 'collection',
|
|
64
67
|
'customColumn.field': 'field',
|
|
@@ -172,6 +175,7 @@ var _default = exports["default"] = (0, _index.register)('en', {
|
|
|
172
175
|
'metabase.nextBtn': 'next step',
|
|
173
176
|
'metabase.nextOk': 'ok',
|
|
174
177
|
'metabase.verify': 'The table has been modified. Please select again',
|
|
178
|
+
'metabase.verifyAliasAction': 'The table has been modified. Please select it again; click As to modify the alias',
|
|
175
179
|
'metabase.validationFailed': 'Validation failed. Do you still want to save?',
|
|
176
180
|
'metabase.validationFilter': 'The filter configuration is incorrect. Saving is prohibited!',
|
|
177
181
|
'metabase.validationFormula': 'The formula configuration is incorrect. Saving is prohibited!',
|
package/lib/cjs/locale/zh.js
CHANGED
|
@@ -52,9 +52,12 @@ var _default = exports["default"] = (0, _index.register)('zh', {
|
|
|
52
52
|
'SqlQueryBuilder.selectColumnAll': '全选',
|
|
53
53
|
'SqlQueryBuilder.alias': '别名',
|
|
54
54
|
'SqlQueryBuilder.aliasForRules': '别名只支持字母 + 数字 + 下划线组合,必须是字母开头,且不能超过30个字节',
|
|
55
|
+
'SqlQueryBuilder.aliasForRulesAction': '别名格式错误:只支持字母、数字和下划线,必须以字母开头且不超过30个字节。点击修改别名',
|
|
55
56
|
'SqlQueryBuilder.nameForRules': '名字只支持字母 + 数字 + 下划线组合,必须是字母开头,且不能超过30个字节',
|
|
56
57
|
'SqlQueryBuilder.pleaseSelectTable': '当前依赖的表为空或被删除',
|
|
57
58
|
'SqlQueryBuilder.repeatAlias': '有重名请修改',
|
|
59
|
+
'SqlQueryBuilder.repeatAliasAction': '别名重复,点击修改别名',
|
|
60
|
+
'SqlQueryBuilder.existsErrorAliasAction': '字段校验错误,点击修改别名',
|
|
58
61
|
'customColumn.operator': '操作符',
|
|
59
62
|
'customColumn.collection': '自定义组合',
|
|
60
63
|
'customColumn.field': '字段',
|
|
@@ -172,6 +175,7 @@ var _default = exports["default"] = (0, _index.register)('zh', {
|
|
|
172
175
|
'metabase.nextBtn': '下一步',
|
|
173
176
|
'metabase.nextOk': '确定',
|
|
174
177
|
'metabase.verify': '表已修改,请重新选择',
|
|
178
|
+
'metabase.verifyAliasAction': '表已修改,请重新选择;点击 As 可修改别名',
|
|
175
179
|
'metabase.validationFailed': '校验未通过,是否依然保存?',
|
|
176
180
|
'metabase.validationFilter': '过滤器配置有误,禁止保存!',
|
|
177
181
|
'metabase.validationFormula': '公式配置有误,禁止保存!',
|
|
@@ -326,9 +326,9 @@
|
|
|
326
326
|
padding: 0;
|
|
327
327
|
border: none;
|
|
328
328
|
border-radius: 999px;
|
|
329
|
-
width:
|
|
330
|
-
height:
|
|
331
|
-
min-height:
|
|
329
|
+
width: 18px;
|
|
330
|
+
height: 18px;
|
|
331
|
+
min-height: 18px;
|
|
332
332
|
font-size: 10px;
|
|
333
333
|
display: inline-flex;
|
|
334
334
|
align-items: center;
|
|
@@ -30,7 +30,6 @@ import ItemWrapper from './components/item-wrapper';
|
|
|
30
30
|
import SelectList from '../dialog/select-list';
|
|
31
31
|
import { LeftJoinIcon, InnerJoinIcon } from '../icons';
|
|
32
32
|
import { SelectTable, SelectJoin, SelectColumnMultiple, SelectColumn, Expression, SelectPermissionTable, FormulaList, getTemplateItem } from '../dialog';
|
|
33
|
-
import { ExclamationCircleFill } from '@gingkoo/pandora-icons';
|
|
34
33
|
import { useStore } from '../../hooks/use-provider';
|
|
35
34
|
var PrevResult = 'Previous results';
|
|
36
35
|
var normalizeJoinOperator = function normalizeJoinOperator(val) {
|
|
@@ -1379,90 +1378,84 @@ var JoinData = function JoinData(props) {
|
|
|
1379
1378
|
cursor: 'pointer'
|
|
1380
1379
|
}
|
|
1381
1380
|
})
|
|
1382
|
-
}), meta.isSubquery ? _jsx(
|
|
1383
|
-
|
|
1384
|
-
|
|
1385
|
-
|
|
1386
|
-
|
|
1387
|
-
|
|
1388
|
-
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
|
|
1420
|
-
|
|
1421
|
-
|
|
1422
|
-
}) : null;
|
|
1423
|
-
}()
|
|
1424
|
-
}), 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$table4 = meta.table2) !== null && _meta$table4 !== void 0 && _meta$table4.alias && store.tableEnableAlias ? "as ".concat((_meta$table5 = meta.table2) === null || _meta$table5 === void 0 ? void 0 : _meta$table5.alias) : '', " ") : __('SqlQueryBuilder.setSubQuery')]
|
|
1381
|
+
}), meta.isSubquery ? _jsx(ItemName, {
|
|
1382
|
+
isError: !store.tableEnableAlias && tableIsError(),
|
|
1383
|
+
message: __(isDel ? 'metabase.verify' : 'SqlQueryBuilder.repeatAlias'),
|
|
1384
|
+
children: _jsx(RightClickValue, {
|
|
1385
|
+
value: meta,
|
|
1386
|
+
children: _jsxs("div", {
|
|
1387
|
+
className: cx("Sqb-TableName", {
|
|
1388
|
+
notSelected: !subQuerySelected
|
|
1389
|
+
}),
|
|
1390
|
+
"data-sqb-snapshot-allow": 'true',
|
|
1391
|
+
onClick: function onClick() {
|
|
1392
|
+
showSubQuery(meta.subquery);
|
|
1393
|
+
},
|
|
1394
|
+
children: [subQuerySelected && _jsx(_Fragment, {
|
|
1395
|
+
children: function () {
|
|
1396
|
+
var showButton = !store.snapshotMode && store.tableEnableAlias;
|
|
1397
|
+
return !store.snapshotMode ? _jsx(_Fragment, {
|
|
1398
|
+
children: showButton && _jsx(Tooltip, {
|
|
1399
|
+
title: __(tableIsError() ? isDel ? store.tableEnableAlias ? 'metabase.verifyAliasAction' : 'metabase.verify' : store.tableEnableAlias ? 'SqlQueryBuilder.repeatAliasAction' : 'SqlQueryBuilder.repeatAlias' : 'SqlQueryBuilder.alias'),
|
|
1400
|
+
children: _jsx(Button, {
|
|
1401
|
+
danger: tableIsError(),
|
|
1402
|
+
className: cx(':Sqb-TableName-as', {
|
|
1403
|
+
isError: tableIsError()
|
|
1404
|
+
}),
|
|
1405
|
+
shape: 'circle',
|
|
1406
|
+
iconOnly: true,
|
|
1407
|
+
primary: true,
|
|
1408
|
+
icon: 'As',
|
|
1409
|
+
size: 'small',
|
|
1410
|
+
onClick: function onClick(e) {
|
|
1411
|
+
var _meta$table3;
|
|
1412
|
+
e.stopPropagation();
|
|
1413
|
+
onChangeTableAlias(((_meta$table3 = meta.table2) === null || _meta$table3 === void 0 ? void 0 : _meta$table3.alias) || '');
|
|
1414
|
+
}
|
|
1415
|
+
})
|
|
1416
|
+
})
|
|
1417
|
+
}) : null;
|
|
1418
|
+
}()
|
|
1419
|
+
}), 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$table4 = meta.table2) !== null && _meta$table4 !== void 0 && _meta$table4.alias && store.tableEnableAlias ? "as ".concat((_meta$table5 = meta.table2) === null || _meta$table5 === void 0 ? void 0 : _meta$table5.alias) : '', " ") : __('SqlQueryBuilder.setSubQuery')]
|
|
1420
|
+
})
|
|
1425
1421
|
})
|
|
1426
|
-
}) : _jsx(
|
|
1427
|
-
|
|
1428
|
-
|
|
1429
|
-
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
|
|
1436
|
-
|
|
1437
|
-
|
|
1438
|
-
|
|
1439
|
-
|
|
1440
|
-
|
|
1441
|
-
|
|
1442
|
-
|
|
1443
|
-
|
|
1444
|
-
|
|
1445
|
-
|
|
1446
|
-
|
|
1447
|
-
|
|
1448
|
-
|
|
1449
|
-
|
|
1450
|
-
|
|
1451
|
-
|
|
1452
|
-
|
|
1453
|
-
|
|
1454
|
-
|
|
1455
|
-
|
|
1456
|
-
|
|
1457
|
-
|
|
1458
|
-
|
|
1459
|
-
|
|
1460
|
-
|
|
1461
|
-
|
|
1462
|
-
|
|
1463
|
-
}) : null;
|
|
1464
|
-
}()
|
|
1465
|
-
}), table2Selected ? "".concat(meta.table2.datasourceName, ".").concat(meta.table2.name, " ").concat((_meta$table7 = meta.table2) !== null && _meta$table7 !== void 0 && _meta$table7.alias && store.tableEnableAlias ? "as ".concat((_meta$table8 = meta.table2) === null || _meta$table8 === void 0 ? void 0 : _meta$table8.alias) : '') : __('SqlQueryBuilder.pickTable')]
|
|
1422
|
+
}) : _jsx(ItemName, {
|
|
1423
|
+
isError: !store.tableEnableAlias && tableIsError(),
|
|
1424
|
+
message: __(isDel ? 'metabase.verify' : 'SqlQueryBuilder.repeatAlias'),
|
|
1425
|
+
children: _jsx(RightClickValue, {
|
|
1426
|
+
value: meta.table2,
|
|
1427
|
+
children: _jsxs("div", {
|
|
1428
|
+
className: cx("Sqb-TableName", {
|
|
1429
|
+
notSelected: !table2Selected
|
|
1430
|
+
}),
|
|
1431
|
+
onClick: selectTable,
|
|
1432
|
+
children: [table2Selected && _jsx(_Fragment, {
|
|
1433
|
+
children: function () {
|
|
1434
|
+
var showButton = !store.snapshotMode && store.tableEnableAlias;
|
|
1435
|
+
return !store.snapshotMode ? _jsx(_Fragment, {
|
|
1436
|
+
children: showButton && _jsx(Tooltip, {
|
|
1437
|
+
title: __(tableIsError() ? isDel ? store.tableEnableAlias ? 'metabase.verifyAliasAction' : 'metabase.verify' : store.tableEnableAlias ? 'SqlQueryBuilder.repeatAliasAction' : 'SqlQueryBuilder.repeatAlias' : 'SqlQueryBuilder.alias'),
|
|
1438
|
+
children: _jsx(Button, {
|
|
1439
|
+
danger: tableIsError(),
|
|
1440
|
+
className: cx(':Sqb-TableName-as', {
|
|
1441
|
+
isError: tableIsError()
|
|
1442
|
+
}),
|
|
1443
|
+
shape: 'circle',
|
|
1444
|
+
iconOnly: true,
|
|
1445
|
+
primary: true,
|
|
1446
|
+
icon: 'As',
|
|
1447
|
+
size: 'small',
|
|
1448
|
+
onClick: function onClick(e) {
|
|
1449
|
+
var _meta$table6;
|
|
1450
|
+
e.stopPropagation();
|
|
1451
|
+
onChangeTableAlias(((_meta$table6 = meta.table2) === null || _meta$table6 === void 0 ? void 0 : _meta$table6.alias) || '');
|
|
1452
|
+
}
|
|
1453
|
+
})
|
|
1454
|
+
})
|
|
1455
|
+
}) : null;
|
|
1456
|
+
}()
|
|
1457
|
+
}), table2Selected ? "".concat(meta.table2.datasourceName, ".").concat(meta.table2.name, " ").concat((_meta$table7 = meta.table2) !== null && _meta$table7 !== void 0 && _meta$table7.alias && store.tableEnableAlias ? "as ".concat((_meta$table8 = meta.table2) === null || _meta$table8 === void 0 ? void 0 : _meta$table8.alias) : '') : __('SqlQueryBuilder.pickTable')]
|
|
1458
|
+
})
|
|
1466
1459
|
})
|
|
1467
1460
|
}), store.showSubquery && (!store.snapshotMode || meta.isSubquery) && _jsx(Tooltip, {
|
|
1468
1461
|
title: __('SqlQueryBuilder.switchSubQuery'),
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
2
1
|
import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
|
|
3
2
|
import _createForOfIteratorHelper from "@babel/runtime/helpers/esm/createForOfIteratorHelper";
|
|
4
3
|
import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
|
|
@@ -514,8 +513,10 @@ var GroupBy = function GroupBy(props) {
|
|
|
514
513
|
};
|
|
515
514
|
return _jsxs(_Fragment, {
|
|
516
515
|
children: [meta.by.map(function (v, i) {
|
|
516
|
+
var existsError = isExistsError([getErrorCheckField(v)], store.existsError);
|
|
517
|
+
var aliasError = !isValidSQLAlias(v === null || v === void 0 ? void 0 : v.fieldAlias);
|
|
517
518
|
return _jsx(ItemName, {
|
|
518
|
-
isError:
|
|
519
|
+
isError: existsError && !store.groupByEnableAlias,
|
|
519
520
|
children: _jsx(RightClickValue, {
|
|
520
521
|
value: v,
|
|
521
522
|
children: _jsxs("div", {
|
|
@@ -525,19 +526,24 @@ var GroupBy = function GroupBy(props) {
|
|
|
525
526
|
return handleUpdate(e, i);
|
|
526
527
|
},
|
|
527
528
|
children: [v.quotes && _jsx(_Fragment, {
|
|
528
|
-
children: store.groupByEnableAlias && !store.snapshotMode && _jsx(
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
529
|
+
children: store.groupByEnableAlias && !store.snapshotMode && _jsx(_Fragment, {
|
|
530
|
+
children: _jsx(Tooltip, {
|
|
531
|
+
title: __(existsError ? 'SqlQueryBuilder.existsErrorAliasAction' : aliasError ? 'SqlQueryBuilder.aliasForRulesAction' : 'SqlQueryBuilder.alias'),
|
|
532
|
+
children: _jsx(Button, {
|
|
533
|
+
danger: existsError || aliasError,
|
|
534
|
+
className: cx(':Sqb-TableName-as :Sqb-TableName green-name', {
|
|
535
|
+
isError: existsError || aliasError
|
|
536
|
+
}),
|
|
537
|
+
shape: 'circle',
|
|
538
|
+
iconOnly: true,
|
|
539
|
+
primary: true,
|
|
540
|
+
icon: 'As',
|
|
541
|
+
size: 'small',
|
|
542
|
+
onClick: function onClick(e) {
|
|
543
|
+
e.stopPropagation();
|
|
544
|
+
onChangeFieldAlias((v === null || v === void 0 ? void 0 : v.fieldAlias) || '', i);
|
|
545
|
+
}
|
|
546
|
+
})
|
|
541
547
|
})
|
|
542
548
|
})
|
|
543
549
|
}), "".concat(v.quotes, " ").concat(v.fieldAlias ? "as ".concat(v.fieldAlias) : ''), !store.snapshotMode && _jsx("span", {
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
2
1
|
import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
|
|
3
2
|
import _createForOfIteratorHelper from "@babel/runtime/helpers/esm/createForOfIteratorHelper";
|
|
4
3
|
import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
|
|
@@ -412,8 +411,10 @@ var SelectIndex = function SelectIndex(props) {
|
|
|
412
411
|
};
|
|
413
412
|
return _jsxs(_Fragment, {
|
|
414
413
|
children: [meta.group.map(function (v, i) {
|
|
414
|
+
var existsError = isExistsError([getErrorCheckField(v)], store.existsError);
|
|
415
|
+
var aliasError = !isValidSQLAlias(v === null || v === void 0 ? void 0 : v.fieldAlias);
|
|
415
416
|
return _jsx(ItemName, {
|
|
416
|
-
isError:
|
|
417
|
+
isError: existsError && !store.groupByEnableAlias,
|
|
417
418
|
children: _jsx(RightClickValue, {
|
|
418
419
|
value: v,
|
|
419
420
|
children: _jsxs("div", {
|
|
@@ -423,19 +424,24 @@ var SelectIndex = function SelectIndex(props) {
|
|
|
423
424
|
return handleUpdate(e, i);
|
|
424
425
|
},
|
|
425
426
|
children: [v.quotes && _jsx(_Fragment, {
|
|
426
|
-
children: store.groupByEnableAlias && !store.snapshotMode && _jsx(
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
427
|
+
children: store.groupByEnableAlias && !store.snapshotMode && _jsx(_Fragment, {
|
|
428
|
+
children: _jsx(Tooltip, {
|
|
429
|
+
title: __(existsError ? 'SqlQueryBuilder.existsErrorAliasAction' : aliasError ? 'SqlQueryBuilder.aliasForRulesAction' : 'SqlQueryBuilder.alias'),
|
|
430
|
+
children: _jsx(Button, {
|
|
431
|
+
danger: existsError || aliasError,
|
|
432
|
+
className: cx(':Sqb-TableName-as :Sqb-TableName green-name', {
|
|
433
|
+
isError: existsError || aliasError
|
|
434
|
+
}),
|
|
435
|
+
shape: 'circle',
|
|
436
|
+
iconOnly: true,
|
|
437
|
+
primary: true,
|
|
438
|
+
icon: 'As',
|
|
439
|
+
size: 'small',
|
|
440
|
+
onClick: function onClick(e) {
|
|
441
|
+
e.stopPropagation();
|
|
442
|
+
onChangeFieldAlias((v === null || v === void 0 ? void 0 : v.fieldAlias) || '', i);
|
|
443
|
+
}
|
|
444
|
+
})
|
|
439
445
|
})
|
|
440
446
|
})
|
|
441
447
|
}), "".concat(v.quotes, " ").concat(v.fieldAlias ? "as ".concat(v.fieldAlias) : ''), !store.snapshotMode && _jsx("span", {
|
|
@@ -24,7 +24,6 @@ import Wrapper from './components/Wrapper';
|
|
|
24
24
|
import NextDom from './components/meta-icon';
|
|
25
25
|
import Header from './components/header';
|
|
26
26
|
import ItemWrapper from './components/item-wrapper';
|
|
27
|
-
import { ExclamationCircleFill } from '@gingkoo/pandora-icons';
|
|
28
27
|
import { useStore } from '../../hooks/use-provider';
|
|
29
28
|
var TableData = function TableData(props) {
|
|
30
29
|
var _meta$subquery, _meta$subquery2, _meta$subquery3, _meta$table4, _meta$table5, _meta$table7, _meta$table8, _store$showMainColumn;
|
|
@@ -293,7 +292,8 @@ var TableData = function TableData(props) {
|
|
|
293
292
|
children: _jsxs("div", {
|
|
294
293
|
className: "Sqb-NotebookCell",
|
|
295
294
|
children: [meta.isSubquery ? _jsx(ItemName, {
|
|
296
|
-
isError: isExistsError(meta.subquery || [], store.existsError),
|
|
295
|
+
isError: isExistsError(meta.subquery || [], store.existsError) || !store.tableEnableAlias && tableIsError(),
|
|
296
|
+
message: !store.tableEnableAlias && tableIsError() ? __(isDel ? 'metabase.verify' : 'SqlQueryBuilder.repeatAlias') : undefined,
|
|
297
297
|
children: _jsx(RightClickValue, {
|
|
298
298
|
value: meta,
|
|
299
299
|
children: _jsxs("div", {
|
|
@@ -306,79 +306,69 @@ var TableData = function TableData(props) {
|
|
|
306
306
|
},
|
|
307
307
|
children: [subQuerySelected && _jsx(_Fragment, {
|
|
308
308
|
children: function () {
|
|
309
|
-
var showButton = !store.snapshotMode &&
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
} : {},
|
|
325
|
-
iconOnly: true,
|
|
326
|
-
primary: !isDel,
|
|
327
|
-
icon: icon,
|
|
328
|
-
size: 'small',
|
|
329
|
-
onClick: function onClick(e) {
|
|
330
|
-
if (store.tableEnableAlias) {
|
|
309
|
+
var showButton = !store.snapshotMode && store.tableEnableAlias;
|
|
310
|
+
return !store.snapshotMode ? _jsx(_Fragment, {
|
|
311
|
+
children: showButton && _jsx(Tooltip, {
|
|
312
|
+
title: __(tableIsError() ? isDel ? store.tableEnableAlias ? 'metabase.verifyAliasAction' : 'metabase.verify' : store.tableEnableAlias ? 'SqlQueryBuilder.repeatAliasAction' : 'SqlQueryBuilder.repeatAlias' : 'SqlQueryBuilder.alias'),
|
|
313
|
+
children: _jsx(Button, {
|
|
314
|
+
danger: tableIsError(),
|
|
315
|
+
className: cx(':Sqb-TableName-as', {
|
|
316
|
+
isError: tableIsError()
|
|
317
|
+
}),
|
|
318
|
+
shape: 'circle',
|
|
319
|
+
iconOnly: true,
|
|
320
|
+
primary: true,
|
|
321
|
+
icon: 'As',
|
|
322
|
+
size: 'small',
|
|
323
|
+
onClick: function onClick(e) {
|
|
331
324
|
var _meta$table3;
|
|
332
325
|
e.stopPropagation();
|
|
333
326
|
onChangeTableAlias(((_meta$table3 = meta.table) === null || _meta$table3 === void 0 ? void 0 : _meta$table3.alias) || '');
|
|
334
327
|
}
|
|
335
|
-
}
|
|
328
|
+
})
|
|
336
329
|
})
|
|
337
330
|
}) : null;
|
|
338
331
|
}()
|
|
339
332
|
}), 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$table4 = meta.table) !== null && _meta$table4 !== void 0 && _meta$table4.alias && store.tableEnableAlias ? "as ".concat((_meta$table5 = meta.table) === null || _meta$table5 === void 0 ? void 0 : _meta$table5.alias) : '', " ") : __('SqlQueryBuilder.setSubQuery')]
|
|
340
333
|
})
|
|
341
334
|
})
|
|
342
|
-
}) : _jsx(
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
}) : null;
|
|
380
|
-
}()
|
|
381
|
-
}), selected ? "".concat(meta.table.datasourceName, ".").concat(meta.table.name, " ").concat((_meta$table7 = meta.table) !== null && _meta$table7 !== void 0 && _meta$table7.alias && store.tableEnableAlias ? "as ".concat((_meta$table8 = meta.table) === null || _meta$table8 === void 0 ? void 0 : _meta$table8.alias) : '') : __('SqlQueryBuilder.pickTable')]
|
|
335
|
+
}) : _jsx(ItemName, {
|
|
336
|
+
isError: !store.tableEnableAlias && tableIsError(),
|
|
337
|
+
message: __(isDel ? 'metabase.verify' : 'SqlQueryBuilder.repeatAlias'),
|
|
338
|
+
children: _jsx(RightClickValue, {
|
|
339
|
+
value: meta.table,
|
|
340
|
+
children: _jsxs("div", {
|
|
341
|
+
className: cx("Sqb-TableName", {
|
|
342
|
+
notSelected: !selected
|
|
343
|
+
}),
|
|
344
|
+
onClick: selectTable,
|
|
345
|
+
children: [selected && _jsx(_Fragment, {
|
|
346
|
+
children: function () {
|
|
347
|
+
var showButton = !store.snapshotMode && store.tableEnableAlias;
|
|
348
|
+
return !store.snapshotMode ? _jsx(_Fragment, {
|
|
349
|
+
children: showButton && _jsx(Tooltip, {
|
|
350
|
+
title: __(tableIsError() ? isDel ? store.tableEnableAlias ? 'metabase.verifyAliasAction' : 'metabase.verify' : store.tableEnableAlias ? 'SqlQueryBuilder.repeatAliasAction' : 'SqlQueryBuilder.repeatAlias' : 'SqlQueryBuilder.alias'),
|
|
351
|
+
children: _jsx(Button, {
|
|
352
|
+
danger: tableIsError(),
|
|
353
|
+
className: cx(':Sqb-TableName-as', {
|
|
354
|
+
isError: tableIsError()
|
|
355
|
+
}),
|
|
356
|
+
shape: 'circle',
|
|
357
|
+
iconOnly: true,
|
|
358
|
+
primary: true,
|
|
359
|
+
icon: 'As',
|
|
360
|
+
size: 'small',
|
|
361
|
+
onClick: function onClick(e) {
|
|
362
|
+
var _meta$table6;
|
|
363
|
+
e.stopPropagation();
|
|
364
|
+
onChangeTableAlias(((_meta$table6 = meta.table) === null || _meta$table6 === void 0 ? void 0 : _meta$table6.alias) || '');
|
|
365
|
+
}
|
|
366
|
+
})
|
|
367
|
+
})
|
|
368
|
+
}) : null;
|
|
369
|
+
}()
|
|
370
|
+
}), selected ? "".concat(meta.table.datasourceName, ".").concat(meta.table.name, " ").concat((_meta$table7 = meta.table) !== null && _meta$table7 !== void 0 && _meta$table7.alias && store.tableEnableAlias ? "as ".concat((_meta$table8 = meta.table) === null || _meta$table8 === void 0 ? void 0 : _meta$table8.alias) : '') : __('SqlQueryBuilder.pickTable')]
|
|
371
|
+
})
|
|
382
372
|
})
|
|
383
373
|
}), store.showSubquery && (!store.snapshotMode || meta.isSubquery) && _jsx(Tooltip, {
|
|
384
374
|
title: __('SqlQueryBuilder.switchSubQuery'),
|
package/lib/es/locale/en.js
CHANGED
|
@@ -50,9 +50,12 @@ export default register('en', {
|
|
|
50
50
|
'SqlQueryBuilder.selectColumnAll': 'select all',
|
|
51
51
|
'SqlQueryBuilder.alias': 'alias',
|
|
52
52
|
'SqlQueryBuilder.aliasForRules': 'The alias only supports a combination of letters, numbers, and underscores. It must start with a letter and cannot exceed 30 bytes',
|
|
53
|
+
'SqlQueryBuilder.aliasForRulesAction': 'Invalid alias: use only letters, numbers, and underscores; start with a letter and keep it within 30 bytes. Click to modify the alias',
|
|
53
54
|
'SqlQueryBuilder.nameForRules': 'The name only supports a combination of letters, numbers, and underscores. It must start with a letter and cannot exceed 30 bytes',
|
|
54
55
|
'SqlQueryBuilder.pleaseSelectTable': 'The currently dependent table is empty or has been deleted',
|
|
55
56
|
'SqlQueryBuilder.repeatAlias': 'If there are duplicate names, please modify them',
|
|
57
|
+
'SqlQueryBuilder.repeatAliasAction': 'Duplicate alias. Click to modify the alias',
|
|
58
|
+
'SqlQueryBuilder.existsErrorAliasAction': 'Field validation error. Click to modify the alias',
|
|
56
59
|
'customColumn.operator': 'operator',
|
|
57
60
|
'customColumn.collection': 'collection',
|
|
58
61
|
'customColumn.field': 'field',
|
|
@@ -166,6 +169,7 @@ export default register('en', {
|
|
|
166
169
|
'metabase.nextBtn': 'next step',
|
|
167
170
|
'metabase.nextOk': 'ok',
|
|
168
171
|
'metabase.verify': 'The table has been modified. Please select again',
|
|
172
|
+
'metabase.verifyAliasAction': 'The table has been modified. Please select it again; click As to modify the alias',
|
|
169
173
|
'metabase.validationFailed': 'Validation failed. Do you still want to save?',
|
|
170
174
|
'metabase.validationFilter': 'The filter configuration is incorrect. Saving is prohibited!',
|
|
171
175
|
'metabase.validationFormula': 'The formula configuration is incorrect. Saving is prohibited!',
|
package/lib/es/locale/zh.js
CHANGED
|
@@ -46,9 +46,12 @@ export default register('zh', {
|
|
|
46
46
|
'SqlQueryBuilder.selectColumnAll': '全选',
|
|
47
47
|
'SqlQueryBuilder.alias': '别名',
|
|
48
48
|
'SqlQueryBuilder.aliasForRules': '别名只支持字母 + 数字 + 下划线组合,必须是字母开头,且不能超过30个字节',
|
|
49
|
+
'SqlQueryBuilder.aliasForRulesAction': '别名格式错误:只支持字母、数字和下划线,必须以字母开头且不超过30个字节。点击修改别名',
|
|
49
50
|
'SqlQueryBuilder.nameForRules': '名字只支持字母 + 数字 + 下划线组合,必须是字母开头,且不能超过30个字节',
|
|
50
51
|
'SqlQueryBuilder.pleaseSelectTable': '当前依赖的表为空或被删除',
|
|
51
52
|
'SqlQueryBuilder.repeatAlias': '有重名请修改',
|
|
53
|
+
'SqlQueryBuilder.repeatAliasAction': '别名重复,点击修改别名',
|
|
54
|
+
'SqlQueryBuilder.existsErrorAliasAction': '字段校验错误,点击修改别名',
|
|
52
55
|
'customColumn.operator': '操作符',
|
|
53
56
|
'customColumn.collection': '自定义组合',
|
|
54
57
|
'customColumn.field': '字段',
|
|
@@ -166,6 +169,7 @@ export default register('zh', {
|
|
|
166
169
|
'metabase.nextBtn': '下一步',
|
|
167
170
|
'metabase.nextOk': '确定',
|
|
168
171
|
'metabase.verify': '表已修改,请重新选择',
|
|
172
|
+
'metabase.verifyAliasAction': '表已修改,请重新选择;点击 As 可修改别名',
|
|
169
173
|
'metabase.validationFailed': '校验未通过,是否依然保存?',
|
|
170
174
|
'metabase.validationFilter': '过滤器配置有误,禁止保存!',
|
|
171
175
|
'metabase.validationFormula': '公式配置有误,禁止保存!',
|