@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.
- package/lib/cjs/components/dialog/custom-editor/index.js +61 -5
- package/lib/cjs/components/dialog/expression/index.js +132 -54
- package/lib/cjs/components/dialog/expression/index.less +43 -0
- package/lib/cjs/components/dialog/formula/index.js +3 -1
- package/lib/cjs/components/dialog/formula/utils.d.ts +1 -0
- package/lib/cjs/components/dialog/formula/utils.js +20 -2
- package/lib/cjs/components/dialog/formula-list/index.d.ts +2 -0
- package/lib/cjs/components/dialog/formula-list/index.js +1119 -151
- package/lib/cjs/components/dialog/formula-list/index.less +362 -46
- package/lib/cjs/components/dialog/formula-list/utils.d.ts +13 -1
- package/lib/cjs/components/dialog/formula-list/utils.js +100 -1
- package/lib/cjs/components/dialog/select-column-multiple/index.d.ts +2 -1
- package/lib/cjs/components/dialog/select-column-multiple/index.js +4 -2
- package/lib/cjs/components/dialog/select-join/index.js +11 -0
- package/lib/cjs/components/dialog/select-summarize/index.d.ts +4 -0
- package/lib/cjs/components/dialog/select-summarize/index.js +136 -15
- package/lib/cjs/components/dialog/select-summarize/index.less +34 -1
- package/lib/cjs/components/dialog/select-table/index.d.ts +4 -1
- package/lib/cjs/components/dialog/select-table/index.js +51 -7
- package/lib/cjs/components/dialog/select-table/index.less +20 -0
- package/lib/cjs/components/icons.d.ts +1 -0
- package/lib/cjs/components/icons.js +54 -29
- package/lib/cjs/components/metabase/index.js +8 -0
- package/lib/cjs/components/metabase/index.less +17 -14
- package/lib/cjs/components/modules/components/item-name.js +16 -2
- package/lib/cjs/components/modules/components/meta-icon.js +6 -4
- package/lib/cjs/components/modules/join-data.js +5 -0
- package/lib/cjs/components/modules/summarize/group-by.js +12 -1
- package/lib/cjs/components/modules/summarize/select-index.js +12 -1
- package/lib/cjs/hooks/use-state.js +1 -13
- package/lib/cjs/index.d.ts +3 -2
- package/lib/cjs/index.js +7 -0
- package/lib/cjs/locale/en.js +31 -0
- package/lib/cjs/locale/index.js +10 -6
- package/lib/cjs/locale/zh.js +31 -0
- package/lib/cjs/store/enum.d.ts +2 -1
- package/lib/cjs/store/enum.js +1 -0
- package/lib/cjs/store/helper.js +25 -2
- package/lib/cjs/store/types.d.ts +7 -1
- package/lib/cjs/types.d.ts +41 -1
- package/lib/cjs/utils/helper.js +20 -0
- package/lib/cjs/utils/transformSql.js +59 -2
- package/lib/cjs/utils.js +25 -4
- package/lib/es/components/dialog/custom-editor/index.js +62 -6
- package/lib/es/components/dialog/expression/index.js +133 -55
- package/lib/es/components/dialog/expression/index.less +43 -0
- package/lib/es/components/dialog/formula/index.js +4 -2
- package/lib/es/components/dialog/formula/utils.d.ts +1 -0
- package/lib/es/components/dialog/formula/utils.js +18 -1
- package/lib/es/components/dialog/formula-list/index.d.ts +2 -0
- package/lib/es/components/dialog/formula-list/index.js +1121 -153
- package/lib/es/components/dialog/formula-list/index.less +362 -46
- package/lib/es/components/dialog/formula-list/utils.d.ts +13 -1
- package/lib/es/components/dialog/formula-list/utils.js +99 -0
- package/lib/es/components/dialog/select-column-multiple/index.d.ts +2 -1
- package/lib/es/components/dialog/select-column-multiple/index.js +4 -2
- package/lib/es/components/dialog/select-join/index.js +12 -1
- package/lib/es/components/dialog/select-summarize/index.d.ts +4 -0
- package/lib/es/components/dialog/select-summarize/index.js +140 -19
- package/lib/es/components/dialog/select-summarize/index.less +34 -1
- package/lib/es/components/dialog/select-table/index.d.ts +4 -1
- package/lib/es/components/dialog/select-table/index.js +51 -7
- package/lib/es/components/dialog/select-table/index.less +20 -0
- package/lib/es/components/icons.d.ts +1 -0
- package/lib/es/components/icons.js +53 -28
- package/lib/es/components/metabase/index.js +8 -0
- package/lib/es/components/metabase/index.less +17 -14
- package/lib/es/components/modules/components/item-name.js +16 -2
- package/lib/es/components/modules/components/meta-icon.js +6 -4
- package/lib/es/components/modules/join-data.js +6 -1
- package/lib/es/components/modules/summarize/group-by.js +12 -1
- package/lib/es/components/modules/summarize/select-index.js +12 -1
- package/lib/es/hooks/use-state.js +1 -13
- package/lib/es/index.d.ts +3 -2
- package/lib/es/index.js +3 -1
- package/lib/es/locale/en.js +31 -0
- package/lib/es/locale/index.js +10 -6
- package/lib/es/locale/zh.js +31 -0
- package/lib/es/store/enum.d.ts +2 -1
- package/lib/es/store/enum.js +1 -0
- package/lib/es/store/helper.js +25 -2
- package/lib/es/store/types.d.ts +7 -1
- package/lib/es/types.d.ts +41 -1
- package/lib/es/utils/helper.js +20 -0
- package/lib/es/utils/transformSql.js +59 -2
- package/lib/es/utils.js +25 -4
- package/package.json +1 -1
|
@@ -47,8 +47,11 @@ var metricOptions = [{
|
|
|
47
47
|
}, {
|
|
48
48
|
name: '最大值',
|
|
49
49
|
tip: '一个字段的最大值'
|
|
50
|
+
}, {
|
|
51
|
+
name: '聚合字符串拼接',
|
|
52
|
+
tip: '按分组跨行拼接字符串,支持自定义分隔符。'
|
|
50
53
|
}];
|
|
51
|
-
var QuotesMap = new Map([['总行数', '计数'], ['总和', '求和 的'], ['平均值', '平均 的'], ['不重复值的总数', '不重复的值 的'], ['累积求和', '累积和 的'], ['累积行数', '累积计数'], ['标准差', '标准偏差 的'], ['最小值', '最小 的'], ['最大值', '最大 的']]);
|
|
54
|
+
var QuotesMap = new Map([['总行数', '计数'], ['总和', '求和 的'], ['平均值', '平均 的'], ['不重复值的总数', '不重复的值 的'], ['累积求和', '累积和 的'], ['累积行数', '累积计数'], ['标准差', '标准偏差 的'], ['最小值', '最小 的'], ['最大值', '最大 的'], ['聚合字符串拼接', 'STRING_AGG']]);
|
|
52
55
|
var localeMap = {
|
|
53
56
|
总行数: 'summarize.totalNumberOfRows',
|
|
54
57
|
计数: 'summarize.count',
|
|
@@ -68,6 +71,8 @@ var localeMap = {
|
|
|
68
71
|
'最小 的': 'summarize.theSmallestYes',
|
|
69
72
|
最大值: 'summarize.maximumCalue',
|
|
70
73
|
'最大 的': 'summarize.biggestYes',
|
|
74
|
+
聚合字符串拼接: 'summarize.stringAgg',
|
|
75
|
+
STRING_AGG: 'summarize.stringAggExpression',
|
|
71
76
|
总的数据行数: 'summarize.totalNumberOfRowsOfData',
|
|
72
77
|
一个字段所有数值的总和: 'summarize.theSumOfAllValuesInAField',
|
|
73
78
|
一个字段所有数值的平均值: 'summarize.theAverageOfAllValuesInAfield',
|
|
@@ -76,21 +81,51 @@ var localeMap = {
|
|
|
76
81
|
'行数的加法统计。如;x段时间内的销售总额': 'summarize.additiveStatisticsOfTheNumberOfRows',
|
|
77
82
|
一个字段所有数值的标准差: 'summarize.theStandardDeviationOfAllValuesInAfield',
|
|
78
83
|
一个字段的最小值: 'summarize.theMinimumValueOfAfield',
|
|
79
|
-
一个字段的最大值: 'summarize.TheMaximumValueOfAfield'
|
|
84
|
+
一个字段的最大值: 'summarize.TheMaximumValueOfAfield',
|
|
85
|
+
'按分组跨行拼接字符串,支持自定义分隔符。': 'summarize.stringAggDescription'
|
|
80
86
|
};
|
|
81
87
|
var Special = ['总行数', '累积行数'];
|
|
82
88
|
var SelectSummarize = function SelectSummarize(_ref) {
|
|
89
|
+
var _value$delimiter, _value$distinct;
|
|
83
90
|
var data = _ref.data,
|
|
84
91
|
value = _ref.value,
|
|
85
92
|
onChange = _ref.onChange,
|
|
86
93
|
didUpdate = _ref.didUpdate,
|
|
87
94
|
ignoreGroupByType = _ref.ignoreGroupByType,
|
|
88
95
|
readonly = _ref.readonly;
|
|
96
|
+
var formulaRootRef = (0, _react.useRef)(null);
|
|
89
97
|
var _useState = (0, _react.useState)(value.condition),
|
|
90
98
|
_useState2 = (0, _slicedToArray2["default"])(_useState, 2),
|
|
91
99
|
condition = _useState2[0],
|
|
92
100
|
setCondition = _useState2[1];
|
|
93
|
-
var _useState3 = (0, _react.useState)(
|
|
101
|
+
var _useState3 = (0, _react.useState)((_value$delimiter = value.delimiter) !== null && _value$delimiter !== void 0 ? _value$delimiter : ','),
|
|
102
|
+
_useState4 = (0, _slicedToArray2["default"])(_useState3, 2),
|
|
103
|
+
delimiter = _useState4[0],
|
|
104
|
+
setDelimiter = _useState4[1];
|
|
105
|
+
var _useState5 = (0, _react.useState)((_value$distinct = value.distinct) !== null && _value$distinct !== void 0 ? _value$distinct : false),
|
|
106
|
+
_useState6 = (0, _slicedToArray2["default"])(_useState5, 2),
|
|
107
|
+
distinct = _useState6[0],
|
|
108
|
+
setDistinct = _useState6[1];
|
|
109
|
+
var _useState7 = (0, _react.useState)(value.orderBy || []),
|
|
110
|
+
_useState8 = (0, _slicedToArray2["default"])(_useState7, 2),
|
|
111
|
+
orderBy = _useState8[0],
|
|
112
|
+
setOrderBy = _useState8[1];
|
|
113
|
+
var _useState9 = (0, _react.useState)(value.orderDirection || 'ASC'),
|
|
114
|
+
_useState0 = (0, _slicedToArray2["default"])(_useState9, 2),
|
|
115
|
+
orderDirection = _useState0[0],
|
|
116
|
+
setOrderDirection = _useState0[1];
|
|
117
|
+
(0, _react.useEffect)(function () {
|
|
118
|
+
var _formulaRootRef$curre;
|
|
119
|
+
if (condition !== '聚合字符串拼接') return;
|
|
120
|
+
var popup = (_formulaRootRef$curre = formulaRootRef.current) === null || _formulaRootRef$curre === void 0 ? void 0 : _formulaRootRef$curre.parentElement;
|
|
121
|
+
if (!popup) return;
|
|
122
|
+
var previousOverflowY = popup.style.overflowY;
|
|
123
|
+
popup.style.overflowY = 'hidden';
|
|
124
|
+
return function () {
|
|
125
|
+
popup.style.overflowY = previousOverflowY;
|
|
126
|
+
};
|
|
127
|
+
}, [condition]);
|
|
128
|
+
var _useState1 = (0, _react.useState)(function () {
|
|
94
129
|
if (Special.includes(value.condition)) {
|
|
95
130
|
return [];
|
|
96
131
|
}
|
|
@@ -117,9 +152,9 @@ var SelectSummarize = function SelectSummarize(_ref) {
|
|
|
117
152
|
}
|
|
118
153
|
return [];
|
|
119
154
|
}),
|
|
120
|
-
|
|
121
|
-
atoms =
|
|
122
|
-
setAtoms =
|
|
155
|
+
_useState10 = (0, _slicedToArray2["default"])(_useState1, 2),
|
|
156
|
+
atoms = _useState10[0],
|
|
157
|
+
setAtoms = _useState10[1];
|
|
123
158
|
function goPrevPage() {
|
|
124
159
|
if (readonly) return;
|
|
125
160
|
setCondition('');
|
|
@@ -197,7 +232,7 @@ var SelectSummarize = function SelectSummarize(_ref) {
|
|
|
197
232
|
availableData = data.map(function (v) {
|
|
198
233
|
return (0, _objectSpread2["default"])((0, _objectSpread2["default"])({}, v), {}, {
|
|
199
234
|
columns: v.columns.filter(function (o) {
|
|
200
|
-
return o.database_type && (_const.NUMBER_GROUP.includes(o.database_type) || (condition === '最大值' || condition === '最小值') && _const.DATE_GROUP.includes(o.database_type));
|
|
235
|
+
return o.database_type && ((condition === '聚合字符串拼接' ? _const.STRING_GROUP.includes(o.database_type) : _const.NUMBER_GROUP.includes(o.database_type)) || (condition === '最大值' || condition === '最小值') && _const.DATE_GROUP.includes(o.database_type));
|
|
201
236
|
})
|
|
202
237
|
});
|
|
203
238
|
}).filter(function (v) {
|
|
@@ -206,9 +241,16 @@ var SelectSummarize = function SelectSummarize(_ref) {
|
|
|
206
241
|
}
|
|
207
242
|
return availableData;
|
|
208
243
|
}
|
|
244
|
+
var getCurrentPopupContainer = function getCurrentPopupContainer(node) {
|
|
245
|
+
var _node$closest;
|
|
246
|
+
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;
|
|
247
|
+
};
|
|
209
248
|
if (condition && !~Special.indexOf(condition)) {
|
|
210
249
|
return (0, _jsxRuntime.jsxs)("div", {
|
|
211
|
-
|
|
250
|
+
ref: formulaRootRef,
|
|
251
|
+
className: (0, _classnames["default"])('Sqb-SelectSummarize-formula', {
|
|
252
|
+
'is-string-agg': condition === '聚合字符串拼接'
|
|
253
|
+
}),
|
|
212
254
|
children: [(0, _jsxRuntime.jsx)("div", {
|
|
213
255
|
className: 'back-title',
|
|
214
256
|
children: (0, _jsxRuntime.jsxs)("div", {
|
|
@@ -217,11 +259,25 @@ var SelectSummarize = function SelectSummarize(_ref) {
|
|
|
217
259
|
children: [" ", (0, _locale.__)(localeMap[condition]), " "]
|
|
218
260
|
})]
|
|
219
261
|
})
|
|
220
|
-
}), (0, _jsxRuntime.
|
|
262
|
+
}), (0, _jsxRuntime.jsxs)("div", {
|
|
221
263
|
className: 'Sqb-SelectSummarize-formula-body',
|
|
222
|
-
children: (0, _jsxRuntime.
|
|
264
|
+
children: [condition === '聚合字符串拼接' && (0, _jsxRuntime.jsxs)("div", {
|
|
265
|
+
className: 'Sqb-item Sqb-string-agg-distinct',
|
|
266
|
+
children: [(0, _jsxRuntime.jsx)(_pandora.Checkbox, {
|
|
267
|
+
checked: distinct,
|
|
268
|
+
disabled: readonly,
|
|
269
|
+
onChange: setDistinct,
|
|
270
|
+
children: "\u662F\u5426\u5F00\u542F\u53BB\u91CD"
|
|
271
|
+
}), (0, _jsxRuntime.jsx)("span", {
|
|
272
|
+
className: 'Sqb-string-agg-distinct-tip',
|
|
273
|
+
children: "SQL Server \u4E0D\u652F\u6301\u914D\u7F6E DISTINCT\uFF0C\u8BF7\u5728\u5B50\u67E5\u8BE2\u91CC\u9762\u53BB\u91CD\u5B8C\u518D\u62FC\u63A5"
|
|
274
|
+
})]
|
|
275
|
+
}), (0, _jsxRuntime.jsxs)("div", {
|
|
223
276
|
className: 'Sqb-item',
|
|
224
|
-
children: (0, _jsxRuntime.jsx)("div", {
|
|
277
|
+
children: [condition === '聚合字符串拼接' && (0, _jsxRuntime.jsx)("div", {
|
|
278
|
+
className: 'Sqb-item--label',
|
|
279
|
+
children: "\u9009\u62E9\u62FC\u63A5\u5B57\u6BB5"
|
|
280
|
+
}), (0, _jsxRuntime.jsx)("div", {
|
|
225
281
|
className: 'Sqb-item--content',
|
|
226
282
|
children: (0, _jsxRuntime.jsx)(_formulaList["default"], {
|
|
227
283
|
value: atoms,
|
|
@@ -234,17 +290,82 @@ var SelectSummarize = function SelectSummarize(_ref) {
|
|
|
234
290
|
didUpdate === null || didUpdate === void 0 || didUpdate();
|
|
235
291
|
}
|
|
236
292
|
})
|
|
237
|
-
})
|
|
238
|
-
})
|
|
293
|
+
})]
|
|
294
|
+
}), condition === '聚合字符串拼接' && (0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
295
|
+
children: [(0, _jsxRuntime.jsxs)("div", {
|
|
296
|
+
className: 'Sqb-item',
|
|
297
|
+
children: [(0, _jsxRuntime.jsx)("div", {
|
|
298
|
+
className: 'Sqb-item--label',
|
|
299
|
+
children: "\u5206\u9694\u7B26"
|
|
300
|
+
}), (0, _jsxRuntime.jsx)("div", {
|
|
301
|
+
className: 'Sqb-item--content',
|
|
302
|
+
children: (0, _jsxRuntime.jsx)(_pandora.Input, {
|
|
303
|
+
value: delimiter,
|
|
304
|
+
placeholder: "\u8BF7\u8F93\u5165\u5206\u9694\u7B26",
|
|
305
|
+
size: 'large',
|
|
306
|
+
onChange: function onChange(val) {
|
|
307
|
+
return setDelimiter(val);
|
|
308
|
+
}
|
|
309
|
+
})
|
|
310
|
+
})]
|
|
311
|
+
}), (0, _jsxRuntime.jsxs)("div", {
|
|
312
|
+
className: 'Sqb-item',
|
|
313
|
+
children: [(0, _jsxRuntime.jsx)("div", {
|
|
314
|
+
className: 'Sqb-item--label',
|
|
315
|
+
children: "\u9009\u62E9\u6392\u5E8F\u5B57\u6BB5"
|
|
316
|
+
}), (0, _jsxRuntime.jsx)("div", {
|
|
317
|
+
className: 'Sqb-item--content',
|
|
318
|
+
children: (0, _jsxRuntime.jsx)(_formulaList["default"], {
|
|
319
|
+
value: orderBy,
|
|
320
|
+
data: data,
|
|
321
|
+
exitData: data,
|
|
322
|
+
enableCopy: false,
|
|
323
|
+
parentPopupChannel: 'secondary',
|
|
324
|
+
onChange: function onChange(nextValue) {
|
|
325
|
+
setOrderBy(nextValue);
|
|
326
|
+
didUpdate === null || didUpdate === void 0 || didUpdate();
|
|
327
|
+
}
|
|
328
|
+
})
|
|
329
|
+
})]
|
|
330
|
+
}), (0, _jsxRuntime.jsxs)("div", {
|
|
331
|
+
className: 'Sqb-item',
|
|
332
|
+
children: [(0, _jsxRuntime.jsx)("div", {
|
|
333
|
+
className: 'Sqb-item--label',
|
|
334
|
+
children: "\u9009\u62E9\u6392\u5E8F\u89C4\u5219"
|
|
335
|
+
}), (0, _jsxRuntime.jsx)("div", {
|
|
336
|
+
className: 'Sqb-item--content',
|
|
337
|
+
children: (0, _jsxRuntime.jsxs)(_pandora.Select, {
|
|
338
|
+
value: orderDirection,
|
|
339
|
+
size: 'large',
|
|
340
|
+
getPopupContainer: getCurrentPopupContainer,
|
|
341
|
+
onChange: function onChange(val) {
|
|
342
|
+
return setOrderDirection(val);
|
|
343
|
+
},
|
|
344
|
+
children: [(0, _jsxRuntime.jsx)(_pandora.Select.Option, {
|
|
345
|
+
value: 'ASC',
|
|
346
|
+
children: "ASC"
|
|
347
|
+
}), (0, _jsxRuntime.jsx)(_pandora.Select.Option, {
|
|
348
|
+
value: 'DESC',
|
|
349
|
+
children: "DESC"
|
|
350
|
+
})]
|
|
351
|
+
})
|
|
352
|
+
})]
|
|
353
|
+
})]
|
|
354
|
+
})]
|
|
239
355
|
}), !readonly && (0, _jsxRuntime.jsx)("div", {
|
|
240
356
|
className: 'Sqb-SelectSummarize-formula-footer',
|
|
241
357
|
children: (0, _jsxRuntime.jsx)(_pandora.Button, {
|
|
242
358
|
primary: true,
|
|
243
359
|
disabled: !atoms.length,
|
|
244
360
|
onClick: function onClick() {
|
|
245
|
-
handleSelect(condition, {
|
|
361
|
+
handleSelect(condition, (0, _objectSpread2["default"])({
|
|
246
362
|
atoms: atoms
|
|
247
|
-
}
|
|
363
|
+
}, condition === '聚合字符串拼接' ? {
|
|
364
|
+
distinct: distinct,
|
|
365
|
+
delimiter: delimiter,
|
|
366
|
+
orderBy: orderBy,
|
|
367
|
+
orderDirection: orderDirection
|
|
368
|
+
} : {}));
|
|
248
369
|
},
|
|
249
370
|
children: "\u786E\u5B9A"
|
|
250
371
|
})
|
|
@@ -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:
|
|
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;
|
|
@@ -7,6 +7,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
});
|
|
8
8
|
exports["default"] = void 0;
|
|
9
9
|
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
10
|
+
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/toConsumableArray"));
|
|
10
11
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/defineProperty"));
|
|
11
12
|
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/asyncToGenerator"));
|
|
12
13
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/slicedToArray"));
|
|
@@ -95,6 +96,12 @@ var SelectTable = function SelectTable(_ref) {
|
|
|
95
96
|
_ref$sourceTable = _ref.sourceTable,
|
|
96
97
|
sourceTable = _ref$sourceTable === void 0 ? EMPTY_ARRAY : _ref$sourceTable,
|
|
97
98
|
value = _ref.value,
|
|
99
|
+
_ref$selectedValues = _ref.selectedValues,
|
|
100
|
+
selectedValues = _ref$selectedValues === void 0 ? EMPTY_ARRAY : _ref$selectedValues,
|
|
101
|
+
_ref$lockedValues = _ref.lockedValues,
|
|
102
|
+
lockedValues = _ref$lockedValues === void 0 ? EMPTY_ARRAY : _ref$lockedValues,
|
|
103
|
+
_ref$multiple = _ref.multiple,
|
|
104
|
+
multiple = _ref$multiple === void 0 ? false : _ref$multiple,
|
|
98
105
|
_ref$onChange = _ref.onChange,
|
|
99
106
|
onChange = _ref$onChange === void 0 ? function () {} : _ref$onChange,
|
|
100
107
|
didUpdate = _ref.didUpdate,
|
|
@@ -136,10 +143,14 @@ var SelectTable = function SelectTable(_ref) {
|
|
|
136
143
|
_useState16 = (0, _slicedToArray2["default"])(_useState15, 2),
|
|
137
144
|
selectedFlatTableTypes = _useState16[0],
|
|
138
145
|
setSelectedFlatTableTypes = _useState16[1];
|
|
139
|
-
var _useState17 = (0, _react.useState)(
|
|
146
|
+
var _useState17 = (0, _react.useState)(selectedValues),
|
|
140
147
|
_useState18 = (0, _slicedToArray2["default"])(_useState17, 2),
|
|
141
|
-
|
|
142
|
-
|
|
148
|
+
multipleValues = _useState18[0],
|
|
149
|
+
setMultipleValues = _useState18[1];
|
|
150
|
+
var _useState19 = (0, _react.useState)(value),
|
|
151
|
+
_useState20 = (0, _slicedToArray2["default"])(_useState19, 2),
|
|
152
|
+
val = _useState20[0],
|
|
153
|
+
setVal = _useState20[1];
|
|
143
154
|
var searchInputRef = (0, _react.useRef)(null);
|
|
144
155
|
var flatSearchInputRef = (0, _react.useRef)(null);
|
|
145
156
|
var tableTypeOptions = (0, _react.useMemo)(function () {
|
|
@@ -149,6 +160,21 @@ var SelectTable = function SelectTable(_ref) {
|
|
|
149
160
|
return getFlatTableTypeOptions(sourceTable);
|
|
150
161
|
}, [sourceTable]);
|
|
151
162
|
var nextPage = !val.datasourceId;
|
|
163
|
+
var isLockedTable = function isLockedTable(tableValue) {
|
|
164
|
+
return lockedValues.some(function (item) {
|
|
165
|
+
return (0, _helper.isSameTableByIdName)(item, tableValue);
|
|
166
|
+
});
|
|
167
|
+
};
|
|
168
|
+
var isTableSelected = function isTableSelected(tableValue) {
|
|
169
|
+
return multiple ? multipleValues.some(function (item) {
|
|
170
|
+
return (0, _helper.isSameTableByIdName)(item, tableValue);
|
|
171
|
+
}) : (0, _helper.isSameTableByIdName)(value, tableValue);
|
|
172
|
+
};
|
|
173
|
+
(0, _react.useEffect)(function () {
|
|
174
|
+
if (multiple) {
|
|
175
|
+
setMultipleValues(selectedValues);
|
|
176
|
+
}
|
|
177
|
+
}, [multiple, selectedValues]);
|
|
152
178
|
(0, _react.useEffect)(function () {
|
|
153
179
|
if (value.datasourceId) {
|
|
154
180
|
getTables(value.datasourceId);
|
|
@@ -258,6 +284,22 @@ var SelectTable = function SelectTable(_ref) {
|
|
|
258
284
|
alias: ''
|
|
259
285
|
});
|
|
260
286
|
}
|
|
287
|
+
function handleTableClick(tableValue) {
|
|
288
|
+
if (!multiple) {
|
|
289
|
+
onChange(tableValue);
|
|
290
|
+
return;
|
|
291
|
+
}
|
|
292
|
+
if (isLockedTable(tableValue)) return;
|
|
293
|
+
setMultipleValues(function (list) {
|
|
294
|
+
var exists = list.some(function (item) {
|
|
295
|
+
return (0, _helper.isSameTableByIdName)(item, tableValue);
|
|
296
|
+
});
|
|
297
|
+
return exists ? list.filter(function (item) {
|
|
298
|
+
return !(0, _helper.isSameTableByIdName)(item, tableValue);
|
|
299
|
+
}) : [].concat((0, _toConsumableArray2["default"])(list), [tableValue]);
|
|
300
|
+
});
|
|
301
|
+
onChange(tableValue);
|
|
302
|
+
}
|
|
261
303
|
function renderTableTypeFilter(tableTypes) {
|
|
262
304
|
if (tableTypes.length <= 1) return null;
|
|
263
305
|
return (0, _jsxRuntime.jsx)("div", {
|
|
@@ -350,10 +392,11 @@ var SelectTable = function SelectTable(_ref) {
|
|
|
350
392
|
className: (0, _classnames["default"])("Sqb-List-section"),
|
|
351
393
|
children: (0, _jsxRuntime.jsx)("div", {
|
|
352
394
|
className: (0, _classnames["default"])("Sqb-List-item mx-2", {
|
|
353
|
-
active: (
|
|
395
|
+
active: isTableSelected(tableValue),
|
|
396
|
+
disabled: isLockedTable(tableValue)
|
|
354
397
|
}),
|
|
355
398
|
onClick: function onClick() {
|
|
356
|
-
|
|
399
|
+
handleTableClick(tableValue);
|
|
357
400
|
},
|
|
358
401
|
children: (0, _jsxRuntime.jsxs)("a", {
|
|
359
402
|
className: 'p-2',
|
|
@@ -472,10 +515,11 @@ var SelectTable = function SelectTable(_ref) {
|
|
|
472
515
|
className: (0, _classnames["default"])("Sqb-List-section"),
|
|
473
516
|
children: (0, _jsxRuntime.jsx)("div", {
|
|
474
517
|
className: (0, _classnames["default"])("Sqb-List-item mx-2", {
|
|
475
|
-
active: (
|
|
518
|
+
active: isTableSelected(tableValue),
|
|
519
|
+
disabled: isLockedTable(tableValue)
|
|
476
520
|
}),
|
|
477
521
|
onClick: function onClick() {
|
|
478
|
-
|
|
522
|
+
handleTableClick(tableValue);
|
|
479
523
|
},
|
|
480
524
|
children: (0, _jsxRuntime.jsxs)("a", {
|
|
481
525
|
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;
|
|
@@ -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
|
|
198
|
+
var FullJoinIcon = exports.FullJoinIcon = function FullJoinIcon(_ref1) {
|
|
199
199
|
var _ref1$width = _ref1.width,
|
|
200
|
-
width = _ref1$width === void 0 ?
|
|
200
|
+
width = _ref1$width === void 0 ? 32 : _ref1$width,
|
|
201
201
|
_ref1$height = _ref1.height,
|
|
202
|
-
height = _ref1$height === void 0 ?
|
|
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(
|
|
217
|
-
var
|
|
218
|
-
width =
|
|
219
|
-
|
|
220
|
-
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(
|
|
235
|
-
var
|
|
236
|
-
width =
|
|
237
|
-
|
|
238
|
-
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(
|
|
253
|
-
var
|
|
254
|
-
width =
|
|
255
|
-
|
|
256
|
-
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(
|
|
270
|
-
var
|
|
271
|
-
width =
|
|
272
|
-
|
|
273
|
-
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(
|
|
287
|
-
var
|
|
288
|
-
width =
|
|
289
|
-
|
|
290
|
-
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,
|
|
@@ -242,8 +242,16 @@ var Metabase = function Metabase(props) {
|
|
|
242
242
|
e.preventDefault();
|
|
243
243
|
e.stopPropagation();
|
|
244
244
|
};
|
|
245
|
+
var stopTooltipInteraction = function stopTooltipInteraction(e) {
|
|
246
|
+
var _target$closest2;
|
|
247
|
+
var target = e.target;
|
|
248
|
+
if (!(target !== null && target !== void 0 && (_target$closest2 = target.closest) !== null && _target$closest2 !== void 0 && _target$closest2.call(target, '.pd-Tooltip'))) return;
|
|
249
|
+
e.stopPropagation();
|
|
250
|
+
};
|
|
245
251
|
return (0, _jsxRuntime.jsx)(VisualBox, {
|
|
246
252
|
ref: store.popupContainer,
|
|
253
|
+
onMouseDownCapture: stopTooltipInteraction,
|
|
254
|
+
onClickCapture: stopTooltipInteraction,
|
|
247
255
|
onContextMenu: function onContextMenu(e) {
|
|
248
256
|
if (readonlyMode) {
|
|
249
257
|
e.preventDefault();
|