@gingkoo/pandora-metabase 1.0.130 → 1.0.131

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.
Files changed (65) hide show
  1. package/lib/cjs/components/dialog/expression/index.js +0 -1
  2. package/lib/cjs/components/dialog/formula-list/utils.js +0 -3
  3. package/lib/cjs/components/dialog/select-column/index.js +2 -2
  4. package/lib/cjs/components/dialog/select-column-multiple/index.d.ts +0 -1
  5. package/lib/cjs/components/dialog/select-column-multiple/index.js +44 -19
  6. package/lib/cjs/components/dialog/select-join-column/index.js +23 -7
  7. package/lib/cjs/components/dialog/select-join-column-multiple/index.js +15 -6
  8. package/lib/cjs/components/dialog/select-permission-table/index.js +2 -2
  9. package/lib/cjs/components/dialog/select-summarize/index.js +1 -3
  10. package/lib/cjs/components/dialog/select-table/index.d.ts +1 -2
  11. package/lib/cjs/components/dialog/select-table/index.js +231 -261
  12. package/lib/cjs/components/dialog/select-table/index.less +51 -36
  13. package/lib/cjs/components/metabase/index.js +34 -16
  14. package/lib/cjs/components/modules/components/item-name.js +0 -1
  15. package/lib/cjs/components/modules/custom-column.js +3 -7
  16. package/lib/cjs/components/modules/filter.js +3 -6
  17. package/lib/cjs/components/modules/join-data.js +41 -87
  18. package/lib/cjs/components/modules/permission-table.js +5 -9
  19. package/lib/cjs/components/modules/sort.js +1 -2
  20. package/lib/cjs/components/modules/summarize/group-by.js +1 -8
  21. package/lib/cjs/components/modules/summarize/select-index.js +1 -4
  22. package/lib/cjs/components/modules/table-data.js +28 -44
  23. package/lib/cjs/hooks/use-state.js +22 -147
  24. package/lib/cjs/index.js +1 -7
  25. package/lib/cjs/locale/en.js +1 -0
  26. package/lib/cjs/locale/zh.js +1 -0
  27. package/lib/cjs/store/types.d.ts +4 -5
  28. package/lib/cjs/types.d.ts +0 -8
  29. package/lib/cjs/utils/helper.d.ts +4 -0
  30. package/lib/cjs/utils/helper.js +102 -1
  31. package/lib/cjs/utils/transformSql.js +0 -2
  32. package/lib/cjs/utils.js +38 -18
  33. package/lib/es/components/dialog/expression/index.js +0 -1
  34. package/lib/es/components/dialog/formula-list/utils.js +0 -3
  35. package/lib/es/components/dialog/select-column/index.js +3 -3
  36. package/lib/es/components/dialog/select-column-multiple/index.d.ts +0 -1
  37. package/lib/es/components/dialog/select-column-multiple/index.js +45 -21
  38. package/lib/es/components/dialog/select-join-column/index.js +24 -8
  39. package/lib/es/components/dialog/select-join-column-multiple/index.js +16 -7
  40. package/lib/es/components/dialog/select-permission-table/index.js +3 -3
  41. package/lib/es/components/dialog/select-summarize/index.js +1 -3
  42. package/lib/es/components/dialog/select-table/index.d.ts +1 -2
  43. package/lib/es/components/dialog/select-table/index.js +233 -263
  44. package/lib/es/components/dialog/select-table/index.less +51 -36
  45. package/lib/es/components/metabase/index.js +34 -16
  46. package/lib/es/components/modules/components/item-name.js +0 -1
  47. package/lib/es/components/modules/custom-column.js +3 -7
  48. package/lib/es/components/modules/filter.js +3 -6
  49. package/lib/es/components/modules/join-data.js +42 -88
  50. package/lib/es/components/modules/permission-table.js +6 -10
  51. package/lib/es/components/modules/sort.js +1 -2
  52. package/lib/es/components/modules/summarize/group-by.js +1 -8
  53. package/lib/es/components/modules/summarize/select-index.js +1 -4
  54. package/lib/es/components/modules/table-data.js +29 -45
  55. package/lib/es/hooks/use-state.js +23 -148
  56. package/lib/es/index.js +1 -7
  57. package/lib/es/locale/en.js +1 -0
  58. package/lib/es/locale/zh.js +1 -0
  59. package/lib/es/store/types.d.ts +4 -5
  60. package/lib/es/types.d.ts +0 -8
  61. package/lib/es/utils/helper.d.ts +4 -0
  62. package/lib/es/utils/helper.js +101 -0
  63. package/lib/es/utils/transformSql.js +0 -2
  64. package/lib/es/utils.js +39 -19
  65. package/package.json +1 -1
@@ -72,7 +72,7 @@ var menuOperator = operators.map(function (v) {
72
72
  };
73
73
  });
