@gingkoo/pandora-metabase 1.0.0-alpha.21 → 1.0.0-alpha.23

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/es/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @gingkoo/pandora-metabase v1.0.0-alpha.21
2
+ * @gingkoo/pandora-metabase v1.0.0-alpha.23
3
3
  */
4
4
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
5
5
  import * as React from 'react';
@@ -725,7 +725,7 @@ const changeTableAlias = (list, curObj) => {
725
725
  alias
726
726
  } = cloneDeep(curObj);
727
727
  const newList = cloneDeep(list);
728
- newList?.map(v => {
728
+ return newList?.map(v => {
729
729
  if (v.type === TypeEnum.data) {
730
730
  if (v.table.tableUuid === tableUuid) {
731
731
  v.table.alias = alias;
@@ -774,7 +774,7 @@ const changeTableAlias = (list, curObj) => {
774
774
  v.by.map(by => {
775
775
  if (by.tableUuid === tableUuid) {
776
776
  by.alias = alias;
777
- by.sql = `${by.alias}.${by.realName || by.name} AS ${by.fieldAlias}`;
777
+ by.sql = `${by.alias}.${by.realName || by.name}`;
778
778
  }
779
779
  });
780
780
  }
@@ -816,13 +816,16 @@ const changeTableAlias = (list, curObj) => {
816
816
  item.table2.alias = alias;
817
817
  // item.table2.sql = '';
818
818
  }
819
+ if (item.subquery) {
820
+ item.subquery = changeTableAlias(item.subquery || [], curObj);
821
+ }
819
822
  });
820
823
  }
821
824
  if (v.subquery) {
822
825
  v.subquery = changeTableAlias(v.subquery || [], curObj);
823
826
  }
824
- });
825
- return newList || [];
827
+ return v;
828
+ }) || [];
826
829
  };
827
830
  const changeFieldAlias = (list, curObj) => {
828
831
  const {
@@ -830,7 +833,7 @@ const changeFieldAlias = (list, curObj) => {
830
833
  fieldAlias
831
834
  } = cloneDeep(curObj);
832
835
  const newList = cloneDeep(list);
833
- newList.map(v => {
836
+ return newList?.map(v => {
834
837
  if (v.type === TypeEnum.data) ;
835
838
  if (v.type === TypeEnum.joinData) {
836
839
  if (v.table1.fieldUuid === fieldUuid) {
@@ -887,7 +890,7 @@ const changeFieldAlias = (list, curObj) => {
887
890
  v.by.map(by => {
888
891
  if (by.fieldUuid === fieldUuid) {
889
892
  by.fieldAlias = fieldAlias;
890
- by.sql = `${by.alias}.${by.realName || by.name} AS ${by.fieldAlias}`;
893
+ by.sql = `${by.alias}.${by.realName || by.name}`;
891
894
  }
892
895
  });
893
896
  }
@@ -926,10 +929,12 @@ const changeFieldAlias = (list, curObj) => {
926
929
  // }
927
930
  // }
928
931
  }
932
+ if (item.subquery) {
933
+ item.subquery = changeFieldAlias(item.subquery || [], curObj);
934
+ }
929
935
  });
930
936
  }
931
- });
932
- return newList;
937
+ }) || [];
933
938
  };
934
939
  function splitByUnion(data) {
935
940
  if (!data) return [];
@@ -7564,6 +7569,9 @@ const Filter = props => {
7564
7569
  let {
7565
7570
  filter
7566
7571
  } = meta;
7572
+ const {
7573
+ notExistsColumns
7574
+ } = store.preProps;
7567
7575
  React__default.useRef(null);
7568
7576
  let index = findIndex(store.metaList[groupIndex].list, meta);
7569
7577
  let notSelected = !meta.filter.length;
@@ -7673,7 +7681,7 @@ const Filter = props => {
7673
7681
  showNotExists(i, '');
7674
7682
  return;
7675
7683
  }
7676
- let data = getColumns();
7684
+ let data = [...getColumns(), ...cloneDeep(notExistsColumns)];
7677
7685
  store.setPopup({
7678
7686
  visible: true,
7679
7687
  node: e.currentTarget,
@@ -7783,6 +7791,7 @@ const Filter = props => {
7783
7791
  let _toolbar = notExistsToolbar || toolbar;
7784
7792
  _toolbar = _toolbar.filter(v => v !== 'group'); // 子查询不需要分组
7785
7793
  let zIndex = store.popupContainer.current ? getMaxZIndexInParents(store.popupContainer.current) : null;
7794
+ let notExistsColumns = getColumns();
7786
7795
  let o = Modal2.openModal({
7787
7796
  title: 'NOT EXISTS',
7788
7797
  transparentMask: true,
@@ -7790,6 +7799,7 @@ const Filter = props => {
7790
7799
  content: jsx(Fragment, {
7791
7800
  children: jsx(SqlVisionBuilder, {
7792
7801
  ...other,
7802
+ notExistsColumns: notExistsColumns,
7793
7803
  showFields: false,
7794
7804
  showSubquery: false,
7795
7805
  toolbar: _toolbar,