@gingkoo/pandora-metabase 1.0.54 → 1.0.56

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.
@@ -17,7 +17,7 @@ import { uuidv4, getAlias } from '../../utils/helper';
17
17
  import { __ } from '../../locale';
18
18
  import { findIndex, getSubColumns } from '../../utils';
19
19
  import { TypeEnum, ColumnsPopupThemeEnum, JoinEnum, SQL_COLUMN_TYPE } from '../../store/enum';
20
- import { AtomsTypeEnum } from '../../store/types';
20
+ import { AtomsTypeEnum, ChangeType } from '../../store/types';
21
21
  import { SummarizeAlias } from '../../store/helper';
22
22
  import { getHelper, changeTableAlias, isValidSQLAlias, isError } from '../../utils';
23
23
  import ItemName from './components/item-name';
@@ -377,7 +377,10 @@ var JoinData = function JoinData(props) {
377
377
  onChange: function onChange(data) {
378
378
  var newMetaList = store.metaList[groupIndex].list.slice();
379
379
  newMetaList[index].columns = data;
380
- store.setMeta(newMetaList, groupIndex);
380
+ store.setMeta(newMetaList, groupIndex, {
381
+ obj: data,
382
+ type: ChangeType.field
383
+ });
381
384
  }
382
385
  })
383
386
  });
@@ -486,7 +489,7 @@ var JoinData = function JoinData(props) {
486
489
  }, []);
487
490
  }
488
491
  // // 过滤为table1选中的表
489
- var newMeta = store.metaList[groupIndex].list.slice();
492
+ var newMeta = cloneDeep(store.metaList[groupIndex].list);
490
493
  // if (((newMeta[index] as MetaJoin)[FlagLocation.TABLE_1] as MetaJoin_TalbeType).name) {
491
494
  // data = data.filter((v) => {
492
495
  // return (
@@ -513,8 +516,11 @@ var JoinData = function JoinData(props) {
513
516
  // }
514
517
  // }
515
518
  newMeta[index][table_type] = data;
516
- initExpressions();
517
- store.setMeta(newMeta, groupIndex);
519
+ initExpressions(newMeta);
520
+ store.setMeta(newMeta, groupIndex, {
521
+ obj: data,
522
+ type: ChangeType[table_type]
523
+ });
518
524
  store.setPopup({
519
525
  visible: false
520
526
  });
@@ -542,7 +548,7 @@ var JoinData = function JoinData(props) {
542
548
  var tableName = data.name;
543
549
  if (meta.table2.name !== tableName || meta.table2.datasourceId !== data.datasourceId) {
544
550
  var _store$preProps;
545
- var newMeta = store.metaList[groupIndex].list.slice();
551
+ var newMeta = cloneDeep(store.metaList[groupIndex].list);
546
552
  var alias = getAlias(tableName, newMeta, ((_store$preProps = store.preProps) === null || _store$preProps === void 0 ? void 0 : _store$preProps.notExistsColumns) || []);
547
553
  var _table2 = _objectSpread(_objectSpread({}, data), {}, {
548
554
  name: tableName,
@@ -555,12 +561,15 @@ var JoinData = function JoinData(props) {
555
561
  datasourceName: data.datasourceName
556
562
  });
557
563
  newMeta[index].table2 = _table2;
558
- initExpressions();
564
+ initExpressions(newMeta);
559
565
  store.fetchColumns(_table2, data.datasourceId, [], function (columns) {
560
566
  newMeta[index].columns = columns;
561
567
  // 关联表变了 下面模块全部删除
562
568
  // newMeta = newMeta.filter((v: MetaListType, i: number) => i <= index);
563
- // store.setMeta(newMeta, groupIndex);
569
+ store.setMeta(newMeta, groupIndex, {
570
+ obj: data,
571
+ type: ChangeType.table2
572
+ });
564
573
  });
565
574
  }
566
575
  setIsDel(false);
@@ -572,8 +581,8 @@ var JoinData = function JoinData(props) {
572
581
  });
573
582
  }
574
583
  // 切换表后重置数据
575
- function initExpressions() {
576
- var newMeta = store.metaList[groupIndex].list.slice();
584
+ function initExpressions(newMeta) {
585
+ // let newMeta: MetaListType[] = store.metaList[groupIndex].list.slice();
577
586
  if (newMeta[index].expressions && newMeta[index].expressions.length > 0) {
578
587
  return;
579
588
  }
@@ -655,7 +664,10 @@ var JoinData = function JoinData(props) {
655
664
  onChange: function onChange(type) {
656
665
  var newMeta = store.metaList[groupIndex].list.slice();
657
666
  newMeta[index].joinType = type;
658
- store.setMeta(newMeta, groupIndex);
667
+ store.setMeta(newMeta, groupIndex, {
668
+ obj: type,
669
+ type: ChangeType.joinType
670
+ });
659
671
  store.setPopup({
660
672
  visible: false
661
673
  });
@@ -941,7 +953,10 @@ var JoinData = function JoinData(props) {
941
953
  // _ind2
942
954
  // ] as AtomsField
943
955
  // ).quotes = quotes;
944
- store.setMeta(newMeta, groupIndex);
956
+ store.setMeta(newMeta, groupIndex, {
957
+ obj: fields,
958
+ type: ChangeType[_position]
959
+ });
945
960
  }
946
961
  })
947
962
  });
@@ -966,7 +981,10 @@ var JoinData = function JoinData(props) {
966
981
  var index = findIndex(store.metaList[groupIndex].list, meta);
967
982
  var newMeta = store.metaList[groupIndex].list.slice();
968
983
  newMeta[index].expressions[_ind][_position][_ind2].val = curObj.value;
969
- store.setMeta(newMeta, groupIndex);
984
+ store.setMeta(newMeta, groupIndex, {
985
+ obj: val,
986
+ type: ChangeType[_position]
987
+ });
970
988
  }
971
989
  })
