@gingkoo/pandora-metabase 1.0.157-alpha.9 → 1.0.158-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.
@@ -31,8 +31,15 @@ var _itemName = _interopRequireDefault(require("../../modules/components/item-na
31
31
  var _dateFormatPicker = require("./date-format-picker");
32
32
  function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, "default": e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
33
33
  var NUMBER_LIST = ['等于', '不等于', '大于', '小于', '介于之间', '大于或等于', '小于或等于', '为空', '不为空', '以...开始', '以...结束', '不以...开始', '不以...结束', 'In', 'Not In', '正则匹配'];
34
- var STRING_LIST = ['等于', '不等于', '包含', '不包含', '为空', '不为空', '以...开始', '以...结束', '不以...开始', '不以...结束', 'In', 'Not In', '正则匹配'];
35
- var DATE_LIST = ['等于', '早于', '晚于', '介于之间', '是空的', '不为空'];
34
+ var STRING_LIST = ['等于', '不等于', '大于', '小于', '大于或等于', '小于或等于', '包含', '不包含', '为空', '不为空', '以...开始', '以...结束', '不以...开始', '不以...结束', 'In', 'Not In', '正则匹配'];
35
+ var DATE_LIST = ['等于', '大于', '小于', '大于或等于', '小于或等于', '介于之间', '为空', '不为空'];
36
+ var DATE_VALUE_CONDITIONS = ['等于', '大于', '小于', '大于或等于', '小于或等于', '早于', '晚于', '在'];
37
+ var SWITCH_VALUE_TYPE_CONDITIONS = ['等于', '不等于', '大于', '小于', '大于或等于', '小于或等于'];
38
+ var LEGACY_DATE_CONDITION_MAP = {
39
+ 早于: '小于',
40
+ 晚于: '大于或等于'
41
+ };
42
+ var LEGACY_EMPTY_CONDITIONS = new Set(['是空的', '不是空的']);
36
43
  var typeList = [{
37
44
  key: _enum.SQL_COLUMN_TYPE.STRING,
38
45
  label: _enum.SQL_COLUMN_TYPE.STRING
@@ -348,12 +355,16 @@ var SelectFilterColumn = function SelectFilterColumn(_ref) {
348
355
  conditions = DATE_LIST;
349
356
  type = _enum.SQL_GROUP_TYPE.DATE;
350
357
  }
358
+ var nextCondition = LEGACY_DATE_CONDITION_MAP[condition];
359
+ if (type === _enum.SQL_GROUP_TYPE.DATE && nextCondition) {
360
+ setCondition(nextCondition);
361
+ }
351
362
  if (isCustom) {
352
363
  conditions = ['无需结果'].concat((0, _toConsumableArray2["default"])(conditions));
353
364
  }
354
- var isCompatibleDateEmptyCondition = type === _enum.SQL_GROUP_TYPE.DATE && (condition === '为空' || condition === '不是空的');
355
- if (!conditions.includes(condition) && !isCompatibleDateEmptyCondition) {
356
- setDefaultVal(conditions[0]);
365
+ var isLegacyEmptyCondition = LEGACY_EMPTY_CONDITIONS.has(condition);
366
+ if (!conditions.includes(condition) && !nextCondition && !isLegacyEmptyCondition) {
367
+ setDefaultVal(conditions[0], type);
357
368
  }
358
369
  return {
359
370
  columnType: columnType,
@@ -507,7 +518,9 @@ var SelectFilterColumn = function SelectFilterColumn(_ref) {
507
518
  })
508
519
  })]
509
520
  });
510
- } else if (~['早于', '晚于', '在'].indexOf(conditionText)) {
521
+ } else if (type === _enum.SQL_GROUP_TYPE.DATE && ~DATE_VALUE_CONDITIONS.filter(function (v) {
522
+ return v !== '等于';
523
+ }).indexOf(conditionText)) {
511
524
  var _rhsVal$3, _rhsVal$4;
512
525
  var _dateVal = ((_rhsVal$3 = rhsVal[0]) === null || _rhsVal$3 === void 0 ? void 0 : _rhsVal$3.type) === _types.AtomsTypeEnum.INPUT_STRING ? rhsVal[0].val : undefined;
513
526
  var _dateFormat = ((_rhsVal$4 = rhsVal[0]) === null || _rhsVal$4 === void 0 ? void 0 : _rhsVal$4.type) === _types.AtomsTypeEnum.INPUT_STRING ? rhsVal[0].format : undefined;
@@ -652,10 +665,10 @@ var SelectFilterColumn = function SelectFilterColumn(_ref) {
652
665
  })
