@gingkoo/pandora-metabase 1.0.111 → 1.0.113
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/custom-editor/index.js +4 -0
- package/lib/cjs/components/dialog/formula/index.js +2 -1
- package/lib/cjs/components/dialog/formula-list/index.d.ts +1 -0
- package/lib/cjs/components/dialog/formula-list/index.js +66 -3
- package/lib/cjs/components/modules/components/meta-icon.js +20 -4
- package/lib/cjs/components/modules/filter.js +5 -6
- package/lib/cjs/components/modules/join-data.js +2 -0
- package/lib/cjs/types.d.ts +1 -0
- package/lib/es/components/dialog/custom-editor/index.js +4 -0
- package/lib/es/components/dialog/formula/index.js +2 -1
- package/lib/es/components/dialog/formula-list/index.d.ts +1 -0
- package/lib/es/components/dialog/formula-list/index.js +66 -3
- package/lib/es/components/modules/components/meta-icon.js +20 -4
- package/lib/es/components/modules/filter.js +5 -6
- package/lib/es/components/modules/join-data.js +2 -0
- package/lib/es/types.d.ts +1 -0
- package/package.json +1 -1
|
@@ -19,17 +19,20 @@ var _styledComponents = _interopRequireDefault(require("styled-components"));
|
|
|
19
19
|
var _types = require("../../../store/types");
|
|
20
20
|
var _pandora = require("@gingkoo/pandora");
|
|
21
21
|
var _utils2 = require("../../../utils");
|
|
22
|
+
var _useProvider = require("../../../hooks/use-provider");
|
|
22
23
|
var _templateObject; // import { getTemplate } from './utils';
|
|
23
24
|
// import { OptionsTypeEnum, customTypes, otherList, operatorList, functionList } from './enum';
|
|
24
25
|
var VisualBox = _styledComponents["default"].div.attrs({
|
|
25
26
|
className: 'visual-box'
|
|
26
27
|
})(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2["default"])([""])));
|
|
27
28
|
var CaseEditor = function CaseEditor(props) {
|
|
29
|
+
var _store$preProps;
|
|
28
30
|
var value = props.value,
|
|
29
31
|
data = props.data,
|
|
30
32
|
exitData = props.exitData,
|
|
31
33
|
onOk = props.onOk,
|
|
32
34
|
onCancel = props.onCancel;
|
|
35
|
+
var store = (0, _useProvider.useStore)();
|
|
33
36
|
// const [popup, setPopup] = useState<PopupType>({ visible: false }); // 弹框信息
|
|
34
37
|
var _useState = (0, _react.useState)(value.formulaList || []),
|
|
35
38
|
_useState2 = (0, _slicedToArray2["default"])(_useState, 2),
|
|
@@ -89,6 +92,7 @@ var CaseEditor = function CaseEditor(props) {
|
|
|
89
92
|
})]
|
|
90
93
|
}), (0, _jsxRuntime.jsx)(_formulaList["default"], {
|
|
91
94
|
isCustom: true,
|
|
95
|
+
otherTypes: (_store$preProps = store.preProps) === null || _store$preProps === void 0 ? void 0 : _store$preProps.otherTypes,
|
|
92
96
|
value: caseList,
|
|
93
97
|
data: data,
|
|
94
98
|
exitData: exitData,
|
|
@@ -186,7 +186,7 @@ var CaseEditor = _react["default"].forwardRef(function (props, ref) {
|
|
|
186
186
|
})]
|
|
187
187
|
}), fun === null || fun === void 0 || (_fun$args = fun.args) === null || _fun$args === void 0 ? void 0 : _fun$args.map(function (v, i) {
|
|
188
188
|
if (v.type === _types.AtomsTypeEnum.COLLECTION) {
|
|
189
|
-
var _formulaList$fun$name3;
|
|
189
|
+
var _store$preProps, _formulaList$fun$name3;
|
|
190
190
|
return (0, _jsxRuntime.jsxs)("div", {
|
|
191
191
|
className: 'Sqb-item-formula-args',
|
|
192
192
|
children: [(0, _jsxRuntime.jsxs)("div", {
|
|
@@ -199,6 +199,7 @@ var CaseEditor = _react["default"].forwardRef(function (props, ref) {
|
|
|
199
199
|
},
|
|
200
200
|
children: ["\u53C2\u6570", i + 1, ":"]
|
|
201
201
|
}), (0, _jsxRuntime.jsx)(_formulaList["default"], {
|
|
202
|
+
otherTypes: (_store$preProps = store.preProps) === null || _store$preProps === void 0 ? void 0 : _store$preProps.otherTypes,
|
|
202
203
|
check: (formulaList === null || formulaList === void 0 || (_formulaList$fun$name3 = formulaList[fun.name]) === null || _formulaList$fun$name3 === void 0 || (_formulaList$fun$name3 = _formulaList$fun$name3.args) === null || _formulaList$fun$name3 === void 0 || (_formulaList$fun$name3 = _formulaList$fun$name3[i]) === null || _formulaList$fun$name3 === void 0 ? void 0 : _formulaList$fun$name3.check) || '',
|
|
203
204
|
value: v.list,
|
|
204
205
|
data: data,
|
|
@@ -68,6 +68,8 @@ var FormulaList = (0, _react.forwardRef)(function (props, ref) {
|
|
|
68
68
|
onChange = props.onChange,
|
|
69
69
|
_props$customTypes = props.customTypes,
|
|
70
70
|
_customTypes = _props$customTypes === void 0 ? _utils3.customTypes : _props$customTypes,
|
|
71
|
+
_props$otherTypes = props.otherTypes,
|
|
72
|
+
otherTypes = _props$otherTypes === void 0 ? [] : _props$otherTypes,
|
|
71
73
|
_props$isCustom = props.isCustom,
|
|
72
74
|
isCustom = _props$isCustom === void 0 ? false : _props$isCustom,
|
|
73
75
|
_props$showPreview = props.showPreview,
|
|
@@ -75,6 +77,26 @@ var FormulaList = (0, _react.forwardRef)(function (props, ref) {
|
|
|
75
77
|
check = props.check,
|
|
76
78
|
_props$_type = props._type,
|
|
77
79
|
_type = _props$_type === void 0 ? 'filter' : _props$_type;
|
|
80
|
+
var mergedTypes = (0, _react.useMemo)(function () {
|
|
81
|
+
var map = new Map();
|
|
82
|
+
[].concat((0, _toConsumableArray2["default"])(_customTypes), (0, _toConsumableArray2["default"])(otherTypes)).forEach(function (item) {
|
|
83
|
+
var _item$value;
|
|
84
|
+
var key = String((_item$value = item === null || item === void 0 ? void 0 : item.value) !== null && _item$value !== void 0 ? _item$value : '');
|
|
85
|
+
if (!key) return;
|
|
86
|
+
map.set(key, item);
|
|
87
|
+
});
|
|
88
|
+
return Array.from(map.values());
|
|
89
|
+
}, [_customTypes, otherTypes]);
|
|
90
|
+
var otherTypeMap = (0, _react.useMemo)(function () {
|
|
91
|
+
var map = new Map();
|
|
92
|
+
(otherTypes || []).forEach(function (item) {
|
|
93
|
+
var _item$value2;
|
|
94
|
+
var key = String((_item$value2 = item === null || item === void 0 ? void 0 : item.value) !== null && _item$value2 !== void 0 ? _item$value2 : '');
|
|
95
|
+
if (!key) return;
|
|
96
|
+
map.set(key, item);
|
|
97
|
+
});
|
|
98
|
+
return map;
|
|
99
|
+
}, [otherTypes]);
|
|
78
100
|
var _useState3 = (0, _react.useState)((0, _cloneDeep["default"])(value)),
|
|
79
101
|
_useState4 = (0, _slicedToArray2["default"])(_useState3, 2),
|
|
80
102
|
caseList = _useState4[0],
|
|
@@ -252,7 +274,7 @@ var FormulaList = (0, _react.forwardRef)(function (props, ref) {
|
|
|
252
274
|
value: option,
|
|
253
275
|
children: option
|
|
254
276
|
}, index + '' + ind);
|
|
255
|
-
}) :
|
|
277
|
+
}) : mergedTypes.map(function (option, index) {
|
|
256
278
|
return (0, _jsxRuntime.jsx)(_pandora.Select.Option, {
|
|
257
279
|
value: option.value,
|
|
258
280
|
children: option.label
|
|
@@ -283,11 +305,17 @@ var FormulaList = (0, _react.forwardRef)(function (props, ref) {
|
|
|
283
305
|
// 常量
|
|
284
306
|
var handleConstant = function handleConstant(val, i) {
|
|
285
307
|
var _caseList = caseList.slice();
|
|
308
|
+
var currentItem = _caseList[i];
|
|
286
309
|
var oldVal = _caseList[i].val;
|
|
287
310
|
var oldType = _caseList[i].type;
|
|
311
|
+
var otherTypeConfig = otherTypeMap.get(String(oldType));
|
|
288
312
|
if (oldType === _types.AtomsTypeEnum.CONSTANT) {
|
|
289
313
|
_caseList[i].id = val;
|
|
290
314
|
_caseList[i].val = (0, _utils3.getConstantLabel)(store.constantList, val);
|
|
315
|
+
} else if (otherTypeConfig) {
|
|
316
|
+
var sourceList = (currentItem === null || currentItem === void 0 ? void 0 : currentItem.list) || otherTypeConfig.list || [];
|
|
317
|
+
_caseList[i].id = val;
|
|
318
|
+
_caseList[i].val = (0, _utils3.getConstantLabel)(sourceList, val);
|
|
291
319
|
} else {
|
|
292
320
|
_caseList[i].val = val;
|
|
293
321
|
}
|
|
@@ -447,7 +475,12 @@ var FormulaList = (0, _react.forwardRef)(function (props, ref) {
|
|
|
447
475
|
var addOperator = function addOperator(type, index, position) {
|
|
448
476
|
var _caseList = caseList.slice() || [];
|
|
449
477
|
var _ind = index;
|
|
450
|
-
var
|
|
478
|
+
var otherTypeConfig = otherTypeMap.get(String(type));
|
|
479
|
+
var temItem = otherTypeConfig ? {
|
|
480
|
+
id: '',
|
|
481
|
+
val: '',
|
|
482
|
+
type: type
|
|
483
|
+
} : (0, _utils3.getTemplateItem)(type);
|
|
451
484
|
if (position === 'add') {
|
|
452
485
|
_caseList.push(temItem);
|
|
453
486
|
_ind = index + 1;
|
|
@@ -571,13 +604,17 @@ var FormulaList = (0, _react.forwardRef)(function (props, ref) {
|
|
|
571
604
|
var node = e.currentTarget;
|
|
572
605
|
var _ind = Number(node.getAttribute('v-index'));
|
|
573
606
|
var _val = node.getAttribute('v-val');
|
|
607
|
+
var _type = node.getAttribute('v-type') || '';
|
|
608
|
+
var currentItem = caseList[_ind];
|
|
609
|
+
var otherTypeConfig = otherTypeMap.get(_type);
|
|
610
|
+
var listSource = (currentItem === null || currentItem === void 0 ? void 0 : currentItem.list) || (otherTypeConfig === null || otherTypeConfig === void 0 ? void 0 : otherTypeConfig.list) || store.constantList || [];
|
|
574
611
|
store.setPopup({
|
|
575
612
|
visible: true,
|
|
576
613
|
node: e.currentTarget,
|
|
577
614
|
container: ref === null || ref === void 0 ? void 0 : ref.current,
|
|
578
615
|
content: (0, _jsxRuntime.jsx)(_selectList["default"], {
|
|
579
616
|
value: _val,
|
|
580
|
-
list:
|
|
617
|
+
list: listSource,
|
|
581
618
|
onChange: function onChange(val) {
|
|
582
619
|
closePopup();
|
|
583
620
|
handleConstant(val, _ind);
|
|
@@ -785,6 +822,32 @@ var FormulaList = (0, _react.forwardRef)(function (props, ref) {
|
|
|
785
822
|
})]
|
|
786
823
|
})
|
|
787
824
|
}, index);
|
|
825
|
+
} else if (otherTypeMap.has(String(type))) {
|
|
826
|
+
// 业务自定义常量类型(otherTypes)
|
|
827
|
+
var currentOtherType = otherTypeMap.get(String(type));
|
|
828
|
+
var listSource = (currentOtherType === null || currentOtherType === void 0 ? void 0 : currentOtherType.list) || [];
|
|
829
|
+
return (0, _jsxRuntime.jsx)(_itemName["default"], {
|
|
830
|
+
isError: !!(v.id || v.val) && !(0, _utils3.getConstantLabel)(listSource, v.id || v.val),
|
|
831
|
+
message: "\u5E38\u91CF\u4E22\u5931",
|
|
832
|
+
children: (0, _jsxRuntime.jsxs)("div", {
|
|
833
|
+
className: (0, _classnames["default"])("Sqb-TableName", {
|
|
834
|
+
notSelected: !v.val
|
|
835
|
+
}),
|
|
836
|
+
"v-index": index,
|
|
837
|
+
"v-val": v.id || v.val,
|
|
838
|
+
"v-type": type,
|
|
839
|
+
onClick: selectConstant,
|
|
840
|
+
children: [(0, _utils3.getConstantLabel)(listSource, v.id || v.val, v.val) || "\u8BF7\u9009\u62E9".concat(currentOtherType.label), (0, _jsxRuntime.jsx)("span", {
|
|
841
|
+
style: {
|
|
842
|
+
fontSize: 0
|
|
843
|
+
},
|
|
844
|
+
onClick: function onClick(e) {
|
|
845
|
+
return handleDel(e, index);
|
|
846
|
+
},
|
|
847
|
+
children: (0, _jsxRuntime.jsx)(_icons.CloseIcon, {})
|
|
848
|
+
})]
|
|
849
|
+
})
|
|
850
|
+
}, index);
|
|
788
851
|
} else if (type === _types.AtomsTypeEnum.EXPRESSION) {
|
|
789
852
|
if (~['早于', '晚于', '在'].indexOf(v.condition) && v.rhs.length > 1) {
|
|
790
853
|
var _caseList$index$quote;
|
|
@@ -382,10 +382,26 @@ var NextDom = function NextDom(props) {
|
|
|
382
382
|
className: "Sqb-item--func",
|
|
383
383
|
children: sortList(available).filter(function (v) {
|
|
384
384
|
return ~store.toolbar.indexOf(v);
|
|
385
|
-
}).map(function (v) {
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
385
|
+
}).map(function (v, idx) {
|
|
386
|
+
var info = IconTypeMap.get(v);
|
|
387
|
+
return (0, _jsxRuntime.jsx)(_pandora.Tooltip, {
|
|
388
|
+
title: size === IconSIzeEnum.SMALL ? info.name : '',
|
|
389
|
+
placement: 'top',
|
|
390
|
+
children: (0, _jsxRuntime.jsx)("button", {
|
|
391
|
+
className: (0, _classnames["default"])("Sqb-button ".concat(info.className || ''), {
|
|
392
|
+
small: size === IconSIzeEnum.SMALL,
|
|
393
|
+
large: size === IconSIzeEnum.LARGE
|
|
394
|
+
}),
|
|
395
|
+
onClick: function onClick() {
|
|
396
|
+
return handleClick(v);
|
|
397
|
+
},
|
|
398
|
+
children: (0, _jsxRuntime.jsxs)("div", {
|
|
399
|
+
children: [info.icon, size === IconSIzeEnum.LARGE ? (0, _jsxRuntime.jsx)("div", {
|
|
400
|
+
children: info.name
|
|
401
|
+
}) : '']
|
|
402
|
+
})
|
|
403
|
+
})
|
|
404
|
+
}, "".concat(String(v), "-").concat(idx));
|
|
389
405
|
})
|
|
390
406
|
})]
|
|
391
407
|
});
|
|
@@ -27,7 +27,9 @@ var Filter = function Filter(props) {
|
|
|
27
27
|
groupIndex = props.groupIndex;
|
|
28
28
|
var store = (0, _useProvider.useStore)();
|
|
29
29
|
var filter = meta.filter;
|
|
30
|
-
var
|
|
30
|
+
var _store$preProps = store.preProps,
|
|
31
|
+
notExistsColumns = _store$preProps.notExistsColumns,
|
|
32
|
+
otherTypes = _store$preProps.otherTypes;
|
|
31
33
|
// const filterCustomType = store.filterCustomType;
|
|
32
34
|
var index = (0, _utils.findIndex)(store.metaList[groupIndex].list, meta);
|
|
33
35
|
// let notSelected = !meta.filter.length;
|
|
@@ -186,11 +188,8 @@ var Filter = function Filter(props) {
|
|
|
186
188
|
groupIndex: groupIndex,
|
|
187
189
|
children: (0, _jsxRuntime.jsx)("div", {
|
|
188
190
|
className: "Sqb-item--content",
|
|
189
|
-
children: (0, _jsxRuntime.jsx)(_formulaList["default"]
|
|
190
|
-
|
|
191
|
-
// operatorList={operatorList}
|
|
192
|
-
, {
|
|
193
|
-
// customTypes={customTypes}
|
|
191
|
+
children: (0, _jsxRuntime.jsx)(_formulaList["default"], {
|
|
192
|
+
otherTypes: otherTypes,
|
|
194
193
|
// operatorList={operatorList}
|
|
195
194
|
value: filter,
|
|
196
195
|
data: getPreColumns(),
|
|
@@ -1843,6 +1843,7 @@ var JoinData = function JoinData(props) {
|
|
|
1843
1843
|
}, i);
|
|
1844
1844
|
}
|
|
1845
1845
|
if (v.type === _types.AtomsTypeEnum.COLLECTION) {
|
|
1846
|
+
var _store$preProps5;
|
|
1846
1847
|
return (0, _jsxRuntime.jsxs)("div", {
|
|
1847
1848
|
className: (0, _classnames["default"])(" Sqb-collection-box"),
|
|
1848
1849
|
children: [i == 0 && (0, _jsxRuntime.jsx)("span", {
|
|
@@ -1850,6 +1851,7 @@ var JoinData = function JoinData(props) {
|
|
|
1850
1851
|
children: "on"
|
|
1851
1852
|
}), (0, _jsxRuntime.jsx)(_dialog.FormulaList, {
|
|
1852
1853
|
_type: _types.FormulaTypeEnum.JOIN_DATA,
|
|
1854
|
+
otherTypes: (_store$preProps5 = store.preProps) === null || _store$preProps5 === void 0 ? void 0 : _store$preProps5.otherTypes,
|
|
1853
1855
|
// showPreview={false}
|
|
1854
1856
|
// check={formulaList?.[fun.name]?.args?.[i]?.check || ''}
|
|
1855
1857
|
value: v.list,
|
package/lib/cjs/types.d.ts
CHANGED
|
@@ -15,15 +15,18 @@ import Styled from 'styled-components';
|
|
|
15
15
|
import { FormulaTypeEnum } from '../../../store/types';
|
|
16
16
|
import { Input, Toast } from '@gingkoo/pandora';
|
|
17
17
|
import { isValidSQLAlias } from '../../../utils';
|
|
18
|
+
import { useStore } from '../../../hooks/use-provider';
|
|
18
19
|
var VisualBox = Styled.div.attrs({
|
|
19
20
|
className: 'visual-box'
|
|
20
21
|
})(_templateObject || (_templateObject = _taggedTemplateLiteral([""])));
|
|
21
22
|
var CaseEditor = function CaseEditor(props) {
|
|
23
|
+
var _store$preProps;
|
|
22
24
|
var value = props.value,
|
|
23
25
|
data = props.data,
|
|
24
26
|
exitData = props.exitData,
|
|
25
27
|
onOk = props.onOk,
|
|
26
28
|
onCancel = props.onCancel;
|
|
29
|
+
var store = useStore();
|
|
27
30
|
// const [popup, setPopup] = useState<PopupType>({ visible: false }); // 弹框信息
|
|
28
31
|
var _useState = useState(value.formulaList || []),
|
|
29
32
|
_useState2 = _slicedToArray(_useState, 2),
|
|
@@ -83,6 +86,7 @@ var CaseEditor = function CaseEditor(props) {
|
|
|
83
86
|
})]
|
|
84
87
|
}), _jsx(FormulaList, {
|
|
85
88
|
isCustom: true,
|
|
89
|
+
otherTypes: (_store$preProps = store.preProps) === null || _store$preProps === void 0 ? void 0 : _store$preProps.otherTypes,
|
|
86
90
|
value: caseList,
|
|
87
91
|
data: data,
|
|
88
92
|
exitData: exitData,
|
|
@@ -178,7 +178,7 @@ var CaseEditor = React.forwardRef(function (props, ref) {
|
|
|
178
178
|
})]
|
|
179
179
|
}), fun === null || fun === void 0 || (_fun$args = fun.args) === null || _fun$args === void 0 ? void 0 : _fun$args.map(function (v, i) {
|
|
180
180
|
if (v.type === AtomsTypeEnum.COLLECTION) {
|
|
181
|
-
var _formulaList$fun$name3;
|
|
181
|
+
var _store$preProps, _formulaList$fun$name3;
|
|
182
182
|
return _jsxs("div", {
|
|
183
183
|
className: 'Sqb-item-formula-args',
|
|
184
184
|
children: [_jsxs("div", {
|
|
@@ -191,6 +191,7 @@ var CaseEditor = React.forwardRef(function (props, ref) {
|
|
|
191
191
|
},
|
|
192
192
|
children: ["\u53C2\u6570", i + 1, ":"]
|
|
193
193
|
}), _jsx(FormulaList, {
|
|
194
|
+
otherTypes: (_store$preProps = store.preProps) === null || _store$preProps === void 0 ? void 0 : _store$preProps.otherTypes,
|
|
194
195
|
check: (formulaList === null || formulaList === void 0 || (_formulaList$fun$name3 = formulaList[fun.name]) === null || _formulaList$fun$name3 === void 0 || (_formulaList$fun$name3 = _formulaList$fun$name3.args) === null || _formulaList$fun$name3 === void 0 || (_formulaList$fun$name3 = _formulaList$fun$name3[i]) === null || _formulaList$fun$name3 === void 0 ? void 0 : _formulaList$fun$name3.check) || '',
|
|
195
196
|
value: v.list,
|
|
196
197
|
data: data,
|
|
@@ -60,6 +60,8 @@ var FormulaList = forwardRef(function (props, ref) {
|
|
|
60
60
|
onChange = props.onChange,
|
|
61
61
|
_props$customTypes = props.customTypes,
|
|
62
62
|
_customTypes = _props$customTypes === void 0 ? customTypes : _props$customTypes,
|
|
63
|
+
_props$otherTypes = props.otherTypes,
|
|
64
|
+
otherTypes = _props$otherTypes === void 0 ? [] : _props$otherTypes,
|
|
63
65
|
_props$isCustom = props.isCustom,
|
|
64
66
|
isCustom = _props$isCustom === void 0 ? false : _props$isCustom,
|
|
65
67
|
_props$showPreview = props.showPreview,
|
|
@@ -67,6 +69,26 @@ var FormulaList = forwardRef(function (props, ref) {
|
|
|
67
69
|
check = props.check,
|
|
68
70
|
_props$_type = props._type,
|
|
69
71
|
_type = _props$_type === void 0 ? 'filter' : _props$_type;
|
|
72
|
+
var mergedTypes = useMemo(function () {
|
|
73
|
+
var map = new Map();
|
|
74
|
+
[].concat(_toConsumableArray(_customTypes), _toConsumableArray(otherTypes)).forEach(function (item) {
|
|
75
|
+
var _item$value;
|
|
76
|
+
var key = String((_item$value = item === null || item === void 0 ? void 0 : item.value) !== null && _item$value !== void 0 ? _item$value : '');
|
|
77
|
+
if (!key) return;
|
|
78
|
+
map.set(key, item);
|
|
79
|
+
});
|
|
80
|
+
return Array.from(map.values());
|
|
81
|
+
}, [_customTypes, otherTypes]);
|
|
82
|
+
var otherTypeMap = useMemo(function () {
|
|
83
|
+
var map = new Map();
|
|
84
|
+
(otherTypes || []).forEach(function (item) {
|
|
85
|
+
var _item$value2;
|
|
86
|
+
var key = String((_item$value2 = item === null || item === void 0 ? void 0 : item.value) !== null && _item$value2 !== void 0 ? _item$value2 : '');
|
|
87
|
+
if (!key) return;
|
|
88
|
+
map.set(key, item);
|
|
89
|
+
});
|
|
90
|
+
return map;
|
|
91
|
+
}, [otherTypes]);
|
|
70
92
|
var _useState3 = useState(cloneDeep(value)),
|
|
71
93
|
_useState4 = _slicedToArray(_useState3, 2),
|
|
72
94
|
caseList = _useState4[0],
|
|
@@ -244,7 +266,7 @@ var FormulaList = forwardRef(function (props, ref) {
|
|
|
244
266
|
value: option,
|
|
245
267
|
children: option
|
|
246
268
|
}, index + '' + ind);
|
|
247
|
-
}) :
|
|
269
|
+
}) : mergedTypes.map(function (option, index) {
|
|
248
270
|
return _jsx(Select.Option, {
|
|
249
271
|
value: option.value,
|
|
250
272
|
children: option.label
|
|
@@ -275,11 +297,17 @@ var FormulaList = forwardRef(function (props, ref) {
|
|
|
275
297
|
// 常量
|
|
276
298
|
var handleConstant = function handleConstant(val, i) {
|
|
277
299
|
var _caseList = caseList.slice();
|
|
300
|
+
var currentItem = _caseList[i];
|
|
278
301
|
var oldVal = _caseList[i].val;
|
|
279
302
|
var oldType = _caseList[i].type;
|
|
303
|
+
var otherTypeConfig = otherTypeMap.get(String(oldType));
|
|
280
304
|
if (oldType === AtomsTypeEnum.CONSTANT) {
|
|
281
305
|
_caseList[i].id = val;
|
|
282
306
|
_caseList[i].val = getConstantLabel(store.constantList, val);
|
|
307
|
+
} else if (otherTypeConfig) {
|
|
308
|
+
var sourceList = (currentItem === null || currentItem === void 0 ? void 0 : currentItem.list) || otherTypeConfig.list || [];
|
|
309
|
+
_caseList[i].id = val;
|
|
310
|
+
_caseList[i].val = getConstantLabel(sourceList, val);
|
|
283
311
|
} else {
|
|
284
312
|
_caseList[i].val = val;
|
|
285
313
|
}
|
|
@@ -439,7 +467,12 @@ var FormulaList = forwardRef(function (props, ref) {
|
|
|
439
467
|
var addOperator = function addOperator(type, index, position) {
|
|
440
468
|
var _caseList = caseList.slice() || [];
|
|
441
469
|
var _ind = index;
|
|
442
|
-
var
|
|
470
|
+
var otherTypeConfig = otherTypeMap.get(String(type));
|
|
471
|
+
var temItem = otherTypeConfig ? {
|
|
472
|
+
id: '',
|
|
473
|
+
val: '',
|
|
474
|
+
type: type
|
|
475
|
+
} : getTemplateItem(type);
|
|
443
476
|
if (position === 'add') {
|
|
444
477
|
_caseList.push(temItem);
|
|
445
478
|
_ind = index + 1;
|
|
@@ -563,13 +596,17 @@ var FormulaList = forwardRef(function (props, ref) {
|
|
|
563
596
|
var node = e.currentTarget;
|
|
564
597
|
var _ind = Number(node.getAttribute('v-index'));
|
|
565
598
|
var _val = node.getAttribute('v-val');
|
|
599
|
+
var _type = node.getAttribute('v-type') || '';
|
|
600
|
+
var currentItem = caseList[_ind];
|
|
601
|
+
var otherTypeConfig = otherTypeMap.get(_type);
|
|
602
|
+
var listSource = (currentItem === null || currentItem === void 0 ? void 0 : currentItem.list) || (otherTypeConfig === null || otherTypeConfig === void 0 ? void 0 : otherTypeConfig.list) || store.constantList || [];
|
|
566
603
|
store.setPopup({
|
|
567
604
|
visible: true,
|
|
568
605
|
node: e.currentTarget,
|
|
569
606
|
container: ref === null || ref === void 0 ? void 0 : ref.current,
|
|
570
607
|
content: _jsx(SelectList, {
|
|
571
608
|
value: _val,
|
|
572
|
-
list:
|
|
609
|
+
list: listSource,
|
|
573
610
|
onChange: function onChange(val) {
|
|
574
611
|
closePopup();
|
|
575
612
|
handleConstant(val, _ind);
|
|
@@ -777,6 +814,32 @@ var FormulaList = forwardRef(function (props, ref) {
|
|
|
777
814
|
})]
|
|
778
815
|
})
|
|
779
816
|
}, index);
|
|
817
|
+
} else if (otherTypeMap.has(String(type))) {
|
|
818
|
+
// 业务自定义常量类型(otherTypes)
|
|
819
|
+
var currentOtherType = otherTypeMap.get(String(type));
|
|
820
|
+
var listSource = (currentOtherType === null || currentOtherType === void 0 ? void 0 : currentOtherType.list) || [];
|
|
821
|
+
return _jsx(ItemName, {
|
|
822
|
+
isError: !!(v.id || v.val) && !getConstantLabel(listSource, v.id || v.val),
|
|
823
|
+
message: "\u5E38\u91CF\u4E22\u5931",
|
|
824
|
+
children: _jsxs("div", {
|
|
825
|
+
className: cx("Sqb-TableName", {
|
|
826
|
+
notSelected: !v.val
|
|
827
|
+
}),
|
|
828
|
+
"v-index": index,
|
|
829
|
+
"v-val": v.id || v.val,
|
|
830
|
+
"v-type": type,
|
|
831
|
+
onClick: selectConstant,
|
|
832
|
+
children: [getConstantLabel(listSource, v.id || v.val, v.val) || "\u8BF7\u9009\u62E9".concat(currentOtherType.label), _jsx("span", {
|
|
833
|
+
style: {
|
|
834
|
+
fontSize: 0
|
|
835
|
+
},
|
|
836
|
+
onClick: function onClick(e) {
|
|
837
|
+
return handleDel(e, index);
|
|
838
|
+
},
|
|
839
|
+
children: _jsx(CloseIcon, {})
|
|
840
|
+
})]
|
|
841
|
+
})
|
|
842
|
+
}, index);
|
|
780
843
|
} else if (type === AtomsTypeEnum.EXPRESSION) {
|
|
781
844
|
if (~['早于', '晚于', '在'].indexOf(v.condition) && v.rhs.length > 1) {
|
|
782
845
|
var _caseList$index$quote;
|
|
@@ -372,10 +372,26 @@ var NextDom = function NextDom(props) {
|
|
|
372
372
|
className: "Sqb-item--func",
|
|
373
373
|
children: sortList(available).filter(function (v) {
|
|
374
374
|
return ~store.toolbar.indexOf(v);
|
|
375
|
-
}).map(function (v) {
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
375
|
+
}).map(function (v, idx) {
|
|
376
|
+
var info = IconTypeMap.get(v);
|
|
377
|
+
return _jsx(Tooltip, {
|
|
378
|
+
title: size === IconSIzeEnum.SMALL ? info.name : '',
|
|
379
|
+
placement: 'top',
|
|
380
|
+
children: _jsx("button", {
|
|
381
|
+
className: cx("Sqb-button ".concat(info.className || ''), {
|
|
382
|
+
small: size === IconSIzeEnum.SMALL,
|
|
383
|
+
large: size === IconSIzeEnum.LARGE
|
|
384
|
+
}),
|
|
385
|
+
onClick: function onClick() {
|
|
386
|
+
return handleClick(v);
|
|
387
|
+
},
|
|
388
|
+
children: _jsxs("div", {
|
|
389
|
+
children: [info.icon, size === IconSIzeEnum.LARGE ? _jsx("div", {
|
|
390
|
+
children: info.name
|
|
391
|
+
}) : '']
|
|
392
|
+
})
|
|
393
|
+
})
|
|
394
|
+
}, "".concat(String(v), "-").concat(idx));
|
|
379
395
|
})
|
|
380
396
|
})]
|
|
381
397
|
});
|
|
@@ -19,7 +19,9 @@ var Filter = function Filter(props) {
|
|
|
19
19
|
groupIndex = props.groupIndex;
|
|
20
20
|
var store = useStore();
|
|
21
21
|
var filter = meta.filter;
|
|
22
|
-
var
|
|
22
|
+
var _store$preProps = store.preProps,
|
|
23
|
+
notExistsColumns = _store$preProps.notExistsColumns,
|
|
24
|
+
otherTypes = _store$preProps.otherTypes;
|
|
23
25
|
// const filterCustomType = store.filterCustomType;
|
|
24
26
|
var index = findIndex(store.metaList[groupIndex].list, meta);
|
|
25
27
|
// let notSelected = !meta.filter.length;
|
|
@@ -178,11 +180,8 @@ var Filter = function Filter(props) {
|
|
|
178
180
|
groupIndex: groupIndex,
|
|
179
181
|
children: _jsx("div", {
|
|
180
182
|
className: "Sqb-item--content",
|
|
181
|
-
children: _jsx(FormulaList
|
|
182
|
-
|
|
183
|
-
// operatorList={operatorList}
|
|
184
|
-
, {
|
|
185
|
-
// customTypes={customTypes}
|
|
183
|
+
children: _jsx(FormulaList, {
|
|
184
|
+
otherTypes: otherTypes,
|
|
186
185
|
// operatorList={operatorList}
|
|
187
186
|
value: filter,
|
|
188
187
|
data: getPreColumns(),
|
|
@@ -1838,6 +1838,7 @@ var JoinData = function JoinData(props) {
|
|
|
1838
1838
|
}, i);
|
|
1839
1839
|
}
|
|
1840
1840
|
if (v.type === AtomsTypeEnum.COLLECTION) {
|
|
1841
|
+
var _store$preProps5;
|
|
1841
1842
|
return _jsxs("div", {
|
|
1842
1843
|
className: cx(" Sqb-collection-box"),
|
|
1843
1844
|
children: [i == 0 && _jsx("span", {
|
|
@@ -1845,6 +1846,7 @@ var JoinData = function JoinData(props) {
|
|
|
1845
1846
|
children: "on"
|
|
1846
1847
|
}), _jsx(FormulaList, {
|
|
1847
1848
|
_type: FormulaTypeEnum.JOIN_DATA,
|
|
1849
|
+
otherTypes: (_store$preProps5 = store.preProps) === null || _store$preProps5 === void 0 ? void 0 : _store$preProps5.otherTypes,
|
|
1848
1850
|
// showPreview={false}
|
|
1849
1851
|
// check={formulaList?.[fun.name]?.args?.[i]?.check || ''}
|
|
1850
1852
|
value: v.list,
|
package/lib/es/types.d.ts
CHANGED