@gingkoo/pandora-metabase 1.0.126 → 1.0.127

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 +15 -5
  2. package/lib/cjs/components/dialog/expression/index.less +31 -16
  3. package/lib/cjs/components/dialog/formula-list/CaseWhenGroup.d.ts +14 -5
  4. package/lib/cjs/components/dialog/formula-list/CaseWhenGroup.js +236 -62
  5. package/lib/cjs/components/dialog/formula-list/LogicGroup.d.ts +3 -2
  6. package/lib/cjs/components/dialog/formula-list/LogicGroup.js +19 -11
  7. package/lib/cjs/components/dialog/formula-list/index.d.ts +1 -0
  8. package/lib/cjs/components/dialog/formula-list/index.js +658 -174
  9. package/lib/cjs/components/dialog/formula-list/index.less +1438 -145
  10. package/lib/cjs/components/dialog/formula-list/utils.js +50 -19
  11. package/lib/cjs/components/dialog/select-column-multiple/index.d.ts +1 -0
  12. package/lib/cjs/components/dialog/select-column-multiple/index.js +42 -22
  13. package/lib/cjs/components/dialog/select-summarize/index.js +10 -2
  14. package/lib/cjs/components/dialog/select-table/index.d.ts +2 -1
  15. package/lib/cjs/components/dialog/select-table/index.js +197 -52
  16. package/lib/cjs/components/dialog/select-table/index.less +45 -2
  17. package/lib/cjs/components/metabase/index.less +156 -39
  18. package/lib/cjs/components/modules/custom-column.js +7 -3
  19. package/lib/cjs/components/modules/filter.js +6 -3
  20. package/lib/cjs/components/modules/join-data.js +62 -14
  21. package/lib/cjs/components/modules/permission-table.js +8 -4
  22. package/lib/cjs/components/modules/sort.js +2 -1
  23. package/lib/cjs/components/modules/summarize/group-by.js +20 -6
  24. package/lib/cjs/components/modules/summarize/select-index.js +9 -5
  25. package/lib/cjs/components/modules/table-data.js +21 -3
  26. package/lib/cjs/hooks/use-state.js +143 -17
  27. package/lib/cjs/index.js +7 -1
  28. package/lib/cjs/store/types.d.ts +14 -7
  29. package/lib/cjs/types.d.ts +8 -0
  30. package/lib/cjs/utils/transformSql.js +44 -21
  31. package/lib/cjs/utils.d.ts +2 -2
  32. package/lib/cjs/utils.js +347 -56
  33. package/lib/es/components/dialog/expression/index.js +15 -5
  34. package/lib/es/components/dialog/expression/index.less +31 -16
  35. package/lib/es/components/dialog/formula-list/CaseWhenGroup.d.ts +14 -5
  36. package/lib/es/components/dialog/formula-list/CaseWhenGroup.js +238 -64
  37. package/lib/es/components/dialog/formula-list/LogicGroup.d.ts +3 -2
  38. package/lib/es/components/dialog/formula-list/LogicGroup.js +19 -11
  39. package/lib/es/components/dialog/formula-list/index.d.ts +1 -0
  40. package/lib/es/components/dialog/formula-list/index.js +660 -176
  41. package/lib/es/components/dialog/formula-list/index.less +1438 -145
  42. package/lib/es/components/dialog/formula-list/utils.js +50 -19
  43. package/lib/es/components/dialog/select-column-multiple/index.d.ts +1 -0
  44. package/lib/es/components/dialog/select-column-multiple/index.js +42 -22
  45. package/lib/es/components/dialog/select-summarize/index.js +10 -2
  46. package/lib/es/components/dialog/select-table/index.d.ts +2 -1
  47. package/lib/es/components/dialog/select-table/index.js +197 -52
  48. package/lib/es/components/dialog/select-table/index.less +45 -2
  49. package/lib/es/components/metabase/index.less +156 -39
  50. package/lib/es/components/modules/custom-column.js +7 -3
  51. package/lib/es/components/modules/filter.js +6 -3
  52. package/lib/es/components/modules/join-data.js +62 -14
  53. package/lib/es/components/modules/permission-table.js +8 -4
  54. package/lib/es/components/modules/sort.js +2 -1
  55. package/lib/es/components/modules/summarize/group-by.js +21 -7
  56. package/lib/es/components/modules/summarize/select-index.js +10 -6
  57. package/lib/es/components/modules/table-data.js +21 -3
  58. package/lib/es/hooks/use-state.js +143 -17
  59. package/lib/es/index.js +7 -1
  60. package/lib/es/store/types.d.ts +14 -7
  61. package/lib/es/types.d.ts +8 -0
  62. package/lib/es/utils/transformSql.js +45 -22
  63. package/lib/es/utils.d.ts +2 -2
  64. package/lib/es/utils.js +348 -57
  65. package/package.json +1 -1
