@gingkoo/pandora-metabase 1.0.88 → 1.0.89

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 (53) hide show
  1. package/lib/cjs/common/SplitView/index.js +12 -11
  2. package/lib/cjs/components/dialog/custom-column/expression-editor.js +2 -1
  3. package/lib/cjs/components/dialog/custom-column/tokenizedI-input.js +2 -1
  4. package/lib/cjs/components/dialog/expression/index.js +12 -11
  5. package/lib/cjs/components/dialog/formula/index.js +22 -15
  6. package/lib/cjs/components/dialog/formula/utils.js +5 -2
  7. package/lib/cjs/components/dialog/formula-list/index.js +31 -27
  8. package/lib/cjs/components/dialog/formula-list/index.less +5 -0
  9. package/lib/cjs/components/dialog/index.js +2 -2
  10. package/lib/cjs/components/dialog/select-column/index.js +4 -4
  11. package/lib/cjs/components/dialog/select-join-column/index.js +3 -3
  12. package/lib/cjs/components/dialog/select-table/index.js +13 -12
  13. package/lib/cjs/components/icons.js +36 -36
  14. package/lib/cjs/components/metabase/index.js +9 -9
  15. package/lib/cjs/components/metabase/index.less +1 -1
  16. package/lib/cjs/components/modules/components/Wrapper.js +6 -6
  17. package/lib/cjs/components/modules/components/header.js +4 -4
  18. package/lib/cjs/components/modules/components/meta-icon.js +2 -1
  19. package/lib/cjs/components/modules/custom-column.js +8 -8
  20. package/lib/cjs/components/modules/filter.js +4 -4
  21. package/lib/cjs/components/modules/join-data.js +13 -13
  22. package/lib/cjs/components/modules/summarize/group-by.js +4 -4
  23. package/lib/cjs/components/modules/summarize/select-index.js +4 -4
  24. package/lib/cjs/components/modules/table-data.js +10 -10
  25. package/lib/cjs/components/popup.js +2 -1
  26. package/lib/cjs/hooks/use-state.js +125 -112
  27. package/lib/cjs/index.js +2 -1
  28. package/lib/cjs/store/types.d.ts +2 -0
  29. package/lib/cjs/utils/transformSql.js +8 -8
  30. package/lib/es/common/SplitView/index.js +10 -10
  31. package/lib/es/components/dialog/expression/index.js +10 -10
  32. package/lib/es/components/dialog/formula/index.js +20 -14
  33. package/lib/es/components/dialog/formula/utils.js +5 -2
  34. package/lib/es/components/dialog/formula-list/index.js +29 -26
  35. package/lib/es/components/dialog/formula-list/index.less +5 -0
  36. package/lib/es/components/dialog/select-column/index.js +4 -4
  37. package/lib/es/components/dialog/select-join-column/index.js +3 -3
  38. package/lib/es/components/dialog/select-table/index.js +11 -11
  39. package/lib/es/components/icons.js +36 -36
  40. package/lib/es/components/metabase/index.js +9 -9
  41. package/lib/es/components/metabase/index.less +1 -1
  42. package/lib/es/components/modules/components/Wrapper.js +6 -6
  43. package/lib/es/components/modules/components/header.js +4 -4
  44. package/lib/es/components/modules/custom-column.js +8 -8
  45. package/lib/es/components/modules/filter.js +4 -4
  46. package/lib/es/components/modules/join-data.js +13 -13
  47. package/lib/es/components/modules/summarize/group-by.js +4 -4
  48. package/lib/es/components/modules/summarize/select-index.js +4 -4
  49. package/lib/es/components/modules/table-data.js +10 -10
  50. package/lib/es/hooks/use-state.js +125 -112
  51. package/lib/es/store/types.d.ts +2 -0
  52. package/lib/es/utils/transformSql.js +8 -8
  53. package/package.json +1 -1
@@ -90,9 +90,9 @@ var FormulaList = forwardRef(function (props, ref) {
90
90
  setOldCode(getPreviewStr(caseList));
91
91
  }, []);
92
92
  var _useState9 = useState(''),
