@gingkoo/pandora-metabase 1.0.157-alpha.2 → 1.0.157-alpha.4

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.
@@ -44,6 +44,17 @@ var JoinList = [{
44
44
  cursor: 'pointer'
45
45
  }
46
46
  })
47
+ }, {
48
+ type: _enum.JoinEnum.full,
49
+ name: 'Full outer join',
50
+ icon: (0, _jsxRuntime.jsx)(_icons.FullJoinIcon, {
51
+ width: 24,
52
+ height: 24,
53
+ style: {
54
+ marginRight: '0.5rem',
55
+ cursor: 'pointer'
56
+ }
57
+ })
47
58
  }];
48
59
  var SelectJoin = function SelectJoin(_ref) {
49
60
  var value = _ref.value,
@@ -15,6 +15,7 @@ export declare const SortIcon: ({ width, height }: IconProps) => React.JSX.Eleme
15
15
  export declare const RowLimitIcon: ({ width, height }: IconProps) => React.JSX.Element;
16
16
  export declare const LeftJoinIcon: ({ width, height, style }: IconProps) => React.JSX.Element;
17
17
  export declare const InnerJoinIcon: ({ width, height, style }: IconProps) => React.JSX.Element;
18
+ export declare const FullJoinIcon: ({ width, height, style }: IconProps) => React.JSX.Element;
18
19
  export declare const UpArrowIcon: ({ width, height }: IconProps) => React.JSX.Element;
19
20
  export declare const DownArrowIcon: ({ width, height }: IconProps) => React.JSX.Element;
20
21
  export declare const CloseIcon: ({ width, height }: IconProps) => React.JSX.Element;
@@ -4,7 +4,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
4
4
  Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
- exports.WellIcon = exports.UpArrowIcon2 = exports.UpArrowIcon = exports.TableIcon = exports.SummarizeIcon = exports.SortIcon = exports.SelectIcon = exports.SearchIcon = exports.RowLimitIcon = exports.RightArrowIcon = exports.PermissionTableIcon = exports.NotSelectIcon = exports.LetterAaIcon = exports.LeftJoinIcon = exports.LeftArrowIcon = exports.JoinDataIcon = exports.InnerJoinIcon = exports.GroupIcon = exports.ForeignKeyIcon = exports.FilterIcon = exports.DownArrowIcon2 = exports.DownArrowIcon = exports.DataSourceIcon = exports.CustomColumnIcon = exports.CloseIcon2 = exports.CloseIcon = exports.CircleIcon = exports.CalendarIcon = exports.AddIcon = void 0;
7
+ exports.WellIcon = exports.UpArrowIcon2 = exports.UpArrowIcon = exports.TableIcon = exports.SummarizeIcon = exports.SortIcon = exports.SelectIcon = exports.SearchIcon = exports.RowLimitIcon = exports.RightArrowIcon = exports.PermissionTableIcon = exports.NotSelectIcon = exports.LetterAaIcon = exports.LeftJoinIcon = exports.LeftArrowIcon = exports.JoinDataIcon = exports.InnerJoinIcon = exports.GroupIcon = exports.FullJoinIcon = exports.ForeignKeyIcon = exports.FilterIcon = exports.DownArrowIcon2 = exports.DownArrowIcon = exports.DataSourceIcon = exports.CustomColumnIcon = exports.CloseIcon2 = exports.CloseIcon = exports.CircleIcon = exports.CalendarIcon = exports.AddIcon = void 0;
8
8
  var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/objectSpread2"));
9
9
  var _jsxRuntime = require("react/jsx-runtime");
10
10
  var CloseIcon2 = exports.CloseIcon2 = function CloseIcon2(reset) {
@@ -195,11 +195,36 @@ var InnerJoinIcon = exports.InnerJoinIcon = function InnerJoinIcon(_ref0) {
195
195
  })
196
196
  });
197
197
  };