@@ -106,7 +106,7 @@ 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);
109
+ return store === null || store === void 0 ? void 0 : store.fetchDataset(meta.table2.datasourceId, meta.table2.datasourceType);
110
110
  case 2:
111
111
  tables = _context.sent;
112
112
  names = (tables === null || tables === void 0 ? void 0 : tables.map(function (v) {
@@ -148,6 +148,7 @@ var JoinData = function JoinData(props) {
148
148
  name_zh: prevGroupBy.alias,
149
149
  datasourceId: '',
150
150
  datasourceName: '',
151
+ datasourceType: '',
151
152
  columns: []
152
153
  };
153
154
  if (prevGroupBy !== null && prevGroupBy !== void 0 && (_prevGroupBy$group = prevGroupBy.group) !== null && _prevGroupBy$group !== void 0 && _prevGroupBy$group.length) {
@@ -192,6 +193,7 @@ var JoinData = function JoinData(props) {
192
193
  tableUuid: v.table2.tableUuid || (0, _helper.uuidv4)('table'),
193
194
  datasourceId: v.table2.datasourceId,
194
195
  datasourceName: v.table2.datasourceName,
196
+ datasourceType: v.table2.datasourceType,
195
197
  columns: v.columns || []
196
198
  };
197
199
  }));
@@ -207,7 +209,8 @@ var JoinData = function JoinData(props) {
207
209
  tableUuid: v.table.tableUuid || (0, _helper.uuidv4)('table'),
208
210
  columns: v.columns,
209
211
  datasourceId: v.table.datasourceId,
210
- datasourceName: v.table.datasourceName
212
+ datasourceName: v.table.datasourceName,
213
+ datasourceType: v.table.datasourceType
211
214
  }));
212
215
  } else if (v.type === _enum.TypeEnum.joinData) {
213
216
  mo.push({
@@ -218,7 +221,8 @@ var JoinData = function JoinData(props) {
218
221
  tableUuid: v.table2.tableUuid || (0, _helper.uuidv4)('table'),
219
222
  columns: v.columns,
220
223
  datasourceId: v.table2.datasourceId,
221
- datasourceName: v.table2.datasourceName
224
+ datasourceName: v.table2.datasourceName,
225
+ datasourceType: v.table2.datasourceType
222
226
  });
223
227
  }
224
228
  return mo;
@@ -234,6 +238,7 @@ var JoinData = function JoinData(props) {
234
238
  tableUuid: meta.table2.tableUuid || (0, _helper.uuidv4)('table'),
235
239
  datasourceId: meta.table2.datasourceId,
236
240
  datasourceName: meta.table2.datasourceName,
241
+ datasourceType: meta.table2.datasourceType,
237
242
  columns: meta.columns
238
243
  }]);
239
244
  var newMeta = store.metaList[groupIndex].list.slice();
@@ -258,6 +263,7 @@ var JoinData = function JoinData(props) {
258
263
  name_zh: prevGroupBy.alias,
259
264
  datasourceId: '',
260
265
  datasourceName: '',
266
+ datasourceType: '',
261
267
  columns: []
262
268
  };
263
269
  if (prevGroupBy !== null && prevGroupBy !== void 0 && (_prevGroupBy$group2 = prevGroupBy.group) !== null && _prevGroupBy$group2 !== void 0 && _prevGroupBy$group2.length) {
@@ -302,6 +308,7 @@ var JoinData = function JoinData(props) {
302
308
  tableUuid: v.table2.tableUuid || (0, _helper.uuidv4)('table'),
303
309
  datasourceId: v.table2.datasourceId,
304
310
  datasourceName: v.table2.datasourceName,
311
+ datasourceType: v.table2.datasourceType,
305
312
  columns: v.columns || []
306
313
  };
307
314
  }));
