@gingkoo/pandora-metabase 1.0.39 → 1.0.41

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.
@@ -1,10 +1,12 @@
1
- import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
2
1
  import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
3
2
  import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
3
+ import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
4
+ import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
4
5
  import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
5
6
  var _excluded = ["subToolbar", "notExistsColumns", "isExit", "toolbar"];
6
7
  import _regeneratorRuntime from "@babel/runtime/regenerator";
7
8
  import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
9
+ import { useEffect, useState } from 'react';
8
10
  import cx from 'classnames';
9
11
  import { Button, Tooltip, Input, Modal2, Modal, Toast, Dropdown, InputNumber } from '@gingkoo/pandora';
10
12
  import { FfPlus, FfLine, Repeat, RelatedWork } from '@gingkoo/pandora-icons';
@@ -25,6 +27,7 @@ import Header from './components/header';
25
27
  import SelectList from '../dialog/select-list';
26
28
  import { LeftJoinIcon, InnerJoinIcon } from '../icons';
27
29
  import { SelectTable, SelectJoin, SelectColumnMultiple, SelectColumn, Expression, SelectPermissionTable, FormulaList, getTemplateItem } from '../dialog';
30
+ import { ExclamationCircleFill } from '@gingkoo/pandora-icons';
28
31
  import { useStore } from '../../hooks/use-provider';
29
32
  var PrevResult = 'Previous results';
30
33
  var operators = ['AND', 'OR', '(', ')', ',', '+', '-', '*', '/', '!=', '<=', '>=', '<', '>', '='];
@@ -61,7 +64,7 @@ var menuOperator = operators.map(function (v) {
61
64
  };
62
65
  });
63
66
  var JoinData = function JoinData(props) {
64
- var _meta$subquery, _meta$subquery2, _meta$subquery3, _meta$table3, _meta$table4, _meta$table6, _meta$table7, _meta$table8, _meta$table9, _meta$expressions, _meta$table0, _meta$table1, _meta$expressions2, _store$showMainColumn, _store$showMainColumn2;
67
+ var _meta$subquery, _meta$subquery2, _meta$subquery3, _meta$table4, _meta$table5, _meta$table7, _meta$table8, _meta$table9, _meta$table0, _meta$expressions, _meta$table1, _meta$table10, _meta$expressions2, _store$showMainColumn, _store$showMainColumn2;
65
68
  var meta = props.meta,
66
69
  groupIndex = props.groupIndex;
67
70
  var store = useStore();
@@ -75,6 +78,45 @@ var JoinData = function JoinData(props) {
75
78
  var _getHelper = getHelper(store.metaList[groupIndex].list, meta),
76
79
  prevTables = _getHelper.prevTables,
77
80
  prevGroupBy = _getHelper.prevGroupBy;
81
+ var _useState = useState(false),
82
+ _useState2 = _slicedToArray(_useState, 2),
83
+ isDel = _useState2[0],
84
+ setIsDel = _useState2[1];
85
+ var tableIsDel = /*#__PURE__*/function () {
86
+ var _ref = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
87
+ var _meta$table;
88
+ var tableName, tables, names;
89
+ return _regeneratorRuntime.wrap(function (_context) {
90
+ while (1) switch (_context.prev = _context.next) {
91
+ case 0:
92
+ tableName = (_meta$table = meta.table2) === null || _meta$table === void 0 ? void 0 : _meta$table.name;
93
+ _context.next = 1;
94
+ return store === null || store === void 0 ? void 0 : store.fetchDataset(meta.table2.datasourceId);
95
+ case 1:
96
+ tables = _context.sent;
97
+ names = (tables === null || tables === void 0 ? void 0 : tables.map(function (v) {
98
+ return v.name;
99
+ })) || [];
100
+ if (!names.includes(tableName)) {
101
+ setIsDel(true);
102
+ } else {
103
+ setIsDel(false);
104
+ }
105
+ case 2:
106
+ case "end":
107
+ return _context.stop();
108
+ }
109
+ }, _callee);
110
+ }));
111
+ return function tableIsDel() {
112
+ return _ref.apply(this, arguments);
113
+ };
114
+ }();
115
+ useEffect(function () {
116
+ setTimeout(function () {
117
+ tableIsDel();
118
+ }, 0);
119
+ }, [meta]);
78
120
  // const ref = useRef(null);
