@gingkoo/pandora-metabase 1.0.0-alpha.7 → 1.0.0-alpha.9

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/README.md CHANGED
@@ -38,27 +38,36 @@ export type ToolbarType =
38
38
  | 'customColumn'
39
39
  | 'sort'
40
40
  | 'rowLimit'
41
- | 'group'; //展示合并结果集,会变为多个数组
41
+ | 'union'; //展示合并结果集,会变为多个数组
42
42
 
43
43
  export interface MetaBaseProps {
44
- loading?: boolean; // 加载状态
45
- btnText?: string; //按钮文字
46
- showFields?:boolean ; //是否显示字段
47
- tableNameTpl?: string; //表名
48
- fieldNameTpl?: string; //字段名
49
44
  /**
50
45
  * 工具栏列表
51
46
  * 默认 ['filter','summarize','joinData','permissionTable','customColumn','sort','rowLimit']
52
47
  */
53
- toolbar?:ToolbarType[]|false;
54
- readonly?: boolean; //是否只读
55
- getTables: (datasourceId: string) => Promise<any>; //获取表
56
- getColumns: (table: string, datasourceId: string) => Promise<any>;//获取数据源
57
- onOk: (params: any) => Promise<void>;
48
+ loading?: boolean;
49
+ btnText?: string;
50
+ showFields?: boolean; // 显示字段
51
+ readonly?: boolean;
52
+ getTables: (datasourceId: string) => Promise<any>;
53
+ getColumns: (table: { name: string; [key: string]: any }, datasourceId: string) => Promise<any>;
54
+ toolbar?: ToolbarType[];
55
+ subToolbar?: ToolbarType[]; //子查询功能菜单 默认取toolbar
56
+ tableNameTpl?: string; //表名
57
+ fieldNameTpl?: string; //字段名
58
+ onOk?: (params: any) => void;
58
59
  value?: MetaListType[]; //默认值
59
60
  sourceList?: DatasourceType[];
60
61
  showSubquery?: boolean; //是否展示子查询
61
62
  subShowSubquery?: boolean; //子查询是否展示子查询
63
+ constantList?: OptionItem[]; //常量下拉框
64
+ notExistsToolbar?: ToolbarType[]; // notExists的功能菜单 默认取toolbar
65
+ }
66
+
67
+ export interface OptionItem {
68
+ value?: string;
69
+ label: string;
70
+ icon?: React.ReactNode;
62
71
  }
63
72
 