198
- var UpArrowIcon = exports.UpArrowIcon = function UpArrowIcon(_ref1) {
198
+ var FullJoinIcon = exports.FullJoinIcon = function FullJoinIcon(_ref1) {
199
199
  var _ref1$width = _ref1.width,
200
- width = _ref1$width === void 0 ? 16 : _ref1$width,
200
+ width = _ref1$width === void 0 ? 32 : _ref1$width,
201
201
  _ref1$height = _ref1.height,
202
- height = _ref1$height === void 0 ? 17 : _ref1$height;
202
+ height = _ref1$height === void 0 ? 32 : _ref1$height,
203
+ style = _ref1.style;
204
+ return (0, _jsxRuntime.jsxs)("svg", {
205
+ viewBox: '0 0 32 32',
206
+ width: width,
207
+ height: height,
208
+ fill: 'currentcolor',
209
+ role: 'img',
210
+ "aria-label": 'join_full_outer icon',
211
+ style: style,
212
+ children: [(0, _jsxRuntime.jsx)("circle", {
213
+ cx: '11',
214
+ cy: '16',
215
+ r: '9'
216
+ }), (0, _jsxRuntime.jsx)("circle", {
217
+ cx: '21',
218
+ cy: '16',
219
+ r: '9'
220
+ })]
221
+ });
222
+ };
223
+ var UpArrowIcon = exports.UpArrowIcon = function UpArrowIcon(_ref10) {
224
+ var _ref10$width = _ref10.width,
225
+ width = _ref10$width === void 0 ? 16 : _ref10$width,
226
+ _ref10$height = _ref10.height,
227
+ height = _ref10$height === void 0 ? 17 : _ref10$height;
203
228
  return (0, _jsxRuntime.jsx)("svg", {
204
229
  className: 'sort-arrow',
205
230
  viewBox: '0 0 32 34',
@@ -213,11 +238,11 @@ var UpArrowIcon = exports.UpArrowIcon = function UpArrowIcon(_ref1) {
213
238
  })
214
239
  });
215
240
  };
216
- var DownArrowIcon = exports.DownArrowIcon = function DownArrowIcon(_ref10) {
217
- var _ref10$width = _ref10.width,
218
- width = _ref10$width === void 0 ? 16 : _ref10$width,
219
- _ref10$height = _ref10.height,
220
- height = _ref10$height === void 0 ? 17 : _ref10$height;
241
+ var DownArrowIcon = exports.DownArrowIcon = function DownArrowIcon(_ref11) {
242
+ var _ref11$width = _ref11.width,
243
+ width = _ref11$width === void 0 ? 16 : _ref11$width,
244
+ _ref11$height = _ref11.height,
245
+ height = _ref11$height === void 0 ? 17 : _ref11$height;
221
246
  return (0, _jsxRuntime.jsx)("svg", {
222
247
  className: 'sort-arrow',
223
248
  viewBox: '0 0 32 34',
@@ -231,11 +256,11 @@ var DownArrowIcon = exports.DownArrowIcon = function DownArrowIcon(_ref10) {
231
256
  })
232
257
  });
233
258
  };
234
- var CloseIcon = exports.CloseIcon = function CloseIcon(_ref11) {
235
- var _ref11$width = _ref11.width,
236
- width = _ref11$width === void 0 ? 16 : _ref11$width,
237
- _ref11$height = _ref11.height,
238
- height = _ref11$height === void 0 ? 16 : _ref11$height;
259
+ var CloseIcon = exports.CloseIcon = function CloseIcon(_ref12) {
260
+ var _ref12$width = _ref12.width,
261
+ width = _ref12$width === void 0 ? 16 : _ref12$width,
262
+ _ref12$height = _ref12.height,
263
+ height = _ref12$height === void 0 ? 16 : _ref12$height;
239
264
  return (0, _jsxRuntime.jsx)("svg", {
240
265
  className: 'closeIcon',
241
266
  viewBox: '0 0 32 32',
@@ -249,11 +274,11 @@ var CloseIcon = exports.CloseIcon = function CloseIcon(_ref11) {
249
274
  })
250
275
  });
251
276
  };