972
990
  });
@@ -1072,7 +1090,7 @@ var JoinData = function JoinData(props) {
1072
1090
  isExit = _store$preProps2.isExit,
1073
1091
  toolbar = _store$preProps2.toolbar,
1074
1092
  other = _objectWithoutProperties(_store$preProps2, _excluded);
1075
- var newMeta = store.metaList[groupIndex].list.slice();
1093
+ var newMeta = cloneDeep(store.metaList[groupIndex].list);
1076
1094
  var index = findIndex(store.metaList[groupIndex].list, meta);
1077
1095
  var oldList = cloneDeep(newMeta[index].subquery);
1078
1096
  var _toolbar = subToolbar || toolbar;
@@ -1113,13 +1131,20 @@ var JoinData = function JoinData(props) {
1113
1131
  return oldCol.name === newCol.name;
1114
1132
  });
1115
1133
  // 如果存在,返回旧列;否则返回新列
1116
- return existingCol ? existingCol : newCol;
1134
+ // return existingCol ? existingCol : newCol;
1135
+ var _column = existingCol ? existingCol : newCol;
1136
+ _column.select = store.isSelectFields || _column.select;
1137
+ // 如果存在,返回旧列;否则返回新列
1138
+ return _column;
1117
1139
  });
1118
1140
  // (newMeta[index] as MetaJoin).columns = newColumns;
1119
- initExpressions();
1141
+ initExpressions(newMeta);
1120
1142
  // 关联表变了 下面模块全部删除
1121
1143
  // newMeta = newMeta.filter((v: MetaListType, i: number) => i <= index);
1122
- store.setMeta(newMeta, groupIndex);
1144
+ store.setMeta(newMeta, groupIndex, {
1145
+ obj: newList,
1146
+ type: ChangeType.subQuery
1147
+ });
1123
1148
  o.close();
