@gingkoo/pandora-metabase 1.0.155 → 1.0.157-alpha.1

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 (29) hide show
  1. package/lib/cjs/components/dialog/formula-list/index.js +16 -8
  2. package/lib/cjs/components/dialog/select-summarize/index.d.ts +4 -0
  3. package/lib/cjs/components/dialog/select-summarize/index.js +136 -15
  4. package/lib/cjs/components/dialog/select-summarize/index.less +34 -1
  5. package/lib/cjs/components/metabase/index.js +8 -0
  6. package/lib/cjs/components/metabase/index.less +5 -0
  7. package/lib/cjs/components/modules/components/item-name.js +16 -2
  8. package/lib/cjs/components/modules/summarize/group-by.js +17 -4
  9. package/lib/cjs/components/modules/summarize/select-index.js +17 -4
  10. package/lib/cjs/locale/en.js +4 -0
  11. package/lib/cjs/locale/zh.js +4 -0
  12. package/lib/cjs/store/helper.js +25 -2
  13. package/lib/cjs/store/types.d.ts +4 -0
  14. package/lib/cjs/utils.js +23 -2
  15. package/lib/es/components/dialog/formula-list/index.js +16 -8
  16. package/lib/es/components/dialog/select-summarize/index.d.ts +4 -0
  17. package/lib/es/components/dialog/select-summarize/index.js +140 -19
  18. package/lib/es/components/dialog/select-summarize/index.less +34 -1
  19. package/lib/es/components/metabase/index.js +8 -0
  20. package/lib/es/components/metabase/index.less +5 -0
  21. package/lib/es/components/modules/components/item-name.js +16 -2
  22. package/lib/es/components/modules/summarize/group-by.js +17 -4
  23. package/lib/es/components/modules/summarize/select-index.js +17 -4
  24. package/lib/es/locale/en.js +4 -0
  25. package/lib/es/locale/zh.js +4 -0
  26. package/lib/es/store/helper.js +25 -2
  27. package/lib/es/store/types.d.ts +4 -0
  28. package/lib/es/utils.js +23 -2
  29. package/package.json +1 -1
package/lib/cjs/utils.js CHANGED
@@ -1244,15 +1244,27 @@ var changeTableAlias = exports.changeTableAlias = function changeTableAlias(list
1244
1244
  }