74
74
  var JoinData = function JoinData(props) {
75
- var _meta$subquery, _meta$subquery2, _meta$subquery3, _meta$table5, _meta$table6, _meta$table8, _meta$table9, _meta$table0, _meta$table1, _meta$expressions, _meta$table10, _meta$table11, _meta$expressions2, _store$showMainColumn, _store$showMainColumn2;
75
+ 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;
76
76
  var meta = props.meta,
77
77
  groupIndex = props.groupIndex;
78
78
  var store = (0, _useProvider.useStore)();
@@ -92,13 +92,13 @@ var JoinData = function JoinData(props) {
92
92
  setIsDel = _useState2[1];
93
93
  var tableIsDel = function () {
94
94
  var _ref = (0, _asyncToGenerator2["default"])(_regenerator["default"].mark(function _callee() {
95
- var _meta$table, _meta$table2;
96
- var tableId, tables, ids;
95
+ var _meta$table;
96
+ var tableInfo, tables;
97
97
  return _regenerator["default"].wrap(function (_context) {
98
98
  while (1) switch (_context.prev = _context.next) {
99
99
  case 0:
100
- tableId = (_meta$table = meta.table2) === null || _meta$table === void 0 ? void 0 : _meta$table.id;
101
- if ((_meta$table2 = meta.table2) !== null && _meta$table2 !== void 0 && _meta$table2.datasourceId) {
100
+ tableInfo = meta.table2;
101
+ if ((_meta$table = meta.table2) !== null && _meta$table !== void 0 && _meta$table.datasourceId) {
102
102
  _context.next = 1;
103
103
  break;
104
104
  }
@@ -106,13 +106,12 @@ var JoinData = function JoinData(props) {
106
106
  return _context.abrupt("return");
107
107
  case 1:
108
108
  _context.next = 2;
109
- return store === null || store === void 0 ? void 0 : store.fetchDataset(meta.table2.datasourceId, meta.table2.datasourceType);
109
+ return store === null || store === void 0 ? void 0 : store.fetchDataset(meta.table2.datasourceId);
110
110
  case 2:
111
111
  tables = _context.sent;
112
- ids = (tables === null || tables === void 0 ? void 0 : tables.map(function (v) {
113
- return v.id;
114
- })) || [];
115
- if (!ids.includes(tableId)) {
112
+ if (!(tables !== null && tables !== void 0 && tables.some(function (v) {
113
+ return (0, _helper.isSameTableByIdFirst)(tableInfo, v);
114
+ }))) {
116
115
  setIsDel(true);
117
116
  } else {
118
117
  setIsDel(false);
@@ -148,7 +147,6 @@ var JoinData = function JoinData(props) {
148
147
  name_zh: prevGroupBy.alias,
149
148
  datasourceId: '',
150
149
  datasourceName: '',
151
- datasourceType: '',
152
150
  columns: []
153
151
  };
154
152
  if (prevGroupBy !== null && prevGroupBy !== void 0 && (_prevGroupBy$group = prevGroupBy.group) !== null && _prevGroupBy$group !== void 0 && _prevGroupBy$group.length) {
@@ -193,7 +191,6 @@ var JoinData = function JoinData(props) {
193
191
  tableUuid: v.table2.tableUuid || (0, _helper.uuidv4)('table'),
194
192
  datasourceId: v.table2.datasourceId,
195
193
  datasourceName: v.table2.datasourceName,
196
- datasourceType: v.table2.datasourceType,
197
194
  columns: v.columns || []
198
195
  };
199
196
  }));
@@ -209,8 +206,7 @@ var JoinData = function JoinData(props) {
209
206
  tableUuid: v.table.tableUuid || (0, _helper.uuidv4)('table'),
210
207
  columns: v.columns,
211
208
  datasourceId: v.table.datasourceId,
212
- datasourceName: v.table.datasourceName,
213
- datasourceType: v.table.datasourceType
209
+ datasourceName: v.table.datasourceName
214
210
  }));
215
211
  } else if (v.type === _enum.TypeEnum.joinData) {
216
212
  mo.push({
@@ -221,8 +217,7 @@ var JoinData = function JoinData(props) {
221
217
  tableUuid: v.table2.tableUuid || (0, _helper.uuidv4)('table'),
222
218
  columns: v.columns,
223
219
  datasourceId: v.table2.datasourceId,
224
- datasourceName: v.table2.datasourceName,
225
- datasourceType: v.table2.datasourceType
220
+ datasourceName: v.table2.datasourceName
226
221
  });
227
222
  }
228
223
  return mo;
@@ -238,7 +233,6 @@ var JoinData = function JoinData(props) {
238
233
  tableUuid: meta.table2.tableUuid || (0, _helper.uuidv4)('table'),
239
234
  datasourceId: meta.table2.datasourceId,
240
235
  datasourceName: meta.table2.datasourceName,
241
- datasourceType: meta.table2.datasourceType,
242
236
  columns: meta.columns
243
237
  }]);
244
238
  var newMeta = store.metaList[groupIndex].list.slice();
@@ -263,7 +257,6 @@ var JoinData = function JoinData(props) {
263
257
  name_zh: prevGroupBy.alias,
264
258
  datasourceId: '',
265
259
  datasourceName: '',
266
- datasourceType: '',
267
260
  columns: []
268
261
  };
269
262
  if (prevGroupBy !== null && prevGroupBy !== void 0 && (_prevGroupBy$group2 = prevGroupBy.group) !== null && _prevGroupBy$group2 !== void 0 && _prevGroupBy$group2.length) {
@@ -308,7 +301,6 @@ var JoinData = function JoinData(props) {
308
301
  tableUuid: v.table2.tableUuid || (0, _helper.uuidv4)('table'),
309
302
  datasourceId: v.table2.datasourceId,
310
303
  datasourceName: v.table2.datasourceName,
311
- datasourceType: v.table2.datasourceType,
312
304
  columns: v.columns || []
313
305
  };
314
306
  }));
@@ -324,8 +316,7 @@ var JoinData = function JoinData(props) {
324
316
  tableUuid: v.table.tableUuid || (0, _helper.uuidv4)('table'),
325
317
  columns: v.columns,
326
318
  datasourceId: v.table.datasourceId,
327
- datasourceName: v.table.datasourceName,
328
- datasourceType: v.table.datasourceType
319
+ datasourceName: v.table.datasourceName
329
320
  }));
330
321
  } else if (v.type === _enum.TypeEnum.joinData) {
331
322
  mo.push({
@@ -336,8 +327,7 @@ var JoinData = function JoinData(props) {
336
327
  tableUuid: v.table2.tableUuid || (0, _helper.uuidv4)('table'),
337
328
  columns: v.columns,
338
329
  datasourceId: v.table2.datasourceId,
339
- datasourceName: v.table2.datasourceName,
340
- datasourceType: v.table2.datasourceType
330
+ datasourceName: v.table2.datasourceName
341
331
  });
342
332
  }
343
333
  return mo;
@@ -351,7 +341,6 @@ var JoinData = function JoinData(props) {
351
341
  tableUuid: meta.table2.tableUuid || (0, _helper.uuidv4)('table'),
352
342
  datasourceId: meta.table2.datasourceId,
353
343
  datasourceName: meta.table2.datasourceName,
354
- datasourceType: meta.table2.datasourceType,
355
344
  columns: meta.columns
356
345
  }]);
357
346
  return data;
@@ -396,8 +385,7 @@ var JoinData = function JoinData(props) {
396
385
  name: prevGroupBy.alias,
397
386
  name_zh: prevGroupBy.alias,
398
387
  datasourceId: '',
399
- datasourceName: '',
400
- datasourceType: ''
388
+ datasourceName: ''
401
389
  };
402
390
  if (prevGroupBy !== null && prevGroupBy !== void 0 && (_prevGroupBy$group3 = prevGroupBy.group) !== null && _prevGroupBy$group3 !== void 0 && _prevGroupBy$group3.length) {}
403
391
  if (prevGroupBy !== null && prevGroupBy !== void 0 && (_prevGroupBy$by3 = prevGroupBy.by) !== null && _prevGroupBy$by3 !== void 0 && _prevGroupBy$by3.length) {}
@@ -417,7 +405,6 @@ var JoinData = function JoinData(props) {
417
405
  tableUuid: v.table2.tableUuid || (0, _helper.uuidv4)('table'),
418
406
  datasourceId: v.table2.datasourceId,
419
407
  datasourceName: v.table2.datasourceName,
420
- datasourceType: v.table2.datasourceType,
421
408
  columns: []
422
409
  };
423
410
  }));
