@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
|
@@ -18,6 +18,7 @@ var _classnames = _interopRequireDefault(require("classnames"));
|
|
|
18
18
|
var _dayjs = _interopRequireDefault(require("dayjs"));
|
|
19
19
|
var _locale = require("../../../locale");
|
|
20
20
|
var _enum = require("../../../store/enum");
|
|
21
|
+
var _helper = require("../../../store/helper");
|
|
21
22
|
var _types = require("../../../store/types");
|
|
22
23
|
var _const = require("../const");
|
|
23
24
|
var _selectList = _interopRequireDefault(require("../select-list"));
|
|
@@ -117,6 +118,13 @@ var SelectFilterColumn = function SelectFilterColumn(_ref) {
|
|
|
117
118
|
return popupContainer || document.body;
|
|
118
119
|
};
|
|
119
120
|
var table2Selected = Boolean(rhsVal && (rhsVal === null || rhsVal === void 0 ? void 0 : rhsVal.length) > 0);
|
|
121
|
+
function getFieldDisplayName(field) {
|
|
122
|
+
if (!field) return '';
|
|
123
|
+
if (field.tableId === _helper.SummarizeAlias) {
|
|
124
|
+
return field.fieldAlias || field.fieldName || '';
|
|
125
|
+
}
|
|
126
|
+
return field.fieldName || field.fieldAlias || '';
|
|
127
|
+
}
|
|
120
128
|
var disabled = (0, _react.useMemo)(function () {
|
|
121
129
|
if (!condition) return true;
|
|
122
130
|
if (~['无需结果'].indexOf(condition)) {
|
|
@@ -135,7 +143,7 @@ var SelectFilterColumn = function SelectFilterColumn(_ref) {
|
|
|
135
143
|
});
|
|
136
144
|
}
|
|
137
145
|
if (v.type === _types.AtomsTypeEnum.FIELD) {
|
|
138
|
-
return v
|
|
146
|
+
return getFieldDisplayName(v);
|
|
139
147
|
}
|
|
140
148
|
});
|
|
141
149
|
return !isOk;
|
|
@@ -147,7 +155,7 @@ var SelectFilterColumn = function SelectFilterColumn(_ref) {
|
|
|
147
155
|
var getAtomsQuotesName = function getAtomsQuotesName(items) {
|
|
148
156
|
var names = items.map(function (v) {
|
|
149
157
|
if ((v === null || v === void 0 ? void 0 : v.type) === _types.AtomsTypeEnum.FIELD) {
|
|
150
|
-
return v
|
|
158
|
+
return getFieldDisplayName(v);
|
|
151
159
|
} else {
|
|
152
160
|
return v.val;
|
|
153
161
|
}
|
|
@@ -636,6 +644,7 @@ var SelectFilterColumn = function SelectFilterColumn(_ref) {
|
|
|
636
644
|
tableUuid: '',
|
|
637
645
|
datasourceName: '',
|
|
638
646
|
datasourceId: '',
|
|
647
|
+
datasourceType: '',
|
|
639
648
|
type: _types.AtomsTypeEnum.FIELD
|
|
640
649
|
}]);
|
|
641
650
|
}
|
|
@@ -694,7 +703,7 @@ var SelectFilterColumn = function SelectFilterColumn(_ref) {
|
|
|
694
703
|
curColumn.lhs.filter(function (v) {
|
|
695
704
|
return v.type === _types.AtomsTypeEnum.FIELD;
|
|
696
705
|
}).map(function (v) {
|
|
697
|
-
names.push(v
|
|
706
|
+
names.push(getFieldDisplayName(v));
|
|
698
707
|
});
|
|
699
708
|
params[0] = names.join(' || ');
|
|
700
709
|
}
|
|
@@ -831,13 +840,14 @@ var SelectFilterColumn = function SelectFilterColumn(_ref) {
|
|
|
831
840
|
className: 'content',
|
|
832
841
|
children: [rhsVal === null || rhsVal === void 0 ? void 0 : rhsVal.map(function (v, i) {
|
|
833
842
|
if (v.type === _types.AtomsTypeEnum.FIELD) {
|
|
843
|
+
var displayName = getFieldDisplayName(v);
|
|
834
844
|
return (0, _jsxRuntime.jsx)("div", {
|
|
835
845
|
className: (0, _classnames["default"])("Sqb-TableName purple-name", {
|
|
836
|
-
notSelected: !
|
|
846
|
+
notSelected: !displayName
|
|
837
847
|
}),
|
|
838
848
|
"v-index": i,
|
|
839
849
|
onClick: selectTable,
|
|
840
|
-
children:
|
|
850
|
+
children: displayName || (0, _locale.__)('SqlQueryBuilder.pickTable')
|
|
841
851
|
}, i);
|
|
842
852
|
}
|
|
843
853
|
if (v.type === _types.AtomsTypeEnum.CONSTANT) {
|
|
@@ -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;
|
|
@@ -5,98 +5,272 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
7
|
exports["default"] = void 0;
|
|
8
|
+
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/objectSpread2"));
|
|
8
9
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
9
|
-
var _react = _interopRequireDefault(require("react"));
|
|
10
10
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
11
|
+
var _pandora = require("@gingkoo/pandora");
|
|
11
12
|
var _pandoraIcons = require("@gingkoo/pandora-icons");
|
|
12
13
|
var _icons = require("../../icons");
|
|
14
|
+
var CASE_ICON_SIZE = 10;
|
|
15
|
+
var caseButtonBaseStyle = {
|
|
16
|
+
display: 'inline-flex',
|
|
17
|
+
alignItems: 'center',
|
|
18
|
+
justifyContent: 'center',
|
|
19
|
+
flex: '0 0 auto',
|
|
20
|
+
width: 20,
|
|
21
|
+
minWidth: 20,
|
|
22
|
+
height: 20,
|
|
23
|
+
margin: 0,
|
|
24
|
+
padding: 0,
|
|
25
|
+
border: '1px solid transparent',
|
|
26
|
+
borderRadius: 6,
|
|
27
|
+
cursor: 'pointer',
|
|
28
|
+
lineHeight: 0,
|
|
29
|
+
boxShadow: '0 1px 2px rgba(83, 92, 112, 0.08)'
|
|
30
|
+
};
|
|
31
|
+
var addButtonStyle = (0, _objectSpread2["default"])((0, _objectSpread2["default"])({}, caseButtonBaseStyle), {}, {
|
|
32
|
+
borderColor: 'rgba(80, 158, 227, 0.28)',
|
|
33
|
+
background: 'rgba(80, 158, 227, 0.12)',
|
|
34
|
+
color: 'rgb(80, 158, 227)'
|
|
35
|
+
});
|
|
36
|
+
var removeButtonStyle = (0, _objectSpread2["default"])((0, _objectSpread2["default"])({}, caseButtonBaseStyle), {}, {
|
|
37
|
+
borderColor: 'rgba(245, 63, 63, 0.2)',
|
|
38
|
+
background: 'rgba(245, 63, 63, 0.06)',
|
|
39
|
+
color: 'rgba(220, 38, 38, 0.72)'
|
|
40
|
+
});
|
|
41
|
+
var removeDisabledButtonStyle = (0, _objectSpread2["default"])((0, _objectSpread2["default"])({}, removeButtonStyle), {}, {
|
|
42
|
+
cursor: 'not-allowed',
|
|
43
|
+
opacity: 0.4,
|
|
44
|
+
boxShadow: 'none'
|
|
45
|
+
});
|
|
46
|
+
var zoomButtonStyle = (0, _objectSpread2["default"])((0, _objectSpread2["default"])({}, caseButtonBaseStyle), {}, {
|
|
47
|
+
border: 'none',
|
|
48
|
+
borderRadius: 999,
|
|
49
|
+
background: 'transparent',
|
|
50
|
+
color: 'rgba(83, 92, 112, 0.58)',
|
|
51
|
+
boxShadow: 'none'
|
|
52
|
+
});
|
|
53
|
+
var recoverButtonStyle = {
|
|
54
|
+
display: 'inline-flex',
|
|
55
|
+
alignItems: 'center',
|
|
56
|
+
gap: 4,
|
|
57
|
+
minHeight: 22,
|
|
58
|
+
margin: 0,
|
|
59
|
+
padding: '0 7px',
|
|
60
|
+
border: '1px dashed rgba(80, 158, 227, 0.35)',
|
|
61
|
+
borderRadius: 7,
|
|
62
|
+
background: 'rgba(80, 158, 227, 0.06)',
|
|
63
|
+
color: 'rgb(80, 158, 227)',
|
|
64
|
+
cursor: 'pointer',
|
|
65
|
+
fontSize: 11,
|
|
66
|
+
lineHeight: 1
|
|
67
|
+
};
|
|
13
68
|
var CaseWhenGroup = function CaseWhenGroup(_ref) {
|
|
14
|
-
var
|
|
15
|
-
|
|
69
|
+
var caseAtomsContent = _ref.caseAtomsContent,
|
|
70
|
+
whenClauses = _ref.whenClauses,
|
|
16
71
|
elseContent = _ref.elseContent,
|
|
17
72
|
onAddBranch = _ref.onAddBranch,
|
|
18
73
|
onAddElse = _ref.onAddElse,
|
|
19
74
|
onRemoveElse = _ref.onRemoveElse,
|
|
20
|
-
|
|
75
|
+
onZoomCase = _ref.onZoomCase,
|
|
76
|
+
onDeleteCase = _ref.onDeleteCase,
|
|
77
|
+
_ref$showTools = _ref.showTools,
|
|
78
|
+
showTools = _ref$showTools === void 0 ? true : _ref$showTools,
|
|
79
|
+
_ref$isNested = _ref.isNested,
|
|
80
|
+
isNested = _ref$isNested === void 0 ? false : _ref$isNested,
|
|
81
|
+
_ref$useBranchScrollI = _ref.useBranchScrollInner,
|
|
82
|
+
useBranchScrollInner = _ref$useBranchScrollI === void 0 ? false : _ref$useBranchScrollI,
|
|
83
|
+
_ref$caseRegionKey = _ref.caseRegionKey,
|
|
84
|
+
caseRegionKey = _ref$caseRegionKey === void 0 ? 'case' : _ref$caseRegionKey,
|
|
85
|
+
_ref$elseRegionKey = _ref.elseRegionKey,
|
|
86
|
+
elseRegionKey = _ref$elseRegionKey === void 0 ? 'else' : _ref$elseRegionKey,
|
|
87
|
+
activeRegionKey = _ref.activeRegionKey,
|
|
88
|
+
onActivateRegion = _ref.onActivateRegion;
|
|
89
|
+
var renderBranchContent = function renderBranchContent(children) {
|
|
90
|
+
if (isNested || !useBranchScrollInner) return children;
|
|
91
|
+
return (0, _jsxRuntime.jsx)("div", {
|
|
92
|
+
className: 'Sqb-CaseBranch-scrollInner',
|
|
93
|
+
children: children
|
|
94
|
+
});
|
|
95
|
+
};
|
|
96
|
+
var getRegionClassName = function getRegionClassName(regionKey) {
|
|
97
|
+
for (var _len = arguments.length, classNames = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
98
|
+
classNames[_key - 1] = arguments[_key];
|
|
99
|
+
}
|
|
100
|
+
return _classnames["default"].apply(void 0, ['Sqb-FormulaGroup-row'].concat(classNames, [{
|
|
101
|
+
'Sqb-CaseRegion--active': activeRegionKey === regionKey
|
|
102
|
+
}]));
|
|
103
|
+
};
|
|
104
|
+
var handleActivateRegion = function handleActivateRegion(e, regionKey) {
|
|
105
|
+
var _target$closest;
|
|
106
|
+
var target = e.target;
|
|
107
|
+
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');
|
|
108
|
+
if (currentRegion !== e.currentTarget) return;
|
|
109
|
+
onActivateRegion === null || onActivateRegion === void 0 || onActivateRegion(regionKey);
|
|
110
|
+
};
|
|
21
111
|
return (0, _jsxRuntime.jsxs)("div", {
|
|
22
|
-
className: (0, _classnames["default"])('Sqb-FormulaGroup', 'flow-group', 'formula-node-group'
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
children: (0, _jsxRuntime.jsx)(
|
|
112
|
+
className: (0, _classnames["default"])('Sqb-FormulaGroup', 'flow-group', 'formula-node-group', 'Sqb-CaseWhenGroup', {
|
|
113
|
+
'Sqb-CaseWhenGroup--nested': isNested
|
|
114
|
+
}),
|
|
115
|
+
children: [showTools && (0, _jsxRuntime.jsxs)("div", {
|
|
116
|
+
className: 'Sqb-CaseWhenTools',
|
|
117
|
+
children: [onZoomCase && (0, _jsxRuntime.jsx)(_pandora.Tooltip, {
|
|
118
|
+
title: "\u7F16\u8F91 caseWhen",
|
|
119
|
+
children: (0, _jsxRuntime.jsx)("button", {
|
|
120
|
+
type: 'button',
|
|
121
|
+
className: 'Sqb-CaseRow-zoom formula-node-tool',
|
|
122
|
+
style: zoomButtonStyle,
|
|
123
|
+
onClick: onZoomCase,
|
|
124
|
+
children: (0, _jsxRuntime.jsx)(_pandoraIcons.FullscreenOExpand, {})
|
|
125
|
+
})
|
|
126
|
+
}), onDeleteCase && (0, _jsxRuntime.jsx)(_pandora.Tooltip, {
|
|
127
|
+
title: "\u5220\u9664 caseWhen",
|
|
128
|
+
children: (0, _jsxRuntime.jsx)("button", {
|
|
129
|
+
type: 'button',
|
|
130
|
+
className: 'Sqb-CaseRow-remove formula-node-remove',
|
|
131
|
+
style: removeButtonStyle,
|
|
132
|
+
onClick: onDeleteCase,
|
|
133
|
+
children: (0, _jsxRuntime.jsx)(_icons.CloseIcon, {
|
|
134
|
+
width: CASE_ICON_SIZE,
|
|
135
|
+
height: CASE_ICON_SIZE
|
|
136
|
+
})
|
|
137
|
+
})
|
|
138
|
+
})]
|
|
28
139
|
}), (0, _jsxRuntime.jsxs)("div", {
|
|
29
|
-
className: (
|
|
140
|
+
className: getRegionClassName(caseRegionKey, 'row-case'),
|
|
141
|
+
onMouseDown: function onMouseDown(e) {
|
|
142
|
+
return handleActivateRegion(e, caseRegionKey);
|
|
143
|
+
},
|
|
30
144
|
children: [(0, _jsxRuntime.jsx)("span", {
|
|
31
145
|
className: 'Sqb-CaseKeyword keyword-case',
|
|
32
146
|
children: "case"
|
|
33
147
|
}), (0, _jsxRuntime.jsx)("div", {
|
|
34
148
|
className: 'Sqb-CaseSection Sqb-CaseSection-case',
|
|
35
|
-
children:
|
|
149
|
+
children: (0, _jsxRuntime.jsx)("div", {
|
|
150
|
+
className: 'Sqb-CaseSection-content',
|
|
151
|
+
children: caseAtomsContent
|
|
152
|
+
})
|
|
36
153
|
})]
|
|
37
|
-
}),
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
154
|
+
}), whenClauses.map(function (branch, branchIndex) {
|
|
155
|
+
var canDeleteBranch = branch.canDelete !== false;
|
|
156
|
+
return (0, _jsxRuntime.jsxs)("div", {
|
|
157
|
+
className: getRegionClassName(branch.key, 'row-when'),
|
|
158
|
+
onMouseDown: function onMouseDown(e) {
|
|
159
|
+
return handleActivateRegion(e, branch.key);
|
|
160
|
+
},
|
|
161
|
+
children: [(0, _jsxRuntime.jsx)("span", {
|
|
162
|
+
className: 'Sqb-CaseBranchIndex',
|
|
163
|
+
children: branchIndex + 1
|
|
164
|
+
}), (0, _jsxRuntime.jsx)("div", {
|
|
165
|
+
className: 'Sqb-CaseBranch-body',
|
|
166
|
+
children: renderBranchContent((0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
167
|
+
children: [(0, _jsxRuntime.jsxs)("div", {
|
|
168
|
+
className: 'Sqb-CaseSection Sqb-CaseSection-condition',
|
|
169
|
+
children: [(0, _jsxRuntime.jsx)("span", {
|
|
170
|
+
className: 'Sqb-CaseKeyword keyword-branch keyword-when',
|
|
171
|
+
children: "when"
|
|
172
|
+
}), (0, _jsxRuntime.jsx)("div", {
|
|
173
|
+
className: 'Sqb-CaseSection-content Sqb-CaseSection-content--wrap',
|
|
174
|
+
children: branch.whenContent
|
|
175
|
+
})]
|
|
176
|
+
}), (0, _jsxRuntime.jsxs)("div", {
|
|
177
|
+
className: 'Sqb-CaseSection Sqb-CaseSection-result',
|
|
178
|
+
children: [(0, _jsxRuntime.jsx)("span", {
|
|
179
|
+
className: 'Sqb-CaseKeyword keyword-branch keyword-then',
|
|
180
|
+
children: "then"
|
|
181
|
+
}), (0, _jsxRuntime.jsx)("div", {
|
|
182
|
+
className: 'Sqb-CaseSection-content Sqb-CaseSection-content--wrap',
|
|
183
|
+
children: branch.thenContent
|
|
184
|
+
})]
|
|
185
|
+
})]
|
|
186
|
+
}))
|
|
187
|
+
}), (0, _jsxRuntime.jsxs)("div", {
|
|
188
|
+
className: 'Sqb-CaseRow-actions when-row-actions',
|
|
189
|
+
children: [(0, _jsxRuntime.jsx)(_pandora.Tooltip, {
|
|
190
|
+
title: "\u65B0\u589E when",
|
|
191
|
+
children: (0, _jsxRuntime.jsx)("button", {
|
|
56
192
|
type: 'button',
|
|
57
193
|
className: 'Sqb-CaseRow-add',
|
|
194
|
+
style: addButtonStyle,
|
|
58
195
|
onClick: branch.onAddAfter,
|
|
59
196
|
children: (0, _jsxRuntime.jsx)(_pandoraIcons.FfPlus, {})
|
|
60
|
-
})
|
|
197
|
+
})
|
|
198
|
+
}), (0, _jsxRuntime.jsx)(_pandora.Tooltip, {
|
|
199
|
+
title: canDeleteBranch ? '删除 when' : '至少保留一个 when / then',
|
|
200
|
+
children: (0, _jsxRuntime.jsx)("button", {
|
|
61
201
|
type: 'button',
|
|
62
|
-
className: 'Sqb-CaseRow-remove',
|
|
202
|
+
className: (0, _classnames["default"])('Sqb-CaseRow-remove', {
|
|
203
|
+
disabled: !canDeleteBranch
|
|
204
|
+
}),
|
|
205
|
+
disabled: !canDeleteBranch,
|
|
206
|
+
style: canDeleteBranch ? removeButtonStyle : removeDisabledButtonStyle,
|
|
63
207
|
onClick: branch.onDelete,
|
|
64
|
-
children: (0, _jsxRuntime.jsx)(_icons.CloseIcon, {
|
|
65
|
-
|
|
208
|
+
children: (0, _jsxRuntime.jsx)(_icons.CloseIcon, {
|
|
209
|
+
width: CASE_ICON_SIZE,
|
|
210
|
+
height: CASE_ICON_SIZE
|
|
211
|
+
})
|
|
212
|
+
})
|
|
66
213
|
})]
|
|
67
|
-
})
|
|
214
|
+
})]
|
|
68
215
|
}, branch.key);
|
|
69
|
-
}),
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
216
|
+
}), whenClauses.length < 1 && (0, _jsxRuntime.jsx)(_pandora.Tooltip, {
|
|
217
|
+
title: "\u65B0\u589E when",
|
|
218
|
+
children: (0, _jsxRuntime.jsxs)("button", {
|
|
219
|
+
type: 'button',
|
|
220
|
+
className: (0, _classnames["default"])('Sqb-CaseRecover', 'recover-row', 'inline-after-case'),
|
|
221
|
+
style: recoverButtonStyle,
|
|
222
|
+
onClick: onAddBranch,
|
|
223
|
+
children: [(0, _jsxRuntime.jsx)(_pandoraIcons.FfPlus, {}), (0, _jsxRuntime.jsx)("span", {
|
|
224
|
+
children: "\u65B0\u589E when"
|
|
225
|
+
})]
|
|
226
|
+
})
|
|
76
227
|
}), elseContent && (0, _jsxRuntime.jsxs)("div", {
|
|
77
|
-
className: (
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
228
|
+
className: getRegionClassName(elseRegionKey, 'row-else'),
|
|
229
|
+
onMouseDown: function onMouseDown(e) {
|
|
230
|
+
return handleActivateRegion(e, elseRegionKey);
|
|
231
|
+
},
|
|
232
|
+
children: [(0, _jsxRuntime.jsx)("span", {
|
|
233
|
+
className: 'Sqb-CaseBranchIndex Sqb-CaseBranchIndex--else',
|
|
234
|
+
"aria-hidden": 'true'
|
|
235
|
+
}), (0, _jsxRuntime.jsx)("div", {
|
|
236
|
+
className: 'Sqb-CaseBranch-body',
|
|
237
|
+
children: renderBranchContent((0, _jsxRuntime.jsxs)("div", {
|
|
238
|
+
className: 'Sqb-CaseSection Sqb-CaseSection-result Sqb-CaseSection-else',
|
|
239
|
+
children: [(0, _jsxRuntime.jsx)("span", {
|
|
240
|
+
className: 'Sqb-CaseKeyword keyword-branch keyword-else',
|
|
241
|
+
children: "else"
|
|
242
|
+
}), (0, _jsxRuntime.jsx)("div", {
|
|
243
|
+
className: 'Sqb-CaseSection-content Sqb-CaseSection-content--wrap',
|
|
244
|
+
children: elseContent
|
|
245
|
+
})]
|
|
246
|
+
}))
|
|
84
247
|
}), (0, _jsxRuntime.jsx)("div", {
|
|
85
248
|
className: 'Sqb-CaseRow-actions when-row-actions',
|
|
86
|
-
children: (0, _jsxRuntime.jsx)(
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
249
|
+
children: (0, _jsxRuntime.jsx)(_pandora.Tooltip, {
|
|
250
|
+
title: "\u5220\u9664 else",
|
|
251
|
+
children: (0, _jsxRuntime.jsx)("button", {
|
|
252
|
+
type: 'button',
|
|
253
|
+
className: 'Sqb-CaseRow-remove',
|
|
254
|
+
style: removeButtonStyle,
|
|
255
|
+
onClick: onRemoveElse,
|
|
256
|
+
children: (0, _jsxRuntime.jsx)(_icons.CloseIcon, {
|
|
257
|
+
width: CASE_ICON_SIZE,
|
|
258
|
+
height: CASE_ICON_SIZE
|
|
259
|
+
})
|
|
260
|
+
})
|
|
91
261
|
})
|
|
92
262
|
})]
|
|
93
|
-
}), !elseContent && (0, _jsxRuntime.
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
263
|
+
}), !elseContent && (0, _jsxRuntime.jsx)(_pandora.Tooltip, {
|
|
264
|
+
title: "\u65B0\u589E else",
|
|
265
|
+
children: (0, _jsxRuntime.jsxs)("button", {
|
|
266
|
+
type: 'button',
|
|
267
|
+
className: (0, _classnames["default"])('Sqb-CaseRecover', 'recover-else-row'),
|
|
268
|
+
style: recoverButtonStyle,
|
|
269
|
+
onClick: onAddElse,
|
|
270
|
+
children: [(0, _jsxRuntime.jsx)(_pandoraIcons.FfPlus, {}), (0, _jsxRuntime.jsx)("span", {
|
|
271
|
+
children: "\u65B0\u589E else"
|
|
272
|
+
})]
|
|
273
|
+
})
|
|
100
274
|
}), (0, _jsxRuntime.jsx)("div", {
|
|
101
275
|
className: (0, _classnames["default"])('Sqb-FormulaGroup-row', 'row-end'),
|
|
102
276
|
children: (0, _jsxRuntime.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;
|
|
@@ -7,15 +7,23 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
exports["default"] = void 0;
|
|
8
8
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
9
9
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
10
|
+
var _pandora = require("@gingkoo/pandora");
|
|
10
11
|
var _icons = require("../../icons");
|
|
11
12
|
var LogicGroup = function LogicGroup(_ref) {
|
|
12
13
|
var operator = _ref.operator,
|
|
13
14
|
onToggleOperator = _ref.onToggleOperator,
|
|
14
|
-
|
|
15
|
+
leftContent = _ref.leftContent,
|
|
16
|
+
rightContent = _ref.rightContent,
|
|
15
17
|
onDelete = _ref.onDelete;
|
|
16
18
|
return (0, _jsxRuntime.jsxs)("div", {
|
|
17
19
|
className: (0, _classnames["default"])('Sqb-FormulaGroup', 'logic-group', 'formula-node-group'),
|
|
18
|
-
children: [(0, _jsxRuntime.jsx)("
|
|
20
|
+
children: [(0, _jsxRuntime.jsx)("span", {
|
|
21
|
+
className: 'Sqb-CaseKeyword',
|
|
22
|
+
children: "("
|
|
23
|
+
}), (0, _jsxRuntime.jsx)("div", {
|
|
24
|
+
className: 'Sqb-LogicGroup-content',
|
|
25
|
+
children: leftContent
|
|
26
|
+
}), (0, _jsxRuntime.jsx)("button", {
|
|
19
27
|
type: 'button',
|
|
20
28
|
className: (0, _classnames["default"])('Sqb-TableName', 'operator-trigger', 'logic-operator', {
|
|
21
29
|
'logic-and': operator === 'and',
|
|
@@ -23,20 +31,20 @@ var LogicGroup = function LogicGroup(_ref) {
|
|
|
23
31
|
}),
|
|
24
32
|
onClick: onToggleOperator,
|
|
25
33
|
children: operator
|
|
26
|
-
}), (0, _jsxRuntime.jsx)("span", {
|
|
27
|
-
className: 'Sqb-CaseKeyword',
|
|
28
|
-
children: "("
|
|
29
34
|
}), (0, _jsxRuntime.jsx)("div", {
|
|
30
35
|
className: 'Sqb-LogicGroup-content',
|
|
31
|
-
children:
|
|
36
|
+
children: rightContent
|
|
32
37
|
}), (0, _jsxRuntime.jsx)("span", {
|
|
33
38
|
className: 'Sqb-CaseKeyword',
|
|
34
39
|
children: ")"
|
|
35
|
-
}), (0, _jsxRuntime.jsx)(
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
+
}), (0, _jsxRuntime.jsx)(_pandora.Tooltip, {
|
|
41
|
+
title: "\u5220\u9664 and/or",
|
|
42
|
+
children: (0, _jsxRuntime.jsx)("button", {
|
|
43
|
+
type: 'button',
|
|
44
|
+
className: 'Sqb-CaseRow-remove formula-node-remove',
|
|
45
|
+
onClick: onDelete,
|
|
46
|
+
children: (0, _jsxRuntime.jsx)(_icons.CloseIcon, {})
|
|
47
|
+
})
|
|
40
48
|
})]
|
|
41
49
|
});
|
|
42
50
|
};
|
|
@@ -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>>;
|