252
- var AddIcon = exports.AddIcon = function AddIcon(_ref12) {
253
- var _ref12$width = _ref12.width,
254
- width = _ref12$width === void 0 ? 16 : _ref12$width,
255
- _ref12$height = _ref12.height,
256
- height = _ref12$height === void 0 ? 16 : _ref12$height;
277
+ var AddIcon = exports.AddIcon = function AddIcon(_ref13) {
278
+ var _ref13$width = _ref13.width,
279
+ width = _ref13$width === void 0 ? 16 : _ref13$width,
280
+ _ref13$height = _ref13.height,
281
+ height = _ref13$height === void 0 ? 16 : _ref13$height;
257
282
  return (0, _jsxRuntime.jsx)("svg", {
258
283
  viewBox: '0 0 32 32',
259
284
  width: width,
@@ -266,11 +291,11 @@ var AddIcon = exports.AddIcon = function AddIcon(_ref12) {
266
291
  })
267
292
  });
268
293
  };
269
- var TableIcon = exports.TableIcon = function TableIcon(_ref13) {
270
- var _ref13$width = _ref13.width,
271
- width = _ref13$width === void 0 ? 18 : _ref13$width,
272
- _ref13$height = _ref13.height,
273
- height = _ref13$height === void 0 ? 18 : _ref13$height;
294
+ var TableIcon = exports.TableIcon = function TableIcon(_ref14) {
295
+ var _ref14$width = _ref14.width,
296
+ width = _ref14$width === void 0 ? 18 : _ref14$width,
297
+ _ref14$height = _ref14.height,
298
+ height = _ref14$height === void 0 ? 18 : _ref14$height;
274
299
  return (0, _jsxRuntime.jsx)("svg", {
275
300
  viewBox: '0 0 32 32',
276
301
  width: width,
@@ -283,11 +308,11 @@ var TableIcon = exports.TableIcon = function TableIcon(_ref13) {
283
308
  })
284
309
  });
285
310
  };