@@ -433,8 +420,7 @@ var JoinData = function JoinData(props) {
433
420
  tableUuid: v.table.tableUuid || (0, _helper.uuidv4)('table'),
434
421
  columns: [],
435
422
  datasourceId: v.table.datasourceId,
436
- datasourceName: v.table.datasourceName,
437
- datasourceType: v.table.datasourceType
423
+ datasourceName: v.table.datasourceName
438
424
  });
439
425
  } else if (v.type === _enum.TypeEnum.joinData) {
440
426
  mo.push({
@@ -445,8 +431,7 @@ var JoinData = function JoinData(props) {
445
431
  tableUuid: v.table2.tableUuid || (0, _helper.uuidv4)('table'),
446
432
  columns: [],
447
433
  datasourceId: v.table2.datasourceId,
448
- datasourceName: v.table2.datasourceName,
449
- datasourceType: v.table2.datasourceType
434
+ datasourceName: v.table2.datasourceName
450
435
  });
451
436
  }
452
437
  return mo;
@@ -482,7 +467,6 @@ var JoinData = function JoinData(props) {
482
467
  alias: meta.table2.alias,
483
468
  datasourceId: meta.table2.datasourceId,
484
469
  datasourceName: meta.table2.datasourceName,
485
- datasourceType: meta.table2.datasourceType,
486
470
  tableUuid: meta.table2.tableUuid || ''
487
471
  };
488
472
  !meta.readonly && store.setPopup({
@@ -493,25 +477,9 @@ var JoinData = function JoinData(props) {
493
477
  tableFlat: store.tableFlat,
494
478
  data: store.sourceList,
495
479
  value: value,
496
- onDatasourceTypeChange: function onDatasourceTypeChange(data) {
497
- var newMeta = (0, _cloneDeep["default"])(store.metaList[groupIndex].list);
498
- var joinMeta = newMeta[index];
499
- joinMeta.table2 = (0, _objectSpread2["default"])((0, _objectSpread2["default"])((0, _objectSpread2["default"])({}, joinMeta.table2), data), {}, {
500
- datasourceType: data.datasourceType
501
- });
502
- joinMeta.columns = joinMeta.columns.map(function (column) {
503
- return (0, _objectSpread2["default"])((0, _objectSpread2["default"])({}, column), {}, {
504
- datasourceType: data.datasourceType
505
- });
506
- });
507
- store.setMeta(newMeta, groupIndex, {
508
- obj: data,
509
- type: _types.ChangeType.table2
510
- });
511
- },
512
480
  onChange: function onChange(data) {
513
481
  var tableName = data.name;
514
- if (meta.table2.name !== tableName || meta.table2.datasourceId !== data.datasourceId || meta.table2.datasourceType !== data.datasourceType) {
482
+ if (!(0, _helper.isSameTableByIdFirst)(meta.table2, data)) {
515
483
  var _store$preProps;
516
484
  var newMeta = (0, _cloneDeep["default"])(store.metaList[groupIndex].list);
517
485
  var alias = (0, _helper.getAlias)(tableName, newMeta, ((_store$preProps = store.preProps) === null || _store$preProps === void 0 ? void 0 : _store$preProps.notExistsColumns) || []);
@@ -523,8 +491,7 @@ var JoinData = function JoinData(props) {
523
491
  fieldUuid: '',
524
492
  quotes: '',
525
493
  datasourceId: data.datasourceId,
526
- datasourceName: data.datasourceName,
527
- datasourceType: data.datasourceType
494
+ datasourceName: data.datasourceName
528
495
  });
529
496
  newMeta[index].table2 = _table2;
530
497
  initExpressions(newMeta);
@@ -562,7 +529,6 @@ var JoinData = function JoinData(props) {
562
529
  tableUuid: '',
563
530
  datasourceName: '',
564
531
  datasourceId: '',
565
- datasourceType: '',
566
532
  type: _types.AtomsTypeEnum.FIELD
567
533
  }],
568
534
  condition: '',
@@ -579,7 +545,6 @@ var JoinData = function JoinData(props) {
579
545
  tableUuid: '',
580
546
  datasourceName: '',
581
547
  datasourceId: '',
582
- datasourceType: '',
583
548
  type: _types.AtomsTypeEnum.FIELD
584
549
  }],
585
550
  type: _types.AtomsTypeEnum.JOIN_DEFAULT
@@ -624,7 +589,6 @@ var JoinData = function JoinData(props) {
624
589
  alias: prevGroupBy.alias,
625
590
  datasourceId: '',
626
591
  datasourceName: '',
627
- datasourceType: '',
628
592
  columns: []
629
593
  };
630
594
  if (prevGroupBy !== null && prevGroupBy !== void 0 && (_prevGroupBy$group4 = prevGroupBy.group) !== null && _prevGroupBy$group4 !== void 0 && _prevGroupBy$group4.length) {
@@ -669,7 +633,6 @@ var JoinData = function JoinData(props) {
669
633
  tableUuid: v.table2.tableUuid || (0, _helper.uuidv4)('table'),
670
634
  datasourceId: v.table2.datasourceId,
671
635
  datasourceName: v.table2.datasourceName,
672
- datasourceType: v.table2.datasourceType,
673
636
  columns: v.columns
674
637
  };
675
638
  }));
@@ -685,8 +648,7 @@ var JoinData = function JoinData(props) {
685
648
  tableUuid: v.table.tableUuid || (0, _helper.uuidv4)('table'),
686
649
  columns: v.columns,
687
650
  datasourceId: v.table.datasourceId,
688
- datasourceName: v.table.datasourceName,
689
- datasourceType: v.table.datasourceType
651
+ datasourceName: v.table.datasourceName
690
652
  });
691
653
  } else if (v.type === _enum.TypeEnum.joinData) {
692
654
  mo.push({
@@ -697,8 +659,7 @@ var JoinData = function JoinData(props) {
697
659
  tableUuid: v.table2.tableUuid || (0, _helper.uuidv4)('table'),
698
660
  columns: v.columns,
699
661
  datasourceId: v.table2.datasourceId,
700
- datasourceName: v.table2.datasourceName,
701
- datasourceType: v.table2.datasourceType
662
+ datasourceName: v.table2.datasourceName
702
663
  });
703
664
  }
704
665
  return mo;
@@ -719,7 +680,6 @@ var JoinData = function JoinData(props) {
719
680
  tableUuid: meta.table2.tableUuid || (0, _helper.uuidv4)('table'),
720
681
  datasourceId: meta.table2.datasourceId,
721
682
  datasourceName: meta.table2.datasourceName,
722
- datasourceType: meta.table2.datasourceType,
723
683
  columns: meta.columns
724
684
  }];