@@ -317,7 +324,8 @@ var JoinData = function JoinData(props) {
317
324
  tableUuid: v.table.tableUuid || (0, _helper.uuidv4)('table'),
318
325
  columns: v.columns,
319
326
  datasourceId: v.table.datasourceId,
320
- datasourceName: v.table.datasourceName
327
+ datasourceName: v.table.datasourceName,
328
+ datasourceType: v.table.datasourceType
321
329
  }));
322
330
  } else if (v.type === _enum.TypeEnum.joinData) {
323
331
  mo.push({
@@ -328,7 +336,8 @@ var JoinData = function JoinData(props) {
328
336
  tableUuid: v.table2.tableUuid || (0, _helper.uuidv4)('table'),
329
337
  columns: v.columns,
330
338
  datasourceId: v.table2.datasourceId,
331
- datasourceName: v.table2.datasourceName
339
+ datasourceName: v.table2.datasourceName,
340
+ datasourceType: v.table2.datasourceType
332
341
  });
333
342
  }
334
343
  return mo;
@@ -342,6 +351,7 @@ var JoinData = function JoinData(props) {
342
351
  tableUuid: meta.table2.tableUuid || (0, _helper.uuidv4)('table'),
343
352
  datasourceId: meta.table2.datasourceId,
344
353
  datasourceName: meta.table2.datasourceName,
354
+ datasourceType: meta.table2.datasourceType,
345
355
  columns: meta.columns
346
356
  }]);
347
357
  return data;
@@ -386,7 +396,8 @@ var JoinData = function JoinData(props) {
386
396
  name: prevGroupBy.alias,
387
397
  name_zh: prevGroupBy.alias,
388
398
  datasourceId: '',
389
- datasourceName: ''
399
+ datasourceName: '',
400
+ datasourceType: ''
390
401
  };
391
402
  if (prevGroupBy !== null && prevGroupBy !== void 0 && (_prevGroupBy$group3 = prevGroupBy.group) !== null && _prevGroupBy$group3 !== void 0 && _prevGroupBy$group3.length) {}
392
403
  if (prevGroupBy !== null && prevGroupBy !== void 0 && (_prevGroupBy$by3 = prevGroupBy.by) !== null && _prevGroupBy$by3 !== void 0 && _prevGroupBy$by3.length) {}
@@ -406,6 +417,7 @@ var JoinData = function JoinData(props) {
406
417
  tableUuid: v.table2.tableUuid || (0, _helper.uuidv4)('table'),
407
418
  datasourceId: v.table2.datasourceId,
408
419
  datasourceName: v.table2.datasourceName,
420
+ datasourceType: v.table2.datasourceType,
409
421
  columns: []
410
422
  };
411
423
  }));
@@ -421,7 +433,8 @@ var JoinData = function JoinData(props) {
421
433
  tableUuid: v.table.tableUuid || (0, _helper.uuidv4)('table'),
422
434
  columns: [],
423
435
  datasourceId: v.table.datasourceId,
424
- datasourceName: v.table.datasourceName
436
+ datasourceName: v.table.datasourceName,
437
+ datasourceType: v.table.datasourceType
425
438
  });
