@gingkoo/pandora-metabase 1.0.116 → 1.0.118
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/formula-list/index.js +51 -27
- package/lib/cjs/components/dialog/formula-list/index.less +35 -20
- package/lib/cjs/components/dialog/formula-list/utils.js +1 -0
- package/lib/cjs/components/metabase/index.less +7 -0
- package/lib/es/components/dialog/formula-list/index.js +51 -27
- package/lib/es/components/dialog/formula-list/index.less +35 -20
- package/lib/es/components/dialog/formula-list/utils.js +1 -0
- package/lib/es/components/metabase/index.less +7 -0
- package/package.json +1 -1
|
@@ -100,7 +100,6 @@ var FormulaList = (0, _react.forwardRef)(function (props, ref) {
|
|
|
100
100
|
var caseList = value || [];
|
|
101
101
|
// const [caseList, setCaseListState] = useState<AtomsItem[]>(cloneDeep(value));
|
|
102
102
|
var caseListRef = (0, _react.useRef)(caseList);
|
|
103
|
-
var isSettingCaseList = (0, _react.useRef)(false);
|
|
104
103
|
var operatorList = (0, _react.useMemo)(function () {
|
|
105
104
|
if (store.operatorList.length > 0) {
|
|
106
105
|
return store.operatorList;
|
|
@@ -147,7 +146,6 @@ var FormulaList = (0, _react.forwardRef)(function (props, ref) {
|
|
|
147
146
|
return v.val;
|
|
148
147
|
}
|
|
149
148
|
}).join(' ');
|
|
150
|
-
isSettingCaseList.current = true;
|
|
151
149
|
// setCaseListState(data);
|
|
152
150
|
caseList = data;
|
|
153
151
|
caseListRef.current = data;
|
|
@@ -182,12 +180,11 @@ var FormulaList = (0, _react.forwardRef)(function (props, ref) {
|
|
|
182
180
|
_useState20 = (0, _slicedToArray2["default"])(_useState19, 2),
|
|
183
181
|
selectedIndices = _useState20[0],
|
|
184
182
|
setSelectedIndices = _useState20[1];
|
|
183
|
+
var _useState21 = (0, _react.useState)(null),
|
|
184
|
+
_useState22 = (0, _slicedToArray2["default"])(_useState21, 2),
|
|
185
|
+
hoveredCopyIndex = _useState22[0],
|
|
186
|
+
setHoveredCopyIndex = _useState22[1];
|
|
185
187
|
(0, _react.useEffect)(function () {
|
|
186
|
-
// Skip if this update came from setCaseList (to avoid infinite loop)
|
|
187
|
-
if (isSettingCaseList.current) {
|
|
188
|
-
isSettingCaseList.current = false;
|
|
189
|
-
return;
|
|
190
|
-
}
|
|
191
188
|
var _errorInfo = (0, _utils3.validateExpressionIntegrity)(caseList);
|
|
192
189
|
setErrorInfo(_errorInfo);
|
|
193
190
|
}, [caseList]);
|
|
@@ -428,13 +425,13 @@ var FormulaList = (0, _react.forwardRef)(function (props, ref) {
|
|
|
428
425
|
// 确认删除吗
|
|
429
426
|
onOk: function () {
|
|
430
427
|
var _onOk = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee() {
|
|
431
|
-
var _caseList;
|
|
428
|
+
var selectedIndexSet, _caseList;
|
|
432
429
|
return _regenerator["default"].wrap(function (_context) {
|
|
433
430
|
while (1) switch (_context.prev = _context.next) {
|
|
434
431
|
case 0:
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
432
|
+
selectedIndexSet = new Set(selectedIndices);
|
|
433
|
+
_caseList = caseList.filter(function (_, index) {
|
|
434
|
+
return !selectedIndexSet.has(index);
|
|
438
435
|
});
|
|
439
436
|
setCaseList(_caseList);
|
|
440
437
|
initPaste();
|
|
@@ -670,6 +667,7 @@ var FormulaList = (0, _react.forwardRef)(function (props, ref) {
|
|
|
670
667
|
return showNotExists(index);
|
|
671
668
|
},
|
|
672
669
|
children: [v.type, " ( * )", (0, _jsxRuntime.jsx)("span", {
|
|
670
|
+
className: 'item-del',
|
|
673
671
|
style: {
|
|
674
672
|
fontSize: 0
|
|
675
673
|
},
|
|
@@ -689,6 +687,7 @@ var FormulaList = (0, _react.forwardRef)(function (props, ref) {
|
|
|
689
687
|
return showSubQuery(index);
|
|
690
688
|
},
|
|
691
689
|
children: [v.label || (0, _locale.__)('SqlQueryBuilder.subquery'), (0, _jsxRuntime.jsx)("span", {
|
|
690
|
+
className: 'item-del',
|
|
692
691
|
style: {
|
|
693
692
|
fontSize: 0
|
|
694
693
|
},
|
|
@@ -711,6 +710,7 @@ var FormulaList = (0, _react.forwardRef)(function (props, ref) {
|
|
|
711
710
|
return handleField(e, index, v);
|
|
712
711
|
},
|
|
713
712
|
children: [!(v !== null && v !== void 0 && v.fieldName) && (0, _locale.__)('customColumn.selectField'), v.fieldName, (0, _jsxRuntime.jsx)("span", {
|
|
713
|
+
className: 'item-del',
|
|
714
714
|
style: {
|
|
715
715
|
fontSize: 0
|
|
716
716
|
},
|
|
@@ -734,6 +734,7 @@ var FormulaList = (0, _react.forwardRef)(function (props, ref) {
|
|
|
734
734
|
handleConstant(val, index);
|
|
735
735
|
}
|
|
736
736
|
}), (0, _jsxRuntime.jsx)("span", {
|
|
737
|
+
className: 'item-del',
|
|
737
738
|
style: {
|
|
738
739
|
fontSize: 0
|
|
739
740
|
},
|
|
@@ -756,6 +757,7 @@ var FormulaList = (0, _react.forwardRef)(function (props, ref) {
|
|
|
756
757
|
handleConstant(val, index);
|
|
757
758
|
}
|
|
758
759
|
}), (0, _jsxRuntime.jsx)("span", {
|
|
760
|
+
className: 'item-del',
|
|
759
761
|
style: {
|
|
760
762
|
fontSize: 0
|
|
761
763
|
},
|
|
@@ -778,6 +780,7 @@ var FormulaList = (0, _react.forwardRef)(function (props, ref) {
|
|
|
778
780
|
notSelected: !v.val
|
|
779
781
|
}),
|
|
780
782
|
children: [!v.val && (0, _locale.__)('customColumn.selectOperator'), v.val, (0, _jsxRuntime.jsx)("span", {
|
|
783
|
+
className: 'item-del',
|
|
781
784
|
style: {
|
|
782
785
|
fontSize: 0
|
|
783
786
|
},
|
|
@@ -811,6 +814,7 @@ var FormulaList = (0, _react.forwardRef)(function (props, ref) {
|
|
|
811
814
|
"v-val": v.id || v.val,
|
|
812
815
|
onClick: selectConstant,
|
|
813
816
|
children: [(0, _utils3.getConstantLabel)(store.constantList, v.id || v.val, v.val) || (0, _locale.__)('SqlQueryBuilder.pickConstant'), (0, _jsxRuntime.jsx)("span", {
|
|
817
|
+
className: 'item-del',
|
|
814
818
|
style: {
|
|
815
819
|
fontSize: 0
|
|
816
820
|
},
|
|
@@ -837,6 +841,7 @@ var FormulaList = (0, _react.forwardRef)(function (props, ref) {
|
|
|
837
841
|
"v-type": type,
|
|
838
842
|
onClick: selectConstant,
|
|
839
843
|
children: [(0, _utils3.getConstantLabel)(listSource, v.id || v.val, v.val) || "\u8BF7\u9009\u62E9".concat(currentOtherType.label), (0, _jsxRuntime.jsx)("span", {
|
|
844
|
+
className: 'item-del',
|
|
840
845
|
style: {
|
|
841
846
|
fontSize: 0
|
|
842
847
|
},
|
|
@@ -866,6 +871,7 @@ var FormulaList = (0, _react.forwardRef)(function (props, ref) {
|
|
|
866
871
|
return handleExpression(e, index, v);
|
|
867
872
|
},
|
|
868
873
|
children: [v.quotes ? v.quotes : (0, _locale.__)('customColumn.selectExpression'), (0, _jsxRuntime.jsx)("span", {
|
|
874
|
+
className: 'item-del',
|
|
869
875
|
style: {
|
|
870
876
|
fontSize: 0
|
|
871
877
|
},
|
|
@@ -887,6 +893,7 @@ var FormulaList = (0, _react.forwardRef)(function (props, ref) {
|
|
|
887
893
|
return showFunction(e, index);
|
|
888
894
|
},
|
|
889
895
|
children: [v.name ? (0, _utils.getQuotes)(v, v.args, formulaList) : (0, _locale.__)('customColumn.selectFormula'), (0, _jsxRuntime.jsx)("span", {
|
|
896
|
+
className: 'item-del',
|
|
890
897
|
style: {
|
|
891
898
|
fontSize: 0
|
|
892
899
|
},
|
|
@@ -911,6 +918,7 @@ var FormulaList = (0, _react.forwardRef)(function (props, ref) {
|
|
|
911
918
|
notSelected: !v.val
|
|
912
919
|
}),
|
|
913
920
|
children: [!v.val && (0, _locale.__)('customColumn.selectOperator'), v.val, !v.fixed && (0, _jsxRuntime.jsx)("span", {
|
|
921
|
+
className: 'item-del',
|
|
914
922
|
style: {
|
|
915
923
|
fontSize: 0
|
|
916
924
|
},
|
|
@@ -939,6 +947,7 @@ var FormulaList = (0, _react.forwardRef)(function (props, ref) {
|
|
|
939
947
|
notSelected: true
|
|
940
948
|
}),
|
|
941
949
|
children: [(0, _locale.__)('customColumn.selectCustomInput'), (0, _jsxRuntime.jsx)("span", {
|
|
950
|
+
className: 'item-del',
|
|
942
951
|
style: {
|
|
943
952
|
fontSize: 0
|
|
944
953
|
},
|
|
@@ -956,16 +965,31 @@ var FormulaList = (0, _react.forwardRef)(function (props, ref) {
|
|
|
956
965
|
};
|
|
957
966
|
var copyDom = function copyDom() {
|
|
958
967
|
var index = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : -1;
|
|
968
|
+
var positioned = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
|
959
969
|
if (!isCopy || selectedIndices.length === 0 && checkedItemsCount === 0) return null;
|
|
960
|
-
return (0, _jsxRuntime.jsx)(
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
970
|
+
return (0, _jsxRuntime.jsx)("div", {
|
|
971
|
+
className: (0, _classnames["default"])('Sqb-Filter-item-copy', {
|
|
972
|
+
'Sqb-Filter-item-copy-static': !positioned
|
|
973
|
+
}),
|
|
974
|
+
onMouseEnter: function onMouseEnter() {
|
|
975
|
+
if (!positioned) return;
|
|
976
|
+
setHoveredCopyIndex(index);
|
|
977
|
+
},
|
|
978
|
+
onMouseLeave: function onMouseLeave() {
|
|
979
|
+
if (!positioned) return;
|
|
980
|
+
setHoveredCopyIndex(function (current) {
|
|
981
|
+
return current === index ? null : current;
|
|
982
|
+
});
|
|
983
|
+
},
|
|
984
|
+
children: (0, _jsxRuntime.jsx)(_pandora.Tooltip, {
|
|
985
|
+
title: "\u5728\u6B64\u5904\u7C98\u8D34(".concat(selectedIndices.length || checkedItemsCount, ")\u9879"),
|
|
986
|
+
children: (0, _jsxRuntime.jsx)(_pandora.Button, {
|
|
987
|
+
onClick: function onClick() {
|
|
988
|
+
return handlePaste(index);
|
|
989
|
+
},
|
|
990
|
+
iconOnly: true,
|
|
991
|
+
icon: (0, _jsxRuntime.jsx)(_pandoraIcons.FfPlus, {})
|
|
992
|
+
})
|
|
969
993
|
})
|
|
970
994
|
});
|
|
971
995
|
};
|
|
@@ -1012,10 +1036,10 @@ var FormulaList = (0, _react.forwardRef)(function (props, ref) {
|
|
|
1012
1036
|
children: "\u6E05\u9664\u590D\u5236"
|
|
1013
1037
|
})]
|
|
1014
1038
|
}), (_caseList2 = caseList) === null || _caseList2 === void 0 ? void 0 : _caseList2.map(function (v, i) {
|
|
1015
|
-
return (0, _jsxRuntime.
|
|
1016
|
-
children:
|
|
1039
|
+
return (0, _jsxRuntime.jsx)(_react["default"].Fragment, {
|
|
1040
|
+
children: (0, _jsxRuntime.jsxs)("div", {
|
|
1017
1041
|
className: (0, _classnames["default"])('Sqb-Filter-item', {
|
|
1018
|
-
hover: ind === i,
|
|
1042
|
+
hover: ind === i && hoveredCopyIndex !== i,
|
|
1019
1043
|
'item-fixed': v.fixed || false,
|
|
1020
1044
|
'item-selected': isCheck
|
|
1021
1045
|
}),
|
|
@@ -1027,7 +1051,7 @@ var FormulaList = (0, _react.forwardRef)(function (props, ref) {
|
|
|
1027
1051
|
if (isCheck) return;
|
|
1028
1052
|
setInd(-1);
|
|
1029
1053
|
},
|
|
1030
|
-
children: [selectOperator({
|
|
1054
|
+
children: [copyDom(i), selectOperator({
|
|
1031
1055
|
triggerElement: function triggerElement() {
|
|
1032
1056
|
return (0, _jsxRuntime.jsx)("div", {
|
|
1033
1057
|
className: 'left-arrow',
|
|
@@ -1056,7 +1080,7 @@ var FormulaList = (0, _react.forwardRef)(function (props, ref) {
|
|
|
1056
1080
|
style: {
|
|
1057
1081
|
pointerEvents: isCheck || store.isMetabaseCopy ? 'none' : 'auto'
|
|
1058
1082
|
},
|
|
1059
|
-
className: (0, _classnames["default"])({
|
|
1083
|
+
className: (0, _classnames["default"])('Sqb-Filter-item-content', {
|
|
1060
1084
|
openCheck: isCheck
|
|
1061
1085
|
}),
|
|
1062
1086
|
children: itemDom(v, i)
|
|
@@ -1078,7 +1102,7 @@ var FormulaList = (0, _react.forwardRef)(function (props, ref) {
|
|
|
1078
1102
|
position: 'after',
|
|
1079
1103
|
trigger: 'hover'
|
|
1080
1104
|
})]
|
|
1081
|
-
}, i)
|
|
1105
|
+
}, i)
|
|
1082
1106
|
}, i);
|
|
1083
1107
|
}), Array.from(caseList).length < 1 && selectOperator({
|
|
1084
1108
|
triggerElement: function triggerElement() {
|
|
@@ -1090,7 +1114,7 @@ var FormulaList = (0, _react.forwardRef)(function (props, ref) {
|
|
|
1090
1114
|
ind: -1,
|
|
1091
1115
|
position: 'add',
|
|
1092
1116
|
trigger: 'click'
|
|
1093
|
-
}), copyDom(), showPreview && (0, _jsxRuntime.jsx)("div", {
|
|
1117
|
+
}), copyDom(-1, false), showPreview && (0, _jsxRuntime.jsx)("div", {
|
|
1094
1118
|
className: (0, _classnames["default"])("mb-2 font-bold uppercase tracking-wider preview-box"),
|
|
1095
1119
|
style: {
|
|
1096
1120
|
fontSize: 12,
|
|
@@ -22,22 +22,32 @@
|
|
|
22
22
|
}
|
|
23
23
|
.Sqb-Filter-item {
|
|
24
24
|
position: relative;
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
25
|
+
&-content {
|
|
26
|
+
position: relative;
|
|
27
|
+
display: inline-flex;
|
|
28
|
+
align-items: center;
|
|
29
|
+
}
|
|
30
|
+
&-copy {
|
|
31
|
+
position: absolute;
|
|
32
|
+
left: -14px;
|
|
33
|
+
top: 50%;
|
|
34
|
+
transform: translate(-50%, -50%);
|
|
35
|
+
|
|
36
|
+
&-static {
|
|
37
|
+
position: static;
|
|
38
|
+
display: inline-flex;
|
|
39
|
+
align-items: center;
|
|
40
|
+
margin-bottom: 8px;
|
|
41
|
+
transform: none;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
38
44
|
.openCheck {
|
|
39
45
|
.Sqb-TableName {
|
|
40
|
-
padding-left:
|
|
46
|
+
padding-left: 28px;
|
|
47
|
+
|
|
48
|
+
.item-del {
|
|
49
|
+
display: none;
|
|
50
|
+
}
|
|
41
51
|
}
|
|
42
52
|
}
|
|
43
53
|
&.item-selected {
|
|
@@ -48,16 +58,21 @@
|
|
|
48
58
|
.item-check {
|
|
49
59
|
display: none;
|
|
50
60
|
position: absolute;
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
z-index:
|
|
61
|
+
left: 0;
|
|
62
|
+
top: 0;
|
|
63
|
+
z-index: 2;
|
|
54
64
|
margin: 0;
|
|
55
65
|
padding: 0;
|
|
56
66
|
width: 100%;
|
|
57
|
-
height:
|
|
67
|
+
height: calc(100% - 8px);
|
|
58
68
|
.pd-Checkbox-mask-wrapper {
|
|
59
|
-
margin
|
|
60
|
-
|
|
69
|
+
margin: 0;
|
|
70
|
+
width: 100%;
|
|
71
|
+
height: 100%;
|
|
72
|
+
display: flex;
|
|
73
|
+
align-items: center;
|
|
74
|
+
justify-content: flex-start;
|
|
75
|
+
padding-left: 8px;
|
|
61
76
|
}
|
|
62
77
|
}
|
|
63
78
|
}
|
|
@@ -319,6 +319,7 @@ var _isOk = exports.isOk = function isOk(rhsVal) {
|
|
|
319
319
|
// 校验表达式完整性
|
|
320
320
|
// 括号不匹配
|
|
321
321
|
function validateParentheses(list) {
|
|
322
|
+
console.log('🚀 ~ validateParentheses ~ list:', list);
|
|
322
323
|
var depth = 0;
|
|
323
324
|
var _iterator = (0, _createForOfIteratorHelper2["default"])(list),
|
|
324
325
|
_step;
|
|
@@ -208,11 +208,18 @@
|
|
|
208
208
|
top: 0;
|
|
209
209
|
transform: translate(50%, -50%);
|
|
210
210
|
margin: 0;
|
|
211
|
+
padding: 0;
|
|
211
212
|
border: none;
|
|
212
213
|
border-radius: 50%;
|
|
213
214
|
width: 20px;
|
|
214
215
|
height: 20px;
|
|
216
|
+
min-height: 20px;
|
|
215
217
|
font-size: 12px;
|
|
218
|
+
display: inline-flex;
|
|
219
|
+
align-items: center;
|
|
220
|
+
justify-content: center;
|
|
221
|
+
line-height: 1;
|
|
222
|
+
flex-shrink: 0;
|
|
216
223
|
}
|
|
217
224
|
&-input {
|
|
218
225
|
//输入框样式,稍微小了一点
|
|
@@ -92,7 +92,6 @@ var FormulaList = forwardRef(function (props, ref) {
|
|
|
92
92
|
var caseList = value || [];
|
|
93
93
|
// const [caseList, setCaseListState] = useState<AtomsItem[]>(cloneDeep(value));
|
|
94
94
|
var caseListRef = useRef(caseList);
|
|
95
|
-
var isSettingCaseList = useRef(false);
|
|
96
95
|
var operatorList = useMemo(function () {
|
|
97
96
|
if (store.operatorList.length > 0) {
|
|
98
97
|
return store.operatorList;
|
|
@@ -139,7 +138,6 @@ var FormulaList = forwardRef(function (props, ref) {
|
|
|
139
138
|
return v.val;
|
|
140
139
|
}
|
|
141
140
|
}).join(' ');
|
|
142
|
-
isSettingCaseList.current = true;
|
|
143
141
|
// setCaseListState(data);
|
|
144
142
|
caseList = data;
|
|
145
143
|
caseListRef.current = data;
|
|
@@ -174,12 +172,11 @@ var FormulaList = forwardRef(function (props, ref) {
|
|
|
174
172
|
_useState20 = _slicedToArray(_useState19, 2),
|
|
175
173
|
selectedIndices = _useState20[0],
|
|
176
174
|
setSelectedIndices = _useState20[1];
|
|
175
|
+
var _useState21 = useState(null),
|
|
176
|
+
_useState22 = _slicedToArray(_useState21, 2),
|
|
177
|
+
hoveredCopyIndex = _useState22[0],
|
|
178
|
+
setHoveredCopyIndex = _useState22[1];
|
|
177
179
|
useEffect(function () {
|
|
178
|
-
// Skip if this update came from setCaseList (to avoid infinite loop)
|
|
179
|
-
if (isSettingCaseList.current) {
|
|
180
|
-
isSettingCaseList.current = false;
|
|
181
|
-
return;
|
|
182
|
-
}
|
|
183
180
|
var _errorInfo = validateExpressionIntegrity(caseList);
|
|
184
181
|
setErrorInfo(_errorInfo);
|
|
185
182
|
}, [caseList]);
|
|
@@ -420,13 +417,13 @@ var FormulaList = forwardRef(function (props, ref) {
|
|
|
420
417
|
// 确认删除吗
|
|
421
418
|
onOk: function () {
|
|
422
419
|
var _onOk = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
423
|
-
var _caseList;
|
|
420
|
+
var selectedIndexSet, _caseList;
|
|
424
421
|
return _regeneratorRuntime.wrap(function (_context) {
|
|
425
422
|
while (1) switch (_context.prev = _context.next) {
|
|
426
423
|
case 0:
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
424
|
+
selectedIndexSet = new Set(selectedIndices);
|
|
425
|
+
_caseList = caseList.filter(function (_, index) {
|
|
426
|
+
return !selectedIndexSet.has(index);
|
|
430
427
|
});
|
|
431
428
|
setCaseList(_caseList);
|
|
432
429
|
initPaste();
|
|
@@ -662,6 +659,7 @@ var FormulaList = forwardRef(function (props, ref) {
|
|
|
662
659
|
return showNotExists(index);
|
|
663
660
|
},
|
|
664
661
|
children: [v.type, " ( * )", _jsx("span", {
|
|
662
|
+
className: 'item-del',
|
|
665
663
|
style: {
|
|
666
664
|
fontSize: 0
|
|
667
665
|
},
|
|
@@ -681,6 +679,7 @@ var FormulaList = forwardRef(function (props, ref) {
|
|
|
681
679
|
return showSubQuery(index);
|
|
682
680
|
},
|
|
683
681
|
children: [v.label || __('SqlQueryBuilder.subquery'), _jsx("span", {
|
|
682
|
+
className: 'item-del',
|
|
684
683
|
style: {
|
|
685
684
|
fontSize: 0
|
|
686
685
|
},
|
|
@@ -703,6 +702,7 @@ var FormulaList = forwardRef(function (props, ref) {
|
|
|
703
702
|
return handleField(e, index, v);
|
|
704
703
|
},
|
|
705
704
|
children: [!(v !== null && v !== void 0 && v.fieldName) && __('customColumn.selectField'), v.fieldName, _jsx("span", {
|
|
705
|
+
className: 'item-del',
|
|
706
706
|
style: {
|
|
707
707
|
fontSize: 0
|
|
708
708
|
},
|
|
@@ -726,6 +726,7 @@ var FormulaList = forwardRef(function (props, ref) {
|
|
|
726
726
|
handleConstant(val, index);
|
|
727
727
|
}
|
|
728
728
|
}), _jsx("span", {
|
|
729
|
+
className: 'item-del',
|
|
729
730
|
style: {
|
|
730
731
|
fontSize: 0
|
|
731
732
|
},
|
|
@@ -748,6 +749,7 @@ var FormulaList = forwardRef(function (props, ref) {
|
|
|
748
749
|
handleConstant(val, index);
|
|
749
750
|
}
|
|
750
751
|
}), _jsx("span", {
|
|
752
|
+
className: 'item-del',
|
|
751
753
|
style: {
|
|
752
754
|
fontSize: 0
|
|
753
755
|
},
|
|
@@ -770,6 +772,7 @@ var FormulaList = forwardRef(function (props, ref) {
|
|
|
770
772
|
notSelected: !v.val
|
|
771
773
|
}),
|
|
772
774
|
children: [!v.val && __('customColumn.selectOperator'), v.val, _jsx("span", {
|
|
775
|
+
className: 'item-del',
|
|
773
776
|
style: {
|
|
774
777
|
fontSize: 0
|
|
775
778
|
},
|
|
@@ -803,6 +806,7 @@ var FormulaList = forwardRef(function (props, ref) {
|
|
|
803
806
|
"v-val": v.id || v.val,
|
|
804
807
|
onClick: selectConstant,
|
|
805
808
|
children: [getConstantLabel(store.constantList, v.id || v.val, v.val) || __('SqlQueryBuilder.pickConstant'), _jsx("span", {
|
|
809
|
+
className: 'item-del',
|
|
806
810
|
style: {
|
|
807
811
|
fontSize: 0
|
|
808
812
|
},
|
|
@@ -829,6 +833,7 @@ var FormulaList = forwardRef(function (props, ref) {
|
|
|
829
833
|
"v-type": type,
|
|
830
834
|
onClick: selectConstant,
|
|
831
835
|
children: [getConstantLabel(listSource, v.id || v.val, v.val) || "\u8BF7\u9009\u62E9".concat(currentOtherType.label), _jsx("span", {
|
|
836
|
+
className: 'item-del',
|
|
832
837
|
style: {
|
|
833
838
|
fontSize: 0
|
|
834
839
|
},
|
|
@@ -858,6 +863,7 @@ var FormulaList = forwardRef(function (props, ref) {
|
|
|
858
863
|
return handleExpression(e, index, v);
|
|
859
864
|
},
|
|
860
865
|
children: [v.quotes ? v.quotes : __('customColumn.selectExpression'), _jsx("span", {
|
|
866
|
+
className: 'item-del',
|
|
861
867
|
style: {
|
|
862
868
|
fontSize: 0
|
|
863
869
|
},
|
|
@@ -879,6 +885,7 @@ var FormulaList = forwardRef(function (props, ref) {
|
|
|
879
885
|
return showFunction(e, index);
|
|
880
886
|
},
|
|
881
887
|
children: [v.name ? getQuotes(v, v.args, formulaList) : __('customColumn.selectFormula'), _jsx("span", {
|
|
888
|
+
className: 'item-del',
|
|
882
889
|
style: {
|
|
883
890
|
fontSize: 0
|
|
884
891
|
},
|
|
@@ -903,6 +910,7 @@ var FormulaList = forwardRef(function (props, ref) {
|
|
|
903
910
|
notSelected: !v.val
|
|
904
911
|
}),
|
|
905
912
|
children: [!v.val && __('customColumn.selectOperator'), v.val, !v.fixed && _jsx("span", {
|
|
913
|
+
className: 'item-del',
|
|
906
914
|
style: {
|
|
907
915
|
fontSize: 0
|
|
908
916
|
},
|
|
@@ -931,6 +939,7 @@ var FormulaList = forwardRef(function (props, ref) {
|
|
|
931
939
|
notSelected: true
|
|
932
940
|
}),
|
|
933
941
|
children: [__('customColumn.selectCustomInput'), _jsx("span", {
|
|
942
|
+
className: 'item-del',
|
|
934
943
|
style: {
|
|
935
944
|
fontSize: 0
|
|
936
945
|
},
|
|
@@ -948,16 +957,31 @@ var FormulaList = forwardRef(function (props, ref) {
|
|
|
948
957
|
};
|
|
949
958
|
var copyDom = function copyDom() {
|
|
950
959
|
var index = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : -1;
|
|
960
|
+
var positioned = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
|
951
961
|
if (!isCopy || selectedIndices.length === 0 && checkedItemsCount === 0) return null;
|
|
952
|
-
return _jsx(
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
962
|
+
return _jsx("div", {
|
|
963
|
+
className: cx('Sqb-Filter-item-copy', {
|
|
964
|
+
'Sqb-Filter-item-copy-static': !positioned
|
|
965
|
+
}),
|
|
966
|
+
onMouseEnter: function onMouseEnter() {
|
|
967
|
+
if (!positioned) return;
|
|
968
|
+
setHoveredCopyIndex(index);
|
|
969
|
+
},
|
|
970
|
+
onMouseLeave: function onMouseLeave() {
|
|
971
|
+
if (!positioned) return;
|
|
972
|
+
setHoveredCopyIndex(function (current) {
|
|
973
|
+
return current === index ? null : current;
|
|
974
|
+
});
|
|
975
|
+
},
|
|
976
|
+
children: _jsx(Tooltip, {
|
|
977
|
+
title: "\u5728\u6B64\u5904\u7C98\u8D34(".concat(selectedIndices.length || checkedItemsCount, ")\u9879"),
|
|
978
|
+
children: _jsx(Button, {
|
|
979
|
+
onClick: function onClick() {
|
|
980
|
+
return handlePaste(index);
|
|
981
|
+
},
|
|
982
|
+
iconOnly: true,
|
|
983
|
+
icon: _jsx(FfPlus, {})
|
|
984
|
+
})
|
|
961
985
|
})
|
|
962
986
|
});
|
|
963
987
|
};
|
|
@@ -1004,10 +1028,10 @@ var FormulaList = forwardRef(function (props, ref) {
|
|
|
1004
1028
|
children: "\u6E05\u9664\u590D\u5236"
|
|
1005
1029
|
})]
|
|
1006
1030
|
}), (_caseList2 = caseList) === null || _caseList2 === void 0 ? void 0 : _caseList2.map(function (v, i) {
|
|
1007
|
-
return
|
|
1008
|
-
children:
|
|
1031
|
+
return _jsx(React.Fragment, {
|
|
1032
|
+
children: _jsxs("div", {
|
|
1009
1033
|
className: cx('Sqb-Filter-item', {
|
|
1010
|
-
hover: ind === i,
|
|
1034
|
+
hover: ind === i && hoveredCopyIndex !== i,
|
|
1011
1035
|
'item-fixed': v.fixed || false,
|
|
1012
1036
|
'item-selected': isCheck
|
|
1013
1037
|
}),
|
|
@@ -1019,7 +1043,7 @@ var FormulaList = forwardRef(function (props, ref) {
|
|
|
1019
1043
|
if (isCheck) return;
|
|
1020
1044
|
setInd(-1);
|
|
1021
1045
|
},
|
|
1022
|
-
children: [selectOperator({
|
|
1046
|
+
children: [copyDom(i), selectOperator({
|
|
1023
1047
|
triggerElement: function triggerElement() {
|
|
1024
1048
|
return _jsx("div", {
|
|
1025
1049
|
className: 'left-arrow',
|
|
@@ -1048,7 +1072,7 @@ var FormulaList = forwardRef(function (props, ref) {
|
|
|
1048
1072
|
style: {
|
|
1049
1073
|
pointerEvents: isCheck || store.isMetabaseCopy ? 'none' : 'auto'
|
|
1050
1074
|
},
|
|
1051
|
-
className: cx({
|
|
1075
|
+
className: cx('Sqb-Filter-item-content', {
|
|
1052
1076
|
openCheck: isCheck
|
|
1053
1077
|
}),
|
|
1054
1078
|
children: itemDom(v, i)
|
|
@@ -1070,7 +1094,7 @@ var FormulaList = forwardRef(function (props, ref) {
|
|
|
1070
1094
|
position: 'after',
|
|
1071
1095
|
trigger: 'hover'
|
|
1072
1096
|
})]
|
|
1073
|
-
}, i)
|
|
1097
|
+
}, i)
|
|
1074
1098
|
}, i);
|
|
1075
1099
|
}), Array.from(caseList).length < 1 && selectOperator({
|
|
1076
1100
|
triggerElement: function triggerElement() {
|
|
@@ -1082,7 +1106,7 @@ var FormulaList = forwardRef(function (props, ref) {
|
|
|
1082
1106
|
ind: -1,
|
|
1083
1107
|
position: 'add',
|
|
1084
1108
|
trigger: 'click'
|
|
1085
|
-
}), copyDom(), showPreview && _jsx("div", {
|
|
1109
|
+
}), copyDom(-1, false), showPreview && _jsx("div", {
|
|
1086
1110
|
className: cx("mb-2 font-bold uppercase tracking-wider preview-box"),
|
|
1087
1111
|
style: {
|
|
1088
1112
|
fontSize: 12,
|
|
@@ -22,22 +22,32 @@
|
|
|
22
22
|
}
|
|
23
23
|
.Sqb-Filter-item {
|
|
24
24
|
position: relative;
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
25
|
+
&-content {
|
|
26
|
+
position: relative;
|
|
27
|
+
display: inline-flex;
|
|
28
|
+
align-items: center;
|
|
29
|
+
}
|
|
30
|
+
&-copy {
|
|
31
|
+
position: absolute;
|
|
32
|
+
left: -14px;
|
|
33
|
+
top: 50%;
|
|
34
|
+
transform: translate(-50%, -50%);
|
|
35
|
+
|
|
36
|
+
&-static {
|
|
37
|
+
position: static;
|
|
38
|
+
display: inline-flex;
|
|
39
|
+
align-items: center;
|
|
40
|
+
margin-bottom: 8px;
|
|
41
|
+
transform: none;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
38
44
|
.openCheck {
|
|
39
45
|
.Sqb-TableName {
|
|
40
|
-
padding-left:
|
|
46
|
+
padding-left: 28px;
|
|
47
|
+
|
|
48
|
+
.item-del {
|
|
49
|
+
display: none;
|
|
50
|
+
}
|
|
41
51
|
}
|
|
42
52
|
}
|
|
43
53
|
&.item-selected {
|
|
@@ -48,16 +58,21 @@
|
|
|
48
58
|
.item-check {
|
|
49
59
|
display: none;
|
|
50
60
|
position: absolute;
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
z-index:
|
|
61
|
+
left: 0;
|
|
62
|
+
top: 0;
|
|
63
|
+
z-index: 2;
|
|
54
64
|
margin: 0;
|
|
55
65
|
padding: 0;
|
|
56
66
|
width: 100%;
|
|
57
|
-
height:
|
|
67
|
+
height: calc(100% - 8px);
|
|
58
68
|
.pd-Checkbox-mask-wrapper {
|
|
59
|
-
margin
|
|
60
|
-
|
|
69
|
+
margin: 0;
|
|
70
|
+
width: 100%;
|
|
71
|
+
height: 100%;
|
|
72
|
+
display: flex;
|
|
73
|
+
align-items: center;
|
|
74
|
+
justify-content: flex-start;
|
|
75
|
+
padding-left: 8px;
|
|
61
76
|
}
|
|
62
77
|
}
|
|
63
78
|
}
|
|
@@ -312,6 +312,7 @@ var _isOk = function isOk(rhsVal) {
|
|
|
312
312
|
// 括号不匹配
|
|
313
313
|
export { _isOk as isOk };
|
|
314
314
|
function validateParentheses(list) {
|
|
315
|
+
console.log('🚀 ~ validateParentheses ~ list:', list);
|
|
315
316
|
var depth = 0;
|
|
316
317
|
var _iterator = _createForOfIteratorHelper(list),
|
|
317
318
|
_step;
|
|
@@ -208,11 +208,18 @@
|
|
|
208
208
|
top: 0;
|
|
209
209
|
transform: translate(50%, -50%);
|
|
210
210
|
margin: 0;
|
|
211
|
+
padding: 0;
|
|
211
212
|
border: none;
|
|
212
213
|
border-radius: 50%;
|
|
213
214
|
width: 20px;
|
|
214
215
|
height: 20px;
|
|
216
|
+
min-height: 20px;
|
|
215
217
|
font-size: 12px;
|
|
218
|
+
display: inline-flex;
|
|
219
|
+
align-items: center;
|
|
220
|
+
justify-content: center;
|
|
221
|
+
line-height: 1;
|
|
222
|
+
flex-shrink: 0;
|
|
216
223
|
}
|
|
217
224
|
&-input {
|
|
218
225
|
//输入框样式,稍微小了一点
|