725
685
  }
@@ -748,7 +708,6 @@ var JoinData = function JoinData(props) {
748
708
  alias: prevGroupBy.alias,
749
709
  datasourceId: '',
750
710
  datasourceName: '',
751
- datasourceType: '',
752
711
  columns: []
753
712
  };
754
713
  if (prevGroupBy !== null && prevGroupBy !== void 0 && (_prevGroupBy$group5 = prevGroupBy.group) !== null && _prevGroupBy$group5 !== void 0 && _prevGroupBy$group5.length) {
@@ -793,7 +752,6 @@ var JoinData = function JoinData(props) {
793
752
  tableUuid: v.table2.tableUuid || (0, _helper.uuidv4)('table'),
794
753
  datasourceId: v.table2.datasourceId,
795
754
  datasourceName: v.table2.datasourceName,
796
- datasourceType: v.table2.datasourceType,
797
755
  columns: v.columns
798
756
  };
799
757
  }));
@@ -809,8 +767,7 @@ var JoinData = function JoinData(props) {
809
767
  tableUuid: v.table.tableUuid || (0, _helper.uuidv4)('table'),
810
768
  columns: v.columns,
811
769
  datasourceId: v.table.datasourceId,
812
- datasourceName: v.table.datasourceName,
813
- datasourceType: v.table.datasourceType
770
+ datasourceName: v.table.datasourceName
814
771
  });
