@gingkoo/pandora-metabase 1.0.117 → 1.0.119

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 (195) hide show
  1. package/lib/cjs/common/Portal/index.js +0 -2
  2. package/lib/cjs/common/SplitView/index.d.ts +0 -4
  3. package/lib/cjs/common/SplitView/index.js +0 -10
  4. package/lib/cjs/components/dialog/custom-column/config.js +4 -48
  5. package/lib/cjs/components/dialog/custom-column/expression-editor.js +3 -14
  6. package/lib/cjs/components/dialog/custom-column/expressions/suggest.d.ts +2 -34
  7. package/lib/cjs/components/dialog/custom-column/expressions/suggest.js +2 -43
  8. package/lib/cjs/components/dialog/custom-column/expressions/tokenizer.js +8 -65
  9. package/lib/cjs/components/dialog/custom-column/index.js +2 -4
  10. package/lib/cjs/components/dialog/custom-column/tokenized-expression.js +2 -3
  11. package/lib/cjs/components/dialog/custom-column/tokenizedI-input.js +1 -1
  12. package/lib/cjs/components/dialog/custom-editor/index.js +2 -7
  13. package/lib/cjs/components/dialog/diff-viewer/index copy.js +1 -16
  14. package/lib/cjs/components/dialog/expression/date-format-picker.js +2 -20
  15. package/lib/cjs/components/dialog/expression/date-format.js +2 -8
  16. package/lib/cjs/components/dialog/expression/index.d.ts +0 -3
  17. package/lib/cjs/components/dialog/expression/index.js +2 -83
  18. package/lib/cjs/components/dialog/formula/index.js +1 -30
  19. package/lib/cjs/components/dialog/formula/utils.js +2 -10
  20. package/lib/cjs/components/dialog/formula-list/CaseWhenGroup.d.ts +19 -0
  21. package/lib/cjs/components/dialog/formula-list/CaseWhenGroup.js +109 -0
  22. package/lib/cjs/components/dialog/formula-list/LogicGroup.d.ts +9 -0
  23. package/lib/cjs/components/dialog/formula-list/LogicGroup.js +43 -0
  24. package/lib/cjs/components/dialog/formula-list/index.d.ts +3 -0
  25. package/lib/cjs/components/dialog/formula-list/index.js +966 -509
  26. package/lib/cjs/components/dialog/formula-list/index.less +724 -0
  27. package/lib/cjs/components/dialog/formula-list/utils.d.ts +0 -7
  28. package/lib/cjs/components/dialog/formula-list/utils.js +117 -112
  29. package/lib/cjs/components/dialog/select-column/index.d.ts +0 -6
  30. package/lib/cjs/components/dialog/select-column/index.js +4 -15
  31. package/lib/cjs/components/dialog/select-column-multiple/index.d.ts +0 -8
  32. package/lib/cjs/components/dialog/select-column-multiple/index.js +6 -45
  33. package/lib/cjs/components/dialog/select-join/index.d.ts +0 -5
  34. package/lib/cjs/components/dialog/select-join/index.js +0 -6
  35. package/lib/cjs/components/dialog/select-join-column/index.d.ts +0 -8
  36. package/lib/cjs/components/dialog/select-join-column/index.js +7 -21
  37. package/lib/cjs/components/dialog/select-join-column-multiple/index.d.ts +0 -8
  38. package/lib/cjs/components/dialog/select-join-column-multiple/index.js +5 -35
  39. package/lib/cjs/components/dialog/select-permission-table/index.d.ts +0 -5
  40. package/lib/cjs/components/dialog/select-permission-table/index.js +0 -6
  41. package/lib/cjs/components/dialog/select-summarize/index.d.ts +3 -3
  42. package/lib/cjs/components/dialog/select-summarize/index.js +105 -18
  43. package/lib/cjs/components/dialog/select-summarize/index.less +23 -0
  44. package/lib/cjs/components/dialog/select-table/index.d.ts +0 -6
  45. package/lib/cjs/components/dialog/select-table/index.js +1 -9
  46. package/lib/cjs/components/metabase/index.js +72 -86
  47. package/lib/cjs/components/metabase/index.less +14 -7
  48. package/lib/cjs/components/modules/components/Wrapper.js +1 -1
  49. package/lib/cjs/components/modules/components/header.js +2 -2
  50. package/lib/cjs/components/modules/components/meta-icon.d.ts +0 -3
  51. package/lib/cjs/components/modules/components/meta-icon.js +2 -47
  52. package/lib/cjs/components/modules/custom-column.js +3 -29
  53. package/lib/cjs/components/modules/enum/filter-enum.js +9 -88
  54. package/lib/cjs/components/modules/filter.js +2 -20
  55. package/lib/cjs/components/modules/index.d.ts +4 -2
  56. package/lib/cjs/components/modules/index.js +24 -1
  57. package/lib/cjs/components/modules/join-data.js +13 -291
  58. package/lib/cjs/components/modules/row-limit.js +0 -1
  59. package/lib/cjs/components/modules/sort.js +1 -61
  60. package/lib/cjs/components/modules/summarize/group-by.d.ts +0 -5
  61. package/lib/cjs/components/modules/summarize/group-by.js +231 -76
  62. package/lib/cjs/components/modules/summarize/select-index.js +96 -46
  63. package/lib/cjs/components/modules/table-data.js +11 -64
  64. package/lib/cjs/components/popup.js +26 -32
  65. package/lib/cjs/hooks/patch.d.ts +1 -0
  66. package/lib/cjs/hooks/patch.js +104 -6
  67. package/lib/cjs/hooks/patch2.js +3 -165
  68. package/lib/cjs/hooks/use-provider.js +0 -3
  69. package/lib/cjs/hooks/use-state.js +55 -135
  70. package/lib/cjs/index.js +0 -15
  71. package/lib/cjs/locale/en.js +5 -0
  72. package/lib/cjs/locale/index.js +1 -4
  73. package/lib/cjs/locale/zh.js +5 -0
  74. package/lib/cjs/sql-formula.js +0 -1
  75. package/lib/cjs/store/enum.d.ts +6 -6
  76. package/lib/cjs/store/enum.js +0 -13
  77. package/lib/cjs/store/helper.d.ts +2 -1
  78. package/lib/cjs/store/helper.js +15 -225
  79. package/lib/cjs/store/types.d.ts +45 -67
  80. package/lib/cjs/store/types.js +3 -49
  81. package/lib/cjs/types.d.ts +1 -0
  82. package/lib/cjs/utils/cookies.js +0 -3
  83. package/lib/cjs/utils/event.js +1 -1
  84. package/lib/cjs/utils/helper-dom.d.ts +1 -0
  85. package/lib/cjs/utils/helper-dom.js +17 -10
  86. package/lib/cjs/utils/helper.js +1 -24
  87. package/lib/cjs/utils/keydown.js +4 -7
  88. package/lib/cjs/utils/platform.d.ts +0 -9
  89. package/lib/cjs/utils/platform.js +0 -10
  90. package/lib/cjs/utils/selection.js +0 -6
  91. package/lib/cjs/utils/storage.d.ts +0 -9
  92. package/lib/cjs/utils/storage.js +1 -11
  93. package/lib/cjs/utils/transformSql.d.ts +5 -0
  94. package/lib/cjs/utils/transformSql.js +42 -113
  95. package/lib/cjs/utils.d.ts +1 -6
  96. package/lib/cjs/utils.js +115 -255
  97. package/lib/es/common/Portal/index.js +0 -2
  98. package/lib/es/common/SplitView/index.d.ts +0 -4
  99. package/lib/es/common/SplitView/index.js +0 -10
  100. package/lib/es/components/dialog/custom-column/config.js +4 -48
  101. package/lib/es/components/dialog/custom-column/expression-editor.js +3 -14
  102. package/lib/es/components/dialog/custom-column/expressions/suggest.d.ts +2 -34
  103. package/lib/es/components/dialog/custom-column/expressions/suggest.js +2 -43
  104. package/lib/es/components/dialog/custom-column/expressions/tokenizer.js +8 -65
  105. package/lib/es/components/dialog/custom-column/index.js +2 -4
  106. package/lib/es/components/dialog/custom-column/tokenized-expression.js +1 -3
  107. package/lib/es/components/dialog/custom-column/tokenizedI-input.js +1 -1
  108. package/lib/es/components/dialog/custom-editor/index.js +1 -7
  109. package/lib/es/components/dialog/diff-viewer/index copy.js +1 -15
  110. package/lib/es/components/dialog/expression/date-format-picker.js +2 -20
  111. package/lib/es/components/dialog/expression/date-format.js +2 -8
  112. package/lib/es/components/dialog/expression/index.d.ts +0 -3
  113. package/lib/es/components/dialog/expression/index.js +2 -82
  114. package/lib/es/components/dialog/formula/index.js +0 -30
  115. package/lib/es/components/dialog/formula/utils.js +2 -10
  116. package/lib/es/components/dialog/formula-list/CaseWhenGroup.d.ts +19 -0
  117. package/lib/es/components/dialog/formula-list/CaseWhenGroup.js +102 -0
  118. package/lib/es/components/dialog/formula-list/LogicGroup.d.ts +9 -0
  119. package/lib/es/components/dialog/formula-list/LogicGroup.js +36 -0
  120. package/lib/es/components/dialog/formula-list/index.d.ts +3 -0
  121. package/lib/es/components/dialog/formula-list/index.js +965 -509
  122. package/lib/es/components/dialog/formula-list/index.less +724 -0
  123. package/lib/es/components/dialog/formula-list/utils.d.ts +0 -7
  124. package/lib/es/components/dialog/formula-list/utils.js +117 -112
  125. package/lib/es/components/dialog/index.js +3 -3
  126. package/lib/es/components/dialog/select-column/index.d.ts +0 -6
  127. package/lib/es/components/dialog/select-column/index.js +4 -14
  128. package/lib/es/components/dialog/select-column-multiple/index.d.ts +0 -8
  129. package/lib/es/components/dialog/select-column-multiple/index.js +7 -47
  130. package/lib/es/components/dialog/select-join/index.d.ts +0 -5
  131. package/lib/es/components/dialog/select-join/index.js +0 -5
  132. package/lib/es/components/dialog/select-join-column/index.d.ts +0 -8
  133. package/lib/es/components/dialog/select-join-column/index.js +7 -20
  134. package/lib/es/components/dialog/select-join-column-multiple/index.d.ts +0 -8
  135. package/lib/es/components/dialog/select-join-column-multiple/index.js +5 -34
  136. package/lib/es/components/dialog/select-permission-table/index.d.ts +0 -5
  137. package/lib/es/components/dialog/select-permission-table/index.js +0 -5
  138. package/lib/es/components/dialog/select-summarize/index.d.ts +3 -3
  139. package/lib/es/components/dialog/select-summarize/index.js +106 -18
  140. package/lib/es/components/dialog/select-summarize/index.less +23 -0
  141. package/lib/es/components/dialog/select-table/index.d.ts +0 -6
  142. package/lib/es/components/dialog/select-table/index.js +1 -8
  143. package/lib/es/components/metabase/index.js +72 -87
  144. package/lib/es/components/metabase/index.less +14 -7
  145. package/lib/es/components/modules/components/Wrapper.js +1 -1
  146. package/lib/es/components/modules/components/header.js +2 -2
  147. package/lib/es/components/modules/components/meta-icon.d.ts +0 -3
  148. package/lib/es/components/modules/components/meta-icon.js +2 -46
  149. package/lib/es/components/modules/custom-column.js +3 -29
  150. package/lib/es/components/modules/enum/filter-enum.js +9 -88
  151. package/lib/es/components/modules/filter.js +2 -19
  152. package/lib/es/components/modules/index.d.ts +4 -2
  153. package/lib/es/components/modules/index.js +24 -1
  154. package/lib/es/components/modules/join-data.js +13 -291
  155. package/lib/es/components/modules/row-limit.js +0 -1
  156. package/lib/es/components/modules/sort.js +1 -61
  157. package/lib/es/components/modules/summarize/group-by.d.ts +0 -5
  158. package/lib/es/components/modules/summarize/group-by.js +233 -78
  159. package/lib/es/components/modules/summarize/select-index.js +96 -46
  160. package/lib/es/components/modules/table-data.js +11 -64
  161. package/lib/es/components/popup.js +27 -33
  162. package/lib/es/hooks/patch.d.ts +1 -0
  163. package/lib/es/hooks/patch.js +103 -5
  164. package/lib/es/hooks/patch2.js +2 -164
  165. package/lib/es/hooks/use-provider.js +0 -3
  166. package/lib/es/hooks/use-state.js +55 -135
  167. package/lib/es/index.js +0 -14
  168. package/lib/es/locale/en.js +5 -0
  169. package/lib/es/locale/index.js +1 -4
  170. package/lib/es/locale/zh.js +5 -0
  171. package/lib/es/sql-formula.js +0 -1
  172. package/lib/es/store/enum.d.ts +6 -6
  173. package/lib/es/store/enum.js +0 -13
  174. package/lib/es/store/helper.d.ts +2 -1
  175. package/lib/es/store/helper.js +13 -224
  176. package/lib/es/store/types.d.ts +45 -67
  177. package/lib/es/store/types.js +3 -49
  178. package/lib/es/types.d.ts +1 -0
  179. package/lib/es/types.js +1 -18
  180. package/lib/es/utils/cookies.js +0 -3
  181. package/lib/es/utils/event.js +1 -1
  182. package/lib/es/utils/helper-dom.d.ts +1 -0
  183. package/lib/es/utils/helper-dom.js +16 -9
  184. package/lib/es/utils/helper.js +1 -24
  185. package/lib/es/utils/keydown.js +4 -7
  186. package/lib/es/utils/platform.d.ts +0 -9
  187. package/lib/es/utils/platform.js +0 -10
  188. package/lib/es/utils/selection.js +0 -6
  189. package/lib/es/utils/storage.d.ts +0 -9
  190. package/lib/es/utils/storage.js +1 -10
  191. package/lib/es/utils/transformSql.d.ts +5 -0
  192. package/lib/es/utils/transformSql.js +42 -112
  193. package/lib/es/utils.d.ts +1 -6
  194. package/lib/es/utils.js +116 -255
  195. package/package.json +1 -1
