@gingkoo/pandora-metabase 1.0.130 → 1.0.132

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 +45 -88
  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 +46 -89
  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,28 +477,15 @@ 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
- var alias = (0, _helper.getAlias)(tableName, newMeta, ((_store$preProps = store.preProps) === null || _store$preProps === void 0 ? void 0 : _store$preProps.notExistsColumns) || []);
485
+ var aliasMetaList = newMeta.filter(function (_, i) {
486
+ return i !== index;
487
+ });
488
+ var alias = (0, _helper.getAlias)(tableName, aliasMetaList, ((_store$preProps = store.preProps) === null || _store$preProps === void 0 ? void 0 : _store$preProps.notExistsColumns) || []);
518
489
  var _table2 = (0, _objectSpread2["default"])((0, _objectSpread2["default"])({}, data), {}, {
519
490
  name: tableName,
520
491
  tableUuid: data.tableUuid || (0, _helper.uuidv4)('table'),
@@ -523,8 +494,7 @@ var JoinData = function JoinData(props) {
523
494
  fieldUuid: '',
524
495
  quotes: '',
525
496
  datasourceId: data.datasourceId,
526
- datasourceName: data.datasourceName,
527
- datasourceType: data.datasourceType
497
+ datasourceName: data.datasourceName
528
498
  });
529
499
  newMeta[index].table2 = _table2;
530
500
  initExpressions(newMeta);
@@ -562,7 +532,6 @@ var JoinData = function JoinData(props) {
562
532
  tableUuid: '',
563
533
  datasourceName: '',
564
534
  datasourceId: '',
565
- datasourceType: '',
566
535
  type: _types.AtomsTypeEnum.FIELD
567
536
  }],
568
537
  condition: '',
@@ -579,7 +548,6 @@ var JoinData = function JoinData(props) {
579
548
  tableUuid: '',
580
549
  datasourceName: '',
581
550
  datasourceId: '',
582
- datasourceType: '',
583
551
  type: _types.AtomsTypeEnum.FIELD
584
552
  }],
585
553
  type: _types.AtomsTypeEnum.JOIN_DEFAULT
@@ -624,7 +592,6 @@ var JoinData = function JoinData(props) {
624
592
  alias: prevGroupBy.alias,
625
593
  datasourceId: '',
626
594
  datasourceName: '',
627
- datasourceType: '',
628
595
  columns: []
629
596
  };
630
597
  if (prevGroupBy !== null && prevGroupBy !== void 0 && (_prevGroupBy$group4 = prevGroupBy.group) !== null && _prevGroupBy$group4 !== void 0 && _prevGroupBy$group4.length) {
@@ -669,7 +636,6 @@ var JoinData = function JoinData(props) {
669
636
  tableUuid: v.table2.tableUuid || (0, _helper.uuidv4)('table'),
670
637
  datasourceId: v.table2.datasourceId,
671
638
  datasourceName: v.table2.datasourceName,
672
- datasourceType: v.table2.datasourceType,
673
639
  columns: v.columns
674
640
  };
675
641
  }));
@@ -685,8 +651,7 @@ var JoinData = function JoinData(props) {
685
651
  tableUuid: v.table.tableUuid || (0, _helper.uuidv4)('table'),
686
652
  columns: v.columns,
687
653
  datasourceId: v.table.datasourceId,
688
- datasourceName: v.table.datasourceName,
689
- datasourceType: v.table.datasourceType
654
+ datasourceName: v.table.datasourceName
690
655
  });
691
656
  } else if (v.type === _enum.TypeEnum.joinData) {
692
657
  mo.push({
@@ -697,8 +662,7 @@ var JoinData = function JoinData(props) {
697
662
  tableUuid: v.table2.tableUuid || (0, _helper.uuidv4)('table'),
698
663
  columns: v.columns,
699
664
  datasourceId: v.table2.datasourceId,
700
- datasourceName: v.table2.datasourceName,
701
- datasourceType: v.table2.datasourceType
665
+ datasourceName: v.table2.datasourceName
702
666
  });
703
667
  }
704
668
  return mo;
@@ -719,7 +683,6 @@ var JoinData = function JoinData(props) {
719
683
  tableUuid: meta.table2.tableUuid || (0, _helper.uuidv4)('table'),
720
684
  datasourceId: meta.table2.datasourceId,
721
685
  datasourceName: meta.table2.datasourceName,
722
- datasourceType: meta.table2.datasourceType,
723
686
  columns: meta.columns
724
687
  }];
725
688
  }