815
772
  } else if (v.type === _enum.TypeEnum.joinData) {
816
773
  mo.push({
@@ -821,8 +778,7 @@ var JoinData = function JoinData(props) {
821
778
  tableUuid: v.table2.tableUuid || (0, _helper.uuidv4)('table'),
822
779
  columns: v.columns,
823
780
  datasourceId: v.table2.datasourceId,
824
- datasourceName: v.table2.datasourceName,
825
- datasourceType: v.table2.datasourceType
781
+ datasourceName: v.table2.datasourceName
826
782
  });
827
783
  }
828
784
  return mo;
@@ -843,7 +799,6 @@ var JoinData = function JoinData(props) {
843
799
  tableUuid: meta.table2.tableUuid || (0, _helper.uuidv4)('table'),
844
800
  datasourceId: meta.table2.datasourceId,
845
801
  datasourceName: meta.table2.datasourceName,
846
- datasourceType: meta.table2.datasourceType,
847
802
  columns: meta.columns
848
803
  }];
849
804
  }
@@ -872,7 +827,6 @@ var JoinData = function JoinData(props) {
872
827
  tableUuid: '',
873
828
  datasourceName: '',
874
829
  datasourceId: '',
875
- datasourceType: '',
876
830
  type: _types.AtomsTypeEnum.FIELD
877
831
  }];
878
832
  store.setMeta(newMeta, groupIndex, {
@@ -969,7 +923,6 @@ var JoinData = function JoinData(props) {
969
923
  tableUuid: '',
970
924
  datasourceName: '',
971
925
  datasourceId: '',
972
- datasourceType: '',
973
926
  type: _types.AtomsTypeEnum.FIELD
974
927
  }];
975
928
  }
@@ -1027,20 +980,23 @@ var JoinData = function JoinData(props) {
1027
980
  });
1028
981
  var items = (0, _utils2.getSubColumns)(newList);
1029
982
  var newColumns = items.flatMap(function (item) {
1030
- return item.columns;
983
+ return item.columns.map(function (column) {
984
+ return (0, _objectSpread2["default"])((0, _objectSpread2["default"])({}, column), {}, {
985
+ tableId: column.tableId || column.id || item.id,
986
+ tableUuid: column.tableUuid || item.tableUuid,
987
+ datasourceId: column.datasourceId || item.datasourceId || ''
988
+ });
989
+ });
1031
990
  }).map(function (v) {
1032
991
  return (0, _objectSpread2["default"])((0, _objectSpread2["default"])({}, v), {}, {
1033
992
  select: false
1034
993
  });
1035
994
  });