64
73
  export interface SqlVisionBuilderRef {
@@ -25,6 +25,7 @@ export interface ColumnType {
25
25
  id: string;
26
26
  datasourceId: string;
27
27
  datasourceName: string;
28
+ quotes?: string;
28
29
  table2?: Omit<MetaJoin_TalbeType, 'column' | 'column_id'> | null;
29
30
  }
30
31
  export interface ColumnGroupType {
package/lib/es/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @gingkoo/pandora-metabase v1.0.0-alpha.7
2
+ * @gingkoo/pandora-metabase v1.0.0-alpha.9
3
3
  */
4
4
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
5
5
  import * as React from 'react';
@@ -466,15 +466,15 @@ const handleNesting = data => {
466
466
  if (customColumn && customColumn.customColumn.length) {
467
467
  obj.customColumns = customColumn.customColumn.map(v => {
468
468
  return {
469
- alias: v.name,
470
- formula: v.formula.replace(/\[.*?\]/g, column => {
471
- let str = column.substr(1, column.length - 2);
472
- if (~str.indexOf('->')) {
473
- let _str = str.replace(/ /g, '').split('->');
474
- return `${_str[0]}.${_str[1]}`;
475
- }
476
- return str;
477
- })
469
+ alias: v.name
470
+ // formula: v.formula.replace(/\[.*?\]/g, (column: string): string => {
471
+ // let str = column.substr(1, column.length - 2);
472
+ // if (~str.indexOf('->')) {
473
+ // let _str = str.replace(/ /g, '').split('->');
474
+ // return `${_str[0]}.${_str[1]}`;
475
+ // }
476
+ // return str;
477
+ // }),
478
478
  };
479
479
  });
480
480
  }
@@ -625,9 +625,8 @@ const getSubColumns = metaList => {
625
625
  metaKey: -1,
626
626
  type: TypeEnum.customColumn,
627
627
  customColumn: [{
628
- name: '',
629
- // 用户起的别名
630
- formula: '' // 公式}];
628
+ name: '' // 用户起的别名
629
+ // formula: '', // 公式}];
631
630
  }]
632
631
  };
633
632
  let {
@@ -649,7 +648,7 @@ const getSubColumns = metaList => {
649
648
  return {
650
649
  name_zh: v.quotes,
651
650
  ...v,
652
- name: v.quotes,
651
+ name: v.fieldAlias,
653
652
  realName: v.sql?.split(' AS ')?.[1] || '',
654
653
  // name_zh: '',
655
654
  database_type: v?.database_type || SQL_COLUMN_TYPE.FLOAT,
@@ -663,7 +662,7 @@ const getSubColumns = metaList => {
663
662
  return {
664
663
  name_zh: v.quotes,
665
664
  ...v,
666
- name: v.quotes,
665
+ name: v.fieldAlias,
667
666
  realName: v.sql?.split(' AS ')?.[1] || '',
668
667
  // name_zh: '',
669
668
  database_type: v?.database_type || SQL_COLUMN_TYPE.FLOAT,
@@ -731,6 +730,9 @@ const changeTableAlias = (list, curObj) => {
731
730
  if (v.table1.tableUuid === tableUuid) {
732
731
  v.table1.alias = alias;
733
732
  }
733
+ if (v.table2.tableUuid === tableUuid) {
734
+ v.table2.alias = alias;
735
+ }
734
736
  }
735
737
  if (v.type === TypeEnum.customColumn) {
736
738
  v.customColumn.map(item => {
@@ -774,22 +776,40 @@ const changeTableAlias = (list, curObj) => {
774
776
  if (v.type === TypeEnum.filter) {
775
777
  v.filter.map(item => {
776
778
  if (item.tableUuid === tableUuid) {
777
- if (item.alias === SummarizeAlias$1) {
778
- //有groupBy 特殊处理
779
- const {
780
- prevGroupBy
781
- } = getHelper(list, v);
782
- let groupBy = prevGroupBy?.by.filter(v => v.fieldUuid === item.fieldUuid)[0] || prevGroupBy?.group.filter(v => v.fieldUuid === item.fieldUuid)[0] || null;
783
- groupBy.alias = alias;
784
- const sql = groupBy.sql;
785
- if (groupBy) {
786
- item.sql = sql;
787
- item.groupSql = sql;
788
- }
789
- } else {
790
- item.alias = alias;
791
- item.sql = '';
792
- }
779
+ // if (item.alias === SummarizeAlias) {
780
+ // //有groupBy 特殊处理
781
+ // const { prevGroupBy } = getHelper(list, v);
782
+ // let groupBy: any =
783
+ // prevGroupBy?.by.filter((v) => v.fieldUuid === item.fieldUuid)[0] ||
784
+ // prevGroupBy?.group.filter((v) => v.fieldUuid === item.fieldUuid)[0] ||
785
+ // null;
786
+ // groupBy.alias = alias;
787
+ // const sql = groupBy.sql;
788
+ // if (groupBy) {
789
+ // item.sql = sql;
790
+ // item.groupSql = sql;
791
+ // }
792
+ // }
793
+ item.alias = alias;
794
+ item.sql = '';
795
+ }
796
+ if (item.table2 && item.table2.tableUuid === tableUuid) {
797
+ // if (item.table2.alias === SummarizeAlias) {
798
+ // //有groupBy 特殊处理
799
+ // const { prevGroupBy } = getHelper(list, v);
800
+ // let groupBy: any =
801
+ // prevGroupBy?.by.filter((v) => v.fieldUuid === item.table2?.fieldUuid)[0] ||
802
+ // prevGroupBy?.group.filter((v) => v.fieldUuid === item.table2?.fieldUuid)[0] ||
803
+ // null;
804
+ // groupBy.alias = alias;
805
+ // const sql = groupBy.sql;
806
+ // if (groupBy) {
807
+ // item.table2.sql = sql;
808
+ // item.table2.groupSql = sql;
809
+ // }
810
+ // }
811
+ item.table2.alias = alias;
812
+ item.table2.sql = '';
793
813
  }
794
814
  });
795
815
  }
@@ -804,7 +824,25 @@ const changeFieldAlias = (list, curObj) => {
804
824
  const newList = cloneDeep(list);
805
825
  newList.map(v => {
806
826
  if (v.type === TypeEnum.data) ;
807
- if (v.type === TypeEnum.joinData) ;
827
+ if (v.type === TypeEnum.joinData) {
828
+ if (v.table1.fieldUuid === fieldUuid) {
829
+ v.table1.fieldAlias = fieldAlias;
830
+ }
831
+ if (v.table2.fieldUuid === fieldUuid) {
832
+ v.table2.fieldAlias = fieldAlias;
833
+ }
834
+ v.expressions.map(column => {
835
+ if (column.left_fieldUuid === fieldUuid) {
836
+ column.left_fieldAlias = fieldAlias;
837
+ }
838
+ if (column.right_fieldUuid === fieldUuid) {
839
+ column.right_fieldAlias = fieldAlias;
840
+ }
841
+ });
842
+ // if (v.table1.tableUuid === tableUuid) {
843
+ // v.table1.alias = alias;
844
+ // }
845
+ }
808
846
  if (v.type === TypeEnum.customColumn) {
809
847
  v.customColumn.map(item => {
810
848
  item.formulaList?.map(formula => {
@@ -863,6 +901,23 @@ const changeFieldAlias = (list, curObj) => {
863
901
  }
864
902
  }
865
903
  }
904
+ if (item.table2 && item.table2.fieldUuid === fieldUuid) {
905
+ item.table2.fieldAlias = fieldAlias;
906
+ // if (item.table2.alias === SummarizeAlias) {
907
+ // //有groupBy 特殊处理
908
+ // const { prevGroupBy } = getHelper(list, v);
909
+ // let groupBy: any =
910
+ // prevGroupBy?.by.filter((v) => v.fieldUuid === item.table2?.fieldUuid)[0] ||
911
+ // prevGroupBy?.group.filter((v) => v.fieldUuid === item.table2?.fieldUuid)[0] ||
912
+ // null;
913
+ // groupBy.fieldAlias = fieldAlias;
914
+ // const sql = groupBy.sql;
915
+ // if (groupBy) {
916
+ // item.table2.sql = sql;
917
+ // item.table2.groupSql = sql;
918
+ // }
919
+ // }
920
+ }
866
921
  });
867
922
  }
868
923
  });
@@ -1019,18 +1074,18 @@ const useStore = () => {
1019
1074
  };
1020
1075
  // 是否显示主表后面的字段按钮 (如果下面 没有聚合,或者选了聚合但是聚合里面没有选值的时候显示 主表字段按钮)
1021
1076
  const showMainColumn = useMemo(() => {
1022
- // 先将二维数组拍平为一维数组
1023
- const flatMetaList = metaList.flatMap(group => group.list);
1024
- // 过滤出所有汇总类型的项
1025
- const summarizeItems = flatMetaList.filter(v => v.type === TypeEnum.summarize);
1026
- // 如果没有汇总项,默认显示主列
1027
- if (summarizeItems.length === 0) {
1028
- return true;
1029
- }
1030
- // 如果只有一个汇总项,并且 group 和 by 都为空,则也显示主列
1031
- const onlyItem = summarizeItems[0];
1032
- const hasGroupOrBy = Array.isArray(onlyItem.group) && onlyItem.group.length > 0 || Array.isArray(onlyItem.by) && onlyItem.by.length > 0;
1033
- return !hasGroupOrBy;
1077
+ return metaList.map((item, groupIndex) => {
1078
+ // 过滤出所有汇总类型的项
1079
+ const summarizeItems = item.list.filter(v => v.type === TypeEnum.summarize);
1080
+ // 如果没有汇总项,默认显示主列
1081
+ if (summarizeItems.length === 0) {
1082
+ return true;
1083
+ }
1084
+ // 如果只有一个汇总项,并且 group 和 by 都为空,则也显示主列
1085
+ const onlyItem = summarizeItems[0];
1086
+ const hasGroupOrBy = Array.isArray(onlyItem.group) && onlyItem.group.length > 0 || Array.isArray(onlyItem.by) && onlyItem.by.length > 0;
1087
+ return !hasGroupOrBy;
1088
+ });
1034
1089
  }, [metaList]);
1035
1090
  // const showMainColumn = useMemo(() => {
1036
1091
  // let summarizeList = metaList.filter((v) => v.type === TypeEnum.summarize);
@@ -1158,8 +1213,8 @@ const useStore = () => {
1158
1213
  tableUuid: '',
1159
1214
  datasourceId: '',
1160
1215
  datasourceName: '',
1161
- column: '',
1162
- column_id: ''
1216
+ fieldAlias: '',
1217
+ fieldUuid: ''
1163
1218
  };
1164
1219
  if (index === 1) {
1165
1220
  table1 = {
@@ -1168,8 +1223,8 @@ const useStore = () => {
1168
1223
  alias: mainTable.table.alias,
1169
1224
  datasourceId: mainTable.table.datasourceId,
1170
1225
  datasourceName: mainTable.table.datasourceName,
1171
- column: '',
1172
- column_id: ''
1226
+ fieldAlias: '',
1227
+ fieldUuid: ''
1173
1228
  };
1174
1229
  }
1175
1230
  item = {
@@ -1184,8 +1239,8 @@ const useStore = () => {
1184
1239
  tableUuid: '',
1185
1240
  datasourceId: '',
1186
1241
  datasourceName: '',
1187
- column: '',
1188
- column_id: ''
1242
+ fieldAlias: '',
1243
+ fieldUuid: ''
1189
1244
  },
1190
1245
  columns: [],
1191
1246
  expressions: []
@@ -5525,7 +5580,7 @@ const TableData = props => {
5525
5580
  }
5526
5581
  })
5527
5582
  }), selected ? `${meta.table.datasourceName}.${meta.table.name} ${meta.table?.alias ? `as ${meta.table?.alias}` : ''}` : __('SqlQueryBuilder.pickTable')]
5528
- }), selected && store.showMainColumn && store.showFields && jsx("div", {
5583
+ }), selected && store.showMainColumn[groupIndex] && store.showFields && jsx("div", {
5529
5584
  className: `Sqb-TableColumns`,
5530
5585
  onClick: selectColumns,
5531
5586
  children: __('SqlQueryBuilder.columns')
@@ -5540,6 +5595,33 @@ const TableData = props => {
5540
5595
  };
5541
5596
 
5542
5597
  const PrevResult$1 = 'Previous results';
5598
+ function setQuotes(_meta) {
5599
+ let newMeta = cloneDeep(_meta);
5600
+ newMeta.table1 = {
5601
+ ...newMeta.table1,
5602
+ fieldAlias: newMeta.table1.fieldAlias || newMeta.table1.column,
5603
+ fieldUuid: newMeta.table1.fieldUuid || newMeta.table1.column_id,
5604
+ quotes: newMeta.table1.quotes || newMeta.table1.column
5605
+ };
5606
+ newMeta.table2 = {
5607
+ ...newMeta.table2,
5608
+ fieldAlias: newMeta.table2.fieldAlias || newMeta.table2.column,
5609
+ fieldUuid: newMeta.table2.fieldUuid || newMeta.table2.column_id,
5610
+ quotes: newMeta.table2.quotes || newMeta.table2.column
5611
+ };
5612
+ newMeta.expressions = newMeta.expressions.map(v => {
5613
+ return {
5614
+ ...v,
5615
+ left_fieldAlias: v.fieldAlias || v.left_column,
5616
+ left_fieldUuid: v.fieldUuid || v.left_column_id,
5617
+ left_quotes: v.left_quotes || v.left_column,
5618
+ right_fieldAlias: v.right_fieldAlias || v.right_column,
5619
+ right_fieldUuid: v.right_fieldUuid || v.right_column_id,
5620
+ right_quotes: v.right_quotes || v.right_column
5621
+ };
5622
+ });
5623
+ return newMeta;
5624
+ }
5543
5625
  var FlagLocation;
5544
5626
  (function (FlagLocation) {
5545
5627
  FlagLocation["TABLE_1"] = "table1";
@@ -5547,8 +5629,8 @@ var FlagLocation;
5547
5629
  })(FlagLocation || (FlagLocation = {}));
5548
5630
  var ExpressionsEnum;
5549
5631
  (function (ExpressionsEnum) {
5550
- ExpressionsEnum["LEFT"] = "left_column";
5551
- ExpressionsEnum["RIGHT"] = "right_column";
5632
+ ExpressionsEnum["LEFT"] = "left";
5633
+ ExpressionsEnum["RIGHT"] = "right";
5552
5634
  })(ExpressionsEnum || (ExpressionsEnum = {}));
5553
5635
  const JoinData = props => {
5554
5636
  const {
@@ -5563,7 +5645,12 @@ const JoinData = props => {
5563
5645
  let table1Selected = Boolean(meta.table1.name);
5564
5646
  let table2Selected = Boolean(meta.table2.name);
5565
5647
  let subQuerySelected = Boolean(meta.subquery?.[0]?.table?.name);
5566
- let columnsSelected = meta.table1.column && meta.table2.column;
5648
+ let columnsSelected = meta.table1.quotes && meta.table2.quotes;
5649
+ useEffect(() => {
5650
+ let newMetaList = store.metaList[groupIndex].list.slice();
5651
+ newMetaList[index] = setQuotes(meta);
5652
+ store.setMeta(newMetaList, groupIndex);
5653
+ }, []);
5567
5654
  function selectColumns(e) {
5568
5655
  let columns = meta.columns;
5569
5656
  !meta.readonly && store.setPopup({
@@ -5632,8 +5719,9 @@ const JoinData = props => {
5632
5719
  name: tableName,
5633
5720
  tableUuid: data.tableUuid || uuidv4('table'),
5634
5721
  alias,
5635
- column: '',
5636
- column_id: '',
5722
+ fieldAlias: '',
5723
+ fieldUuid: '',
5724
+ quotes: '',
5637
5725
  datasourceId: data.datasourceId,
5638
5726
  datasourceName: data.datasourceName
5639
5727
  };
@@ -5676,8 +5764,9 @@ const JoinData = props => {
5676
5764
  let type = node.getAttribute('v-data');
5677
5765
  let data = [];
5678
5766
  let value = {
5679
- name: meta[type].column,
5680
- id: meta[type].column_id,
5767
+ name: meta[type].quotes || meta[type].fieldAlias,
5768
+ quotes: meta[type].quotes,
5769
+ id: meta[type].fieldUuid,
5681
5770
  table: meta[type].name,
5682
5771
  tableId: meta[type].id,
5683
5772
  fieldUuid: meta[type].fieldUuid || uuidv4('field'),
@@ -5795,11 +5884,21 @@ const JoinData = props => {
5795
5884
  sql,
5796
5885
  datasourceId,
5797
5886
  datasourceName,
5798
- id = ''
5887
+ id = '',
5888
+ fieldAlias = '',
5889
+ fieldUuid = '',
5890
+ quotes
5799
5891
  } = record;
5800
5892
  let newMeta = store.metaList[groupIndex].list.slice();
5801
- newMeta[index][type].column = name;
5802
- newMeta[index][type].column_id = id;
5893
+ if (alias === SummarizeAlias$1) {
5894
+ newMeta[index][type].fieldAlias = fieldAlias;
5895
+ newMeta[index][type].fieldUuid = fieldUuid;
5896
+ newMeta[index][type].quotes = quotes;
5897
+ } else {
5898
+ newMeta[index][type].fieldAlias = name;
5899
+ newMeta[index][type].fieldUuid = id;
5900
+ newMeta[index][type].quotes = name;
5901
+ }
5803
5902
  if (type === FlagLocation.TABLE_1) {
5804
5903
  if (newMeta[index][type].alias !== alias) {
5805
5904
  newMeta[index][type].alias = alias;
@@ -5827,8 +5926,8 @@ const JoinData = props => {
5827
5926
  let index = findIndex(store.metaList[groupIndex].list, meta);
5828
5927
  let table_type = type === ExpressionsEnum.LEFT ? FlagLocation.TABLE_1 : FlagLocation.TABLE_2;
5829
5928
  let value = {
5830
- name: meta.expressions[_ind][type],
5831
- id: meta.expressions[_ind][`${type}_id`],
5929
+ name: meta.expressions[_ind][`${type}_quotes`] || meta.expressions[_ind][`${type}_fieldAlias`],
5930
+ id: meta.expressions[_ind][`${type}_fieldUuid`],
5832
5931
  table: meta[table_type].name,
5833
5932
  fieldUuid: meta[table_type].fieldUuid || uuidv4('field'),
5834
5933
  fieldAlias: meta[table_type].fieldAlias || '',
@@ -5953,11 +6052,23 @@ const JoinData = props => {
5953
6052
  sql,
5954
6053
  datasourceId,
5955
6054
  datasourceName,
5956
- id = ''
6055
+ id = '',
6056
+ fieldAlias,
6057
+ fieldUuid,
6058
+ quotes = ''
5957
6059
  } = record;
5958
6060
  let newMeta = store.metaList[groupIndex].list.slice();
5959
- newMeta[index].expressions[_ind][type] = name;
5960
- newMeta[index].expressions[_ind][`${type}_id`] = id;
6061
+ if (alias === SummarizeAlias$1) {
6062
+ newMeta[index].expressions[_ind][`${type}_fieldAlias`] = fieldAlias;
6063
+ newMeta[index].expressions[_ind][`${type}_fieldUuid`] = fieldUuid;
6064
+ newMeta[index].expressions[_ind][`${type}_quotes`] = quotes;
6065
+ } else {
6066
+ newMeta[index].expressions[_ind][`${type}_fieldAlias`] = name;
6067
+ newMeta[index].expressions[_ind][`${type}_fieldUuid`] = id;
6068
+ newMeta[index].expressions[_ind][`${type}_quotes`] = name;
6069
+ }
6070
+ // (newMeta[index] as MetaJoin).expressions[_ind][type] = name;
6071
+ // (newMeta[index] as MetaJoin).expressions[_ind][`${type}_id`] = id;
5961
6072
  store.setMeta(newMeta, groupIndex);
5962
6073
  store.setPopup({
5963
6074
  visible: false
@@ -6061,8 +6172,8 @@ const JoinData = props => {
6061
6172
  newMeta[index].subquery = newList;
6062
6173
  newMeta[index].table2 = {
6063
6174
  ...newList[0].table,
6064
- column: '',
6065
- column_id: ''
6175
+ fieldAlias: '',
6176
+ fieldUuid: ''
6066
6177
  };
6067
6178
  const items = getSubColumns(newList);
6068
6179
  const newColumns = items.flatMap(item => item.columns);
@@ -6087,8 +6198,9 @@ const JoinData = props => {
6087
6198
  let newMeta = store.metaList[groupIndex].list.slice();
6088
6199
  newMeta[index].isSubquery = !newMeta[index].isSubquery;
6089
6200
  newMeta[index].table2 = {
6090
- column: '',
6091
- column_id: '',
6201
+ quotes: '',
6202
+ fieldAlias: '',
6203
+ fieldUuid: '',
6092
6204
  name: '',
6093
6205
  // 表名
6094
6206
  tableUuid: '',
@@ -6221,23 +6333,23 @@ const JoinData = props => {
6221
6333
  children: "on"
6222
6334
  }), jsx("div", {
6223
6335
  className: cx(`Sqb-TableName`, {
6224
- notSelected: !meta.table1.column
6336
+ notSelected: !meta.table1.quotes
6225
6337
  }),
6226
6338
  "v-data": FlagLocation.TABLE_1,
6227
6339
  onClick: selectJoinColumn,
6228
- children: meta.table1.column ? meta.table1.column : __('SqlQueryBuilder.pickTable')
6340
+ children: meta.table1.quotes ? meta.table1.quotes : __('SqlQueryBuilder.pickTable')
6229
6341
  }), jsx("span", {
6230
6342
  className: 'mr-2 text-gray-500',
6231
6343
  children: "="
6232
6344
  }), jsx("div", {
6233
6345
  className: cx(`Sqb-TableName`, {
6234
- notSelected: !meta.table2.column
6346
+ notSelected: !meta.table2.quotes
6235
6347
  }),
6236
6348
  "v-data": FlagLocation.TABLE_2,
6237
6349
  onClick: selectJoinColumn,
6238
- children: meta.table2.column ? meta.table2.column : __('SqlQueryBuilder.pickTable')
6350
+ children: meta.table2.quotes ? meta.table2.quotes : __('SqlQueryBuilder.pickTable')
6239
6351
  })]
6240
- }), meta.table1.column_id && meta.table2.column_id && meta.expressions?.map((v, i) => {
6352
+ }), meta.table1.fieldUuid && meta.table2.fieldUuid && meta.expressions?.map((v, i) => {
6241
6353
  return jsxs("div", {
6242
6354
  className: cx(`Sqb-where block`),
6243
6355
  children: [jsx("span", {
@@ -6266,12 +6378,12 @@ const JoinData = props => {
6266
6378
  children: v.left_constant ? v.left_constant : __('SqlQueryBuilder.pickConstant')
6267
6379
  }), (!v.left_type || v.left_type === 'field') && jsx("div", {
6268
6380
  className: cx(`Sqb-TableName`, {
6269
- notSelected: !v.left_column
6381
+ notSelected: !v.left_quotes
6270
6382
  }),
6271
6383
  "v-data": ExpressionsEnum.LEFT,
6272
6384
  "v-index": i,
6273
6385
  onClick: selectMoreJoinColumn,
6274
- children: v.left_column ? v.left_column : __('SqlQueryBuilder.pickTable')
6386
+ children: v.left_quotes ? v.left_quotes : __('SqlQueryBuilder.pickTable')
6275
6387
  }), jsx(Tooltip, {
6276
6388
  title: __('SqlQueryBuilder.switch'),
6277
6389
  children: jsx(Button, {
@@ -6310,12 +6422,12 @@ const JoinData = props => {
6310
6422
  children: v.right_constant ? v.right_constant : __('SqlQueryBuilder.pickConstant')
6311
6423
  }), (!v.right_type || v.right_type === 'field') && jsx("div", {
6312
6424
  className: cx(`Sqb-TableName`, {
6313
- notSelected: !v.right_column
6425
+ notSelected: !v.right_quotes
6314
6426
  }),
6315
6427
  "v-data": ExpressionsEnum.RIGHT,
6316
6428
  "v-index": i,
6317
6429
  onClick: selectMoreJoinColumn,
6318
- children: v.right_column ? v.right_column : __('SqlQueryBuilder.pickTable')
6430
+ children: v.right_quotes ? v.right_quotes : __('SqlQueryBuilder.pickTable')
6319
6431
  }), jsx(Tooltip, {
6320
6432
  title: __('SqlQueryBuilder.switch'),
6321
6433
  children: jsx(Button, {
@@ -6341,14 +6453,15 @@ const JoinData = props => {
6341
6453
  let newMeta = store.metaList[groupIndex].list.slice();
6342
6454
  newMeta[index].expressions.splice(i + 1, 0, {
6343
6455
  operator: 'and',
6344
- left_column: '',
6345
- left_column_id: '',
6456
+ left_fieldAlias: '',
6457
+ left_fieldUuid: '',
6458
+ left_quotes: '',
6346
6459
  left_string: '',
6347
- left_isString: false,
6348
6460
  left_type: 'field',
6349
6461
  left_constant: '',
6350
- right_column: '',
6351
- right_column_id: '',
6462
+ right_fieldAlias: '',
6463
+ right_fieldUuid: '',
6464
+ right_quotes: '',
6352
6465
  right_string: '',
6353
6466
  right_isString: false,
6354
6467
  right_type: 'field',
@@ -6373,7 +6486,7 @@ const JoinData = props => {
6373
6486
  })
6374
6487
  })]
6375
6488
  }, i);
6376
- }), meta.table1.column_id && meta.table2.column_id && (meta.expressions?.length || 0) < 1 && jsx(Tooltip, {
6489
+ }), meta.table1.fieldUuid && meta.table2.fieldUuid && (meta.expressions?.length || 0) < 1 && jsx(Tooltip, {
6377
6490
  title: __('SqlQueryBuilder.add'),
6378
6491
  children: jsx(Button, {
6379
6492
  disabled: meta.readonly,
@@ -6386,14 +6499,15 @@ const JoinData = props => {
6386
6499
  let newMeta = store.metaList[groupIndex].list.slice();
6387
6500
  newMeta[index].expressions = [{
6388
6501
  operator: 'and',
6389
- left_column: '',
6390
- left_column_id: '',
6502
+ left_fieldAlias: '',
6503
+ left_fieldUuid: '',
6504
+ left_quotes: '',
6391
6505
  left_string: '',
6392
- left_isString: false,
6393
6506
  left_type: 'field',
6394
6507
  left_constant: '',
6395
- right_column: '',
6396
- right_column_id: '',
6508
+ right_fieldAlias: '',
6509
+ right_fieldUuid: '',
6510
+ right_quotes: '',
6397
6511
  right_string: '',
6398
6512
  right_isString: false,
6399
6513
  right_constant: '',
@@ -6665,8 +6779,7 @@ const CaseEditor = props => {
6665
6779
  const _onOk = () => {
6666
6780
  typeof onOk === 'function' && onOk?.({
6667
6781
  name,
6668
- formulaList: caseList,
6669
- formula: ''
6782
+ formulaList: caseList
6670
6783
  });
6671
6784
  };
6672
6785
  // 分段
@@ -7351,7 +7464,7 @@ const Filter = props => {
7351
7464
  let newMeta = store.metaList[groupIndex].list.slice();
7352
7465
  let val = filter[i];
7353
7466
  if (val.type === Filter_TypeEnum.NOT_EXISTS) {
7354
- showSubQuery(i, '');
7467
+ showNotExists(i, '');
7355
7468
  return;
7356
7469
  }
7357
7470
  let data = getColumns();
@@ -7450,10 +7563,10 @@ const Filter = props => {
7450
7563
  newMeta[index].filter = [..._filter];
7451
7564
  setInd(-1);
7452
7565
  };
7453
- // 子查询弹窗
7454
- const showSubQuery = (i, position) => {
7566
+ // NotExists 窗口
7567
+ const showNotExists = (i, position) => {
7455
7568
  const {
7456
- subToolbar,
7569
+ notExistsToolbar,
7457
7570
  toolbar,
7458
7571
  ...other
7459
7572
  } = store.preProps;
@@ -7461,7 +7574,7 @@ const Filter = props => {
7461
7574
  let index = findIndex(store.metaList[groupIndex].list, meta);
7462
7575
  let _value = position ? [] : newMeta[index].filter[i]?.subquery || [];
7463
7576
  let oldList = position ? [] : cloneDeep(newMeta[index].filter[i]?.subquery || []);
7464
- let _toolbar = subToolbar || toolbar;
7577
+ let _toolbar = notExistsToolbar || toolbar;
7465
7578
  _toolbar = _toolbar.filter(v => v !== 'group'); // 子查询不需要分组
7466
7579
  let zIndex = store.popupContainer.current ? getMaxZIndexInParents(store.popupContainer.current) : null;
7467
7580
  let o = Modal2.openModal({
@@ -7560,7 +7673,7 @@ const Filter = props => {
7560
7673
  if (type === Filter_TypeEnum.EXPRESSION) {
7561
7674
  handleAdd(_e);
7562
7675
  } else if (type === Filter_TypeEnum.NOT_EXISTS) {
7563
- showSubQuery(_index, _type);
7676
+ showNotExists(_index, _type);
7564
7677
  }
7565
7678
  }
7566
7679
  })
@@ -7627,7 +7740,7 @@ const Filter = props => {
7627
7740
  }, i) : jsxs("div", {
7628
7741
  className: `Sqb-TableName purple-name`,
7629
7742
  onClick: e => handleUpdate(e, i),
7630
- children: [v.quotes, jsx("span", {
7743
+ children: [v.type === Filter_TypeEnum.NOT_EXISTS ? 'not exitis ( * )' : v.quotes, jsx("span", {
7631
7744
  style: {
7632
7745
  fontSize: 0
7633
7746
  },
@@ -7837,8 +7950,8 @@ const GroupBy = props => {
7837
7950
  quotes: '',
7838
7951
  datasourceId: '',
7839
7952
  datasourceName: '',
7840
- column: '',
7841
- column_id: '',
7953
+ // column: '',
7954
+ // column_id: '',
7842
7955
  summarizeType: MetaSummarize_Enum.BY
7843
7956
  };
7844
7957
  store.setPopup({
@@ -8099,8 +8212,8 @@ const SelectIndex = props => {
8099
8212
  quotes: '',
8100
8213
  datasourceId: '',
8101
8214
  datasourceName: '',
8102
- column: '',
8103
- column_id: '',
8215
+ // column: '',
8216
+ // column_id: '',
8104
8217
  summarizeType: MetaSummarize_Enum.GROUP
8105
8218
  };
8106
8219
  store.setPopup({