426
439
  } else if (v.type === _enum.TypeEnum.joinData) {
427
440
  mo.push({
@@ -432,7 +445,8 @@ var JoinData = function JoinData(props) {
432
445
  tableUuid: v.table2.tableUuid || (0, _helper.uuidv4)('table'),
433
446
  columns: [],
434
447
  datasourceId: v.table2.datasourceId,
435
- datasourceName: v.table2.datasourceName
448
+ datasourceName: v.table2.datasourceName,
449
+ datasourceType: v.table2.datasourceType
436
450
  });
437
451
  }
438
452
  return mo;
@@ -468,6 +482,7 @@ var JoinData = function JoinData(props) {
468
482
  alias: meta.table2.alias,
469
483
  datasourceId: meta.table2.datasourceId,
470
484
  datasourceName: meta.table2.datasourceName,
485
+ datasourceType: meta.table2.datasourceType,
471
486
  tableUuid: meta.table2.tableUuid || ''
472
487
  };
473
488
  !meta.readonly && store.setPopup({
@@ -478,9 +493,25 @@ var JoinData = function JoinData(props) {
478
493
  tableFlat: store.tableFlat,
479
494
  data: store.sourceList,
480
495
  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
+ },
481
512
  onChange: function onChange(data) {
482
513
  var tableName = data.name;
483
- if (meta.table2.name !== tableName || meta.table2.datasourceId !== data.datasourceId) {
514
+ if (meta.table2.name !== tableName || meta.table2.datasourceId !== data.datasourceId || meta.table2.datasourceType !== data.datasourceType) {
484
515
  var _store$preProps;
485
516
  var newMeta = (0, _cloneDeep["default"])(store.metaList[groupIndex].list);
486
517
  var alias = (0, _helper.getAlias)(tableName, newMeta, ((_store$preProps = store.preProps) === null || _store$preProps === void 0 ? void 0 : _store$preProps.notExistsColumns) || []);
@@ -492,7 +523,8 @@ var JoinData = function JoinData(props) {
492
523
  fieldUuid: '',
493
524
  quotes: '',
494
525
  datasourceId: data.datasourceId,
495
- datasourceName: data.datasourceName
526
+ datasourceName: data.datasourceName,
527
+ datasourceType: data.datasourceType
496
528
  });
497
529
  newMeta[index].table2 = _table2;
498
530
  initExpressions(newMeta);
@@ -530,6 +562,7 @@ var JoinData = function JoinData(props) {
530
562
  tableUuid: '',
531
563
  datasourceName: '',
532
564
  datasourceId: '',
565
+ datasourceType: '',
533
566
  type: _types.AtomsTypeEnum.FIELD
534
567
  }],
535
568
  condition: '',
@@ -546,6 +579,7 @@ var JoinData = function JoinData(props) {
546
579
  tableUuid: '',
547
580
  datasourceName: '',
548
581
  datasourceId: '',
582
+ datasourceType: '',
549
583
  type: _types.AtomsTypeEnum.FIELD
550
584
  }],
551
585
  type: _types.AtomsTypeEnum.JOIN_DEFAULT
@@ -590,6 +624,7 @@ var JoinData = function JoinData(props) {
590
624
  alias: prevGroupBy.alias,
591
625
  datasourceId: '',
592
626
  datasourceName: '',
627
+ datasourceType: '',
593
628
  columns: []
594
629
  };
595
630
  if (prevGroupBy !== null && prevGroupBy !== void 0 && (_prevGroupBy$group4 = prevGroupBy.group) !== null && _prevGroupBy$group4 !== void 0 && _prevGroupBy$group4.length) {
@@ -634,6 +669,7 @@ var JoinData = function JoinData(props) {
634
669
  tableUuid: v.table2.tableUuid || (0, _helper.uuidv4)('table'),
635
670
  datasourceId: v.table2.datasourceId,
636
671
  datasourceName: v.table2.datasourceName,
672
+ datasourceType: v.table2.datasourceType,
637
673
  columns: v.columns
638
674
  };
639
675
  }));
@@ -649,7 +685,8 @@ var JoinData = function JoinData(props) {
649
685
  tableUuid: v.table.tableUuid || (0, _helper.uuidv4)('table'),
650
686
  columns: v.columns,
651
687
  datasourceId: v.table.datasourceId,
652
- datasourceName: v.table.datasourceName
688
+ datasourceName: v.table.datasourceName,
689
+ datasourceType: v.table.datasourceType
653
690
  });
654
691
  } else if (v.type === _enum.TypeEnum.joinData) {
655
692
  mo.push({
@@ -660,7 +697,8 @@ var JoinData = function JoinData(props) {
660
697
  tableUuid: v.table2.tableUuid || (0, _helper.uuidv4)('table'),
661
698
  columns: v.columns,
662
699
  datasourceId: v.table2.datasourceId,
663
- datasourceName: v.table2.datasourceName
700
+ datasourceName: v.table2.datasourceName,
701
+ datasourceType: v.table2.datasourceType
664
702
  });
665
703
  }
666
704
  return mo;
@@ -681,6 +719,7 @@ var JoinData = function JoinData(props) {
681
719
  tableUuid: meta.table2.tableUuid || (0, _helper.uuidv4)('table'),
682
720
  datasourceId: meta.table2.datasourceId,
683
721
  datasourceName: meta.table2.datasourceName,
722
+ datasourceType: meta.table2.datasourceType,
684
723
  columns: meta.columns
685
724
  }];
686
725
  }
@@ -709,6 +748,7 @@ var JoinData = function JoinData(props) {
709
748
  alias: prevGroupBy.alias,
710
749
  datasourceId: '',
711
750
  datasourceName: '',
751
+ datasourceType: '',
712
752
  columns: []
713
753
  };