1036
995
  newMeta[index].columns = newColumns.map(function (newCol) {
1037
- var _existingCol$select;
1038
996
  var existingCol = newMeta[index].columns.find(function (oldCol) {
1039
- return newCol.fieldUuid && oldCol.fieldUuid === newCol.fieldUuid || newCol.fieldAlias && oldCol.fieldAlias === newCol.fieldAlias || oldCol.name === newCol.name;
1040
- });
1041
- var _column = (0, _objectSpread2["default"])((0, _objectSpread2["default"])({}, newCol), {}, {
1042
- select: (_existingCol$select = existingCol === null || existingCol === void 0 ? void 0 : existingCol.select) !== null && _existingCol$select !== void 0 ? _existingCol$select : newCol.select
997
+ return (0, _helper.isSameColumnByIdFirst)(oldCol, newCol);
1043
998
  });
999
+ var _column = existingCol ? existingCol : newCol;
1044
1000
  _column.select = store.isSelectFields || _column.select;
1045
1001
  return _column;
1046
1002
  });
@@ -1160,7 +1116,6 @@ var JoinData = function JoinData(props) {
1160
1116
  tableUuid: '',
1161
1117
  datasourceName: '',
1162
1118
  datasourceId: '',
1163
- datasourceType: '',
1164
1119
  type: _types.AtomsTypeEnum.FIELD
1165
1120
  }],
1166
1121
  condition: '',
@@ -1177,7 +1132,6 @@ var JoinData = function JoinData(props) {
1177
1132
  tableUuid: '',
1178
1133
  datasourceName: '',
1179
1134
  datasourceId: '',
1180
- datasourceType: '',
1181
1135
  type: _types.AtomsTypeEnum.FIELD
1182
1136
  }],
1183
1137
  type: type
@@ -1301,11 +1255,11 @@ var JoinData = function JoinData(props) {
1301
1255
  }
1302
1256
  };
1303
1257
  var tableIsError = function tableIsError() {
1304
- var _store$preProps4, _meta$table3;
1258
+ var _store$preProps4, _meta$table2;
1305
1259
  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) {
1306
1260
  return v.alias;
1307
1261
  })) || [];
1308
- var tableAlias = (_meta$table3 = meta.table2) === null || _meta$table3 === void 0 ? void 0 : _meta$table3.alias;
1262
+ var tableAlias = (_meta$table2 = meta.table2) === null || _meta$table2 === void 0 ? void 0 : _meta$table2.alias;
1309
1263
  if (tableAlias && aliass.includes(tableAlias) || isDel) {
1310
1264
  return true;
1311
1265
  }
@@ -1388,15 +1342,15 @@ var JoinData = function JoinData(props) {
1388
1342
  size: 'small',
1389
1343
  onClick: function onClick(e) {
1390
1344
  if (store.tableEnableAlias) {
1391
- var _meta$table4;
1345
+ var _meta$table3;
1392
1346
  e.stopPropagation();
1393
- onChangeTableAlias(((_meta$table4 = meta.table2) === null || _meta$table4 === void 0 ? void 0 : _meta$table4.alias) || '');
1347
+ onChangeTableAlias(((_meta$table3 = meta.table2) === null || _meta$table3 === void 0 ? void 0 : _meta$table3.alias) || '');
1394
1348
  }
1395
1349
  }
1396
1350
  })
1397
1351
  }) : null;
1398
1352
  }()
1399
- }), subQuerySelected ? "".concat(((_meta$subquery2 = meta.subquery) === null || _meta$subquery2 === void 0 ? void 0 : _meta$subquery2[0]).table.datasourceName, ".").concat(((_meta$subquery3 = meta.subquery) === null || _meta$subquery3 === void 0 ? void 0 : _meta$subquery3[0]).table.name, " ").concat((_meta$table5 = meta.table2) !== null && _meta$table5 !== void 0 && _meta$table5.alias && store.tableEnableAlias ? "as ".concat((_meta$table6 = meta.table2) === null || _meta$table6 === void 0 ? void 0 : _meta$table6.alias) : '', " ") : (0, _locale.__)('SqlQueryBuilder.setSubQuery')]
1353
+ }), 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')]
1400
1354
  }) : (0, _jsxRuntime.jsxs)("div", {
1401
1355
  className: (0, _classnames["default"])("Sqb-TableName", {
1402
1356
  notSelected: !table2Selected
@@ -1426,15 +1380,15 @@ var JoinData = function JoinData(props) {
1426
1380
  size: 'small',
1427
1381
  onClick: function onClick(e) {
1428
1382
  if (store.tableEnableAlias) {
1429
- var _meta$table7;
1383
+ var _meta$table6;
1430
1384
  e.stopPropagation();
1431
- onChangeTableAlias(((_meta$table7 = meta.table2) === null || _meta$table7 === void 0 ? void 0 : _meta$table7.alias) || '');
1385
+ onChangeTableAlias(((_meta$table6 = meta.table2) === null || _meta$table6 === void 0 ? void 0 : _meta$table6.alias) || '');
1432
1386
  }
1433
1387
  }
1434
1388
  })
1435
1389
  }) : null;
1436
1390
  }()
