@gingkoo/pandora-metabase 0.0.15 → 0.0.17

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 v0.0.15
2
+ * @gingkoo/pandora-metabase v0.0.17
3
3
  */
4
4
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
5
5
  import * as React from 'react';
@@ -132,13 +132,20 @@ const useStore = () => {
132
132
  const [sourceList, setSourceList] = useState([]); //数据源列表
133
133
  const [_cacheSource2TableMap, set_cacheSource2TableMap] = useState({}); //数据源id 对应数据集列表
134
134
  const [_cacheColumnsMap, set_cacheColumnsMap] = useState({}); //数据源id 对应数据集列表
135
- const [metaList, setMeta] = useState(defaultMetaList); //数据源id 对应数据集列表
135
+ const [metaList, _setMeta] = useState(defaultMetaList); //数据源id 对应数据集列表
136
136
  const [popupData, setPopup] = useState({
137
137
  visible: false,
138
138
  node: null,
139
139
  content: null
140
140
  }); //弹窗
141
141
  const [popupClosable, setClosable] = useState(defaultMetaList); //是否可关闭 如果弹框里面再弹框 则不可关闭
142
+ const setMeta = list => {
143
+ if (list.length) {
144
+ _setMeta(list);
145
+ } else {
146
+ _setMeta(defaultMetaList);
147
+ }
148
+ };
142
149
  // const [fetchDatasetFn, setFetchDatasetFn] = useState<(id: string) => Promise<any>>(
143
150
  // async () => {},
144
151
  // ); //fn
@@ -5757,7 +5764,8 @@ const JoinData = props => {
5757
5764
  newMeta[index].subquery = newList;
5758
5765
  newMeta[index].table2 = {
5759
5766
  ...newList[0].table,
5760
- column: ''
5767
+ column: '',
5768
+ column_id: ''
5761
5769
  };
5762
5770
  const items = _getColumns(newList);
5763
5771
  const newColumns = items.flatMap(item => item.columns);
@@ -5773,9 +5781,7 @@ const JoinData = props => {
5773
5781
  }
5774
5782
  })
5775
5783
  }),
5776
- onClose: () => {
5777
- o.close();
5778
- }
5784
+ onClose: () => {}
5779
5785
  });
5780
5786
  };
5781
5787
  // 切换子查询
@@ -5852,8 +5858,8 @@ const JoinData = props => {
5852
5858
  disabled: meta.readonly,
5853
5859
  primary: meta.isSubquery,
5854
5860
  ghost: true,
5855
- className: cx('mr-2 operator-icon subquery-icon', {
5856
- isSubquery: !meta.isSubquery
5861
+ className: cx('mr-2 operator-icon', {
5862
+ ['subquery-icon']: !meta.isSubquery
5857
5863
  }),
5858
5864
  icon: jsx(RelatedWork, {}),
5859
5865
  onClick: switchSubQuery
@@ -7263,7 +7269,8 @@ const SqlVisionBuilder = /*#__PURE__*/React__default.forwardRef((props, ref) =>
7263
7269
  store.setProps(props);
7264
7270
  }, [props]);
7265
7271
  useEffect(() => {
7266
- store.setPreData(value);
7272
+ store.setMeta(value);
7273
+ // store.setPreData(value);
7267
7274
  }, [JSON.stringify(value)]);
7268
7275
  useEffect(() => {
7269
7276
  store.setSourceList(sourceList);