@gingkoo/pandora-metabase 1.0.0-alpha.12 → 1.0.0-alpha.14

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.12
2
+ * @gingkoo/pandora-metabase v1.0.0-alpha.14
3
3
  */
4
4
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
5
5
  import * as React from 'react';
@@ -1177,10 +1177,6 @@ const useStore = () => {
1177
1177
  let newList = item.list?.map((v, i) => {
1178
1178
  let newMeta = item.list;
1179
1179
  // 替换column
1180
- if (newMeta[i].type === TypeEnum.joinData) {
1181
- newMeta[i] = setQuotes(newMeta[i]);
1182
- setMeta(newMeta, groupIndex);
1183
- }
1184
1180
  // 设置右侧column
1185
1181
  if (v.table2?.datasourceId && v.columns.length < 1) {
1186
1182
  fetchColumns(newMeta[i].table2, newMeta[i].table2.datasourceId, columns => {
@@ -1192,6 +1188,10 @@ const useStore = () => {
1192
1188
  } else {
1193
1189
  newMeta[i].columns = columns;
1194
1190
  }
1191
+ if (v.type === TypeEnum.joinData) {
1192
+ newMeta[i] = setQuotes(newMeta[i]);
1193
+ setMeta(newMeta, groupIndex);
1194
+ }
1195
1195
  setMeta(newMeta, groupIndex);
1196
1196
  });
1197
1197
  return {
@@ -1211,6 +1211,10 @@ const useStore = () => {
1211
1211
  newMeta[i].columns = columns;
1212
1212
  v.columns = columns;
1213
1213
  }
1214
+ if (v.type === TypeEnum.joinData) {
1215
+ newMeta[i] = setQuotes(newMeta[i]);
1216
+ setMeta(newMeta, groupIndex);
1217
+ }
1214
1218
  setMeta(newMeta, groupIndex);
1215
1219
  });
1216
1220
  return {
@@ -5630,6 +5634,33 @@ const TableData = props => {
5630
5634
  };
5631
5635
 
5632
5636
  const PrevResult$1 = 'Previous results';
5637
+ function setQuotes(_meta) {
5638
+ let newMeta = cloneDeep(_meta);
5639
+ newMeta.table1 = {
5640
+ ...newMeta.table1,
5641
+ fieldAlias: newMeta.table1.fieldAlias || newMeta.table1.column,
5642
+ fieldUuid: newMeta.table1.fieldUuid || newMeta.table1.column_id,
5643
+ quotes: newMeta.table1.quotes || newMeta.table1.column
5644
+ };
5645
+ newMeta.table2 = {
5646
+ ...newMeta.table2,
5647
+ fieldAlias: newMeta.table2.fieldAlias || newMeta.table2.column,
5648
+ fieldUuid: newMeta.table2.fieldUuid || newMeta.table2.column_id,
5649
+ quotes: newMeta.table2.quotes || newMeta.table2.column
5650
+ };
5651
+ newMeta.expressions = newMeta.expressions.map(v => {
5652
+ return {
5653
+ ...v,
5654
+ left_fieldAlias: v.fieldAlias || v.left_column,
5655
+ left_fieldUuid: v.fieldUuid || v.left_column_id,
5656
+ left_quotes: v.left_quotes || v.left_column,
5657
+ right_fieldAlias: v.right_fieldAlias || v.right_column,
5658
+ right_fieldUuid: v.right_fieldUuid || v.right_column_id,
5659
+ right_quotes: v.right_quotes || v.right_column
5660
+ };
5661
+ });
5662
+ return newMeta;
5663
+ }
5633
5664
  var FlagLocation;
5634
5665
  (function (FlagLocation) {
5635
5666
  FlagLocation["TABLE_1"] = "table1";
@@ -5654,11 +5685,11 @@ const JoinData = props => {
5654
5685
  let table2Selected = Boolean(meta.table2.name);
5655
5686
  let subQuerySelected = Boolean(meta.subquery?.[0]?.table?.name);
5656
5687
  let columnsSelected = meta.table1.quotes && meta.table2.quotes;
5657
- // useEffect(() => {
5658
- // let newMetaList = store.metaList[groupIndex].list.slice();
5659
- // newMetaList[index] = setQuotes(meta);
5660
- // store.setMeta(newMetaList, groupIndex);
5661
- // }, [metaKey]);
5688
+ useEffect(() => {
5689
+ let newMetaList = store.metaList[groupIndex].list.slice();
5690
+ newMetaList[index] = setQuotes(meta);
5691
+ store.setMeta(newMetaList, groupIndex);
5692
+ }, []);
5662
5693
  function selectColumns(e) {
5663
5694
  let columns = meta.columns;
5664
5695
  !meta.readonly && store.setPopup({