1245
1245
  if (v.type === _enum.TypeEnum.summarize) {
1246
1246
  v.group.map(function (group) {
1247
+ var _group$orderBy;
1247
1248
  var groupAtoms = group.atoms;
1249
+ var shouldRefreshSql = false;
1248
1250
  if (groupAtoms && groupAtoms.length > 0) {
1249
1251
  group.atoms = _changeAlias(groupAtoms, {
1250
1252
  uuid: tableUuid,
1251
1253
  alias: alias
1252
1254
  }, AliasType.table);
1253
- group.sql = (0, _helper.summarizeToSql)(v.group, group).sql;
1255
+ shouldRefreshSql = true;
1254
1256
  } else if (group.tableUuid === tableUuid) {
1255
1257
  group.alias = alias;
1258
+ shouldRefreshSql = true;
1259
+ }
1260
+ if ((_group$orderBy = group.orderBy) !== null && _group$orderBy !== void 0 && _group$orderBy.length) {
1261
+ group.orderBy = _changeAlias(group.orderBy, {
1262
+ uuid: tableUuid,
1263
+ alias: alias
1264
+ }, AliasType.table);
1265
+ shouldRefreshSql = true;
1266
+ }
1267
+ if (shouldRefreshSql) {
1256
1268
  group.sql = (0, _helper.summarizeToSql)(v.group, group).sql;
1257
1269
  }
1258
1270
  });
@@ -1330,12 +1342,21 @@ var changeFieldAlias = exports.changeFieldAlias = function changeFieldAlias(list
1330
1342
  if (v.type === _enum.TypeEnum.rowLimit) {}
1331
1343
  if (v.type === _enum.TypeEnum.summarize) {
1332
1344
  v.group.map(function (group) {
1345
+ var _group$orderBy2;
1333
1346
  var groupAtoms = group.atoms;
1347
+ var shouldRefreshSql = false;
1334
1348
  if (groupAtoms && groupAtoms.length > 0) {
1335
1349
  group.atoms = _changeAlias(groupAtoms, aliasTarget, AliasType.field);
1336
- group.sql = (0, _helper.summarizeToSql)(v.group, group).sql;
1350
+ shouldRefreshSql = true;
1337
1351
  } else if (isAliasTargetSummarizeRecord(group, aliasTarget)) {
1338
1352
  group.fieldAlias = alias;
1353
+ shouldRefreshSql = true;
1354
+ }
1355
+ if ((_group$orderBy2 = group.orderBy) !== null && _group$orderBy2 !== void 0 && _group$orderBy2.length) {
1356
+ group.orderBy = _changeAlias(group.orderBy, aliasTarget, AliasType.field);
1357
+ shouldRefreshSql = true;
1358
+ }
1359
+ if (shouldRefreshSql) {
1339
1360
  group.sql = (0, _helper.summarizeToSql)(v.group, group).sql;
1340
1361
  }
1341
1362
  });
@@ -39,6 +39,7 @@ import { getTopLayerZIndex } from '../../../utils/helper-dom';
39
39
  import CaseWhenGroup from './CaseWhenGroup';
40
40
  import LogicGroup from './LogicGroup';
41
41
  import { SummarizeAlias } from '../../../store/helper';
42
+ var parentPopupLockCounts = new WeakMap();
42
43
  var CASE_FIXED_OPERATORS = ['case', 'when', 'then', 'else', 'end'];
43
44
  var LOGIC_FIXED_OPERATORS = ['(', ')'];
44
45
  var LOGIC_REQUIRED_OPERATORS = ['(', ')'];
@@ -190,6 +191,16 @@ var FormulaList = forwardRef(function (props, ref) {
190
191
  }
191
192
  store.setClosable(closable);
192
193
  };
194
+ var changeSharedParentLockCount = function changeSharedParentLockCount(delta) {
195
+ if (!parentPopupChannel) return;
196
+ var counts = parentPopupLockCounts.get(store) || {
197
+ primary: 0,
198
+ secondary: 0
199
+ };
200
+ counts[parentPopupChannel] = Math.max(0, counts[parentPopupChannel] + delta);
201
+ parentPopupLockCounts.set(store, counts);
202
+ setParentClosable(counts[parentPopupChannel] === 0);
203
+ };
193
204
  var lockParentPopup = function lockParentPopup() {
194
205
  if (!parentPopupChannel) return;
195
206
  if (parentPopupUnlockTimerRef.current) {
@@ -197,19 +208,16 @@ var FormulaList = forwardRef(function (props, ref) {
197
208
  parentPopupUnlockTimerRef.current = null;
198
209
  }
199
210
  parentPopupLockCountRef.current += 1;
200
- if (parentPopupLockCountRef.current === 1) {
201
- setParentClosable(false);
202
- }
211
+ changeSharedParentLockCount(1);
203
212
  };
204
213
  var unlockParentPopup = function unlockParentPopup() {
205
214
  var delay = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
206
215
  if (!parentPopupChannel) return;
207
216
  var runUnlock = function runUnlock() {
208
217
  parentPopupUnlockTimerRef.current = null;
209
- parentPopupLockCountRef.current = Math.max(0, parentPopupLockCountRef.current - 1);
210
- if (parentPopupLockCountRef.current === 0) {
211
- setParentClosable(true);
212
- }
218
+ if (parentPopupLockCountRef.current === 0) return;
219
+ parentPopupLockCountRef.current -= 1;
220
+ changeSharedParentLockCount(-1);
213
221
  };
214
222
  if (delay > 0) {
215
223
  if (parentPopupUnlockTimerRef.current) {
@@ -259,8 +267,8 @@ var FormulaList = forwardRef(function (props, ref) {
259
267
  parentPopupUnlockTimerRef.current = null;
260
268
  }
261
269
  if (parentPopupLockCountRef.current > 0) {
270
+ changeSharedParentLockCount(-parentPopupLockCountRef.current);
262
271
  parentPopupLockCountRef.current = 0;
263
- setParentClosable(true);
264
272
  }
265
273
  };
266
274
  }, [parentPopupChannel]);
@@ -10,6 +10,10 @@ export type ValueType = Partial<ColumnType> & {
10
10
  condition: string;
11
11
  quotes: string;
12
12
  atoms?: AtomsItem[];
13
+ delimiter?: string;
14
+ distinct?: boolean;
15
+ orderBy?: AtomsItem[];
16
+ orderDirection?: 'ASC' | 'DESC';
13
17
  };
14
18
  interface PropsType {
15
19
  data: DataType[];
@@ -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
  }
@@ -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();
@@ -1,5 +1,10 @@
1
1
  @import './helper.less';
2
2
 
3
+ // Tooltip 动画期间组件库会临时关闭 pointer-events,导致点击穿透到下层按钮。
4
+ .pd-Trigger.pd-Tooltip {
5
+ pointer-events: auto !important;
6
+ }
7
+
3
8
  .visual-box {
4
9
  position: relative;
5
10
  width: 100%;
@@ -11,7 +11,15 @@ var ItemName = function ItemName(props) {
11
11
  var showError = isError && !store.snapshotMode;
12
12
  return _jsx(Badge, {
13
13
  count: showError ? _jsx(Tooltip, {
14
- title: message || __('metabase.verify'),
14
+ title: _jsx("span", {
15
+ onMouseDown: function onMouseDown(e) {
16
+ return e.stopPropagation();
17
+ },
18
+ onClick: function onClick(e) {
19
+ return e.stopPropagation();
20
+ },
21
+ children: message || __('metabase.verify')
22
+ }),
15
23
  children: _jsx(Button, {
16
24
  className: 'isError',
17
25
  style: {
@@ -22,7 +30,13 @@ var ItemName = function ItemName(props) {
22
30
  danger: true,
23
31
  size: 'small',
24
32
  icon: _jsx(ExclamationCircleFill, {}),
25
- iconOnly: true
33
+ iconOnly: true,
34
+ onMouseDown: function onMouseDown(e) {
35
+ return e.stopPropagation();
36
+ },
37
+ onClick: function onClick(e) {
38
+ return e.stopPropagation();
39
+ }
26
40
  })
27
41
  }) : '',
28
42
  children: children
@@ -513,8 +513,10 @@ var GroupBy = function GroupBy(props) {
513
513
  };
514
514
  return _jsxs(_Fragment, {
515
515
  children: [meta.by.map(function (v, i) {
516
+ var existsError = isExistsError([getErrorCheckField(v)], store.existsError);
517
+ var aliasError = !isValidSQLAlias(v === null || v === void 0 ? void 0 : v.fieldAlias);
516
518
  return _jsx(ItemName, {
517
- isError: isExistsError([getErrorCheckField(v)], store.existsError),
519
+ isError: existsError && !store.groupByEnableAlias,
518
520
  children: _jsx(RightClickValue, {
519
521
  value: v,
520
522
  children: _jsxs("div", {
@@ -526,11 +528,22 @@ var GroupBy = function GroupBy(props) {
526
528
  children: [v.quotes && _jsx(_Fragment, {
527
529
  children: store.groupByEnableAlias && !store.snapshotMode && _jsx(_Fragment, {
528
530
  children: _jsx(Tooltip, {
529
- title: __(!isValidSQLAlias(v === null || v === void 0 ? void 0 : v.fieldAlias) ? 'SqlQueryBuilder.aliasForRulesAction' : 'SqlQueryBuilder.alias'),
531
+ triggerProps: {
532
+ duration: 0
533
+ },
534
+ title: _jsx("span", {
535
+ onMouseDown: function onMouseDown(e) {
536
+ return e.stopPropagation();
537
+ },
538
+ onClick: function onClick(e) {
539
+ return e.stopPropagation();
540
+ },
541
+ children: __(existsError ? 'SqlQueryBuilder.existsErrorAliasAction' : aliasError ? 'SqlQueryBuilder.aliasForRulesAction' : 'SqlQueryBuilder.alias')
542
+ }),
530
543
  children: _jsx(Button, {
531
- danger: !isValidSQLAlias(v === null || v === void 0 ? void 0 : v.fieldAlias),
544
+ danger: existsError || aliasError,
532
545
  className: cx(':Sqb-TableName-as :Sqb-TableName green-name', {
533
- isError: !isValidSQLAlias(v === null || v === void 0 ? void 0 : v.fieldAlias)
546
+ isError: existsError || aliasError
534
547
  }),
535
548
  shape: 'circle',
536
549
  iconOnly: true,
@@ -411,8 +411,10 @@ var SelectIndex = function SelectIndex(props) {
411
411
  };
412
412
  return _jsxs(_Fragment, {
413
413
  children: [meta.group.map(function (v, i) {
414
+ var existsError = isExistsError([getErrorCheckField(v)], store.existsError);
415
+ var aliasError = !isValidSQLAlias(v === null || v === void 0 ? void 0 : v.fieldAlias);
414
416
  return _jsx(ItemName, {
415
- isError: isExistsError([getErrorCheckField(v)], store.existsError),
417
+ isError: existsError && !store.groupByEnableAlias,
416
418
  children: _jsx(RightClickValue, {
417
419
  value: v,
418
420
  children: _jsxs("div", {
@@ -424,11 +426,22 @@ var SelectIndex = function SelectIndex(props) {
424
426
  children: [v.quotes && _jsx(_Fragment, {
425
427
  children: store.groupByEnableAlias && !store.snapshotMode && _jsx(_Fragment, {
426
428
  children: _jsx(Tooltip, {
427
- title: __(!isValidSQLAlias(v === null || v === void 0 ? void 0 : v.fieldAlias) ? 'SqlQueryBuilder.aliasForRulesAction' : 'SqlQueryBuilder.alias'),
429
+ triggerProps: {
430
+ duration: 0
431
+ },
432
+ title: _jsx("span", {
433
+ onMouseDown: function onMouseDown(e) {
434
+ return e.stopPropagation();
435
+ },
436
+ onClick: function onClick(e) {
437
+ return e.stopPropagation();
438
+ },
439
+ children: __(existsError ? 'SqlQueryBuilder.existsErrorAliasAction' : aliasError ? 'SqlQueryBuilder.aliasForRulesAction' : 'SqlQueryBuilder.alias')
440
+ }),
428
441
  children: _jsx(Button, {
429
- danger: !isValidSQLAlias(v === null || v === void 0 ? void 0 : v.fieldAlias),
442
+ danger: existsError || aliasError,
430
443
  className: cx(':Sqb-TableName-as :Sqb-TableName green-name', {
431
- isError: !isValidSQLAlias(v === null || v === void 0 ? void 0 : v.fieldAlias)
444
+ isError: existsError || aliasError
432
445
  }),
433
446
  shape: 'circle',
434
447
  iconOnly: true,
@@ -55,6 +55,7 @@ export default register('en', {
55
55
  'SqlQueryBuilder.pleaseSelectTable': 'The currently dependent table is empty or has been deleted',
56
56
  'SqlQueryBuilder.repeatAlias': 'If there are duplicate names, please modify them',
57
57
  'SqlQueryBuilder.repeatAliasAction': 'Duplicate alias. Click to modify the alias',
58
+ 'SqlQueryBuilder.existsErrorAliasAction': 'Field validation error. Click to modify the alias',
58
59
  'customColumn.operator': 'operator',
59
60
  'customColumn.collection': 'collection',
60
61
  'customColumn.field': 'field',
@@ -143,6 +144,8 @@ export default register('en', {
143
144
  'summarize.theSmallestYes': 'the smallest, yes',
144
145
  'summarize.maximumCalue': 'maximum value',
145
146
  'summarize.biggestYes': 'biggest, yes',
147
+ 'summarize.stringAgg': 'Aggregate string concatenation',
148
+ 'summarize.stringAggExpression': 'STRING_AGG',
146
149
  'summarize.totalNumberOfRowsOfData': 'total number of rows of data',
147
150
  'summarize.theSumOfAllValuesInAField': 'the sum of all values in a field',
148
151
  'summarize.theAverageOfAllValuesInAfield': 'the average of all values in a field',
@@ -152,6 +155,7 @@ export default register('en', {
152
155
  'summarize.theStandardDeviationOfAllValuesInAfield': 'the standard deviation of all values in a field',
153
156
  'summarize.theMinimumValueOfAfield': 'the minimum value of a field',
154
157
  'summarize.TheMaximumValueOfAfield': 'the maximum value of a field',
158
+ 'summarize.stringAggDescription': 'Concatenate strings across rows within each group, with a custom delimiter.',
155
159
  'rowLimit.pleaseEnter': 'please enter',
156
160
  'result.TheSQLStatementForThisQuery': 'The SQL statement for this query',
157
161
  'result.closePanel': 'close panel',
@@ -51,6 +51,7 @@ export default register('zh', {
51
51
  'SqlQueryBuilder.pleaseSelectTable': '当前依赖的表为空或被删除',
52
52
  'SqlQueryBuilder.repeatAlias': '有重名请修改',
53
53
  'SqlQueryBuilder.repeatAliasAction': '别名重复,点击修改别名',
54
+ 'SqlQueryBuilder.existsErrorAliasAction': '字段校验错误,点击修改别名',
54
55
  'customColumn.operator': '操作符',
55
56
  'customColumn.collection': '自定义组合',
56
57
  'customColumn.field': '字段',
@@ -143,6 +144,8 @@ export default register('zh', {
143
144
  'summarize.theSmallestYes': '最小 的',
144
145
  'summarize.maximumCalue': '最大值',
145
146
  'summarize.biggestYes': '最大 的',
147
+ 'summarize.stringAgg': '聚合字符串拼接',
148
+ 'summarize.stringAggExpression': 'STRING_AGG',
146
149
  'summarize.totalNumberOfRowsOfData': '总的数据行数',
147
150
  'summarize.theSumOfAllValuesInAField': '一个字段所有数值的总和',
148
151
  'summarize.theAverageOfAllValuesInAfield': '一个字段所有数值的平均值',
@@ -152,6 +155,7 @@ export default register('zh', {
152
155
  'summarize.theStandardDeviationOfAllValuesInAfield': '一个字段所有数值的标准差',
153
156
  'summarize.theMinimumValueOfAfield': '一个字段的最小值',
154
157
  'summarize.TheMaximumValueOfAfield': '一个字段的最大值',
158
+ 'summarize.stringAggDescription': '按分组跨行拼接字符串,支持自定义分隔符。',
155
159
  'rowLimit.pleaseEnter': '请输入',
156
160
  'result.TheSQLStatementForThisQuery': '这个查询的SQL语句',
157
161
  'result.closePanel': '关闭面板',