@gingkoo/pandora-metabase 1.0.118 → 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.
- package/lib/cjs/common/Portal/index.js +0 -2
- package/lib/cjs/common/SplitView/index.d.ts +0 -4
- package/lib/cjs/common/SplitView/index.js +0 -10
- package/lib/cjs/components/dialog/custom-column/config.js +4 -48
- package/lib/cjs/components/dialog/custom-column/expression-editor.js +3 -14
- package/lib/cjs/components/dialog/custom-column/expressions/suggest.d.ts +2 -34
- package/lib/cjs/components/dialog/custom-column/expressions/suggest.js +2 -43
- package/lib/cjs/components/dialog/custom-column/expressions/tokenizer.js +8 -65
- package/lib/cjs/components/dialog/custom-column/index.js +2 -4
- package/lib/cjs/components/dialog/custom-column/tokenized-expression.js +2 -3
- package/lib/cjs/components/dialog/custom-column/tokenizedI-input.js +1 -1
- package/lib/cjs/components/dialog/custom-editor/index.js +2 -7
- package/lib/cjs/components/dialog/diff-viewer/index copy.js +1 -16
- package/lib/cjs/components/dialog/expression/date-format-picker.js +2 -20
- package/lib/cjs/components/dialog/expression/date-format.js +2 -8
- package/lib/cjs/components/dialog/expression/index.d.ts +0 -3
- package/lib/cjs/components/dialog/expression/index.js +2 -83
- package/lib/cjs/components/dialog/formula/index.js +1 -30
- package/lib/cjs/components/dialog/formula/utils.js +2 -10
- package/lib/cjs/components/dialog/formula-list/CaseWhenGroup.d.ts +19 -0
- package/lib/cjs/components/dialog/formula-list/CaseWhenGroup.js +109 -0
- package/lib/cjs/components/dialog/formula-list/LogicGroup.d.ts +9 -0
- package/lib/cjs/components/dialog/formula-list/LogicGroup.js +43 -0
- package/lib/cjs/components/dialog/formula-list/index.d.ts +3 -0
- package/lib/cjs/components/dialog/formula-list/index.js +967 -503
- package/lib/cjs/components/dialog/formula-list/index.less +724 -0
- package/lib/cjs/components/dialog/formula-list/utils.d.ts +0 -7
- package/lib/cjs/components/dialog/formula-list/utils.js +117 -113
- package/lib/cjs/components/dialog/select-column/index.d.ts +0 -6
- package/lib/cjs/components/dialog/select-column/index.js +4 -15
- package/lib/cjs/components/dialog/select-column-multiple/index.d.ts +0 -8
- package/lib/cjs/components/dialog/select-column-multiple/index.js +6 -45
- package/lib/cjs/components/dialog/select-join/index.d.ts +0 -5
- package/lib/cjs/components/dialog/select-join/index.js +0 -6
- package/lib/cjs/components/dialog/select-join-column/index.d.ts +0 -8
- package/lib/cjs/components/dialog/select-join-column/index.js +7 -21
- package/lib/cjs/components/dialog/select-join-column-multiple/index.d.ts +0 -8
- package/lib/cjs/components/dialog/select-join-column-multiple/index.js +5 -35
- package/lib/cjs/components/dialog/select-permission-table/index.d.ts +0 -5
- package/lib/cjs/components/dialog/select-permission-table/index.js +0 -6
- package/lib/cjs/components/dialog/select-summarize/index.d.ts +3 -3
- package/lib/cjs/components/dialog/select-summarize/index.js +105 -18
- package/lib/cjs/components/dialog/select-summarize/index.less +23 -0
- package/lib/cjs/components/dialog/select-table/index.d.ts +0 -6
- package/lib/cjs/components/dialog/select-table/index.js +1 -9
- package/lib/cjs/components/metabase/index.js +72 -86
- package/lib/cjs/components/metabase/index.less +7 -7
- package/lib/cjs/components/modules/components/Wrapper.js +1 -1
- package/lib/cjs/components/modules/components/header.js +2 -2
- package/lib/cjs/components/modules/components/meta-icon.d.ts +0 -3
- package/lib/cjs/components/modules/components/meta-icon.js +2 -47
- package/lib/cjs/components/modules/custom-column.js +3 -29
- package/lib/cjs/components/modules/enum/filter-enum.js +9 -88
- package/lib/cjs/components/modules/filter.js +2 -20
- package/lib/cjs/components/modules/index.d.ts +4 -2
- package/lib/cjs/components/modules/index.js +24 -1
- package/lib/cjs/components/modules/join-data.js +13 -291
- package/lib/cjs/components/modules/row-limit.js +0 -1
- package/lib/cjs/components/modules/sort.js +1 -61
- package/lib/cjs/components/modules/summarize/group-by.d.ts +0 -5
- package/lib/cjs/components/modules/summarize/group-by.js +231 -76
- package/lib/cjs/components/modules/summarize/select-index.js +96 -46
- package/lib/cjs/components/modules/table-data.js +11 -64
- package/lib/cjs/components/popup.js +26 -32
- package/lib/cjs/hooks/patch.d.ts +1 -0
- package/lib/cjs/hooks/patch.js +104 -6
- package/lib/cjs/hooks/patch2.js +3 -165
- package/lib/cjs/hooks/use-provider.js +0 -3
- package/lib/cjs/hooks/use-state.js +55 -135
- package/lib/cjs/index.js +0 -15
- package/lib/cjs/locale/en.js +5 -0
- package/lib/cjs/locale/index.js +1 -4
- package/lib/cjs/locale/zh.js +5 -0
- package/lib/cjs/sql-formula.js +0 -1
- package/lib/cjs/store/enum.d.ts +6 -6
- package/lib/cjs/store/enum.js +0 -13
- package/lib/cjs/store/helper.d.ts +2 -1
- package/lib/cjs/store/helper.js +15 -225
- package/lib/cjs/store/types.d.ts +45 -67
- package/lib/cjs/store/types.js +3 -49
- package/lib/cjs/types.d.ts +1 -0
- package/lib/cjs/utils/cookies.js +0 -3
- package/lib/cjs/utils/event.js +1 -1
- package/lib/cjs/utils/helper-dom.d.ts +1 -0
- package/lib/cjs/utils/helper-dom.js +17 -10
- package/lib/cjs/utils/helper.js +1 -24
- package/lib/cjs/utils/keydown.js +4 -7
- package/lib/cjs/utils/platform.d.ts +0 -9
- package/lib/cjs/utils/platform.js +0 -10
- package/lib/cjs/utils/selection.js +0 -6
- package/lib/cjs/utils/storage.d.ts +0 -9
- package/lib/cjs/utils/storage.js +1 -11
- package/lib/cjs/utils/transformSql.d.ts +5 -0
- package/lib/cjs/utils/transformSql.js +42 -113
- package/lib/cjs/utils.d.ts +1 -6
- package/lib/cjs/utils.js +115 -255
- package/lib/es/common/Portal/index.js +0 -2
- package/lib/es/common/SplitView/index.d.ts +0 -4
- package/lib/es/common/SplitView/index.js +0 -10
- package/lib/es/components/dialog/custom-column/config.js +4 -48
- package/lib/es/components/dialog/custom-column/expression-editor.js +3 -14
- package/lib/es/components/dialog/custom-column/expressions/suggest.d.ts +2 -34
- package/lib/es/components/dialog/custom-column/expressions/suggest.js +2 -43
- package/lib/es/components/dialog/custom-column/expressions/tokenizer.js +8 -65
- package/lib/es/components/dialog/custom-column/index.js +2 -4
- package/lib/es/components/dialog/custom-column/tokenized-expression.js +1 -3
- package/lib/es/components/dialog/custom-column/tokenizedI-input.js +1 -1
- package/lib/es/components/dialog/custom-editor/index.js +1 -7
- package/lib/es/components/dialog/diff-viewer/index copy.js +1 -15
- package/lib/es/components/dialog/expression/date-format-picker.js +2 -20
- package/lib/es/components/dialog/expression/date-format.js +2 -8
- package/lib/es/components/dialog/expression/index.d.ts +0 -3
- package/lib/es/components/dialog/expression/index.js +2 -82
- package/lib/es/components/dialog/formula/index.js +0 -30
- package/lib/es/components/dialog/formula/utils.js +2 -10
- package/lib/es/components/dialog/formula-list/CaseWhenGroup.d.ts +19 -0
- package/lib/es/components/dialog/formula-list/CaseWhenGroup.js +102 -0
- package/lib/es/components/dialog/formula-list/LogicGroup.d.ts +9 -0
- package/lib/es/components/dialog/formula-list/LogicGroup.js +36 -0
- package/lib/es/components/dialog/formula-list/index.d.ts +3 -0
- package/lib/es/components/dialog/formula-list/index.js +966 -503
- package/lib/es/components/dialog/formula-list/index.less +724 -0
- package/lib/es/components/dialog/formula-list/utils.d.ts +0 -7
- package/lib/es/components/dialog/formula-list/utils.js +117 -113
- package/lib/es/components/dialog/index.js +3 -3
- package/lib/es/components/dialog/select-column/index.d.ts +0 -6
- package/lib/es/components/dialog/select-column/index.js +4 -14
- package/lib/es/components/dialog/select-column-multiple/index.d.ts +0 -8
- package/lib/es/components/dialog/select-column-multiple/index.js +7 -47
- package/lib/es/components/dialog/select-join/index.d.ts +0 -5
- package/lib/es/components/dialog/select-join/index.js +0 -5
- package/lib/es/components/dialog/select-join-column/index.d.ts +0 -8
- package/lib/es/components/dialog/select-join-column/index.js +7 -20
- package/lib/es/components/dialog/select-join-column-multiple/index.d.ts +0 -8
- package/lib/es/components/dialog/select-join-column-multiple/index.js +5 -34
- package/lib/es/components/dialog/select-permission-table/index.d.ts +0 -5
- package/lib/es/components/dialog/select-permission-table/index.js +0 -5
- package/lib/es/components/dialog/select-summarize/index.d.ts +3 -3
- package/lib/es/components/dialog/select-summarize/index.js +106 -18
- package/lib/es/components/dialog/select-summarize/index.less +23 -0
- package/lib/es/components/dialog/select-table/index.d.ts +0 -6
- package/lib/es/components/dialog/select-table/index.js +1 -8
- package/lib/es/components/metabase/index.js +72 -87
- package/lib/es/components/metabase/index.less +7 -7
- package/lib/es/components/modules/components/Wrapper.js +1 -1
- package/lib/es/components/modules/components/header.js +2 -2
- package/lib/es/components/modules/components/meta-icon.d.ts +0 -3
- package/lib/es/components/modules/components/meta-icon.js +2 -46
- package/lib/es/components/modules/custom-column.js +3 -29
- package/lib/es/components/modules/enum/filter-enum.js +9 -88
- package/lib/es/components/modules/filter.js +2 -19
- package/lib/es/components/modules/index.d.ts +4 -2
- package/lib/es/components/modules/index.js +24 -1
- package/lib/es/components/modules/join-data.js +13 -291
- package/lib/es/components/modules/row-limit.js +0 -1
- package/lib/es/components/modules/sort.js +1 -61
- package/lib/es/components/modules/summarize/group-by.d.ts +0 -5
- package/lib/es/components/modules/summarize/group-by.js +233 -78
- package/lib/es/components/modules/summarize/select-index.js +96 -46
- package/lib/es/components/modules/table-data.js +11 -64
- package/lib/es/components/popup.js +27 -33
- package/lib/es/hooks/patch.d.ts +1 -0
- package/lib/es/hooks/patch.js +103 -5
- package/lib/es/hooks/patch2.js +2 -164
- package/lib/es/hooks/use-provider.js +0 -3
- package/lib/es/hooks/use-state.js +55 -135
- package/lib/es/index.js +0 -14
- package/lib/es/locale/en.js +5 -0
- package/lib/es/locale/index.js +1 -4
- package/lib/es/locale/zh.js +5 -0
- package/lib/es/sql-formula.js +0 -1
- package/lib/es/store/enum.d.ts +6 -6
- package/lib/es/store/enum.js +0 -13
- package/lib/es/store/helper.d.ts +2 -1
- package/lib/es/store/helper.js +13 -224
- package/lib/es/store/types.d.ts +45 -67
- package/lib/es/store/types.js +3 -49
- package/lib/es/types.d.ts +1 -0
- package/lib/es/types.js +1 -18
- package/lib/es/utils/cookies.js +0 -3
- package/lib/es/utils/event.js +1 -1
- package/lib/es/utils/helper-dom.d.ts +1 -0
- package/lib/es/utils/helper-dom.js +16 -9
- package/lib/es/utils/helper.js +1 -24
- package/lib/es/utils/keydown.js +4 -7
- package/lib/es/utils/platform.d.ts +0 -9
- package/lib/es/utils/platform.js +0 -10
- package/lib/es/utils/selection.js +0 -6
- package/lib/es/utils/storage.d.ts +0 -9
- package/lib/es/utils/storage.js +1 -10
- package/lib/es/utils/transformSql.d.ts +5 -0
- package/lib/es/utils/transformSql.js +42 -112
- package/lib/es/utils.d.ts +1 -6
- package/lib/es/utils.js +116 -255
- package/package.json +1 -1
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
// DiffViewer.tsx
|
|
4
3
|
import { useEffect, useRef, useState } from 'react';
|
|
5
4
|
import { diffWordsWithSpace, createTwoFilesPatch } from 'diff';
|
|
6
5
|
import './index.less';
|
|
@@ -22,7 +21,6 @@ var DiffViewer = function DiffViewer(_ref) {
|
|
|
22
21
|
_useState4 = _slicedToArray(_useState3, 2),
|
|
23
22
|
hunkHeaders = _useState4[0],
|
|
24
23
|
setHunkHeaders = _useState4[1];
|
|
25
|
-
// 提取文件头和 hunk headers(安全依赖)
|
|
26
24
|
useEffect(function () {
|
|
27
25
|
var safeOldStr = typeof oldCode === 'string' ? oldCode : '';
|
|
28
26
|
var safeNewStr = typeof newCode === 'string' ? newCode : '';
|
|
@@ -30,17 +28,10 @@ var DiffViewer = function DiffViewer(_ref) {
|
|
|
30
28
|
context: 10
|
|
31
29
|
});
|
|
32
30
|
var lines = patch.split('\n');
|
|
33
|
-
// for (const line of lines) {
|
|
34
|
-
// if (line.startsWith('--- ')) {
|
|
35
|
-
// setOldFileHeader(line);
|
|
36
|
-
// break;
|
|
37
|
-
// }
|
|
38
|
-
// }
|
|
39
31
|
setHunkHeaders(lines.filter(function (l) {
|
|
40
32
|
return l.startsWith('@@ ') && l.endsWith(' @@');
|
|
41
33
|
}));
|
|
42
34
|
}, [oldCode, newCode, oldFileName, newFileName]);
|
|
43
|
-
// 主 diff 渲染逻辑
|
|
44
35
|
useEffect(function () {
|
|
45
36
|
var safeOld = (typeof oldCode === 'string' ? oldCode : '').split('\n');
|
|
46
37
|
var safeNew = (typeof newCode === 'string' ? newCode : '').split('\n');
|
|
@@ -54,7 +45,6 @@ var DiffViewer = function DiffViewer(_ref) {
|
|
|
54
45
|
var diffs = diffWordsWithSpace(oldLine, newLine);
|
|
55
46
|
var leftContent = '';
|
|
56
47
|
var rightContent = '';
|
|
57
|
-
// ✅ 检查最后一个 token 是否是行尾空格且被删除
|
|
58
48
|
var lastToken = diffs[diffs.length - 1];
|
|
59
49
|
var ignoreLastTrailingSpace = diffs.length > 0 && (lastToken === null || lastToken === void 0 ? void 0 : lastToken.removed) && /^\s+$/.test(lastToken.value) && oldLine.endsWith(lastToken.value);
|
|
60
50
|
for (var j = 0; j < diffs.length; j++) {
|
|
@@ -63,10 +53,8 @@ var DiffViewer = function DiffViewer(_ref) {
|
|
|
63
53
|
if (part.added) {
|
|
64
54
|
rightContent += "<span class=\"diff-add\">".concat(escaped, "</span>");
|
|
65
55
|
} else if (part.removed) {
|
|
66
|
-
// ✅ 如果是最后一个 token 且是行尾空格 → 不高亮
|
|
67
56
|
if (ignoreLastTrailingSpace && j === diffs.length - 1) {
|
|
68
|
-
leftContent += escaped;
|
|
69
|
-
// rightContent 不加(因为新行没有)
|
|
57
|
+
leftContent += escaped;
|
|
70
58
|
} else {
|
|
71
59
|
leftContent += "<span class=\"diff-del\">".concat(escaped, "</span>");
|
|
72
60
|
}
|
|
@@ -75,7 +63,6 @@ var DiffViewer = function DiffViewer(_ref) {
|
|
|
75
63
|
rightContent += escaped;
|
|
76
64
|
}
|
|
77
65
|
}
|
|
78
|
-
// 处理缺失行
|
|
79
66
|
if (i >= safeOld.length) leftContent = ' ';
|
|
80
67
|
if (i >= safeNew.length) rightContent = ' ';
|
|
81
68
|
leftHtml.push("<div class=\"diff-line\">".concat(leftContent, "</div>"));
|
|
@@ -89,7 +76,6 @@ var DiffViewer = function DiffViewer(_ref) {
|
|
|
89
76
|
return clearTimeout(timer);
|
|
90
77
|
};
|
|
91
78
|
}, [oldCode, newCode]);
|
|
92
|
-
// 同步滚动
|
|
93
79
|
useEffect(function () {
|
|
94
80
|
var left = leftRef.current;
|
|
95
81
|
var right = rightRef.current;
|
|
@@ -6,20 +6,13 @@ import dayjs from 'dayjs';
|
|
|
6
6
|
var RangePicker = DatePicker.RangePicker,
|
|
7
7
|
YearPicker = DatePicker.YearPicker,
|
|
8
8
|
MonthPicker = DatePicker.MonthPicker;
|
|
9
|
-
var DATE_FORMAT_OPTIONS = [
|
|
10
|
-
// { value: 'YYYY', label: 'YYYY' },
|
|
11
|
-
// { value: 'YYYY-MM', label: 'YYYY-MM' },
|
|
12
|
-
{
|
|
9
|
+
var DATE_FORMAT_OPTIONS = [{
|
|
13
10
|
value: 'YYYY-MM-DD',
|
|
14
11
|
label: 'YYYY-MM-DD'
|
|
15
12
|
}, {
|
|
16
13
|
value: 'YYYY-MM-DD HH:mm',
|
|
17
14
|
label: 'YYYY-MM-DD HH:mm'
|
|
18
|
-
}
|
|
19
|
-
// { value: 'YYYY/MM', label: 'YYYY/MM' },
|
|
20
|
-
// { value: 'YYYY/MM/DD', label: 'YYYY/MM/DD' },
|
|
21
|
-
// { value: 'YYYY/MM/DD HH:mm', label: 'YYYY/MM/DD HH:mm' },
|
|
22
|
-
];
|
|
15
|
+
}];
|
|
23
16
|
var DEFAULT_FORMAT = 'YYYY-MM-DD HH:mm';
|
|
24
17
|
export var DateRangeFormatPicker = function DateRangeFormatPicker(_ref) {
|
|
25
18
|
var value = _ref.value,
|
|
@@ -35,14 +28,12 @@ export var DateRangeFormatPicker = function DateRangeFormatPicker(_ref) {
|
|
|
35
28
|
}
|
|
36
29
|
}, [format]);
|
|
37
30
|
var showTime = currentFormat.includes('HH:mm');
|
|
38
|
-
// 根据格式确定 RangePicker 的 mode
|
|
39
31
|
var getRangePickerMode = function getRangePickerMode() {
|
|
40
32
|
if (currentFormat === 'YYYY') return 'year';
|
|
41
33
|
if (currentFormat === 'YYYY-MM' || currentFormat === 'YYYY/MM') return 'month';
|
|
42
34
|
return 'date';
|
|
43
35
|
};
|
|
44
36
|
var handleFormatChange = function handleFormatChange(newFormat) {
|
|
45
|
-
// 切换格式时,用新格式重新格式化当前值
|
|
46
37
|
if (value && value.length > 0) {
|
|
47
38
|
var formattedValues = value.map(function (v) {
|
|
48
39
|
if (!v) return '';
|
|
@@ -50,26 +41,20 @@ export var DateRangeFormatPicker = function DateRangeFormatPicker(_ref) {
|
|
|
50
41
|
if (!parsed.isValid()) return '';
|
|
51
42
|
return parsed.format(newFormat);
|
|
52
43
|
});
|
|
53
|
-
// 只调用 onChange,传递新格式化的值和新格式
|
|
54
44
|
onChange === null || onChange === void 0 || onChange(formattedValues, newFormat);
|
|
55
45
|
}
|
|
56
46
|
setCurrentFormat(newFormat);
|
|
57
47
|
};
|
|
58
|
-
// 将字符串数组转为 dayjs 对象数组,供 RangePicker 使用
|
|
59
48
|
var rangeValue = (value === null || value === void 0 ? void 0 : value.map(function (v) {
|
|
60
49
|
if (!v) return null;
|
|
61
|
-
// 尝试用当前格式解析,失败则用 dayjs 默认解析
|
|
62
50
|
var parsed = dayjs(v, currentFormat, true);
|
|
63
51
|
if (parsed.isValid()) return parsed;
|
|
64
|
-
// 尝试不用严格模式解析
|
|
65
52
|
var looseParsed = dayjs(v, currentFormat);
|
|
66
53
|
if (looseParsed.isValid()) return looseParsed;
|
|
67
|
-
// 最后尝试不指定格式
|
|
68
54
|
var anyParsed = dayjs(v);
|
|
69
55
|
return anyParsed.isValid() ? anyParsed : null;
|
|
70
56
|
})) || undefined;
|
|
71
57
|
var handleRangeChange = function handleRangeChange(date, dateString) {
|
|
72
|
-
// 确保日期值按 currentFormat 格式化
|
|
73
58
|
var formattedValues = (date === null || date === void 0 ? void 0 : date.map(function (d) {
|
|
74
59
|
if (!d || !dayjs(d).isValid()) return '';
|
|
75
60
|
return dayjs(d).format(currentFormat);
|
|
@@ -122,7 +107,6 @@ export var DateFormatPicker = function DateFormatPicker(_ref2) {
|
|
|
122
107
|
var isYearOnly = currentFormat === 'YYYY';
|
|
123
108
|
var isMonthOnly = currentFormat === 'YYYY-MM' || currentFormat === 'YYYY/MM';
|
|
124
109
|
var handleFormatChange = function handleFormatChange(newFormat) {
|
|
125
|
-
// 切换格式时,用新格式重新格式化当前值
|
|
126
110
|
if (value) {
|
|
127
111
|
var parsed = dayjs(value);
|
|
128
112
|
if (parsed.isValid()) {
|
|
@@ -131,7 +115,6 @@ export var DateFormatPicker = function DateFormatPicker(_ref2) {
|
|
|
131
115
|
}
|
|
132
116
|
setCurrentFormat(newFormat);
|
|
133
117
|
};
|
|
134
|
-
// 将字符串转为 dayjs 对象,使用宽松解析
|
|
135
118
|
var dateValue = function () {
|
|
136
119
|
if (!value) return undefined;
|
|
137
120
|
var parsed = dayjs(value, currentFormat, true);
|
|
@@ -150,7 +133,6 @@ export var DateFormatPicker = function DateFormatPicker(_ref2) {
|
|
|
150
133
|
var handleMonthChange = function handleMonthChange(dateString) {
|
|
151
134
|
onChange === null || onChange === void 0 || onChange(dateString, currentFormat);
|
|
152
135
|
};
|
|
153
|
-
// 根据格式渲染不同的选择器
|
|
154
136
|
var renderPicker = function renderPicker() {
|
|
155
137
|
if (isYearOnly) {
|
|
156
138
|
return _jsx(YearPicker, {
|
|
@@ -1,14 +1,8 @@
|
|
|
1
|
-
export var DATE_FORMAT_OPTIONS = [
|
|
2
|
-
// { value: 'YYYY-MM', label: 'YYYY-MM' },
|
|
3
|
-
{
|
|
1
|
+
export var DATE_FORMAT_OPTIONS = [{
|
|
4
2
|
value: 'YYYY-MM-DD',
|
|
5
3
|
label: 'YYYY-MM-DD'
|
|
6
4
|
}, {
|
|
7
5
|
value: 'YYYY-MM-DD HH:mm',
|
|
8
6
|
label: 'YYYY-MM-DD HH:mm'
|
|
9
|
-
}
|
|
10
|
-
// { value: 'YYYY/MM', label: 'YYYY/MM' },
|
|
11
|
-
// { value: 'YYYY/MM/DD', label: 'YYYY/MM/DD' },
|
|
12
|
-
// { value: 'YYYY/MM/DD HH:mm', label: 'YYYY/MM/DD HH:mm' },
|
|
13
|
-
];
|
|
7
|
+
}];
|
|
14
8
|
export var DEFAULT_DATE_FORMAT = 'YYYY-MM-DD HH:mm';
|
|
@@ -2,9 +2,6 @@ import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
|
|
|
2
2
|
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
3
3
|
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
4
4
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
5
|
-
/**
|
|
6
|
-
* 关联模块 选择表字段
|
|
7
|
-
*/
|
|
8
5
|
import './index.less';
|
|
9
6
|
import React, { useEffect, useMemo, useState } from 'react';
|
|
10
7
|
import { Repeat, Function } from '@gingkoo/pandora-icons';
|
|
@@ -26,11 +23,7 @@ import ItemName from '../../modules/components/item-name';
|
|
|
26
23
|
import { DateFormatPicker, DateRangeFormatPicker } from './date-format-picker';
|
|
27
24
|
var NUMBER_LIST = ['等于', '不等于', '大于', '小于', '介于之间', '大于或等于', '小于或等于', '为空', '不为空', '以...开始', '以...结束', '不以...开始', '不以...结束', 'In', 'Not In', '正则匹配'];
|
|
28
25
|
var STRING_LIST = ['等于', '不等于', '包含', '不包含', '为空', '不为空', '以...开始', '以...结束', '不以...开始', '不以...结束', 'In', 'Not In', '正则匹配'];
|
|
29
|
-
var DATE_LIST = [
|
|
30
|
-
// '前', '下一个', '当前',
|
|
31
|
-
'等于', '早于', '晚于',
|
|
32
|
-
// '在',
|
|
33
|
-
'介于之间', '是空的', '不为空'];
|
|
26
|
+
var DATE_LIST = ['等于', '早于', '晚于', '介于之间', '是空的', '不为空'];
|
|
34
27
|
var typeList = [{
|
|
35
28
|
key: SQL_COLUMN_TYPE.STRING,
|
|
36
29
|
label: SQL_COLUMN_TYPE.STRING
|
|
@@ -41,12 +34,6 @@ var typeList = [{
|
|
|
41
34
|
key: SQL_COLUMN_TYPE.DATE,
|
|
42
35
|
label: SQL_COLUMN_TYPE.DATE
|
|
43
36
|
}];
|
|
44
|
-
// const typeList = Object.values(SQL_COLUMN_TYPE).map((v) => {
|
|
45
|
-
// return {
|
|
46
|
-
// key: v,
|
|
47
|
-
// label: v,
|
|
48
|
-
// };
|
|
49
|
-
// });
|
|
50
37
|
var SelectFilterColumn = function SelectFilterColumn(_ref) {
|
|
51
38
|
var _value$lhs;
|
|
52
39
|
var _ref$data = _ref.data,
|
|
@@ -72,10 +59,6 @@ var SelectFilterColumn = function SelectFilterColumn(_ref) {
|
|
|
72
59
|
_useState6 = _slicedToArray(_useState5, 2),
|
|
73
60
|
rhsVal = _useState6[0],
|
|
74
61
|
setRhsVal = _useState6[1];
|
|
75
|
-
// const [valType, setValType] = useState<'string' | 'constant' | 'field' | ''>(
|
|
76
|
-
// value.valType || 'string',
|
|
77
|
-
// );
|
|
78
|
-
// const [constantName, setConstantName] = useState<string>(value.constantName || '');
|
|
79
62
|
var _useState7 = useState((value === null || value === void 0 ? void 0 : value.database_type) || SQL_COLUMN_TYPE.STRING),
|
|
80
63
|
_useState8 = _slicedToArray(_useState7, 2),
|
|
81
64
|
special_type = _useState8[0],
|
|
@@ -116,20 +99,6 @@ var SelectFilterColumn = function SelectFilterColumn(_ref) {
|
|
|
116
99
|
}
|
|
117
100
|
});
|
|
118
101
|
return !isOk;
|
|
119
|
-
// console.log('🚀 ~ disabled ~ a:', a);
|
|
120
|
-
// if ((rhsVal[0] as AtomsString).val && ~['等于', '不等于', '早于', '晚于'].indexOf(condition)) {
|
|
121
|
-
// return false;
|
|
122
|
-
// }
|
|
123
|
-
// if (~['为空', '不为空', '是空的', '不是空的'].indexOf(condition)) {
|
|
124
|
-
// return false;
|
|
125
|
-
// }
|
|
126
|
-
// else if (~['前', '下一个', '介于之间'].indexOf(condition)) {
|
|
127
|
-
// if ((rhsVal[0] as AtomsStringList).val[0] && (rhsVal[0] as AtomsStringList).val[1]) {
|
|
128
|
-
// return false;
|
|
129
|
-
// }
|
|
130
|
-
// } else if (rhsVal.length && (rhsVal as AtomsString[]).map((v) => v.val).join(',')) {
|
|
131
|
-
// return false;
|
|
132
|
-
// }
|
|
133
102
|
return true;
|
|
134
103
|
}, [rhsVal, condition, curColumn]);
|
|
135
104
|
useEffect(function () {
|
|
@@ -192,9 +161,6 @@ var SelectFilterColumn = function SelectFilterColumn(_ref) {
|
|
|
192
161
|
firstVal = _val.val[0] || '';
|
|
193
162
|
secondVal = _val.val[1] || '';
|
|
194
163
|
}
|
|
195
|
-
// let [first = { val: '', type: AtomsTypeEnum.INPUT }] = val as AtomsString[];
|
|
196
|
-
// let firstVal = first.val || '';
|
|
197
|
-
// let secondVal = second.val || '';
|
|
198
164
|
var quotes = '';
|
|
199
165
|
if (condition === '以...开始') {
|
|
200
166
|
if (isEn) {
|
|
@@ -293,31 +259,12 @@ var SelectFilterColumn = function SelectFilterColumn(_ref) {
|
|
|
293
259
|
formula: formula,
|
|
294
260
|
rhs: rhsVal,
|
|
295
261
|
condition: condition,
|
|
296
|
-
// 选择条件
|
|
297
262
|
quotes: quotes,
|
|
298
|
-
|
|
299
|
-
database_type: filterCustomType ? special_type : '' // 自定义类型
|
|
300
|
-
// groupSql: curColumn.alias === SummarizeAlias ? curColumn.sql : '',
|
|
263
|
+
database_type: filterCustomType ? special_type : ''
|
|
301
264
|
}));
|
|
302
265
|
}
|
|
303
266
|
function goPrevPage() {
|
|
304
|
-
// setCurColumn({
|
|
305
|
-
// lhs: [],
|
|
306
|
-
// rhs: [],
|
|
307
|
-
// database_type: '', // 字段类型
|
|
308
|
-
// condition: '', // 条件 聚合by过来的会有这个
|
|
309
|
-
// quotes: '', // 展示用户看的 组装的文字
|
|
310
|
-
// type: AtomsTypeEnum.EXPRESSION, // 连接类型
|
|
311
|
-
// });
|
|
312
267
|
setIsNext(false);
|
|
313
|
-
// setCondition('');
|
|
314
|
-
// setFormula({});
|
|
315
|
-
// setRhsVal([
|
|
316
|
-
// {
|
|
317
|
-
// val: '',
|
|
318
|
-
// type: AtomsTypeEnum.INPUT,
|
|
319
|
-
// },
|
|
320
|
-
// ]);
|
|
321
268
|
}
|
|
322
269
|
function getData(data) {
|
|
323
270
|
var _data$database_type = data.database_type,
|
|
@@ -444,7 +391,6 @@ var SelectFilterColumn = function SelectFilterColumn(_ref) {
|
|
|
444
391
|
value: firstVal || '',
|
|
445
392
|
onInput: function onInput(e) {
|
|
446
393
|
var newVal = rhsVal.slice();
|
|
447
|
-
// (newVal as AtomsStringList[])[0].val[0] = e.target.value;
|
|
448
394
|
newVal[0].val = e.target.value;
|
|
449
395
|
setRhsVal(newVal);
|
|
450
396
|
}
|
|
@@ -472,7 +418,6 @@ var SelectFilterColumn = function SelectFilterColumn(_ref) {
|
|
|
472
418
|
onChange: function onChange(key) {
|
|
473
419
|
var newVal = rhsVal.slice();
|
|
474
420
|
newVal[1].val = key;
|
|
475
|
-
// (newVal as AtomsStringList[])[0].val[1] = key;
|
|
476
421
|
setRhsVal(newVal);
|
|
477
422
|
},
|
|
478
423
|
children: _jsxs(Button, {
|
|
@@ -582,7 +527,6 @@ var SelectFilterColumn = function SelectFilterColumn(_ref) {
|
|
|
582
527
|
visible: false
|
|
583
528
|
});
|
|
584
529
|
}
|
|
585
|
-
// 选择变量
|
|
586
530
|
var selectConstant = function selectConstant(e) {
|
|
587
531
|
store.setClosable(false);
|
|
588
532
|
var node = e.currentTarget;
|
|
@@ -596,7 +540,6 @@ var SelectFilterColumn = function SelectFilterColumn(_ref) {
|
|
|
596
540
|
list: store.constantList || [],
|
|
597
541
|
onChange: function onChange(val) {
|
|
598
542
|
closePopup2();
|
|
599
|
-
// let curObj = store.constantList.filter((v: any) => v.value === val)[0];
|
|
600
543
|
var newVal = rhsVal.slice();
|
|
601
544
|
newVal[0].id = val;
|
|
602
545
|
newVal[0].val = getConstantLabel(store.constantList, val);
|
|
@@ -635,29 +578,17 @@ var SelectFilterColumn = function SelectFilterColumn(_ref) {
|
|
|
635
578
|
if (type === AtomsTypeEnum.FIELD) {
|
|
636
579
|
setRhsVal([{
|
|
637
580
|
fieldName: '',
|
|
638
|
-
// 字段名
|
|
639
581
|
fieldNameZh: '',
|
|
640
|
-
// 字段中文名
|
|
641
582
|
fieldAlias: '',
|
|
642
|
-
// 别名
|
|
643
583
|
fieldUuid: '',
|
|
644
|
-
// uuid
|
|
645
584
|
fieldId: '',
|
|
646
|
-
// 字段id
|
|
647
|
-
// quotes?: string; // 字段展示的 不知道有没有用
|
|
648
585
|
tableName: '',
|
|
649
|
-
// 表名
|
|
650
586
|
tableNameZh: '',
|
|
651
587
|
tableId: '',
|
|
652
|
-
// 表名
|
|
653
588
|
tableAlias: '',
|
|
654
|
-
// 别名
|
|
655
589
|
tableUuid: '',
|
|
656
|
-
// 表唯一标识
|
|
657
590
|
datasourceName: '',
|
|
658
|
-
// 数据源名
|
|
659
591
|
datasourceId: '',
|
|
660
|
-
// 数据源id
|
|
661
592
|
type: AtomsTypeEnum.FIELD
|
|
662
593
|
}]);
|
|
663
594
|
}
|
|
@@ -690,7 +621,6 @@ var SelectFilterColumn = function SelectFilterColumn(_ref) {
|
|
|
690
621
|
onSelect: function onSelect(fields, quotes) {
|
|
691
622
|
var newR = _toConsumableArray(rhsVal);
|
|
692
623
|
newR = fields;
|
|
693
|
-
// (newR[_index] as AtomsField).quotes = quotes;
|
|
694
624
|
setRhsVal(newR);
|
|
695
625
|
store.setPopup2({
|
|
696
626
|
visible: false
|
|
@@ -701,7 +631,6 @@ var SelectFilterColumn = function SelectFilterColumn(_ref) {
|
|
|
701
631
|
});
|
|
702
632
|
};
|
|
703
633
|
if (isNext) {
|
|
704
|
-
// SQL_GROUP_TYPE
|
|
705
634
|
var _getData = getData(curColumn),
|
|
706
635
|
fieldType = _getData.type,
|
|
707
636
|
conditions = _getData.conditions;
|
|
@@ -944,19 +873,10 @@ var SelectFilterColumn = function SelectFilterColumn(_ref) {
|
|
|
944
873
|
setIsNext(true);
|
|
945
874
|
},
|
|
946
875
|
onSelect: function onSelect(fields, quotes) {
|
|
947
|
-
// const { columns, ...other } = tableInfo;
|
|
948
876
|
setCurColumn(_objectSpread(_objectSpread({}, curColumn), {}, {
|
|
949
877
|
lhs: fields
|
|
950
878
|
}));
|
|
951
879
|
setIsNext(true);
|
|
952
|
-
// setCurColumn(record);
|
|
953
|
-
/**
|
|
954
|
-
* 这里默认帮用户选好一部分数据
|
|
955
|
-
* 不至于让用户每一个都自己选、
|
|
956
|
-
* 比如说:条件字段 默认我们帮他选好第一个...
|
|
957
|
-
*/
|
|
958
|
-
// let { conditions } = getData(curColumn);
|
|
959
|
-
// setDefaultVal(conditions[0]);
|
|
960
880
|
}
|
|
961
881
|
})
|
|
962
882
|
});
|
|
@@ -14,7 +14,6 @@ import ItemName from '../../modules/components/item-name';
|
|
|
14
14
|
import { __ } from '../../../locale';
|
|
15
15
|
import { getTemArgs, getObjTem, getParamActions, getQuotes, formulaName, formulaIsError } from './utils';
|
|
16
16
|
import Styled from 'styled-components';
|
|
17
|
-
// import { OptionsTypeEnum, customTypes, otherList, operatorList, functionList } from './enum';
|
|
18
17
|
import { AtomsTypeEnum, FormulaTypeEnum } from '../../../store/types';
|
|
19
18
|
import { Select, Button } from '@gingkoo/pandora';
|
|
20
19
|
import cloneDeep from 'lodash/cloneDeep';
|
|
@@ -37,9 +36,6 @@ var CaseEditor = React.forwardRef(function (props, ref) {
|
|
|
37
36
|
_useState2 = _slicedToArray(_useState, 2),
|
|
38
37
|
fun = _useState2[0],
|
|
39
38
|
setFun = _useState2[1];
|
|
40
|
-
// const [formulaList, setFunctionList] = useState<{ [params: string]: FormulaTemplatesItem }>(
|
|
41
|
-
// getObjTem(store.formulaTemplates),
|
|
42
|
-
// );
|
|
43
39
|
var formulaList = useMemo(function () {
|
|
44
40
|
return getObjTem(store.formulaTemplates);
|
|
45
41
|
}, [store.formulaTemplates]);
|
|
@@ -74,26 +70,12 @@ var CaseEditor = React.forwardRef(function (props, ref) {
|
|
|
74
70
|
});
|
|
75
71
|
}, [currentFormulaKey, currentFormulaTemplate, effectiveArity]);
|
|
76
72
|
var _ref = useRef(null);
|
|
77
|
-
// EXPRESSION = 'expression', // 表达式
|
|
78
|
-
// // FUNCTION = 'function', // 函数
|
|
79
|
-
// INPUT_STRING = 'inputString', // 字符串输入框
|
|
80
|
-
// INPUT_STRING_LIST = 'inputStringList', // 字符串输入框
|
|
81
|
-
// INPUT_NUMBER_LIST = 'inputNumberList', // 数字输入框
|
|
82
|
-
// INPUT_NUMBER = 'inputNumber', // 数字输入框
|
|
83
|
-
// CONSTANT = 'constant', // 常量
|
|
84
|
-
// OPERATOR = 'operator', // 运算符
|
|
85
|
-
// UNKNOWN = 'unknown', //未选具体类型
|
|
86
|
-
// FORMULA = 'FORMULA',
|
|
87
|
-
// COLLECTION = 'collection',
|
|
88
|
-
// 提交按钮是否可用
|
|
89
73
|
var usable = useMemo(function () {
|
|
90
74
|
return fun.name && isOk(fun.args);
|
|
91
75
|
}, [fun]);
|
|
92
|
-
// 取消
|
|
93
76
|
var _onClose = function _onClose() {
|
|
94
77
|
onCancel === null || onCancel === void 0 || onCancel();
|
|
95
78
|
};
|
|
96
|
-
// 确定
|
|
97
79
|
var _onOk = function _onOk() {
|
|
98
80
|
typeof onOk === 'function' && (onOk === null || onOk === void 0 ? void 0 : onOk(_objectSpread(_objectSpread({}, fun), {}, {
|
|
99
81
|
arity: effectiveArity,
|
|
@@ -102,11 +84,9 @@ var CaseEditor = React.forwardRef(function (props, ref) {
|
|
|
102
84
|
quotes: getQuotes(fun, fun.args, formulaList)
|
|
103
85
|
})));
|
|
104
86
|
};
|
|
105
|
-
// 选择公式名
|
|
106
87
|
var handleFunName = function handleFunName(id) {
|
|
107
88
|
var _formulaList$id, _formulaList$id2, _formulaList$id3;
|
|
108
89
|
var isId = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
109
|
-
// formulaList?.[name].args;
|
|
110
90
|
setFun(_objectSpread(_objectSpread({}, fun), {}, {
|
|
111
91
|
args: 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),
|
|
112
92
|
arity: formulaList === null || formulaList === void 0 || (_formulaList$id2 = formulaList[id]) === null || _formulaList$id2 === void 0 ? void 0 : _formulaList$id2.arity,
|
|
@@ -182,9 +162,6 @@ var CaseEditor = React.forwardRef(function (props, ref) {
|
|
|
182
162
|
}, option.id || String(option.name + ind));
|
|
183
163
|
})
|
|
184
164
|
}, index);
|
|
185
|
-
// <Select.Option key={index} value={option.name}>
|
|
186
|
-
// {option.name}
|
|
187
|
-
// </Select.Option>
|
|
188
165
|
})
|
|
189
166
|
})
|
|
190
167
|
})
|
|
@@ -224,15 +201,8 @@ var CaseEditor = React.forwardRef(function (props, ref) {
|
|
|
224
201
|
onChange: function onChange(data, _quotes) {
|
|
225
202
|
var _args = cloneDeep(fun.args);
|
|
226
203
|
_args[i].list = data;
|
|
227
|
-
// (_args[i] as AtomsCollection).quotes = _quotes || '';
|
|
228
|
-
// const quotes = (_args as AtomsCollection[])
|
|
229
|
-
// .map((v) => {
|
|
230
|
-
// return v.quotes;
|
|
231
|
-
// })
|
|
232
|
-
// .join(' , ');
|
|
233
204
|
setFun(_objectSpread(_objectSpread({}, fun), {}, {
|
|
234
205
|
quotes: getQuotes(fun, _args, formulaList),
|
|
235
|
-
//fun.name + ' ( ' + quotes + ' ) ',
|
|
236
206
|
args: _args
|
|
237
207
|
}));
|
|
238
208
|
}
|
|
@@ -4,9 +4,6 @@ export var getObjTem = function getObjTem(arr) {
|
|
|
4
4
|
var obj = {};
|
|
5
5
|
arr === null || arr === void 0 || arr.map(function (v) {
|
|
6
6
|
v.children.map(function (vv) {
|
|
7
|
-
// if (vv.name) {
|
|
8
|
-
// obj[vv.name] = vv;
|
|
9
|
-
// }
|
|
10
7
|
if (vv.id) {
|
|
11
8
|
obj[vv.id] = vv;
|
|
12
9
|
}
|
|
@@ -25,7 +22,6 @@ export var getTemArgs = function getTemArgs(temArgs, arity) {
|
|
|
25
22
|
var minLen = (arity === null || arity === void 0 ? void 0 : arity.min) || (arity === null || arity === void 0 ? void 0 : arity.exact);
|
|
26
23
|
var temLen = _temArgs.length;
|
|
27
24
|
var len = minLen - temLen;
|
|
28
|
-
// 按最小长度添加
|
|
29
25
|
if (len > 0) {
|
|
30
26
|
Array.from({
|
|
31
27
|
length: len
|
|
@@ -48,15 +44,12 @@ export function getParamActions(params, arity) {
|
|
|
48
44
|
};
|
|
49
45
|
}
|
|
50
46
|
var effectiveMin = 'min' in arity ? arity.min : 'exact' in arity ? arity.exact : 0;
|
|
51
|
-
var effectiveMax = 'max' in arity ? arity.max : 'exact' in arity ? arity.exact
|
|
52
|
-
: Infinity;
|
|
47
|
+
var effectiveMax = 'max' in arity ? arity.max : 'exact' in arity ? arity.exact : Infinity;
|
|
53
48
|
return {
|
|
54
49
|
canAdd: len < effectiveMax,
|
|
55
|
-
|
|
56
|
-
canDel: len > effectiveMin // 大于 min 才能删
|
|
50
|
+
canDel: len > effectiveMin
|
|
57
51
|
};
|
|
58
52
|
}
|
|
59
|
-
// 获取公式名称 如果找不到 用传入的name
|
|
60
53
|
export var formulaName = function formulaName(fun, formulaList) {
|
|
61
54
|
var obj = formulaList[fun.id] || formulaList[fun.name];
|
|
62
55
|
return (obj === null || obj === void 0 ? void 0 : obj.name) || fun.name;
|
|
@@ -74,7 +67,6 @@ export var getQuotes = function getQuotes(fun, _args, formulaList) {
|
|
|
74
67
|
}).join(' ');
|
|
75
68
|
return quotes;
|
|
76
69
|
}).join(' , ');
|
|
77
|
-
// let obj = formulaList[fun.id] || formulaList[fun.name];
|
|
78
70
|
return formulaName(fun, formulaList) + ' ( ' + quotes + ' ) ';
|
|
79
71
|
};
|
|
80
72
|
export var 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;
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import cx from 'classnames';
|
|
4
|
+
import { FfPlus } from '@gingkoo/pandora-icons';
|
|
5
|
+
import { CloseIcon } from '../../icons';
|
|
6
|
+
var CaseWhenGroup = function CaseWhenGroup(_ref) {
|
|
7
|
+
var caseValueContent = _ref.caseValueContent,
|
|
8
|
+
branches = _ref.branches,
|
|
9
|
+
elseContent = _ref.elseContent,
|
|
10
|
+
onAddBranch = _ref.onAddBranch,
|
|
11
|
+
onAddElse = _ref.onAddElse,
|
|
12
|
+
onRemoveElse = _ref.onRemoveElse,
|
|
13
|
+
onDeleteCase = _ref.onDeleteCase;
|
|
14
|
+
return _jsxs("div", {
|
|
15
|
+
className: cx('Sqb-FormulaGroup', 'flow-group', 'formula-node-group'),
|
|
16
|
+
children: [_jsx("button", {
|
|
17
|
+
type: 'button',
|
|
18
|
+
className: 'Sqb-CaseRow-remove formula-node-remove',
|
|
19
|
+
onClick: onDeleteCase,
|
|
20
|
+
children: _jsx(CloseIcon, {})
|
|
21
|
+
}), _jsxs("div", {
|
|
22
|
+
className: cx('Sqb-FormulaGroup-row', 'row-case'),
|
|
23
|
+
children: [_jsx("span", {
|
|
24
|
+
className: 'Sqb-CaseKeyword keyword-case',
|
|
25
|
+
children: "case"
|
|
26
|
+
}), _jsx("div", {
|
|
27
|
+
className: 'Sqb-CaseSection Sqb-CaseSection-case',
|
|
28
|
+
children: caseValueContent
|
|
29
|
+
})]
|
|
30
|
+
}), branches.map(function (branch) {
|
|
31
|
+
return _jsx(React.Fragment, {
|
|
32
|
+
children: _jsxs("div", {
|
|
33
|
+
className: cx('Sqb-FormulaGroup-row', 'row-when'),
|
|
34
|
+
children: [_jsxs("div", {
|
|
35
|
+
className: 'Sqb-CaseSection Sqb-CaseSection-condition',
|
|
36
|
+
children: [_jsx("span", {
|
|
37
|
+
className: 'Sqb-CaseKeyword keyword-branch',
|
|
38
|
+
children: "when"
|
|
39
|
+
}), branch.whenContent]
|
|
40
|
+
}), _jsxs("div", {
|
|
41
|
+
className: 'Sqb-CaseSection Sqb-CaseSection-result',
|
|
42
|
+
children: [_jsx("span", {
|
|
43
|
+
className: 'Sqb-CaseKeyword keyword-branch',
|
|
44
|
+
children: "then"
|
|
45
|
+
}), branch.thenContent]
|
|
46
|
+
}), _jsxs("div", {
|
|
47
|
+
className: 'Sqb-CaseRow-actions when-row-actions',
|
|
48
|
+
children: [_jsx("button", {
|
|
49
|
+
type: 'button',
|
|
50
|
+
className: 'Sqb-CaseRow-add',
|
|
51
|
+
onClick: branch.onAddAfter,
|
|
52
|
+
children: _jsx(FfPlus, {})
|
|
53
|
+
}), _jsx("button", {
|
|
54
|
+
type: 'button',
|
|
55
|
+
className: 'Sqb-CaseRow-remove',
|
|
56
|
+
onClick: branch.onDelete,
|
|
57
|
+
children: _jsx(CloseIcon, {})
|
|
58
|
+
})]
|
|
59
|
+
})]
|
|
60
|
+
})
|
|
61
|
+
}, branch.key);
|
|
62
|
+
}), branches.length < 1 && _jsxs("button", {
|
|
63
|
+
type: 'button',
|
|
64
|
+
className: cx('Sqb-CaseRecover', 'recover-row', 'inline-after-case'),
|
|
65
|
+
onClick: onAddBranch,
|
|
66
|
+
children: [_jsx(FfPlus, {}), _jsx("span", {
|
|
67
|
+
children: "\u65B0\u589E when"
|
|
68
|
+
})]
|
|
69
|
+
}), elseContent && _jsxs("div", {
|
|
70
|
+
className: cx('Sqb-FormulaGroup-row', 'row-else'),
|
|
71
|
+
children: [_jsxs("div", {
|
|
72
|
+
className: 'Sqb-CaseSection Sqb-CaseSection-result',
|
|
73
|
+
children: [_jsx("span", {
|
|
74
|
+
className: 'Sqb-CaseKeyword keyword-branch',
|
|
75
|
+
children: "else"
|
|
76
|
+
}), elseContent]
|
|
77
|
+
}), _jsx("div", {
|
|
78
|
+
className: 'Sqb-CaseRow-actions when-row-actions',
|
|
79
|
+
children: _jsx("button", {
|
|
80
|
+
type: 'button',
|
|
81
|
+
className: 'Sqb-CaseRow-remove',
|
|
82
|
+
onClick: onRemoveElse,
|
|
83
|
+
children: _jsx(CloseIcon, {})
|
|
84
|
+
})
|
|
85
|
+
})]
|
|
86
|
+
}), !elseContent && _jsxs("button", {
|
|
87
|
+
type: 'button',
|
|
88
|
+
className: cx('Sqb-CaseRecover', 'recover-else-row'),
|
|
89
|
+
onClick: onAddElse,
|
|
90
|
+
children: [_jsx(FfPlus, {}), _jsx("span", {
|
|
91
|
+
children: "\u65B0\u589E else"
|
|
92
|
+
})]
|
|
93
|
+
}), _jsx("div", {
|
|
94
|
+
className: cx('Sqb-FormulaGroup-row', 'row-end'),
|
|
95
|
+
children: _jsx("span", {
|
|
96
|
+
className: 'Sqb-CaseKeyword keyword-end',
|
|
97
|
+
children: "end"
|
|
98
|
+
})
|
|
99
|
+
})]
|
|
100
|
+
});
|
|
101
|
+
};
|
|
102
|
+
export default CaseWhenGroup;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
type Props = {
|
|
3
|
+
operator: 'and' | 'or';
|
|
4
|
+
onToggleOperator: () => void;
|
|
5
|
+
content: React.ReactNode;
|
|
6
|
+
onDelete: (e: any) => void;
|
|
7
|
+
};
|
|
8
|
+
declare const LogicGroup: ({ operator, onToggleOperator, content, onDelete }: Props) => import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
export default LogicGroup;
|