79
121
  // useEffect(() => {
80
122
  // let newMetaList = store.metaList[groupIndex].list.slice();
@@ -196,6 +238,126 @@ var JoinData = function JoinData(props) {
196
238
  });
197
239
  return data;
198
240
  };
241
+ var getCollectionTableColumns = function getCollectionTableColumns() {
242
+ var data = [];
243
+ var _getHelper3 = getHelper(store.metaList[groupIndex].list, meta),
244
+ ExistAboveGroupBy = _getHelper3.ExistAboveGroupBy,
245
+ prevList = _getHelper3.prevList,
246
+ prevGroupBy = _getHelper3.prevGroupBy;
247
+ // 获取左侧表
248
+ if (ExistAboveGroupBy) {
249
+ var _prevGroupBy$group2, _prevGroupBy$by2;
250
+ var _data = {
251
+ alias: prevGroupBy.alias,
252
+ id: prevGroupBy.alias,
253
+ tableUuid: prevGroupBy.tableUuid || uuidv4('table'),
254
+ name: prevGroupBy.alias,
255
+ name_zh: prevGroupBy.alias,
256
+ datasourceId: '',
257
+ datasourceName: '',
258
+ columns: []
259
+ };
260
+ if (prevGroupBy !== null && prevGroupBy !== void 0 && (_prevGroupBy$group2 = prevGroupBy.group) !== null && _prevGroupBy$group2 !== void 0 && _prevGroupBy$group2.length) {
261
+ _data.columns = _data.columns.concat(prevGroupBy.group.map(function (v) {
262
+ return _objectSpread(_objectSpread({}, v), {}, {
263
+ name: v.name || v.quotes,
264
+ name_zh: v.name_zh || v.quotes,
265
+ id: v.id || v.fieldId,
266
+ database_type: (v === null || v === void 0 ? void 0 : v.database_type) || SQL_COLUMN_TYPE.FLOAT,
267
+ special_type: '',
268
+ sql: v.sql,
269
+ select: true
270
+ });
271
+ }));
272
+ }
273
+ if (prevGroupBy !== null && prevGroupBy !== void 0 && (_prevGroupBy$by2 = prevGroupBy.by) !== null && _prevGroupBy$by2 !== void 0 && _prevGroupBy$by2.length) {
274
+ _data.columns = _data.columns.concat(prevGroupBy.by.map(function (v) {
275
+ return _objectSpread(_objectSpread({}, v), {}, {
276
+ name: v.name || v.quotes,
277
+ name_zh: v.name_zh || v.quotes,
278
+ id: v.id || v.fieldId,
279
+ database_type: (v === null || v === void 0 ? void 0 : v.database_type) || SQL_COLUMN_TYPE.FLOAT,
280
+ special_type: '',
281
+ sql: v.sql,
282
+ select: true
283
+ });
284
+ }));
285
+ }
286
+ data = [_data];
287
+ var joinData = prevList.filter(function (v) {
288
+ return v.type === TypeEnum.joinData;
289
+ }).filter(function (v) {
290
+ return v && v.table2.name;
291
+ });
292
+ if (joinData !== null && joinData !== void 0 && joinData.length) {
293
+ data = data.concat(joinData.map(function (v) {
294
+ return {
295
+ alias: v.table2.alias,
296
+ name: v.table2.name,
297
+ name_zh: v.table2.name_zh,
298
+ id: v.table2.id,
299
+ tableUuid: v.table2.tableUuid || uuidv4('table'),
300
+ datasourceId: v.table2.datasourceId,
301
+ datasourceName: v.table2.datasourceName,
302
+ columns: v.columns || []
303
+ };
304
+ }));
305
+ }
306
+ } else {
307
+ data = store.metaList[groupIndex].list.slice(0, index).reduce(function (mo, v) {
308
+ if (v.type === TypeEnum.data) {
309
+ mo.push(_objectSpread(_objectSpread({}, v.table), {}, {
310
+ alias: v.table.alias,
311
+ name: v.table.name,
312
+ name_zh: v.table.name_zh,
313
+ id: v.table.id,
314
+ tableUuid: v.table.tableUuid || uuidv4('table'),
315
+ columns: v.columns,
316
+ datasourceId: v.table.datasourceId,
317
+ datasourceName: v.table.datasourceName
318
+ }));
319
+ } else if (v.type === TypeEnum.joinData) {
320
+ mo.push({
321
+ alias: v.table2.alias,
322
+ name: v.table2.name,
323
+ name_zh: v.table2.name_zh,
324
+ id: v.table2.id,
325
+ tableUuid: v.table2.tableUuid || uuidv4('table'),
326
+ columns: v.columns,
327
+ datasourceId: v.table2.datasourceId,
328
+ datasourceName: v.table2.datasourceName
329
+ });
330
+ }
331
+ return mo;
332
+ }, []);
333
+ // .filter((v: DataType) => v.tableUuid === meta.table1.tableUuid);
334
+ }
335
+ // 获取右侧表
336
+ // 添加table2
337
+ data = data.concat([{
338
+ alias: meta.table2.alias,
339
+ name: meta.table2.name,
340
+ name_zh: meta.table2.name_zh,
341
+ id: meta.table2.id,
342
+ tableUuid: meta.table2.tableUuid || uuidv4('table'),
343
+ datasourceId: meta.table2.datasourceId,
344
+ datasourceName: meta.table2.datasourceName,
345
+ columns: meta.columns
346
+ }]);
347
+ // 过滤为table1选中的表
348
+ // let newMeta = store.metaList[groupIndex].list.slice();
349
+ // data = data.filter((v) => {
350
+ // return (
351
+ // ((newMeta[index] as MetaJoin)[FlagLocation.TABLE_1] as MetaJoin_TalbeType).tableUuid ==
352
+ // v.tableUuid ||
353
+ // ((newMeta[index] as MetaJoin)[FlagLocation.TABLE_1] as MetaJoin_TalbeType).name ==
354
+ // SummarizeAlias ||
355
+ // ((newMeta[index] as MetaJoin)[FlagLocation.TABLE_2] as MetaJoin_TalbeType).tableUuid ==
356
+ // v.tableUuid
357
+ // );
358
+ // });
359
+ return data;
360
+ };
199
361
  // 字段列表