714
754
  if (prevGroupBy !== null && prevGroupBy !== void 0 && (_prevGroupBy$group5 = prevGroupBy.group) !== null && _prevGroupBy$group5 !== void 0 && _prevGroupBy$group5.length) {
@@ -753,6 +793,7 @@ var JoinData = function JoinData(props) {
753
793
  tableUuid: v.table2.tableUuid || (0, _helper.uuidv4)('table'),
754
794
  datasourceId: v.table2.datasourceId,
755
795
  datasourceName: v.table2.datasourceName,
796
+ datasourceType: v.table2.datasourceType,
756
797
  columns: v.columns
757
798
  };
758
799
  }));
@@ -768,7 +809,8 @@ var JoinData = function JoinData(props) {
768
809
  tableUuid: v.table.tableUuid || (0, _helper.uuidv4)('table'),
769
810
  columns: v.columns,
770
811
  datasourceId: v.table.datasourceId,
771
- datasourceName: v.table.datasourceName
812
+ datasourceName: v.table.datasourceName,
813
+ datasourceType: v.table.datasourceType
772
814
  });
773
815
  } else if (v.type === _enum.TypeEnum.joinData) {
774
816
  mo.push({
@@ -779,7 +821,8 @@ var JoinData = function JoinData(props) {
779
821
  tableUuid: v.table2.tableUuid || (0, _helper.uuidv4)('table'),
780
822
  columns: v.columns,
781
823
  datasourceId: v.table2.datasourceId,
782
- datasourceName: v.table2.datasourceName
824
+ datasourceName: v.table2.datasourceName,
825
+ datasourceType: v.table2.datasourceType
783
826
  });
784
827
  }
785
828
  return mo;
@@ -800,6 +843,7 @@ var JoinData = function JoinData(props) {
800
843
  tableUuid: meta.table2.tableUuid || (0, _helper.uuidv4)('table'),
801
844
  datasourceId: meta.table2.datasourceId,
802
845
  datasourceName: meta.table2.datasourceName,
846
+ datasourceType: meta.table2.datasourceType,
803
847
  columns: meta.columns
804
848
  }];
805
849
  }
@@ -828,6 +872,7 @@ var JoinData = function JoinData(props) {
828
872
  tableUuid: '',
829
873
  datasourceName: '',
830
874
  datasourceId: '',
875
+ datasourceType: '',
831
876
  type: _types.AtomsTypeEnum.FIELD
832
877
  }];
833
878
  store.setMeta(newMeta, groupIndex, {
@@ -924,6 +969,7 @@ var JoinData = function JoinData(props) {
924
969
  tableUuid: '',
925
970
  datasourceName: '',
926
971
  datasourceId: '',
972
+ datasourceType: '',
927
973
  type: _types.AtomsTypeEnum.FIELD
928
974
  }];
929
975
  }
@@ -1111,6 +1157,7 @@ var JoinData = function JoinData(props) {
1111
1157
  tableUuid: '',
1112
1158
  datasourceName: '',
1113
1159
  datasourceId: '',
1160
+ datasourceType: '',
1114
1161
  type: _types.AtomsTypeEnum.FIELD
1115
1162
  }],
1116
1163
  condition: '',
@@ -1127,6 +1174,7 @@ var JoinData = function JoinData(props) {
1127
1174
  tableUuid: '',
1128
1175
  datasourceName: '',
1129
1176
  datasourceId: '',
1177
+ datasourceType: '',
1130
1178
  type: _types.AtomsTypeEnum.FIELD
1131
1179
  }],
1132
1180
  type: type
@@ -41,7 +41,8 @@ var PermissionTable = function PermissionTable(props) {
41
41
  tableUuid: (0, _helper.uuidv4)('table'),
42
42
  alias: prevGroupBy.alias,
43
43
  datasourceId: '',
44
- datasourceName: ''
44
+ datasourceName: '',
45
+ datasourceType: ''
45
46
  };
46
47
  data = [_data];
47
48
  var joinData = prevList.filter(function (v) {
@@ -58,7 +59,8 @@ var PermissionTable = function PermissionTable(props) {
58
59
  tableUuid: v.table2.tableUuid,
59
60
  id: v.table2.id,
60
61
  datasourceId: v.table2.datasourceId,
61
- datasourceName: v.table2.datasourceName
62
+ datasourceName: v.table2.datasourceName,
63
+ datasourceType: v.table2.datasourceType
62
64
  };
63
65
  }));
64
66
  }