@@ -748,7 +711,6 @@ var JoinData = function JoinData(props) {
748
711
  alias: prevGroupBy.alias,
749
712
  datasourceId: '',
750
713
  datasourceName: '',
751
- datasourceType: '',
752
714
  columns: []
753
715
  };
754
716
  if (prevGroupBy !== null && prevGroupBy !== void 0 && (_prevGroupBy$group5 = prevGroupBy.group) !== null && _prevGroupBy$group5 !== void 0 && _prevGroupBy$group5.length) {
@@ -793,7 +755,6 @@ var JoinData = function JoinData(props) {
793
755
  tableUuid: v.table2.tableUuid || (0, _helper.uuidv4)('table'),
794
756
  datasourceId: v.table2.datasourceId,
795
757
  datasourceName: v.table2.datasourceName,
796
- datasourceType: v.table2.datasourceType,
797
758
  columns: v.columns
798
759
  };
799
760
  }));
@@ -809,8 +770,7 @@ var JoinData = function JoinData(props) {
809
770
  tableUuid: v.table.tableUuid || (0, _helper.uuidv4)('table'),
810
771
  columns: v.columns,
811
772
  datasourceId: v.table.datasourceId,
812
- datasourceName: v.table.datasourceName,
813
- datasourceType: v.table.datasourceType
773
+ datasourceName: v.table.datasourceName
814
774
  });
815
775
  } else if (v.type === _enum.TypeEnum.joinData) {
816
776
  mo.push({
@@ -821,8 +781,7 @@ var JoinData = function JoinData(props) {
821
781
  tableUuid: v.table2.tableUuid || (0, _helper.uuidv4)('table'),
822
782
  columns: v.columns,
823
783
  datasourceId: v.table2.datasourceId,
824
- datasourceName: v.table2.datasourceName,
825
- datasourceType: v.table2.datasourceType
784
+ datasourceName: v.table2.datasourceName
826
785
  });
827
786
  }
828
787
  return mo;
@@ -843,7 +802,6 @@ var JoinData = function JoinData(props) {
843
802
  tableUuid: meta.table2.tableUuid || (0, _helper.uuidv4)('table'),
844
803
  datasourceId: meta.table2.datasourceId,
845
804
  datasourceName: meta.table2.datasourceName,
846
- datasourceType: meta.table2.datasourceType,
847
805
  columns: meta.columns
848
806
  }];
849
807
  }
@@ -872,7 +830,6 @@ var JoinData = function JoinData(props) {
872
830
  tableUuid: '',
873
831
  datasourceName: '',
874
832
  datasourceId: '',
875
- datasourceType: '',
876
833
  type: _types.AtomsTypeEnum.FIELD
877
834
  }];
878
835
  store.setMeta(newMeta, groupIndex, {
@@ -969,7 +926,6 @@ var JoinData = function JoinData(props) {
969
926
  tableUuid: '',
970
927
  datasourceName: '',
971
928
  datasourceId: '',
972
- datasourceType: '',
973
929
  type: _types.AtomsTypeEnum.FIELD
974
930
  }];
975
931
  }
@@ -1027,20 +983,23 @@ var JoinData = function JoinData(props) {
1027
983
  });
1028
984
  var items = (0, _utils2.getSubColumns)(newList);
1029
985
  var newColumns = items.flatMap(function (item) {
1030
- return item.columns;
986
+ return item.columns.map(function (column) {
987
+ return (0, _objectSpread2["default"])((0, _objectSpread2["default"])({}, column), {}, {
988
+ tableId: column.tableId || column.id || item.id,
989
+ tableUuid: column.tableUuid || item.tableUuid,
990
+ datasourceId: column.datasourceId || item.datasourceId || ''
991
+ });
992
+ });
1031
993
  }).map(function (v) {
1032
994
  return (0, _objectSpread2["default"])((0, _objectSpread2["default"])({}, v), {}, {
1033
995
  select: false
1034
996
  });
1035
997
  });
1036
998
  newMeta[index].columns = newColumns.map(function (newCol) {
1037
- var _existingCol$select;
1038
999
  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
1000
+ return (0, _helper.isSameColumnByIdFirst)(oldCol, newCol);
1043
1001
  });
1002
+ var _column = existingCol ? existingCol : newCol;
1044
1003
  _column.select = store.isSelectFields || _column.select;
1045
1004
  return _column;
1046
1005
  });