1124
1149
  } catch (e) {
1125
1150
  console.warn(e);
@@ -1180,7 +1205,10 @@ var JoinData = function JoinData(props) {
1180
1205
  newMeta = store.metaList[groupIndex].list.slice();
1181
1206
  newMeta[index].table2.alias = alias;
1182
1207
  newMeta = changeTableAlias(newMeta, newMeta[index].table2);
1183
- store.setMeta(newMeta, groupIndex);
1208
+ store.setMeta(newMeta, groupIndex, {
1209
+ obj: newMeta[index].table2,
1210
+ type: ChangeType.tableAlias
1211
+ });
1184
1212
  case 2:
1185
1213
  case "end":
1186
1214
  return _context2.stop();
@@ -1216,7 +1244,10 @@ var JoinData = function JoinData(props) {
1216
1244
  value: value,
1217
1245
  onChange: function onChange(data) {
1218
1246
  newMeta[index].expressions.splice(i, 1, data);
1219
- store.setMeta(newMeta, groupIndex);
1247
+ store.setMeta(newMeta, groupIndex, {
1248
+ obj: newMeta[index].expressions,
1249
+ type: ChangeType.expressions
1250
+ });
1220
1251
  closePopup();
1221
1252
  }
1222
1253
  })
@@ -1461,61 +1492,149 @@ var JoinData = function JoinData(props) {
1461
1492
  onClick: function onClick() {
1462
1493
  showSubQuery(meta.subquery);
1463
1494
  },
1464
- children: [subQuerySelected && _jsx(Tooltip, {
1465
- title: __(tableIsError() ? isDel ? 'metabase.verify' : 'SqlQueryBuilder.repeatAlias' : 'SqlQueryBuilder.alias'),
1466
- children: _jsx(Button, {
1467
- danger: tableIsError(),
1468
- className: cx(':Sqb-TableName-as', {
1469
- isError: tableIsError()
1470
- }),
1471
- shape: 'circle',
1472
- style: isDel ? {
1473
- fontSize: 18,
1474
- backgroundColor: '#fff',
1475
- width: 'auto',
1476
- height: 'auto'
1477
- } : {},
1478
- iconOnly: true,
1479
- primary: !isDel,
1480
- icon: isDel ? _jsx(ExclamationCircleFill, {}) : 'As',
1481
- size: 'small',
1482
- onClick: function onClick(e) {
1483
- var _meta$table4;
1484
- e.stopPropagation();
1485
- onChangeTableAlias(((_meta$table4 = meta.table2) === null || _meta$table4 === void 0 ? void 0 : _meta$table4.alias) || '');
1486
- }
1487
- })
1488
- }), subQuerySelected ? "".concat(((_meta$subquery2 = meta.subquery) === null || _meta$subquery2 === void 0 ? void 0 : _meta$subquery2[0]).table.datasourceName, ".").concat(((_meta$subquery3 = meta.subquery) === null || _meta$subquery3 === void 0 ? void 0 : _meta$subquery3[0]).table.name, " ").concat((_meta$table5 = meta.table2) !== null && _meta$table5 !== void 0 && _meta$table5.alias ? "as ".concat((_meta$table6 = meta.table2) === null || _meta$table6 === void 0 ? void 0 : _meta$table6.alias) : '', " ") : __('SqlQueryBuilder.setSubQuery')]
1495
+ children: [subQuerySelected && _jsx(_Fragment, {
1496
+ children: function () {
1497
+ var showButton = store.tableEnableAlias || tableIsError() && isDel;
1498
+ var icon = isDel ? _jsx(ExclamationCircleFill, {}) : store.tableEnableAlias ? 'As' : '';
1499
+ return showButton ? _jsx(Tooltip, {
1500
+ title: __(tableIsError() ? isDel ? 'metabase.verify' : 'SqlQueryBuilder.repeatAlias' : 'SqlQueryBuilder.alias'),
1501
+ children: _jsx(Button, {
1502
+ danger: tableIsError(),
1503
+ className: cx(':Sqb-TableName-as', {
1504
+ isError: tableIsError()
1505
+ }),
1506
+ shape: 'circle',
1507
+ style: isDel ? {
1508
+ fontSize: 18,
1509
+ backgroundColor: '#fff',
1510
+ width: 'auto',
1511
+ height: 'auto'
1512
+ } : {},
1513
+ iconOnly: true,
1514
+ primary: !isDel,
1515
+ icon: icon,
1516
+ size: 'small',
1517
+ onClick: function onClick(e) {
1518
+ if (store.tableEnableAlias) {
1519
+ var _meta$table4;
1520
+ e.stopPropagation();
1521
+ onChangeTableAlias(((_meta$table4 = meta.table2) === null || _meta$table4 === void 0 ? void 0 : _meta$table4.alias) || '');
1522
+ }
1523
+ }
1524
+ })
1525
+ }) : null;
1526
+ }()
1527
+ })
1528
+ // <Tooltip
1529
+ // title={__(
1530
+ // tableIsError()
1531
+ // ? isDel
1532
+ // ? 'metabase.verify'
1533
+ // : 'SqlQueryBuilder.repeatAlias'
1534
+ // : 'SqlQueryBuilder.alias',
1535
+ // )}
1536
+ // >
1537
+ // <Button
1538
+ // danger={tableIsError()}
1539
+ // className={cx(':Sqb-TableName-as', {
1540
+ // isError: tableIsError(),
1541
+ // })}
1542
+ // shape='circle'
1543
+ // style={
1544
+ // isDel
1545
+ // ? {
1546
+ // fontSize: 18,
1547
+ // backgroundColor: '#fff',
1548
+ // width: 'auto',
1549
+ // height: 'auto',
1550
+ // }
1551
+ // : {}
1552
+ // }
1553
+ // iconOnly
1554
+ // primary={!isDel}
1555
+ // icon={isDel ? <ExclamationCircleFill /> : 'As'}
1556
+ // size='small'
1557
+ // onClick={(e) => {
1558
+ // e.stopPropagation();
1559
+ // onChangeTableAlias(meta.table2?.alias || '');
1560
+ // }}
1561
+ // ></Button>
1562
+ // </Tooltip>
1563
+ , subQuerySelected ? "".concat(((_meta$subquery2 = meta.subquery) === null || _meta$subquery2 === void 0 ? void 0 : _meta$subquery2[0]).table.datasourceName, ".").concat(((_meta$subquery3 = meta.subquery) === null || _meta$subquery3 === void 0 ? void 0 : _meta$subquery3[0]).table.name, " ").concat((_meta$table5 = meta.table2) !== null && _meta$table5 !== void 0 && _meta$table5.alias && store.tableEnableAlias ? "as ".concat((_meta$table6 = meta.table2) === null || _meta$table6 === void 0 ? void 0 : _meta$table6.alias) : '', " ") : __('SqlQueryBuilder.setSubQuery')]
1489
1564
  }) : _jsxs("div", {
1490
1565
  className: cx("Sqb-TableName", {
1491
1566
  notSelected: !table2Selected
1492
1567
  }),
1493
1568
  onClick: selectTable,
1494
- children: [table2Selected && _jsx(Tooltip, {
1495
- title: __(tableIsError() ? isDel ? 'metabase.verify' : 'SqlQueryBuilder.repeatAlias' : 'SqlQueryBuilder.alias'),
1496
- children: _jsx(Button, {
1497
- danger: tableIsError(),
1498
- className: cx(':Sqb-TableName-as', {
1499
- isError: tableIsError()
1500
- }),
1501
- shape: 'circle',
1502
- style: isDel ? {
1503
- fontSize: 18,
1504
- backgroundColor: '#fff',
1505
- width: 'auto',
1506
- height: 'auto'
1507
- } : {},
1508
- iconOnly: true,
1509
- primary: !isDel,
1510
- icon: isDel ? _jsx(ExclamationCircleFill, {}) : 'As',
1511
- size: 'small',
1512
- onClick: function onClick(e) {
1513
- var _meta$table7;
1514
- e.stopPropagation();
1515
- onChangeTableAlias(((_meta$table7 = meta.table2) === null || _meta$table7 === void 0 ? void 0 : _meta$table7.alias) || '');
1516
- }
1517
- })
1518
- }), table2Selected ? "".concat(meta.table2.datasourceName, ".").concat(meta.table2.name, " ").concat((_meta$table8 = meta.table2) !== null && _meta$table8 !== void 0 && _meta$table8.alias ? "as ".concat((_meta$table9 = meta.table2) === null || _meta$table9 === void 0 ? void 0 : _meta$table9.alias) : '') : __('SqlQueryBuilder.pickTable')]
1569
+ children: [table2Selected && _jsx(_Fragment, {
1570
+ children: function () {
1571
+ var showButton = store.tableEnableAlias || tableIsError() && isDel;
1572
+ var icon = isDel ? _jsx(ExclamationCircleFill, {}) : store.tableEnableAlias ? 'As' : '';
1573
+ return showButton ? _jsx(Tooltip, {
1574
+ title: __(tableIsError() ? isDel ? 'metabase.verify' : 'SqlQueryBuilder.repeatAlias' : 'SqlQueryBuilder.alias'),
1575
+ children: _jsx(Button, {
1576
+ danger: tableIsError(),
1577
+ className: cx(':Sqb-TableName-as', {
1578
+ isError: tableIsError()
1579
+ }),
1580
+ shape: 'circle',
1581
+ style: isDel ? {
1582
+ fontSize: 18,
1583
+ backgroundColor: '#fff',
1584
+ width: 'auto',
1585
+ height: 'auto'
1586
+ } : {},
1587
+ iconOnly: true,
1588
+ primary: !isDel,
1589
+ icon: icon,
1590
+ size: 'small',
1591
+ onClick: function onClick(e) {
1592
+ if (store.tableEnableAlias) {
1593
+ var _meta$table7;
1594
+ e.stopPropagation();
1595
+ onChangeTableAlias(((_meta$table7 = meta.table2) === null || _meta$table7 === void 0 ? void 0 : _meta$table7.alias) || '');
1596
+ }
1597
+ }
1598
+ })
1599
+ }) : null;
1600
+ }()
1601
+ })
1602
+ // <Tooltip
1603
+ // title={__(
1604
+ // tableIsError()
1605
+ // ? isDel
1606
+ // ? 'metabase.verify'
1607
+ // : 'SqlQueryBuilder.repeatAlias'
1608
+ // : 'SqlQueryBuilder.alias',
1609
+ // )}
1610
+ // >
1611
+ // <Button
1612
+ // danger={tableIsError()}
1613
+ // className={cx(':Sqb-TableName-as', {
1614
+ // isError: tableIsError(),
1615
+ // })}
1616
+ // shape='circle'
1617
+ // style={
1618
+ // isDel
1619
+ // ? {
1620
+ // fontSize: 18,
1621
+ // backgroundColor: '#fff',
1622
+ // width: 'auto',
1623
+ // height: 'auto',
1624
+ // }
1625
+ // : {}
1626
+ // }
1627
+ // iconOnly
1628
+ // primary={!isDel}
1629
+ // icon={isDel ? <ExclamationCircleFill /> : 'As'}
1630
+ // size='small'
1631
+ // onClick={(e) => {
1632
+ // e.stopPropagation();
1633
+ // onChangeTableAlias(meta.table2?.alias || '');
1634
+ // }}
1635
+ // ></Button>
1636
+ // </Tooltip>
1637
+ , table2Selected ? "".concat(meta.table2.datasourceName, ".").concat(meta.table2.name, " ").concat((_meta$table8 = meta.table2) !== null && _meta$table8 !== void 0 && _meta$table8.alias && store.tableEnableAlias ? "as ".concat((_meta$table9 = meta.table2) === null || _meta$table9 === void 0 ? void 0 : _meta$table9.alias) : '') : __('SqlQueryBuilder.pickTable')]
1519
1638
  }), store.showSubquery && _jsx(Tooltip, {
1520
1639
  title: __('SqlQueryBuilder.switchSubQuery'),
1521
1640
  children: _jsx(Button, {
@@ -1718,7 +1837,10 @@ var JoinData = function JoinData(props) {
1718
1837
  var newMeta = store.metaList[groupIndex].list.slice();
1719
1838
  newMeta[index].expressions[i].list = data;
1720
1839
  newMeta[index].expressions[i].quotes = _quotes;
1721
- store.setMeta(newMeta, groupIndex);
1840
+ store.setMeta(newMeta, groupIndex, {
1841
+ obj: newMeta[index].expressions,
1842
+ type: ChangeType.expressions
1843
+ });
1722
1844
  }
1723
1845
  }), _jsx(Tooltip, {
1724
1846
  title: __('SqlQueryBuilder.add'),
@@ -1,12 +1,12 @@
1
1
  import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
2
2
  import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
3
3
  import _regeneratorRuntime from "@babel/runtime/regenerator";
4
- import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
4
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
5
5
  import cx from 'classnames';
6
6
  import { __ } from '../../../locale';
7
7
  import { findIndex, getHelper } from '../../../utils';
8
8
  import { TypeEnum, ColumnsPopupThemeEnum, SQL_COLUMN_TYPE } from '../../../store/enum';
9
- import { MetaSummarize_Enum, AtomsTypeEnum } from '../../../store/types';
9
+ import { MetaSummarize_Enum, AtomsTypeEnum, ChangeType } from '../../../store/types';
10
10
  import SelectJoinColumn from '../../dialog/select-join-column';
11
11
  import { Tooltip, Button, Modal, Input, Toast } from '@gingkoo/pandora';
12
12
  import { uuidv4, getAlias } from '../../../utils/helper';
@@ -151,7 +151,10 @@ var GroupBy = function GroupBy(props) {
151
151
  // if (value.quotes !== data.quotes) {
152
152
  // newMeta = newMeta.filter((_: MetaListType, _i: number) => _i <= index);
153
153
  // }
154
- store.setMeta(newMeta, groupIndex);
154
+ store.setMeta(newMeta, groupIndex, {
155
+ obj: newMeta[index].by,
156
+ type: ChangeType.by
157
+ });
155
158
  closePopup();
156
159
  }
157
160
  })
@@ -203,7 +206,10 @@ var GroupBy = function GroupBy(props) {
203
206
  summarizeType: MetaSummarize_Enum.BY
204
207
  });
205
208
  });