@@ -72,7 +74,8 @@ var PermissionTable = function PermissionTable(props) {
72
74
  id: v.table.id,
73
75
  tableUuid: v.table.tableUuid,
74
76
  datasourceId: v.table.datasourceId,
75
- datasourceName: v.table.datasourceName
77
+ datasourceName: v.table.datasourceName,
78
+ datasourceType: v.table.datasourceType
76
79
  });
77
80
  } else if (v.type === _enum.TypeEnum.joinData) {
78
81
  mo.push({
@@ -82,7 +85,8 @@ var PermissionTable = function PermissionTable(props) {
82
85
  id: v.table2.id,
83
86
  tableUuid: v.table2.tableUuid,
84
87
  datasourceId: v.table2.datasourceId,
85
- datasourceName: v.table2.datasourceName
88
+ datasourceName: v.table2.datasourceName,
89
+ datasourceType: v.table2.datasourceType
86
90
  });
87
91
  }
88
92
  return mo;
@@ -90,7 +90,8 @@ 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
93
+ datasourceName: v.table2.datasourceName,
94
+ datasourceType: v.table2.datasourceType
94
95
  };
95
96
  } else {
96
97
  return {
@@ -45,7 +45,13 @@ var _getSummaryText = function getSummaryText() {
45
45
  return [lhs, item.condition, rhs].filter(Boolean).join(' ').trim();
46
46
  }
47
47
  if (item.type === _types.AtomsTypeEnum.AND_OR) {
48
- return "".concat(item.operator || 'and', " ( ").concat(_getSummaryText(item.list || []), " )").replace(/\s+/g, ' ').trim();
48
+ var hasBinarySides = Array.isArray(item.leftAtoms) || Array.isArray(item.rightAtoms);
49
+ if (hasBinarySides) {
50
+ var leftText = _getSummaryText(item.leftAtoms || []);
51
+ var rightText = _getSummaryText(item.rightAtoms || []);
52
+ return "( ".concat(leftText, " ").concat(item.operator || 'and', " ").concat(rightText, " )").replace(/\s+/g, ' ').trim();
53
+ }
54
+ return "".concat(item.operator || 'and', " ( ").concat(_getSummaryText(item.atoms || []), " )").replace(/\s+/g, ' ').trim();
49
55
  }
50
56
  if (item.type === _types.AtomsTypeEnum.CASE_WHEN) {
51
57
  return item.quotes || 'case when';
@@ -102,6 +108,7 @@ var GroupByEditor = function GroupByEditor(_ref) {
102
108
  tableUuid: value.tableUuid || '',
103
109
  datasourceName: value.datasourceName || '',
104
110
  datasourceId: value.datasourceId || '',
111
+ datasourceType: value.datasourceType || '',
105
112
  type: _types.AtomsTypeEnum.FIELD
106
113
  };
107
114
  return [fieldAtom];
@@ -221,6 +228,7 @@ var GroupBy = function GroupBy(props) {
221
228
  tableUuid: v.table2.tableUuid,
222
229
  datasourceId: v.table2.datasourceId,
223
230
  datasourceName: v.table2.datasourceName,
231
+ datasourceType: v.table2.datasourceType,
224
232
  columns: v.columns
225
233
  };
226
234
  }));
@@ -236,6 +244,7 @@ var GroupBy = function GroupBy(props) {
236
244
  tableUuid: v.table.tableUuid,
237
245
  datasourceId: v.table.datasourceId,
238
246
  datasourceName: v.table.datasourceName,
247
+ datasourceType: v.table.datasourceType,
239
248
  columns: v.columns
240
249
  };
