@gingkoo/pandora-metabase 1.0.27 → 1.0.29
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 +21 -10
- package/lib/cjs/components/dialog/select-join-column/index.js +13 -2
- 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 +215 -81
- 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 +21 -10
- package/lib/es/components/dialog/select-join-column/index.js +13 -2
- 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 +216 -82
- 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,6 @@ var IconMap = {
|
|
|
46
46
|
};
|
|
47
47
|
var OPEN_GROUP = false; // mr.chen 说不弄这块 弄个开关防止后面要用
|
|
48
48
|
var SelectJoinColumn = function SelectJoinColumn(_ref) {
|
|
49
|
-
var _value$;
|
|
50
49
|
var _ref$data = _ref.data,
|
|
51
50
|
data = _ref$data === void 0 ? [] : _ref$data,
|
|
52
51
|
_value = _ref.value,
|
|
@@ -68,7 +67,7 @@ var SelectJoinColumn = function SelectJoinColumn(_ref) {
|
|
|
68
67
|
_useState2 = (0, _slicedToArray2["default"])(_useState, 2),
|
|
69
68
|
value = _useState2[0],
|
|
70
69
|
setValue = _useState2[1]; // 当前选择的字段
|
|
71
|
-
var _useState3 = (0, _react.useState)(
|
|
70
|
+
var _useState3 = (0, _react.useState)(''),
|
|
72
71
|
_useState4 = (0, _slicedToArray2["default"])(_useState3, 2),
|
|
73
72
|
curTable = _useState4[0],
|
|
74
73
|
setCurTable = _useState4[1]; // 当前选择的表
|
|
@@ -84,16 +83,28 @@ var SelectJoinColumn = function SelectJoinColumn(_ref) {
|
|
|
84
83
|
_useState6 = (0, _slicedToArray2["default"])(_useState5, 2),
|
|
85
84
|
tableList = _useState6[0],
|
|
86
85
|
setTableList = _useState6[1];
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
86
|
+
(0, _react.useEffect)(function () {
|
|
87
|
+
var _value$, _value$2;
|
|
88
|
+
var tableUuid = _value === null || _value === void 0 || (_value$ = _value[0]) === null || _value$ === void 0 ? void 0 : _value$.tableUuid;
|
|
89
|
+
if ((_value === null || _value === void 0 || (_value$2 = _value[0]) === null || _value$2 === void 0 ? void 0 : _value$2.tableId) === _helper.SummarizeAlias) {
|
|
90
|
+
tableUuid = '';
|
|
91
|
+
} else {
|
|
92
|
+
var isHas = data.filter(function (v) {
|
|
93
|
+
return v.tableUuid === tableUuid;
|
|
94
|
+
});
|
|
95
|
+
if (isHas.length < 1) {
|
|
96
|
+
tableUuid = data[0].tableUuid;
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
setCurTable(tableUuid);
|
|
100
|
+
}, [data, _value]);
|
|
90
101
|
(0, _react.useEffect)(function () {
|
|
91
102
|
// setCurColumn(_value);
|
|
92
103
|
setValue(_value);
|
|
93
104
|
}, [_value]);
|
|
94
|
-
var isActive = function isActive(
|
|
105
|
+
var isActive = function isActive(id) {
|
|
95
106
|
return (value === null || value === void 0 ? void 0 : value.filter(function (v) {
|
|
96
|
-
return v.
|
|
107
|
+
return v.fieldId === id;
|
|
97
108
|
}).length) > 0;
|
|
98
109
|
};
|
|
99
110
|
(0, _react.useEffect)(function () {
|
|
@@ -139,7 +150,7 @@ var SelectJoinColumn = function SelectJoinColumn(_ref) {
|
|
|
139
150
|
return;
|
|
140
151
|
}
|
|
141
152
|
var isHas = (value === null || value === void 0 || (_value$filter = value.filter(function (v) {
|
|
142
|
-
return v.
|
|
153
|
+
return v.fieldId === (val === null || val === void 0 ? void 0 : val.fieldId);
|
|
143
154
|
})) === null || _value$filter === void 0 ? void 0 : _value$filter.length) > 0;
|
|
144
155
|
var _value = value;
|
|
145
156
|
if (tableUuid != curTable) {
|
|
@@ -149,7 +160,7 @@ var SelectJoinColumn = function SelectJoinColumn(_ref) {
|
|
|
149
160
|
_value.push(val);
|
|
150
161
|
} else {
|
|
151
162
|
_value = _value.filter(function (v) {
|
|
152
|
-
return v.
|
|
163
|
+
return v.fieldId != (val === null || val === void 0 ? void 0 : val.fieldId);
|
|
153
164
|
});
|
|
154
165
|
}
|
|
155
166
|
setValue(_value);
|
|
@@ -269,7 +280,7 @@ var SelectJoinColumn = function SelectJoinColumn(_ref) {
|
|
|
269
280
|
className: (0, _classnames["default"])("Sqb-List-section"),
|
|
270
281
|
children: (0, _jsxRuntime.jsx)("div", {
|
|
271
282
|
className: (0, _classnames["default"])("Sqb-List-item mx-2", {
|
|
272
|
-
active: isActive(v.
|
|
283
|
+
active: isActive(v.id)
|
|
273
284
|
}),
|
|
274
285
|
onClick: function onClick() {
|
|
275
286
|
if (isSummarize) {
|
|
@@ -82,12 +82,19 @@ var SelectJoinColumn = function SelectJoinColumn(_ref) {
|
|
|
82
82
|
setTableList = _useState8[1];
|
|
83
83
|
(0, _react.useEffect)(function () {
|
|
84
84
|
setValue(_value);
|
|
85
|
-
setCurTable(_value.tableUuid);
|
|
86
85
|
setCurColumn(_value.name);
|
|
87
86
|
}, [_value]);
|
|
88
87
|
(0, _react.useEffect)(function () {
|
|
88
|
+
var tableUuid = _value === null || _value === void 0 ? void 0 : _value.tableUuid;
|
|
89
|
+
var isHas = data.filter(function (v) {
|
|
90
|
+
return v.tableUuid === tableUuid;
|
|
91
|
+
});
|
|
92
|
+
if (isHas.length < 1) {
|
|
93
|
+
tableUuid = data[0].tableUuid;
|
|
94
|
+
}
|
|
95
|
+
setCurTable(tableUuid);
|
|
89
96
|
setTableList(data.map(function (v, i) {
|
|
90
|
-
var open = !i && !
|
|
97
|
+
var open = !i && !tableUuid ? true : v.tableUuid === tableUuid; // TODO.这里只判断表名相等 没有用了 因为表上面加了一层数据源 先这样吧
|
|
91
98
|
return (0, _objectSpread2["default"])((0, _objectSpread2["default"])({}, v), {}, {
|
|
92
99
|
open: open,
|
|
93
100
|
searchText: '',
|
|
@@ -240,6 +247,8 @@ var SelectJoinColumn = function SelectJoinColumn(_ref) {
|
|
|
240
247
|
return onGroup((0, _objectSpread2["default"])((0, _objectSpread2["default"])((0, _objectSpread2["default"])({}, _value), {}, {
|
|
241
248
|
tableUuid: tableUuid || _value.tableUuid
|
|
242
249
|
}, v), {}, {
|
|
250
|
+
datasourceId: datasourceId,
|
|
251
|
+
datasourceName: datasourceName,
|
|
243
252
|
table: table,
|
|
244
253
|
tableId: tableId,
|
|
245
254
|
alias: tableAlias,
|
|
@@ -311,6 +320,8 @@ var SelectJoinColumn = function SelectJoinColumn(_ref) {
|
|
|
311
320
|
return onGroup((0, _objectSpread2["default"])((0, _objectSpread2["default"])((0, _objectSpread2["default"])({}, _value), {}, {
|
|
312
321
|
tableUuid: tableUuid || _value.tableUuid
|
|
313
322
|
}, v), {}, {
|
|
323
|
+
datasourceId: datasourceId,
|
|
324
|
+
datasourceName: datasourceName,
|
|
314
325
|
table: table,
|
|
315
326
|
tableId: tableId,
|
|
316
327
|
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,
|