@gingkoo/pandora-metabase 1.0.27 → 1.0.28
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 +11 -12
- package/lib/cjs/components/dialog/custom-column/expression-editor.js +1 -2
- package/lib/cjs/components/dialog/custom-column/tokenizedI-input.js +1 -2
- package/lib/cjs/components/dialog/expression/index.js +11 -12
- package/lib/cjs/components/dialog/formula-list/index.js +53 -43
- package/lib/cjs/components/dialog/index.js +2 -2
- package/lib/cjs/components/dialog/select-column/index.js +4 -4
- package/lib/cjs/components/dialog/select-column-multiple/index.js +7 -7
- package/lib/cjs/components/dialog/select-join-column/index.js +4 -0
- package/lib/cjs/components/dialog/select-permission-table/index.js +2 -2
- package/lib/cjs/components/dialog/select-table/index.js +7 -7
- package/lib/cjs/components/icons.js +36 -36
- package/lib/cjs/components/metabase/index.js +41 -12
- package/lib/cjs/components/metabase/index.less +3 -0
- package/lib/cjs/components/modules/components/Wrapper.js +6 -6
- package/lib/cjs/components/modules/components/item-name.d.ts +7 -0
- package/lib/cjs/components/modules/components/item-name.js +34 -0
- package/lib/cjs/components/modules/components/meta-icon.js +6 -0
- package/lib/cjs/components/modules/custom-column.js +25 -25
- package/lib/cjs/components/modules/filter.js +2 -2
- package/lib/cjs/components/modules/join-data.js +206 -80
- package/lib/cjs/components/modules/permission-table.js +24 -10
- package/lib/cjs/components/modules/sort.js +17 -13
- package/lib/cjs/components/modules/summarize/group-by.js +90 -38
- package/lib/cjs/components/modules/summarize/select-index.js +84 -38
- package/lib/cjs/components/modules/table-data.js +14 -6
- package/lib/cjs/components/popup.js +1 -2
- package/lib/cjs/hooks/use-state.js +58 -65
- package/lib/cjs/index.js +1 -2
- package/lib/cjs/locale/en.js +5 -2
- package/lib/cjs/locale/zh.js +5 -2
- package/lib/cjs/utils/transformSql.d.ts +6 -0
- package/lib/cjs/utils/transformSql.js +968 -0
- package/lib/cjs/utils.d.ts +7 -1
- package/lib/cjs/utils.js +112 -15
- package/lib/es/common/SplitView/index.js +10 -10
- package/lib/es/components/dialog/expression/index.js +10 -10
- package/lib/es/components/dialog/formula-list/index.js +54 -44
- package/lib/es/components/dialog/select-column/index.js +4 -4
- package/lib/es/components/dialog/select-column-multiple/index.js +7 -7
- package/lib/es/components/dialog/select-join-column/index.js +4 -0
- package/lib/es/components/dialog/select-permission-table/index.js +2 -2
- package/lib/es/components/dialog/select-table/index.js +7 -7
- package/lib/es/components/icons.js +36 -36
- package/lib/es/components/metabase/index.js +42 -13
- package/lib/es/components/metabase/index.less +3 -0
- package/lib/es/components/modules/components/Wrapper.js +6 -6
- package/lib/es/components/modules/components/item-name.d.ts +7 -0
- package/lib/es/components/modules/components/item-name.js +28 -0
- package/lib/es/components/modules/components/meta-icon.js +6 -0
- package/lib/es/components/modules/custom-column.js +26 -26
- package/lib/es/components/modules/filter.js +2 -2
- package/lib/es/components/modules/join-data.js +207 -81
- package/lib/es/components/modules/permission-table.js +24 -10
- package/lib/es/components/modules/sort.js +18 -14
- package/lib/es/components/modules/summarize/group-by.js +92 -40
- package/lib/es/components/modules/summarize/select-index.js +86 -40
- package/lib/es/components/modules/table-data.js +14 -6
- package/lib/es/hooks/use-state.js +58 -65
- package/lib/es/locale/en.js +5 -2
- package/lib/es/locale/zh.js +5 -2
- package/lib/es/utils/transformSql.d.ts +6 -0
- package/lib/es/utils/transformSql.js +961 -0
- package/lib/es/utils.d.ts +7 -1
- package/lib/es/utils.js +102 -4
- package/package.json +1 -1
|
@@ -15,8 +15,7 @@ var _styledComponents = _interopRequireDefault(require("styled-components"));
|
|
|
15
15
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
16
16
|
var _winsize = require("../../hooks/winsize");
|
|
17
17
|
var _templateObject;
|
|
18
|
-
function
|
|
19
|
-
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; }
|
|
18
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, "default": e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
|
|
20
19
|
var StyledSashHorizontal = _styledComponents["default"].div.attrs({
|
|
21
20
|
className: 'view-sash horizontal'
|
|
22
21
|
})(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2["default"])(["\n top: ", ";\n"])), function (props) {
|
|
@@ -61,17 +60,17 @@ var SplitView = _react["default"].forwardRef(function (props, ref) {
|
|
|
61
60
|
hMaximum = _useState8[0],
|
|
62
61
|
setHMaximum = _useState8[1];
|
|
63
62
|
var _useState9 = (0, _react.useState)(false),
|
|
64
|
-
|
|
65
|
-
vMinimum =
|
|
66
|
-
setVMinimum =
|
|
67
|
-
var
|
|
63
|
+
_useState0 = (0, _slicedToArray2["default"])(_useState9, 2),
|
|
64
|
+
vMinimum = _useState0[0],
|
|
65
|
+
setVMinimum = _useState0[1];
|
|
66
|
+
var _useState1 = (0, _react.useState)(false),
|
|
67
|
+
_useState10 = (0, _slicedToArray2["default"])(_useState1, 2),
|
|
68
|
+
vMaximum = _useState10[0],
|
|
69
|
+
setVMaximum = _useState10[1];
|
|
70
|
+
var _useState11 = (0, _react.useState)(0),
|
|
68
71
|
_useState12 = (0, _slicedToArray2["default"])(_useState11, 2),
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
var _useState13 = (0, _react.useState)(0),
|
|
72
|
-
_useState14 = (0, _slicedToArray2["default"])(_useState13, 2),
|
|
73
|
-
bottomHeight = _useState14[0],
|
|
74
|
-
setBottomHeight = _useState14[1];
|
|
72
|
+
bottomHeight = _useState12[0],
|
|
73
|
+
setBottomHeight = _useState12[1];
|
|
75
74
|
_react["default"].useImperativeHandle(ref, function () {
|
|
76
75
|
return {
|
|
77
76
|
open: function open() {
|
|
@@ -18,8 +18,7 @@ var _popup = _interopRequireDefault(require("../../popup"));
|
|
|
18
18
|
var _selectList = _interopRequireDefault(require("./dialog/select-list"));
|
|
19
19
|
var _functionTip = _interopRequireDefault(require("./dialog/function-tip"));
|
|
20
20
|
var _useProvider = require("../../../hooks/use-provider");
|
|
21
|
-
function
|
|
22
|
-
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; }
|
|
21
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, "default": e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
|
|
23
22
|
var ErrorMessage = function ErrorMessage(_ref) {
|
|
24
23
|
var msg = _ref.msg;
|
|
25
24
|
if (!msg) return null;
|
|
@@ -20,8 +20,7 @@ var _reactDom = _interopRequireDefault(require("react-dom"));
|
|
|
20
20
|
var _server = _interopRequireDefault(require("react-dom/server"));
|
|
21
21
|
var _selection = require("../../../utils/selection");
|
|
22
22
|
var _tokenizedExpression = _interopRequireDefault(require("./tokenized-expression"));
|
|
23
|
-
function
|
|
24
|
-
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; }
|
|
23
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, "default": e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
|
|
25
24
|
function _callSuper(t, o, e) { return o = (0, _getPrototypeOf2["default"])(o), (0, _possibleConstructorReturn2["default"])(t, (0, _isNativeReflectConstruct2["default"])() ? Reflect.construct(o, e || [], (0, _getPrototypeOf2["default"])(t).constructor) : o.apply(t, e)); }
|
|
26
25
|
var TokenizedInput = /*#__PURE__*/function (_React$Component) {
|
|
27
26
|
function TokenizedInput() {
|
|
@@ -25,8 +25,7 @@ var _selectColumnMultiple = _interopRequireDefault(require("../select-column-mul
|
|
|
25
25
|
var _icons = require("../../icons");
|
|
26
26
|
var _useProvider = require("../../../hooks/use-provider");
|
|
27
27
|
var _cloneDeep = _interopRequireDefault(require("lodash/cloneDeep"));
|
|
28
|
-
function
|
|
29
|
-
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; }
|
|
28
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, "default": e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
|
|
30
29
|
/**
|
|
31
30
|
* 关联模块 选择表字段
|
|
32
31
|
*/
|
|
@@ -89,18 +88,18 @@ var SelectFilterColumn = function SelectFilterColumn(_ref) {
|
|
|
89
88
|
special_type = _useState8[0],
|
|
90
89
|
setSpecial_type = _useState8[1];
|
|
91
90
|
var _useState9 = (0, _react.useState)(value.formula || {}),
|
|
92
|
-
|
|
93
|
-
formula =
|
|
94
|
-
setFormula =
|
|
91
|
+
_useState0 = (0, _slicedToArray2["default"])(_useState9, 2),
|
|
92
|
+
formula = _useState0[0],
|
|
93
|
+
setFormula = _useState0[1];
|
|
95
94
|
var store = (0, _useProvider.useStore)();
|
|
96
|
-
var
|
|
95
|
+
var _useState1 = (0, _react.useState)(false),
|
|
96
|
+
_useState10 = (0, _slicedToArray2["default"])(_useState1, 2),
|
|
97
|
+
popupVisible = _useState10[0],
|
|
98
|
+
setPopupVisible = _useState10[1];
|
|
99
|
+
var _useState11 = (0, _react.useState)((value === null || value === void 0 || (_value$lhs = value.lhs) === null || _value$lhs === void 0 ? void 0 : _value$lhs.length) > 0 || false),
|
|
97
100
|
_useState12 = (0, _slicedToArray2["default"])(_useState11, 2),
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
var _useState13 = (0, _react.useState)((value === null || value === void 0 || (_value$lhs = value.lhs) === null || _value$lhs === void 0 ? void 0 : _value$lhs.length) > 0 || false),
|
|
101
|
-
_useState14 = (0, _slicedToArray2["default"])(_useState13, 2),
|
|
102
|
-
isNext = _useState14[0],
|
|
103
|
-
setIsNext = _useState14[1];
|
|
101
|
+
isNext = _useState12[0],
|
|
102
|
+
setIsNext = _useState12[1];
|
|
104
103
|
var table2Selected = Boolean(rhsVal && (rhsVal === null || rhsVal === void 0 ? void 0 : rhsVal.length) > 0);
|
|
105
104
|
var disabled = (0, _react.useMemo)(function () {
|
|
106
105
|
if (!condition) return true;
|
|
@@ -27,6 +27,7 @@ var _utils2 = require("./utils");
|
|
|
27
27
|
var _selectList = _interopRequireDefault(require("../../dialog/select-list"));
|
|
28
28
|
var _arrow = _interopRequireDefault(require("./arrow.svg"));
|
|
29
29
|
var _useProvider = require("../../../hooks/use-provider");
|
|
30
|
+
var _itemName = _interopRequireDefault(require("../../modules/components/item-name"));
|
|
30
31
|
var _excluded = ["notExistsToolbar", "toolbar"]; // import './index.less';
|
|
31
32
|
var FormulaList = (0, _react.forwardRef)(function (props, ref) {
|
|
32
33
|
var value = props.value,
|
|
@@ -162,7 +163,7 @@ var FormulaList = (0, _react.forwardRef)(function (props, ref) {
|
|
|
162
163
|
showSubquery: false,
|
|
163
164
|
toolbar: _toolbar,
|
|
164
165
|
btnText: (0, _locale.__)('SqlQueryBuilder.confirm'),
|
|
165
|
-
value: _value,
|
|
166
|
+
value: (0, _cloneDeep["default"])(_value),
|
|
166
167
|
onOk: function onOk(newList) {
|
|
167
168
|
try {
|
|
168
169
|
// 子查询未改变不做操作
|
|
@@ -256,23 +257,26 @@ var FormulaList = (0, _react.forwardRef)(function (props, ref) {
|
|
|
256
257
|
}, index);
|
|
257
258
|
} else if (type === _types.AtomsTypeEnum.FIELD) {
|
|
258
259
|
// 字段
|
|
259
|
-
return (0, _jsxRuntime.
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
},
|
|
266
|
-
children: [!(v !== null && v !== void 0 && v.fieldName) && (0, _locale.__)('customColumn.selectField'), v.fieldName, (0, _jsxRuntime.jsx)("span", {
|
|
267
|
-
style: {
|
|
268
|
-
fontSize: 0
|
|
269
|
-
},
|
|
260
|
+
return (0, _jsxRuntime.jsx)(_itemName["default"], {
|
|
261
|
+
isError: (0, _utils.isError)(v, data),
|
|
262
|
+
children: (0, _jsxRuntime.jsxs)("div", {
|
|
263
|
+
className: (0, _classnames["default"])("Sqb-TableName ", {
|
|
264
|
+
notSelected: !(v !== null && v !== void 0 && v.fieldName)
|
|
265
|
+
}),
|
|
270
266
|
onClick: function onClick(e) {
|
|
271
|
-
return
|
|
267
|
+
return handleField(e, index, v);
|
|
272
268
|
},
|
|
273
|
-
children: (0, _jsxRuntime.jsx)(
|
|
274
|
-
|
|
275
|
-
|
|
269
|
+
children: [!(v !== null && v !== void 0 && v.fieldName) && (0, _locale.__)('customColumn.selectField'), v.fieldName, (0, _jsxRuntime.jsx)("span", {
|
|
270
|
+
style: {
|
|
271
|
+
fontSize: 0
|
|
272
|
+
},
|
|
273
|
+
onClick: function onClick(e) {
|
|
274
|
+
return handleDel(e, index);
|
|
275
|
+
},
|
|
276
|
+
children: (0, _jsxRuntime.jsx)(_icons.CloseIcon, {})
|
|
277
|
+
})]
|
|
278
|
+
})
|
|
279
|
+
}, index);
|
|
276
280
|
} else if (type === _types.AtomsTypeEnum.INPUT_STRING) {
|
|
277
281
|
// 输入框
|
|
278
282
|
return (0, _jsxRuntime.jsxs)("div", {
|
|
@@ -371,39 +375,45 @@ var FormulaList = (0, _react.forwardRef)(function (props, ref) {
|
|
|
371
375
|
}, index);
|
|
372
376
|
} else if (type === _types.AtomsTypeEnum.EXPRESSION) {
|
|
373
377
|
// 表达式
|
|
374
|
-
return (0, _jsxRuntime.
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
},
|
|
381
|
-
children: [v.quotes ? v.quotes : (0, _locale.__)('customColumn.selectExpression'), (0, _jsxRuntime.jsx)("span", {
|
|
382
|
-
style: {
|
|
383
|
-
fontSize: 0
|
|
384
|
-
},
|
|
378
|
+
return (0, _jsxRuntime.jsx)(_itemName["default"], {
|
|
379
|
+
isError: (0, _utils.isError)(v, data),
|
|
380
|
+
children: (0, _jsxRuntime.jsxs)("div", {
|
|
381
|
+
className: (0, _classnames["default"])("Sqb-TableName purple-name", {
|
|
382
|
+
notSelected: !v.quotes
|
|
383
|
+
}),
|
|
385
384
|
onClick: function onClick(e) {
|
|
386
|
-
return
|
|
385
|
+
return handleExpression(e, index, v);
|
|
387
386
|
},
|
|
388
|
-
children: (0, _jsxRuntime.jsx)(
|
|
389
|
-
|
|
390
|
-
|
|
387
|
+
children: [v.quotes ? v.quotes : (0, _locale.__)('customColumn.selectExpression'), (0, _jsxRuntime.jsx)("span", {
|
|
388
|
+
style: {
|
|
389
|
+
fontSize: 0
|
|
390
|
+
},
|
|
391
|
+
onClick: function onClick(e) {
|
|
392
|
+
return handleDel(e, index);
|
|
393
|
+
},
|
|
394
|
+
children: (0, _jsxRuntime.jsx)(_icons.CloseIcon, {})
|
|
395
|
+
})]
|
|
396
|
+
})
|
|
397
|
+
}, index);
|
|
391
398
|
} else if (type === _types.AtomsTypeEnum.FORMULA) {
|
|
392
399
|
// 公式
|
|
393
|
-
return (0, _jsxRuntime.
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
},
|
|
398
|
-
children: [v.quotes ? v.quotes : (0, _locale.__)('customColumn.selectFormula'), (0, _jsxRuntime.jsx)("span", {
|
|
399
|
-
style: {
|
|
400
|
-
fontSize: 0
|
|
401
|
-
},
|
|
400
|
+
return (0, _jsxRuntime.jsx)(_itemName["default"], {
|
|
401
|
+
isError: (0, _utils.isError)(v, data),
|
|
402
|
+
children: (0, _jsxRuntime.jsxs)("div", {
|
|
403
|
+
className: (0, _classnames["default"])("Sqb-TableName gray-name"),
|
|
402
404
|
onClick: function onClick(e) {
|
|
403
|
-
return
|
|
405
|
+
return showFunction(e, index);
|
|
404
406
|
},
|
|
405
|
-
children: (0, _jsxRuntime.jsx)(
|
|
406
|
-
|
|
407
|
+
children: [v.quotes ? v.quotes : (0, _locale.__)('customColumn.selectFormula'), (0, _jsxRuntime.jsx)("span", {
|
|
408
|
+
style: {
|
|
409
|
+
fontSize: 0
|
|
410
|
+
},
|
|
411
|
+
onClick: function onClick(e) {
|
|
412
|
+
return handleDel(e, index);
|
|
413
|
+
},
|
|
414
|
+
children: (0, _jsxRuntime.jsx)(_icons.CloseIcon, {})
|
|
415
|
+
})]
|
|
416
|
+
})
|
|
407
417
|
}, index);
|
|
408
418
|
} else {
|
|
409
419
|
return (0, _jsxRuntime.jsx)(_pandora.Select, {
|
|
@@ -13,7 +13,7 @@ Object.defineProperty(exports, "CustomColumnPopup", {
|
|
|
13
13
|
Object.defineProperty(exports, "Expression", {
|
|
14
14
|
enumerable: true,
|
|
15
15
|
get: function get() {
|
|
16
|
-
return
|
|
16
|
+
return _index0["default"];
|
|
17
17
|
}
|
|
18
18
|
});
|
|
19
19
|
Object.defineProperty(exports, "FormulaList", {
|
|
@@ -79,5 +79,5 @@ var _index6 = _interopRequireDefault(require("./select-join/index"));
|
|
|
79
79
|
var _index7 = _interopRequireDefault(require("./select-table/index"));
|
|
80
80
|
var _index8 = _interopRequireDefault(require("./select-permission-table/index"));
|
|
81
81
|
var _index9 = _interopRequireDefault(require("./formula-list/index"));
|
|
82
|
-
var
|
|
82
|
+
var _index0 = _interopRequireDefault(require("./expression/index"));
|
|
83
83
|
var _utils = require("./formula-list/utils");
|
|
@@ -104,16 +104,16 @@ var SelectColumn = function SelectColumn(_ref) {
|
|
|
104
104
|
onOk: function () {
|
|
105
105
|
var _onOk = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee() {
|
|
106
106
|
var newColumns, newMetaList;
|
|
107
|
-
return _regenerator["default"].wrap(function
|
|
107
|
+
return _regenerator["default"].wrap(function (_context) {
|
|
108
108
|
while (1) switch (_context.prev = _context.next) {
|
|
109
109
|
case 0:
|
|
110
110
|
if ((0, _utils.isValidSQLAlias)(fieldAlias)) {
|
|
111
|
-
_context.next =
|
|
111
|
+
_context.next = 1;
|
|
112
112
|
break;
|
|
113
113
|
}
|
|
114
114
|
_pandora.Toast.warning((0, _locale.__)('SqlQueryBuilder.aliasForRules'));
|
|
115
115
|
return _context.abrupt("return", false);
|
|
116
|
-
case
|
|
116
|
+
case 1:
|
|
117
117
|
newColumns = (0, _cloneDeep["default"])(columns);
|
|
118
118
|
newMetaList = store.metaList[groupIndex].list.slice();
|
|
119
119
|
newColumns[i].fieldAlias = fieldAlias;
|
|
@@ -124,7 +124,7 @@ var SelectColumn = function SelectColumn(_ref) {
|
|
|
124
124
|
setTimeout(function () {
|
|
125
125
|
store.setClosable(true);
|
|
126
126
|
}, 0);
|
|
127
|
-
case
|
|
127
|
+
case 2:
|
|
128
128
|
case "end":
|
|
129
129
|
return _context.stop();
|
|
130
130
|
}
|
|
@@ -46,7 +46,7 @@ var IconMap = {
|
|
|
46
46
|
};
|
|
47
47
|
var OPEN_GROUP = false; // mr.chen 说不弄这块 弄个开关防止后面要用
|
|
48
48
|
var SelectJoinColumn = function SelectJoinColumn(_ref) {
|
|
49
|
-
var _value
|
|
49
|
+
var _value$, _value$2;
|
|
50
50
|
var _ref$data = _ref.data,
|
|
51
51
|
data = _ref$data === void 0 ? [] : _ref$data,
|
|
52
52
|
_value = _ref.value,
|
|
@@ -68,7 +68,7 @@ var SelectJoinColumn = function SelectJoinColumn(_ref) {
|
|
|
68
68
|
_useState2 = (0, _slicedToArray2["default"])(_useState, 2),
|
|
69
69
|
value = _useState2[0],
|
|
70
70
|
setValue = _useState2[1]; // 当前选择的字段
|
|
71
|
-
var _useState3 = (0, _react.useState)(_value === null || _value === void 0 || (_value$ = _value[0]) === null || _value$ === void 0 ? void 0 : _value$.tableUuid),
|
|
71
|
+
var _useState3 = (0, _react.useState)((_value === null || _value === void 0 || (_value$ = _value[0]) === null || _value$ === void 0 ? void 0 : _value$.tableId) === _helper.SummarizeAlias ? '' : _value === null || _value === void 0 || (_value$2 = _value[0]) === null || _value$2 === void 0 ? void 0 : _value$2.tableUuid),
|
|
72
72
|
_useState4 = (0, _slicedToArray2["default"])(_useState3, 2),
|
|
73
73
|
curTable = _useState4[0],
|
|
74
74
|
setCurTable = _useState4[1]; // 当前选择的表
|
|
@@ -91,9 +91,9 @@ var SelectJoinColumn = function SelectJoinColumn(_ref) {
|
|
|
91
91
|
// setCurColumn(_value);
|
|
92
92
|
setValue(_value);
|
|
93
93
|
}, [_value]);
|
|
94
|
-
var isActive = function isActive(
|
|
94
|
+
var isActive = function isActive(id) {
|
|
95
95
|
return (value === null || value === void 0 ? void 0 : value.filter(function (v) {
|
|
96
|
-
return v.
|
|
96
|
+
return v.fieldId === id;
|
|
97
97
|
}).length) > 0;
|
|
98
98
|
};
|
|
99
99
|
(0, _react.useEffect)(function () {
|
|
@@ -139,7 +139,7 @@ var SelectJoinColumn = function SelectJoinColumn(_ref) {
|
|
|
139
139
|
return;
|
|
140
140
|
}
|
|
141
141
|
var isHas = (value === null || value === void 0 || (_value$filter = value.filter(function (v) {
|
|
142
|
-
return v.
|
|
142
|
+
return v.fieldId === (val === null || val === void 0 ? void 0 : val.fieldId);
|
|
143
143
|
})) === null || _value$filter === void 0 ? void 0 : _value$filter.length) > 0;
|
|
144
144
|
var _value = value;
|
|
145
145
|
if (tableUuid != curTable) {
|
|
@@ -149,7 +149,7 @@ var SelectJoinColumn = function SelectJoinColumn(_ref) {
|
|
|
149
149
|
_value.push(val);
|
|
150
150
|
} else {
|
|
151
151
|
_value = _value.filter(function (v) {
|
|
152
|
-
return v.
|
|
152
|
+
return v.fieldId != (val === null || val === void 0 ? void 0 : val.fieldId);
|
|
153
153
|
});
|
|
154
154
|
}
|
|
155
155
|
setValue(_value);
|
|
@@ -269,7 +269,7 @@ var SelectJoinColumn = function SelectJoinColumn(_ref) {
|
|
|
269
269
|
className: (0, _classnames["default"])("Sqb-List-section"),
|
|
270
270
|
children: (0, _jsxRuntime.jsx)("div", {
|
|
271
271
|
className: (0, _classnames["default"])("Sqb-List-item mx-2", {
|
|
272
|
-
active: isActive(v.
|
|
272
|
+
active: isActive(v.id)
|
|
273
273
|
}),
|
|
274
274
|
onClick: function onClick() {
|
|
275
275
|
if (isSummarize) {
|
|
@@ -240,6 +240,8 @@ var SelectJoinColumn = function SelectJoinColumn(_ref) {
|
|
|
240
240
|
return onGroup((0, _objectSpread2["default"])((0, _objectSpread2["default"])((0, _objectSpread2["default"])({}, _value), {}, {
|
|
241
241
|
tableUuid: tableUuid || _value.tableUuid
|
|
242
242
|
}, v), {}, {
|
|
243
|
+
datasourceId: datasourceId,
|
|
244
|
+
datasourceName: datasourceName,
|
|
243
245
|
table: table,
|
|
244
246
|
tableId: tableId,
|
|
245
247
|
alias: tableAlias,
|
|
@@ -311,6 +313,8 @@ var SelectJoinColumn = function SelectJoinColumn(_ref) {
|
|
|
311
313
|
return onGroup((0, _objectSpread2["default"])((0, _objectSpread2["default"])((0, _objectSpread2["default"])({}, _value), {}, {
|
|
312
314
|
tableUuid: tableUuid || _value.tableUuid
|
|
313
315
|
}, v), {}, {
|
|
316
|
+
datasourceId: datasourceId,
|
|
317
|
+
datasourceName: datasourceName,
|
|
314
318
|
table: table,
|
|
315
319
|
tableId: tableId,
|
|
316
320
|
alias: tableAlias,
|
|
@@ -59,12 +59,12 @@ var SelectPermissionTable = function SelectPermissionTable(_ref) {
|
|
|
59
59
|
}), (0, _jsxRuntime.jsx)("div", {
|
|
60
60
|
children: (0, _jsxRuntime.jsxs)("h4", {
|
|
61
61
|
className: 'List-item-title ml-2',
|
|
62
|
-
children: [v.datasourceName ? "".concat(v.datasourceName, ".") : '', v.name === 'source' ? PrevResult : v.name]
|
|
62
|
+
children: [v.datasourceName ? "".concat(v.datasourceName, ".") : '', v.name === 'source' ? PrevResult : v.alias || v.name]
|
|
63
63
|
})
|
|
64
64
|
})]
|
|
65
65
|
})
|
|
66
66
|
})
|
|
67
|
-
}, v.name);
|
|
67
|
+
}, v.alias || v.name);
|
|
68
68
|
})
|
|
69
69
|
})
|
|
70
70
|
})
|
|
@@ -50,9 +50,9 @@ var SelectTable = function SelectTable(_ref) {
|
|
|
50
50
|
originList = _useState8[0],
|
|
51
51
|
setOriginList = _useState8[1];
|
|
52
52
|
var _useState9 = (0, _react.useState)(value),
|
|
53
|
-
|
|
54
|
-
val =
|
|
55
|
-
setVal =
|
|
53
|
+
_useState0 = (0, _slicedToArray2["default"])(_useState9, 2),
|
|
54
|
+
val = _useState0[0],
|
|
55
|
+
setVal = _useState0[1];
|
|
56
56
|
(0, _react.useEffect)(function () {
|
|
57
57
|
if (value.datasourceId) {
|
|
58
58
|
getTables(value.datasourceId);
|
|
@@ -64,18 +64,18 @@ var SelectTable = function SelectTable(_ref) {
|
|
|
64
64
|
function _getTables() {
|
|
65
65
|
_getTables = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee(datasourceId) {
|
|
66
66
|
var tables;
|
|
67
|
-
return _regenerator["default"].wrap(function
|
|
67
|
+
return _regenerator["default"].wrap(function (_context) {
|
|
68
68
|
while (1) switch (_context.prev = _context.next) {
|
|
69
69
|
case 0:
|
|
70
70
|
setLoading(true);
|
|
71
|
-
_context.next =
|
|
71
|
+
_context.next = 1;
|
|
72
72
|
return store.fetchDataset(datasourceId);
|
|
73
|
-
case
|
|
73
|
+
case 1:
|
|
74
74
|
tables = _context.sent;
|
|
75
75
|
setLoading(false);
|
|
76
76
|
setList(tables);
|
|
77
77
|
setOriginList(tables);
|
|
78
|
-
case
|
|
78
|
+
case 2:
|
|
79
79
|
case "end":
|
|
80
80
|
return _context.stop();
|
|
81
81
|
}
|
|
@@ -176,12 +176,12 @@ var LeftJoinIcon = exports.LeftJoinIcon = function LeftJoinIcon(_ref9) {
|
|
|
176
176
|
})
|
|
177
177
|
});
|
|
178
178
|
};
|
|
179
|
-
var InnerJoinIcon = exports.InnerJoinIcon = function InnerJoinIcon(
|
|
180
|
-
var
|
|
181
|
-
width =
|
|
182
|
-
|
|
183
|
-
height =
|
|
184
|
-
style =
|
|
179
|
+
var InnerJoinIcon = exports.InnerJoinIcon = function InnerJoinIcon(_ref0) {
|
|
180
|
+
var _ref0$width = _ref0.width,
|
|
181
|
+
width = _ref0$width === void 0 ? 32 : _ref0$width,
|
|
182
|
+
_ref0$height = _ref0.height,
|
|
183
|
+
height = _ref0$height === void 0 ? 32 : _ref0$height,
|
|
184
|
+
style = _ref0.style;
|
|
185
185
|
return (0, _jsxRuntime.jsx)("svg", {
|
|
186
186
|
viewBox: '0 0 32 32',
|
|
187
187
|
width: width,
|
|
@@ -195,11 +195,11 @@ var InnerJoinIcon = exports.InnerJoinIcon = function InnerJoinIcon(_ref10) {
|
|
|
195
195
|
})
|
|
196
196
|
});
|
|
197
197
|
};
|
|
198
|
-
var UpArrowIcon = exports.UpArrowIcon = function UpArrowIcon(
|
|
199
|
-
var
|
|
200
|
-
width =
|
|
201
|
-
|
|
202
|
-
height =
|
|
198
|
+
var UpArrowIcon = exports.UpArrowIcon = function UpArrowIcon(_ref1) {
|
|
199
|
+
var _ref1$width = _ref1.width,
|
|
200
|
+
width = _ref1$width === void 0 ? 16 : _ref1$width,
|
|
201
|
+
_ref1$height = _ref1.height,
|
|
202
|
+
height = _ref1$height === void 0 ? 17 : _ref1$height;
|
|
203
203
|
return (0, _jsxRuntime.jsx)("svg", {
|
|
204
204
|
className: 'sort-arrow',
|
|
205
205
|
viewBox: '0 0 32 34',
|
|
@@ -213,11 +213,11 @@ var UpArrowIcon = exports.UpArrowIcon = function UpArrowIcon(_ref11) {
|
|
|
213
213
|
})
|
|
214
214
|
});
|
|
215
215
|
};
|
|
216
|
-
var DownArrowIcon = exports.DownArrowIcon = function DownArrowIcon(
|
|
217
|
-
var
|
|
218
|
-
width =
|
|
219
|
-
|
|
220
|
-
height =
|
|
216
|
+
var DownArrowIcon = exports.DownArrowIcon = function DownArrowIcon(_ref10) {
|
|
217
|
+
var _ref10$width = _ref10.width,
|
|
218
|
+
width = _ref10$width === void 0 ? 16 : _ref10$width,
|
|
219
|
+
_ref10$height = _ref10.height,
|
|
220
|
+
height = _ref10$height === void 0 ? 17 : _ref10$height;
|
|
221
221
|
return (0, _jsxRuntime.jsx)("svg", {
|
|
222
222
|
className: 'sort-arrow',
|
|
223
223
|
viewBox: '0 0 32 34',
|
|
@@ -231,11 +231,11 @@ var DownArrowIcon = exports.DownArrowIcon = function DownArrowIcon(_ref12) {
|
|
|
231
231
|
})
|
|
232
232
|
});
|
|
233
233
|
};
|
|
234
|
-
var CloseIcon = exports.CloseIcon = function CloseIcon(
|
|
235
|
-
var
|
|
236
|
-
width =
|
|
237
|
-
|
|
238
|
-
height =
|
|
234
|
+
var CloseIcon = exports.CloseIcon = function CloseIcon(_ref11) {
|
|
235
|
+
var _ref11$width = _ref11.width,
|
|
236
|
+
width = _ref11$width === void 0 ? 16 : _ref11$width,
|
|
237
|
+
_ref11$height = _ref11.height,
|
|
238
|
+
height = _ref11$height === void 0 ? 16 : _ref11$height;
|
|
239
239
|
return (0, _jsxRuntime.jsx)("svg", {
|
|
240
240
|
className: 'closeIcon',
|
|
241
241
|
viewBox: '0 0 32 32',
|
|
@@ -249,11 +249,11 @@ var CloseIcon = exports.CloseIcon = function CloseIcon(_ref13) {
|
|
|
249
249
|
})
|
|
250
250
|
});
|
|
251
251
|
};
|
|
252
|
-
var AddIcon = exports.AddIcon = function AddIcon(
|
|
253
|
-
var
|
|
254
|
-
width =
|
|
255
|
-
|
|
256
|
-
height =
|
|
252
|
+
var AddIcon = exports.AddIcon = function AddIcon(_ref12) {
|
|
253
|
+
var _ref12$width = _ref12.width,
|
|
254
|
+
width = _ref12$width === void 0 ? 16 : _ref12$width,
|
|
255
|
+
_ref12$height = _ref12.height,
|
|
256
|
+
height = _ref12$height === void 0 ? 16 : _ref12$height;
|
|
257
257
|
return (0, _jsxRuntime.jsx)("svg", {
|
|
258
258
|
viewBox: '0 0 32 32',
|
|
259
259
|
width: width,
|
|
@@ -266,11 +266,11 @@ var AddIcon = exports.AddIcon = function AddIcon(_ref14) {
|
|
|
266
266
|
})
|
|
267
267
|
});
|
|
268
268
|
};
|
|
269
|
-
var TableIcon = exports.TableIcon = function TableIcon(
|
|
270
|
-
var
|
|
271
|
-
width =
|
|
272
|
-
|
|
273
|
-
height =
|
|
269
|
+
var TableIcon = exports.TableIcon = function TableIcon(_ref13) {
|
|
270
|
+
var _ref13$width = _ref13.width,
|
|
271
|
+
width = _ref13$width === void 0 ? 18 : _ref13$width,
|
|
272
|
+
_ref13$height = _ref13.height,
|
|
273
|
+
height = _ref13$height === void 0 ? 18 : _ref13$height;
|
|
274
274
|
return (0, _jsxRuntime.jsx)("svg", {
|
|
275
275
|
viewBox: '0 0 32 32',
|
|
276
276
|
width: width,
|
|
@@ -283,11 +283,11 @@ var TableIcon = exports.TableIcon = function TableIcon(_ref15) {
|
|
|
283
283
|
})
|
|
284
284
|
});
|
|
285
285
|
};
|
|
286
|
-
var SearchIcon = exports.SearchIcon = function SearchIcon(
|
|
287
|
-
var
|
|
288
|
-
width =
|
|
289
|
-
|
|
290
|
-
height =
|
|
286
|
+
var SearchIcon = exports.SearchIcon = function SearchIcon(_ref14) {
|
|
287
|
+
var _ref14$width = _ref14.width,
|
|
288
|
+
width = _ref14$width === void 0 ? 16 : _ref14$width,
|
|
289
|
+
_ref14$height = _ref14.height,
|
|
290
|
+
height = _ref14$height === void 0 ? 16 : _ref14$height;
|
|
291
291
|
return (0, _jsxRuntime.jsx)("svg", {
|
|
292
292
|
viewBox: '0 0 32 32',
|
|
293
293
|
width: width,
|
|
@@ -52,11 +52,40 @@ var Metabase = function Metabase(props) {
|
|
|
52
52
|
if (!visible) return null;
|
|
53
53
|
return content;
|
|
54
54
|
}, [store.popupData2]);
|
|
55
|
+
var onCheck = function onCheck() {
|
|
56
|
+
var doms = store.popupContainer.current.querySelectorAll('.isError');
|
|
57
|
+
if (doms.length) {
|
|
58
|
+
_pandora.Modal.confirm({
|
|
59
|
+
title: (0, _locale.__)('metabase.prompt'),
|
|
60
|
+
content: (0, _locale.__)('metabase.validationFailed'),
|
|
61
|
+
onOk: function () {
|
|
62
|
+
var _onOk = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee() {
|
|
63
|
+
return _regenerator["default"].wrap(function (_context) {
|
|
64
|
+
while (1) switch (_context.prev = _context.next) {
|
|
65
|
+
case 0:
|
|
66
|
+
_context.next = 1;
|
|
67
|
+
return onSave();
|
|
68
|
+
case 1:
|
|
69
|
+
case "end":
|
|
70
|
+
return _context.stop();
|
|
71
|
+
}
|
|
72
|
+
}, _callee);
|
|
73
|
+
}));
|
|
74
|
+
function onOk() {
|
|
75
|
+
return _onOk.apply(this, arguments);
|
|
76
|
+
}
|
|
77
|
+
return onOk;
|
|
78
|
+
}()
|
|
79
|
+
});
|
|
80
|
+
} else {
|
|
81
|
+
onSave();
|
|
82
|
+
}
|
|
83
|
+
};
|
|
55
84
|
var onSave = /*#__PURE__*/function () {
|
|
56
|
-
var _ref = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function
|
|
85
|
+
var _ref = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee2() {
|
|
57
86
|
var intercept, _metaList;
|
|
58
|
-
return _regenerator["default"].wrap(function
|
|
59
|
-
while (1) switch (
|
|
87
|
+
return _regenerator["default"].wrap(function (_context2) {
|
|
88
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
60
89
|
case 0:
|
|
61
90
|
intercept = false; // 是否返回
|
|
62
91
|
_metaList = (0, _utils.splitByUnion)(store.metaList);
|
|
@@ -69,21 +98,21 @@ var Metabase = function Metabase(props) {
|
|
|
69
98
|
}
|
|
70
99
|
});
|
|
71
100
|
if (!(saveLoading || intercept)) {
|
|
72
|
-
|
|
101
|
+
_context2.next = 1;
|
|
73
102
|
break;
|
|
74
103
|
}
|
|
75
|
-
return
|
|
76
|
-
case
|
|
104
|
+
return _context2.abrupt("return", null);
|
|
105
|
+
case 1:
|
|
77
106
|
setSaveLoading(true);
|
|
78
|
-
|
|
107
|
+
_context2.next = 2;
|
|
79
108
|
return onOk === null || onOk === void 0 ? void 0 : onOk(_metaList);
|
|
80
|
-
case
|
|
109
|
+
case 2:
|
|
81
110
|
setSaveLoading(false);
|
|
82
|
-
case
|
|
111
|
+
case 3:
|
|
83
112
|
case "end":
|
|
84
|
-
return
|
|
113
|
+
return _context2.stop();
|
|
85
114
|
}
|
|
86
|
-
},
|
|
115
|
+
}, _callee2);
|
|
87
116
|
}));
|
|
88
117
|
return function onSave() {
|
|
89
118
|
return _ref.apply(this, arguments);
|
|
@@ -126,7 +155,7 @@ var Metabase = function Metabase(props) {
|
|
|
126
155
|
className: ":Sqb-btn",
|
|
127
156
|
loading: saveLoading,
|
|
128
157
|
disabled: saveLoading,
|
|
129
|
-
onClick:
|
|
158
|
+
onClick: onCheck,
|
|
130
159
|
children: btnText || (0, _locale.__)('SqlQueryBuilder.visualize')
|
|
131
160
|
}) : null, store.popupContainer.current && (0, _jsxRuntime.jsx)(_popup["default"], {
|
|
132
161
|
container: store.popupData.container || store.popupContainer.current,
|