653
666
  });
654
667
  };
655
- var onRepeat = function onRepeat(e) {
668
+ var onRepeat = function onRepeat(e, fieldType) {
656
669
  var _rhsVal$7;
657
670
  setParentClosable(false);
658
- var inputAtomType = ((_rhsVal$7 = rhsVal[0]) === null || _rhsVal$7 === void 0 ? void 0 : _rhsVal$7.type) === _types.AtomsTypeEnum.INPUT_NUMBER ? _types.AtomsTypeEnum.INPUT_NUMBER : _types.AtomsTypeEnum.INPUT_STRING;
671
+ var inputAtomType = fieldType === _enum.SQL_GROUP_TYPE.NUMBER || ((_rhsVal$7 = rhsVal[0]) === null || _rhsVal$7 === void 0 ? void 0 : _rhsVal$7.type) === _types.AtomsTypeEnum.INPUT_NUMBER ? _types.AtomsTypeEnum.INPUT_NUMBER : _types.AtomsTypeEnum.INPUT_STRING;
659
672
  store.setPopup2({
660
673
  visible: true,
661
674
  node: e.currentTarget,
@@ -886,7 +899,7 @@ var SelectFilterColumn = function SelectFilterColumn(_ref) {
886
899
  getPopupContainer: getCurrentPopupContainer,
887
900
  onChange: function onChange(key) {
888
901
  setCurColumn((0, _objectSpread2["default"])({}, curColumn));
889
- setDefaultVal(key);
902
+ setDefaultVal(key, fieldType);
890
903
  },
891
904
  droplist: menu,
892
905
  children: (0, _jsxRuntime.jsxs)(_pandora.Button, {
@@ -931,14 +944,16 @@ var SelectFilterColumn = function SelectFilterColumn(_ref) {
931
944
  children: renderFilter(fieldType, condition)
932
945
  }, i);
933
946
  }
934
- }), ~['等于', '不等于', '早于', '晚于'].indexOf(condition) ? (0, _jsxRuntime.jsx)(_pandora.Tooltip, {
947
+ }), ~SWITCH_VALUE_TYPE_CONDITIONS.indexOf(condition) || fieldType === _enum.SQL_GROUP_TYPE.DATE && ~DATE_VALUE_CONDITIONS.indexOf(condition) ? (0, _jsxRuntime.jsx)(_pandora.Tooltip, {
935
948
  title: (0, _locale.__)('SqlQueryBuilder.switch'),
936
949
  children: (0, _jsxRuntime.jsx)(_pandora.Button, {
937
950
  primary: true,
938
951
  ghost: true,
939
952
  className: 'ml-2 operator-icon',
940
953
  icon: (0, _jsxRuntime.jsx)(_pandoraIcons.Repeat, {}),
941
- onClick: onRepeat
954
+ onClick: function onClick(e) {
955
+ return onRepeat(e, fieldType);
956
+ }
942
957
  })
943
958
  }) : '']
944
959
  }), (0, _jsxRuntime.jsx)("div", {
@@ -955,7 +970,7 @@ var SelectFilterColumn = function SelectFilterColumn(_ref) {
955
970
  })]
956
971
  });
957
972
  }
