@gingkoo/pandora-metabase 0.0.14 → 0.0.16
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.
|
@@ -42,5 +42,5 @@ interface PropsType {
|
|
|
42
42
|
}) => void;
|
|
43
43
|
didUpdate?: Function;
|
|
44
44
|
}
|
|
45
|
-
declare const SelectJoinColumn: ({ data, value, theme, onSelect, isGroup, onGroup, didUpdate, }: PropsType) => import("react/jsx-runtime").JSX.Element;
|
|
45
|
+
declare const SelectJoinColumn: ({ data, value: _value, theme, onSelect, isGroup, onGroup, didUpdate, }: PropsType) => import("react/jsx-runtime").JSX.Element;
|
|
46
46
|
export default SelectJoinColumn;
|
package/lib/es/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @gingkoo/pandora-metabase v0.0.
|
|
2
|
+
* @gingkoo/pandora-metabase v0.0.16
|
|
3
3
|
*/
|
|
4
4
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
5
5
|
import * as React from 'react';
|
|
@@ -3658,7 +3658,7 @@ const IconMap = {
|
|
|
3658
3658
|
const OPEN_GROUP = false; // mr.chen 说不弄这块 弄个开关防止后面要用
|
|
3659
3659
|
const SelectJoinColumn = ({
|
|
3660
3660
|
data: _data = [],
|
|
3661
|
-
value,
|
|
3661
|
+
value: _value,
|
|
3662
3662
|
theme: _theme = ColumnsPopupThemeEnum.skyBlue,
|
|
3663
3663
|
onSelect,
|
|
3664
3664
|
isGroup,
|
|
@@ -3666,10 +3666,11 @@ const SelectJoinColumn = ({
|
|
|
3666
3666
|
didUpdate
|
|
3667
3667
|
}) => {
|
|
3668
3668
|
const store = useStore$1();
|
|
3669
|
-
const [
|
|
3670
|
-
const [
|
|
3669
|
+
const [value, setValue] = useState(_value); // 当前选择的字段
|
|
3670
|
+
const [curTable, setCurTable] = useState(_value.alias); // 当前选择的表
|
|
3671
|
+
const [curColumn, setCurColumn] = useState(_value.name); // 当前选择的字段
|
|
3671
3672
|
const [tableList, setTableList] = useState(_data.map((v, i) => {
|
|
3672
|
-
let open = !i && !
|
|
3673
|
+
let open = !i && !_value.alias ? true : v.alias === _value.alias; // TODO.这里只判断表名相等 没有用了 因为表上面加了一层数据源 先这样吧
|
|
3673
3674
|
return {
|
|
3674
3675
|
...v,
|
|
3675
3676
|
open,
|
|
@@ -3677,6 +3678,22 @@ const SelectJoinColumn = ({
|
|
|
3677
3678
|
columns: v.columns.slice()
|
|
3678
3679
|
};
|
|
3679
3680
|
}));
|
|
3681
|
+
useEffect(() => {
|
|
3682
|
+
setValue(_value);
|
|
3683
|
+
setCurTable(_value.alias);
|
|
3684
|
+
setCurColumn(_value.name);
|
|
3685
|
+
}, [_value]);
|
|
3686
|
+
useEffect(() => {
|
|
3687
|
+
setTableList(_data.map((v, i) => {
|
|
3688
|
+
let open = !i && !_value.alias ? true : v.alias === _value.alias; // TODO.这里只判断表名相等 没有用了 因为表上面加了一层数据源 先这样吧
|
|
3689
|
+
return {
|
|
3690
|
+
...v,
|
|
3691
|
+
open,
|
|
3692
|
+
searchText: '',
|
|
3693
|
+
columns: v.columns.slice()
|
|
3694
|
+
};
|
|
3695
|
+
}));
|
|
3696
|
+
}, [_data, _value]);
|
|
3680
3697
|
useEffect(() => {
|
|
3681
3698
|
didUpdate?.();
|
|
3682
3699
|
}, [tableList]);
|
|
@@ -5263,19 +5280,20 @@ const JoinData = props => {
|
|
|
5263
5280
|
});
|
|
5264
5281
|
}
|
|
5265
5282
|
function _getColumns(metaList) {
|
|
5266
|
-
let {
|
|
5267
|
-
ExistAboveGroupBy,
|
|
5268
|
-
prevList,
|
|
5269
|
-
prevGroupBy
|
|
5270
|
-
} = getHelper(metaList, {
|
|
5283
|
+
let obj = {
|
|
5271
5284
|
metaKey: -1,
|
|
5272
5285
|
type: TypeEnum.customColumn,
|
|
5273
5286
|
customColumn: [{
|
|
5274
5287
|
name: '',
|
|
5275
5288
|
// 用户起的别名
|
|
5276
|
-
formula: '
|
|
5289
|
+
formula: '' // 公式}];
|
|
5277
5290
|
}]
|
|
5278
|
-
}
|
|
5291
|
+
};
|
|
5292
|
+
let {
|
|
5293
|
+
ExistAboveGroupBy,
|
|
5294
|
+
prevList,
|
|
5295
|
+
prevGroupBy
|
|
5296
|
+
} = getHelper([...metaList, obj], obj);
|
|
5279
5297
|
let data;
|
|
5280
5298
|
if (ExistAboveGroupBy) {
|
|
5281
5299
|
let _data = {
|
|
@@ -5714,6 +5732,7 @@ const JoinData = props => {
|
|
|
5714
5732
|
const {
|
|
5715
5733
|
ref,
|
|
5716
5734
|
subToolbar,
|
|
5735
|
+
toolbar,
|
|
5717
5736
|
...other
|
|
5718
5737
|
} = store.preProps;
|
|
5719
5738
|
let newMeta = store.metaList.slice();
|
|
@@ -5725,7 +5744,7 @@ const JoinData = props => {
|
|
|
5725
5744
|
children: jsx(SqlVisionBuilder, {
|
|
5726
5745
|
...other,
|
|
5727
5746
|
_showSubquery: store.showSubquery,
|
|
5728
|
-
toolbar: subToolbar,
|
|
5747
|
+
toolbar: subToolbar || toolbar,
|
|
5729
5748
|
btnText: __('SqlQueryBuilder.confirm'),
|
|
5730
5749
|
value: val,
|
|
5731
5750
|
onOk: newList => {
|
|
@@ -5754,9 +5773,7 @@ const JoinData = props => {
|
|
|
5754
5773
|
}
|
|
5755
5774
|
})
|
|
5756
5775
|
}),
|
|
5757
|
-
onClose: () => {
|
|
5758
|
-
o.close();
|
|
5759
|
-
}
|
|
5776
|
+
onClose: () => {}
|
|
5760
5777
|
});
|
|
5761
5778
|
};
|
|
5762
5779
|
// 切换子查询
|
|
@@ -5833,8 +5850,8 @@ const JoinData = props => {
|
|
|
5833
5850
|
disabled: meta.readonly,
|
|
5834
5851
|
primary: meta.isSubquery,
|
|
5835
5852
|
ghost: true,
|
|
5836
|
-
className: cx('mr-2 operator-icon
|
|
5837
|
-
|
|
5853
|
+
className: cx('mr-2 operator-icon', {
|
|
5854
|
+
['subquery-icon']: !meta.isSubquery
|
|
5838
5855
|
}),
|
|
5839
5856
|
icon: jsx(RelatedWork, {}),
|
|
5840
5857
|
onClick: switchSubQuery
|