241
250
  } else if (v.type === _enum.TypeEnum.joinData) {
@@ -247,6 +256,7 @@ var GroupBy = function GroupBy(props) {
247
256
  tableUuid: v.table2.tableUuid,
248
257
  datasourceId: v.table2.datasourceId,
249
258
  datasourceName: v.table2.datasourceName,
259
+ datasourceType: v.table2.datasourceType,
250
260
  columns: v.columns
251
261
  };
252
262
  } else {
@@ -305,6 +315,7 @@ var GroupBy = function GroupBy(props) {
305
315
  quotes: '',
306
316
  datasourceId: '',
307
317
  datasourceName: '',
318
+ datasourceType: '',
308
319
  atoms: [],
309
320
  summarizeType: _types.MetaSummarize_Enum.BY
310
321
  };
@@ -365,6 +376,7 @@ var GroupBy = function GroupBy(props) {
365
376
  newMeta = store.metaList[groupIndex].list.slice();
366
377
  newMeta[index].by[i].fieldAlias = fieldAlias;
367
378
  newMeta[index].by[i].sql = (0, _helper2.summarizeByToSql)(newMeta[index].by[i]);
379
+ newMeta = (0, _utils.changeFieldAlias)(newMeta, newMeta[index].by[i]);
368
380
  store.setMeta(newMeta, groupIndex, {
369
381
  obj: newMeta[index].by,
370
382
  type: _types.ChangeType.by
@@ -390,7 +402,8 @@ var GroupBy = function GroupBy(props) {
390
402
  tableUuid: v.tableUuid,
391
403
  alias: v.alias,
392
404
  datasourceName: '',
393
- datasourceId: ''
405
+ datasourceId: '',
406
+ datasourceType: ''
394
407
  });
395
408
  });
396
409
  };
@@ -409,6 +422,7 @@ var GroupBy = function GroupBy(props) {
409
422
  tableUuid: v.tableUuid,
410
423
  datasourceName: '',
411
424
  datasourceId: '',
425
+ datasourceType: '',
412
426
  type: _types.AtomsTypeEnum.FIELD
413
427
  });
414
428
  };
@@ -432,13 +446,13 @@ var GroupBy = function GroupBy(props) {
432
446
  if (_found) return _found;
433
447
  }
434
448
  if (item.type === _types.AtomsTypeEnum.AND_OR) {
435
- var _found2 = _getFirstField(item.list || []);
449
+ var _found2 = _getFirstField([].concat((0, _toConsumableArray2["default"])(item.leftAtoms || []), (0, _toConsumableArray2["default"])(item.rightAtoms || []), (0, _toConsumableArray2["default"])(item.atoms || [])));
436
450
  if (_found2) return _found2;
437
451
  }
438
452
  if (item.type === _types.AtomsTypeEnum.CASE_WHEN) {
439
- var _found3 = _getFirstField(item.caseValue || []) || (item.branches || []).map(function (branch) {
440
- return _getFirstField([].concat((0, _toConsumableArray2["default"])(branch.when || []), (0, _toConsumableArray2["default"])(branch.then || [])));
441
- }).find(Boolean) || _getFirstField(item.elseValue || []);
453
+ var _found3 = _getFirstField(item.caseAtoms || []) || (item.whenClauses || []).map(function (branch) {
454
+ return _getFirstField([].concat((0, _toConsumableArray2["default"])(branch.whenAtoms || []), (0, _toConsumableArray2["default"])(branch.thenAtoms || [])));
455
+ }).find(Boolean) || _getFirstField(item.elseAtoms || []);
442
456
  if (_found3) return _found3;
443
457
  }
444
458
  if (item.type === _types.AtomsTypeEnum.EXISTS || item.type === _types.AtomsTypeEnum.NOT_EXISTS) {
@@ -204,6 +204,7 @@ var SelectIndex = function SelectIndex(props) {
204
204
  quotes: '',
205
205
  datasourceId: '',
206
206
  datasourceName: '',
207
+ datasourceType: '',
207
208
  summarizeType: _types.MetaSummarize_Enum.GROUP
208
209
  };
209
210
  store.setPopup2({
@@ -281,6 +282,7 @@ var SelectIndex = function SelectIndex(props) {
281
282
  newMeta = store.metaList[groupIndex].list.slice();
282
283
  newMeta[index].group[i].fieldAlias = fieldAlias;
283
284
  newMeta[index].group[i].sql = newMeta[index].group[i].sql.split('AS ')[0] + "AS ".concat(fieldAlias);
285
+ newMeta = (0, _utils.changeFieldAlias)(newMeta, newMeta[index].group[i]);
284
286
  store.setMeta(newMeta, groupIndex, {
285
287
  obj: newMeta[index].group,
286
288
  type: _types.ChangeType.group
@@ -306,7 +308,8 @@ var SelectIndex = function SelectIndex(props) {
306
308
  tableUuid: v.tableUuid,
307
309
  alias: v.alias,
308
310
  datasourceName: '',
309
- datasourceId: ''
311
+ datasourceId: '',
312
+ datasourceType: ''
310
313
  });
311
314
  });
312
315
  };
@@ -325,6 +328,7 @@ var SelectIndex = function SelectIndex(props) {
325
328
  tableUuid: v.tableUuid,
326
329
  datasourceName: '',
327
330
  datasourceId: '',
331
+ datasourceType: '',
328
332
  type: _types.AtomsTypeEnum.FIELD
329
333
  });
330
334
  };