93
- _useState0 = _slicedToArray(_useState9, 2),
94
- filterVal = _useState0[0],
95
- setFilterVal = _useState0[1];
93
+ _useState10 = _slicedToArray(_useState9, 2),
94
+ filterVal = _useState10[0],
95
+ setFilterVal = _useState10[1];
96
96
  var setCaseList = function setCaseList(data) {
97
97
  var quotes = data.map(function (v, i) {
98
98
  if (v !== null && v !== void 0 && v.quotes) {
@@ -107,35 +107,35 @@ var FormulaList = forwardRef(function (props, ref) {
107
107
  caseList = data;
108
108
  caseListRef.current = data;
109
109
  };
110
- var _useState1 = useState(-1),
111
- _useState10 = _slicedToArray(_useState1, 2),
112
- ind = _useState10[0],
113
- setInd = _useState10[1];
110
+ var _useState11 = useState(-1),
111
+ _useState12 = _slicedToArray(_useState11, 2),
112
+ ind = _useState12[0],
113
+ setInd = _useState12[1];
114
114
  var filterCustomType = store.filterCustomType;
115
115
  var _ref = useRef(null);
116
- var _useState11 = useState({
116
+ var _useState13 = useState({
117
117
  isError: false
118
118
  }),
119
- _useState12 = _slicedToArray(_useState11, 2),
120
- errorInfo = _useState12[0],
121
- setErrorInfo = _useState12[1];
122
- var _useState13 = useState(false),
123
119
  _useState14 = _slicedToArray(_useState13, 2),
124
- isCheck = _useState14[0],
125
- setIsCheck = _useState14[1];
126
- var myInstanceIdRef = useRef(Math.random().toString(36).slice(2));
127
- var _useState15 = useState(!!window.__sqb_selection_active__),
120
+ errorInfo = _useState14[0],
121
+ setErrorInfo = _useState14[1];
122
+ var _useState15 = useState(false),
128
123
  _useState16 = _slicedToArray(_useState15, 2),
129
- globalSelectionActive = _useState16[0],
130
- setGlobalSelectionActive = _useState16[1];
131
- var _useState17 = useState(window.__sqb_selection_owner__ || null),
124
+ isCheck = _useState16[0],
125
+ setIsCheck = _useState16[1];
126
+ var myInstanceIdRef = useRef(Math.random().toString(36).slice(2));
127
+ var _useState17 = useState(!!window.__sqb_selection_active__),
132
128
  _useState18 = _slicedToArray(_useState17, 2),
133
- globalSelectionOwner = _useState18[0],
134
- setGlobalSelectionOwner = _useState18[1];
135
- var _useState19 = useState([]),
129
+ globalSelectionActive = _useState18[0],
130
+ setGlobalSelectionActive = _useState18[1];
131
+ var _useState19 = useState(window.__sqb_selection_owner__ || null),
136
132
  _useState20 = _slicedToArray(_useState19, 2),
137
- selectedIndices = _useState20[0],
138
- setSelectedIndices = _useState20[1];
133
+ globalSelectionOwner = _useState20[0],
134
+ setGlobalSelectionOwner = _useState20[1];
135
+ var _useState21 = useState([]),
136
+ _useState22 = _slicedToArray(_useState21, 2),
137
+ selectedIndices = _useState22[0],
138
+ setSelectedIndices = _useState22[1];
139
139
  useEffect(function () {
140
140
  var leftBrackets = caseList.filter(function (v) {
141
141
  return v.type === AtomsTypeEnum.OPERATOR && v.val === '(';
@@ -373,7 +373,7 @@ var FormulaList = forwardRef(function (props, ref) {
373
373
  onOk: function () {
374
374
  var _onOk = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
375
375
  var _caseList;
376
- return _regeneratorRuntime.wrap(function (_context) {
376
+ return _regeneratorRuntime.wrap(function _callee$(_context) {
377
377
  while (1) switch (_context.prev = _context.next) {
378
378
  case 0:
379
379
  _caseList = caseList.slice(); // 删除选中项,selectedIndices 已经是排序好的了
@@ -382,7 +382,7 @@ var FormulaList = forwardRef(function (props, ref) {
382
382
  });
383
383
  setCaseList(_caseList);
384
384
  initPaste();
385
- case 1:
385
+ case 4:
386
386
  case "end":
387
387
  return _context.stop();
388
388
  }
@@ -947,6 +947,9 @@ var FormulaList = forwardRef(function (props, ref) {
947
947
  style: {
948
948
  pointerEvents: isCheck || store.isMetabaseCopy ? 'none' : 'auto'
949
949
  },
950
+ className: cx({
951
+ openCheck: isCheck
952
+ }),
950
953
  children: itemDom(v, i)
951
954
  }), selectOperator({
952
955
  triggerElement: function triggerElement(value) {
@@ -35,6 +35,11 @@
35
35
  // transform: none;
36
36
  // }
37
37
  // }
38
+ .openCheck {
39
+ .Sqb-TableName {
40
+ padding-left: 20px;
41
+ }
42
+ }
38
43
  &.item-selected {
39
44
  .item-check {
40
45
  display: block;
@@ -102,16 +102,16 @@ var SelectColumn = function SelectColumn(_ref) {
102
102
  onOk: function () {
103
103
  var _onOk = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
104
104
  var newColumns, newMetaList;
105
- return _regeneratorRuntime.wrap(function (_context) {
105
+ return _regeneratorRuntime.wrap(function _callee$(_context) {
106
106
  while (1) switch (_context.prev = _context.next) {
107
107
  case 0:
108
108
  if (isValidSQLAlias(fieldAlias)) {
109
- _context.next = 1;
109
+ _context.next = 3;
110
110
  break;
111
111
  }
112
112
  Toast.warning(__('SqlQueryBuilder.aliasForRules'));
113
113
  return _context.abrupt("return", false);
114
- case 1:
114
+ case 3:
115
115
  newColumns = cloneDeep(columns);
116
116
  newMetaList = store.metaList[groupIndex].list.slice();
117
117
  newColumns[i].fieldAlias = fieldAlias;
@@ -125,7 +125,7 @@ var SelectColumn = function SelectColumn(_ref) {
125
125
  setTimeout(function () {
126
126
  store.setClosable(true);
127
127
  }, 0);
128
- case 2:
128
+ case 11:
129
129
  case "end":
130
130
  return _context.stop();
131
131
  }
@@ -73,9 +73,9 @@ var SelectJoinColumn = function SelectJoinColumn(_ref) {
73
73
  columns: v.columns.slice()
74
74
  });
75
75
  })),
76
- _useState0 = _slicedToArray(_useState9, 2),
77
- tableList = _useState0[0],
78
- setTableList = _useState0[1];
76
+ _useState10 = _slicedToArray(_useState9, 2),
77
+ tableList = _useState10[0],
78
+ setTableList = _useState10[1];
79
79
  useEffect(function () {
80
80
  setValue(_value);
81
81
  setCurColumn(_value.name);
@@ -47,13 +47,13 @@ var SelectTable = function SelectTable(_ref) {
47
47
  list = _useState8[0],
48
48
  setList = _useState8[1];
49
49
  var _useState9 = useState([]),
50
- _useState0 = _slicedToArray(_useState9, 2),
51
- originList = _useState0[0],
52
- setOriginList = _useState0[1];
53
- var _useState1 = useState(value),
54
- _useState10 = _slicedToArray(_useState1, 2),
55
- val = _useState10[0],
56
- setVal = _useState10[1];
50
+ _useState10 = _slicedToArray(_useState9, 2),
51
+ originList = _useState10[0],
52
+ setOriginList = _useState10[1];
53
+ var _useState11 = useState(value),
54
+ _useState12 = _slicedToArray(_useState11, 2),
55
+ val = _useState12[0],
56
+ setVal = _useState12[1];
57
57
  useEffect(function () {
58
58
  if (value.datasourceId) {
59
59
  getTables(value.datasourceId);
@@ -65,18 +65,18 @@ var SelectTable = function SelectTable(_ref) {
65
65
  function _getTables() {
66
66
  _getTables = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(datasourceId) {
67
67
  var tables;
68
- return _regeneratorRuntime.wrap(function (_context) {
68
+ return _regeneratorRuntime.wrap(function _callee$(_context) {
69
69
  while (1) switch (_context.prev = _context.next) {
70
70
  case 0:
71
71
  setLoading(true);
72
- _context.next = 1;
72
+ _context.next = 3;
73
73
  return store.fetchDataset(datasourceId);
74
- case 1:
74
+ case 3:
75
75
  tables = _context.sent;
76
76
  setLoading(false);
77
77
  setList(tables);
78
78
  setOriginList(tables);
79
- case 2:
79
+ case 7:
80
80
  case "end":
81
81
  return _context.stop();
82
82
  }
@@ -169,12 +169,12 @@ export var LeftJoinIcon = function LeftJoinIcon(_ref9) {
169
169
  })
170
170
  });
171
171
  };
172
- export var InnerJoinIcon = function InnerJoinIcon(_ref0) {
173
- var _ref0$width = _ref0.width,
174
- width = _ref0$width === void 0 ? 32 : _ref0$width,
175
- _ref0$height = _ref0.height,
176
- height = _ref0$height === void 0 ? 32 : _ref0$height,
177
- style = _ref0.style;
172
+ export var InnerJoinIcon = function InnerJoinIcon(_ref10) {
173
+ var _ref10$width = _ref10.width,
174
+ width = _ref10$width === void 0 ? 32 : _ref10$width,
175
+ _ref10$height = _ref10.height,
176
+ height = _ref10$height === void 0 ? 32 : _ref10$height,
177
+ style = _ref10.style;
178
178
  return _jsx("svg", {
179
179
  viewBox: '0 0 32 32',
180
180
  width: width,
@@ -188,11 +188,11 @@ export var InnerJoinIcon = function InnerJoinIcon(_ref0) {
188
188
  })
189
189
  });
190
190
  };
191
- export var UpArrowIcon = function UpArrowIcon(_ref1) {
192
- var _ref1$width = _ref1.width,
193
- width = _ref1$width === void 0 ? 16 : _ref1$width,
194
- _ref1$height = _ref1.height,
195
- height = _ref1$height === void 0 ? 17 : _ref1$height;
191
+ export var UpArrowIcon = function UpArrowIcon(_ref11) {
192
+ var _ref11$width = _ref11.width,
193
+ width = _ref11$width === void 0 ? 16 : _ref11$width,
194
+ _ref11$height = _ref11.height,
195
+ height = _ref11$height === void 0 ? 17 : _ref11$height;
196
196
  return _jsx("svg", {
197
197
  className: 'sort-arrow',
198
198
  viewBox: '0 0 32 34',
@@ -206,11 +206,11 @@ export var UpArrowIcon = function UpArrowIcon(_ref1) {
206
206
  })
207
207
  });
208
208
  };
209
- export var DownArrowIcon = function DownArrowIcon(_ref10) {
210
- var _ref10$width = _ref10.width,
211
- width = _ref10$width === void 0 ? 16 : _ref10$width,
212
- _ref10$height = _ref10.height,
213
- height = _ref10$height === void 0 ? 17 : _ref10$height;
209
+ export var DownArrowIcon = function DownArrowIcon(_ref12) {
210
+ var _ref12$width = _ref12.width,
211
+ width = _ref12$width === void 0 ? 16 : _ref12$width,
212
+ _ref12$height = _ref12.height,
213
+ height = _ref12$height === void 0 ? 17 : _ref12$height;
214
214
  return _jsx("svg", {
215
215
  className: 'sort-arrow',
216
216
  viewBox: '0 0 32 34',
@@ -224,11 +224,11 @@ export var DownArrowIcon = function DownArrowIcon(_ref10) {
224
224
  })
225
225
  });
226
226
  };
227
- export var CloseIcon = function CloseIcon(_ref11) {
228
- var _ref11$width = _ref11.width,
229
- width = _ref11$width === void 0 ? 16 : _ref11$width,
230
- _ref11$height = _ref11.height,
231
- height = _ref11$height === void 0 ? 16 : _ref11$height;
227
+ export var CloseIcon = function CloseIcon(_ref13) {
228
+ var _ref13$width = _ref13.width,
229
+ width = _ref13$width === void 0 ? 16 : _ref13$width,
230
+ _ref13$height = _ref13.height,
231
+ height = _ref13$height === void 0 ? 16 : _ref13$height;
232
232
  return _jsx("svg", {
233
233
  className: 'closeIcon',
234
234
  viewBox: '0 0 32 32',
@@ -242,11 +242,11 @@ export var CloseIcon = function CloseIcon(_ref11) {
242
242
  })
243
243
  });
244
244
  };
245
- export var AddIcon = function AddIcon(_ref12) {
246
- var _ref12$width = _ref12.width,
247
- width = _ref12$width === void 0 ? 16 : _ref12$width,
248
- _ref12$height = _ref12.height,
249
- height = _ref12$height === void 0 ? 16 : _ref12$height;
245
+ export var AddIcon = function AddIcon(_ref14) {
246
+ var _ref14$width = _ref14.width,
247
+ width = _ref14$width === void 0 ? 16 : _ref14$width,
248
+ _ref14$height = _ref14.height,
249
+ height = _ref14$height === void 0 ? 16 : _ref14$height;
250
250
  return _jsx("svg", {
251
251
  viewBox: '0 0 32 32',
252
252
  width: width,
@@ -259,11 +259,11 @@ export var AddIcon = function AddIcon(_ref12) {
259
259
  })
260
260
  });
261
261
  };
262
- export var TableIcon = function TableIcon(_ref13) {
263
- var _ref13$width = _ref13.width,
264
- width = _ref13$width === void 0 ? 18 : _ref13$width,
265
- _ref13$height = _ref13.height,
266
- height = _ref13$height === void 0 ? 18 : _ref13$height;
262
+ export var TableIcon = function TableIcon(_ref15) {
263
+ var _ref15$width = _ref15.width,
264
+ width = _ref15$width === void 0 ? 18 : _ref15$width,
265
+ _ref15$height = _ref15.height,
266
+ height = _ref15$height === void 0 ? 18 : _ref15$height;
267
267
  return _jsx("svg", {
268
268
  viewBox: '0 0 32 32',
269
269
  width: width,
@@ -276,11 +276,11 @@ export var TableIcon = function TableIcon(_ref13) {
276
276
  })
277
277
  });
278
278
  };
279
- export var SearchIcon = function SearchIcon(_ref14) {
280
- var _ref14$width = _ref14.width,
281
- width = _ref14$width === void 0 ? 16 : _ref14$width,
282
- _ref14$height = _ref14.height,
283
- height = _ref14$height === void 0 ? 16 : _ref14$height;
279
+ export var SearchIcon = function SearchIcon(_ref16) {
280
+ var _ref16$width = _ref16.width,
281
+ width = _ref16$width === void 0 ? 16 : _ref16$width,
282
+ _ref16$height = _ref16.height,
283
+ height = _ref16$height === void 0 ? 16 : _ref16$height;
284
284
  return _jsx("svg", {
285
285
  viewBox: '0 0 32 32',
286
286
  width: width,
@@ -72,12 +72,12 @@ var Metabase = function Metabase(props) {
72
72
  content: __('metabase.validationFailed'),
73
73
  onOk: function () {
74
74
  var _onOk = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
75
- return _regeneratorRuntime.wrap(function (_context) {
75
+ return _regeneratorRuntime.wrap(function _callee$(_context) {
76
76
  while (1) switch (_context.prev = _context.next) {
77
77
  case 0:
78
- _context.next = 1;
78
+ _context.next = 2;
79
79
  return onSave();
80
- case 1:
80
+ case 2:
81
81
  case "end":
82
82
  return _context.stop();
83
83
  }
@@ -96,7 +96,7 @@ var Metabase = function Metabase(props) {
96
96
  var onSave = /*#__PURE__*/function () {
97
97
  var _ref = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
98
98
  var intercept, _metaList;
99
- return _regeneratorRuntime.wrap(function (_context2) {
99
+ return _regeneratorRuntime.wrap(function _callee2$(_context2) {
100
100
  while (1) switch (_context2.prev = _context2.next) {
101
101
  case 0:
102
102
  intercept = false; // 是否返回
@@ -110,17 +110,17 @@ var Metabase = function Metabase(props) {
110
110
  }
111
111
  });
112
112
  if (!(saveLoading || intercept)) {
113
- _context2.next = 1;
113
+ _context2.next = 6;
114
114
  break;
115
115
  }
116
116
  return _context2.abrupt("return", null);
117
- case 1:
117
+ case 6:
118
118
  setSaveLoading(true);
119
- _context2.next = 2;
119
+ _context2.next = 9;
120
120
  return onOk === null || onOk === void 0 ? void 0 : onOk(_metaList);
121
- case 2:
121
+ case 9:
122
122
  setSaveLoading(false);
123
- case 3:
123
+ case 10:
124
124
  case "end":
125
125
  return _context2.stop();
126
126
  }
@@ -16,7 +16,7 @@
16
16
  &-fun-btns {
17
17
  position: absolute;
18
18
  left: 0;
19
- top: 7px;
19
+ top: 2px;
20
20
  display: flex;
21
21
  justify-content: end;
22
22
  width: 66.6667%;
@@ -25,19 +25,19 @@ var Wrapper = function Wrapper(_ref) {
25
25
  function _animation() {
26
26
  _animation = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
27
27
  var _couterRef$current;
28
- return _regeneratorRuntime.wrap(function (_context) {
28
+ return _regeneratorRuntime.wrap(function _callee$(_context) {
29
29
  while (1) switch (_context.prev = _context.next) {
30
30
  case 0:
31
- _context.next = 1;
31
+ _context.next = 2;
32
32
  return sleep(10);
33
- case 1:
33
+ case 2:
34
34
  setOpacity(1);
35
35
  ((_couterRef$current = couterRef.current) === null || _couterRef$current === void 0 || (_couterRef$current = _couterRef$current.childNodes) === null || _couterRef$current === void 0 ? void 0 : _couterRef$current.length) && setMaxHeight(couterRef.current.childNodes[0].clientHeight + 16);
36
- _context.next = 2;
36
+ _context.next = 6;
37
37
  return sleep(500);
38
- case 2:
38
+ case 6:
39
39
  setMaxHeight('auto');
40
- case 3:
40
+ case 7:
41
41
  case "end":
42
42
  return _context.stop();
43
43
  }
@@ -16,14 +16,14 @@ var Header = function Header(props) {
16
16
  var diff = /*#__PURE__*/function () {
17
17
  var _ref = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
18
18
  var _oldMeta, _newMeta, _yield$store$getModul, oldCode, newCode, o;
19
- return _regeneratorRuntime.wrap(function (_context) {
19
+ return _regeneratorRuntime.wrap(function _callee$(_context) {
20
20
  while (1) switch (_context.prev = _context.next) {
21
21
  case 0:
22
22
  _oldMeta = store.sourceData.slice();
23
23
  _newMeta = splitByUnion(store.metaList);
24
- _context.next = 1;
24
+ _context.next = 4;
25
25
  return store.getModuleDiffCode(_oldMeta, _newMeta);
26
- case 1:
26
+ case 4:
27
27
  _yield$store$getModul = _context.sent;
28
28
  oldCode = _yield$store$getModul.oldCode;
29
29
  newCode = _yield$store$getModul.newCode;
@@ -36,7 +36,7 @@ var Header = function Header(props) {
36
36
  }),
37
37
  onClose: function onClose() {}
38
38
  });
39
- case 2:
39
+ case 8:
40
40
  case "end":
41
41
  return _context.stop();
42
42
  }
@@ -74,14 +74,14 @@ var CustomColumn = function CustomColumn(props) {
74
74
  function _handleUpdate() {
75
75
  _handleUpdate = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(e, i) {
76
76
  var node, newMeta, value, columns;
77
- return _regeneratorRuntime.wrap(function (_context) {
77
+ return _regeneratorRuntime.wrap(function _callee$(_context) {
78
78
  while (1) switch (_context.prev = _context.next) {
79
79
  case 0:
80
80
  node = e.currentTarget;
81
81
  closePopup();
82
- _context.next = 1;
82
+ _context.next = 4;
83
83
  return sleep(100);
84
- case 1:
84
+ case 4:
85
85
  newMeta = store.metaList[groupIndex].list.slice();
86
86
  value = customColumn[i];
87
87
  columns = getAvailableColumns();
@@ -106,7 +106,7 @@ var CustomColumn = function CustomColumn(props) {
106
106
  onClose: closePopup
107
107
  })
108
108
  });
109
- case 2:
109
+ case 8:
110
110
  case "end":
111
111
  return _context.stop();
112
112
  }
@@ -176,8 +176,8 @@ var CustomColumn = function CustomColumn(props) {
176
176
  tableId: v.table2.id,
177
177
  tableUuid: v.table2.tableUuid || uuidv4('table'),
178
178
  columns: v.columns,
179
- datasourceId: mainTable.table.datasourceId,
180
- datasourceName: mainTable.table.datasourceName
179
+ datasourceId: v.table2.datasourceId,
180
+ datasourceName: v.table2.datasourceName
181
181
  });
182
182
  }));
183
183
  }
@@ -200,8 +200,8 @@ var CustomColumn = function CustomColumn(props) {
200
200
  tableId: v.table2.id,
201
201
  tableUuid: v.table2.tableUuid || uuidv4('table'),
202
202
  columns: v.columns,
203
- datasourceId: mainTable.table.datasourceId,
204
- datasourceName: mainTable.table.datasourceName
203
+ datasourceId: v.table2.datasourceId,
204
+ datasourceName: v.table2.datasourceName
205
205
  });
206
206
  } else {
207
207
  return {
@@ -91,8 +91,8 @@ var Filter = function Filter(props) {
91
91
  id: v.table2.id,
92
92
  tableUuid: v.table2.tableUuid || uuidv4('table'),
93
93
  columns: v.columns,
94
- datasourceId: mainTable.table.datasourceId,
95
- datasourceName: mainTable.table.datasourceName
94
+ datasourceId: v.table2.datasourceId,
95
+ datasourceName: v.table2.datasourceName
96
96
  };
97
97
  }));
98
98
  }
@@ -120,8 +120,8 @@ var Filter = function Filter(props) {
120
120
  id: v.table2.id,
121
121
  tableUuid: v.table2.tableUuid || uuidv4('table'),
122
122
  columns: v.columns,
123
- datasourceId: mainTable.table.datasourceId,
124
- datasourceName: mainTable.table.datasourceName
123
+ datasourceId: v.table2.datasourceId,
124
+ datasourceName: v.table2.datasourceName
125
125
  };
126
126
  } else {
127
127
  return {
@@ -65,7 +65,7 @@ var menuOperator = operators.map(function (v) {
65
65
  };
66
66
  });
67
67
  var JoinData = function JoinData(props) {
68
- 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;
68
+ var _meta$subquery, _meta$subquery2, _meta$subquery3, _meta$table5, _meta$table6, _meta$table8, _meta$table9, _meta$table10, _meta$table11, _meta$expressions, _meta$table12, _meta$table13, _meta$expressions2, _store$showMainColumn, _store$showMainColumn2;
69
69
  var meta = props.meta,
70
70
  groupIndex = props.groupIndex;
71
71
  var store = useStore();
@@ -87,20 +87,20 @@ var JoinData = function JoinData(props) {
87
87
  var _ref = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
88
88
  var _meta$table, _meta$table2;
89
89
  var tableName, tables, names;
90
- return _regeneratorRuntime.wrap(function (_context) {
90
+ return _regeneratorRuntime.wrap(function _callee$(_context) {
91
91
  while (1) switch (_context.prev = _context.next) {
92
92
  case 0:
93
93
  tableName = (_meta$table = meta.table2) === null || _meta$table === void 0 ? void 0 : _meta$table.name;
94
94
  if ((_meta$table2 = meta.table2) !== null && _meta$table2 !== void 0 && _meta$table2.datasourceId) {
95
- _context.next = 1;
95
+ _context.next = 4;
96
96
  break;
97
97
  }
98
98
  setIsDel(false);
99
99
  return _context.abrupt("return");
100
- case 1:
101
- _context.next = 2;
100
+ case 4:
101
+ _context.next = 6;
102
102
  return store === null || store === void 0 ? void 0 : store.fetchDataset(meta.table2.datasourceId);
103
- case 2:
103
+ case 6:
104
104
  tables = _context.sent;
105
105
  names = (tables === null || tables === void 0 ? void 0 : tables.map(function (v) {
106
106
  return v.name;
@@ -110,7 +110,7 @@ var JoinData = function JoinData(props) {
110
110
  } else {
111
111
  setIsDel(false);
112
112
  }
113
- case 3:
113
+ case 9:
114
114
  case "end":
115
115
  return _context.stop();
116
116
  }
@@ -1196,16 +1196,16 @@ var JoinData = function JoinData(props) {
1196
1196
  onOk: function () {
1197
1197
  var _onOk = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
1198
1198
  var index, newMeta;
1199
- return _regeneratorRuntime.wrap(function (_context2) {
1199
+ return _regeneratorRuntime.wrap(function _callee2$(_context2) {
1200
1200
  while (1) switch (_context2.prev = _context2.next) {
1201
1201
  case 0:
1202
1202
  if (isValidSQLAlias(alias)) {
1203
- _context2.next = 1;
1203
+ _context2.next = 3;
1204
1204
  break;
1205
1205
  }
1206
1206
  Toast.warning(__('SqlQueryBuilder.aliasForRules'));
1207
1207
  return _context2.abrupt("return", false);
1208
- case 1:
1208
+ case 3:
1209
1209
  index = findIndex(store.metaList[groupIndex].list, meta);
1210
1210
  newMeta = store.metaList[groupIndex].list.slice();
1211
1211
  newMeta[index].table2.alias = alias;
@@ -1214,7 +1214,7 @@ var JoinData = function JoinData(props) {
1214
1214
  obj: newMeta[index].table2,
1215
1215
  type: ChangeType.tableAlias
1216
1216
  });
1217
- case 2:
1217
+ case 8:
1218
1218
  case "end":
1219
1219
  return _context2.stop();
1220
1220
  }
@@ -1655,7 +1655,7 @@ var JoinData = function JoinData(props) {
1655
1655
  icon: _jsx(RelatedWork, {}),
1656
1656
  onClick: switchSubQuery
1657
1657
  })
1658
- }), ((_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) {
1658
+ }), ((_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$expressions = meta.expressions) === null || _meta$expressions === void 0 ? void 0 : _meta$expressions.map(function (v, i) {
1659
1659
  if (v.type === AtomsTypeEnum.JOIN_DEFAULT) {
1660
1660
  return _jsxs("div", {
1661
1661
  className: cx("Sqb-where block"),
@@ -1883,7 +1883,7 @@ var JoinData = function JoinData(props) {
1883
1883
  })]
1884
1884
  }, i);
1885
1885
  }
1886
- })), ((_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 && _jsx(Tooltip, {
1886
+ })), ((_meta$table12 = meta.table2) === null || _meta$table12 === void 0 ? void 0 : _meta$table12.name) && ((_meta$table13 = meta.table1) === null || _meta$table13 === void 0 ? void 0 : _meta$table13.name) && (((_meta$expressions2 = meta.expressions) === null || _meta$expressions2 === void 0 ? void 0 : _meta$expressions2.length) || 0) < 1 && _jsx(Tooltip, {
1887
1887
  title: __('SqlQueryBuilder.add'),
1888
1888
  children: _jsx(Dropdown, {
1889
1889
  trigger: ['click'],
@@ -249,16 +249,16 @@ var GroupBy = function GroupBy(props) {
249
249
  onOk: function () {
250
250
  var _onOk = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
251
251
  var newMeta;
252
- return _regeneratorRuntime.wrap(function (_context) {
252
+ return _regeneratorRuntime.wrap(function _callee$(_context) {
253
253
  while (1) switch (_context.prev = _context.next) {
254
254
  case 0:
255
255
  if (isValidSQLAlias(fieldAlias)) {
256
- _context.next = 1;
256
+ _context.next = 3;
257
257
  break;
258
258
  }
259
259
  Toast.warning(__('SqlQueryBuilder.aliasForRules'));
260
260
  return _context.abrupt("return", false);
261
- case 1:
261
+ case 3:
262
262
  newMeta = store.metaList[groupIndex].list.slice(); // @ts-ignore
263
263
  newMeta[index].by[i].sql = newMeta[index].by[i].sql.split('AS ')[0] + "AS ".concat(fieldAlias); //修改sql
264
264
  newMeta[index].by[i].fieldAlias = fieldAlias;
@@ -267,7 +267,7 @@ var GroupBy = function GroupBy(props) {
267
267
  obj: newMeta[index].by,
268
268
  type: ChangeType.by
269
269
  });
270
- case 2:
270
+ case 8:
271
271
  case "end":
272
272
  return _context.stop();
273
273
  }
@@ -247,16 +247,16 @@ var SelectIndex = function SelectIndex(props) {
247
247
  onOk: function () {
248
248
  var _onOk = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
249
249
  var newMeta;
250
- return _regeneratorRuntime.wrap(function (_context) {
250
+ return _regeneratorRuntime.wrap(function _callee$(_context) {
251
251
  while (1) switch (_context.prev = _context.next) {
252
252
  case 0:
253
253
  if (isValidSQLAlias(fieldAlias)) {
254
- _context.next = 1;
254
+ _context.next = 3;
255
255
  break;
256
256
  }
257
257
  Toast.warning(__('SqlQueryBuilder.aliasForRules'));
258
258
  return _context.abrupt("return", false);
259
- case 1:
259
+ case 3:
260
260
  newMeta = store.metaList[groupIndex].list.slice(); // @ts-ignore
261
261
  newMeta[index].group[i].fieldAlias = fieldAlias;
262
262
  newMeta[index].group[i].sql = newMeta[index].group[i].sql.split('AS ')[0] + "AS ".concat(fieldAlias); //修改sql
@@ -265,7 +265,7 @@ var SelectIndex = function SelectIndex(props) {
265
265
  obj: newMeta[index].group,
266
266
  type: ChangeType.group
267
267
  });
268
- case 2:
268
+ case 8:
269
269
  case "end":
270
270
  return _context.stop();
271
271
  }