@@ -20,8 +20,7 @@ var _types = require("../../../store/types");
20
20
  var _pandora = require("@gingkoo/pandora");
21
21
  var _utils2 = require("../../../utils");
22
22
  var _useProvider = require("../../../hooks/use-provider");
23
- var _templateObject; // import { getTemplate } from './utils';
24
- // import { OptionsTypeEnum, customTypes, otherList, operatorList, functionList } from './enum';
23
+ var _templateObject;
25
24
  var VisualBox = _styledComponents["default"].div.attrs({
26
25
  className: 'visual-box'
27
26
  })(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2["default"])([""])));
@@ -33,7 +32,6 @@ var CaseEditor = function CaseEditor(props) {
33
32
  onOk = props.onOk,
34
33
  onCancel = props.onCancel;
35
34
  var store = (0, _useProvider.useStore)();
36
- // const [popup, setPopup] = useState<PopupType>({ visible: false }); // 弹框信息
37
35
  var _useState = (0, _react.useState)(value.formulaList || []),
38
36
  _useState2 = (0, _slicedToArray2["default"])(_useState, 2),
39
37
  caseList = _useState2[0],
@@ -41,17 +39,14 @@ var CaseEditor = function CaseEditor(props) {
41
39
  var _useState3 = (0, _react.useState)((value === null || value === void 0 ? void 0 : value.name) || ''),
42
40
  _useState4 = (0, _slicedToArray2["default"])(_useState3, 2),
43
41
  name = _useState4[0],
44
- setName = _useState4[1]; // 表达式名字
42
+ setName = _useState4[1];
45
43
  var ref = (0, _react.useRef)(null);
46
- // 提交按钮是否可用
47
44
  var usable = (0, _react.useMemo)(function () {
48
45
  return (0, _utils.isOk)(caseList) && name;
49
46
  }, [caseList, name]);
50
- // 取消
51
47
  var _onClose = function _onClose() {
52
48
  onCancel === null || onCancel === void 0 || onCancel();
53
49
  };
54
- // 确定
55
50
  var _onOk = function _onOk() {
56
51
  if (!(0, _utils2.isValidSQLAlias)(name)) {
57
52
  _pandora.Toast.warning((0, _locale.__)('SqlQueryBuilder.nameForRules'));
@@ -10,8 +10,6 @@ var _jsxRuntime = require("react/jsx-runtime");
10
10
  var _react = require("react");
11
11
  var _diff = require("diff");
12
12
  require("./index.less");
13
- // DiffViewer.tsx
14
-
15
13
  var DiffViewer = function DiffViewer(_ref) {
16
14
  var oldCode = _ref.oldCode,
17
15
  newCode = _ref.newCode,
@@ -30,7 +28,6 @@ var DiffViewer = function DiffViewer(_ref) {
30
28
  _useState4 = (0, _slicedToArray2["default"])(_useState3, 2),
31
29
  hunkHeaders = _useState4[0],
32
30
  setHunkHeaders = _useState4[1];
33
- // 提取文件头和 hunk headers(安全依赖)
34
31
  (0, _react.useEffect)(function () {
35
32
  var safeOldStr = typeof oldCode === 'string' ? oldCode : '';
36
33
  var safeNewStr = typeof newCode === 'string' ? newCode : '';
@@ -38,17 +35,10 @@ var DiffViewer = function DiffViewer(_ref) {
38
35
  context: 10
39
36
  });
40
37
  var lines = patch.split('\n');
41
- // for (const line of lines) {
42
- // if (line.startsWith('--- ')) {
43
- // setOldFileHeader(line);
44
- // break;
45
- // }
46
- // }
47
38
  setHunkHeaders(lines.filter(function (l) {
48
39
  return l.startsWith('@@ ') && l.endsWith(' @@');
49
40
  }));
50
41
  }, [oldCode, newCode, oldFileName, newFileName]);
51
- // 主 diff 渲染逻辑
52
42
  (0, _react.useEffect)(function () {
53
43
  var safeOld = (typeof oldCode === 'string' ? oldCode : '').split('\n');
54
44
  var safeNew = (typeof newCode === 'string' ? newCode : '').split('\n');
@@ -62,7 +52,6 @@ var DiffViewer = function DiffViewer(_ref) {
62
52
  var diffs = (0, _diff.diffWordsWithSpace)(oldLine, newLine);
63
53
  var leftContent = '';
64
54
  var rightContent = '';
65
- // ✅ 检查最后一个 token 是否是行尾空格且被删除
66
55
  var lastToken = diffs[diffs.length - 1];
67
56
  var ignoreLastTrailingSpace = diffs.length > 0 && (lastToken === null || lastToken === void 0 ? void 0 : lastToken.removed) && /^\s+$/.test(lastToken.value) && oldLine.endsWith(lastToken.value);
68
57
  for (var j = 0; j < diffs.length; j++) {
@@ -71,10 +60,8 @@ var DiffViewer = function DiffViewer(_ref) {
71
60
  if (part.added) {
72
61
  rightContent += "<span class=\"diff-add\">".concat(escaped, "</span>");
73
62
  } else if (part.removed) {
74
- // ✅ 如果是最后一个 token 且是行尾空格 → 不高亮
75
63
  if (ignoreLastTrailingSpace && j === diffs.length - 1) {
76
- leftContent += escaped; // 显示空格但不标红
77
- // rightContent 不加(因为新行没有)
64
+ leftContent += escaped;
78
65
  } else {
79
66
  leftContent += "<span class=\"diff-del\">".concat(escaped, "</span>");
80
67
  }
@@ -83,7 +70,6 @@ var DiffViewer = function DiffViewer(_ref) {
83
70
  rightContent += escaped;
84
71
  }
85
72
  }
86
- // 处理缺失行
87
73
  if (i >= safeOld.length) leftContent = '&nbsp;';
88
74
  if (i >= safeNew.length) rightContent = '&nbsp;';
89
75
  leftHtml.push("<div class=\"diff-line\">".concat(leftContent, "</div>"));
@@ -97,7 +83,6 @@ var DiffViewer = function DiffViewer(_ref) {
97
83
  return clearTimeout(timer);
98
84
  };
99
85
  }, [oldCode, newCode]);
100
- // 同步滚动
101
86
  (0, _react.useEffect)(function () {
102
87
  var left = leftRef.current;
103
88
  var right = rightRef.current;
@@ -13,20 +13,13 @@ var _dayjs = _interopRequireDefault(require("dayjs"));
13
13
  var RangePicker = _pandora.DatePicker.RangePicker,
14
14
  YearPicker = _pandora.DatePicker.YearPicker,
15
15
  MonthPicker = _pandora.DatePicker.MonthPicker;
16
- var DATE_FORMAT_OPTIONS = [
17
- // { value: 'YYYY', label: 'YYYY' },
18
- // { value: 'YYYY-MM', label: 'YYYY-MM' },
19
- {
16
+ var DATE_FORMAT_OPTIONS = [{
20
17
  value: 'YYYY-MM-DD',
21
18
  label: 'YYYY-MM-DD'
22
19
  }, {
23
20
  value: 'YYYY-MM-DD HH:mm',
24
21
  label: 'YYYY-MM-DD HH:mm'
25
- }
26
- // { value: 'YYYY/MM', label: 'YYYY/MM' },
27
- // { value: 'YYYY/MM/DD', label: 'YYYY/MM/DD' },
28
- // { value: 'YYYY/MM/DD HH:mm', label: 'YYYY/MM/DD HH:mm' },
29
- ];
22
+ }];
30
23
  var DEFAULT_FORMAT = 'YYYY-MM-DD HH:mm';
31
24
  var DateRangeFormatPicker = exports.DateRangeFormatPicker = function DateRangeFormatPicker(_ref) {
32
25
  var value = _ref.value,
@@ -42,14 +35,12 @@ var DateRangeFormatPicker = exports.DateRangeFormatPicker = function DateRangeFo
42
35
  }
43
36
  }, [format]);
44
37
  var showTime = currentFormat.includes('HH:mm');
45
- // 根据格式确定 RangePicker 的 mode
46
38
  var getRangePickerMode = function getRangePickerMode() {
47
39
  if (currentFormat === 'YYYY') return 'year';
48
40
  if (currentFormat === 'YYYY-MM' || currentFormat === 'YYYY/MM') return 'month';
49
41
  return 'date';
50
42
  };
51
43
  var handleFormatChange = function handleFormatChange(newFormat) {
52
- // 切换格式时,用新格式重新格式化当前值
53
44
  if (value && value.length > 0) {
54
45
  var formattedValues = value.map(function (v) {
55
46
  if (!v) return '';
@@ -57,26 +48,20 @@ var DateRangeFormatPicker = exports.DateRangeFormatPicker = function DateRangeFo
57
48
  if (!parsed.isValid()) return '';
58
49
  return parsed.format(newFormat);
59
50
  });
60
- // 只调用 onChange,传递新格式化的值和新格式
61
51
  onChange === null || onChange === void 0 || onChange(formattedValues, newFormat);
62
52
  }
63
53
  setCurrentFormat(newFormat);
64
54
  };
65
- // 将字符串数组转为 dayjs 对象数组,供 RangePicker 使用
66
55
  var rangeValue = (value === null || value === void 0 ? void 0 : value.map(function (v) {
67
56
  if (!v) return null;
68
- // 尝试用当前格式解析,失败则用 dayjs 默认解析
69
57
  var parsed = (0, _dayjs["default"])(v, currentFormat, true);
70
58
  if (parsed.isValid()) return parsed;
71
- // 尝试不用严格模式解析
72
59
  var looseParsed = (0, _dayjs["default"])(v, currentFormat);
73
60
  if (looseParsed.isValid()) return looseParsed;
74
- // 最后尝试不指定格式
75
61
  var anyParsed = (0, _dayjs["default"])(v);
76
62
  return anyParsed.isValid() ? anyParsed : null;
77
63
  })) || undefined;
78
64
  var handleRangeChange = function handleRangeChange(date, dateString) {
79
- // 确保日期值按 currentFormat 格式化
80
65
  var formattedValues = (date === null || date === void 0 ? void 0 : date.map(function (d) {
81
66
  if (!d || !(0, _dayjs["default"])(d).isValid()) return '';
82
67
  return (0, _dayjs["default"])(d).format(currentFormat);
@@ -129,7 +114,6 @@ var DateFormatPicker = exports.DateFormatPicker = function DateFormatPicker(_ref
129
114
  var isYearOnly = currentFormat === 'YYYY';
130
115
  var isMonthOnly = currentFormat === 'YYYY-MM' || currentFormat === 'YYYY/MM';
131
116
  var handleFormatChange = function handleFormatChange(newFormat) {
132
- // 切换格式时,用新格式重新格式化当前值
133
117
  if (value) {
134
118
  var parsed = (0, _dayjs["default"])(value);
135
119
  if (parsed.isValid()) {
@@ -138,7 +122,6 @@ var DateFormatPicker = exports.DateFormatPicker = function DateFormatPicker(_ref
138
122
  }
139
123
  setCurrentFormat(newFormat);
140
124
  };
141
- // 将字符串转为 dayjs 对象,使用宽松解析
142
125
  var dateValue = function () {
143
126
  if (!value) return undefined;
144
127
  var parsed = (0, _dayjs["default"])(value, currentFormat, true);
@@ -157,7 +140,6 @@ var DateFormatPicker = exports.DateFormatPicker = function DateFormatPicker(_ref
157
140
  var handleMonthChange = function handleMonthChange(dateString) {
158
141
  onChange === null || onChange === void 0 || onChange(dateString, currentFormat);
159
142
  };
160
- // 根据格式渲染不同的选择器
161
143
  var renderPicker = function renderPicker() {
162
144
  if (isYearOnly) {
163
145
  return (0, _jsxRuntime.jsx)(YearPicker, {
@@ -4,17 +4,11 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.DEFAULT_DATE_FORMAT = exports.DATE_FORMAT_OPTIONS = void 0;
7
- var DATE_FORMAT_OPTIONS = exports.DATE_FORMAT_OPTIONS = [
8
- // { value: 'YYYY-MM', label: 'YYYY-MM' },
9
- {
7
+ var DATE_FORMAT_OPTIONS = exports.DATE_FORMAT_OPTIONS = [{
10
8
  value: 'YYYY-MM-DD',
11
9
  label: 'YYYY-MM-DD'
12
10
  }, {
13
11
  value: 'YYYY-MM-DD HH:mm',
14
12
  label: 'YYYY-MM-DD HH:mm'
15
- }
16
- // { value: 'YYYY/MM', label: 'YYYY/MM' },
17
- // { value: 'YYYY/MM/DD', label: 'YYYY/MM/DD' },
18
- // { value: 'YYYY/MM/DD HH:mm', label: 'YYYY/MM/DD HH:mm' },
19
- ];
13
+ }];
20
14
  var DEFAULT_DATE_FORMAT = exports.DEFAULT_DATE_FORMAT = 'YYYY-MM-DD HH:mm';
@@ -1,6 +1,3 @@
1
- /**
2
- * 关联模块 选择表字段
3
- */
4
1
  import './index.less';
5
2
  import { AtomsExpression } from '../../../store/types';
6
3
  import { DataType } from '../select-column-multiple';
@@ -29,17 +29,9 @@ var _utils = require("../formula-list/utils");
29
29
  var _itemName = _interopRequireDefault(require("../../modules/components/item-name"));
30
30
  var _dateFormatPicker = require("./date-format-picker");
31
31
  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); }
32
- /**
33
- * 关联模块 选择表字段
34
- */
35
-
36
32
  var NUMBER_LIST = ['等于', '不等于', '大于', '小于', '介于之间', '大于或等于', '小于或等于', '为空', '不为空', '以...开始', '以...结束', '不以...开始', '不以...结束', 'In', 'Not In', '正则匹配'];
37
33
  var STRING_LIST = ['等于', '不等于', '包含', '不包含', '为空', '不为空', '以...开始', '以...结束', '不以...开始', '不以...结束', 'In', 'Not In', '正则匹配'];
38
- var DATE_LIST = [
39
- // '前', '下一个', '当前',
40
- '等于', '早于', '晚于',
41
- // '在',
42
- '介于之间', '是空的', '不为空'];
34
+ var DATE_LIST = ['等于', '早于', '晚于', '介于之间', '是空的', '不为空'];
43
35
  var typeList = [{
44
36
  key: _enum.SQL_COLUMN_TYPE.STRING,
45
37
  label: _enum.SQL_COLUMN_TYPE.STRING
@@ -50,12 +42,6 @@ var typeList = [{
50
42
  key: _enum.SQL_COLUMN_TYPE.DATE,
51
43
  label: _enum.SQL_COLUMN_TYPE.DATE
52
44
  }];
53
- // const typeList = Object.values(SQL_COLUMN_TYPE).map((v) => {
54
- // return {
55
- // key: v,
56
- // label: v,
57
- // };
58
- // });
59
45
  var SelectFilterColumn = function SelectFilterColumn(_ref) {
60
46
  var _value$lhs;
61
47
  var _ref$data = _ref.data,
@@ -81,10 +67,6 @@ var SelectFilterColumn = function SelectFilterColumn(_ref) {
81
67
  _useState6 = (0, _slicedToArray2["default"])(_useState5, 2),
82
68
  rhsVal = _useState6[0],
83
69
  setRhsVal = _useState6[1];
84
- // const [valType, setValType] = useState<'string' | 'constant' | 'field' | ''>(
85
- // value.valType || 'string',
86
- // );
87
- // const [constantName, setConstantName] = useState<string>(value.constantName || '');
88
70
  var _useState7 = (0, _react.useState)((value === null || value === void 0 ? void 0 : value.database_type) || _enum.SQL_COLUMN_TYPE.STRING),
89
71
  _useState8 = (0, _slicedToArray2["default"])(_useState7, 2),
90
72
  special_type = _useState8[0],
@@ -125,20 +107,6 @@ var SelectFilterColumn = function SelectFilterColumn(_ref) {
125
107
  }
126
108
  });
127
109
  return !isOk;
128
- // console.log('🚀 ~ disabled ~ a:', a);
129
- // if ((rhsVal[0] as AtomsString).val && ~['等于', '不等于', '早于', '晚于'].indexOf(condition)) {
130
- // return false;
131
- // }
132
- // if (~['为空', '不为空', '是空的', '不是空的'].indexOf(condition)) {
133
- // return false;
134
- // }
135
- // else if (~['前', '下一个', '介于之间'].indexOf(condition)) {
136
- // if ((rhsVal[0] as AtomsStringList).val[0] && (rhsVal[0] as AtomsStringList).val[1]) {
137
- // return false;
138
- // }
139
- // } else if (rhsVal.length && (rhsVal as AtomsString[]).map((v) => v.val).join(',')) {
140
- // return false;
141
- // }
142
110
  return true;
143
111
  }, [rhsVal, condition, curColumn]);
144
112
  (0, _react.useEffect)(function () {
@@ -201,9 +169,6 @@ var SelectFilterColumn = function SelectFilterColumn(_ref) {
201
169
  firstVal = _val.val[0] || '';
202
170
  secondVal = _val.val[1] || '';
203
171
  }
204
- // let [first = { val: '', type: AtomsTypeEnum.INPUT }] = val as AtomsString[];
205
- // let firstVal = first.val || '';
206
- // let secondVal = second.val || '';
207
172
  var quotes = '';
208
173
  if (condition === '以...开始') {
209
174
  if (_locale.isEn) {
@@ -302,31 +267,12 @@ var SelectFilterColumn = function SelectFilterColumn(_ref) {
302
267
  formula: formula,
303
268
  rhs: rhsVal,
304
269
  condition: condition,
305
- // 选择条件
306
270
  quotes: quotes,
307
- // 前端显示用户看的文字
308
- database_type: filterCustomType ? special_type : '' // 自定义类型
309
- // groupSql: curColumn.alias === SummarizeAlias ? curColumn.sql : '',
271
+ database_type: filterCustomType ? special_type : ''
310
272
  }));
311
273
  }
312
274
  function goPrevPage() {
313
- // setCurColumn({
314
- // lhs: [],
315
- // rhs: [],
316
- // database_type: '', // 字段类型
317
- // condition: '', // 条件 聚合by过来的会有这个
318
- // quotes: '', // 展示用户看的 组装的文字
319
- // type: AtomsTypeEnum.EXPRESSION, // 连接类型
320
- // });
321
275
  setIsNext(false);
322
- // setCondition('');
323
- // setFormula({});
324
- // setRhsVal([
325
- // {
326
- // val: '',
327
- // type: AtomsTypeEnum.INPUT,
328
- // },
329
- // ]);
330
276
  }
331
277
  function getData(data) {
332
278
  var _data$database_type = data.database_type,
@@ -453,7 +399,6 @@ var SelectFilterColumn = function SelectFilterColumn(_ref) {
453
399
  value: firstVal || '',
454
400
  onInput: function onInput(e) {
455
401
  var newVal = rhsVal.slice();
456
- // (newVal as AtomsStringList[])[0].val[0] = e.target.value;
457
402
  newVal[0].val = e.target.value;
458
403
  setRhsVal(newVal);
459
404
  }
@@ -481,7 +426,6 @@ var SelectFilterColumn = function SelectFilterColumn(_ref) {
481
426
  onChange: function onChange(key) {
482
427
  var newVal = rhsVal.slice();
483
428
  newVal[1].val = key;
484
- // (newVal as AtomsStringList[])[0].val[1] = key;
485
429
  setRhsVal(newVal);
486
430
  },
487
431
  children: (0, _jsxRuntime.jsxs)(_pandora.Button, {
@@ -591,7 +535,6 @@ var SelectFilterColumn = function SelectFilterColumn(_ref) {
591
535
  visible: false
592
536
  });
593
537
  }
594
- // 选择变量
595
538
  var selectConstant = function selectConstant(e) {
596
539
  store.setClosable(false);
597
540
  var node = e.currentTarget;
@@ -605,7 +548,6 @@ var SelectFilterColumn = function SelectFilterColumn(_ref) {
605
548
  list: store.constantList || [],
606
549
  onChange: function onChange(val) {
607
550
  closePopup2();
608
- // let curObj = store.constantList.filter((v: any) => v.value === val)[0];
609
551
  var newVal = rhsVal.slice();
610
552
  newVal[0].id = val;
611
553
  newVal[0].val = (0, _utils.getConstantLabel)(store.constantList, val);
@@ -644,29 +586,17 @@ var SelectFilterColumn = function SelectFilterColumn(_ref) {
644
586
  if (type === _types.AtomsTypeEnum.FIELD) {
645
587
  setRhsVal([{
646
588
  fieldName: '',
647
- // 字段名
648
589
  fieldNameZh: '',
649
- // 字段中文名
650
590
  fieldAlias: '',
651
- // 别名
652
591
  fieldUuid: '',
653
- // uuid
654
592
  fieldId: '',
655
- // 字段id
656
- // quotes?: string; // 字段展示的 不知道有没有用
657
593
  tableName: '',
658
- // 表名
659
594
  tableNameZh: '',
660
595
  tableId: '',
661
- // 表名
662
596
  tableAlias: '',
663
- // 别名
664
597
  tableUuid: '',
665
- // 表唯一标识
666
598
  datasourceName: '',
667
- // 数据源名
668
599
  datasourceId: '',
669
- // 数据源id
670
600
  type: _types.AtomsTypeEnum.FIELD
671
601
  }]);
672
602
  }
@@ -699,7 +629,6 @@ var SelectFilterColumn = function SelectFilterColumn(_ref) {
699
629
  onSelect: function onSelect(fields, quotes) {
700
630
  var newR = (0, _toConsumableArray2["default"])(rhsVal);
701
631
  newR = fields;
702
- // (newR[_index] as AtomsField).quotes = quotes;
703
632
  setRhsVal(newR);
704
633
  store.setPopup2({
705
634
  visible: false
@@ -710,7 +639,6 @@ var SelectFilterColumn = function SelectFilterColumn(_ref) {
710
639
  });
711
640
  };
712
641
  if (isNext) {
713
- // SQL_GROUP_TYPE
714
642
  var _getData = getData(curColumn),
715
643
  fieldType = _getData.type,
716
644
  conditions = _getData.conditions;
@@ -953,19 +881,10 @@ var SelectFilterColumn = function SelectFilterColumn(_ref) {
953
881
  setIsNext(true);
954
882
  },
955
883
  onSelect: function onSelect(fields, quotes) {
956
- // const { columns, ...other } = tableInfo;
957
884
  setCurColumn((0, _objectSpread2["default"])((0, _objectSpread2["default"])({}, curColumn), {}, {
958
885
  lhs: fields
959
886
  }));
960
887
  setIsNext(true);
961
- // setCurColumn(record);
962
- /**
963
- * 这里默认帮用户选好一部分数据
964
- * 不至于让用户每一个都自己选、
965
- * 比如说:条件字段 默认我们帮他选好第一个...
966
- */
967
- // let { conditions } = getData(curColumn);
968
- // setDefaultVal(conditions[0]);
969
888
  }
970
889
  })
971
890
  });
@@ -25,7 +25,7 @@ var _types = require("../../../store/types");
25
25
  var _pandora = require("@gingkoo/pandora");
26
26
  var _cloneDeep = _interopRequireDefault(require("lodash/cloneDeep"));
27
27
  var _useProvider = require("../../../hooks/use-provider");
28
- var _templateObject; // import { OptionsTypeEnum, customTypes, otherList, operatorList, functionList } from './enum';
28
+ var _templateObject;
29
29
  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); }
30
30
  var VisualBox = _styledComponents["default"].div.attrs({
31
31
  className: 'visual-box'
@@ -45,9 +45,6 @@ var CaseEditor = _react["default"].forwardRef(function (props, ref) {
45
45
  _useState2 = (0, _slicedToArray2["default"])(_useState, 2),
46
46
  fun = _useState2[0],
47
47
  setFun = _useState2[1];
48
- // const [formulaList, setFunctionList] = useState<{ [params: string]: FormulaTemplatesItem }>(
49
- // getObjTem(store.formulaTemplates),
50
- // );
51
48
  var formulaList = (0, _react.useMemo)(function () {
52
49
  return (0, _utils2.getObjTem)(store.formulaTemplates);
53
50
  }, [store.formulaTemplates]);
@@ -82,26 +79,12 @@ var CaseEditor = _react["default"].forwardRef(function (props, ref) {
82
79
  });
83
80
  }, [currentFormulaKey, currentFormulaTemplate, effectiveArity]);
84
81
  var _ref = (0, _react.useRef)(null);
85
- // EXPRESSION = 'expression', // 表达式
86
- // // FUNCTION = 'function', // 函数
87
- // INPUT_STRING = 'inputString', // 字符串输入框
88
- // INPUT_STRING_LIST = 'inputStringList', // 字符串输入框
89
- // INPUT_NUMBER_LIST = 'inputNumberList', // 数字输入框
90
- // INPUT_NUMBER = 'inputNumber', // 数字输入框
91
- // CONSTANT = 'constant', // 常量
92
- // OPERATOR = 'operator', // 运算符
93
- // UNKNOWN = 'unknown', //未选具体类型
94
- // FORMULA = 'FORMULA',
95
- // COLLECTION = 'collection',
96
- // 提交按钮是否可用
97
82
  var usable = (0, _react.useMemo)(function () {
98
83
  return fun.name && (0, _utils.isOk)(fun.args);
99
84
  }, [fun]);
100
- // 取消
101
85
  var _onClose = function _onClose() {
102
86
  onCancel === null || onCancel === void 0 || onCancel();
103
87
  };
104
- // 确定
105
88
  var _onOk = function _onOk() {
106
89
  typeof onOk === 'function' && (onOk === null || onOk === void 0 ? void 0 : onOk((0, _objectSpread2["default"])((0, _objectSpread2["default"])({}, fun), {}, {
107
90
  arity: effectiveArity,
@@ -110,11 +93,9 @@ var CaseEditor = _react["default"].forwardRef(function (props, ref) {
110
93
  quotes: (0, _utils2.getQuotes)(fun, fun.args, formulaList)
111
94
  })));
112
95
  };
113
- // 选择公式名
114
96
  var handleFunName = function handleFunName(id) {
115
97
  var _formulaList$id, _formulaList$id2, _formulaList$id3;
116
98
  var isId = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
117
- // formulaList?.[name].args;
118
99
  setFun((0, _objectSpread2["default"])((0, _objectSpread2["default"])({}, fun), {}, {
119
100
  args: (0, _utils2.getTemArgs)(formulaList === null || formulaList === void 0 ? void 0 : formulaList[id].args, formulaList === null || formulaList === void 0 || (_formulaList$id = formulaList[id]) === null || _formulaList$id === void 0 ? void 0 : _formulaList$id.arity),
120
101
  arity: formulaList === null || formulaList === void 0 || (_formulaList$id2 = formulaList[id]) === null || _formulaList$id2 === void 0 ? void 0 : _formulaList$id2.arity,
@@ -190,9 +171,6 @@ var CaseEditor = _react["default"].forwardRef(function (props, ref) {
190
171
  }, option.id || String(option.name + ind));
191
172
  })
192
173
  }, index);
193
- // <Select.Option key={index} value={option.name}>
194
- // {option.name}
195
- // </Select.Option>
196
174
  })
197
175
  })
198
176
  })
@@ -232,15 +210,8 @@ var CaseEditor = _react["default"].forwardRef(function (props, ref) {
232
210
  onChange: function onChange(data, _quotes) {
233
211
  var _args = (0, _cloneDeep["default"])(fun.args);
234
212
  _args[i].list = data;
235
- // (_args[i] as AtomsCollection).quotes = _quotes || '';
236
- // const quotes = (_args as AtomsCollection[])
237
- // .map((v) => {
238
- // return v.quotes;
239
- // })
240
- // .join(' , ');
241
213
  setFun((0, _objectSpread2["default"])((0, _objectSpread2["default"])({}, fun), {}, {
242
214
  quotes: (0, _utils2.getQuotes)(fun, _args, formulaList),
243
- //fun.name + ' ( ' + quotes + ' ) ',
244
215
  args: _args
245
216
  }));
246
217
  }
@@ -12,9 +12,6 @@ var getObjTem = exports.getObjTem = function getObjTem(arr) {
12
12
  var obj = {};
13
13
  arr === null || arr === void 0 || arr.map(function (v) {
14
14
  v.children.map(function (vv) {
15
- // if (vv.name) {
16
- // obj[vv.name] = vv;
17
- // }
18
15
  if (vv.id) {
19
16
  obj[vv.id] = vv;
20
17
  }
@@ -33,7 +30,6 @@ var getTemArgs = exports.getTemArgs = function getTemArgs(temArgs, arity) {
33
30
  var minLen = (arity === null || arity === void 0 ? void 0 : arity.min) || (arity === null || arity === void 0 ? void 0 : arity.exact);
34
31
  var temLen = _temArgs.length;
35
32
  var len = minLen - temLen;
36
- // 按最小长度添加
37
33
  if (len > 0) {
38
34
  Array.from({
39
35
  length: len
@@ -56,15 +52,12 @@ function getParamActions(params, arity) {
56
52
  };
57
53
  }
58
54
  var effectiveMin = 'min' in arity ? arity.min : 'exact' in arity ? arity.exact : 0;
59
- var effectiveMax = 'max' in arity ? arity.max : 'exact' in arity ? arity.exact // ← 这里!不能是 Infinity
60
- : Infinity;
55
+ var effectiveMax = 'max' in arity ? arity.max : 'exact' in arity ? arity.exact : Infinity;
61
56
  return {
62
57
  canAdd: len < effectiveMax,
63
- // 小于 max 才能加
64
- canDel: len > effectiveMin // 大于 min 才能删
58
+ canDel: len > effectiveMin
65
59
  };
66
60
  }
67
- // 获取公式名称 如果找不到 用传入的name
68
61
  var formulaName = exports.formulaName = function formulaName(fun, formulaList) {
69
62
  var obj = formulaList[fun.id] || formulaList[fun.name];
70
63
  return (obj === null || obj === void 0 ? void 0 : obj.name) || fun.name;
@@ -82,7 +75,6 @@ var getQuotes = exports.getQuotes = function getQuotes(fun, _args, formulaList)
82
75
  }).join(' ');
83
76
  return quotes;
84
77
  }).join(' , ');
85
- // let obj = formulaList[fun.id] || formulaList[fun.name];
86
78
  return formulaName(fun, formulaList) + ' ( ' + quotes + ' ) ';
87
79
  };
88
80
  var formulaIsError = exports.formulaIsError = function formulaIsError(fun, formulaList) {
@@ -0,0 +1,19 @@
1
+ import React from 'react';
2
+ export type CaseWhenBranchView = {
3
+ key: string;
4
+ whenContent: React.ReactNode;
5
+ thenContent: React.ReactNode;
6
+ onAddAfter: (e: any) => void;
7
+ onDelete: (e: any) => void;
8
+ };
9
+ type Props = {
10
+ caseValueContent: React.ReactNode;
11
+ branches: CaseWhenBranchView[];
12
+ elseContent?: React.ReactNode;
13
+ onAddBranch: (e: any) => void;
14
+ onAddElse: (e: any) => void;
15
+ onRemoveElse: (e: any) => void;
16
+ onDeleteCase: (e: any) => void;
17
+ };
18
+ declare const CaseWhenGroup: ({ caseValueContent, branches, elseContent, onAddBranch, onAddElse, onRemoveElse, onDeleteCase, }: Props) => import("react/jsx-runtime").JSX.Element;
19
+ export default CaseWhenGroup;