200
362
  function selectColumns(e) {
201
363
  var columns = meta.columns;
@@ -220,12 +382,12 @@ var JoinData = function JoinData(props) {
220
382
  var index = findIndex(store.metaList[groupIndex].list, meta);
221
383
  var table_type = FlagLocation.TABLE_1;
222
384
  var data = [];
223
- var _getHelper3 = getHelper(store.metaList[groupIndex].list, meta),
224
- ExistAboveGroupBy = _getHelper3.ExistAboveGroupBy,
225
- prevList = _getHelper3.prevList,
226
- prevGroupBy = _getHelper3.prevGroupBy;
385
+ var _getHelper4 = getHelper(store.metaList[groupIndex].list, meta),
386
+ ExistAboveGroupBy = _getHelper4.ExistAboveGroupBy,
387
+ prevList = _getHelper4.prevList,
388
+ prevGroupBy = _getHelper4.prevGroupBy;
227
389
  if (ExistAboveGroupBy) {
228
- var _prevGroupBy$group2, _prevGroupBy$by2;
390
+ var _prevGroupBy$group3, _prevGroupBy$by3;
229
391
  var _data = {
230
392
  alias: prevGroupBy.alias,
231
393
  id: prevGroupBy.alias,
@@ -236,7 +398,7 @@ var JoinData = function JoinData(props) {
236
398
  datasourceName: ''
237
399
  // columns: [],
238
400
  };
239
- if (prevGroupBy !== null && prevGroupBy !== void 0 && (_prevGroupBy$group2 = prevGroupBy.group) !== null && _prevGroupBy$group2 !== void 0 && _prevGroupBy$group2.length) {
401
+ if (prevGroupBy !== null && prevGroupBy !== void 0 && (_prevGroupBy$group3 = prevGroupBy.group) !== null && _prevGroupBy$group3 !== void 0 && _prevGroupBy$group3.length) {
240
402
  // _data.columns = _data.columns.concat(
241
403
  // prevGroupBy.group.map((v: MetaSummarize_Group) => {
242
404
  // return {
@@ -252,7 +414,7 @@ var JoinData = function JoinData(props) {
252
414
  // }),
253
415
  // );
254
416
  }
255
- if (prevGroupBy !== null && prevGroupBy !== void 0 && (_prevGroupBy$by2 = prevGroupBy.by) !== null && _prevGroupBy$by2 !== void 0 && _prevGroupBy$by2.length) {
417
+ if (prevGroupBy !== null && prevGroupBy !== void 0 && (_prevGroupBy$by3 = prevGroupBy.by) !== null && _prevGroupBy$by3 !== void 0 && _prevGroupBy$by3.length) {
256
418
  // _data.columns = _data.columns.concat(
257
419
  // prevGroupBy.by.map((v: MetaSummarize_By) => {
258
420
  // return {
@@ -394,6 +556,7 @@ var JoinData = function JoinData(props) {
394
556
  // store.setMeta(newMeta, groupIndex);
395
557
  });
396
558
  }
559
+ setIsDel(false);
397
560
  store.setPopup({
398
561
  visible: false
399
562
  });
@@ -495,13 +658,13 @@ var JoinData = function JoinData(props) {
495
658
  }
496
659
  function getColumns(_position) {
497
660
  var data = [];
498
- var _getHelper4 = getHelper(store.metaList[groupIndex].list, meta),
499
- ExistAboveGroupBy = _getHelper4.ExistAboveGroupBy,
500
- prevList = _getHelper4.prevList,
501
- prevGroupBy = _getHelper4.prevGroupBy;
661
+ var _getHelper5 = getHelper(store.metaList[groupIndex].list, meta),
662
+ ExistAboveGroupBy = _getHelper5.ExistAboveGroupBy,
663
+ prevList = _getHelper5.prevList,
664
+ prevGroupBy = _getHelper5.prevGroupBy;
502
665
  if (_position === ExpressionsEnum.LEFT) {
503
666
  if (ExistAboveGroupBy) {
504
- var _prevGroupBy$group3, _prevGroupBy$by3;
667
+ var _prevGroupBy$group4, _prevGroupBy$by4;
505
668
  var _data = {
506
669
  name: prevGroupBy.alias,
507
670
  name_zh: prevGroupBy.alias,
@@ -512,7 +675,7 @@ var JoinData = function JoinData(props) {
512
675
  datasourceName: '',
513
676
  columns: []
514
677
  };
515
- if (prevGroupBy !== null && prevGroupBy !== void 0 && (_prevGroupBy$group3 = prevGroupBy.group) !== null && _prevGroupBy$group3 !== void 0 && _prevGroupBy$group3.length) {
678
+ if (prevGroupBy !== null && prevGroupBy !== void 0 && (_prevGroupBy$group4 = prevGroupBy.group) !== null && _prevGroupBy$group4 !== void 0 && _prevGroupBy$group4.length) {
516
679
  _data.columns = _data.columns.concat(prevGroupBy.group.map(function (v) {
517
680
  return _objectSpread(_objectSpread({}, v), {}, {
518
681
  name: v.name || v.quotes,
@@ -525,7 +688,7 @@ var JoinData = function JoinData(props) {
525
688
  });
526
689
  }));
527
690
  }
528
- if (prevGroupBy !== null && prevGroupBy !== void 0 && (_prevGroupBy$by3 = prevGroupBy.by) !== null && _prevGroupBy$by3 !== void 0 && _prevGroupBy$by3.length) {
691
+ if (prevGroupBy !== null && prevGroupBy !== void 0 && (_prevGroupBy$by4 = prevGroupBy.by) !== null && _prevGroupBy$by4 !== void 0 && _prevGroupBy$by4.length) {
529
692
  _data.columns = _data.columns.concat(prevGroupBy.by.map(function (v) {
530
693
  return _objectSpread(_objectSpread({}, v), {}, {
531
694
  name: v.name || v.quotes,
@@ -615,13 +778,13 @@ var JoinData = function JoinData(props) {
615
778
  var _ind2 = Number(node.getAttribute('v-index2'));
616
779
  var index = findIndex(store.metaList[groupIndex].list, meta);
617
780
  var data = [];
618
- var _getHelper5 = getHelper(store.metaList[groupIndex].list, meta),
619
- ExistAboveGroupBy = _getHelper5.ExistAboveGroupBy,
620
- prevList = _getHelper5.prevList,
621
- prevGroupBy = _getHelper5.prevGroupBy;
781
+ var _getHelper6 = getHelper(store.metaList[groupIndex].list, meta),
782
+ ExistAboveGroupBy = _getHelper6.ExistAboveGroupBy,
783
+ prevList = _getHelper6.prevList,
784
+ prevGroupBy = _getHelper6.prevGroupBy;
622
785
  if (_position === ExpressionsEnum.LEFT) {
623
786
  if (ExistAboveGroupBy) {
624
- var _prevGroupBy$group4, _prevGroupBy$by4;
787
+ var _prevGroupBy$group5, _prevGroupBy$by5;
625
788
  var _data = {
626
789
  name: prevGroupBy.alias,
627
790
  name_zh: prevGroupBy.alias,
@@ -632,7 +795,7 @@ var JoinData = function JoinData(props) {
632
795
  datasourceName: '',
633
796
  columns: []
634
797
  };
635
- if (prevGroupBy !== null && prevGroupBy !== void 0 && (_prevGroupBy$group4 = prevGroupBy.group) !== null && _prevGroupBy$group4 !== void 0 && _prevGroupBy$group4.length) {
798
+ if (prevGroupBy !== null && prevGroupBy !== void 0 && (_prevGroupBy$group5 = prevGroupBy.group) !== null && _prevGroupBy$group5 !== void 0 && _prevGroupBy$group5.length) {
636
799
  _data.columns = _data.columns.concat(prevGroupBy.group.map(function (v) {
637
800
  return _objectSpread(_objectSpread({}, v), {}, {
638
801
  name: v.name || v.quotes,
@@ -645,7 +808,7 @@ var JoinData = function JoinData(props) {
645
808
  });
646
809
  }));
647
810
  }
648
- if (prevGroupBy !== null && prevGroupBy !== void 0 && (_prevGroupBy$by4 = prevGroupBy.by) !== null && _prevGroupBy$by4 !== void 0 && _prevGroupBy$by4.length) {
811
+ if (prevGroupBy !== null && prevGroupBy !== void 0 && (_prevGroupBy$by5 = prevGroupBy.by) !== null && _prevGroupBy$by5 !== void 0 && _prevGroupBy$by5.length) {
649
812
  _data.columns = _data.columns.concat(prevGroupBy.by.map(function (v) {
650
813
  return _objectSpread(_objectSpread({}, v), {}, {
651
814
  name: v.name || v.quotes,
@@ -807,10 +970,10 @@ var JoinData = function JoinData(props) {
807
970
  });
808
971
  }
809
972
  // 修改输入框类型
810
- function onChangeType(e, _ref) {
811
- var _ref$position = _ref.position,
812
- position = _ref$position === void 0 ? 'rhs' : _ref$position,
813
- _ind = _ref.index;
973
+ function onChangeType(e, _ref2) {
974
+ var _ref2$position = _ref2.position,
975
+ position = _ref2$position === void 0 ? 'rhs' : _ref2$position,
976
+ _ind = _ref2.index;
814
977
  var index = findIndex(store.metaList[groupIndex].list, meta);
815
978
  var newMeta = store.metaList[groupIndex].list.slice();
816
979
  store.setPopup({
@@ -880,13 +1043,13 @@ var JoinData = function JoinData(props) {
880
1043
  })
881
1044
  });
882
1045
  }
883
- function onChangeString(val, _ref2) {
884
- var _ref2$position = _ref2.position,
885
- position = _ref2$position === void 0 ? 'rhs' : _ref2$position,
886
- _ref2$index = _ref2.index1,
887
- index1 = _ref2$index === void 0 ? 0 : _ref2$index,
888
- _ref2$index2 = _ref2.index2,
889
- index2 = _ref2$index2 === void 0 ? 0 : _ref2$index2;
1046
+ function onChangeString(val, _ref3) {
1047
+ var _ref3$position = _ref3.position,
1048
+ position = _ref3$position === void 0 ? 'rhs' : _ref3$position,
1049
+ _ref3$index = _ref3.index1,
1050
+ index1 = _ref3$index === void 0 ? 0 : _ref3$index,
1051
+ _ref3$index2 = _ref3.index2,
1052
+ index2 = _ref3$index2 === void 0 ? 0 : _ref3$index2;
890
1053
  // : 'rhs'
891
1054
  var index = findIndex(store.metaList[groupIndex].list, meta);
892
1055
  var newMeta = store.metaList[groupIndex].list.slice();
@@ -994,17 +1157,17 @@ var JoinData = function JoinData(props) {
994
1157
  }
995
1158
  }),
996
1159
  onOk: function () {
997
- var _onOk = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
1160
+ var _onOk = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
998
1161
  var index, newMeta;
999
- return _regeneratorRuntime.wrap(function (_context) {
1000
- while (1) switch (_context.prev = _context.next) {
1162
+ return _regeneratorRuntime.wrap(function (_context2) {
1163
+ while (1) switch (_context2.prev = _context2.next) {
1001
1164
  case 0:
1002
1165
  if (isValidSQLAlias(alias)) {
1003
- _context.next = 1;
1166
+ _context2.next = 1;
1004
1167
  break;
1005
1168
  }
1006
1169
  Toast.warning(__('SqlQueryBuilder.aliasForRules'));
1007
- return _context.abrupt("return", false);
1170
+ return _context2.abrupt("return", false);
1008
1171
  case 1:
1009
1172
  index = findIndex(store.metaList[groupIndex].list, meta);
1010
1173
  newMeta = store.metaList[groupIndex].list.slice();
@@ -1013,9 +1176,9 @@ var JoinData = function JoinData(props) {
1013
1176
  store.setMeta(newMeta, groupIndex);
1014
1177
  case 2:
1015
1178
  case "end":
1016
- return _context.stop();
1179
+ return _context2.stop();
1017
1180
  }
1018
- }, _callee);
1181
+ }, _callee2);
1019
1182
  }));
1020
1183
  function onOk() {
1021
1184
  return _onOk.apply(this, arguments);
@@ -1234,12 +1397,12 @@ var JoinData = function JoinData(props) {
1234
1397
  }
1235
1398
  };
1236
1399
  var tableIsError = function tableIsError() {
1237
- var _store$preProps4, _meta$table;
1400
+ var _store$preProps4, _meta$table2;
1238
1401
  var aliass = ((_store$preProps4 = store.preProps) === null || _store$preProps4 === void 0 || (_store$preProps4 = _store$preProps4.notExistsColumns) === null || _store$preProps4 === void 0 ? void 0 : _store$preProps4.map(function (v) {
1239
1402
  return v.alias;
1240
1403
  })) || [];
1241
- var tableAlias = (_meta$table = meta.table2) === null || _meta$table === void 0 ? void 0 : _meta$table.alias;
1242
- if (tableAlias && aliass.includes(tableAlias)) {
1404
+ var tableAlias = (_meta$table2 = meta.table2) === null || _meta$table2 === void 0 ? void 0 : _meta$table2.alias;
1405
+ if (tableAlias && aliass.includes(tableAlias) || isDel) {
1243
1406
  return true;
1244
1407
  }
1245
1408
  return false;
@@ -1293,48 +1456,60 @@ var JoinData = function JoinData(props) {
1293
1456
  showSubQuery(meta.subquery);
1294
1457
  },
1295
1458
  children: [subQuerySelected && _jsx(Tooltip, {
1296
- title: __(tableIsError() ? 'SqlQueryBuilder.repeatAlias' : 'SqlQueryBuilder.alias'),
1459
+ title: __(tableIsError() ? isDel ? 'metabase.verify' : 'SqlQueryBuilder.repeatAlias' : 'SqlQueryBuilder.alias'),
1297
1460
  children: _jsx(Button, {
1298
1461
  danger: tableIsError(),
1299
1462
  className: cx(':Sqb-TableName-as', {
1300
1463
  isError: tableIsError()
1301
1464
  }),
1302
1465
  shape: 'circle',
1466
+ style: isDel ? {
1467
+ fontSize: 18,
1468
+ backgroundColor: '#fff',
1469
+ width: 'auto',
1470
+ height: 'auto'
1471
+ } : {},
1303
1472
  iconOnly: true,
1304
- primary: true,
1305
- icon: 'As',
1473
+ primary: !isDel,
1474
+ icon: isDel ? _jsx(ExclamationCircleFill, {}) : 'As',
1306
1475
  size: 'small',
1307
1476
  onClick: function onClick(e) {
1308
- var _meta$table2;
1477
+ var _meta$table3;
1309
1478
  e.stopPropagation();
1310
- onChangeTableAlias(((_meta$table2 = meta.table2) === null || _meta$table2 === void 0 ? void 0 : _meta$table2.alias) || '');
1479
+ onChangeTableAlias(((_meta$table3 = meta.table2) === null || _meta$table3 === void 0 ? void 0 : _meta$table3.alias) || '');
1311
1480
  }
1312
1481
  })
1313
- }), 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$table3 = meta.table2) !== null && _meta$table3 !== void 0 && _meta$table3.alias ? "as ".concat((_meta$table4 = meta.table2) === null || _meta$table4 === void 0 ? void 0 : _meta$table4.alias) : '', " ") : __('SqlQueryBuilder.setSubQuery')]
1482
+ }), 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 ? "as ".concat((_meta$table5 = meta.table2) === null || _meta$table5 === void 0 ? void 0 : _meta$table5.alias) : '', " ") : __('SqlQueryBuilder.setSubQuery')]
1314
1483
  }) : _jsxs("div", {
1315
1484
  className: cx("Sqb-TableName", {
1316
1485
  notSelected: !table2Selected
1317
1486
  }),
1318
1487
  onClick: selectTable,
1319
1488
  children: [table2Selected && _jsx(Tooltip, {
1320
- title: __(tableIsError() ? 'SqlQueryBuilder.repeatAlias' : 'SqlQueryBuilder.alias'),
1489
+ title: __(tableIsError() ? isDel ? 'metabase.verify' : 'SqlQueryBuilder.repeatAlias' : 'SqlQueryBuilder.alias'),
1321
1490
  children: _jsx(Button, {
1322
1491
  danger: tableIsError(),
1323
1492
  className: cx(':Sqb-TableName-as', {
1324
1493
  isError: tableIsError()
1325
1494
  }),
1326
1495
  shape: 'circle',
1496
+ style: isDel ? {
1497
+ fontSize: 18,
1498
+ backgroundColor: '#fff',
1499
+ width: 'auto',
1500
+ height: 'auto'
1501
+ } : {},
1327
1502
  iconOnly: true,
1328
- primary: true,
1329
- icon: 'As',
1503
+ primary: !isDel,
1504
+ icon: isDel ? _jsx(ExclamationCircleFill, {}) : 'As',
1330
1505
  size: 'small',
1331
1506
  onClick: function onClick(e) {
1332
- var _meta$table5;
1507
+ var _meta$table6;
1333
1508
  e.stopPropagation();
1334
- onChangeTableAlias(((_meta$table5 = meta.table2) === null || _meta$table5 === void 0 ? void 0 : _meta$table5.alias) || '');
1509
+ onChangeTableAlias(((_meta$table6 = meta.table2) === null || _meta$table6 === void 0 ? void 0 : _meta$table6.alias) || '');
1335
1510
  }
1336
1511
  })
1337
- }), table2Selected ? "".concat(meta.table2.datasourceName, ".").concat(meta.table2.name, " ").concat((_meta$table6 = meta.table2) !== null && _meta$table6 !== void 0 && _meta$table6.alias ? "as ".concat((_meta$table7 = meta.table2) === null || _meta$table7 === void 0 ? void 0 : _meta$table7.alias) : '') : __('SqlQueryBuilder.pickTable')]
1512
+ }), table2Selected ? "".concat(meta.table2.datasourceName, ".").concat(meta.table2.name, " ").concat((_meta$table7 = meta.table2) !== null && _meta$table7 !== void 0 && _meta$table7.alias ? "as ".concat((_meta$table8 = meta.table2) === null || _meta$table8 === void 0 ? void 0 : _meta$table8.alias) : '') : __('SqlQueryBuilder.pickTable')]
1338
1513
  }), store.showSubquery && _jsx(Tooltip, {
1339
1514
  title: __('SqlQueryBuilder.switchSubQuery'),
1340
1515
  children: _jsx(Button, {
@@ -1345,7 +1520,7 @@ var JoinData = function JoinData(props) {
1345
1520
  icon: _jsx(RelatedWork, {}),
1346
1521
  onClick: switchSubQuery
1347
1522
  })
1348
- }), ((_meta$table8 = meta.table2) === null || _meta$table8 === void 0 ? void 0 : _meta$table8.name) && ((_meta$table9 = meta.table1) === null || _meta$table9 === void 0 ? void 0 : _meta$table9.name) && ((_meta$expressions = meta.expressions) === null || _meta$expressions === void 0 ? void 0 : _meta$expressions.map(function (v, i) {
1523
+ }), ((_meta$table9 = meta.table2) === null || _meta$table9 === void 0 ? void 0 : _meta$table9.name) && ((_meta$table0 = meta.table1) === null || _meta$table0 === void 0 ? void 0 : _meta$table0.name) && ((_meta$expressions = meta.expressions) === null || _meta$expressions === void 0 ? void 0 : _meta$expressions.map(function (v, i) {
1349
1524
  if (v.type === AtomsTypeEnum.JOIN_DEFAULT) {
1350
1525
  return _jsxs("div", {
1351
1526
  className: cx("Sqb-where block"),
@@ -1531,7 +1706,7 @@ var JoinData = function JoinData(props) {
1531
1706
  // showPreview={false}
1532
1707
  // check={formulaList?.[fun.name]?.args?.[i]?.check || ''}
1533
1708
  value: v.list,
1534
- data: getTableColumns(),
1709
+ data: getCollectionTableColumns(),
1535
1710
  // ref={ref}
1536
1711
  onChange: function onChange(data, _quotes) {
1537
1712
  var newMeta = store.metaList[groupIndex].list.slice();
@@ -1572,7 +1747,7 @@ var JoinData = function JoinData(props) {
1572
1747
  })]
1573
1748
  }, i);
1574
1749
  }
1575
- })), ((_meta$table0 = meta.table2) === null || _meta$table0 === void 0 ? void 0 : _meta$table0.name) && ((_meta$table1 = meta.table1) === null || _meta$table1 === void 0 ? void 0 : _meta$table1.name) && (((_meta$expressions2 = meta.expressions) === null || _meta$expressions2 === void 0 ? void 0 : _meta$expressions2.length) || 0) < 1 && _jsx(Tooltip, {
1750
+ })), ((_meta$table1 = meta.table2) === null || _meta$table1 === void 0 ? void 0 : _meta$table1.name) && ((_meta$table10 = meta.table1) === null || _meta$table10 === void 0 ? void 0 : _meta$table10.name) && (((_meta$expressions2 = meta.expressions) === null || _meta$expressions2 === void 0 ? void 0 : _meta$expressions2.length) || 0) < 1 && _jsx(Tooltip, {
1576
1751
  title: __('SqlQueryBuilder.add'),
1577
1752
  children: _jsx(Dropdown, {
1578
1753
  trigger: ['click'],