@gingkoo/pandora-metabase 1.0.100 → 1.0.101
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cjs/components/dialog/formula-list/index.js +15 -12
- package/lib/cjs/components/modules/custom-column.js +1 -1
- package/lib/cjs/components/modules/table-data.js +43 -39
- package/lib/es/components/dialog/formula-list/index.js +15 -12
- package/lib/es/components/modules/custom-column.js +2 -2
- package/lib/es/components/modules/table-data.js +44 -40
- package/package.json +1 -1
|
@@ -641,20 +641,23 @@ var FormulaList = (0, _react.forwardRef)(function (props, ref) {
|
|
|
641
641
|
}, index)
|
|
642
642
|
}, index);
|
|
643
643
|
} else if (v.type === _types.AtomsTypeEnum.SUB_QUERY) {
|
|
644
|
-
return (0, _jsxRuntime.
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
},
|
|
649
|
-
children: [v.label || (0, _locale.__)('SqlQueryBuilder.subquery'), (0, _jsxRuntime.jsx)("span", {
|
|
650
|
-
style: {
|
|
651
|
-
fontSize: 0
|
|
652
|
-
},
|
|
644
|
+
return (0, _jsxRuntime.jsx)(_itemName["default"], {
|
|
645
|
+
isError: (0, _utils2.isExistsError)(v.subQuery, store.existsError),
|
|
646
|
+
children: (0, _jsxRuntime.jsxs)("div", {
|
|
647
|
+
className: "Sqb-TableName purple-name",
|
|
653
648
|
onClick: function onClick(e) {
|
|
654
|
-
return
|
|
649
|
+
return showSubQuery(index);
|
|
655
650
|
},
|
|
656
|
-
children: (0, _jsxRuntime.jsx)(
|
|
657
|
-
|
|
651
|
+
children: [v.label || (0, _locale.__)('SqlQueryBuilder.subquery'), (0, _jsxRuntime.jsx)("span", {
|
|
652
|
+
style: {
|
|
653
|
+
fontSize: 0
|
|
654
|
+
},
|
|
655
|
+
onClick: function onClick(e) {
|
|
656
|
+
return handleDel(e, index);
|
|
657
|
+
},
|
|
658
|
+
children: (0, _jsxRuntime.jsx)(_icons.CloseIcon, {})
|
|
659
|
+
})]
|
|
660
|
+
}, index)
|
|
658
661
|
}, index);
|
|
659
662
|
} else if (type === _types.AtomsTypeEnum.FIELD) {
|
|
660
663
|
// 字段
|
|
@@ -333,7 +333,7 @@ var CustomColumn = function CustomColumn(props) {
|
|
|
333
333
|
className: "Sqb-NotebookCell gray-bg",
|
|
334
334
|
children: [meta.customColumn.map(function (v, i) {
|
|
335
335
|
return (0, _jsxRuntime.jsx)(_itemName["default"], {
|
|
336
|
-
isError: (0, _utils.isError)(v.formulaList, getColumns()),
|
|
336
|
+
isError: (0, _utils.isError)(v.formulaList, getColumns()) || (0, _utils.isExistsError)(v.formulaList, store.existsError),
|
|
337
337
|
children: (0, _jsxRuntime.jsxs)("div", {
|
|
338
338
|
className: (0, _classnames["default"])("Sqb-TableName gray-name"),
|
|
339
339
|
onClick: function onClick(e) {
|
|
@@ -23,6 +23,7 @@ var _utils = require("../../utils");
|
|
|
23
23
|
var _pandoraIcons = require("@gingkoo/pandora-icons");
|
|
24
24
|
var _cloneDeep = _interopRequireDefault(require("lodash/cloneDeep"));
|
|
25
25
|
var _isEqual = _interopRequireDefault(require("lodash/isEqual"));
|
|
26
|
+
var _itemName = _interopRequireDefault(require("./components/item-name"));
|
|
26
27
|
var _dialog = require("../dialog");
|
|
27
28
|
var _Wrapper = _interopRequireDefault(require("./components/Wrapper"));
|
|
28
29
|
var _metaIcon = _interopRequireDefault(require("./components/meta-icon"));
|
|
@@ -311,46 +312,49 @@ var TableData = function TableData(props) {
|
|
|
311
312
|
className: "Sqb-item--content",
|
|
312
313
|
children: (0, _jsxRuntime.jsxs)("div", {
|
|
313
314
|
className: "Sqb-NotebookCell",
|
|
314
|
-
children: [meta.isSubquery ? (0, _jsxRuntime.
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
315
|
+
children: [meta.isSubquery ? (0, _jsxRuntime.jsx)(_itemName["default"], {
|
|
316
|
+
isError: (0, _utils.isExistsError)(meta.subquery || [], store.existsError),
|
|
317
|
+
children: (0, _jsxRuntime.jsxs)("div", {
|
|
318
|
+
className: (0, _classnames["default"])("Sqb-TableName", {
|
|
319
|
+
notSelected: !subQuerySelected
|
|
320
|
+
}),
|
|
321
|
+
onClick: function onClick() {
|
|
322
|
+
showSubQuery(meta.subquery);
|
|
323
|
+
},
|
|
324
|
+
children: [subQuerySelected && (0, _jsxRuntime.jsx)(_jsxRuntime.Fragment, {
|
|
325
|
+
children: function () {
|
|
326
|
+
var showButton = store.tableEnableAlias || tableIsError() && isDel;
|
|
327
|
+
var icon = isDel ? (0, _jsxRuntime.jsx)(_pandoraIcons.ExclamationCircleFill, {}) : store.tableEnableAlias ? 'As' : '';
|
|
328
|
+
return showButton ? (0, _jsxRuntime.jsx)(_pandora.Tooltip, {
|
|
329
|
+
title: (0, _locale.__)(tableIsError() ? isDel ? 'metabase.verify' : 'SqlQueryBuilder.repeatAlias' : 'SqlQueryBuilder.alias'),
|
|
330
|
+
children: (0, _jsxRuntime.jsx)(_pandora.Button, {
|
|
331
|
+
danger: tableIsError(),
|
|
332
|
+
className: (0, _classnames["default"])(':Sqb-TableName-as', {
|
|
333
|
+
isError: tableIsError()
|
|
334
|
+
}),
|
|
335
|
+
shape: 'circle',
|
|
336
|
+
style: isDel ? {
|
|
337
|
+
fontSize: 18,
|
|
338
|
+
backgroundColor: '#fff',
|
|
339
|
+
width: 'auto',
|
|
340
|
+
height: 'auto'
|
|
341
|
+
} : {},
|
|
342
|
+
iconOnly: true,
|
|
343
|
+
primary: !isDel,
|
|
344
|
+
icon: icon,
|
|
345
|
+
size: 'small',
|
|
346
|
+
onClick: function onClick(e) {
|
|
347
|
+
if (store.tableEnableAlias) {
|
|
348
|
+
var _meta$table4;
|
|
349
|
+
e.stopPropagation();
|
|
350
|
+
onChangeTableAlias(((_meta$table4 = meta.table) === null || _meta$table4 === void 0 ? void 0 : _meta$table4.alias) || '');
|
|
351
|
+
}
|
|
348
352
|
}
|
|
349
|
-
}
|
|
350
|
-
})
|
|
351
|
-
})
|
|
352
|
-
}()
|
|
353
|
-
})
|
|
353
|
+
})
|
|
354
|
+
}) : null;
|
|
355
|
+
}()
|
|
356
|
+
}), subQuerySelected ? "".concat(((_meta$subquery2 = meta.subquery) === null || _meta$subquery2 === void 0 ? void 0 : _meta$subquery2[0]).table.datasourceName, ".").concat(((_meta$subquery3 = meta.subquery) === null || _meta$subquery3 === void 0 ? void 0 : _meta$subquery3[0]).table.name, " ").concat((_meta$table5 = meta.table) !== null && _meta$table5 !== void 0 && _meta$table5.alias && store.tableEnableAlias ? "as ".concat((_meta$table6 = meta.table) === null || _meta$table6 === void 0 ? void 0 : _meta$table6.alias) : '', " ") : (0, _locale.__)('SqlQueryBuilder.setSubQuery')]
|
|
357
|
+
})
|
|
354
358
|
}) : (0, _jsxRuntime.jsxs)("div", {
|
|
355
359
|
className: (0, _classnames["default"])("Sqb-TableName", {
|
|
356
360
|
notSelected: !selected
|
|
@@ -633,20 +633,23 @@ var FormulaList = forwardRef(function (props, ref) {
|
|
|
633
633
|
}, index)
|
|
634
634
|
}, index);
|
|
635
635
|
} else if (v.type === AtomsTypeEnum.SUB_QUERY) {
|
|
636
|
-
return
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
},
|
|
641
|
-
children: [v.label || __('SqlQueryBuilder.subquery'), _jsx("span", {
|
|
642
|
-
style: {
|
|
643
|
-
fontSize: 0
|
|
644
|
-
},
|
|
636
|
+
return _jsx(ItemName, {
|
|
637
|
+
isError: isExistsError(v.subQuery, store.existsError),
|
|
638
|
+
children: _jsxs("div", {
|
|
639
|
+
className: "Sqb-TableName purple-name",
|
|
645
640
|
onClick: function onClick(e) {
|
|
646
|
-
return
|
|
641
|
+
return showSubQuery(index);
|
|
647
642
|
},
|
|
648
|
-
children: _jsx(
|
|
649
|
-
|
|
643
|
+
children: [v.label || __('SqlQueryBuilder.subquery'), _jsx("span", {
|
|
644
|
+
style: {
|
|
645
|
+
fontSize: 0
|
|
646
|
+
},
|
|
647
|
+
onClick: function onClick(e) {
|
|
648
|
+
return handleDel(e, index);
|
|
649
|
+
},
|
|
650
|
+
children: _jsx(CloseIcon, {})
|
|
651
|
+
})]
|
|
652
|
+
}, index)
|
|
650
653
|
}, index);
|
|
651
654
|
} else if (type === AtomsTypeEnum.FIELD) {
|
|
652
655
|
// 字段
|
|
@@ -7,7 +7,7 @@ import { Modal2 } from '@gingkoo/pandora';
|
|
|
7
7
|
import { Provider } from '../../hooks/use-provider';
|
|
8
8
|
import cx from 'classnames';
|
|
9
9
|
import { __ } from '../../locale';
|
|
10
|
-
import { findIndex, isError } from '../../utils';
|
|
10
|
+
import { findIndex, isError, isExistsError } from '../../utils';
|
|
11
11
|
import { sleep, flatArray } from '../../utils/helper';
|
|
12
12
|
import { ChangeType } from '../../store/types';
|
|
13
13
|
import { getHelper } from '../../utils';
|
|
@@ -329,7 +329,7 @@ var CustomColumn = function CustomColumn(props) {
|
|
|
329
329
|
className: "Sqb-NotebookCell gray-bg",
|
|
330
330
|
children: [meta.customColumn.map(function (v, i) {
|
|
331
331
|
return _jsx(ItemName, {
|
|
332
|
-
isError: isError(v.formulaList, getColumns()),
|
|
332
|
+
isError: isError(v.formulaList, getColumns()) || isExistsError(v.formulaList, store.existsError),
|
|
333
333
|
children: _jsxs("div", {
|
|
334
334
|
className: cx("Sqb-TableName gray-name"),
|
|
335
335
|
onClick: function onClick(e) {
|
|
@@ -13,10 +13,11 @@ import { ChangeType } from '../../store/types';
|
|
|
13
13
|
import { Tooltip, Button, Modal, Modal2, Input, Toast } from '@gingkoo/pandora';
|
|
14
14
|
import Metabase from '../../index';
|
|
15
15
|
import { uuidv4, getAlias } from '../../utils/helper';
|
|
16
|
-
import { changeTableAlias, getSubColumns, isValidSQLAlias } from '../../utils';
|
|
16
|
+
import { changeTableAlias, getSubColumns, isValidSQLAlias, isExistsError } from '../../utils';
|
|
17
17
|
import { RelatedWork } from '@gingkoo/pandora-icons';
|
|
18
18
|
import cloneDeep from 'lodash/cloneDeep';
|
|
19
19
|
import isEqual from 'lodash/isEqual';
|
|
20
|
+
import ItemName from './components/item-name';
|
|
20
21
|
import { SelectTable, SelectColumn } from '../dialog';
|
|
21
22
|
import Wrapper from './components/Wrapper';
|
|
22
23
|
import NextDom from './components/meta-icon';
|
|
@@ -305,46 +306,49 @@ var TableData = function TableData(props) {
|
|
|
305
306
|
className: "Sqb-item--content",
|
|
306
307
|
children: _jsxs("div", {
|
|
307
308
|
className: "Sqb-NotebookCell",
|
|
308
|
-
children: [meta.isSubquery ?
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
309
|
+
children: [meta.isSubquery ? _jsx(ItemName, {
|
|
310
|
+
isError: isExistsError(meta.subquery || [], store.existsError),
|
|
311
|
+
children: _jsxs("div", {
|
|
312
|
+
className: cx("Sqb-TableName", {
|
|
313
|
+
notSelected: !subQuerySelected
|
|
314
|
+
}),
|
|
315
|
+
onClick: function onClick() {
|
|
316
|
+
showSubQuery(meta.subquery);
|
|
317
|
+
},
|
|
318
|
+
children: [subQuerySelected && _jsx(_Fragment, {
|
|
319
|
+
children: function () {
|
|
320
|
+
var showButton = store.tableEnableAlias || tableIsError() && isDel;
|
|
321
|
+
var icon = isDel ? _jsx(ExclamationCircleFill, {}) : store.tableEnableAlias ? 'As' : '';
|
|
322
|
+
return showButton ? _jsx(Tooltip, {
|
|
323
|
+
title: __(tableIsError() ? isDel ? 'metabase.verify' : 'SqlQueryBuilder.repeatAlias' : 'SqlQueryBuilder.alias'),
|
|
324
|
+
children: _jsx(Button, {
|
|
325
|
+
danger: tableIsError(),
|
|
326
|
+
className: cx(':Sqb-TableName-as', {
|
|
327
|
+
isError: tableIsError()
|
|
328
|
+
}),
|
|
329
|
+
shape: 'circle',
|
|
330
|
+
style: isDel ? {
|
|
331
|
+
fontSize: 18,
|
|
332
|
+
backgroundColor: '#fff',
|
|
333
|
+
width: 'auto',
|
|
334
|
+
height: 'auto'
|
|
335
|
+
} : {},
|
|
336
|
+
iconOnly: true,
|
|
337
|
+
primary: !isDel,
|
|
338
|
+
icon: icon,
|
|
339
|
+
size: 'small',
|
|
340
|
+
onClick: function onClick(e) {
|
|
341
|
+
if (store.tableEnableAlias) {
|
|
342
|
+
var _meta$table4;
|
|
343
|
+
e.stopPropagation();
|
|
344
|
+
onChangeTableAlias(((_meta$table4 = meta.table) === null || _meta$table4 === void 0 ? void 0 : _meta$table4.alias) || '');
|
|
345
|
+
}
|
|
342
346
|
}
|
|
343
|
-
}
|
|
344
|
-
})
|
|
345
|
-
})
|
|
346
|
-
}()
|
|
347
|
-
})
|
|
347
|
+
})
|
|
348
|
+
}) : null;
|
|
349
|
+
}()
|
|
350
|
+
}), subQuerySelected ? "".concat(((_meta$subquery2 = meta.subquery) === null || _meta$subquery2 === void 0 ? void 0 : _meta$subquery2[0]).table.datasourceName, ".").concat(((_meta$subquery3 = meta.subquery) === null || _meta$subquery3 === void 0 ? void 0 : _meta$subquery3[0]).table.name, " ").concat((_meta$table5 = meta.table) !== null && _meta$table5 !== void 0 && _meta$table5.alias && store.tableEnableAlias ? "as ".concat((_meta$table6 = meta.table) === null || _meta$table6 === void 0 ? void 0 : _meta$table6.alias) : '', " ") : __('SqlQueryBuilder.setSubQuery')]
|
|
351
|
+
})
|
|
348
352
|
}) : _jsxs("div", {
|
|
349
353
|
className: cx("Sqb-TableName", {
|
|
350
354
|
notSelected: !selected
|