@gingkoo/pandora-metabase 1.0.156 → 1.0.157-alpha.10

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 (87) hide show
  1. package/lib/cjs/components/dialog/custom-editor/index.js +61 -5
  2. package/lib/cjs/components/dialog/expression/index.js +132 -54
  3. package/lib/cjs/components/dialog/expression/index.less +43 -0
  4. package/lib/cjs/components/dialog/formula/index.js +3 -1
  5. package/lib/cjs/components/dialog/formula/utils.d.ts +1 -0
  6. package/lib/cjs/components/dialog/formula/utils.js +20 -2
  7. package/lib/cjs/components/dialog/formula-list/index.d.ts +2 -0
  8. package/lib/cjs/components/dialog/formula-list/index.js +1119 -151
  9. package/lib/cjs/components/dialog/formula-list/index.less +362 -46
  10. package/lib/cjs/components/dialog/formula-list/utils.d.ts +13 -1
  11. package/lib/cjs/components/dialog/formula-list/utils.js +100 -1
  12. package/lib/cjs/components/dialog/select-column-multiple/index.d.ts +2 -1
  13. package/lib/cjs/components/dialog/select-column-multiple/index.js +4 -2
  14. package/lib/cjs/components/dialog/select-join/index.js +11 -0
  15. package/lib/cjs/components/dialog/select-summarize/index.d.ts +4 -0
  16. package/lib/cjs/components/dialog/select-summarize/index.js +136 -15
  17. package/lib/cjs/components/dialog/select-summarize/index.less +34 -1
  18. package/lib/cjs/components/dialog/select-table/index.d.ts +4 -1
  19. package/lib/cjs/components/dialog/select-table/index.js +51 -7
  20. package/lib/cjs/components/dialog/select-table/index.less +20 -0
  21. package/lib/cjs/components/icons.d.ts +1 -0
  22. package/lib/cjs/components/icons.js +54 -29
  23. package/lib/cjs/components/metabase/index.js +8 -0
  24. package/lib/cjs/components/metabase/index.less +17 -14
  25. package/lib/cjs/components/modules/components/item-name.js +16 -2
  26. package/lib/cjs/components/modules/components/meta-icon.js +6 -4
  27. package/lib/cjs/components/modules/join-data.js +5 -0
  28. package/lib/cjs/components/modules/summarize/group-by.js +12 -1
  29. package/lib/cjs/components/modules/summarize/select-index.js +12 -1
  30. package/lib/cjs/hooks/use-state.js +1 -13
  31. package/lib/cjs/index.d.ts +3 -2
  32. package/lib/cjs/index.js +7 -0
  33. package/lib/cjs/locale/en.js +31 -0
  34. package/lib/cjs/locale/index.js +10 -6
  35. package/lib/cjs/locale/zh.js +31 -0
  36. package/lib/cjs/store/enum.d.ts +2 -1
  37. package/lib/cjs/store/enum.js +1 -0
  38. package/lib/cjs/store/helper.js +25 -2
  39. package/lib/cjs/store/types.d.ts +7 -1
  40. package/lib/cjs/types.d.ts +41 -1
  41. package/lib/cjs/utils/helper.js +20 -0
  42. package/lib/cjs/utils/transformSql.js +59 -2
  43. package/lib/cjs/utils.js +25 -4
  44. package/lib/es/components/dialog/custom-editor/index.js +62 -6
  45. package/lib/es/components/dialog/expression/index.js +133 -55
  46. package/lib/es/components/dialog/expression/index.less +43 -0
  47. package/lib/es/components/dialog/formula/index.js +4 -2
  48. package/lib/es/components/dialog/formula/utils.d.ts +1 -0
  49. package/lib/es/components/dialog/formula/utils.js +18 -1
  50. package/lib/es/components/dialog/formula-list/index.d.ts +2 -0
  51. package/lib/es/components/dialog/formula-list/index.js +1121 -153
  52. package/lib/es/components/dialog/formula-list/index.less +362 -46
  53. package/lib/es/components/dialog/formula-list/utils.d.ts +13 -1
  54. package/lib/es/components/dialog/formula-list/utils.js +99 -0
  55. package/lib/es/components/dialog/select-column-multiple/index.d.ts +2 -1
  56. package/lib/es/components/dialog/select-column-multiple/index.js +4 -2
  57. package/lib/es/components/dialog/select-join/index.js +12 -1
  58. package/lib/es/components/dialog/select-summarize/index.d.ts +4 -0
  59. package/lib/es/components/dialog/select-summarize/index.js +140 -19
  60. package/lib/es/components/dialog/select-summarize/index.less +34 -1
  61. package/lib/es/components/dialog/select-table/index.d.ts +4 -1
  62. package/lib/es/components/dialog/select-table/index.js +51 -7
  63. package/lib/es/components/dialog/select-table/index.less +20 -0
  64. package/lib/es/components/icons.d.ts +1 -0
  65. package/lib/es/components/icons.js +53 -28
  66. package/lib/es/components/metabase/index.js +8 -0
  67. package/lib/es/components/metabase/index.less +17 -14
  68. package/lib/es/components/modules/components/item-name.js +16 -2
  69. package/lib/es/components/modules/components/meta-icon.js +6 -4
  70. package/lib/es/components/modules/join-data.js +6 -1
  71. package/lib/es/components/modules/summarize/group-by.js +12 -1
  72. package/lib/es/components/modules/summarize/select-index.js +12 -1
  73. package/lib/es/hooks/use-state.js +1 -13
  74. package/lib/es/index.d.ts +3 -2
  75. package/lib/es/index.js +3 -1
  76. package/lib/es/locale/en.js +31 -0
  77. package/lib/es/locale/index.js +10 -6
  78. package/lib/es/locale/zh.js +31 -0
  79. package/lib/es/store/enum.d.ts +2 -1
  80. package/lib/es/store/enum.js +1 -0
  81. package/lib/es/store/helper.js +25 -2
  82. package/lib/es/store/types.d.ts +7 -1
  83. package/lib/es/types.d.ts +41 -1
  84. package/lib/es/utils/helper.js +20 -0
  85. package/lib/es/utils/transformSql.js +59 -2
  86. package/lib/es/utils.js +25 -4
  87. package/package.json +1 -1