206
- store.setMeta(newMeta, groupIndex);
209
+ store.setMeta(newMeta, groupIndex, {
210
+ obj: newMeta[index].by,
211
+ type: ChangeType.by
212
+ });
207
213
  closePopup();
208
214
  }
209
215
  })
@@ -253,7 +259,10 @@ var GroupBy = function GroupBy(props) {
253
259
  newMeta[index].by[i].sql = newMeta[index].by[i].sql.split('AS ')[0] + "AS ".concat(fieldAlias); //修改sql
254
260
  newMeta[index].by[i].fieldAlias = fieldAlias;
255
261
  newMeta = changeFieldAlias(newMeta, newMeta[index].by[i]);
256
- store.setMeta(newMeta, groupIndex);
262
+ store.setMeta(newMeta, groupIndex, {
263
+ obj: newMeta[index].by,
264
+ type: ChangeType.by
265
+ });
257
266
  case 2:
258
267
  case "end":
259
268
  return _context.stop();
@@ -322,19 +331,21 @@ var GroupBy = function GroupBy(props) {
322
331
  onClick: function onClick(e) {
323
332
  return handleUpdate(e, i);
324
333
  },
325
- children: [v.quotes && _jsx(Tooltip, {
326
- title: __('SqlQueryBuilder.alias'),
327
- children: _jsx(Button, {
328
- className: ':Sqb-TableName-as :Sqb-TableName green-name',
329
- shape: 'circle',
330
- iconOnly: true,
331
- primary: true,
332
- icon: 'As',
333
- size: 'small',
334
- onClick: function onClick(e) {
335
- e.stopPropagation();
336
- onChangeFieldAlias((v === null || v === void 0 ? void 0 : v.fieldAlias) || '', i);
337
- }
334
+ children: [v.quotes && _jsx(_Fragment, {
335
+ children: store.fieldEnableAlias && _jsx(Tooltip, {
336
+ title: __('SqlQueryBuilder.alias'),
337
+ children: _jsx(Button, {
338
+ className: ':Sqb-TableName-as :Sqb-TableName green-name',
339
+ shape: 'circle',
340
+ iconOnly: true,
341
+ primary: true,
342
+ icon: 'As',
343
+ size: 'small',
344
+ onClick: function onClick(e) {
345
+ e.stopPropagation();
346
+ onChangeFieldAlias((v === null || v === void 0 ? void 0 : v.fieldAlias) || '', i);
347
+ }
348
+ })
338
349
  })
339
350
  }), "".concat(v.quotes, " ").concat(v.fieldAlias ? "as ".concat(v.fieldAlias) : ''), _jsx("span", {
340
351
  style: {
@@ -1,7 +1,7 @@
1
1
  import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
2
2
  import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
3
3
  import _regeneratorRuntime from "@babel/runtime/regenerator";
4
- import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
4
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
5
5
  import cx from 'classnames';
6
6
  import { __ } from '../../../locale';
7
7
  import { findIndex, getHelper } from '../../../utils';
@@ -9,7 +9,7 @@ import { TypeEnum, SQL_COLUMN_TYPE } from '../../../store/enum';
9
9
  import { summarizeToSql } from '../../../store/helper';
10
10
  import { Tooltip, Button, Modal, Input, Toast } from '@gingkoo/pandora';
11
11
  import { uuidv4 } from '../../../utils/helper';
12
- import { MetaSummarize_Enum, AtomsTypeEnum } from '../../../store/types';
12
+ import { MetaSummarize_Enum, AtomsTypeEnum, ChangeType } from '../../../store/types';
13
13
  import { changeFieldAlias, isValidSQLAlias, isError } from '../../../utils';
14
14
  import ItemName from '../components/item-name';
15
15
  import { AddIcon, CloseIcon } from '../../icons';
@@ -152,7 +152,10 @@ var SelectIndex = function SelectIndex(props) {
152
152
  // if (value.quotes !== data.quotes) {
153
153
  // newMeta = newMeta.filter((_: MetaListType, _i: number) => _i <= index);
154
154
  // }
155
- store.setMeta(newMeta, groupIndex);
155
+ store.setMeta(newMeta, groupIndex, {
156
+ obj: newMeta[index].group,
157
+ type: ChangeType.group
158
+ });
156
159
  closePopup();
157
160
  }
158
161
  })
@@ -203,7 +206,10 @@ var SelectIndex = function SelectIndex(props) {
203
206
  summarizeType: MetaSummarize_Enum.GROUP
204
207
  });
205
208
  });
206
- store.setMeta(newMeta, groupIndex);
209
+ store.setMeta(newMeta, groupIndex, {
210
+ obj: newMeta[index].group,
211
+ type: ChangeType.group
212
+ });
207
213
  closePopup();
208
214
  }
209
215
  })
@@ -254,7 +260,10 @@ var SelectIndex = function SelectIndex(props) {
254
260
  newMeta[index].group[i].fieldAlias = fieldAlias;
255
261
  newMeta[index].group[i].sql = newMeta[index].group[i].sql.split('AS ')[0] + "AS ".concat(fieldAlias); //修改sql
256
262
  newMeta = changeFieldAlias(newMeta, newMeta[index].group[i]);
257
- store.setMeta(newMeta, groupIndex);
263
+ store.setMeta(newMeta, groupIndex, {
264
+ obj: newMeta[index].group,
265
+ type: ChangeType.group
266
+ });
258
267
  case 2:
259
268
  case "end":
260
269
  return _context.stop();
@@ -323,19 +332,21 @@ var SelectIndex = function SelectIndex(props) {
323
332
  onClick: function onClick(e) {
324
333
  return handleUpdate(e, i);
325
334
  },
326
- children: [v.quotes && _jsx(Tooltip, {
327
- title: __('SqlQueryBuilder.alias'),
328
- children: _jsx(Button, {
329
- className: ':Sqb-TableName-as :Sqb-TableName green-name',
330
- shape: 'circle',
331
- iconOnly: true,
332
- primary: true,
333
- icon: 'As',
334
- size: 'small',
335
- onClick: function onClick(e) {
336
- e.stopPropagation();
337
- onChangeFieldAlias((v === null || v === void 0 ? void 0 : v.fieldAlias) || '', i);
338
- }
335
+ children: [v.quotes && _jsx(_Fragment, {
336
+ children: store.fieldEnableAlias && _jsx(Tooltip, {
337
+ title: __('SqlQueryBuilder.alias'),
338
+ children: _jsx(Button, {
339
+ className: ':Sqb-TableName-as :Sqb-TableName green-name',
340
+ shape: 'circle',
341
+ iconOnly: true,
342
+ primary: true,
343
+ icon: 'As',
344
+ size: 'small',
345
+ onClick: function onClick(e) {
346
+ e.stopPropagation();
347
+ onChangeFieldAlias((v === null || v === void 0 ? void 0 : v.fieldAlias) || '', i);
348
+ }
349
+ })
339
350
  })
340
351
  }), "".concat(v.quotes, " ").concat(v.fieldAlias ? "as ".concat(v.fieldAlias) : ''), _jsx("span", {
341
352
  style: {