958
- function setDefaultVal(_condition) {
973
+ function setDefaultVal(_condition, fieldType) {
959
974
  var _rhsVal$0;
960
975
  setCondition(_condition);
961
976
  var inputAtomType = ((_rhsVal$0 = rhsVal[0]) === null || _rhsVal$0 === void 0 ? void 0 : _rhsVal$0.type) === _types.AtomsTypeEnum.INPUT_NUMBER ? _types.AtomsTypeEnum.INPUT_NUMBER : _types.AtomsTypeEnum.INPUT_STRING;
@@ -975,7 +990,7 @@ var SelectFilterColumn = function SelectFilterColumn(_ref) {
975
990
  val: '天',
976
991
  type: _types.AtomsTypeEnum.INPUT_STRING
977
992
  }]);
978
- } else if (~['早于', '晚于', '在'].indexOf(_condition)) {
993
+ } else if (fieldType === _enum.SQL_GROUP_TYPE.DATE && ~DATE_VALUE_CONDITIONS.indexOf(_condition)) {
979
994
  setRhsVal([{
980
995
  val: (0, _dayjs["default"])().format('YYYY-MM-DD HH:mm'),
981
996
  type: _types.AtomsTypeEnum.INPUT_STRING,
@@ -2952,7 +2952,7 @@ var FormulaList = (0, _react.forwardRef)(function (props, ref) {
2952
2952
  }
2953
2953
  if (type === _types.AtomsTypeEnum.EXPRESSION) {
2954
2954
  var quotes = (0, _utils2.getAtomDisplayText)(v);
2955
- if (~['早于', '晚于', '在'].indexOf(v.condition) && v.rhs.length > 1) {
2955
+ if (~['大于', '小于', '大于或等于', '小于或等于', '早于', '晚于', '在'].indexOf(v.condition) && v.rhs.length > 1) {
2956
2956
  var _getAtomDisplayText$s;
2957
2957
  var nextList = caseList.slice();
2958
2958
  nextList[index].rhs = [nextList[index].rhs[0]];
@@ -78,11 +78,9 @@ var sanitizeAliasPart = function sanitizeAliasPart() {
78
78
  var value = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
79
79
  return value.replace(/[^a-zA-Z0-9_]/g, '_').replace(/_+/g, '_').replace(/^_+|_+$/g, '');
80
80
  };
81
- var buildAutoGroupByAlias = function buildAutoGroupByAlias(tableAlias, fieldName, itemIndex) {
81
+ var buildAutoGroupByAlias = function buildAutoGroupByAlias(fieldName, itemIndex) {
82
82
  var fallbackAlias = "group_by_".concat(itemIndex + 1);
83
- var aliasPrefix = sanitizeAliasPart(tableAlias);
84
- var aliasField = sanitizeAliasPart(fieldName);
85
- var autoAlias = (aliasPrefix && aliasField ? "".concat(aliasPrefix, "__").concat(aliasField) : aliasField || aliasPrefix) || fallbackAlias;
83
+ var autoAlias = sanitizeAliasPart(fieldName) || fallbackAlias;
86
84
  if (!/^[a-zA-Z]/.test(autoAlias)) {
87
85
  autoAlias = "a_".concat(autoAlias.replace(/^[^a-zA-Z]+/, ''));
88
86
  }
@@ -485,7 +483,6 @@ var GroupBy = function GroupBy(props) {
485
483
  return _getFirstField(atoms) || getField(record);
486
484
  };
487
485
  var normalizeByRecord = function normalizeByRecord(record, itemIndex, metaList) {
488
- var _store$preProps;
489
486
  var atoms = getAtomsValue(record);
490
487
  var firstField = _getFirstField(atoms);
491
488
  var nextRecord = (0, _objectSpread2["default"])((0, _objectSpread2["default"])({}, record), {}, {
@@ -508,7 +505,14 @@ var GroupBy = function GroupBy(props) {
508
505
  nextRecord.datasourceName = firstField.datasourceName || nextRecord.datasourceName;
509
506
  nextRecord.database_type = firstField.database_type || nextRecord.database_type;
510
507
  }
511
- var defaultFieldAlias = firstField !== null && firstField !== void 0 && firstField.fieldName ? buildAutoGroupByAlias((0, _helper.getAlias)(firstField.tableAlias || nextRecord.alias, metaList, ((_store$preProps = store.preProps) === null || _store$preProps === void 0 ? void 0 : _store$preProps.notExistsColumns) || []), firstField.fieldName, itemIndex) : "group_by_".concat(itemIndex + 1);
508
+ var usedAliases = meta.by.filter(function (_, idx) {
509
+ return idx !== itemIndex;
510
+ }).map(function (item) {
511
+ return item.fieldAlias;
512
+ }).filter(function (alias) {
513
+ return Boolean(alias);
514
+ });
515
+ var defaultFieldAlias = firstField !== null && firstField !== void 0 && firstField.fieldName ? (0, _helper.getAlias)(buildAutoGroupByAlias(firstField.fieldName, itemIndex), [], [], usedAliases) : "group_by_".concat(itemIndex + 1);
512
516
  nextRecord.fieldAlias = nextRecord.fieldAlias || defaultFieldAlias;
513
517
  nextRecord.fieldUuid = nextRecord.fieldUuid || (0, _helper.uuidv4)('field');
514
518
  nextRecord.sql = (0, _helper2.summarizeByToSql)(nextRecord);
@@ -258,6 +258,18 @@ var _handleBaseType2Sql9 = exports.handleBaseType2Sql = function handleBaseType2
258
258
  case '不等于':
259
259
  _right_condition = "!= ".concat(_rightSql);
260
260
  break;
261
+ case '大于':
262
+ _right_condition = "> ".concat(_rightSql);
263
+ break;
264
+ case '小于':
265
+ _right_condition = "< ".concat(_rightSql);
266
+ break;
267
+ case '大于或等于':
268
+ _right_condition = ">= ".concat(_rightSql);
269
+ break;
270
+ case '小于或等于':
271
+ _right_condition = "<= ".concat(_rightSql);
272
+ break;
261
273
  case '包含':
262
274
  _right_condition = "LIKE '%".concat(condition_1, "%'");
263
275
  break;
@@ -265,9 +277,11 @@ var _handleBaseType2Sql9 = exports.handleBaseType2Sql = function handleBaseType2
265
277
  _right_condition = "NOT LIKE '%".concat(condition_1, "%'");
266
278
  break;
267
279
  case '为空':
280
+ case '是空的':
268
281
  _right_condition = "IS NULL";
269
282
  break;
270
283
  case '不为空':
284
+ case '不是空的':
271
285
  _right_condition = "IS NOT NULL";
272
286
  break;
273
287
  case '以...开始':
@@ -347,9 +361,11 @@ var _handleBaseType2Sql9 = exports.handleBaseType2Sql = function handleBaseType2
347
361
  _right_condition = "<= ".concat(_condition_3);
348
362
  break;
349
363
  case '为空':
364
+ case '是空的':
350
365
  _right_condition = "IS NULL";
351
366
  break;
352
367
  case '不为空':
368
+ case '不是空的':
353
369
  _right_condition = "IS NOT NULL";
354
370
  break;
355
371
  case '以...开始':
@@ -444,12 +460,20 @@ var _handleBaseType2Sql9 = exports.handleBaseType2Sql = function handleBaseType2
444
460
  case '等于':
445
461
  _right_condition = "= ".concat(_condition_4);
446
462
  break;
463
+ case '大于':
464
+ _right_condition = "> ".concat(_condition_4);
465
+ break;
466
+ case '小于':
447
467
  case '早于':
448
468
  _right_condition = "< ".concat(_condition_4);
449
469
  break;
470
+ case '大于或等于':
450
471
  case '晚于':
451
472
  _right_condition = ">= ".concat(_condition_4);
452
473
  break;
474
+ case '小于或等于':
475
+ _right_condition = "<= ".concat(_condition_4);
476
+ break;
453
477
  case '介于之间':
454
478
  _right_condition = "(".concat(_left_condition, " >= ").concat(_condition_4, " AND ").concat(_left_condition, " < ").concat(_condition_5, ")");
455
479
  _left_condition = '';
package/lib/cjs/utils.js CHANGED
@@ -574,6 +574,7 @@ var getExpressionConditionText = function getExpressionConditionText(condition)
574
574
  早于: 'filter.earlierThan',
575
575
  晚于: 'filter.laterThan',
576
576
  是空的: 'filter.isEmpty',
577
+ 不是空的: 'filter.notEmpty',
577
578
  In: 'filter.within',
578
579
  'Not In': 'filter.withnotin',
579
580
  无需结果: 'filter.notresults',
@@ -23,8 +23,15 @@ import { EMPTY_RHS_CONDITIONS, getConstantLabel, normalizeExpressionAtom } from
23
23
  import ItemName from '../../modules/components/item-name';
24
24
  import { DateFormatPicker, DateRangeFormatPicker } from './date-format-picker';
25
25
  var NUMBER_LIST = ['等于', '不等于', '大于', '小于', '介于之间', '大于或等于', '小于或等于', '为空', '不为空', '以...开始', '以...结束', '不以...开始', '不以...结束', 'In', 'Not In', '正则匹配'];
26
- var STRING_LIST = ['等于', '不等于', '包含', '不包含', '为空', '不为空', '以...开始', '以...结束', '不以...开始', '不以...结束', 'In', 'Not In', '正则匹配'];
27
- var DATE_LIST = ['等于', '早于', '晚于', '介于之间', '是空的', '不为空'];
26
+ var STRING_LIST = ['等于', '不等于', '大于', '小于', '大于或等于', '小于或等于', '包含', '不包含', '为空', '不为空', '以...开始', '以...结束', '不以...开始', '不以...结束', 'In', 'Not In', '正则匹配'];
27
+ var DATE_LIST = ['等于', '大于', '小于', '大于或等于', '小于或等于', '介于之间', '为空', '不为空'];
28
+ var DATE_VALUE_CONDITIONS = ['等于', '大于', '小于', '大于或等于', '小于或等于', '早于', '晚于', '在'];
29
+ var SWITCH_VALUE_TYPE_CONDITIONS = ['等于', '不等于', '大于', '小于', '大于或等于', '小于或等于'];
30
+ var LEGACY_DATE_CONDITION_MAP = {
31
+ 早于: '小于',
32
+ 晚于: '大于或等于'
33
+ };
34
+ var LEGACY_EMPTY_CONDITIONS = new Set(['是空的', '不是空的']);
28
35
  var typeList = [{
29
36
  key: SQL_COLUMN_TYPE.STRING,
30
37
  label: SQL_COLUMN_TYPE.STRING
@@ -340,12 +347,16 @@ var SelectFilterColumn = function SelectFilterColumn(_ref) {
340
347
  conditions = DATE_LIST;
341
348
  type = SQL_GROUP_TYPE.DATE;
342
349
  }
350
+ var nextCondition = LEGACY_DATE_CONDITION_MAP[condition];
351
+ if (type === SQL_GROUP_TYPE.DATE && nextCondition) {
352
+ setCondition(nextCondition);
353
+ }
343
354
  if (isCustom) {
344
355
  conditions = ['无需结果'].concat(_toConsumableArray(conditions));
345
356
  }
346
- var isCompatibleDateEmptyCondition = type === SQL_GROUP_TYPE.DATE && (condition === '为空' || condition === '不是空的');
347
- if (!conditions.includes(condition) && !isCompatibleDateEmptyCondition) {
348
- setDefaultVal(conditions[0]);
357
+ var isLegacyEmptyCondition = LEGACY_EMPTY_CONDITIONS.has(condition);
358
+ if (!conditions.includes(condition) && !nextCondition && !isLegacyEmptyCondition) {
359
+ setDefaultVal(conditions[0], type);
349
360
  }
350
361
  return {
351
362
  columnType: columnType,
@@ -499,7 +510,9 @@ var SelectFilterColumn = function SelectFilterColumn(_ref) {
499
510
  })
500
511
  })]
501
512
  });
502
- } else if (~['早于', '晚于', '在'].indexOf(conditionText)) {
513
+ } else if (type === SQL_GROUP_TYPE.DATE && ~DATE_VALUE_CONDITIONS.filter(function (v) {
514
+ return v !== '等于';
515
+ }).indexOf(conditionText)) {
503
516
  var _rhsVal$3, _rhsVal$4;
504
517
  var _dateVal = ((_rhsVal$3 = rhsVal[0]) === null || _rhsVal$3 === void 0 ? void 0 : _rhsVal$3.type) === AtomsTypeEnum.INPUT_STRING ? rhsVal[0].val : undefined;
505
518
  var _dateFormat = ((_rhsVal$4 = rhsVal[0]) === null || _rhsVal$4 === void 0 ? void 0 : _rhsVal$4.type) === AtomsTypeEnum.INPUT_STRING ? rhsVal[0].format : undefined;
@@ -644,10 +657,10 @@ var SelectFilterColumn = function SelectFilterColumn(_ref) {
644
657
  })
645
658
  });
646
659
  };
647
- var onRepeat = function onRepeat(e) {
660
+ var onRepeat = function onRepeat(e, fieldType) {
648
661
  var _rhsVal$7;
649
662
  setParentClosable(false);
650
- var inputAtomType = ((_rhsVal$7 = rhsVal[0]) === null || _rhsVal$7 === void 0 ? void 0 : _rhsVal$7.type) === AtomsTypeEnum.INPUT_NUMBER ? AtomsTypeEnum.INPUT_NUMBER : AtomsTypeEnum.INPUT_STRING;
663
+ var inputAtomType = fieldType === SQL_GROUP_TYPE.NUMBER || ((_rhsVal$7 = rhsVal[0]) === null || _rhsVal$7 === void 0 ? void 0 : _rhsVal$7.type) === AtomsTypeEnum.INPUT_NUMBER ? AtomsTypeEnum.INPUT_NUMBER : AtomsTypeEnum.INPUT_STRING;
651
664
  store.setPopup2({
652
665
  visible: true,
653
666
  node: e.currentTarget,
@@ -878,7 +891,7 @@ var SelectFilterColumn = function SelectFilterColumn(_ref) {
878
891
  getPopupContainer: getCurrentPopupContainer,
879
892
  onChange: function onChange(key) {
880
893
  setCurColumn(_objectSpread({}, curColumn));
881
- setDefaultVal(key);
894
+ setDefaultVal(key, fieldType);
882
895
  },
883
896
  droplist: menu,
884
897
  children: _jsxs(Button, {
@@ -923,14 +936,16 @@ var SelectFilterColumn = function SelectFilterColumn(_ref) {
923
936
  children: renderFilter(fieldType, condition)
924
937
  }, i);
925
938
  }
926
- }), ~['等于', '不等于', '早于', '晚于'].indexOf(condition) ? _jsx(Tooltip, {
939
+ }), ~SWITCH_VALUE_TYPE_CONDITIONS.indexOf(condition) || fieldType === SQL_GROUP_TYPE.DATE && ~DATE_VALUE_CONDITIONS.indexOf(condition) ? _jsx(Tooltip, {
927
940
  title: __('SqlQueryBuilder.switch'),
928
941
  children: _jsx(Button, {
929
942
  primary: true,
930
943
  ghost: true,
931
944
  className: 'ml-2 operator-icon',
932
945
  icon: _jsx(Repeat, {}),
933
- onClick: onRepeat
946
+ onClick: function onClick(e) {
947
+ return onRepeat(e, fieldType);
948
+ }
934
949
  })
935
950
  }) : '']
936
951
  }), _jsx("div", {
@@ -947,7 +962,7 @@ var SelectFilterColumn = function SelectFilterColumn(_ref) {
947
962
  })]
948
963
  });
949
964
  }
950
- function setDefaultVal(_condition) {
965
+ function setDefaultVal(_condition, fieldType) {
951
966
  var _rhsVal$0;
952
967
  setCondition(_condition);
953
968
  var inputAtomType = ((_rhsVal$0 = rhsVal[0]) === null || _rhsVal$0 === void 0 ? void 0 : _rhsVal$0.type) === AtomsTypeEnum.INPUT_NUMBER ? AtomsTypeEnum.INPUT_NUMBER : AtomsTypeEnum.INPUT_STRING;
@@ -967,7 +982,7 @@ var SelectFilterColumn = function SelectFilterColumn(_ref) {
967
982
  val: '天',
968
983
  type: AtomsTypeEnum.INPUT_STRING
969
984
  }]);
970
- } else if (~['早于', '晚于', '在'].indexOf(_condition)) {
985
+ } else if (fieldType === SQL_GROUP_TYPE.DATE && ~DATE_VALUE_CONDITIONS.indexOf(_condition)) {
971
986
  setRhsVal([{
972
987
  val: moment().format('YYYY-MM-DD HH:mm'),
973
988
  type: AtomsTypeEnum.INPUT_STRING,
@@ -2943,7 +2943,7 @@ var FormulaList = forwardRef(function (props, ref) {
2943
2943
  }
2944
2944
  if (type === AtomsTypeEnum.EXPRESSION) {
2945
2945
  var quotes = getAtomDisplayText(v);
2946
- if (~['早于', '晚于', '在'].indexOf(v.condition) && v.rhs.length > 1) {
2946
+ if (~['大于', '小于', '大于或等于', '小于或等于', '早于', '晚于', '在'].indexOf(v.condition) && v.rhs.length > 1) {
2947
2947
  var _getAtomDisplayText$s;
2948
2948
  var nextList = caseList.slice();
2949
2949
  nextList[index].rhs = [nextList[index].rhs[0]];
@@ -72,11 +72,9 @@ var sanitizeAliasPart = function sanitizeAliasPart() {
72
72
  var value = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
73
73
  return value.replace(/[^a-zA-Z0-9_]/g, '_').replace(/_+/g, '_').replace(/^_+|_+$/g, '');
74
74
  };
75
- var buildAutoGroupByAlias = function buildAutoGroupByAlias(tableAlias, fieldName, itemIndex) {
75
+ var buildAutoGroupByAlias = function buildAutoGroupByAlias(fieldName, itemIndex) {
76
76
  var fallbackAlias = "group_by_".concat(itemIndex + 1);
77
- var aliasPrefix = sanitizeAliasPart(tableAlias);
78
- var aliasField = sanitizeAliasPart(fieldName);
79
- var autoAlias = (aliasPrefix && aliasField ? "".concat(aliasPrefix, "__").concat(aliasField) : aliasField || aliasPrefix) || fallbackAlias;
77
+ var autoAlias = sanitizeAliasPart(fieldName) || fallbackAlias;
80
78
  if (!/^[a-zA-Z]/.test(autoAlias)) {
81
79
  autoAlias = "a_".concat(autoAlias.replace(/^[^a-zA-Z]+/, ''));
82
80
  }
@@ -479,7 +477,6 @@ var GroupBy = function GroupBy(props) {
479
477
  return _getFirstField(atoms) || getField(record);
480
478
  };
481
479
  var normalizeByRecord = function normalizeByRecord(record, itemIndex, metaList) {
482
- var _store$preProps;
483
480
  var atoms = getAtomsValue(record);
484
481
  var firstField = _getFirstField(atoms);
485
482
  var nextRecord = _objectSpread(_objectSpread({}, record), {}, {
@@ -502,7 +499,14 @@ var GroupBy = function GroupBy(props) {
502
499
  nextRecord.datasourceName = firstField.datasourceName || nextRecord.datasourceName;
503
500
  nextRecord.database_type = firstField.database_type || nextRecord.database_type;
504
501
  }
505
- var defaultFieldAlias = firstField !== null && firstField !== void 0 && firstField.fieldName ? buildAutoGroupByAlias(getAlias(firstField.tableAlias || nextRecord.alias, metaList, ((_store$preProps = store.preProps) === null || _store$preProps === void 0 ? void 0 : _store$preProps.notExistsColumns) || []), firstField.fieldName, itemIndex) : "group_by_".concat(itemIndex + 1);
502
+ var usedAliases = meta.by.filter(function (_, idx) {
503
+ return idx !== itemIndex;
504
+ }).map(function (item) {
505
+ return item.fieldAlias;
506
+ }).filter(function (alias) {
507
+ return Boolean(alias);
508
+ });
509
+ var defaultFieldAlias = firstField !== null && firstField !== void 0 && firstField.fieldName ? getAlias(buildAutoGroupByAlias(firstField.fieldName, itemIndex), [], [], usedAliases) : "group_by_".concat(itemIndex + 1);
506
510
  nextRecord.fieldAlias = nextRecord.fieldAlias || defaultFieldAlias;
507
511
  nextRecord.fieldUuid = nextRecord.fieldUuid || uuidv4('field');
508
512
  nextRecord.sql = summarizeByToSql(nextRecord);
@@ -251,6 +251,18 @@ var _handleBaseType2Sql9 = function handleBaseType2Sql(list) {
251
251
  case '不等于':
252
252
  _right_condition = "!= ".concat(_rightSql);
253
253
  break;
254
+ case '大于':
255
+ _right_condition = "> ".concat(_rightSql);
256
+ break;
257
+ case '小于':
258
+ _right_condition = "< ".concat(_rightSql);
259
+ break;
260
+ case '大于或等于':
261
+ _right_condition = ">= ".concat(_rightSql);
262
+ break;
263
+ case '小于或等于':
264
+ _right_condition = "<= ".concat(_rightSql);
265
+ break;
254
266
  case '包含':
255
267
  _right_condition = "LIKE '%".concat(condition_1, "%'");
256
268
  break;
@@ -258,9 +270,11 @@ var _handleBaseType2Sql9 = function handleBaseType2Sql(list) {
258
270
  _right_condition = "NOT LIKE '%".concat(condition_1, "%'");
259
271
  break;
260
272
  case '为空':
273
+ case '是空的':
261
274
  _right_condition = "IS NULL";
262
275
  break;
263
276
  case '不为空':
277
+ case '不是空的':
264
278
  _right_condition = "IS NOT NULL";
265
279
  break;
266
280
  case '以...开始':
@@ -340,9 +354,11 @@ var _handleBaseType2Sql9 = function handleBaseType2Sql(list) {
340
354
  _right_condition = "<= ".concat(_condition_3);
341
355
  break;
342
356
  case '为空':
357
+ case '是空的':
343
358
  _right_condition = "IS NULL";
344
359
  break;
345
360
  case '不为空':
361
+ case '不是空的':
346
362
  _right_condition = "IS NOT NULL";
347
363
  break;
348
364
  case '以...开始':
@@ -437,12 +453,20 @@ var _handleBaseType2Sql9 = function handleBaseType2Sql(list) {
437
453
  case '等于':
438
454
  _right_condition = "= ".concat(_condition_4);
439
455
  break;
456
+ case '大于':
457
+ _right_condition = "> ".concat(_condition_4);
458
+ break;
459
+ case '小于':
440
460
  case '早于':
441
461
  _right_condition = "< ".concat(_condition_4);
442
462
  break;
463
+ case '大于或等于':
443
464
  case '晚于':
444
465
  _right_condition = ">= ".concat(_condition_4);
445
466
  break;
467
+ case '小于或等于':
468
+ _right_condition = "<= ".concat(_condition_4);
469
+ break;
446
470
  case '介于之间':
447
471
  _right_condition = "(".concat(_left_condition, " >= ").concat(_condition_4, " AND ").concat(_left_condition, " < ").concat(_condition_5, ")");
448
472
  _left_condition = '';
package/lib/es/utils.js CHANGED
@@ -560,6 +560,7 @@ var getExpressionConditionText = function getExpressionConditionText(condition)
560
560
  早于: 'filter.earlierThan',
561
561
  晚于: 'filter.laterThan',
562
562
  是空的: 'filter.isEmpty',
563
+ 不是空的: 'filter.notEmpty',
563
564
  In: 'filter.within',
564
565
  'Not In': 'filter.withnotin',
565
566
  无需结果: 'filter.notresults',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gingkoo/pandora-metabase",
3
- "version": "1.0.157-alpha.9",
3
+ "version": "1.0.158-alpha.1",
4
4
  "description": "",
5
5
  "main": "lib/es/index.js",
6
6
  "module": "lib/es/index.js",