@gingkoo/pandora-metabase 1.0.0-alpha.28 → 1.0.0-alpha.29

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.28
2
+ * @gingkoo/pandora-metabase v1.0.0-alpha.29
3
3
  */
4
4
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
5
5
  import * as React from 'react';
@@ -681,7 +681,7 @@ const getSubColumns = metaList => {
681
681
  ...v,
682
682
  name: v.fieldAlias || v.name,
683
683
  fieldAlias: '',
684
- fieldUuid: uuidv4('field'),
684
+ // fieldUuid: uuidv4('field'),
685
685
  realName: v.sql?.split(' AS ')?.[1] || '',
686
686
  // name_zh: '',
687
687
  database_type: v?.database_type || SQL_COLUMN_TYPE.FLOAT,
@@ -697,7 +697,7 @@ const getSubColumns = metaList => {
697
697
  ...v,
698
698
  name: v.fieldAlias || v.name,
699
699
  fieldAlias: '',
700
- fieldUuid: uuidv4('field'),
700
+ // fieldUuid: uuidv4('field'),
701
701
  realName: v.sql?.split(' AS ')?.[1] || '',
702
702
  // name_zh: '',
703
703
  database_type: v?.database_type || SQL_COLUMN_TYPE.FLOAT,
@@ -718,8 +718,8 @@ const getSubColumns = metaList => {
718
718
  return {
719
719
  ...column,
720
720
  name: column.fieldAlias || column.name,
721
- fieldAlias: '',
722
- fieldUuid: uuidv4('field')
721
+ fieldAlias: ''
722
+ // fieldUuid: uuidv4('field'),
723
723
  };
724
724
  });
725
725
  return {
@@ -737,10 +737,10 @@ const getSubColumns = metaList => {
737
737
  return {
738
738
  ...column,
739
739
  name: column.fieldAlias || column.name,
740
- fieldAlias: '',
741
- fieldUuid: uuidv4('field')
740
+ fieldAlias: ''
741
+ // fieldUuid: uuidv4('field'),
742
742
  };
743
- });
743
+ }).filter(item => item.select);
744
744
  return {
745
745
  alias: v.table.alias,
746
746
  table: v.table.name,
@@ -751,10 +751,10 @@ const getSubColumns = metaList => {
751
751
  return {
752
752
  ...column,
753
753
  name: column.fieldAlias || column.name,
754
- fieldAlias: '',
755
- fieldUuid: uuidv4('field')
754
+ fieldAlias: ''
755
+ // fieldUuid: uuidv4('field'),
756
756
  };
757
- });
757
+ }).filter(item => item.select);
758
758
  return {
759
759
  alias: v.table2.alias,
760
760
  table: v.table2.name,
@@ -766,10 +766,12 @@ const getSubColumns = metaList => {
766
766
  } = v;
767
767
  const columns = customColumn.map(v => {
768
768
  return {
769
- name_zh: __('SqlQueryBuilder.customColumn'),
769
+ database_type: SQL_COLUMN_TYPE.STRING,
770
+ name_zh: v.name,
770
771
  name: v.name,
771
- fieldAlias: '',
772
- fieldUuid: uuidv4('field')
772
+ select: true,
773
+ fieldAlias: ''
774
+ // fieldUuid: uuidv4('field'),
773
775
  };
774
776
  });
775
777
  return {
@@ -891,14 +893,17 @@ const changeTableAlias = (list, curObj) => {
891
893
  item.table2.alias = alias;
892
894
  // item.table2.sql = '';
893
895
  }
894
- if (item.subquery) {
895
- item.subquery = changeTableAlias(item.subquery || [], curObj);
896
- }
896
+ // if (item.subquery) {
897
+ // item.subquery = changeTableAlias(item.subquery || [], curObj);
898
+ // }
897
899
  });
898
900
  }
899
- if (v.subquery) {
900
- v.subquery = changeTableAlias(v.subquery || [], curObj);
901
- }
901
+ // if ((v as MetaData | MetaJoin).subquery) {
902
+ // (v as MetaData | MetaJoin).subquery = changeTableAlias(
903
+ // (v as MetaData | MetaJoin).subquery || [],
904
+ // curObj,
905
+ // );
906
+ // }
902
907
  return v;
903
908
  }) || [];
904
909
  };
@@ -979,9 +984,9 @@ const changeFieldAlias = (list, curObj) => {
979
984
  prevGroupBy
980
985
  } = getHelper(list, v);