1437
- }), table2Selected ? "".concat(meta.table2.datasourceName, ".").concat(meta.table2.name, " ").concat((_meta$table8 = meta.table2) !== null && _meta$table8 !== void 0 && _meta$table8.alias && store.tableEnableAlias ? "as ".concat((_meta$table9 = meta.table2) === null || _meta$table9 === void 0 ? void 0 : _meta$table9.alias) : '') : (0, _locale.__)('SqlQueryBuilder.pickTable')]
1391
+ }), 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')]
1438
1392
  }), store.showSubquery && (0, _jsxRuntime.jsx)(_pandora.Tooltip, {
1439
1393
  title: (0, _locale.__)('SqlQueryBuilder.switchSubQuery'),
1440
1394
  children: (0, _jsxRuntime.jsx)(_pandora.Button, {
@@ -1445,7 +1399,7 @@ var JoinData = function JoinData(props) {
1445
1399
  icon: (0, _jsxRuntime.jsx)(_pandoraIcons.RelatedWork, {}),
1446
1400
  onClick: switchSubQuery
1447
1401
  })
1448
- }), ((_meta$table0 = meta.table2) === null || _meta$table0 === void 0 ? void 0 : _meta$table0.name) && ((_meta$table1 = meta.table1) === null || _meta$table1 === void 0 ? void 0 : _meta$table1.name) && ((_meta$expressions = meta.expressions) === null || _meta$expressions === void 0 ? void 0 : _meta$expressions.map(function (v, i) {
1402
+ }), ((_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) {
1449
1403
  if (v.type === _types.AtomsTypeEnum.JOIN_DEFAULT) {
1450
1404
  return (0, _jsxRuntime.jsxs)("div", {
1451
1405
  className: (0, _classnames["default"])("Sqb-where block"),
@@ -1672,7 +1626,7 @@ var JoinData = function JoinData(props) {
1672
1626
  })]
1673
1627
  }, i);
1674
1628
  }
1675
- })), ((_meta$table10 = meta.table2) === null || _meta$table10 === void 0 ? void 0 : _meta$table10.name) && ((_meta$table11 = meta.table1) === null || _meta$table11 === void 0 ? void 0 : _meta$table11.name) && (((_meta$expressions2 = meta.expressions) === null || _meta$expressions2 === void 0 ? void 0 : _meta$expressions2.length) || 0) < 1 && (0, _jsxRuntime.jsx)(_pandora.Tooltip, {
1629
+ })), ((_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 && (0, _jsxRuntime.jsx)(_pandora.Tooltip, {
1676
1630
  title: (0, _locale.__)('SqlQueryBuilder.add'),
1677
1631
  children: (0, _jsxRuntime.jsx)(_pandora.Dropdown, {
1678
1632
  trigger: ['click'],
@@ -41,8 +41,7 @@ var PermissionTable = function PermissionTable(props) {
41
41
  tableUuid: (0, _helper.uuidv4)('table'),
42
42
  alias: prevGroupBy.alias,
43
43
  datasourceId: '',
44
- datasourceName: '',
45
- datasourceType: ''
44
+ datasourceName: ''
46
45
  };
47
46
  data = [_data];
48
47
  var joinData = prevList.filter(function (v) {
@@ -59,8 +58,7 @@ var PermissionTable = function PermissionTable(props) {
59
58
  tableUuid: v.table2.tableUuid,
60
59
  id: v.table2.id,
61
60
  datasourceId: v.table2.datasourceId,
62
- datasourceName: v.table2.datasourceName,
63
- datasourceType: v.table2.datasourceType
61
+ datasourceName: v.table2.datasourceName
64
62
  };
65
63
  }));
66
64
  }
@@ -74,8 +72,7 @@ var PermissionTable = function PermissionTable(props) {
74
72
  id: v.table.id,
75
73
  tableUuid: v.table.tableUuid,
76
74
  datasourceId: v.table.datasourceId,
77
- datasourceName: v.table.datasourceName,
78
- datasourceType: v.table.datasourceType
75
+ datasourceName: v.table.datasourceName
79
76
  });
80
77
  } else if (v.type === _enum.TypeEnum.joinData) {
81
78
  mo.push({
@@ -85,8 +82,7 @@ var PermissionTable = function PermissionTable(props) {
85
82
  id: v.table2.id,
86
83
  tableUuid: v.table2.tableUuid,
87
84
  datasourceId: v.table2.datasourceId,
88
- datasourceName: v.table2.datasourceName,
89
- datasourceType: v.table2.datasourceType
85
+ datasourceName: v.table2.datasourceName
90
86
  });
91
87
  }
92
88
  return mo;
@@ -100,7 +96,7 @@ var PermissionTable = function PermissionTable(props) {
100
96
  data: data,
101
97
  value: meta.table,
102
98
  onChange: function onChange(data) {
103
- if (meta.table.datasourceId !== data.datasourceId || meta.table.name !== data.name) {
99
+ if (!(0, _helper.isSameTableByIdFirst)(meta.table, data)) {
104
100
  meta.table = data;
105
101
  }
106
102
  store.setPopup({
@@ -90,8 +90,7 @@ var Sort = function Sort(props) {
90
90
  id: v.table2.id,
91
91
  columns: v.columns,
92
92
  datasourceId: v.table2.datasourceId,
93
- datasourceName: v.table2.datasourceName,
94
- datasourceType: v.table2.datasourceType
93
+ datasourceName: v.table2.datasourceName
95
94
  };
96
95
  } else {
97
96
  return {
@@ -108,7 +108,6 @@ var GroupByEditor = function GroupByEditor(_ref) {
108
108
  tableUuid: value.tableUuid || '',
109
109
  datasourceName: value.datasourceName || '',
110
110
  datasourceId: value.datasourceId || '',
111
- datasourceType: value.datasourceType || '',
112
111
  type: _types.AtomsTypeEnum.FIELD
113
112
  };
114
113
  return [fieldAtom];
@@ -228,7 +227,6 @@ var GroupBy = function GroupBy(props) {
228
227
  tableUuid: v.table2.tableUuid,
229
228
  datasourceId: v.table2.datasourceId,
230
229
  datasourceName: v.table2.datasourceName,
231
- datasourceType: v.table2.datasourceType,
232
230
  columns: v.columns
233
231
  };
234
232
  }));
@@ -244,7 +242,6 @@ var GroupBy = function GroupBy(props) {
244
242
  tableUuid: v.table.tableUuid,
245
243
  datasourceId: v.table.datasourceId,
246
244
  datasourceName: v.table.datasourceName,
247
- datasourceType: v.table.datasourceType,
248
245
  columns: v.columns
249
246
  };
250
247
  } else if (v.type === _enum.TypeEnum.joinData) {
@@ -256,7 +253,6 @@ var GroupBy = function GroupBy(props) {
256
253
  tableUuid: v.table2.tableUuid,
257
254
  datasourceId: v.table2.datasourceId,
258
255
  datasourceName: v.table2.datasourceName,
259
- datasourceType: v.table2.datasourceType,
260
256
  columns: v.columns
261
257
  };
262
258
  } else {
@@ -315,7 +311,6 @@ var GroupBy = function GroupBy(props) {
315
311
  quotes: '',
316
312
  datasourceId: '',
317
313
  datasourceName: '',
318
- datasourceType: '',
319
314
  atoms: [],
320
315
  summarizeType: _types.MetaSummarize_Enum.BY
321
316
  };
@@ -402,8 +397,7 @@ var GroupBy = function GroupBy(props) {
402
397
  tableUuid: v.tableUuid,
403
398
  alias: v.alias,
404
399
  datasourceName: '',
405
- datasourceId: '',
406
- datasourceType: ''
400
+ datasourceId: ''
407
401
  });
408
402
  });
409
403
  };
@@ -422,7 +416,6 @@ var GroupBy = function GroupBy(props) {
422
416
  tableUuid: v.tableUuid,
423
417
  datasourceName: '',
424
418
  datasourceId: '',
425
- datasourceType: '',
426
419
  type: _types.AtomsTypeEnum.FIELD
427
420
  });
428
421
  };
@@ -204,7 +204,6 @@ var SelectIndex = function SelectIndex(props) {
204
204
  quotes: '',
205
205
  datasourceId: '',
206
206
  datasourceName: '',
207
- datasourceType: '',
208
207
  summarizeType: _types.MetaSummarize_Enum.GROUP
209
208
  };
210
209
  store.setPopup2({
@@ -308,8 +307,7 @@ var SelectIndex = function SelectIndex(props) {
308
307
  tableUuid: v.tableUuid,
309
308
  alias: v.alias,
310
309
  datasourceName: '',
311
- datasourceId: '',
312
- datasourceType: ''
310
+ datasourceId: ''
313
311
  });
314
312
  });
315
313
  };
@@ -328,7 +326,6 @@ var SelectIndex = function SelectIndex(props) {
328
326
  tableUuid: v.tableUuid,
329
327
  datasourceName: '',
330
328
  datasourceId: '',
331
- datasourceType: '',
332
329
  type: _types.AtomsTypeEnum.FIELD
333
330
  });
334
331
  };