@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.
@@ -326,9 +326,9 @@
326
326
  padding: 0;
327
327
  border: none;
328
328
  border-radius: 999px;
329
- width: 16px;
330
- height: 16px;
331
- min-height: 16px;
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)(_rightClickValue["default"], {
1388
- value: meta,
1389
- children: (0, _jsxRuntime.jsxs)("div", {
1390
- className: (0, _classnames["default"])("Sqb-TableName", {
1391
- notSelected: !subQuerySelected
1392
- }),
1393
- "data-sqb-snapshot-allow": 'true',
1394
- onClick: function onClick() {
1395
- showSubQuery(meta.subquery);
1396
- },
1397
- children: [subQuerySelected && (0, _jsxRuntime.jsx)(_jsxRuntime.Fragment, {
1398
- children: function () {
1399
- var showButton = !store.snapshotMode && (store.tableEnableAlias || tableIsError() && isDel);
1400
- var icon = isDel ? (0, _jsxRuntime.jsx)(_pandoraIcons.ExclamationCircleFill, {}) : store.tableEnableAlias ? 'As' : '';
1401
- return showButton ? (0, _jsxRuntime.jsx)(_pandora.Tooltip, {
1402
- title: (0, _locale.__)(tableIsError() ? isDel ? 'metabase.verify' : 'SqlQueryBuilder.repeatAlias' : 'SqlQueryBuilder.alias'),
1403
- children: (0, _jsxRuntime.jsx)(_pandora.Button, {
1404
- danger: tableIsError(),
1405
- className: (0, _classnames["default"])(':Sqb-TableName-as', {
1406
- isError: tableIsError()
1407
- }),
1408
- shape: 'circle',
1409
- style: isDel ? {
1410
- fontSize: 18,
1411
- backgroundColor: '#fff',
1412
- width: 'auto',
1413
- height: 'auto'
1414
- } : {},
1415
- iconOnly: true,
1416
- primary: !isDel,
1417
- icon: icon,
1418
- size: 'small',
1419
- onClick: function onClick(e) {
1420
- if (store.tableEnableAlias) {
1421
- var _meta$table3;
1422
- e.stopPropagation();
1423
- onChangeTableAlias(((_meta$table3 = meta.table2) === null || _meta$table3 === void 0 ? void 0 : _meta$table3.alias) || '');
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)(_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 || tableIsError() && isDel);
1441
- var icon = isDel ? (0, _jsxRuntime.jsx)(_pandoraIcons.ExclamationCircleFill, {}) : store.tableEnableAlias ? 'As' : '';
1442
- return showButton ? (0, _jsxRuntime.jsx)(_pandora.Tooltip, {
1443
- title: (0, _locale.__)(tableIsError() ? isDel ? 'metabase.verify' : '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
- style: isDel ? {
1451
- fontSize: 18,
1452
- backgroundColor: '#fff',
1453
- width: 'auto',
1454
- height: 'auto'
1455
- } : {},
1456
- iconOnly: true,
1457
- primary: !isDel,
1458
- icon: icon,
1459
- size: 'small',
1460
- onClick: function onClick(e) {
1461
- if (store.tableEnableAlias) {
1462
- var _meta$table6;
1463
- e.stopPropagation();
1464
- onChangeTableAlias(((_meta$table6 = meta.table2) === null || _meta$table6 === void 0 ? void 0 : _meta$table6.alias) || '');
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: (0, _utils.isExistsError)([getErrorCheckField(v)], store.existsError),
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)(_pandora.Tooltip, {
535
- title: !(0, _utils.isValidSQLAlias)(v === null || v === void 0 ? void 0 : v.fieldAlias) ? (0, _locale.__)('SqlQueryBuilder.aliasForRules') : (0, _locale.__)('SqlQueryBuilder.alias'),
536
- children: (0, _jsxRuntime.jsx)(_pandora.Button, {
537
- className: (0, _classnames["default"])(':Sqb-TableName-as :Sqb-TableName green-name', (0, _defineProperty2["default"])({}, 'isError', !(0, _utils.isValidSQLAlias)(v === null || v === void 0 ? void 0 : v.fieldAlias))),
538
- shape: 'circle',
539
- iconOnly: true,
540
- primary: true,
541
- icon: 'As',
542
- size: 'small',
543
- onClick: function onClick(e) {
544
- e.stopPropagation();
545
- onChangeFieldAlias((v === null || v === void 0 ? void 0 : v.fieldAlias) || '', i);
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: (0, _utils.isExistsError)([getErrorCheckField(v)], store.existsError),
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)(_pandora.Tooltip, {
433
- title: !(0, _utils.isValidSQLAlias)(v === null || v === void 0 ? void 0 : v.fieldAlias) ? (0, _locale.__)('SqlQueryBuilder.aliasForRules') : (0, _locale.__)('SqlQueryBuilder.alias'),
434
- children: (0, _jsxRuntime.jsx)(_pandora.Button, {
435
- className: (0, _classnames["default"])(':Sqb-TableName-as :Sqb-TableName green-name', (0, _defineProperty2["default"])({}, 'isError', !(0, _utils.isValidSQLAlias)(v === null || v === void 0 ? void 0 : v.fieldAlias))),
436
- shape: 'circle',
437
- iconOnly: true,
438
- primary: true,
439
- icon: 'As',
440
- size: 'small',
441
- onClick: function onClick(e) {
442
- e.stopPropagation();
443
- onChangeFieldAlias((v === null || v === void 0 ? void 0 : v.fieldAlias) || '', i);
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 && (store.tableEnableAlias || tableIsError() && isDel);
316
- var icon = isDel ? (0, _jsxRuntime.jsx)(_pandoraIcons.ExclamationCircleFill, {}) : store.tableEnableAlias ? 'As' : '';
317
- return showButton ? (0, _jsxRuntime.jsx)(_pandora.Tooltip, {
318
- title: (0, _locale.__)(tableIsError() ? isDel ? 'metabase.verify' : 'SqlQueryBuilder.repeatAlias' : 'SqlQueryBuilder.alias'),
319
- children: (0, _jsxRuntime.jsx)(_pandora.Button, {
320
- danger: tableIsError(),
321
- className: (0, _classnames["default"])(':Sqb-TableName-as', {
322
- isError: tableIsError()
323
- }),
324
- shape: 'circle',
325
- style: isDel ? {
326
- fontSize: 18,
327
- backgroundColor: '#fff',
328
- width: 'auto',
329
- height: 'auto'
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)(_rightClickValue["default"], {
349
- value: meta.table,
350
- children: (0, _jsxRuntime.jsxs)("div", {
351
- className: (0, _classnames["default"])("Sqb-TableName", {
352
- notSelected: !selected
353
- }),
354
- onClick: selectTable,
355
- children: [selected && (0, _jsxRuntime.jsx)(_jsxRuntime.Fragment, {
356
- children: function () {
357
- var showButton = !store.snapshotMode && (store.tableEnableAlias || tableIsError() && isDel);
358
- var icon = isDel ? (0, _jsxRuntime.jsx)(_pandoraIcons.ExclamationCircleFill, {}) : store.tableEnableAlias ? 'As' : '';
359
- return showButton ? (0, _jsxRuntime.jsx)(_pandora.Tooltip, {
360
- title: (0, _locale.__)(tableIsError() ? isDel ? 'metabase.verify' : 'SqlQueryBuilder.repeatAlias' : 'SqlQueryBuilder.alias'),
361
- children: (0, _jsxRuntime.jsx)(_pandora.Button, {
362
- danger: tableIsError(),
363
- className: (0, _classnames["default"])(':Sqb-TableName-as', {
364
- isError: tableIsError()
365
- }),
366
- shape: 'circle',
367
- style: isDel ? {
368
- fontSize: 18,
369
- backgroundColor: '#fff',
370
- width: 'auto',
371
- height: 'auto'
372
- } : {},
373
- iconOnly: true,
374
- primary: !isDel,
375
- icon: icon,
376
- size: 'small',
377
- onClick: function onClick(e) {
378
- if (store.tableEnableAlias) {
379
- var _meta$table6;
380
- e.stopPropagation();
381
- onChangeTableAlias(((_meta$table6 = meta.table) === null || _meta$table6 === void 0 ? void 0 : _meta$table6.alias) || '');
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'),
@@ -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!',
@@ -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: 16px;
330
- height: 16px;
331
- min-height: 16px;
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(RightClickValue, {
1383
- value: meta,
1384
- children: _jsxs("div", {
1385
- className: cx("Sqb-TableName", {
1386
- notSelected: !subQuerySelected
1387
- }),
1388
- "data-sqb-snapshot-allow": 'true',
1389
- onClick: function onClick() {
1390
- showSubQuery(meta.subquery);
1391
- },
1392
- children: [subQuerySelected && _jsx(_Fragment, {
1393
- children: function () {
1394
- var showButton = !store.snapshotMode && (store.tableEnableAlias || tableIsError() && isDel);
1395
- var icon = isDel ? _jsx(ExclamationCircleFill, {}) : store.tableEnableAlias ? 'As' : '';
1396
- return showButton ? _jsx(Tooltip, {
1397
- title: __(tableIsError() ? isDel ? 'metabase.verify' : 'SqlQueryBuilder.repeatAlias' : 'SqlQueryBuilder.alias'),
1398
- children: _jsx(Button, {
1399
- danger: tableIsError(),
1400
- className: cx(':Sqb-TableName-as', {
1401
- isError: tableIsError()
1402
- }),
1403
- shape: 'circle',
1404
- style: isDel ? {
1405
- fontSize: 18,
1406
- backgroundColor: '#fff',
1407
- width: 'auto',
1408
- height: 'auto'
1409
- } : {},
1410
- iconOnly: true,
1411
- primary: !isDel,
1412
- icon: icon,
1413
- size: 'small',
1414
- onClick: function onClick(e) {
1415
- if (store.tableEnableAlias) {
1416
- var _meta$table3;
1417
- e.stopPropagation();
1418
- onChangeTableAlias(((_meta$table3 = meta.table2) === null || _meta$table3 === void 0 ? void 0 : _meta$table3.alias) || '');
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(RightClickValue, {
1427
- value: meta.table2,
1428
- children: _jsxs("div", {
1429
- className: cx("Sqb-TableName", {
1430
- notSelected: !table2Selected
1431
- }),
1432
- onClick: selectTable,
1433
- children: [table2Selected && _jsx(_Fragment, {
1434
- children: function () {
1435
- var showButton = !store.snapshotMode && (store.tableEnableAlias || tableIsError() && isDel);
1436
- var icon = isDel ? _jsx(ExclamationCircleFill, {}) : store.tableEnableAlias ? 'As' : '';
1437
- return showButton ? _jsx(Tooltip, {
1438
- title: __(tableIsError() ? isDel ? 'metabase.verify' : 'SqlQueryBuilder.repeatAlias' : 'SqlQueryBuilder.alias'),
1439
- children: _jsx(Button, {
1440
- danger: tableIsError(),
1441
- className: cx(':Sqb-TableName-as', {
1442
- isError: tableIsError()
1443
- }),
1444
- shape: 'circle',
1445
- style: isDel ? {
1446
- fontSize: 18,
1447
- backgroundColor: '#fff',
1448
- width: 'auto',
1449
- height: 'auto'
1450
- } : {},
1451
- iconOnly: true,
1452
- primary: !isDel,
1453
- icon: icon,
1454
- size: 'small',
1455
- onClick: function onClick(e) {
1456
- if (store.tableEnableAlias) {
1457
- var _meta$table6;
1458
- e.stopPropagation();
1459
- onChangeTableAlias(((_meta$table6 = meta.table2) === null || _meta$table6 === void 0 ? void 0 : _meta$table6.alias) || '');
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: isExistsError([getErrorCheckField(v)], store.existsError),
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(Tooltip, {
529
- title: !isValidSQLAlias(v === null || v === void 0 ? void 0 : v.fieldAlias) ? __('SqlQueryBuilder.aliasForRules') : __('SqlQueryBuilder.alias'),
530
- children: _jsx(Button, {
531
- className: cx(':Sqb-TableName-as :Sqb-TableName green-name', _defineProperty({}, 'isError', !isValidSQLAlias(v === null || v === void 0 ? void 0 : v.fieldAlias))),
532
- shape: 'circle',
533
- iconOnly: true,
534
- primary: true,
535
- icon: 'As',
536
- size: 'small',
537
- onClick: function onClick(e) {
538
- e.stopPropagation();
539
- onChangeFieldAlias((v === null || v === void 0 ? void 0 : v.fieldAlias) || '', i);
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: isExistsError([getErrorCheckField(v)], store.existsError),
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(Tooltip, {
427
- title: !isValidSQLAlias(v === null || v === void 0 ? void 0 : v.fieldAlias) ? __('SqlQueryBuilder.aliasForRules') : __('SqlQueryBuilder.alias'),
428
- children: _jsx(Button, {
429
- className: cx(':Sqb-TableName-as :Sqb-TableName green-name', _defineProperty({}, 'isError', !isValidSQLAlias(v === null || v === void 0 ? void 0 : v.fieldAlias))),
430
- shape: 'circle',
431
- iconOnly: true,
432
- primary: true,
433
- icon: 'As',
434
- size: 'small',
435
- onClick: function onClick(e) {
436
- e.stopPropagation();
437
- onChangeFieldAlias((v === null || v === void 0 ? void 0 : v.fieldAlias) || '', i);
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 && (store.tableEnableAlias || tableIsError() && isDel);
310
- var icon = isDel ? _jsx(ExclamationCircleFill, {}) : store.tableEnableAlias ? 'As' : '';
311
- return showButton ? _jsx(Tooltip, {
312
- title: __(tableIsError() ? isDel ? 'metabase.verify' : '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
- style: isDel ? {
320
- fontSize: 18,
321
- backgroundColor: '#fff',
322
- width: 'auto',
323
- height: 'auto'
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(RightClickValue, {
343
- value: meta.table,
344
- children: _jsxs("div", {
345
- className: cx("Sqb-TableName", {
346
- notSelected: !selected
347
- }),
348
- onClick: selectTable,
349
- children: [selected && _jsx(_Fragment, {
350
- children: function () {
351
- var showButton = !store.snapshotMode && (store.tableEnableAlias || tableIsError() && isDel);
352
- var icon = isDel ? _jsx(ExclamationCircleFill, {}) : store.tableEnableAlias ? 'As' : '';
353
- return showButton ? _jsx(Tooltip, {
354
- title: __(tableIsError() ? isDel ? 'metabase.verify' : 'SqlQueryBuilder.repeatAlias' : 'SqlQueryBuilder.alias'),
355
- children: _jsx(Button, {
356
- danger: tableIsError(),
357
- className: cx(':Sqb-TableName-as', {
358
- isError: tableIsError()
359
- }),
360
- shape: 'circle',
361
- style: isDel ? {
362
- fontSize: 18,
363
- backgroundColor: '#fff',
364
- width: 'auto',
365
- height: 'auto'
366
- } : {},
367
- iconOnly: true,
368
- primary: !isDel,
369
- icon: icon,
370
- size: 'small',
371
- onClick: function onClick(e) {
372
- if (store.tableEnableAlias) {
373
- var _meta$table6;
374
- e.stopPropagation();
375
- onChangeTableAlias(((_meta$table6 = meta.table) === null || _meta$table6 === void 0 ? void 0 : _meta$table6.alias) || '');
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'),
@@ -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!',
@@ -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': '公式配置有误,禁止保存!',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gingkoo/pandora-metabase",
3
- "version": "1.0.155-alpha.1",
3
+ "version": "1.0.156",
4
4
  "description": "",
5
5
  "main": "lib/es/index.js",
6
6
  "module": "lib/es/index.js",