@@ -1160,7 +1119,6 @@ var JoinData = function JoinData(props) {
1160
1119
  tableUuid: '',
1161
1120
  datasourceName: '',
1162
1121
  datasourceId: '',
1163
- datasourceType: '',
1164
1122
  type: _types.AtomsTypeEnum.FIELD
1165
1123
  }],
1166
1124
  condition: '',
@@ -1177,7 +1135,6 @@ var JoinData = function JoinData(props) {
1177
1135
  tableUuid: '',
1178
1136
  datasourceName: '',
1179
1137
  datasourceId: '',
1180
- datasourceType: '',
1181
1138
  type: _types.AtomsTypeEnum.FIELD
1182
1139
  }],
1183
1140
  type: type
@@ -1301,11 +1258,11 @@ var JoinData = function JoinData(props) {
1301
1258
  }
1302
1259
  };
1303
1260
  var tableIsError = function tableIsError() {
1304
- var _store$preProps4, _meta$table3;
1261
+ var _store$preProps4, _meta$table2;
1305
1262
  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
1263
  return v.alias;
1307
1264
  })) || [];
1308
- var tableAlias = (_meta$table3 = meta.table2) === null || _meta$table3 === void 0 ? void 0 : _meta$table3.alias;
1265
+ var tableAlias = (_meta$table2 = meta.table2) === null || _meta$table2 === void 0 ? void 0 : _meta$table2.alias;
1309
1266
  if (tableAlias && aliass.includes(tableAlias) || isDel) {
1310
1267
  return true;
1311
1268
  }
@@ -1388,15 +1345,15 @@ var JoinData = function JoinData(props) {
1388
1345
  size: 'small',
1389
1346
  onClick: function onClick(e) {
1390
1347
  if (store.tableEnableAlias) {
1391
- var _meta$table4;
1348
+ var _meta$table3;
1392
1349
  e.stopPropagation();
1393
- onChangeTableAlias(((_meta$table4 = meta.table2) === null || _meta$table4 === void 0 ? void 0 : _meta$table4.alias) || '');
1350
+ onChangeTableAlias(((_meta$table3 = meta.table2) === null || _meta$table3 === void 0 ? void 0 : _meta$table3.alias) || '');
1394
1351
  }
1395
1352
  }
1396
1353
  })
1397
1354
  }) : null;
1398
1355
  }()
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')]
1356
+ }), 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
1357
  }) : (0, _jsxRuntime.jsxs)("div", {
1401
1358
  className: (0, _classnames["default"])("Sqb-TableName", {
1402
1359
  notSelected: !table2Selected
@@ -1426,15 +1383,15 @@ var JoinData = function JoinData(props) {
1426
1383
  size: 'small',
1427
1384
  onClick: function onClick(e) {
1428
1385
  if (store.tableEnableAlias) {
1429
- var _meta$table7;
1386
+ var _meta$table6;
1430
1387
  e.stopPropagation();
1431
- onChangeTableAlias(((_meta$table7 = meta.table2) === null || _meta$table7 === void 0 ? void 0 : _meta$table7.alias) || '');
1388
+ onChangeTableAlias(((_meta$table6 = meta.table2) === null || _meta$table6 === void 0 ? void 0 : _meta$table6.alias) || '');
1432
1389
  }
1433
1390
  }
1434
1391
  })
1435
1392
  }) : null;
1436
1393
  }()
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')]
1394
+ }), 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
1395
  }), store.showSubquery && (0, _jsxRuntime.jsx)(_pandora.Tooltip, {
1439
1396
  title: (0, _locale.__)('SqlQueryBuilder.switchSubQuery'),
1440
1397
  children: (0, _jsxRuntime.jsx)(_pandora.Button, {
@@ -1445,7 +1402,7 @@ var JoinData = function JoinData(props) {
1445
1402
  icon: (0, _jsxRuntime.jsx)(_pandoraIcons.RelatedWork, {}),
1446
1403
  onClick: switchSubQuery
1447
1404
  })
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) {
1405
+ }), ((_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
1406
  if (v.type === _types.AtomsTypeEnum.JOIN_DEFAULT) {
1450
1407
  return (0, _jsxRuntime.jsxs)("div", {
1451
1408
  className: (0, _classnames["default"])("Sqb-where block"),
@@ -1672,7 +1629,7 @@ var JoinData = function JoinData(props) {
1672
1629
  })]
1673
1630
  }, i);
1674
1631
  }
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, {
1632
+ })), ((_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
1633
  title: (0, _locale.__)('SqlQueryBuilder.add'),
1677
1634
  children: (0, _jsxRuntime.jsx)(_pandora.Dropdown, {
1678
1635
  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
  };