@gingkoo/pandora-metabase 1.0.158-alpha.2 → 1.0.158-alpha.21
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/common/SplitView/index.js +2 -2
- package/lib/cjs/components/dialog/column-type-label/index.d.ts +8 -0
- package/lib/cjs/components/dialog/column-type-label/index.js +22 -0
- package/lib/cjs/components/dialog/column-type-label/index.less +17 -0
- package/lib/cjs/components/dialog/custom-column/config.js +2 -2
- package/lib/cjs/components/dialog/custom-column/expression-editor.js +1 -1
- package/lib/cjs/components/dialog/custom-column/expressions/suggest.js +2 -2
- package/lib/cjs/components/dialog/custom-column/expressions/tokenizer.js +2 -2
- package/lib/cjs/components/dialog/custom-column/index.js +2 -2
- package/lib/cjs/components/dialog/custom-column/tokenized-expression.js +6 -6
- package/lib/cjs/components/dialog/custom-column/tokenizedI-input.js +8 -8
- package/lib/cjs/components/dialog/custom-editor/index.js +4 -4
- package/lib/cjs/components/dialog/expression/date-format-picker.js +1 -1
- package/lib/cjs/components/dialog/expression/index.js +4 -4
- package/lib/cjs/components/dialog/formula/index.js +55 -14
- package/lib/cjs/components/dialog/formula/index.less +7 -0
- package/lib/cjs/components/dialog/formula/utils.js +5 -1
- package/lib/cjs/components/dialog/formula-list/CaseWhenGroup.d.ts +3 -4
- package/lib/cjs/components/dialog/formula-list/CaseWhenGroup.js +138 -214
- package/lib/cjs/components/dialog/formula-list/LogicGroup.js +55 -39
- package/lib/cjs/components/dialog/formula-list/index.d.ts +3 -0
- package/lib/cjs/components/dialog/formula-list/index.js +414 -321
- package/lib/cjs/components/dialog/formula-list/index.less +1012 -1105
- package/lib/cjs/components/dialog/formula-list/utils.d.ts +16 -2
- package/lib/cjs/components/dialog/formula-list/utils.js +650 -131
- package/lib/cjs/components/dialog/select-column/index.js +10 -4
- package/lib/cjs/components/dialog/select-column/index.less +6 -1
- package/lib/cjs/components/dialog/select-column-multiple/index.js +12 -9
- package/lib/cjs/components/dialog/select-column-multiple/index.less +10 -0
- package/lib/cjs/components/dialog/select-join-column/index.js +9 -5
- package/lib/cjs/components/dialog/select-join-column/index.less +10 -0
- package/lib/cjs/components/dialog/select-join-column-multiple/index.js +10 -6
- package/lib/cjs/components/dialog/select-join-column-multiple/index.less +10 -0
- package/lib/cjs/components/dialog/select-permission-table/index.js +1 -1
- package/lib/cjs/components/dialog/select-summarize/index.js +2 -2
- package/lib/cjs/components/dialog/select-table/index.js +5 -5
- package/lib/cjs/components/icons.js +1 -1
- package/lib/cjs/components/metabase/index.js +129 -60
- package/lib/cjs/components/metabase/index.less +28 -29
- package/lib/cjs/components/modules/components/Wrapper.js +2 -2
- package/lib/cjs/components/modules/components/header.d.ts +2 -1
- package/lib/cjs/components/modules/components/header.js +7 -3
- package/lib/cjs/components/modules/components/item-wrapper.js +1 -1
- package/lib/cjs/components/modules/components/meta-icon.js +3 -5
- package/lib/cjs/components/modules/custom-column.js +7 -4
- package/lib/cjs/components/modules/filter.js +2 -2
- package/lib/cjs/components/modules/join-data.js +100 -21
- package/lib/cjs/components/modules/sort.js +6 -3
- package/lib/cjs/components/modules/summarize/group-by.js +10 -6
- package/lib/cjs/components/modules/summarize/select-index.js +12 -5
- package/lib/cjs/components/modules/table-data.js +50 -16
- package/lib/cjs/components/popup.js +7 -7
- package/lib/cjs/components/right-click-menu.js +3 -3
- package/lib/cjs/components/sql-syntax-confirm.d.ts +14 -0
- package/lib/cjs/components/sql-syntax-confirm.js +149 -0
- package/lib/cjs/enum.d.ts +1 -0
- package/lib/cjs/enum.js +16 -0
- package/lib/cjs/hooks/patch.js +1 -1
- package/lib/cjs/hooks/patch2.js +1 -1
- package/lib/cjs/hooks/use-state.js +118 -111
- package/lib/cjs/hooks/winsize.js +1 -1
- package/lib/cjs/index.d.ts +4 -2
- package/lib/cjs/index.js +14 -6
- package/lib/cjs/locale/en.js +35 -0
- package/lib/cjs/locale/zh.js +35 -0
- package/lib/cjs/prompt.d.ts +3 -0
- package/lib/cjs/prompt.js +262 -0
- package/lib/cjs/store/enum.d.ts +50 -0
- package/lib/cjs/store/enum.js +56 -2
- package/lib/cjs/store/helper.js +2 -2
- package/lib/cjs/store/types.d.ts +9 -52
- package/lib/cjs/store/types.js +25 -54
- package/lib/cjs/types.d.ts +6 -0
- package/lib/cjs/utils/event.js +3 -3
- package/lib/cjs/utils/helper.js +1 -1
- package/lib/cjs/utils/keydown.js +2 -2
- package/lib/cjs/utils/selection.js +1 -1
- package/lib/cjs/utils/storage.js +2 -2
- package/lib/cjs/utils/transformSql.d.ts +44 -1
- package/lib/cjs/utils/transformSql.js +1042 -29
- package/lib/cjs/utils.d.ts +3 -1
- package/lib/cjs/utils.js +82 -43
- package/lib/cjs/validate.d.ts +2 -0
- package/lib/cjs/validate.js +42 -0
- package/lib/es/components/dialog/column-type-label/index.d.ts +8 -0
- package/lib/es/components/dialog/column-type-label/index.js +16 -0
- package/lib/es/components/dialog/column-type-label/index.less +17 -0
- package/lib/es/components/dialog/expression/index.js +1 -1
- package/lib/es/components/dialog/formula/index.js +53 -12
- package/lib/es/components/dialog/formula/index.less +7 -0
- package/lib/es/components/dialog/formula/utils.js +5 -1
- package/lib/es/components/dialog/formula-list/CaseWhenGroup.d.ts +3 -4
- package/lib/es/components/dialog/formula-list/CaseWhenGroup.js +141 -217
- package/lib/es/components/dialog/formula-list/LogicGroup.js +54 -38
- package/lib/es/components/dialog/formula-list/index.d.ts +3 -0
- package/lib/es/components/dialog/formula-list/index.js +409 -316
- package/lib/es/components/dialog/formula-list/index.less +1012 -1105
- package/lib/es/components/dialog/formula-list/utils.d.ts +16 -2
- package/lib/es/components/dialog/formula-list/utils.js +646 -126
- package/lib/es/components/dialog/select-column/index.js +7 -1
- package/lib/es/components/dialog/select-column/index.less +6 -1
- package/lib/es/components/dialog/select-column-multiple/index.js +9 -6
- package/lib/es/components/dialog/select-column-multiple/index.less +10 -0
- package/lib/es/components/dialog/select-join-column/index.js +7 -3
- package/lib/es/components/dialog/select-join-column/index.less +10 -0
- package/lib/es/components/dialog/select-join-column-multiple/index.js +7 -3
- package/lib/es/components/dialog/select-join-column-multiple/index.less +10 -0
- package/lib/es/components/metabase/index.js +126 -57
- package/lib/es/components/metabase/index.less +28 -29
- package/lib/es/components/modules/components/header.d.ts +2 -1
- package/lib/es/components/modules/components/header.js +6 -2
- package/lib/es/components/modules/components/meta-icon.js +2 -4
- package/lib/es/components/modules/custom-column.js +4 -1
- package/lib/es/components/modules/join-data.js +98 -19
- package/lib/es/components/modules/sort.js +4 -1
- package/lib/es/components/modules/summarize/group-by.js +5 -1
- package/lib/es/components/modules/summarize/select-index.js +8 -1
- package/lib/es/components/modules/table-data.js +47 -13
- package/lib/es/components/sql-syntax-confirm.d.ts +14 -0
- package/lib/es/components/sql-syntax-confirm.js +142 -0
- package/lib/es/enum.d.ts +1 -0
- package/lib/es/enum.js +1 -0
- package/lib/es/hooks/use-state.js +112 -105
- package/lib/es/index.d.ts +4 -2
- package/lib/es/index.js +8 -6
- package/lib/es/locale/en.js +35 -0
- package/lib/es/locale/zh.js +35 -0
- package/lib/es/prompt.d.ts +3 -0
- package/lib/es/prompt.js +3 -0
- package/lib/es/store/enum.d.ts +50 -0
- package/lib/es/store/enum.js +55 -1
- package/lib/es/store/types.d.ts +9 -52
- package/lib/es/store/types.js +2 -53
- package/lib/es/types.d.ts +6 -0
- package/lib/es/utils/transformSql.d.ts +44 -1
- package/lib/es/utils/transformSql.js +1038 -25
- package/lib/es/utils.d.ts +3 -1
- package/lib/es/utils.js +76 -37
- package/lib/es/validate.d.ts +2 -0
- package/lib/es/validate.js +1 -0
- package/package.json +31 -1
- package/lib/cjs/components/dialog/diff-viewer/index copy.d.ts +0 -10
- package/lib/cjs/components/dialog/diff-viewer/index copy.js +0 -139
- package/lib/es/components/dialog/diff-viewer/index copy.d.ts +0 -10
- package/lib/es/components/dialog/diff-viewer/index copy.js +0 -132
|
@@ -5,96 +5,85 @@ 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"));
|
|
9
8
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
10
9
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
11
10
|
var _pandora = require("@gingkoo/pandora");
|
|
12
11
|
var _pandoraIcons = require("@gingkoo/pandora-icons");
|
|
13
12
|
var _icons = require("../../icons");
|
|
14
13
|
var CASE_ICON_SIZE = 10;
|
|
15
|
-
var
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
14
|
+
var CwOpIcon = function CwOpIcon(_ref) {
|
|
15
|
+
var type = _ref.type;
|
|
16
|
+
return (0, _jsxRuntime.jsx)("svg", {
|
|
17
|
+
viewBox: '0 0 16 16',
|
|
18
|
+
width: '12',
|
|
19
|
+
height: '12',
|
|
20
|
+
"aria-hidden": true,
|
|
21
|
+
children: (0, _jsxRuntime.jsx)("path", {
|
|
22
|
+
d: type === 'plus' ? 'M8 3.2v9.6M3.2 8h9.6' : 'M4.2 4.2l7.6 7.6M11.8 4.2l-7.6 7.6',
|
|
23
|
+
fill: 'none',
|
|
24
|
+
stroke: 'currentColor',
|
|
25
|
+
strokeWidth: '1.6',
|
|
26
|
+
strokeLinecap: 'round'
|
|
27
|
+
})
|
|
28
|
+
});
|
|
30
29
|
};
|
|
31
|
-
var
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
fontSize: 11,
|
|
66
|
-
lineHeight: 1
|
|
30
|
+
var CwBranchOps = function CwBranchOps(_ref2) {
|
|
31
|
+
var onAdd = _ref2.onAdd,
|
|
32
|
+
onDelete = _ref2.onDelete,
|
|
33
|
+
_ref2$canDelete = _ref2.canDelete,
|
|
34
|
+
canDelete = _ref2$canDelete === void 0 ? true : _ref2$canDelete,
|
|
35
|
+
addTitle = _ref2.addTitle,
|
|
36
|
+
deleteTitle = _ref2.deleteTitle;
|
|
37
|
+
return (0, _jsxRuntime.jsxs)("div", {
|
|
38
|
+
className: 'CwLine-ops',
|
|
39
|
+
children: [onAdd && (0, _jsxRuntime.jsx)(_pandora.Tooltip, {
|
|
40
|
+
title: addTitle,
|
|
41
|
+
children: (0, _jsxRuntime.jsx)("button", {
|
|
42
|
+
type: 'button',
|
|
43
|
+
className: 'CwLine-op',
|
|
44
|
+
onClick: onAdd,
|
|
45
|
+
children: (0, _jsxRuntime.jsx)(CwOpIcon, {
|
|
46
|
+
type: 'plus'
|
|
47
|
+
})
|
|
48
|
+
})
|
|
49
|
+
}), onDelete && (0, _jsxRuntime.jsx)(_pandora.Tooltip, {
|
|
50
|
+
title: deleteTitle,
|
|
51
|
+
children: (0, _jsxRuntime.jsx)("button", {
|
|
52
|
+
type: 'button',
|
|
53
|
+
className: 'CwLine-op',
|
|
54
|
+
onClick: function onClick(e) {
|
|
55
|
+
if (!canDelete) return;
|
|
56
|
+
onDelete(e);
|
|
57
|
+
},
|
|
58
|
+
children: (0, _jsxRuntime.jsx)(CwOpIcon, {
|
|
59
|
+
type: 'close'
|
|
60
|
+
})
|
|
61
|
+
})
|
|
62
|
+
})]
|
|
63
|
+
});
|
|
67
64
|
};
|
|
68
|
-
var CaseWhenGroup = function CaseWhenGroup(
|
|
69
|
-
var caseAtomsContent =
|
|
70
|
-
whenClauses =
|
|
71
|
-
elseContent =
|
|
72
|
-
onAddBranch =
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
showTools =
|
|
79
|
-
|
|
80
|
-
readonly =
|
|
81
|
-
|
|
82
|
-
isNested =
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
onActivateRegion = _ref.onActivateRegion;
|
|
91
|
-
var renderBranchContent = function renderBranchContent(children) {
|
|
92
|
-
if (isNested || !useBranchScrollInner) return children;
|
|
93
|
-
return (0, _jsxRuntime.jsx)("div", {
|
|
94
|
-
className: 'Sqb-CaseBranch-scrollInner',
|
|
95
|
-
children: children
|
|
96
|
-
});
|
|
97
|
-
};
|
|
65
|
+
var CaseWhenGroup = function CaseWhenGroup(_ref3) {
|
|
66
|
+
var caseAtomsContent = _ref3.caseAtomsContent,
|
|
67
|
+
whenClauses = _ref3.whenClauses,
|
|
68
|
+
elseContent = _ref3.elseContent,
|
|
69
|
+
onAddBranch = _ref3.onAddBranch,
|
|
70
|
+
onRemoveElse = _ref3.onRemoveElse,
|
|
71
|
+
_ref3$canClearElse = _ref3.canClearElse,
|
|
72
|
+
canClearElse = _ref3$canClearElse === void 0 ? false : _ref3$canClearElse,
|
|
73
|
+
onZoomCase = _ref3.onZoomCase,
|
|
74
|
+
onDeleteCase = _ref3.onDeleteCase,
|
|
75
|
+
_ref3$showTools = _ref3.showTools,
|
|
76
|
+
showTools = _ref3$showTools === void 0 ? true : _ref3$showTools,
|
|
77
|
+
_ref3$readonly = _ref3.readonly,
|
|
78
|
+
readonly = _ref3$readonly === void 0 ? false : _ref3$readonly,
|
|
79
|
+
_ref3$isNested = _ref3.isNested,
|
|
80
|
+
isNested = _ref3$isNested === void 0 ? false : _ref3$isNested,
|
|
81
|
+
_ref3$caseRegionKey = _ref3.caseRegionKey,
|
|
82
|
+
caseRegionKey = _ref3$caseRegionKey === void 0 ? 'case' : _ref3$caseRegionKey,
|
|
83
|
+
_ref3$elseRegionKey = _ref3.elseRegionKey,
|
|
84
|
+
elseRegionKey = _ref3$elseRegionKey === void 0 ? 'else' : _ref3$elseRegionKey,
|
|
85
|
+
activeRegionKey = _ref3.activeRegionKey,
|
|
86
|
+
onActivateRegion = _ref3.onActivateRegion;
|
|
98
87
|
var getRegionClassName = function getRegionClassName(regionKey) {
|
|
99
88
|
for (var _len = arguments.length, classNames = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
100
89
|
classNames[_key - 1] = arguments[_key];
|
|
@@ -103,15 +92,8 @@ var CaseWhenGroup = function CaseWhenGroup(_ref) {
|
|
|
103
92
|
'Sqb-CaseRegion--active': activeRegionKey === regionKey
|
|
104
93
|
}]));
|
|
105
94
|
};
|
|
106
|
-
var handleActivateRegion = function handleActivateRegion(e, regionKey) {
|
|
107
|
-
var _target$closest;
|
|
108
|
-
var target = e.target;
|
|
109
|
-
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');
|
|
110
|
-
if (currentRegion !== e.currentTarget) return;
|
|
111
|
-
onActivateRegion === null || onActivateRegion === void 0 || onActivateRegion(regionKey);
|
|
112
|
-
};
|
|
113
95
|
return (0, _jsxRuntime.jsxs)("div", {
|
|
114
|
-
className: (0, _classnames["default"])('Sqb-FormulaGroup', '
|
|
96
|
+
className: (0, _classnames["default"])('Sqb-FormulaGroup', 'formula-node-group', 'Sqb-CaseWhenGroup', 'CwBlock', {
|
|
115
97
|
'Sqb-CaseWhenGroup--nested': isNested
|
|
116
98
|
}),
|
|
117
99
|
children: [showTools && !readonly && (0, _jsxRuntime.jsxs)("div", {
|
|
@@ -121,7 +103,6 @@ var CaseWhenGroup = function CaseWhenGroup(_ref) {
|
|
|
121
103
|
children: (0, _jsxRuntime.jsx)("button", {
|
|
122
104
|
type: 'button',
|
|
123
105
|
className: 'Sqb-CaseRow-zoom formula-node-tool',
|
|
124
|
-
style: zoomButtonStyle,
|
|
125
106
|
onClick: onZoomCase,
|
|
126
107
|
children: (0, _jsxRuntime.jsx)(_pandoraIcons.FullscreenOExpand, {})
|
|
127
108
|
})
|
|
@@ -130,7 +111,6 @@ var CaseWhenGroup = function CaseWhenGroup(_ref) {
|
|
|
130
111
|
children: (0, _jsxRuntime.jsx)("button", {
|
|
131
112
|
type: 'button',
|
|
132
113
|
className: 'Sqb-CaseRow-remove formula-node-remove',
|
|
133
|
-
style: removeButtonStyle,
|
|
134
114
|
onClick: onDeleteCase,
|
|
135
115
|
children: (0, _jsxRuntime.jsx)(_icons.CloseIcon, {
|
|
136
116
|
width: CASE_ICON_SIZE,
|
|
@@ -139,145 +119,89 @@ var CaseWhenGroup = function CaseWhenGroup(_ref) {
|
|
|
139
119
|
})
|
|
140
120
|
})]
|
|
141
121
|
}), (0, _jsxRuntime.jsxs)("div", {
|
|
142
|
-
className: getRegionClassName(caseRegionKey, '
|
|
143
|
-
|
|
144
|
-
return
|
|
122
|
+
className: getRegionClassName(caseRegionKey, 'CwLine', 'CwLine--case'),
|
|
123
|
+
onMouseEnter: function onMouseEnter() {
|
|
124
|
+
return onActivateRegion === null || onActivateRegion === void 0 ? void 0 : onActivateRegion(caseRegionKey);
|
|
145
125
|
},
|
|
146
|
-
children: [(0, _jsxRuntime.jsx)("
|
|
147
|
-
className: '
|
|
148
|
-
children: "
|
|
126
|
+
children: [(0, _jsxRuntime.jsx)("div", {
|
|
127
|
+
className: 'CwLine-k',
|
|
128
|
+
children: "CASE"
|
|
149
129
|
}), (0, _jsxRuntime.jsx)("div", {
|
|
150
|
-
className: '
|
|
151
|
-
children:
|
|
152
|
-
className: 'Sqb-CaseSection-content',
|
|
153
|
-
children: caseAtomsContent
|
|
154
|
-
})
|
|
130
|
+
className: 'CwLine-v',
|
|
131
|
+
children: caseAtomsContent
|
|
155
132
|
})]
|
|
156
|
-
}), whenClauses.map(function (branch
|
|
133
|
+
}), whenClauses.map(function (branch) {
|
|
157
134
|
var canDeleteBranch = branch.canDelete !== false;
|
|
158
135
|
return (0, _jsxRuntime.jsxs)("div", {
|
|
159
|
-
className:
|
|
160
|
-
|
|
161
|
-
|
|
136
|
+
className: (0, _classnames["default"])('CwBranch', {
|
|
137
|
+
'Sqb-CaseRegion--active': activeRegionKey === branch.key
|
|
138
|
+
}),
|
|
139
|
+
onMouseEnter: function onMouseEnter() {
|
|
140
|
+
return onActivateRegion === null || onActivateRegion === void 0 ? void 0 : onActivateRegion(branch.key);
|
|
162
141
|
},
|
|
163
|
-
children: [(0, _jsxRuntime.
|
|
164
|
-
className: '
|
|
165
|
-
children:
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
children: [(0, _jsxRuntime.jsx)("span", {
|
|
181
|
-
className: 'Sqb-CaseKeyword keyword-branch keyword-then',
|
|
182
|
-
children: "then"
|
|
183
|
-
}), (0, _jsxRuntime.jsx)("div", {
|
|
184
|
-
className: 'Sqb-CaseSection-content Sqb-CaseSection-content--wrap',
|
|
185
|
-
children: branch.thenContent
|
|
186
|
-
})]
|
|
187
|
-
})]
|
|
188
|
-
}))
|
|
189
|
-
}), !readonly && (0, _jsxRuntime.jsxs)("div", {
|
|
190
|
-
className: 'Sqb-CaseRow-actions when-row-actions',
|
|
191
|
-
children: [(0, _jsxRuntime.jsx)(_pandora.Tooltip, {
|
|
192
|
-
title: "\u65B0\u589E when",
|
|
193
|
-
children: (0, _jsxRuntime.jsx)("button", {
|
|
194
|
-
type: 'button',
|
|
195
|
-
className: 'Sqb-CaseRow-add',
|
|
196
|
-
style: addButtonStyle,
|
|
197
|
-
onClick: branch.onAddAfter,
|
|
198
|
-
children: (0, _jsxRuntime.jsx)(_pandoraIcons.FfPlus, {})
|
|
199
|
-
})
|
|
200
|
-
}), (0, _jsxRuntime.jsx)(_pandora.Tooltip, {
|
|
201
|
-
title: canDeleteBranch ? '删除 when' : '至少保留一个 when / then',
|
|
202
|
-
children: (0, _jsxRuntime.jsx)("button", {
|
|
203
|
-
type: 'button',
|
|
204
|
-
className: (0, _classnames["default"])('Sqb-CaseRow-remove', {
|
|
205
|
-
disabled: !canDeleteBranch
|
|
206
|
-
}),
|
|
207
|
-
disabled: !canDeleteBranch,
|
|
208
|
-
style: canDeleteBranch ? removeButtonStyle : removeDisabledButtonStyle,
|
|
209
|
-
onClick: branch.onDelete,
|
|
210
|
-
children: (0, _jsxRuntime.jsx)(_icons.CloseIcon, {
|
|
211
|
-
width: CASE_ICON_SIZE,
|
|
212
|
-
height: CASE_ICON_SIZE
|
|
213
|
-
})
|
|
214
|
-
})
|
|
142
|
+
children: [(0, _jsxRuntime.jsxs)("div", {
|
|
143
|
+
className: getRegionClassName(branch.key, 'CwLine', 'CwLine--when'),
|
|
144
|
+
children: [(0, _jsxRuntime.jsx)("div", {
|
|
145
|
+
className: 'CwLine-k',
|
|
146
|
+
children: "WHEN"
|
|
147
|
+
}), (0, _jsxRuntime.jsx)("div", {
|
|
148
|
+
className: 'CwLine-v',
|
|
149
|
+
children: branch.whenContent
|
|
150
|
+
})]
|
|
151
|
+
}), (0, _jsxRuntime.jsxs)("div", {
|
|
152
|
+
className: getRegionClassName(branch.key, 'CwLine', 'CwLine--then'),
|
|
153
|
+
children: [(0, _jsxRuntime.jsx)("div", {
|
|
154
|
+
className: 'CwLine-k',
|
|
155
|
+
children: "THEN"
|
|
156
|
+
}), (0, _jsxRuntime.jsx)("div", {
|
|
157
|
+
className: 'CwLine-v',
|
|
158
|
+
children: branch.thenContent
|
|
215
159
|
})]
|
|
160
|
+
}), !readonly && (0, _jsxRuntime.jsx)(CwBranchOps, {
|
|
161
|
+
addTitle: "\u65B0\u589E WHEN",
|
|
162
|
+
deleteTitle: "\u5220\u9664 WHEN",
|
|
163
|
+
onAdd: branch.onAddAfter,
|
|
164
|
+
onDelete: canDeleteBranch ? branch.onDelete : undefined
|
|
216
165
|
})]
|
|
217
166
|
}, branch.key);
|
|
218
|
-
}), !readonly && whenClauses.length < 1 && (0, _jsxRuntime.jsx)(
|
|
219
|
-
|
|
167
|
+
}), !readonly && whenClauses.length < 1 && (0, _jsxRuntime.jsx)("div", {
|
|
168
|
+
className: 'CwLine CwLine--addWhen',
|
|
220
169
|
children: (0, _jsxRuntime.jsxs)("button", {
|
|
221
170
|
type: 'button',
|
|
222
|
-
className:
|
|
223
|
-
style: recoverButtonStyle,
|
|
171
|
+
className: 'CwLine-add',
|
|
224
172
|
onClick: onAddBranch,
|
|
225
|
-
children: [(0, _jsxRuntime.jsx)(
|
|
226
|
-
|
|
173
|
+
children: [(0, _jsxRuntime.jsx)(_icons.AddIcon, {
|
|
174
|
+
width: 10,
|
|
175
|
+
height: 10
|
|
176
|
+
}), (0, _jsxRuntime.jsx)("span", {
|
|
177
|
+
children: "WHEN"
|
|
227
178
|
})]
|
|
228
179
|
})
|
|
229
|
-
}),
|
|
230
|
-
className:
|
|
231
|
-
|
|
232
|
-
|
|
180
|
+
}), (0, _jsxRuntime.jsxs)("div", {
|
|
181
|
+
className: (0, _classnames["default"])('CwBranch', 'CwBranch--else', {
|
|
182
|
+
'Sqb-CaseRegion--active': activeRegionKey === elseRegionKey
|
|
183
|
+
}),
|
|
184
|
+
onMouseEnter: function onMouseEnter() {
|
|
185
|
+
return onActivateRegion === null || onActivateRegion === void 0 ? void 0 : onActivateRegion(elseRegionKey);
|
|
233
186
|
},
|
|
234
|
-
children: [(0, _jsxRuntime.
|
|
235
|
-
className: '
|
|
236
|
-
"
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
className: '
|
|
241
|
-
children:
|
|
242
|
-
className: 'Sqb-CaseKeyword keyword-branch keyword-else',
|
|
243
|
-
children: "else"
|
|
244
|
-
}), (0, _jsxRuntime.jsx)("div", {
|
|
245
|
-
className: 'Sqb-CaseSection-content Sqb-CaseSection-content--wrap',
|
|
246
|
-
children: elseContent
|
|
247
|
-
})]
|
|
248
|
-
}))
|
|
249
|
-
}), !readonly && (0, _jsxRuntime.jsx)("div", {
|
|
250
|
-
className: 'Sqb-CaseRow-actions when-row-actions',
|
|
251
|
-
children: (0, _jsxRuntime.jsx)(_pandora.Tooltip, {
|
|
252
|
-
title: "\u5220\u9664 else",
|
|
253
|
-
children: (0, _jsxRuntime.jsx)("button", {
|
|
254
|
-
type: 'button',
|
|
255
|
-
className: 'Sqb-CaseRow-remove',
|
|
256
|
-
style: removeButtonStyle,
|
|
257
|
-
onClick: onRemoveElse,
|
|
258
|
-
children: (0, _jsxRuntime.jsx)(_icons.CloseIcon, {
|
|
259
|
-
width: CASE_ICON_SIZE,
|
|
260
|
-
height: CASE_ICON_SIZE
|
|
261
|
-
})
|
|
262
|
-
})
|
|
263
|
-
})
|
|
264
|
-
})]
|
|
265
|
-
}), !readonly && !elseContent && (0, _jsxRuntime.jsx)(_pandora.Tooltip, {
|
|
266
|
-
title: "\u65B0\u589E else",
|
|
267
|
-
children: (0, _jsxRuntime.jsxs)("button", {
|
|
268
|
-
type: 'button',
|
|
269
|
-
className: (0, _classnames["default"])('Sqb-CaseRecover', 'recover-else-row'),
|
|
270
|
-
style: recoverButtonStyle,
|
|
271
|
-
onClick: onAddElse,
|
|
272
|
-
children: [(0, _jsxRuntime.jsx)(_pandoraIcons.FfPlus, {}), (0, _jsxRuntime.jsx)("span", {
|
|
273
|
-
children: "\u65B0\u589E else"
|
|
187
|
+
children: [(0, _jsxRuntime.jsxs)("div", {
|
|
188
|
+
className: getRegionClassName(elseRegionKey, 'CwLine', 'CwLine--else'),
|
|
189
|
+
children: [(0, _jsxRuntime.jsx)("div", {
|
|
190
|
+
className: 'CwLine-k',
|
|
191
|
+
children: "ELSE"
|
|
192
|
+
}), (0, _jsxRuntime.jsx)("div", {
|
|
193
|
+
className: 'CwLine-v',
|
|
194
|
+
children: elseContent
|
|
274
195
|
})]
|
|
275
|
-
})
|
|
196
|
+
}), !readonly && canClearElse && (0, _jsxRuntime.jsx)(CwBranchOps, {
|
|
197
|
+
deleteTitle: "\u6E05\u7A7A ELSE",
|
|
198
|
+
onDelete: onRemoveElse
|
|
199
|
+
})]
|
|
276
200
|
}), (0, _jsxRuntime.jsx)("div", {
|
|
277
|
-
className:
|
|
278
|
-
children: (0, _jsxRuntime.jsx)("
|
|
279
|
-
className: '
|
|
280
|
-
children: "
|
|
201
|
+
className: 'Sqb-FormulaGroup-row CwLine CwLine--end',
|
|
202
|
+
children: (0, _jsxRuntime.jsx)("div", {
|
|
203
|
+
className: 'CwLine-k',
|
|
204
|
+
children: "END"
|
|
281
205
|
})
|
|
282
206
|
})]
|
|
283
207
|
});
|
|
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
7
|
exports["default"] = void 0;
|
|
8
|
-
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/
|
|
8
|
+
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
|
|
9
9
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
10
10
|
var _react = _interopRequireDefault(require("react"));
|
|
11
11
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
@@ -41,51 +41,51 @@ var LogicGroup = function LogicGroup(_ref) {
|
|
|
41
41
|
}
|
|
42
42
|
};
|
|
43
43
|
var renderOperator = function renderOperator(operator, index) {
|
|
44
|
-
return (0, _jsxRuntime.jsx)(
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
disabled: item.key !== 'add' && !canDeleteItem
|
|
49
|
-
});
|
|
44
|
+
return (0, _jsxRuntime.jsx)("div", {
|
|
45
|
+
className: (0, _classnames["default"])('Sqb-LogicGroup-operator', {
|
|
46
|
+
'Sqb-LogicGroup-operator--and': operator === 'and',
|
|
47
|
+
'Sqb-LogicGroup-operator--or': operator === 'or'
|
|
50
48
|
}),
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
onChange: function onChange(action) {
|
|
58
|
-
handleOperatorMenuChange(index, action);
|
|
59
|
-
},
|
|
60
|
-
children: (0, _jsxRuntime.jsx)("button", {
|
|
61
|
-
type: 'button',
|
|
62
|
-
className: (0, _classnames["default"])(':Sqb-TableName', 'operator-trigger', 'logic-operator', {
|
|
63
|
-
'logic-and': operator === 'and',
|
|
64
|
-
'logic-or': operator === 'or'
|
|
49
|
+
children: (0, _jsxRuntime.jsx)(_pandora.Dropdown, {
|
|
50
|
+
trigger: 'contextMenu',
|
|
51
|
+
droplist: operatorMenuItems.map(function (item) {
|
|
52
|
+
return (0, _objectSpread2["default"])((0, _objectSpread2["default"])({}, item), {}, {
|
|
53
|
+
disabled: item.key !== 'add' && !canDeleteItem
|
|
54
|
+
});
|
|
65
55
|
}),
|
|
66
|
-
|
|
67
|
-
|
|
56
|
+
triggerProps: {
|
|
57
|
+
clickToClose: true,
|
|
58
|
+
style: {
|
|
59
|
+
zIndex: 9999
|
|
60
|
+
}
|
|
61
|
+
},
|
|
62
|
+
onChange: function onChange(action) {
|
|
63
|
+
handleOperatorMenuChange(index, action);
|
|
68
64
|
},
|
|
69
|
-
children:
|
|
65
|
+
children: (0, _jsxRuntime.jsx)("span", {
|
|
66
|
+
role: 'button',
|
|
67
|
+
tabIndex: 0,
|
|
68
|
+
className: (0, _classnames["default"])('Sqb-TableName', 'operator-trigger', 'logic-operator', {
|
|
69
|
+
'logic-and': operator === 'and',
|
|
70
|
+
'logic-or': operator === 'or'
|
|
71
|
+
}),
|
|
72
|
+
onClick: function onClick() {
|
|
73
|
+
return onChangeOperator(index, operator === 'or' ? 'and' : 'or');
|
|
74
|
+
},
|
|
75
|
+
onKeyDown: function onKeyDown(e) {
|
|
76
|
+
if (e.key === 'Enter' || e.key === ' ') {
|
|
77
|
+
e.preventDefault();
|
|
78
|
+
onChangeOperator(index, operator === 'or' ? 'and' : 'or');
|
|
79
|
+
}
|
|
80
|
+
},
|
|
81
|
+
children: operator.toUpperCase()
|
|
82
|
+
})
|
|
70
83
|
})
|
|
71
84
|
});
|
|
72
85
|
};
|
|
73
86
|
return (0, _jsxRuntime.jsxs)("div", {
|
|
74
|
-
className: (0, _classnames["default"])('Sqb-FormulaGroup', 'logic-group', 'formula-node-group'),
|
|
75
|
-
children: [(0, _jsxRuntime.jsx)(
|
|
76
|
-
className: 'Sqb-CaseKeyword',
|
|
77
|
-
children: "("
|
|
78
|
-
}), items.map(function (item, index) {
|
|
79
|
-
return (0, _jsxRuntime.jsxs)(_react["default"].Fragment, {
|
|
80
|
-
children: [index > 0 && renderOperator(item.operator || 'and', index), (0, _jsxRuntime.jsx)("div", {
|
|
81
|
-
className: 'Sqb-LogicGroup-content',
|
|
82
|
-
children: item.content
|
|
83
|
-
})]
|
|
84
|
-
}, index);
|
|
85
|
-
}), (0, _jsxRuntime.jsx)("span", {
|
|
86
|
-
className: 'Sqb-CaseKeyword',
|
|
87
|
-
children: ")"
|
|
88
|
-
}), !readonly && (0, _jsxRuntime.jsx)(_pandora.Tooltip, {
|
|
87
|
+
className: (0, _classnames["default"])('Sqb-FormulaGroup', 'logic-group', 'formula-node-group', 'CwBlock'),
|
|
88
|
+
children: [!readonly && (0, _jsxRuntime.jsx)(_pandora.Tooltip, {
|
|
89
89
|
title: "\u5220\u9664 and/or",
|
|
90
90
|
children: (0, _jsxRuntime.jsx)("button", {
|
|
91
91
|
type: 'button',
|
|
@@ -93,6 +93,22 @@ var LogicGroup = function LogicGroup(_ref) {
|
|
|
93
93
|
onClick: onDelete,
|
|
94
94
|
children: (0, _jsxRuntime.jsx)(_icons.CloseIcon, {})
|
|
95
95
|
})
|
|
96
|
+
}), (0, _jsxRuntime.jsx)("span", {
|
|
97
|
+
className: 'Sqb-LogicGroup-paren Sqb-LogicGroup-paren--open',
|
|
98
|
+
children: "("
|
|
99
|
+
}), (0, _jsxRuntime.jsx)("div", {
|
|
100
|
+
className: 'Sqb-LogicGroup-body',
|
|
101
|
+
children: items.map(function (item, index) {
|
|
102
|
+
return (0, _jsxRuntime.jsxs)(_react["default"].Fragment, {
|
|
103
|
+
children: [index > 0 && renderOperator(item.operator || 'and', index), (0, _jsxRuntime.jsx)("div", {
|
|
104
|
+
className: 'Sqb-LogicGroup-content',
|
|
105
|
+
children: item.content
|
|
106
|
+
})]
|
|
107
|
+
}, index);
|
|
108
|
+
})
|
|
109
|
+
}), (0, _jsxRuntime.jsx)("span", {
|
|
110
|
+
className: 'Sqb-LogicGroup-paren Sqb-LogicGroup-paren--close',
|
|
111
|
+
children: ")"
|
|
96
112
|
})]
|
|
97
113
|
});
|
|
98
114
|
};
|
|
@@ -17,7 +17,10 @@ interface PropsType {
|
|
|
17
17
|
embedded?: boolean;
|
|
18
18
|
enableCopy?: boolean;
|
|
19
19
|
enableZoom?: boolean;
|
|
20
|
+
checkActive?: boolean;
|
|
21
|
+
forceChecked?: boolean;
|
|
20
22
|
parentPopupChannel?: 'primary' | 'secondary';
|
|
23
|
+
pairBrackets?: boolean;
|
|
21
24
|
onAddSql?: (sql: string, availableTables?: any[], tableScope?: FormulaSqlTableScopeItem[]) => Promise<void | (() => void)> | void | (() => void);
|
|
22
25
|
}
|
|
23
26
|
declare const FormulaList: React.ForwardRefExoticComponent<PropsType & React.RefAttributes<unknown>>;
|