981
986
  let groupBy = prevGroupBy?.by.filter(v => v.fieldUuid === item.fieldUuid)[0] || prevGroupBy?.group.filter(v => v.fieldUuid === item.fieldUuid)[0] || null;
982
- groupBy.fieldAlias = fieldAlias;
983
- const sql = groupBy.sql;
984
987
  if (groupBy) {
988
+ groupBy.fieldAlias = fieldAlias;
989
+ const sql = groupBy.sql;
985
990
  item.sql = sql;
986
991
  item.groupSql = sql;
987
992
  }
@@ -1004,8 +1009,8 @@ const changeFieldAlias = (list, curObj) => {
1004
1009
  // }
1005
1010
  // }
1006
1011
  }
1007
- if (item.subquery) {
1008
- item.subquery = changeFieldAlias(item.subquery || [], curObj);
1012
+ if (item.notExists) {
1013
+ item.notExists = changeFieldAlias(item.notExists || [], curObj);
1009
1014
  }
1010
1015
  });
1011
1016
  }
@@ -2264,13 +2269,13 @@ const LeftJoinIcon = ({
2264
2269
  })
2265
2270
  });
2266
2271
  const InnerJoinIcon = ({
2267
- width: _width10 = 32,
2268
- height: _height10 = 32,
2272
+ width: _width0 = 32,
2273
+ height: _height0 = 32,
2269
2274
  style
2270
2275
  }) => jsx("svg", {
2271
2276
  viewBox: '0 0 32 32',
2272
- width: _width10,
2273
- height: _height10,
2277
+ width: _width0,
2278
+ height: _height0,
2274
2279
  fill: 'currentcolor',
2275
2280
  role: 'img',
2276
2281
  "aria-label": 'join_inner icon',
@@ -2280,13 +2285,13 @@ const InnerJoinIcon = ({
2280
2285
  })
2281
2286
  });
2282
2287
  const UpArrowIcon = ({
2283
- width: _width11 = 16,
2284
- height: _height11 = 17
2288
+ width: _width1 = 16,
2289
+ height: _height1 = 17
2285
2290
  }) => jsx("svg", {
2286
2291
  className: 'sort-arrow',
2287
2292
  viewBox: '0 0 32 34',
2288
- width: _width11,
2289
- height: _height11,
2293
+ width: _width1,
2294
+ height: _height1,
2290
2295
  fill: 'currentcolor',
2291
2296
  role: 'img',
2292
2297
  "aria-label": 'arrow_up icon',
@@ -2295,13 +2300,13 @@ const UpArrowIcon = ({
2295
2300
  })
2296
2301
  });
2297
2302
  const DownArrowIcon = ({
2298
- width: _width12 = 16,
2299
- height: _height12 = 17
2303
+ width: _width10 = 16,
2304
+ height: _height10 = 17
2300
2305
  }) => jsx("svg", {
2301
2306
  className: 'sort-arrow',
2302
2307
  viewBox: '0 0 32 34',
2303
- width: _width12,
2304
- height: _height12,
2308
+ width: _width10,
2309
+ height: _height10,
2305
2310
  fill: 'currentcolor',
2306
2311
  role: 'img',
2307
2312
  "aria-label": 'arrow_down icon',
@@ -2310,13 +2315,13 @@ const DownArrowIcon = ({
2310
2315
  })
2311
2316
  });
2312
2317
  const CloseIcon = ({
2313
- width: _width13 = 16,
2314
- height: _height13 = 16
2318
+ width: _width11 = 16,
2319
+ height: _height11 = 16
2315
2320
  }) => jsx("svg", {
2316
2321
  className: 'closeIcon',
2317
2322
  viewBox: '0 0 32 32',
2318
- width: _width13,
2319
- height: _height13,
2323
+ width: _width11,
2324
+ height: _height11,
2320
2325
  fill: 'currentcolor',
2321
2326
  role: 'img',
2322
2327
  "aria-label": 'close icon',
@@ -2325,12 +2330,12 @@ const CloseIcon = ({
2325
2330
  })
2326
2331
  });
2327
2332
  const AddIcon = ({
2328
- width: _width14 = 16,
2329
- height: _height14 = 16
2333
+ width: _width12 = 16,
2334
+ height: _height12 = 16
2330
2335
  }) => jsx("svg", {
2331
2336
  viewBox: '0 0 32 32',
2332
- width: _width14,
2333
- height: _height14,
2337
+ width: _width12,
2338
+ height: _height12,
2334
2339
  fill: 'currentcolor',
2335
2340
  role: 'img',
2336
2341
  "aria-label": 'add icon',
@@ -2339,12 +2344,12 @@ const AddIcon = ({
2339
2344
  })
2340
2345
  });