@@ -351,13 +355,13 @@ var SelectIndex = function SelectIndex(props) {
351
355
  if (_found) return _found;
352
356
  }
353
357
  if (item.type === _types.AtomsTypeEnum.AND_OR) {
354
- var _found2 = _getFirstField(item.list || []);
358
+ var _found2 = _getFirstField([].concat((0, _toConsumableArray2["default"])(item.leftAtoms || []), (0, _toConsumableArray2["default"])(item.rightAtoms || []), (0, _toConsumableArray2["default"])(item.atoms || [])));
355
359
  if (_found2) return _found2;
356
360
  }
357
361
  if (item.type === _types.AtomsTypeEnum.CASE_WHEN) {
358
- var _found3 = _getFirstField(item.caseValue || []) || (item.branches || []).map(function (branch) {
359
- return _getFirstField([].concat((0, _toConsumableArray2["default"])(branch.when || []), (0, _toConsumableArray2["default"])(branch.then || [])));
360
- }).find(Boolean) || _getFirstField(item.elseValue || []);
362
+ var _found3 = _getFirstField(item.caseAtoms || []) || (item.whenClauses || []).map(function (branch) {
363
+ return _getFirstField([].concat((0, _toConsumableArray2["default"])(branch.whenAtoms || []), (0, _toConsumableArray2["default"])(branch.thenAtoms || [])));
364
+ }).find(Boolean) || _getFirstField(item.elseAtoms || []);
361
365
  if (_found3) return _found3;
362
366
  }
363
367
  if (item.type === _types.AtomsTypeEnum.EXISTS || item.type === _types.AtomsTypeEnum.NOT_EXISTS) {
@@ -59,7 +59,7 @@ var TableData = function TableData(props) {
59
59
  return _context.abrupt("return");
60
60
  case 1:
61
61
  _context.next = 2;
62
- return store === null || store === void 0 ? void 0 : store.fetchDataset(meta.table.datasourceId);
62
+ return store === null || store === void 0 ? void 0 : store.fetchDataset(meta.table.datasourceId, meta.table.datasourceType);
63
63
  case 2:
64
64
  tables = _context.sent;
65
65
  names = (tables === null || tables === void 0 ? void 0 : tables.map(function (v) {
@@ -94,8 +94,25 @@ var TableData = function TableData(props) {
94
94
  data: store.sourceList,
95
95
  sourceTable: store.sourceTable || [],
96
96
  value: meta.table,
97
+ onDatasourceTypeChange: function onDatasourceTypeChange(data) {
98
+ var newMetas = store.metaList[groupIndex].list.slice();
99
+ var newMetaList = newMetas[0];
100
+ newMetaList.table = (0, _objectSpread2["default"])((0, _objectSpread2["default"])((0, _objectSpread2["default"])({}, newMetaList.table), data), {}, {
101
+ datasourceType: data.datasourceType
102
+ });
103
+ newMetaList.columns = newMetaList.columns.map(function (column) {
104
+ return (0, _objectSpread2["default"])((0, _objectSpread2["default"])({}, column), {}, {
105
+ datasourceType: data.datasourceType
106
+ });
107
+ });
108
+ newMetas[0] = newMetaList;
109
+ store.setMeta(newMetas, groupIndex, {
110
+ obj: data,
111
+ type: _types.ChangeType.datasource
112
+ });
113
+ },
97
114
  onChange: function onChange(data) {
98
- if (meta.table.datasourceId !== data.datasourceId || meta.table.name !== data.name) {
115
+ if (meta.table.datasourceId !== data.datasourceId || meta.table.datasourceType !== data.datasourceType || meta.table.name !== data.name) {
99
116
  var _store$preProps;
100
117
  var newMetaList = store.metaList[groupIndex].list.slice()[0];
101
118
  newMetaList.table = (0, _objectSpread2["default"])((0, _objectSpread2["default"])({}, data), {}, {
@@ -264,7 +281,8 @@ var TableData = function TableData(props) {
264
281
  id: '',
265
282
  alias: '',
266
283
  datasourceName: '',
267
- datasourceId: ''
284
+ datasourceId: '',
285
+ datasourceType: ''
268
286
  };
269
287
  store.setMeta(newMetaList, groupIndex);
270
288
  };