@@ -1,12 +1,12 @@
1
1
  import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
2
2
  import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
3
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
4
4
  import './index.less';
5
- import { useState } from 'react';
6
- import { Tooltip, Button } from '@gingkoo/pandora';
5
+ import { useEffect, useRef, useState } from 'react';
6
+ import { Tooltip, Button, Checkbox, Input, Select } from '@gingkoo/pandora';
7
7
  import cx from 'classnames';
8
8
  import { ColumnsPopupThemeEnum } from '../../../store/enum';
9
- import { NUMBER_GROUP, DATE_GROUP } from '../const';
9
+ import { NUMBER_GROUP, STRING_GROUP, DATE_GROUP } from '../const';
10
10
  import { __ } from '../../../locale';
11
11
  import { TableIcon, LeftArrowIcon } from '../../icons';
12
12
  import FormulaList from '../formula-list';
@@ -40,8 +40,11 @@ var metricOptions = [{
40
40
  }, {
41
41
  name: '最大值',
42
42
  tip: '一个字段的最大值'
43
+ }, {
44
+ name: '聚合字符串拼接',
45
+ tip: '按分组跨行拼接字符串,支持自定义分隔符。'
43
46
  }];
44
- var QuotesMap = new Map([['总行数', '计数'], ['总和', '求和 的'], ['平均值', '平均 的'], ['不重复值的总数', '不重复的值 的'], ['累积求和', '累积和 的'], ['累积行数', '累积计数'], ['标准差', '标准偏差 的'], ['最小值', '最小 的'], ['最大值', '最大 的']]);
47
+ var QuotesMap = new Map([['总行数', '计数'], ['总和', '求和 的'], ['平均值', '平均 的'], ['不重复值的总数', '不重复的值 的'], ['累积求和', '累积和 的'], ['累积行数', '累积计数'], ['标准差', '标准偏差 的'], ['最小值', '最小 的'], ['最大值', '最大 的'], ['聚合字符串拼接', 'STRING_AGG']]);
45
48
  var localeMap = {
46
49
  总行数: 'summarize.totalNumberOfRows',
47
50
  计数: 'summarize.count',
@@ -61,6 +64,8 @@ var localeMap = {
61
64
  '最小 的': 'summarize.theSmallestYes',
62
65
  最大值: 'summarize.maximumCalue',
63
66
  '最大 的': 'summarize.biggestYes',
67
+ 聚合字符串拼接: 'summarize.stringAgg',
68
+ STRING_AGG: 'summarize.stringAggExpression',
64
69
  总的数据行数: 'summarize.totalNumberOfRowsOfData',
65
70
  一个字段所有数值的总和: 'summarize.theSumOfAllValuesInAField',
66
71
  一个字段所有数值的平均值: 'summarize.theAverageOfAllValuesInAfield',
@@ -69,21 +74,51 @@ var localeMap = {
69
74
  '行数的加法统计。如;x段时间内的销售总额': 'summarize.additiveStatisticsOfTheNumberOfRows',
70
75
  一个字段所有数值的标准差: 'summarize.theStandardDeviationOfAllValuesInAfield',
71
76
  一个字段的最小值: 'summarize.theMinimumValueOfAfield',
72
- 一个字段的最大值: 'summarize.TheMaximumValueOfAfield'
77
+ 一个字段的最大值: 'summarize.TheMaximumValueOfAfield',
78
+ '按分组跨行拼接字符串,支持自定义分隔符。': 'summarize.stringAggDescription'
73
79
  };
74
80
  var Special = ['总行数', '累积行数'];
75
81
  var SelectSummarize = function SelectSummarize(_ref) {
82
+ var _value$delimiter, _value$distinct;
76
83
  var data = _ref.data,
77
84
  value = _ref.value,
78
85
  onChange = _ref.onChange,
79
86
  didUpdate = _ref.didUpdate,
80
87
  ignoreGroupByType = _ref.ignoreGroupByType,
81
88
  readonly = _ref.readonly;
89
+ var formulaRootRef = useRef(null);
82
90
  var _useState = useState(value.condition),
83
91
  _useState2 = _slicedToArray(_useState, 2),
84
92
  condition = _useState2[0],
85
93
  setCondition = _useState2[1];
86
- var _useState3 = useState(function () {
94
+ var _useState3 = useState((_value$delimiter = value.delimiter) !== null && _value$delimiter !== void 0 ? _value$delimiter : ','),
95
+ _useState4 = _slicedToArray(_useState3, 2),
96
+ delimiter = _useState4[0],
97
+ setDelimiter = _useState4[1];
98
+ var _useState5 = useState((_value$distinct = value.distinct) !== null && _value$distinct !== void 0 ? _value$distinct : false),
99
+ _useState6 = _slicedToArray(_useState5, 2),
100
+ distinct = _useState6[0],
101
+ setDistinct = _useState6[1];
102
+ var _useState7 = useState(value.orderBy || []),
103
+ _useState8 = _slicedToArray(_useState7, 2),
104
+ orderBy = _useState8[0],
105
+ setOrderBy = _useState8[1];
106
+ var _useState9 = useState(value.orderDirection || 'ASC'),
107
+ _useState0 = _slicedToArray(_useState9, 2),
108
+ orderDirection = _useState0[0],
109
+ setOrderDirection = _useState0[1];
110
+ useEffect(function () {
111
+ var _formulaRootRef$curre;
112
+ if (condition !== '聚合字符串拼接') return;
113
+ var popup = (_formulaRootRef$curre = formulaRootRef.current) === null || _formulaRootRef$curre === void 0 ? void 0 : _formulaRootRef$curre.parentElement;
114
+ if (!popup) return;
115
+ var previousOverflowY = popup.style.overflowY;
116
+ popup.style.overflowY = 'hidden';
117
+ return function () {
118
+ popup.style.overflowY = previousOverflowY;
119
+ };
120
+ }, [condition]);
121
+ var _useState1 = useState(function () {
87
122
  if (Special.includes(value.condition)) {
88
123
  return [];
89
124
  }
@@ -110,9 +145,9 @@ var SelectSummarize = function SelectSummarize(_ref) {
110
145
  }
111
146
  return [];
112
147
  }),
113
- _useState4 = _slicedToArray(_useState3, 2),
114
- atoms = _useState4[0],
115
- setAtoms = _useState4[1];
148
+ _useState10 = _slicedToArray(_useState1, 2),
149
+ atoms = _useState10[0],
150
+ setAtoms = _useState10[1];
116
151
  function goPrevPage() {
117
152
  if (readonly) return;
118
153
  setCondition('');
@@ -190,7 +225,7 @@ var SelectSummarize = function SelectSummarize(_ref) {
190
225
  availableData = data.map(function (v) {
191
226
  return _objectSpread(_objectSpread({}, v), {}, {
192
227
  columns: v.columns.filter(function (o) {
193
- return o.database_type && (NUMBER_GROUP.includes(o.database_type) || (condition === '最大值' || condition === '最小值') && DATE_GROUP.includes(o.database_type));
228
+ return o.database_type && ((condition === '聚合字符串拼接' ? STRING_GROUP.includes(o.database_type) : NUMBER_GROUP.includes(o.database_type)) || (condition === '最大值' || condition === '最小值') && DATE_GROUP.includes(o.database_type));
194
229
  })
195
230
  });
196
231
  }).filter(function (v) {
@@ -199,9 +234,16 @@ var SelectSummarize = function SelectSummarize(_ref) {
199
234
  }
200
235
  return availableData;
201
236
  }
237
+ var getCurrentPopupContainer = function getCurrentPopupContainer(node) {
238
+ var _node$closest;
239
+ return (node === null || node === void 0 || (_node$closest = node.closest) === null || _node$closest === void 0 ? void 0 : _node$closest.call(node, '[data-sqb-popup-container="true"]')) || document.body;
240
+ };
202
241
  if (condition && !~Special.indexOf(condition)) {
203
242
  return _jsxs("div", {
204
- className: 'Sqb-SelectSummarize-formula',
243
+ ref: formulaRootRef,
244
+ className: cx('Sqb-SelectSummarize-formula', {
245
+ 'is-string-agg': condition === '聚合字符串拼接'
246
+ }),
205
247
  children: [_jsx("div", {
206
248
  className: 'back-title',
207
249
  children: _jsxs("div", {
@@ -210,11 +252,25 @@ var SelectSummarize = function SelectSummarize(_ref) {
210
252
  children: [" ", __(localeMap[condition]), " "]
211
253
  })]
212
254
  })
213
- }), _jsx("div", {
255
+ }), _jsxs("div", {
214
256
  className: 'Sqb-SelectSummarize-formula-body',
215
- children: _jsx("div", {
257
+ children: [condition === '聚合字符串拼接' && _jsxs("div", {
258
+ className: 'Sqb-item Sqb-string-agg-distinct',
259
+ children: [_jsx(Checkbox, {
260
+ checked: distinct,
261
+ disabled: readonly,
262
+ onChange: setDistinct,
263
+ children: "\u662F\u5426\u5F00\u542F\u53BB\u91CD"
264
+ }), _jsx("span", {
265
+ className: 'Sqb-string-agg-distinct-tip',
266
+ children: "SQL Server \u4E0D\u652F\u6301\u914D\u7F6E DISTINCT\uFF0C\u8BF7\u5728\u5B50\u67E5\u8BE2\u91CC\u9762\u53BB\u91CD\u5B8C\u518D\u62FC\u63A5"
267
+ })]
268
+ }), _jsxs("div", {
216
269
  className: 'Sqb-item',
217
- children: _jsx("div", {
270
+ children: [condition === '聚合字符串拼接' && _jsx("div", {
271
+ className: 'Sqb-item--label',
272
+ children: "\u9009\u62E9\u62FC\u63A5\u5B57\u6BB5"
273
+ }), _jsx("div", {
218
274
  className: 'Sqb-item--content',
219
275
  children: _jsx(FormulaList, {
220
276
  value: atoms,
@@ -227,17 +283,82 @@ var SelectSummarize = function SelectSummarize(_ref) {
227
283
  didUpdate === null || didUpdate === void 0 || didUpdate();
228
284
  }
229
285
  })
230
- })
231
- })
286
+ })]
287
+ }), condition === '聚合字符串拼接' && _jsxs(_Fragment, {
288
+ children: [_jsxs("div", {
289
+ className: 'Sqb-item',
290
+ children: [_jsx("div", {
291
+ className: 'Sqb-item--label',
292
+ children: "\u5206\u9694\u7B26"
293
+ }), _jsx("div", {
294
+ className: 'Sqb-item--content',
295
+ children: _jsx(Input, {
296
+ value: delimiter,
297
+ placeholder: "\u8BF7\u8F93\u5165\u5206\u9694\u7B26",
298
+ size: 'large',
299
+ onChange: function onChange(val) {
300
+ return setDelimiter(val);
301
+ }
302
+ })
303
+ })]
304
+ }), _jsxs("div", {
305
+ className: 'Sqb-item',
306
+ children: [_jsx("div", {
307
+ className: 'Sqb-item--label',
308
+ children: "\u9009\u62E9\u6392\u5E8F\u5B57\u6BB5"
309
+ }), _jsx("div", {
310
+ className: 'Sqb-item--content',
311
+ children: _jsx(FormulaList, {
312
+ value: orderBy,
313
+ data: data,
314
+ exitData: data,
315
+ enableCopy: false,
316
+ parentPopupChannel: 'secondary',
317
+ onChange: function onChange(nextValue) {
318
+ setOrderBy(nextValue);
319
+ didUpdate === null || didUpdate === void 0 || didUpdate();
320
+ }
321
+ })
322
+ })]
323
+ }), _jsxs("div", {
324
+ className: 'Sqb-item',
325
+ children: [_jsx("div", {
326
+ className: 'Sqb-item--label',
327
+ children: "\u9009\u62E9\u6392\u5E8F\u89C4\u5219"
328
+ }), _jsx("div", {
329
+ className: 'Sqb-item--content',
330
+ children: _jsxs(Select, {
331
+ value: orderDirection,
332
+ size: 'large',
333
+ getPopupContainer: getCurrentPopupContainer,
334
+ onChange: function onChange(val) {
335
+ return setOrderDirection(val);
336
+ },
337
+ children: [_jsx(Select.Option, {
338
+ value: 'ASC',
339
+ children: "ASC"
340
+ }), _jsx(Select.Option, {
341
+ value: 'DESC',
342
+ children: "DESC"
343
+ })]
344
+ })
345
+ })]
346
+ })]
347
+ })]
232
348
  }), !readonly && _jsx("div", {
233
349
  className: 'Sqb-SelectSummarize-formula-footer',
234
350
  children: _jsx(Button, {
235
351
  primary: true,
236
352
  disabled: !atoms.length,
237
353
  onClick: function onClick() {
238
- handleSelect(condition, {
354
+ handleSelect(condition, _objectSpread({
239
355
  atoms: atoms
240
- });
356
+ }, condition === '聚合字符串拼接' ? {
357
+ distinct: distinct,
358
+ delimiter: delimiter,
359
+ orderBy: orderBy,
360
+ orderDirection: orderDirection
361
+ } : {}));
241
362
  },
242
363
  children: "\u786E\u5B9A"
243
364
  })
@@ -156,6 +156,26 @@
156
156
  width: min(760px, calc(100vw - 64px));
157
157
  max-width: 100%;
158
158
  background: #fff;
159
+
160
+ &.is-string-agg {
161
+ display: flex;
162
+ flex-direction: column;
163
+ height: min(680px, calc(100vh - 20px));
164
+ max-height: inherit;
165
+ overflow: hidden;
166
+
167
+ .back-title,
168
+ .Sqb-SelectSummarize-formula-footer {
169
+ flex: none;
170
+ }
171
+
172
+ .Sqb-SelectSummarize-formula-body {
173
+ flex: 1;
174
+ min-height: 0;
175
+ max-height: none;
176
+ overflow-y: auto;
177
+ }
178
+ }
159
179
  }
160
180
 
161
181
  .Sqb-SelectSummarize-formula-body {
@@ -167,10 +187,23 @@
167
187
  .Sqb-item--content {
168
188
  width: 100%;
169
189
  }
190
+
191
+ .Sqb-item--label {
192
+ margin: 12px 0 6px;
193
+ color: #5f6575;
194
+ }
195
+
196
+ .Sqb-string-agg-distinct-tip {
197
+ margin-left: 8px;
198
+ color: #949aab;
199
+ font-size: 12px;
200
+ }
170
201
  }
171
202
 
172
203
  .Sqb-SelectSummarize-formula-footer {
173
204
  display: flex;
174
205
  justify-content: flex-end;
175
- padding: 0 16px 16px;
206
+ padding: 8px 16px;
207
+ box-shadow: 0 -1px 4px rgba(0, 0, 0, 0.05);
208
+ background: #fff;
176
209
  }
@@ -6,9 +6,12 @@ interface PropsType {
6
6
  data: DatasourceType[];
7
7
  sourceTable: any[];
8
8
  value: MetaData_TableType;
9
+ selectedValues?: MetaData_TableType[];
10
+ lockedValues?: MetaData_TableType[];
11
+ multiple?: boolean;
9
12
  onChange: (reocrd: MetaData_TableType) => void;
10
13
  didUpdate?: Function;
11
14
  tableFlat?: boolean;
12
15
  }
13
- declare const SelectTable: ({ data, sourceTable, value, onChange, didUpdate, tableFlat, }: PropsType) => React.JSX.Element;
16
+ declare const SelectTable: ({ data, sourceTable, value, selectedValues, lockedValues, multiple, onChange, didUpdate, tableFlat, }: PropsType) => React.JSX.Element;
14
17
  export default SelectTable;
@@ -1,3 +1,4 @@
1
+ import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
1
2
  import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
2
3
  import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
3
4
  import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
@@ -87,6 +88,12 @@ var SelectTable = function SelectTable(_ref) {
87
88
  _ref$sourceTable = _ref.sourceTable,
88
89
  sourceTable = _ref$sourceTable === void 0 ? EMPTY_ARRAY : _ref$sourceTable,
89
90
  value = _ref.value,
91
+ _ref$selectedValues = _ref.selectedValues,
92
+ selectedValues = _ref$selectedValues === void 0 ? EMPTY_ARRAY : _ref$selectedValues,
93
+ _ref$lockedValues = _ref.lockedValues,
94
+ lockedValues = _ref$lockedValues === void 0 ? EMPTY_ARRAY : _ref$lockedValues,
95
+ _ref$multiple = _ref.multiple,
96
+ multiple = _ref$multiple === void 0 ? false : _ref$multiple,
90
97
  _ref$onChange = _ref.onChange,
91
98
  onChange = _ref$onChange === void 0 ? function () {} : _ref$onChange,
92
99
  didUpdate = _ref.didUpdate,
@@ -128,10 +135,14 @@ var SelectTable = function SelectTable(_ref) {
128
135
  _useState16 = _slicedToArray(_useState15, 2),
129
136
  selectedFlatTableTypes = _useState16[0],
130
137
  setSelectedFlatTableTypes = _useState16[1];
131
- var _useState17 = useState(value),
138
+ var _useState17 = useState(selectedValues),
132
139
  _useState18 = _slicedToArray(_useState17, 2),
133
- val = _useState18[0],
134
- setVal = _useState18[1];
140
+ multipleValues = _useState18[0],
141
+ setMultipleValues = _useState18[1];
142
+ var _useState19 = useState(value),
143
+ _useState20 = _slicedToArray(_useState19, 2),
144
+ val = _useState20[0],
145
+ setVal = _useState20[1];
135
146
  var searchInputRef = useRef(null);
136
147
  var flatSearchInputRef = useRef(null);
137
148
  var tableTypeOptions = useMemo(function () {
@@ -141,6 +152,21 @@ var SelectTable = function SelectTable(_ref) {
141
152
  return getFlatTableTypeOptions(sourceTable);
142
153
  }, [sourceTable]);
143
154
  var nextPage = !val.datasourceId;
155
+ var isLockedTable = function isLockedTable(tableValue) {
156
+ return lockedValues.some(function (item) {
157
+ return isSameTableByIdName(item, tableValue);
158
+ });
159
+ };
160
+ var isTableSelected = function isTableSelected(tableValue) {
161
+ return multiple ? multipleValues.some(function (item) {
162
+ return isSameTableByIdName(item, tableValue);
163
+ }) : isSameTableByIdName(value, tableValue);
164
+ };
165
+ useEffect(function () {
166
+ if (multiple) {
167
+ setMultipleValues(selectedValues);
168
+ }
169
+ }, [multiple, selectedValues]);
144
170
  useEffect(function () {
145
171
  if (value.datasourceId) {
146
172
  getTables(value.datasourceId);
@@ -250,6 +276,22 @@ var SelectTable = function SelectTable(_ref) {
250
276
  alias: ''
251
277
  });
252
278
  }
279
+ function handleTableClick(tableValue) {
280
+ if (!multiple) {
281
+ onChange(tableValue);
282
+ return;
283
+ }
284
+ if (isLockedTable(tableValue)) return;
285
+ setMultipleValues(function (list) {
286
+ var exists = list.some(function (item) {
287
+ return isSameTableByIdName(item, tableValue);
288
+ });
289
+ return exists ? list.filter(function (item) {
290
+ return !isSameTableByIdName(item, tableValue);
291
+ }) : [].concat(_toConsumableArray(list), [tableValue]);
292
+ });
293
+ onChange(tableValue);
294
+ }
253
295
  function renderTableTypeFilter(tableTypes) {
254
296
  if (tableTypes.length <= 1) return null;
255
297
  return _jsx("div", {
@@ -342,10 +384,11 @@ var SelectTable = function SelectTable(_ref) {
342
384
  className: cx("Sqb-List-section"),
343
385
  children: _jsx("div", {
344
386
  className: cx("Sqb-List-item mx-2", {
345
- active: isSameTableByIdName(value, tableValue)
387
+ active: isTableSelected(tableValue),
388
+ disabled: isLockedTable(tableValue)
346
389
  }),
347
390
  onClick: function onClick() {
348
- onChange(tableValue);
391
+ handleTableClick(tableValue);
349
392
  },
350
393
  children: _jsxs("a", {
351
394
  className: 'p-2',
@@ -464,10 +507,11 @@ var SelectTable = function SelectTable(_ref) {
464
507
  className: cx("Sqb-List-section"),
465
508
  children: _jsx("div", {
466
509
  className: cx("Sqb-List-item mx-2", {
467
- active: isSameTableByIdName(value, tableValue)
510
+ active: isTableSelected(tableValue),
511
+ disabled: isLockedTable(tableValue)
468
512
  }),
469
513
  onClick: function onClick() {
470
- onChange(tableValue);
514
+ handleTableClick(tableValue);
471
515
  },
472
516
  children: _jsxs("a", {
473
517
  className: 'p-2',
@@ -45,6 +45,16 @@
45
45
  color: #949aab !important;
46
46
  }
47
47
  }
48
+ &.active.disabled {
49
+ background-color: #e8f4ff;
50
+ border: 1px solid #b9dcfb;
51
+ .List-item-icon {
52
+ color: #509ee3 !important;
53
+ }
54
+ .List-item-title {
55
+ color: #2d7fbd !important;
56
+ }
57
+ }
48
58
  }
49
59
  }
50
60
 
@@ -156,6 +166,16 @@
156
166
  color: #949aab !important;
157
167
  }
158
168
  }
169
+ &.active.disabled {
170
+ background-color: #e8f4ff;
171
+ border: 1px solid #b9dcfb;
172
+ .List-item-icon {
173
+ color: #509ee3 !important;
174
+ }
175
+ .List-item-title {
176
+ color: #2d7fbd !important;
177
+ }
178
+ }
159
179
  }
160
180
 
161
181
  .Sqb-List-search {
@@ -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,
@@ -233,8 +233,16 @@ var Metabase = function Metabase(props) {
233
233
  e.preventDefault();
234
234
  e.stopPropagation();
235
235
  };
236
+ var stopTooltipInteraction = function stopTooltipInteraction(e) {
237
+ var _target$closest2;
238
+ var target = e.target;
239
+ if (!(target !== null && target !== void 0 && (_target$closest2 = target.closest) !== null && _target$closest2 !== void 0 && _target$closest2.call(target, '.pd-Tooltip'))) return;
240
+ e.stopPropagation();
241
+ };
236
242
  return _jsx(VisualBox, {
237
243
  ref: store.popupContainer,
244
+ onMouseDownCapture: stopTooltipInteraction,
245
+ onClickCapture: stopTooltipInteraction,
238
246
  onContextMenu: function onContextMenu(e) {
239
247
  if (readonlyMode) {
240
248
  e.preventDefault();