2341
2346
  const TableIcon = ({
2342
- width: _width15 = 18,
2343
- height: _height15 = 18
2347
+ width: _width13 = 18,
2348
+ height: _height13 = 18
2344
2349
  }) => jsx("svg", {
2345
2350
  viewBox: '0 0 32 32',
2346
- width: _width15,
2347
- height: _height15,
2351
+ width: _width13,
2352
+ height: _height13,
2348
2353
  fill: 'currentcolor',
2349
2354
  role: 'img',
2350
2355
  "aria-label": 'table2 icon',
@@ -2353,12 +2358,12 @@ const TableIcon = ({
2353
2358
  })
2354
2359
  });
2355
2360
  const SearchIcon = ({
2356
- width: _width16 = 16,
2357
- height: _height16 = 16
2361
+ width: _width14 = 16,
2362
+ height: _height14 = 16
2358
2363
  }) => jsx("svg", {
2359
2364
  viewBox: '0 0 32 32',
2360
- width: _width16,
2361
- height: _height16,
2365
+ width: _width14,
2366
+ height: _height14,
2362
2367
  fill: 'currentcolor',
2363
2368
  role: 'img',
2364
2369
  "aria-label": 'search icon',
@@ -3617,7 +3622,9 @@ const Portal = /*#__PURE__*/forwardRef((props, ref) => {
3617
3622
  initRef.current = true;
3618
3623
  }
3619
3624
  useEffect(() => {
3620
- didUpdate?.(props, containerRef.current);
3625
+ setTimeout(() => {
3626
+ didUpdate?.(props, containerRef.current);
3627
+ }, 0);
3621
3628
  });
3622
3629
  useEffect(() => {
3623
3630
  return () => {
@@ -5767,7 +5774,7 @@ const TableData = props => {
5767
5774
  newMetaList.subquery = newList;
5768
5775
  newMetaList.table = {
5769
5776
  ...newList[0].table,
5770
- alias: '',
5777
+ alias: newMetaList.table.alias || '',
5771
5778
  tableUuid: uuidv4('table')
5772
5779
  };
5773
5780
  const items = getSubColumns(newList);
@@ -7842,8 +7849,8 @@ const Filter = props => {
7842
7849
  } = store.preProps;
7843
7850
  let newMeta = store.metaList[groupIndex].list.slice();
7844
7851
  let index = findIndex(store.metaList[groupIndex].list, meta);
7845
- let _value = position ? [] : newMeta[index].filter[i]?.subquery || [];
7846
- let oldList = position ? [] : cloneDeep(newMeta[index].filter[i]?.subquery || []);
7852
+ let _value = position ? [] : newMeta[index].filter[i]?.notExists || [];
7853
+ let oldList = position ? [] : cloneDeep(newMeta[index].filter[i]?.notExists || []);
7847
7854
  let _toolbar = notExistsToolbar || toolbar;
7848
7855
  _toolbar = _toolbar.filter(v => v !== 'group'); // 子查询不需要分组
7849
7856
  let zIndex = store.popupContainer.current ? getMaxZIndexInParents(store.popupContainer.current) : null;
@@ -7869,7 +7876,7 @@ const Filter = props => {
7869
7876
  return;
7870
7877
  }
7871
7878
  const _tem = {
7872
- subquery: newList,
7879
+ notExists: newList,
7873
7880
  quotes: buildSqlQuery(newList),
7874
7881
  condition: '',
7875
7882
  table: '',
@@ -8056,7 +8063,7 @@ const Filter = props => {
8056
8063
  if (typeof v === 'string') {
8057
8064
  return v;
8058
8065
  } else if (v.type === Filter_TypeEnum.NOT_EXISTS) {
8059
- return `${buildSqlQuery(v.subquery)}`;
8066
+ return `${buildSqlQuery(v.notExists)}`;
8060
8067
  } else {
8061
8068
  return v.quotes;
8062
8069
  }
@@ -8727,8 +8734,8 @@ const Sort = props => {
8727
8734
  let value = {
8728
8735
  table: '',
8729
8736
  tableId: '',
8730
- tableUuid: uuidv4('table'),
8731
- fieldUuid: uuidv4('field'),
8737
+ tableUuid: '',
8738
+ fieldUuid: '',
8732
8739
  fieldAlias: '',
8733
8740
  alias: '',
8734
8741
  name: '',