@gingkoo/pandora-metabase 1.0.126 → 1.0.128
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cjs/components/dialog/expression/index.js +15 -5
- package/lib/cjs/components/dialog/expression/index.less +31 -16
- package/lib/cjs/components/dialog/formula-list/CaseWhenGroup.d.ts +14 -5
- package/lib/cjs/components/dialog/formula-list/CaseWhenGroup.js +236 -62
- package/lib/cjs/components/dialog/formula-list/LogicGroup.d.ts +3 -2
- package/lib/cjs/components/dialog/formula-list/LogicGroup.js +19 -11
- package/lib/cjs/components/dialog/formula-list/index.d.ts +1 -0
- package/lib/cjs/components/dialog/formula-list/index.js +658 -174
- package/lib/cjs/components/dialog/formula-list/index.less +1438 -145
- package/lib/cjs/components/dialog/formula-list/utils.js +50 -19
- package/lib/cjs/components/dialog/select-column-multiple/index.d.ts +1 -0
- package/lib/cjs/components/dialog/select-column-multiple/index.js +42 -22
- package/lib/cjs/components/dialog/select-summarize/index.js +10 -2
- package/lib/cjs/components/dialog/select-table/index.d.ts +2 -1
- package/lib/cjs/components/dialog/select-table/index.js +197 -52
- package/lib/cjs/components/dialog/select-table/index.less +45 -2
- package/lib/cjs/components/metabase/index.less +156 -39
- package/lib/cjs/components/modules/custom-column.js +7 -3
- package/lib/cjs/components/modules/filter.js +6 -3
- package/lib/cjs/components/modules/join-data.js +67 -16
- package/lib/cjs/components/modules/permission-table.js +8 -4
- package/lib/cjs/components/modules/sort.js +2 -1
- package/lib/cjs/components/modules/summarize/group-by.js +20 -6
- package/lib/cjs/components/modules/summarize/select-index.js +9 -5
- package/lib/cjs/components/modules/table-data.js +26 -5
- package/lib/cjs/hooks/use-state.js +143 -17
- package/lib/cjs/index.js +7 -1
- package/lib/cjs/store/types.d.ts +14 -7
- package/lib/cjs/types.d.ts +8 -0
- package/lib/cjs/utils/transformSql.js +44 -21
- package/lib/cjs/utils.d.ts +2 -2
- package/lib/cjs/utils.js +349 -58
- package/lib/es/components/dialog/expression/index.js +15 -5
- package/lib/es/components/dialog/expression/index.less +31 -16
- package/lib/es/components/dialog/formula-list/CaseWhenGroup.d.ts +14 -5
- package/lib/es/components/dialog/formula-list/CaseWhenGroup.js +238 -64
- package/lib/es/components/dialog/formula-list/LogicGroup.d.ts +3 -2
- package/lib/es/components/dialog/formula-list/LogicGroup.js +19 -11
- package/lib/es/components/dialog/formula-list/index.d.ts +1 -0
- package/lib/es/components/dialog/formula-list/index.js +660 -176
- package/lib/es/components/dialog/formula-list/index.less +1438 -145
- package/lib/es/components/dialog/formula-list/utils.js +50 -19
- package/lib/es/components/dialog/select-column-multiple/index.d.ts +1 -0
- package/lib/es/components/dialog/select-column-multiple/index.js +42 -22
- package/lib/es/components/dialog/select-summarize/index.js +10 -2
- package/lib/es/components/dialog/select-table/index.d.ts +2 -1
- package/lib/es/components/dialog/select-table/index.js +197 -52
- package/lib/es/components/dialog/select-table/index.less +45 -2
- package/lib/es/components/metabase/index.less +156 -39
- package/lib/es/components/modules/custom-column.js +7 -3
- package/lib/es/components/modules/filter.js +6 -3
- package/lib/es/components/modules/join-data.js +67 -16
- package/lib/es/components/modules/permission-table.js +8 -4
- package/lib/es/components/modules/sort.js +2 -1
- package/lib/es/components/modules/summarize/group-by.js +21 -7
- package/lib/es/components/modules/summarize/select-index.js +10 -6
- package/lib/es/components/modules/table-data.js +26 -5
- package/lib/es/hooks/use-state.js +143 -17
- package/lib/es/index.js +7 -1
- package/lib/es/store/types.d.ts +14 -7
- package/lib/es/types.d.ts +8 -0
- package/lib/es/utils/transformSql.js +45 -22
- package/lib/es/utils.d.ts +2 -2
- package/lib/es/utils.js +350 -59
- package/package.json +1 -1
|
@@ -66,27 +66,33 @@
|
|
|
66
66
|
flex: 1;
|
|
67
67
|
}
|
|
68
68
|
.operator-icon {
|
|
69
|
-
|
|
69
|
+
min-width: 28px !important;
|
|
70
|
+
height: 28px !important;
|
|
71
|
+
padding: 0 7px !important;
|
|
72
|
+
font-size: 14px !important;
|
|
70
73
|
}
|
|
71
74
|
.Sqb-TableName {
|
|
72
|
-
border:
|
|
73
|
-
border-radius:
|
|
75
|
+
border: 1px solid transparent;
|
|
76
|
+
border-radius: 5px;
|
|
74
77
|
color: white;
|
|
75
78
|
background-color: rgb(80, 158, 227);
|
|
76
79
|
transition: background 300ms linear 0s;
|
|
77
80
|
box-sizing: border-box;
|
|
78
81
|
// margin-bottom: 8px;
|
|
79
82
|
// margin-right: 8px;
|
|
80
|
-
padding:
|
|
83
|
+
padding: 4px 7px;
|
|
81
84
|
display: flex;
|
|
82
85
|
-webkit-box-align: center;
|
|
83
86
|
align-items: center;
|
|
84
87
|
cursor: pointer;
|
|
88
|
+
min-height: 28px;
|
|
89
|
+
font-size: 13px;
|
|
90
|
+
line-height: 18px;
|
|
85
91
|
&-input {
|
|
86
92
|
//输入框样式,稍微小了一点
|
|
87
|
-
margin-bottom:
|
|
88
|
-
margin-right:
|
|
89
|
-
padding:
|
|
93
|
+
margin-bottom: 6px;
|
|
94
|
+
margin-right: 6px;
|
|
95
|
+
padding: 5px 7px;
|
|
90
96
|
}
|
|
91
97
|
&::selection {
|
|
92
98
|
color: #ffffff;
|
|
@@ -103,7 +109,7 @@
|
|
|
103
109
|
}
|
|
104
110
|
}
|
|
105
111
|
&.notSelected {
|
|
106
|
-
border:
|
|
112
|
+
border: 1px solid rgba(80, 158, 227, 0.25);
|
|
107
113
|
color: rgb(80, 158, 227);
|
|
108
114
|
background-color: transparent;
|
|
109
115
|
&:hover {
|
|
@@ -118,10 +124,12 @@
|
|
|
118
124
|
}
|
|
119
125
|
svg.closeIcon {
|
|
120
126
|
opacity: 0.6;
|
|
121
|
-
margin-left:
|
|
127
|
+
margin-left: 5px;
|
|
128
|
+
width: 12px;
|
|
129
|
+
height: 12px;
|
|
122
130
|
}
|
|
123
131
|
&.notSelected {
|
|
124
|
-
border:
|
|
132
|
+
border: 1px solid rgba(113, 114, 173, 0.25);
|
|
125
133
|
color: rgb(113, 114, 173);
|
|
126
134
|
background-color: transparent;
|
|
127
135
|
&:hover {
|
|
@@ -136,11 +144,15 @@
|
|
|
136
144
|
background-color: rgba(147, 161, 171, 0.8);
|
|
137
145
|
}
|
|
138
146
|
svg.sort-arrow {
|
|
139
|
-
margin-right: 0.
|
|
147
|
+
margin-right: 0.35rem;
|
|
148
|
+
width: 12px;
|
|
149
|
+
height: 12px;
|
|
140
150
|
}
|
|
141
151
|
svg.closeIcon {
|
|
142
152
|
opacity: 0.6;
|
|
143
|
-
margin-left:
|
|
153
|
+
margin-left: 5px;
|
|
154
|
+
width: 12px;
|
|
155
|
+
height: 12px;
|
|
144
156
|
}
|
|
145
157
|
}
|
|
146
158
|
&.green-name {
|
|
@@ -151,10 +163,12 @@
|
|
|
151
163
|
}
|
|
152
164
|
svg.closeIcon {
|
|
153
165
|
opacity: 0.6;
|
|
154
|
-
margin-left:
|
|
166
|
+
margin-left: 5px;
|
|
167
|
+
width: 12px;
|
|
168
|
+
height: 12px;
|
|
155
169
|
}
|
|
156
170
|
&.notSelected {
|
|
157
|
-
border:
|
|
171
|
+
border: 1px solid rgba(136, 191, 77, 0.25);
|
|
158
172
|
color: rgb(136, 191, 77);
|
|
159
173
|
background-color: transparent;
|
|
160
174
|
&:hover {
|
|
@@ -221,11 +235,12 @@
|
|
|
221
235
|
}
|
|
222
236
|
|
|
223
237
|
.operator-btn {
|
|
224
|
-
height:
|
|
225
|
-
padding: 8px !important;
|
|
238
|
+
height: 32px !important;
|
|
239
|
+
padding: 4px 8px !important;
|
|
226
240
|
text-align: left !important;
|
|
227
241
|
display: flex !important;
|
|
228
242
|
align-items: center !important;
|
|
243
|
+
font-size: 13px !important;
|
|
229
244
|
& > .pd-Icon {
|
|
230
245
|
margin-left: auto !important;
|
|
231
246
|
}
|
|
@@ -1,19 +1,28 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
export type
|
|
2
|
+
export type CaseWhenClauseView = {
|
|
3
3
|
key: string;
|
|
4
4
|
whenContent: React.ReactNode;
|
|
5
5
|
thenContent: React.ReactNode;
|
|
6
|
+
canDelete?: boolean;
|
|
6
7
|
onAddAfter: (e: any) => void;
|
|
7
8
|
onDelete: (e: any) => void;
|
|
8
9
|
};
|
|
9
10
|
type Props = {
|
|
10
|
-
|
|
11
|
-
|
|
11
|
+
caseAtomsContent: React.ReactNode;
|
|
12
|
+
whenClauses: CaseWhenClauseView[];
|
|
12
13
|
elseContent?: React.ReactNode;
|
|
13
14
|
onAddBranch: (e: any) => void;
|
|
14
15
|
onAddElse: (e: any) => void;
|
|
15
16
|
onRemoveElse: (e: any) => void;
|
|
16
|
-
|
|
17
|
+
onZoomCase?: (e: any) => void;
|
|
18
|
+
onDeleteCase?: (e: any) => void;
|
|
19
|
+
showTools?: boolean;
|
|
20
|
+
isNested?: boolean;
|
|
21
|
+
useBranchScrollInner?: boolean;
|
|
22
|
+
caseRegionKey?: string;
|
|
23
|
+
elseRegionKey?: string;
|
|
24
|
+
activeRegionKey?: string | null;
|
|
25
|
+
onActivateRegion?: (key: string) => void;
|
|
17
26
|
};
|
|
18
|
-
declare const CaseWhenGroup: ({
|
|
27
|
+
declare const CaseWhenGroup: ({ caseAtomsContent, whenClauses, elseContent, onAddBranch, onAddElse, onRemoveElse, onZoomCase, onDeleteCase, showTools, isNested, useBranchScrollInner, caseRegionKey, elseRegionKey, activeRegionKey, onActivateRegion, }: Props) => import("react/jsx-runtime").JSX.Element;
|
|
19
28
|
export default CaseWhenGroup;
|
|
@@ -1,95 +1,269 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
1
|
+
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
3
|
import cx from 'classnames';
|
|
4
|
-
import {
|
|
4
|
+
import { Tooltip } from '@gingkoo/pandora';
|
|
5
|
+
import { FfPlus, FullscreenOExpand } from '@gingkoo/pandora-icons';
|
|
5
6
|
import { CloseIcon } from '../../icons';
|
|
7
|
+
var CASE_ICON_SIZE = 10;
|
|
8
|
+
var caseButtonBaseStyle = {
|
|
9
|
+
display: 'inline-flex',
|
|
10
|
+
alignItems: 'center',
|
|
11
|
+
justifyContent: 'center',
|
|
12
|
+
flex: '0 0 auto',
|
|
13
|
+
width: 20,
|
|
14
|
+
minWidth: 20,
|
|
15
|
+
height: 20,
|
|
16
|
+
margin: 0,
|
|
17
|
+
padding: 0,
|
|
18
|
+
border: '1px solid transparent',
|
|
19
|
+
borderRadius: 6,
|
|
20
|
+
cursor: 'pointer',
|
|
21
|
+
lineHeight: 0,
|
|
22
|
+
boxShadow: '0 1px 2px rgba(83, 92, 112, 0.08)'
|
|
23
|
+
};
|
|
24
|
+
var addButtonStyle = _objectSpread(_objectSpread({}, caseButtonBaseStyle), {}, {
|
|
25
|
+
borderColor: 'rgba(80, 158, 227, 0.28)',
|
|
26
|
+
background: 'rgba(80, 158, 227, 0.12)',
|
|
27
|
+
color: 'rgb(80, 158, 227)'
|
|
28
|
+
});
|
|
29
|
+
var removeButtonStyle = _objectSpread(_objectSpread({}, caseButtonBaseStyle), {}, {
|
|
30
|
+
borderColor: 'rgba(245, 63, 63, 0.2)',
|
|
31
|
+
background: 'rgba(245, 63, 63, 0.06)',
|
|
32
|
+
color: 'rgba(220, 38, 38, 0.72)'
|
|
33
|
+
});
|
|
34
|
+
var removeDisabledButtonStyle = _objectSpread(_objectSpread({}, removeButtonStyle), {}, {
|
|
35
|
+
cursor: 'not-allowed',
|
|
36
|
+
opacity: 0.4,
|
|
37
|
+
boxShadow: 'none'
|
|
38
|
+
});
|
|
39
|
+
var zoomButtonStyle = _objectSpread(_objectSpread({}, caseButtonBaseStyle), {}, {
|
|
40
|
+
border: 'none',
|
|
41
|
+
borderRadius: 999,
|
|
42
|
+
background: 'transparent',
|
|
43
|
+
color: 'rgba(83, 92, 112, 0.58)',
|
|
44
|
+
boxShadow: 'none'
|
|
45
|
+
});
|
|
46
|
+
var recoverButtonStyle = {
|
|
47
|
+
display: 'inline-flex',
|
|
48
|
+
alignItems: 'center',
|
|
49
|
+
gap: 4,
|
|
50
|
+
minHeight: 22,
|
|
51
|
+
margin: 0,
|
|
52
|
+
padding: '0 7px',
|
|
53
|
+
border: '1px dashed rgba(80, 158, 227, 0.35)',
|
|
54
|
+
borderRadius: 7,
|
|
55
|
+
background: 'rgba(80, 158, 227, 0.06)',
|
|
56
|
+
color: 'rgb(80, 158, 227)',
|
|
57
|
+
cursor: 'pointer',
|
|
58
|
+
fontSize: 11,
|
|
59
|
+
lineHeight: 1
|
|
60
|
+
};
|
|
6
61
|
var CaseWhenGroup = function CaseWhenGroup(_ref) {
|
|
7
|
-
var
|
|
8
|
-
|
|
62
|
+
var caseAtomsContent = _ref.caseAtomsContent,
|
|
63
|
+
whenClauses = _ref.whenClauses,
|
|
9
64
|
elseContent = _ref.elseContent,
|
|
10
65
|
onAddBranch = _ref.onAddBranch,
|
|
11
66
|
onAddElse = _ref.onAddElse,
|
|
12
67
|
onRemoveElse = _ref.onRemoveElse,
|
|
13
|
-
|
|
68
|
+
onZoomCase = _ref.onZoomCase,
|
|
69
|
+
onDeleteCase = _ref.onDeleteCase,
|
|
70
|
+
_ref$showTools = _ref.showTools,
|
|
71
|
+
showTools = _ref$showTools === void 0 ? true : _ref$showTools,
|
|
72
|
+
_ref$isNested = _ref.isNested,
|
|
73
|
+
isNested = _ref$isNested === void 0 ? false : _ref$isNested,
|
|
74
|
+
_ref$useBranchScrollI = _ref.useBranchScrollInner,
|
|
75
|
+
useBranchScrollInner = _ref$useBranchScrollI === void 0 ? false : _ref$useBranchScrollI,
|
|
76
|
+
_ref$caseRegionKey = _ref.caseRegionKey,
|
|
77
|
+
caseRegionKey = _ref$caseRegionKey === void 0 ? 'case' : _ref$caseRegionKey,
|
|
78
|
+
_ref$elseRegionKey = _ref.elseRegionKey,
|
|
79
|
+
elseRegionKey = _ref$elseRegionKey === void 0 ? 'else' : _ref$elseRegionKey,
|
|
80
|
+
activeRegionKey = _ref.activeRegionKey,
|
|
81
|
+
onActivateRegion = _ref.onActivateRegion;
|
|
82
|
+
var renderBranchContent = function renderBranchContent(children) {
|
|
83
|
+
if (isNested || !useBranchScrollInner) return children;
|
|
84
|
+
return _jsx("div", {
|
|
85
|
+
className: 'Sqb-CaseBranch-scrollInner',
|
|
86
|
+
children: children
|
|
87
|
+
});
|
|
88
|
+
};
|
|
89
|
+
var getRegionClassName = function getRegionClassName(regionKey) {
|
|
90
|
+
for (var _len = arguments.length, classNames = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
91
|
+
classNames[_key - 1] = arguments[_key];
|
|
92
|
+
}
|
|
93
|
+
return cx.apply(void 0, ['Sqb-FormulaGroup-row'].concat(classNames, [{
|
|
94
|
+
'Sqb-CaseRegion--active': activeRegionKey === regionKey
|
|
95
|
+
}]));
|
|
96
|
+
};
|
|
97
|
+
var handleActivateRegion = function handleActivateRegion(e, regionKey) {
|
|
98
|
+
var _target$closest;
|
|
99
|
+
var target = e.target;
|
|
100
|
+
var currentRegion = target === null || target === void 0 || (_target$closest = target.closest) === null || _target$closest === void 0 ? void 0 : _target$closest.call(target, '.Sqb-FormulaGroup-row');
|
|
101
|
+
if (currentRegion !== e.currentTarget) return;
|
|
102
|
+
onActivateRegion === null || onActivateRegion === void 0 || onActivateRegion(regionKey);
|
|
103
|
+
};
|
|
14
104
|
return _jsxs("div", {
|
|
15
|
-
className: cx('Sqb-FormulaGroup', 'flow-group', 'formula-node-group'
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
children: _jsx(
|
|
105
|
+
className: cx('Sqb-FormulaGroup', 'flow-group', 'formula-node-group', 'Sqb-CaseWhenGroup', {
|
|
106
|
+
'Sqb-CaseWhenGroup--nested': isNested
|
|
107
|
+
}),
|
|
108
|
+
children: [showTools && _jsxs("div", {
|
|
109
|
+
className: 'Sqb-CaseWhenTools',
|
|
110
|
+
children: [onZoomCase && _jsx(Tooltip, {
|
|
111
|
+
title: "\u7F16\u8F91 caseWhen",
|
|
112
|
+
children: _jsx("button", {
|
|
113
|
+
type: 'button',
|
|
114
|
+
className: 'Sqb-CaseRow-zoom formula-node-tool',
|
|
115
|
+
style: zoomButtonStyle,
|
|
116
|
+
onClick: onZoomCase,
|
|
117
|
+
children: _jsx(FullscreenOExpand, {})
|
|
118
|
+
})
|
|
119
|
+
}), onDeleteCase && _jsx(Tooltip, {
|
|
120
|
+
title: "\u5220\u9664 caseWhen",
|
|
121
|
+
children: _jsx("button", {
|
|
122
|
+
type: 'button',
|
|
123
|
+
className: 'Sqb-CaseRow-remove formula-node-remove',
|
|
124
|
+
style: removeButtonStyle,
|
|
125
|
+
onClick: onDeleteCase,
|
|
126
|
+
children: _jsx(CloseIcon, {
|
|
127
|
+
width: CASE_ICON_SIZE,
|
|
128
|
+
height: CASE_ICON_SIZE
|
|
129
|
+
})
|
|
130
|
+
})
|
|
131
|
+
})]
|
|
21
132
|
}), _jsxs("div", {
|
|
22
|
-
className:
|
|
133
|
+
className: getRegionClassName(caseRegionKey, 'row-case'),
|
|
134
|
+
onMouseDown: function onMouseDown(e) {
|
|
135
|
+
return handleActivateRegion(e, caseRegionKey);
|
|
136
|
+
},
|
|
23
137
|
children: [_jsx("span", {
|
|
24
138
|
className: 'Sqb-CaseKeyword keyword-case',
|
|
25
139
|
children: "case"
|
|
26
140
|
}), _jsx("div", {
|
|
27
141
|
className: 'Sqb-CaseSection Sqb-CaseSection-case',
|
|
28
|
-
children:
|
|
142
|
+
children: _jsx("div", {
|
|
143
|
+
className: 'Sqb-CaseSection-content',
|
|
144
|
+
children: caseAtomsContent
|
|
145
|
+
})
|
|
29
146
|
})]
|
|
30
|
-
}),
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
147
|
+
}), whenClauses.map(function (branch, branchIndex) {
|
|
148
|
+
var canDeleteBranch = branch.canDelete !== false;
|
|
149
|
+
return _jsxs("div", {
|
|
150
|
+
className: getRegionClassName(branch.key, 'row-when'),
|
|
151
|
+
onMouseDown: function onMouseDown(e) {
|
|
152
|
+
return handleActivateRegion(e, branch.key);
|
|
153
|
+
},
|
|
154
|
+
children: [_jsx("span", {
|
|
155
|
+
className: 'Sqb-CaseBranchIndex',
|
|
156
|
+
children: branchIndex + 1
|
|
157
|
+
}), _jsx("div", {
|
|
158
|
+
className: 'Sqb-CaseBranch-body',
|
|
159
|
+
children: renderBranchContent(_jsxs(_Fragment, {
|
|
160
|
+
children: [_jsxs("div", {
|
|
161
|
+
className: 'Sqb-CaseSection Sqb-CaseSection-condition',
|
|
162
|
+
children: [_jsx("span", {
|
|
163
|
+
className: 'Sqb-CaseKeyword keyword-branch keyword-when',
|
|
164
|
+
children: "when"
|
|
165
|
+
}), _jsx("div", {
|
|
166
|
+
className: 'Sqb-CaseSection-content Sqb-CaseSection-content--wrap',
|
|
167
|
+
children: branch.whenContent
|
|
168
|
+
})]
|
|
169
|
+
}), _jsxs("div", {
|
|
170
|
+
className: 'Sqb-CaseSection Sqb-CaseSection-result',
|
|
171
|
+
children: [_jsx("span", {
|
|
172
|
+
className: 'Sqb-CaseKeyword keyword-branch keyword-then',
|
|
173
|
+
children: "then"
|
|
174
|
+
}), _jsx("div", {
|
|
175
|
+
className: 'Sqb-CaseSection-content Sqb-CaseSection-content--wrap',
|
|
176
|
+
children: branch.thenContent
|
|
177
|
+
})]
|
|
178
|
+
})]
|
|
179
|
+
}))
|
|
180
|
+
}), _jsxs("div", {
|
|
181
|
+
className: 'Sqb-CaseRow-actions when-row-actions',
|
|
182
|
+
children: [_jsx(Tooltip, {
|
|
183
|
+
title: "\u65B0\u589E when",
|
|
184
|
+
children: _jsx("button", {
|
|
49
185
|
type: 'button',
|
|
50
186
|
className: 'Sqb-CaseRow-add',
|
|
187
|
+
style: addButtonStyle,
|
|
51
188
|
onClick: branch.onAddAfter,
|
|
52
189
|
children: _jsx(FfPlus, {})
|
|
53
|
-
})
|
|
190
|
+
})
|
|
191
|
+
}), _jsx(Tooltip, {
|
|
192
|
+
title: canDeleteBranch ? '删除 when' : '至少保留一个 when / then',
|
|
193
|
+
children: _jsx("button", {
|
|
54
194
|
type: 'button',
|
|
55
|
-
className: 'Sqb-CaseRow-remove',
|
|
195
|
+
className: cx('Sqb-CaseRow-remove', {
|
|
196
|
+
disabled: !canDeleteBranch
|
|
197
|
+
}),
|
|
198
|
+
disabled: !canDeleteBranch,
|
|
199
|
+
style: canDeleteBranch ? removeButtonStyle : removeDisabledButtonStyle,
|
|
56
200
|
onClick: branch.onDelete,
|
|
57
|
-
children: _jsx(CloseIcon, {
|
|
58
|
-
|
|
201
|
+
children: _jsx(CloseIcon, {
|
|
202
|
+
width: CASE_ICON_SIZE,
|
|
203
|
+
height: CASE_ICON_SIZE
|
|
204
|
+
})
|
|
205
|
+
})
|
|
59
206
|
})]
|
|
60
|
-
})
|
|
207
|
+
})]
|
|
61
208
|
}, branch.key);
|
|
62
|
-
}),
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
209
|
+
}), whenClauses.length < 1 && _jsx(Tooltip, {
|
|
210
|
+
title: "\u65B0\u589E when",
|
|
211
|
+
children: _jsxs("button", {
|
|
212
|
+
type: 'button',
|
|
213
|
+
className: cx('Sqb-CaseRecover', 'recover-row', 'inline-after-case'),
|
|
214
|
+
style: recoverButtonStyle,
|
|
215
|
+
onClick: onAddBranch,
|
|
216
|
+
children: [_jsx(FfPlus, {}), _jsx("span", {
|
|
217
|
+
children: "\u65B0\u589E when"
|
|
218
|
+
})]
|
|
219
|
+
})
|
|
69
220
|
}), elseContent && _jsxs("div", {
|
|
70
|
-
className:
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
221
|
+
className: getRegionClassName(elseRegionKey, 'row-else'),
|
|
222
|
+
onMouseDown: function onMouseDown(e) {
|
|
223
|
+
return handleActivateRegion(e, elseRegionKey);
|
|
224
|
+
},
|
|
225
|
+
children: [_jsx("span", {
|
|
226
|
+
className: 'Sqb-CaseBranchIndex Sqb-CaseBranchIndex--else',
|
|
227
|
+
"aria-hidden": 'true'
|
|
228
|
+
}), _jsx("div", {
|
|
229
|
+
className: 'Sqb-CaseBranch-body',
|
|
230
|
+
children: renderBranchContent(_jsxs("div", {
|
|
231
|
+
className: 'Sqb-CaseSection Sqb-CaseSection-result Sqb-CaseSection-else',
|
|
232
|
+
children: [_jsx("span", {
|
|
233
|
+
className: 'Sqb-CaseKeyword keyword-branch keyword-else',
|
|
234
|
+
children: "else"
|
|
235
|
+
}), _jsx("div", {
|
|
236
|
+
className: 'Sqb-CaseSection-content Sqb-CaseSection-content--wrap',
|
|
237
|
+
children: elseContent
|
|
238
|
+
})]
|
|
239
|
+
}))
|
|
77
240
|
}), _jsx("div", {
|
|
78
241
|
className: 'Sqb-CaseRow-actions when-row-actions',
|
|
79
|
-
children: _jsx(
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
242
|
+
children: _jsx(Tooltip, {
|
|
243
|
+
title: "\u5220\u9664 else",
|
|
244
|
+
children: _jsx("button", {
|
|
245
|
+
type: 'button',
|
|
246
|
+
className: 'Sqb-CaseRow-remove',
|
|
247
|
+
style: removeButtonStyle,
|
|
248
|
+
onClick: onRemoveElse,
|
|
249
|
+
children: _jsx(CloseIcon, {
|
|
250
|
+
width: CASE_ICON_SIZE,
|
|
251
|
+
height: CASE_ICON_SIZE
|
|
252
|
+
})
|
|
253
|
+
})
|
|
84
254
|
})
|
|
85
255
|
})]
|
|
86
|
-
}), !elseContent &&
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
256
|
+
}), !elseContent && _jsx(Tooltip, {
|
|
257
|
+
title: "\u65B0\u589E else",
|
|
258
|
+
children: _jsxs("button", {
|
|
259
|
+
type: 'button',
|
|
260
|
+
className: cx('Sqb-CaseRecover', 'recover-else-row'),
|
|
261
|
+
style: recoverButtonStyle,
|
|
262
|
+
onClick: onAddElse,
|
|
263
|
+
children: [_jsx(FfPlus, {}), _jsx("span", {
|
|
264
|
+
children: "\u65B0\u589E else"
|
|
265
|
+
})]
|
|
266
|
+
})
|
|
93
267
|
}), _jsx("div", {
|
|
94
268
|
className: cx('Sqb-FormulaGroup-row', 'row-end'),
|
|
95
269
|
children: _jsx("span", {
|
|
@@ -2,8 +2,9 @@ import React from 'react';
|
|
|
2
2
|
type Props = {
|
|
3
3
|
operator: 'and' | 'or';
|
|
4
4
|
onToggleOperator: () => void;
|
|
5
|
-
|
|
5
|
+
leftContent: React.ReactNode;
|
|
6
|
+
rightContent: React.ReactNode;
|
|
6
7
|
onDelete: (e: any) => void;
|
|
7
8
|
};
|
|
8
|
-
declare const LogicGroup: ({ operator, onToggleOperator,
|
|
9
|
+
declare const LogicGroup: ({ operator, onToggleOperator, leftContent, rightContent, onDelete, }: Props) => import("react/jsx-runtime").JSX.Element;
|
|
9
10
|
export default LogicGroup;
|
|
@@ -1,14 +1,22 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import cx from 'classnames';
|
|
3
|
+
import { Tooltip } from '@gingkoo/pandora';
|
|
3
4
|
import { CloseIcon } from '../../icons';
|
|
4
5
|
var LogicGroup = function LogicGroup(_ref) {
|
|
5
6
|
var operator = _ref.operator,
|
|
6
7
|
onToggleOperator = _ref.onToggleOperator,
|
|
7
|
-
|
|
8
|
+
leftContent = _ref.leftContent,
|
|
9
|
+
rightContent = _ref.rightContent,
|
|
8
10
|
onDelete = _ref.onDelete;
|
|
9
11
|
return _jsxs("div", {
|
|
10
12
|
className: cx('Sqb-FormulaGroup', 'logic-group', 'formula-node-group'),
|
|
11
|
-
children: [_jsx("
|
|
13
|
+
children: [_jsx("span", {
|
|
14
|
+
className: 'Sqb-CaseKeyword',
|
|
15
|
+
children: "("
|
|
16
|
+
}), _jsx("div", {
|
|
17
|
+
className: 'Sqb-LogicGroup-content',
|
|
18
|
+
children: leftContent
|
|
19
|
+
}), _jsx("button", {
|
|
12
20
|
type: 'button',
|
|
13
21
|
className: cx('Sqb-TableName', 'operator-trigger', 'logic-operator', {
|
|
14
22
|
'logic-and': operator === 'and',
|
|
@@ -16,20 +24,20 @@ var LogicGroup = function LogicGroup(_ref) {
|
|
|
16
24
|
}),
|
|
17
25
|
onClick: onToggleOperator,
|
|
18
26
|
children: operator
|
|
19
|
-
}), _jsx("span", {
|
|
20
|
-
className: 'Sqb-CaseKeyword',
|
|
21
|
-
children: "("
|
|
22
27
|
}), _jsx("div", {
|
|
23
28
|
className: 'Sqb-LogicGroup-content',
|
|
24
|
-
children:
|
|
29
|
+
children: rightContent
|
|
25
30
|
}), _jsx("span", {
|
|
26
31
|
className: 'Sqb-CaseKeyword',
|
|
27
32
|
children: ")"
|
|
28
|
-
}), _jsx(
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
+
}), _jsx(Tooltip, {
|
|
34
|
+
title: "\u5220\u9664 and/or",
|
|
35
|
+
children: _jsx("button", {
|
|
36
|
+
type: 'button',
|
|
37
|
+
className: 'Sqb-CaseRow-remove formula-node-remove',
|
|
38
|
+
onClick: onDelete,
|
|
39
|
+
children: _jsx(CloseIcon, {})
|
|
40
|
+
})
|
|
33
41
|
})]
|
|
34
42
|
});
|
|
35
43
|
};
|
|
@@ -15,6 +15,7 @@ interface PropsType {
|
|
|
15
15
|
_type?: string;
|
|
16
16
|
embedded?: boolean;
|
|
17
17
|
enableCopy?: boolean;
|
|
18
|
+
enableZoom?: boolean;
|
|
18
19
|
parentPopupChannel?: 'primary' | 'secondary';
|
|
19
20
|
}
|
|
20
21
|
declare const FormulaList: React.ForwardRefExoticComponent<PropsType & React.RefAttributes<unknown>>;
|