286
- var SearchIcon = exports.SearchIcon = function SearchIcon(_ref14) {
287
- var _ref14$width = _ref14.width,
288
- width = _ref14$width === void 0 ? 16 : _ref14$width,
289
- _ref14$height = _ref14.height,
290
- height = _ref14$height === void 0 ? 16 : _ref14$height;
311
+ var SearchIcon = exports.SearchIcon = function SearchIcon(_ref15) {
312
+ var _ref15$width = _ref15.width,
313
+ width = _ref15$width === void 0 ? 16 : _ref15$width,
314
+ _ref15$height = _ref15.height,
315
+ height = _ref15$height === void 0 ? 16 : _ref15$height;
291
316
  return (0, _jsxRuntime.jsx)("svg", {
292
317
  viewBox: '0 0 32 32',
293
318
  width: width,
@@ -1378,6 +1378,11 @@ var JoinData = function JoinData(props) {
1378
1378
  marginRight: '0.5rem',
1379
1379
  cursor: 'pointer'
1380
1380
  }
1381
+ }) : meta.joinType === _enum.JoinEnum.full ? (0, _jsxRuntime.jsx)(_icons.FullJoinIcon, {
1382
+ style: {
1383
+ marginRight: '0.5rem',
1384
+ cursor: 'pointer'
1385
+ }
1381
1386
  }) : (0, _jsxRuntime.jsx)(_icons.InnerJoinIcon, {
1382
1387
  style: {
1383
1388
  marginRight: '0.5rem',
@@ -16,7 +16,8 @@ export declare enum TypeEnum {
16
16
  export declare enum JoinEnum {
17
17
  left = "LEFT JOIN",
18
18
  right = "RIGHT JOIN",
19
- inner = "INNER JOIN"
19
+ inner = "INNER JOIN",
20
+ full = "FULL JOIN"
20
21
  }
21
22
  export declare enum UnionEnum {
22
23
  union = "UNION",
@@ -26,6 +26,7 @@ var JoinEnum;
26
26
  JoinEnum["left"] = "LEFT JOIN";
27
27
  JoinEnum["right"] = "RIGHT JOIN";
28
28
  JoinEnum["inner"] = "INNER JOIN";
29
+ JoinEnum["full"] = "FULL JOIN";
29
30
  })(JoinEnum || (exports.JoinEnum = JoinEnum = {}));
30
31
  var UnionEnum;
31
32
  (function (UnionEnum) {
@@ -1,5 +1,5 @@
1
1
  import type { DatasourceType } from '../types';
2
- import { TypeEnum, SpecialType, JoinEnum, SQL_COLUMN_TYPE, SortEnum } from './enum';
2
+ import { TypeEnum, SpecialType, JoinEnum, SQL_COLUMN_TYPE, SortEnum, UnionEnum } from './enum';
3
3
  export declare enum FormulaTypeEnum {
4
4
  CUSTOM = "custom",
5
5
  FILTER = "filter",
@@ -210,6 +210,7 @@ export interface MetaData_ColumnsType {
210
210
  }
211
211
  export interface MetaData {
212
212
  metaKey: number;
213
+ patchVersion?: string;
213
214
  readonly?: boolean;
214
215
  hidden?: boolean;
215
216
  type: TypeEnum.data;
@@ -351,6 +352,7 @@ export interface MetaPermissionTable {
351
352
  export interface MetaUnion {
352
353
  metaKey: number;
353
354
  type: TypeEnum.union;
355
+ union: UnionEnum;
354
356
  subquery: MetaListType[];
355
357
  }
356
358
  export interface LooseObject {
@@ -40,7 +40,10 @@ var BlockTypeEnum = {
40
40
  exists: 'exists',
41
41
  FORMULA: 'FORMULA',
42
42
  collection: 'collection',
43
- andOr: 'andOr'
43
+ andOr: 'andOr',
44
+ caseWhen: 'caseWhen',
45
+ select: 'select',
46
+ subquery: 'subquery'
44
47
  };
45
48
  var SummarizeAlias = 'source';
46
49
  var SQL_GROUP_TYPE = {
@@ -496,6 +499,38 @@ var _handleBaseType2Sql9 = exports.handleBaseType2Sql = function handleBaseType2
496
499
  sql += " ".concat(collectionSql);
497
500
  constants.push.apply(constants, (0, _toConsumableArray2["default"])(collectionConstants));
498
501
  }
502
+ if (type === BlockTypeEnum.select) {
503
+ var values = (Array.isArray(item.val) ? item.val : [item.val]).filter(function (value) {
504
+ return value !== null && value !== undefined && value !== '';
505
+ }).map(function (value) {
506
+ return String(value);
507
+ });
508
+ var selectSql = values.join(', ');
509
+ sql += selectSql ? " ".concat(selectSql) : '';
510
+ sql_items.push.apply(sql_items, (0, _toConsumableArray2["default"])(values));
511
+ }
512
+ if (type === BlockTypeEnum.subquery) {
513
+ if (Array.isArray(item.subQuery) && item.subQuery.length) {
514
+ sql += " (".concat(handleSqlUnion(item.subQuery, db).sql, ")");
515
+ }
516
+ }
517
+ if (type === BlockTypeEnum.caseWhen) {
518
+ var caseSqlResult = _handleBaseType2Sql9(item.caseAtoms || [], db);
519
+ constants.push.apply(constants, (0, _toConsumableArray2["default"])(caseSqlResult.constants));
520
+ var whenSql = (item.whenClauses || []).map(function (clause) {
521
+ var whenResult = _handleBaseType2Sql9(clause.whenAtoms || [], db);
522
+ var thenResult = _handleBaseType2Sql9(clause.thenAtoms || [], db);
523
+ constants.push.apply(constants, (0, _toConsumableArray2["default"])(whenResult.constants).concat((0, _toConsumableArray2["default"])(thenResult.constants)));
524
+ var whenCondition = whenResult.sql.trim();
525
+ var thenValue = thenResult.sql.trim();
526
+ return whenCondition && thenValue ? "WHEN ".concat(whenCondition, " THEN ").concat(thenValue) : '';
527
+ }).filter(Boolean).join(' ');
528
+ var elseResult = _handleBaseType2Sql9(item.elseAtoms || [], db);
529
+ constants.push.apply(constants, (0, _toConsumableArray2["default"])(elseResult.constants));
530
+ var caseExpression = caseSqlResult.sql.trim();
531
+ var elseSql = elseResult.sql.trim();
532
+ sql += " CASE".concat(caseExpression ? " ".concat(caseExpression) : '').concat(whenSql ? " ".concat(whenSql) : '').concat(elseSql ? " ELSE ".concat(elseSql) : '', " END");
533
+ }
499
534
  if (type === BlockTypeEnum.andOr) {
500
535
  var itemsSql = normalizeAndOrItems(item).map(function (logicItem, index) {
501
536
  var _handleBaseType2Sql8 = _handleBaseType2Sql9(logicItem.atoms || [], db),
@@ -755,7 +790,7 @@ var handleSqlUnion = function handleSqlUnion(metas) {
755
790
  unionMetas.forEach(function (it) {
756
791
  if (Array.isArray(it.subquery) && it.subquery.length) {
757
792
  var u_data = handleSqlStruct(it.subquery, db);
758
- var _sqlStruct2text2 = _sqlStruct2text3(u_data, 0, db),
793
+ var _sqlStruct2text2 = _sqlStruct2text3(u_data, 0, db, noFields),
759
794
  u_sqltext = _sqlStruct2text2.sql,
760
795
  u_fields = _sqlStruct2text2.fields;
761
796
  union_fields.push(u_fields);
@@ -2,7 +2,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import './index.less';
3
3
  import cx from 'classnames';
4
4
  import { JoinEnum } from '../../../store/enum';
5
- import { LeftJoinIcon, InnerJoinIcon } from '../../icons';
5
+ import { LeftJoinIcon, InnerJoinIcon, FullJoinIcon } from '../../icons';
6
6
  var JoinList = [{
7
7
  type: JoinEnum.left,
8
8
  name: 'Left outer join',
@@ -37,6 +37,17 @@ var JoinList = [{
37
37
  cursor: 'pointer'
38
38
  }
39
39
  })
40
+ }, {
41
+ type: JoinEnum.full,
42
+ name: 'Full outer join',
43
+ icon: _jsx(FullJoinIcon, {
44
+ width: 24,
45
+ height: 24,
46
+ style: {
47
+ marginRight: '0.5rem',
48
+ cursor: 'pointer'
49
+ }
50
+ })
40
51
  }];
41
52
  var SelectJoin = function SelectJoin(_ref) {
42
53
  var value = _ref.value,
@@ -15,6 +15,7 @@ export declare const SortIcon: ({ width, height }: IconProps) => React.JSX.Eleme
15
15
  export declare const RowLimitIcon: ({ width, height }: IconProps) => React.JSX.Element;
16
16
  export declare const LeftJoinIcon: ({ width, height, style }: IconProps) => React.JSX.Element;
17
17
  export declare const InnerJoinIcon: ({ width, height, style }: IconProps) => React.JSX.Element;
18
+ export declare const FullJoinIcon: ({ width, height, style }: IconProps) => React.JSX.Element;
18
19
  export declare const UpArrowIcon: ({ width, height }: IconProps) => React.JSX.Element;
19
20
  export declare const DownArrowIcon: ({ width, height }: IconProps) => React.JSX.Element;
20
21
  export declare const CloseIcon: ({ width, height }: IconProps) => React.JSX.Element;
@@ -188,11 +188,36 @@ export var InnerJoinIcon = function InnerJoinIcon(_ref0) {
188
188
  })
189
189
  });
190
190
  };
191
- export var UpArrowIcon = function UpArrowIcon(_ref1) {
191
+ export var FullJoinIcon = function FullJoinIcon(_ref1) {
192
192
  var _ref1$width = _ref1.width,
193
- width = _ref1$width === void 0 ? 16 : _ref1$width,
193
+ width = _ref1$width === void 0 ? 32 : _ref1$width,
194
194
  _ref1$height = _ref1.height,
195
- height = _ref1$height === void 0 ? 17 : _ref1$height;
195
+ height = _ref1$height === void 0 ? 32 : _ref1$height,
196
+ style = _ref1.style;
197
+ return _jsxs("svg", {
198
+ viewBox: '0 0 32 32',
199
+ width: width,
200
+ height: height,
201
+ fill: 'currentcolor',
202
+ role: 'img',
203
+ "aria-label": 'join_full_outer icon',
204
+ style: style,
205
+ children: [_jsx("circle", {
206
+ cx: '11',
207
+ cy: '16',
208
+ r: '9'
209
+ }), _jsx("circle", {
210
+ cx: '21',
211
+ cy: '16',
212
+ r: '9'
213
+ })]
214
+ });
215
+ };
216
+ export var UpArrowIcon = function UpArrowIcon(_ref10) {
217
+ var _ref10$width = _ref10.width,
218
+ width = _ref10$width === void 0 ? 16 : _ref10$width,
219
+ _ref10$height = _ref10.height,
220
+ height = _ref10$height === void 0 ? 17 : _ref10$height;
196
221
  return _jsx("svg", {
197
222
  className: 'sort-arrow',
198
223
  viewBox: '0 0 32 34',
@@ -206,11 +231,11 @@ export var UpArrowIcon = function UpArrowIcon(_ref1) {
206
231
  })
207
232
  });
208
233
  };
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;
234
+ export var DownArrowIcon = function DownArrowIcon(_ref11) {
235
+ var _ref11$width = _ref11.width,
236
+ width = _ref11$width === void 0 ? 16 : _ref11$width,
237
+ _ref11$height = _ref11.height,
238
+ height = _ref11$height === void 0 ? 17 : _ref11$height;
214
239
  return _jsx("svg", {
215
240
  className: 'sort-arrow',
216
241
  viewBox: '0 0 32 34',
@@ -224,11 +249,11 @@ export var DownArrowIcon = function DownArrowIcon(_ref10) {
224
249
  })
225
250
  });
226
251
  };
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;
252
+ export var CloseIcon = function CloseIcon(_ref12) {
253
+ var _ref12$width = _ref12.width,
254
+ width = _ref12$width === void 0 ? 16 : _ref12$width,
255
+ _ref12$height = _ref12.height,
256
+ height = _ref12$height === void 0 ? 16 : _ref12$height;
232
257
  return _jsx("svg", {
233
258
  className: 'closeIcon',
234
259
  viewBox: '0 0 32 32',
@@ -242,11 +267,11 @@ export var CloseIcon = function CloseIcon(_ref11) {
242
267
  })
243
268
  });
244
269
  };
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;
270
+ export var AddIcon = function AddIcon(_ref13) {
271
+ var _ref13$width = _ref13.width,
272
+ width = _ref13$width === void 0 ? 16 : _ref13$width,
273
+ _ref13$height = _ref13.height,
274
+ height = _ref13$height === void 0 ? 16 : _ref13$height;
250
275
  return _jsx("svg", {
251
276
  viewBox: '0 0 32 32',
252
277
  width: width,
@@ -259,11 +284,11 @@ export var AddIcon = function AddIcon(_ref12) {
259
284
  })
260
285
  });
261
286
  };
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;
287
+ export var TableIcon = function TableIcon(_ref14) {
288
+ var _ref14$width = _ref14.width,
289
+ width = _ref14$width === void 0 ? 18 : _ref14$width,
290
+ _ref14$height = _ref14.height,
291
+ height = _ref14$height === void 0 ? 18 : _ref14$height;
267
292
  return _jsx("svg", {
268
293
  viewBox: '0 0 32 32',
269
294
  width: width,
@@ -276,11 +301,11 @@ export var TableIcon = function TableIcon(_ref13) {
276
301
  })
277
302
  });
278
303
  };
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;
304
+ export var SearchIcon = function SearchIcon(_ref15) {
305
+ var _ref15$width = _ref15.width,
306
+ width = _ref15$width === void 0 ? 16 : _ref15$width,
307
+ _ref15$height = _ref15.height,
308
+ height = _ref15$height === void 0 ? 16 : _ref15$height;
284
309
  return _jsx("svg", {
285
310
  viewBox: '0 0 32 32',
286
311
  width: width,
@@ -28,7 +28,7 @@ import NextDom from './components/meta-icon';
28
28
  import Header from './components/header';
29
29
  import ItemWrapper from './components/item-wrapper';
30
30
  import SelectList from '../dialog/select-list';
31
- import { LeftJoinIcon, InnerJoinIcon } from '../icons';
31
+ import { LeftJoinIcon, InnerJoinIcon, FullJoinIcon } from '../icons';
32
32
  import { SelectTable, SelectJoin, SelectColumnMultiple, SelectColumn, Expression, SelectPermissionTable, FormulaList, getTemplateItem } from '../dialog';
33
33
  import { useStore } from '../../hooks/use-provider';
34
34
  var PrevResult = 'Previous results';
@@ -1372,6 +1372,11 @@ var JoinData = function JoinData(props) {
1372
1372
  marginRight: '0.5rem',
1373
1373
  cursor: 'pointer'
1374
1374
  }
1375
+ }) : meta.joinType === JoinEnum.full ? _jsx(FullJoinIcon, {
1376
+ style: {
1377
+ marginRight: '0.5rem',
1378
+ cursor: 'pointer'
1379
+ }
1375
1380
  }) : _jsx(InnerJoinIcon, {
1376
1381
  style: {
1377
1382
  marginRight: '0.5rem',
@@ -16,7 +16,8 @@ export declare enum TypeEnum {
16
16
  export declare enum JoinEnum {
17
17
  left = "LEFT JOIN",
18
18
  right = "RIGHT JOIN",
19
- inner = "INNER JOIN"
19
+ inner = "INNER JOIN",
20
+ full = "FULL JOIN"
20
21
  }
21
22
  export declare enum UnionEnum {
22
23
  union = "UNION",
@@ -20,6 +20,7 @@ export var JoinEnum;
20
20
  JoinEnum["left"] = "LEFT JOIN";
21
21
  JoinEnum["right"] = "RIGHT JOIN";
22
22
  JoinEnum["inner"] = "INNER JOIN";
23
+ JoinEnum["full"] = "FULL JOIN";
23
24
  })(JoinEnum || (JoinEnum = {}));
24
25
  export var UnionEnum;
25
26
  (function (UnionEnum) {
@@ -1,5 +1,5 @@
1
1
  import type { DatasourceType } from '../types';
2
- import { TypeEnum, SpecialType, JoinEnum, SQL_COLUMN_TYPE, SortEnum } from './enum';
2
+ import { TypeEnum, SpecialType, JoinEnum, SQL_COLUMN_TYPE, SortEnum, UnionEnum } from './enum';
3
3
  export declare enum FormulaTypeEnum {
4
4
  CUSTOM = "custom",
5
5
  FILTER = "filter",
@@ -210,6 +210,7 @@ export interface MetaData_ColumnsType {
210
210
  }
211
211
  export interface MetaData {
212
212
  metaKey: number;
213
+ patchVersion?: string;
213
214
  readonly?: boolean;
214
215
  hidden?: boolean;
215
216
  type: TypeEnum.data;
@@ -351,6 +352,7 @@ export interface MetaPermissionTable {
351
352
  export interface MetaUnion {
352
353
  metaKey: number;
353
354
  type: TypeEnum.union;
355
+ union: UnionEnum;
354
356
  subquery: MetaListType[];
355
357
  }
356
358
  export interface LooseObject {
@@ -33,7 +33,10 @@ var BlockTypeEnum = {
33
33
  exists: 'exists',
34
34
  FORMULA: 'FORMULA',
35
35
  collection: 'collection',
36
- andOr: 'andOr'
36
+ andOr: 'andOr',
37
+ caseWhen: 'caseWhen',
38
+ select: 'select',
39
+ subquery: 'subquery'
37
40
  };
38
41
  var SummarizeAlias = 'source';
39
42
  var SQL_GROUP_TYPE = {
@@ -489,6 +492,38 @@ var _handleBaseType2Sql9 = function handleBaseType2Sql(list) {
489
492
  sql += " ".concat(collectionSql);
490
493
  constants.push.apply(constants, _toConsumableArray(collectionConstants));
491
494
  }
495
+ if (type === BlockTypeEnum.select) {
496
+ var values = (Array.isArray(item.val) ? item.val : [item.val]).filter(function (value) {
497
+ return value !== null && value !== undefined && value !== '';
498
+ }).map(function (value) {
499
+ return String(value);
500
+ });
501
+ var selectSql = values.join(', ');
502
+ sql += selectSql ? " ".concat(selectSql) : '';
503
+ sql_items.push.apply(sql_items, _toConsumableArray(values));
504
+ }
505
+ if (type === BlockTypeEnum.subquery) {
506
+ if (Array.isArray(item.subQuery) && item.subQuery.length) {
507
+ sql += " (".concat(handleSqlUnion(item.subQuery, db).sql, ")");
508
+ }
509
+ }
510
+ if (type === BlockTypeEnum.caseWhen) {
511
+ var caseSqlResult = _handleBaseType2Sql9(item.caseAtoms || [], db);
512
+ constants.push.apply(constants, _toConsumableArray(caseSqlResult.constants));
513
+ var whenSql = (item.whenClauses || []).map(function (clause) {
514
+ var whenResult = _handleBaseType2Sql9(clause.whenAtoms || [], db);
515
+ var thenResult = _handleBaseType2Sql9(clause.thenAtoms || [], db);
516
+ constants.push.apply(constants, _toConsumableArray(whenResult.constants).concat(_toConsumableArray(thenResult.constants)));
517
+ var whenCondition = whenResult.sql.trim();
518
+ var thenValue = thenResult.sql.trim();
519
+ return whenCondition && thenValue ? "WHEN ".concat(whenCondition, " THEN ").concat(thenValue) : '';
520
+ }).filter(Boolean).join(' ');
521
+ var elseResult = _handleBaseType2Sql9(item.elseAtoms || [], db);
522
+ constants.push.apply(constants, _toConsumableArray(elseResult.constants));
523
+ var caseExpression = caseSqlResult.sql.trim();
524
+ var elseSql = elseResult.sql.trim();
525
+ sql += " CASE".concat(caseExpression ? " ".concat(caseExpression) : '').concat(whenSql ? " ".concat(whenSql) : '').concat(elseSql ? " ELSE ".concat(elseSql) : '', " END");
526
+ }
492
527
  if (type === BlockTypeEnum.andOr) {
493
528
  var itemsSql = normalizeAndOrItems(item).map(function (logicItem, index) {
494
529
  var _handleBaseType2Sql8 = _handleBaseType2Sql9(logicItem.atoms || [], db),
@@ -749,7 +784,7 @@ var handleSqlUnion = function handleSqlUnion(metas) {
749
784
  unionMetas.forEach(function (it) {
750
785
  if (Array.isArray(it.subquery) && it.subquery.length) {
751
786
  var u_data = handleSqlStruct(it.subquery, db);
752
- var _sqlStruct2text2 = _sqlStruct2text3(u_data, 0, db),
787
+ var _sqlStruct2text2 = _sqlStruct2text3(u_data, 0, db, noFields),
753
788
  u_sqltext = _sqlStruct2text2.sql,
754
789
  u_fields = _sqlStruct2text2.fields;
755
790
  union_fields.push(u_fields);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gingkoo/pandora-metabase",
3
- "version": "1.0.157-alpha.2",
3
+ "version": "1.0.157-alpha.4",
4
4
  "description": "",
5
5
  "main": "lib/es/index.js",
6
6
  "module": "lib/es/index.js",