@gingkoo/pandora-metabase 1.0.81 → 1.0.83
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 +139 -74
- package/lib/cjs/components/dialog/formula-list/index.less +13 -0
- package/lib/cjs/components/metabase/index.js +26 -4
- package/lib/cjs/components/metabase/index.less +32 -1
- package/lib/cjs/components/modules/components/header.d.ts +2 -0
- package/lib/cjs/components/modules/components/header.js +11 -6
- package/lib/cjs/components/modules/components/item-wrapper.d.ts +9 -0
- package/lib/cjs/components/modules/components/item-wrapper.js +45 -0
- package/lib/cjs/components/modules/components/meta-icon.d.ts +11 -0
- package/lib/cjs/components/modules/components/meta-icon.js +60 -12
- package/lib/cjs/components/modules/custom-column.js +34 -28
- package/lib/cjs/components/modules/filter.js +18 -12
- package/lib/cjs/components/modules/join-data.js +417 -411
- package/lib/cjs/components/modules/permission-table.js +17 -11
- package/lib/cjs/components/modules/row-limit.js +18 -12
- package/lib/cjs/components/modules/sort.js +33 -27
- package/lib/cjs/components/modules/summarize/index.js +26 -20
- package/lib/cjs/components/modules/table-data.js +137 -131
- package/lib/cjs/components/modules/union.js +14 -8
- package/lib/cjs/hooks/use-state.js +84 -31
- package/lib/cjs/index.js +9 -3
- package/lib/cjs/locale/en.js +5 -3
- package/lib/cjs/locale/zh.js +5 -3
- package/lib/cjs/types.d.ts +2 -0
- package/lib/cjs/utils/storage.d.ts +1 -0
- package/lib/cjs/utils/storage.js +2 -1
- package/lib/cjs/utils.d.ts +6 -0
- package/lib/cjs/utils.js +23 -3
- package/lib/es/components/dialog/formula-list/index.js +139 -76
- package/lib/es/components/dialog/formula-list/index.less +13 -0
- package/lib/es/components/metabase/index.js +26 -4
- package/lib/es/components/metabase/index.less +32 -1
- package/lib/es/components/modules/components/header.d.ts +2 -0
- package/lib/es/components/modules/components/header.js +12 -7
- package/lib/es/components/modules/components/item-wrapper.d.ts +9 -0
- package/lib/es/components/modules/components/item-wrapper.js +38 -0
- package/lib/es/components/modules/components/meta-icon.d.ts +11 -0
- package/lib/es/components/modules/components/meta-icon.js +60 -14
- package/lib/es/components/modules/custom-column.js +34 -28
- package/lib/es/components/modules/filter.js +18 -12
- package/lib/es/components/modules/join-data.js +417 -411
- package/lib/es/components/modules/permission-table.js +17 -11
- package/lib/es/components/modules/row-limit.js +18 -12
- package/lib/es/components/modules/sort.js +33 -27
- package/lib/es/components/modules/summarize/index.js +26 -20
- package/lib/es/components/modules/table-data.js +137 -131
- package/lib/es/components/modules/union.js +14 -8
- package/lib/es/hooks/use-state.js +84 -31
- package/lib/es/index.js +9 -3
- package/lib/es/locale/en.js +5 -3
- package/lib/es/locale/zh.js +5 -3
- package/lib/es/types.d.ts +2 -0
- package/lib/es/utils/storage.d.ts +1 -0
- package/lib/es/utils/storage.js +2 -1
- package/lib/es/utils.d.ts +6 -0
- package/lib/es/utils.js +21 -1
- package/package.json +1 -1
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
2
2
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
3
|
+
import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
|
|
3
4
|
import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
|
|
4
5
|
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
5
6
|
var _excluded = ["notExistsToolbar", "toolbar"],
|
|
6
7
|
_excluded2 = ["subToolbar", "notExistsColumns", "showFields", "isExit", "toolbar"];
|
|
8
|
+
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
7
9
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
8
|
-
import { useEffect, useState, useRef, forwardRef } from 'react';
|
|
10
|
+
import React, { useEffect, useState, useRef, forwardRef } from 'react';
|
|
9
11
|
import './index.less';
|
|
10
|
-
import { FieldString, FieldNumber } from '@gingkoo/pandora-icons';
|
|
12
|
+
import { FieldString, FieldNumber, FfPlus } from '@gingkoo/pandora-icons';
|
|
11
13
|
import cx from 'classnames';
|
|
12
14
|
// import './index.less';
|
|
13
15
|
import Metabase from '../../../index';
|
|
@@ -15,7 +17,7 @@ import { __ } from '../../../locale';
|
|
|
15
17
|
import isEqual from 'lodash/isEqual';
|
|
16
18
|
import { AtomsTypeEnum, FormulaTypeEnum } from '../../../store/types';
|
|
17
19
|
import { ColumnsPopupThemeEnum } from '../../../store/enum';
|
|
18
|
-
import { Select, Input, Modal2, Modal, InputNumber, Radio, Space, Button, Checkbox } from '@gingkoo/pandora';
|
|
20
|
+
import { Select, Input, Modal2, Modal, InputNumber, Radio, Space, Button, Checkbox, Tooltip } from '@gingkoo/pandora';
|
|
19
21
|
import cloneDeep from 'lodash/cloneDeep';
|
|
20
22
|
import { buildSqlQuery, isError, changeCopyField } from '../../../utils';
|
|
21
23
|
import Formula from '../formula';
|
|
@@ -309,12 +311,17 @@ var FormulaList = forwardRef(function (props, ref) {
|
|
|
309
311
|
}
|
|
310
312
|
// 粘贴到末尾并清除勾选
|
|
311
313
|
function handlePaste() {
|
|
314
|
+
var index = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : -1;
|
|
312
315
|
var _caseList = caseList.slice();
|
|
313
316
|
// determine items to paste (selected items have priority)
|
|
314
317
|
var itemsToPaste = storage._metabaseCopyItems || [];
|
|
315
318
|
itemsToPaste = changeCopyField(itemsToPaste, data);
|
|
316
319
|
if (itemsToPaste.length) {
|
|
317
|
-
|
|
320
|
+
if (index === -1) {
|
|
321
|
+
_caseList.push.apply(_caseList, _toConsumableArray(itemsToPaste));
|
|
322
|
+
} else {
|
|
323
|
+
_caseList.splice.apply(_caseList, [index, 0].concat(_toConsumableArray(itemsToPaste)));
|
|
324
|
+
}
|
|
318
325
|
setCaseList(_caseList);
|
|
319
326
|
}
|
|
320
327
|
initPaste();
|
|
@@ -357,6 +364,38 @@ var FormulaList = forwardRef(function (props, ref) {
|
|
|
357
364
|
setSelectedIndices(allIndices);
|
|
358
365
|
setLocalItem(allIndices);
|
|
359
366
|
};
|
|
367
|
+
var delSelect = function delSelect() {
|
|
368
|
+
Modal.confirm({
|
|
369
|
+
title: __('metabase.prompt'),
|
|
370
|
+
// 提示
|
|
371
|
+
content: __('customColumn.confirmDelete'),
|
|
372
|
+
// 确认删除吗
|
|
373
|
+
onOk: function () {
|
|
374
|
+
var _onOk = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
375
|
+
var _caseList;
|
|
376
|
+
return _regeneratorRuntime.wrap(function (_context) {
|
|
377
|
+
while (1) switch (_context.prev = _context.next) {
|
|
378
|
+
case 0:
|
|
379
|
+
_caseList = caseList.slice(); // 删除选中项,selectedIndices 已经是排序好的了
|
|
380
|
+
selectedIndices.forEach(function (i) {
|
|
381
|
+
_caseList.splice(i, 1);
|
|
382
|
+
});
|
|
383
|
+
setCaseList(_caseList);
|
|
384
|
+
initPaste();
|
|
385
|
+
case 1:
|
|
386
|
+
case "end":
|
|
387
|
+
return _context.stop();
|
|
388
|
+
}
|
|
389
|
+
}, _callee);
|
|
390
|
+
}));
|
|
391
|
+
function onOk() {
|
|
392
|
+
return _onOk.apply(this, arguments);
|
|
393
|
+
}
|
|
394
|
+
return onOk;
|
|
395
|
+
}(),
|
|
396
|
+
onCancel: function onCancel() {}
|
|
397
|
+
});
|
|
398
|
+
};
|
|
360
399
|
// 开启关闭勾选,清除别的过滤器勾选
|
|
361
400
|
var _setIsCheck = function _setIsCheck(val) {
|
|
362
401
|
initPaste();
|
|
@@ -465,6 +504,8 @@ var FormulaList = forwardRef(function (props, ref) {
|
|
|
465
504
|
transparentMask: true,
|
|
466
505
|
content: _jsx(_Fragment, {
|
|
467
506
|
children: _jsx(Metabase, _objectSpread(_objectSpread({}, other), {}, {
|
|
507
|
+
isExit: true,
|
|
508
|
+
isSubquery: true,
|
|
468
509
|
notExistsColumns: exitData,
|
|
469
510
|
fieldEnableAlias: false,
|
|
470
511
|
toolbar: _toolbar,
|
|
@@ -804,6 +845,21 @@ var FormulaList = forwardRef(function (props, ref) {
|
|
|
804
845
|
});
|
|
805
846
|
}
|
|
806
847
|
};
|
|
848
|
+
var copyDom = function copyDom() {
|
|
849
|
+
var index = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : -1;
|
|
850
|
+
if (!isCopy || selectedIndices.length === 0 && checkedItemsCount === 0) return null;
|
|
851
|
+
return _jsx(Tooltip, {
|
|
852
|
+
title: "\u5728\u6B64\u5904\u7C98\u8D34(".concat(selectedIndices.length || checkedItemsCount, ")\u9879"),
|
|
853
|
+
children: _jsx(Button, {
|
|
854
|
+
className: cx(':Sqb-Filter-item-copy'),
|
|
855
|
+
onClick: function onClick() {
|
|
856
|
+
return handlePaste(index);
|
|
857
|
+
},
|
|
858
|
+
iconOnly: true,
|
|
859
|
+
icon: _jsx(FfPlus, {})
|
|
860
|
+
})
|
|
861
|
+
});
|
|
862
|
+
};
|
|
807
863
|
return _jsx(_Fragment, {
|
|
808
864
|
children: _jsxs("div", {
|
|
809
865
|
className: "Sqb-NotebookCell",
|
|
@@ -829,70 +885,88 @@ var FormulaList = forwardRef(function (props, ref) {
|
|
|
829
885
|
},
|
|
830
886
|
primary: true,
|
|
831
887
|
children: __('customColumn.copyAll')
|
|
832
|
-
})
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
'item-selected': isCheck
|
|
839
|
-
}),
|
|
840
|
-
onMouseEnter: function onMouseEnter(e) {
|
|
841
|
-
if (isCheck) return;
|
|
842
|
-
setInd(i);
|
|
888
|
+
}), selectedIndices.length > 0 && _jsx(Button, {
|
|
889
|
+
primary: true,
|
|
890
|
+
danger: true,
|
|
891
|
+
size: 'small',
|
|
892
|
+
onClick: function onClick() {
|
|
893
|
+
return delSelect();
|
|
843
894
|
},
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
895
|
+
children: __('customColumn.delSelect')
|
|
896
|
+
}), !isCheck && checkedItemsCount > 0 && _jsx(Button, {
|
|
897
|
+
primary: true,
|
|
898
|
+
warning: true,
|
|
899
|
+
size: 'small',
|
|
900
|
+
onClick: function onClick() {
|
|
901
|
+
return initPaste();
|
|
847
902
|
},
|
|
848
|
-
children:
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
},
|
|
862
|
-
ind: i,
|
|
863
|
-
position: 'before',
|
|
864
|
-
trigger: 'hover'
|
|
865
|
-
}), v.type !== AtomsTypeEnum.UNKNOWN && _jsx(Checkbox, {
|
|
866
|
-
className: 'item-check',
|
|
867
|
-
checked: selectedIndices.includes(i),
|
|
868
|
-
disabled: globalSelectionActive && globalSelectionOwner !== myInstanceIdRef.current,
|
|
869
|
-
onChange: function onChange(e) {
|
|
870
|
-
var _e$target$checked, _e$target;
|
|
871
|
-
return toggleSelect(i, (_e$target$checked = e === null || e === void 0 || (_e$target = e.target) === null || _e$target === void 0 ? void 0 : _e$target.checked) !== null && _e$target$checked !== void 0 ? _e$target$checked : !selectedIndices.includes(i));
|
|
872
|
-
}
|
|
873
|
-
}), _jsx("div", {
|
|
874
|
-
style: {
|
|
875
|
-
pointerEvents: isCheck ? 'none' : 'auto'
|
|
903
|
+
children: "\u6E05\u9664\u590D\u5236"
|
|
904
|
+
})]
|
|
905
|
+
}), (_caseList2 = caseList) === null || _caseList2 === void 0 ? void 0 : _caseList2.map(function (v, i) {
|
|
906
|
+
return _jsxs(React.Fragment, {
|
|
907
|
+
children: [copyDom(i), _jsxs("div", {
|
|
908
|
+
className: cx('Sqb-Filter-item', {
|
|
909
|
+
hover: ind === i,
|
|
910
|
+
'item-fixed': v.fixed || false,
|
|
911
|
+
'item-selected': isCheck
|
|
912
|
+
}),
|
|
913
|
+
onMouseEnter: function onMouseEnter(e) {
|
|
914
|
+
if (isCheck) return;
|
|
915
|
+
setInd(i);
|
|
876
916
|
},
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
return _jsx("div", {
|
|
881
|
-
className: 'right-arrow',
|
|
882
|
-
"v-index": i,
|
|
883
|
-
"v-type": 'after',
|
|
884
|
-
onClick: function onClick() {
|
|
885
|
-
addOperator(AtomsTypeEnum.UNKNOWN, i, 'after');
|
|
886
|
-
},
|
|
887
|
-
children: _jsx("img", {
|
|
888
|
-
src: arrow
|
|
889
|
-
})
|
|
890
|
-
});
|
|
917
|
+
onMouseLeave: function onMouseLeave() {
|
|
918
|
+
if (isCheck) return;
|
|
919
|
+
setInd(-1);
|
|
891
920
|
},
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
921
|
+
children: [selectOperator({
|
|
922
|
+
triggerElement: function triggerElement() {
|
|
923
|
+
return _jsx("div", {
|
|
924
|
+
className: 'left-arrow',
|
|
925
|
+
"v-index": i,
|
|
926
|
+
"v-type": 'before',
|
|
927
|
+
onClick: function onClick() {
|
|
928
|
+
if (!selectedIndices.length) addOperator(AtomsTypeEnum.UNKNOWN, i, 'before');
|
|
929
|
+
},
|
|
930
|
+
children: _jsx("img", {
|
|
931
|
+
src: arrow
|
|
932
|
+
})
|
|
933
|
+
});
|
|
934
|
+
},
|
|
935
|
+
ind: i,
|
|
936
|
+
position: 'before',
|
|
937
|
+
trigger: 'hover'
|
|
938
|
+
}), v.type !== AtomsTypeEnum.UNKNOWN && _jsx(Checkbox, {
|
|
939
|
+
className: 'item-check',
|
|
940
|
+
checked: selectedIndices.includes(i),
|
|
941
|
+
disabled: globalSelectionActive && globalSelectionOwner !== myInstanceIdRef.current,
|
|
942
|
+
onChange: function onChange(e) {
|
|
943
|
+
var _e$target$checked, _e$target;
|
|
944
|
+
return toggleSelect(i, (_e$target$checked = e === null || e === void 0 || (_e$target = e.target) === null || _e$target === void 0 ? void 0 : _e$target.checked) !== null && _e$target$checked !== void 0 ? _e$target$checked : !selectedIndices.includes(i));
|
|
945
|
+
}
|
|
946
|
+
}), _jsx("div", {
|
|
947
|
+
style: {
|
|
948
|
+
pointerEvents: isCheck || store.isMetabaseCopy ? 'none' : 'auto'
|
|
949
|
+
},
|
|
950
|
+
children: itemDom(v, i)
|
|
951
|
+
}), selectOperator({
|
|
952
|
+
triggerElement: function triggerElement(value) {
|
|
953
|
+
return _jsx("div", {
|
|
954
|
+
className: 'right-arrow',
|
|
955
|
+
"v-index": i,
|
|
956
|
+
"v-type": 'after',
|
|
957
|
+
onClick: function onClick() {
|
|
958
|
+
addOperator(AtomsTypeEnum.UNKNOWN, i, 'after');
|
|
959
|
+
},
|
|
960
|
+
children: _jsx("img", {
|
|
961
|
+
src: arrow
|
|
962
|
+
})
|
|
963
|
+
});
|
|
964
|
+
},
|
|
965
|
+
ind: i,
|
|
966
|
+
position: 'after',
|
|
967
|
+
trigger: 'hover'
|
|
968
|
+
})]
|
|
969
|
+
}, i)]
|
|
896
970
|
}, i);
|
|
897
971
|
}), Array.from(caseList).length < 1 && selectOperator({
|
|
898
972
|
triggerElement: function triggerElement() {
|
|
@@ -904,18 +978,7 @@ var FormulaList = forwardRef(function (props, ref) {
|
|
|
904
978
|
ind: -1,
|
|
905
979
|
position: 'add',
|
|
906
980
|
trigger: 'click'
|
|
907
|
-
}),
|
|
908
|
-
triggerElement: function triggerElement(value) {
|
|
909
|
-
return _jsxs("div", {
|
|
910
|
-
className: cx("Sqb-TableName green-name"),
|
|
911
|
-
onClick: handlePaste,
|
|
912
|
-
children: ["\u7C98\u8D34(", selectedIndices.length || checkedItemsCount, ")\u9879"]
|
|
913
|
-
});
|
|
914
|
-
},
|
|
915
|
-
ind: -1,
|
|
916
|
-
position: 'add',
|
|
917
|
-
trigger: 'click'
|
|
918
|
-
}), showPreview && _jsx("div", {
|
|
981
|
+
}), copyDom(), showPreview && _jsx("div", {
|
|
919
982
|
className: cx("mb-2 font-bold uppercase tracking-wider preview-box"),
|
|
920
983
|
style: {
|
|
921
984
|
fontSize: 12,
|
|
@@ -22,6 +22,19 @@
|
|
|
22
22
|
}
|
|
23
23
|
.Sqb-Filter-item {
|
|
24
24
|
position: relative;
|
|
25
|
+
// &-copy {
|
|
26
|
+
// position: absolute;
|
|
27
|
+
// left: 0;
|
|
28
|
+
// top: 50%;
|
|
29
|
+
// z-index: 1;
|
|
30
|
+
// transform: translate(-100%, -50%);
|
|
31
|
+
// &.isEndCopy {
|
|
32
|
+
// position: relative;
|
|
33
|
+
// left: auto;
|
|
34
|
+
// top: auto;
|
|
35
|
+
// transform: none;
|
|
36
|
+
// }
|
|
37
|
+
// }
|
|
25
38
|
&.item-selected {
|
|
26
39
|
.item-check {
|
|
27
40
|
display: block;
|
|
@@ -26,7 +26,8 @@ var Metabase = function Metabase(props) {
|
|
|
26
26
|
_props$readonly = props.readonly,
|
|
27
27
|
readonly = _props$readonly === void 0 ? false : _props$readonly,
|
|
28
28
|
onOk = props.onOk,
|
|
29
|
-
metabaseCopy = props.metabaseCopy
|
|
29
|
+
metabaseCopy = props.metabaseCopy,
|
|
30
|
+
moduleCopy = props.moduleCopy;
|
|
30
31
|
var store = useStore();
|
|
31
32
|
var _useState = useState(false),
|
|
32
33
|
_useState2 = _slicedToArray(_useState, 2),
|
|
@@ -131,8 +132,29 @@ var Metabase = function Metabase(props) {
|
|
|
131
132
|
}();
|
|
132
133
|
// 复制功能
|
|
133
134
|
var copy = function copy() {
|
|
134
|
-
return
|
|
135
|
-
children:
|
|
135
|
+
return _jsxs(Space, {
|
|
136
|
+
children: [moduleCopy && _jsx(_Fragment, {
|
|
137
|
+
children: _jsx(Tooltip, {
|
|
138
|
+
title: '开启勾选后可勾选组进行复制,复制后可在其他地方粘贴使用',
|
|
139
|
+
children: _jsx(Button, {
|
|
140
|
+
size: 'small',
|
|
141
|
+
type: 'primary',
|
|
142
|
+
warning: store.isMetabaseCopy,
|
|
143
|
+
className: cx("Sqb-copy-btn ", {
|
|
144
|
+
'primary-color': !store.isMetabaseCopy
|
|
145
|
+
}),
|
|
146
|
+
onClick: function onClick() {
|
|
147
|
+
// if (store.isMetabaseCopy) {
|
|
148
|
+
// storage._metabaseCopyModule = null;
|
|
149
|
+
// }
|
|
150
|
+
store.setIsMetabaseCopy(!store.isMetabaseCopy);
|
|
151
|
+
store.setMetabaseCopyModule([]);
|
|
152
|
+
storage._metabaseCopyModule = [];
|
|
153
|
+
},
|
|
154
|
+
children: store.isMetabaseCopy ? '清除勾选组复制' : '开启勾选组复制'
|
|
155
|
+
})
|
|
156
|
+
})
|
|
157
|
+
}), metabaseCopy && _jsxs(_Fragment, {
|
|
136
158
|
children: [_jsx(Tooltip, {
|
|
137
159
|
title: '点击复制当前配置,您可以在其他地方粘贴使用',
|
|
138
160
|
children: _jsx(Button, {
|
|
@@ -169,7 +191,7 @@ var Metabase = function Metabase(props) {
|
|
|
169
191
|
children: __('metabase.paste')
|
|
170
192
|
})
|
|
171
193
|
})]
|
|
172
|
-
})
|
|
194
|
+
})]
|
|
173
195
|
});
|
|
174
196
|
};
|
|
175
197
|
return (
|
|
@@ -23,6 +23,24 @@
|
|
|
23
23
|
}
|
|
24
24
|
&-list {
|
|
25
25
|
padding-top: 1.5rem;
|
|
26
|
+
.Sqb-item-check {
|
|
27
|
+
display: flex;
|
|
28
|
+
align-items: center;
|
|
29
|
+
width: 66.6667%;
|
|
30
|
+
.pd-Checkbox-text {
|
|
31
|
+
width: 100%;
|
|
32
|
+
|
|
33
|
+
.Sqb-item--content {
|
|
34
|
+
width: 100%;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
pointer-events: none; /* 该 div 及内部所有元素不接收鼠标事件 */
|
|
38
|
+
|
|
39
|
+
.Sqb-item {
|
|
40
|
+
pointer-events: none; /* 该 div 及内部所有元素不接收鼠标事件 */
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
}
|
|
26
44
|
}
|
|
27
45
|
&-hover-parent {
|
|
28
46
|
margin-bottom: 16px;
|
|
@@ -52,10 +70,18 @@
|
|
|
52
70
|
width: 16px;
|
|
53
71
|
height: 16px;
|
|
54
72
|
color: #b8bbc3;
|
|
55
|
-
margin-left: auto;
|
|
73
|
+
// margin-left: auto;
|
|
56
74
|
visibility: hidden;
|
|
57
75
|
cursor: pointer;
|
|
58
76
|
}
|
|
77
|
+
&-actions {
|
|
78
|
+
margin-left: auto;
|
|
79
|
+
// align-items: center;
|
|
80
|
+
.pd-Space-item {
|
|
81
|
+
display: flex;
|
|
82
|
+
align-items: center;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
59
85
|
&--content {
|
|
60
86
|
width: 66.6667%;
|
|
61
87
|
box-sizing: border-box;
|
|
@@ -419,6 +445,11 @@
|
|
|
419
445
|
visibility: visible;
|
|
420
446
|
}
|
|
421
447
|
}
|
|
448
|
+
&-copy {
|
|
449
|
+
width: 33%;
|
|
450
|
+
min-width: 150px;
|
|
451
|
+
margin: 5px 0;
|
|
452
|
+
}
|
|
422
453
|
}
|
|
423
454
|
|
|
424
455
|
& > &-btn {
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
|
|
2
2
|
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
3
3
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
4
|
-
import { Tooltip, Button, Modal2 } from '@gingkoo/pandora';
|
|
4
|
+
import { Tooltip, Button, Modal2, Space } from '@gingkoo/pandora';
|
|
5
|
+
import cx from 'classnames';
|
|
5
6
|
import { CloseIcon2 } from '../../icons';
|
|
6
7
|
import { __ } from '../../../locale';
|
|
7
8
|
import { useStore } from '../../../hooks/use-provider';
|
|
@@ -9,6 +10,7 @@ import { splitByUnion } from '../../../utils';
|
|
|
9
10
|
import DiffViewer from '../../dialog/diff-viewer';
|
|
10
11
|
var Header = function Header(props) {
|
|
11
12
|
var meta = props.meta,
|
|
13
|
+
groupIndex = props.groupIndex,
|
|
12
14
|
isDataModule = props.isDataModule;
|
|
13
15
|
var store = useStore();
|
|
14
16
|
var diff = /*#__PURE__*/function () {
|
|
@@ -57,12 +59,15 @@ var Header = function Header(props) {
|
|
|
57
59
|
onClick: diff,
|
|
58
60
|
children: "\u5DEE\u5F02\u5BF9\u6BD4"
|
|
59
61
|
})
|
|
60
|
-
}),
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
62
|
+
}), _jsx(Space, {
|
|
63
|
+
className: cx(':Sqb-item-actions'),
|
|
64
|
+
children: props.onClose && !store.isMetabaseCopy && _jsx(Tooltip, {
|
|
65
|
+
placement: 'top',
|
|
66
|
+
title: __('data.del'),
|
|
67
|
+
children: _jsx(CloseIcon2, {
|
|
68
|
+
className: "Sqb-item-close",
|
|
69
|
+
onClick: props.onClose
|
|
70
|
+
})
|
|
66
71
|
})
|
|
67
72
|
})]
|
|
68
73
|
});
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
interface HeaderProps {
|
|
3
|
+
className?: string;
|
|
4
|
+
groupIndex: number;
|
|
5
|
+
meta?: any;
|
|
6
|
+
children?: React.ReactNode;
|
|
7
|
+
}
|
|
8
|
+
declare const ItemWrapper: (props: HeaderProps) => string | number | boolean | Iterable<React.ReactNode> | import("react/jsx-runtime").JSX.Element | null | undefined;
|
|
9
|
+
export default ItemWrapper;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import { Checkbox } from '@gingkoo/pandora';
|
|
4
|
+
import cx from 'classnames';
|
|
5
|
+
import { useStore } from '../../../hooks/use-provider';
|
|
6
|
+
import { metaIsCheck } from '../../../utils';
|
|
7
|
+
import storage from '../../../utils/storage';
|
|
8
|
+
import cloneDeep from 'lodash/cloneDeep';
|
|
9
|
+
var ItemWrapper = function ItemWrapper(props) {
|
|
10
|
+
var meta = props.meta,
|
|
11
|
+
groupIndex = props.groupIndex,
|
|
12
|
+
children = props.children;
|
|
13
|
+
var store = useStore();
|
|
14
|
+
var changeCopyModule = function changeCopyModule(isCheck, meta) {
|
|
15
|
+
var data = cloneDeep(store.metabaseCopyModule) || [];
|
|
16
|
+
if (isCheck) {
|
|
17
|
+
data = [].concat(_toConsumableArray(data), [meta]);
|
|
18
|
+
} else {
|
|
19
|
+
data = data.filter(function (v) {
|
|
20
|
+
return v.metaKey !== meta.metaKey;
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
store.setMetabaseCopyModule(data);
|
|
24
|
+
storage._metabaseCopyModule = data;
|
|
25
|
+
};
|
|
26
|
+
if (store.isMetabaseCopy && meta.type !== 'union' && meta.type !== 'data') {
|
|
27
|
+
return _jsx(Checkbox, {
|
|
28
|
+
checked: metaIsCheck(store.metabaseCopyModule, meta),
|
|
29
|
+
onChange: function onChange(val) {
|
|
30
|
+
changeCopyModule(val, meta);
|
|
31
|
+
},
|
|
32
|
+
className: cx(':Sqb-item-check'),
|
|
33
|
+
children: children
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
return children;
|
|
37
|
+
};
|
|
38
|
+
export default ItemWrapper;
|
|
@@ -1,7 +1,18 @@
|
|
|
1
|
+
import { TypeEnum } from '../../../store/enum';
|
|
1
2
|
import { MetaListType } from '../../../store/types';
|
|
2
3
|
interface PropsType {
|
|
3
4
|
meta: MetaListType;
|
|
4
5
|
groupIndex: number;
|
|
5
6
|
}
|
|
7
|
+
type IconInfoType = {
|
|
8
|
+
name: string;
|
|
9
|
+
icon: JSX.Element;
|
|
10
|
+
className?: string;
|
|
11
|
+
};
|
|
12
|
+
export declare const IconTypeMap: Map<TypeEnum, IconInfoType>;
|
|
13
|
+
/**
|
|
14
|
+
* 查找模块下面能放哪些icon (参考来源:metabase.com)
|
|
15
|
+
*/
|
|
16
|
+
export declare const findNextIcon: (store: any, props: PropsType) => TypeEnum[];
|
|
6
17
|
declare const NextDom: (props: PropsType) => import("react/jsx-runtime").JSX.Element | null;
|
|
7
18
|
export default NextDom;
|
|
@@ -1,9 +1,14 @@
|
|
|
1
|
-
import
|
|
1
|
+
import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
|
|
2
|
+
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
3
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
4
|
+
import React, { useEffect } from 'react';
|
|
2
5
|
import cx from 'classnames';
|
|
3
6
|
import { __ } from '../../../locale';
|
|
4
7
|
import { TypeEnum } from '../../../store/enum';
|
|
5
|
-
import { Tooltip } from '@gingkoo/pandora';
|
|
6
|
-
import {
|
|
8
|
+
import { Tooltip, Button } from '@gingkoo/pandora';
|
|
9
|
+
import { FfPlus } from '@gingkoo/pandora-icons';
|
|
10
|
+
import storage from '../../../utils/storage';
|
|
11
|
+
import { getHelper, isCanPaste } from '../../../utils';
|
|
7
12
|
// import { type SqlVisionStoreType } from '../../../store/helper';
|
|
8
13
|
import { useStore } from '../../../hooks/use-provider';
|
|
9
14
|
import { RowLimitIcon, SortIcon, CustomColumnIcon, JoinDataIcon, PermissionTableIcon, SummarizeIcon, FilterIcon, GroupIcon } from '../../icons';
|
|
@@ -12,7 +17,7 @@ var IconSIzeEnum;
|
|
|
12
17
|
IconSIzeEnum["SMALL"] = "small";
|
|
13
18
|
IconSIzeEnum["LARGE"] = "large";
|
|
14
19
|
})(IconSIzeEnum || (IconSIzeEnum = {}));
|
|
15
|
-
var IconTypeMap = new Map([[TypeEnum.filter, {
|
|
20
|
+
export var IconTypeMap = new Map([[TypeEnum.filter, {
|
|
16
21
|
name: __('SqlQueryBuilder.filter'),
|
|
17
22
|
icon: _jsx(FilterIcon, {}),
|
|
18
23
|
className: 'filter'
|
|
@@ -117,7 +122,7 @@ var judgeSize = function judgeSize(store, props, nextLen, groupIndex) {
|
|
|
117
122
|
/**
|
|
118
123
|
* 查找模块下面能放哪些icon (参考来源:metabase.com)
|
|
119
124
|
*/
|
|
120
|
-
var findNextIcon = function findNextIcon(store, props) {
|
|
125
|
+
export var findNextIcon = function findNextIcon(store, props) {
|
|
121
126
|
var _store$metaList$group;
|
|
122
127
|
var meta = props.meta,
|
|
123
128
|
groupIndex = props.groupIndex;
|
|
@@ -318,15 +323,56 @@ var NextDom = function NextDom(props) {
|
|
|
318
323
|
store.addMeta(type, index + 1, groupIndex);
|
|
319
324
|
}
|
|
320
325
|
var MetaIconDom = metaIcon(size, handleClick);
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
326
|
+
var _React$useState = React.useState(false),
|
|
327
|
+
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
328
|
+
isShowAdd = _React$useState2[0],
|
|
329
|
+
setIsShowAdd = _React$useState2[1];
|
|
330
|
+
useEffect(function () {
|
|
331
|
+
if (store.metabaseCopyModule) {
|
|
332
|
+
// let { prevItem, nextItem } = getHelper(store.metaList[groupIndex].list, meta);
|
|
333
|
+
var nextTypes = findNextIcon(store, {
|
|
334
|
+
meta: meta,
|
|
335
|
+
groupIndex: groupIndex
|
|
336
|
+
});
|
|
337
|
+
var isCan = isCanPaste(store.metabaseCopyModule, {
|
|
338
|
+
nextTypes: _toConsumableArray(nextTypes)
|
|
339
|
+
});
|
|
340
|
+
setIsShowAdd(isCan);
|
|
341
|
+
} else {
|
|
342
|
+
setIsShowAdd(false);
|
|
343
|
+
}
|
|
344
|
+
}, [store.metabaseCopyModule]);
|
|
345
|
+
var handlePaste = function handlePaste() {
|
|
346
|
+
var _store$metaList3;
|
|
347
|
+
var index = (_store$metaList3 = store.metaList) === null || _store$metaList3 === void 0 || (_store$metaList3 = _store$metaList3[groupIndex]) === null || _store$metaList3 === void 0 || (_store$metaList3 = _store$metaList3.list) === null || _store$metaList3 === void 0 ? void 0 : _store$metaList3.indexOf(meta);
|
|
348
|
+
store.addMeta('', index + 1, groupIndex, store.metabaseCopyModule);
|
|
349
|
+
// 粘贴后重置
|
|
350
|
+
store.setMetabaseCopyModule([]);
|
|
351
|
+
store.setIsMetabaseCopy(false);
|
|
352
|
+
storage._metabaseCopyModule = [];
|
|
353
|
+
};
|
|
354
|
+
return _jsxs(_Fragment, {
|
|
355
|
+
children: [store.metabaseCopyModule && store.metabaseCopyModule.length > 0 && isShowAdd && _jsx(Tooltip, {
|
|
356
|
+
title: "\u5728\u6B64\u5904\u7C98\u8D34",
|
|
357
|
+
children: _jsxs(Button, {
|
|
358
|
+
className: cx(':Sqb-item-copy'),
|
|
359
|
+
onClick: handlePaste,
|
|
360
|
+
// iconOnly={false}
|
|
361
|
+
// icon={}
|
|
362
|
+
dashed: true,
|
|
363
|
+
ghost: true,
|
|
364
|
+
children: [_jsx(FfPlus, {}), "\u5C06\u5185\u5BB9\u7C98\u8D34\u5230\u6B64\u5904"]
|
|
365
|
+
})
|
|
366
|
+
}), _jsx("div", {
|
|
367
|
+
className: "Sqb-item--func",
|
|
368
|
+
children: sortList(available).filter(function (v) {
|
|
369
|
+
return ~store.toolbar.indexOf(v);
|
|
370
|
+
}).map(function (v) {
|
|
371
|
+
return _jsx(MetaIconDom, {
|
|
372
|
+
type: v
|
|
373
|
+
}, v);
|
|
374
|
+
})
|
|
375
|
+
})]
|
|
330
376
|
});
|
|
331
377
|
};
|
|
332
378
|
export default NextDom;
|