@gingkoo/pandora-metabase 1.0.140 → 1.0.141-alpha.4

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.
Files changed (32) hide show
  1. package/README.md +2 -3
  2. package/lib/cjs/components/dialog/formula-list/LogicGroup.d.ts +8 -5
  3. package/lib/cjs/components/dialog/formula-list/LogicGroup.js +64 -18
  4. package/lib/cjs/components/dialog/formula-list/index.js +374 -153
  5. package/lib/cjs/components/dialog/formula-list/index.less +18 -5
  6. package/lib/cjs/components/dialog/formula-list/utils.js +45 -17
  7. package/lib/cjs/components/dialog/select-summarize/index.js +7 -0
  8. package/lib/cjs/components/modules/summarize/group-by.js +10 -1
  9. package/lib/cjs/components/modules/summarize/select-index.js +3 -1
  10. package/lib/cjs/hooks/use-state.js +181 -80
  11. package/lib/cjs/index.js +24 -3
  12. package/lib/cjs/store/types.d.ts +4 -4
  13. package/lib/cjs/types.d.ts +21 -1
  14. package/lib/cjs/utils/transformSql.js +51 -38
  15. package/lib/cjs/utils.d.ts +1 -0
  16. package/lib/cjs/utils.js +291 -56
  17. package/lib/es/components/dialog/formula-list/LogicGroup.d.ts +8 -5
  18. package/lib/es/components/dialog/formula-list/LogicGroup.js +65 -19
  19. package/lib/es/components/dialog/formula-list/index.js +373 -152
  20. package/lib/es/components/dialog/formula-list/index.less +18 -5
  21. package/lib/es/components/dialog/formula-list/utils.js +45 -17
  22. package/lib/es/components/dialog/select-summarize/index.js +7 -0
  23. package/lib/es/components/modules/summarize/group-by.js +10 -1
  24. package/lib/es/components/modules/summarize/select-index.js +3 -1
  25. package/lib/es/hooks/use-state.js +182 -81
  26. package/lib/es/index.js +25 -4
  27. package/lib/es/store/types.d.ts +4 -4
  28. package/lib/es/types.d.ts +21 -1
  29. package/lib/es/utils/transformSql.js +52 -39
  30. package/lib/es/utils.d.ts +1 -0
  31. package/lib/es/utils.js +290 -55
  32. package/package.json +1 -1
package/lib/es/utils.js CHANGED
@@ -1,10 +1,13 @@
1
+ import _createForOfIteratorHelper from "@babel/runtime/helpers/esm/createForOfIteratorHelper";
1
2
  import _typeof from "@babel/runtime/helpers/esm/typeof";
2
3
  import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
3
- import _createForOfIteratorHelper from "@babel/runtime/helpers/esm/createForOfIteratorHelper";
4
4
  import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
5
5
  import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
6
6
  import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
7
- var _excluded = ["list"];
7
+ var _excluded = ["operator", "leftAtoms", "rightAtoms", "atoms"],
8
+ _excluded2 = ["operator", "leftAtoms", "rightAtoms", "atoms"],
9
+ _excluded3 = ["operator", "leftAtoms", "rightAtoms", "atoms", "items"],
10
+ _excluded4 = ["list"];
8
11
  import { __, isEn } from './locale';
9
12
  import { TypeEnum, SQL_COLUMN_TYPE } from './store/enum';
10
13
  import { MetaSummarize_Enum, AtomsTypeEnum } from './store/types';
@@ -312,14 +315,13 @@ var _syncSubQueryFieldItems = function syncSubQueryFieldItems() {
312
315
  elseAtoms: _syncSubQueryFieldItems(item.elseAtoms || [], table, columns, oldColumns)
313
316
  });
314
317
  } else if (item.type === AtomsTypeEnum.AND_OR) {
315
- var hasBinarySides = Array.isArray(item.leftAtoms) || Array.isArray(item.rightAtoms);
316
- nextItem = _objectSpread(_objectSpread({}, item), hasBinarySides ? {
317
- atoms: undefined,
318
- leftAtoms: _syncSubQueryFieldItems(item.leftAtoms || [], table, columns, oldColumns),
319
- rightAtoms: _syncSubQueryFieldItems(item.rightAtoms || [], table, columns, oldColumns)
320
- } : {
321
- atoms: _syncSubQueryFieldItems(item.atoms || [], table, columns, oldColumns)
322
- });
318
+ nextItem = syncAndOrBinaryFields(_objectSpread(_objectSpread({}, item), {}, {
319
+ items: normalizeAndOrItems(item).map(function (logicItem) {
320
+ return _objectSpread(_objectSpread({}, logicItem), {}, {
321
+ atoms: _syncSubQueryFieldItems(logicItem.atoms || [], table, columns, oldColumns)
322
+ });
323
+ })
324
+ }));
323
325
  } else {
324
326
  nextItem = item;
325
327
  }
@@ -619,15 +621,250 @@ var buildFormulaQuotes = function buildFormulaQuotes(item) {
619
621
  var argsText = (item.args || []).map(_getAtomDisplayText).join(' , ');
620
622
  return normalizeAtomQuotes("".concat(item.name || '', " ( ").concat(argsText, " )"));
621
623
  };
624
+ var normalizeAndOrItems = function normalizeAndOrItems(item) {
625
+ if (Array.isArray(item.items) && item.items.length > 0) {
626
+ return item.items.map(function (logicItem, index) {
627
+ var operator = logicItem.operator,
628
+ leftAtoms = logicItem.leftAtoms,
629
+ rightAtoms = logicItem.rightAtoms,
630
+ atoms = logicItem.atoms,
631
+ nextLogicItem = _objectWithoutProperties(logicItem, _excluded);
632
+ return _objectSpread(_objectSpread(_objectSpread({}, nextLogicItem), index > 0 ? {
633
+ operator: operator || item.operator || 'and'
634
+ } : {}), {}, {
635
+ atoms: Array.isArray(atoms) && atoms.length > 0 ? atoms : []
636
+ });
637
+ });
638
+ }
639
+ if (Array.isArray(item.leftAtoms) || Array.isArray(item.rightAtoms)) {
640
+ return [{
641
+ atoms: Array.isArray(item.leftAtoms) ? item.leftAtoms : []
642
+ }, {
643
+ operator: item.operator || 'and',
644
+ atoms: Array.isArray(item.rightAtoms) ? item.rightAtoms : []
645
+ }];
646
+ }
647
+ return [{
648
+ atoms: Array.isArray(item.atoms) ? item.atoms : []
649
+ }];
650
+ };
622
651
  var buildAndOrQuotes = function buildAndOrQuotes(item) {
623
- var hasBinarySides = Array.isArray(item.leftAtoms) || Array.isArray(item.rightAtoms);
624
- if (hasBinarySides) {
625
- var leftText = (item.leftAtoms || []).map(_getAtomDisplayText).join(' ');
626
- var rightText = (item.rightAtoms || []).map(_getAtomDisplayText).join(' ');
627
- return normalizeAtomQuotes("( ".concat(leftText, " ").concat(item.operator || 'and', " ").concat(rightText, " )"));
628
- }
629
- var atomsText = (item.atoms || []).map(_getAtomDisplayText).join(' ');
630
- return normalizeAtomQuotes("".concat(item.operator || 'and', " ( ").concat(atomsText, " )"));
652
+ var itemsText = normalizeAndOrItems(item).map(function (logicItem, index) {
653
+ var atomsText = (logicItem.atoms || []).map(_getAtomDisplayText).join(' ');
654
+ return index === 0 ? atomsText : "".concat(logicItem.operator || 'and', " ").concat(atomsText);
655
+ }).join(' ');
656
+ return normalizeAtomQuotes("( ".concat(itemsText, " )"));
657
+ };
658
+ var syncAndOrBinaryFields = function syncAndOrBinaryFields(item) {
659
+ var operator = item.operator,
660
+ leftAtoms = item.leftAtoms,
661
+ rightAtoms = item.rightAtoms,
662
+ atoms = item.atoms,
663
+ nextItem = _objectWithoutProperties(item, _excluded2);
664
+ return _objectSpread(_objectSpread({}, nextItem), {}, {
665
+ items: normalizeAndOrItems(item)
666
+ });
667
+ };
668
+ var _normalizeAndOrStructureInner = function normalizeAndOrStructureInner(data, cache) {
669
+ if (!data || _typeof(data) !== 'object') return data;
670
+ if (cache.has(data)) return cache.get(data);
671
+ if (Array.isArray(data)) {
672
+ var nextList = [];
673
+ cache.set(data, nextList);
674
+ data.forEach(function (item) {
675
+ nextList.push(_normalizeAndOrStructureInner(item, cache));
676
+ });
677
+ return nextList;
678
+ }
679
+ var item = data;
680
+ if (item.type === AtomsTypeEnum.AND_OR) {
681
+ var operator = item.operator,
682
+ leftAtoms = item.leftAtoms,
683
+ rightAtoms = item.rightAtoms,
684
+ atoms = item.atoms,
685
+ items = item.items,
686
+ nextItem = _objectWithoutProperties(item, _excluded3);
687
+ var normalizedItem = _objectSpread(_objectSpread({}, nextItem), {}, {
688
+ items: []
689
+ });
690
+ cache.set(item, normalizedItem);
691
+ normalizedItem.items = normalizeAndOrItems(item).map(function (logicItem) {
692
+ return _objectSpread(_objectSpread({}, logicItem.operator ? {
693
+ operator: logicItem.operator
694
+ } : {}), {}, {
695
+ atoms: _normalizeAndOrStructureInner(logicItem.atoms || [], cache)
696
+ });
697
+ });
698
+ normalizedItem.quotes = buildAndOrQuotes(normalizedItem);
699
+ return normalizedItem;
700
+ }
701
+ if (item.type === AtomsTypeEnum.JOIN_DEFAULT || item.type === AtomsTypeEnum.EXPRESSION) {
702
+ var _nextItem = _objectSpread({}, item);
703
+ cache.set(item, _nextItem);
704
+ if (Array.isArray(item.lhs)) {
705
+ _nextItem.lhs = _normalizeAndOrStructureInner(item.lhs, cache);
706
+ }
707
+ if (Array.isArray(item.rhs)) {
708
+ _nextItem.rhs = _normalizeAndOrStructureInner(item.rhs, cache);
709
+ }
710
+ return _nextItem;
711
+ }
712
+ if (item.type === AtomsTypeEnum.FORMULA) {
713
+ var _nextItem2 = _objectSpread({}, item);
714
+ cache.set(item, _nextItem2);
715
+ if (Array.isArray(item.args)) {
716
+ _nextItem2.args = _normalizeAndOrStructureInner(item.args, cache);
717
+ }
718
+ return _nextItem2;
719
+ }
720
+ if (item.type === AtomsTypeEnum.COLLECTION) {
721
+ var _nextItem3 = _objectSpread({}, item);
722
+ cache.set(item, _nextItem3);
723
+ if (Array.isArray(item.list)) {
724
+ _nextItem3.list = _normalizeAndOrStructureInner(item.list, cache);
725
+ }
726
+ return _nextItem3;
727
+ }
728
+ if (item.type === AtomsTypeEnum.CASE_WHEN) {
729
+ var _nextItem4 = _objectSpread({}, item);
730
+ cache.set(item, _nextItem4);
731
+ if (Array.isArray(item.caseAtoms)) {
732
+ _nextItem4.caseAtoms = _normalizeAndOrStructureInner(item.caseAtoms, cache);
733
+ }
734
+ if (Array.isArray(item.whenClauses)) {
735
+ _nextItem4.whenClauses = item.whenClauses.map(function (clause) {
736
+ if (!clause || _typeof(clause) !== 'object') return clause;
737
+ if (cache.has(clause)) return cache.get(clause);
738
+ var nextClause = _objectSpread({}, clause);
739
+ cache.set(clause, nextClause);
740
+ if (Array.isArray(clause.whenAtoms)) {
741
+ nextClause.whenAtoms = _normalizeAndOrStructureInner(clause.whenAtoms, cache);
742
+ }
743
+ if (Array.isArray(clause.thenAtoms)) {
744
+ nextClause.thenAtoms = _normalizeAndOrStructureInner(clause.thenAtoms, cache);
745
+ }
746
+ return nextClause;
747
+ });
748
+ }
749
+ if (Array.isArray(item.elseAtoms)) {
750
+ _nextItem4.elseAtoms = _normalizeAndOrStructureInner(item.elseAtoms, cache);
751
+ }
752
+ return _nextItem4;
753
+ }
754
+ if (item.type === AtomsTypeEnum.EXISTS || item.type === AtomsTypeEnum.NOT_EXISTS || item.type === AtomsTypeEnum.SUB_QUERY) {
755
+ var _nextItem5 = _objectSpread({}, item);
756
+ cache.set(item, _nextItem5);
757
+ if (Array.isArray(item.notExists)) {
758
+ _nextItem5.notExists = _normalizeAndOrStructureInner(item.notExists, cache);
759
+ }
760
+ if (Array.isArray(item.subQuery)) {
761
+ _nextItem5.subQuery = _normalizeAndOrStructureInner(item.subQuery, cache);
762
+ }
763
+ return _nextItem5;
764
+ }
765
+ if (item.type === TypeEnum.data) {
766
+ var _nextItem6 = _objectSpread({}, item);
767
+ cache.set(item, _nextItem6);
768
+ if (Array.isArray(item.subquery)) {
769
+ _nextItem6.subquery = _normalizeAndOrStructureInner(item.subquery, cache);
770
+ }
771
+ return _nextItem6;
772
+ }
773
+ if (item.type === TypeEnum.joinData) {
774
+ var _nextItem7 = _objectSpread({}, item);
775
+ cache.set(item, _nextItem7);
776
+ if (Array.isArray(item.expressions)) {
777
+ _nextItem7.expressions = _normalizeAndOrStructureInner(item.expressions, cache);
778
+ }
779
+ if (Array.isArray(item.subquery)) {
780
+ _nextItem7.subquery = _normalizeAndOrStructureInner(item.subquery, cache);
781
+ }
782
+ return _nextItem7;
783
+ }
784
+ if (item.type === TypeEnum.customColumn) {
785
+ var _nextItem8 = _objectSpread({}, item);
786
+ cache.set(item, _nextItem8);
787
+ if (Array.isArray(item.customColumn)) {
788
+ _nextItem8.customColumn = item.customColumn.map(function (column) {
789
+ if (!column || _typeof(column) !== 'object') return column;
790
+ if (cache.has(column)) return cache.get(column);
791
+ var nextColumn = _objectSpread({}, column);
792
+ cache.set(column, nextColumn);
793
+ if (Array.isArray(column.formulaList)) {
794
+ nextColumn.formulaList = _normalizeAndOrStructureInner(column.formulaList, cache);
795
+ }
796
+ return nextColumn;
797
+ });
798
+ }
799
+ return _nextItem8;
800
+ }
801
+ if (item.type === TypeEnum.filter) {
802
+ var _nextItem9 = _objectSpread({}, item);
803
+ cache.set(item, _nextItem9);
804
+ if (Array.isArray(item.filter)) {
805
+ _nextItem9.filter = _normalizeAndOrStructureInner(item.filter, cache);
806
+ }
807
+ return _nextItem9;
808
+ }
809
+ if (item.type === TypeEnum.summarize) {
810
+ var _nextItem0 = _objectSpread({}, item);
811
+ cache.set(item, _nextItem0);
812
+ if (Array.isArray(item.group)) {
813
+ _nextItem0.group = item.group.map(function (record) {
814
+ if (!record || _typeof(record) !== 'object') return record;
815
+ if (cache.has(record)) return cache.get(record);
816
+ var nextRecord = _objectSpread({}, record);
817
+ cache.set(record, nextRecord);
818
+ if (Array.isArray(record.atoms)) {
819
+ nextRecord.atoms = _normalizeAndOrStructureInner(record.atoms, cache);
820
+ }
821
+ return nextRecord;
822
+ });
823
+ }
824
+ if (Array.isArray(item.by)) {
825
+ _nextItem0.by = item.by.map(function (record) {
826
+ if (!record || _typeof(record) !== 'object') return record;
827
+ if (cache.has(record)) return cache.get(record);
828
+ var nextRecord = _objectSpread({}, record);
829
+ cache.set(record, nextRecord);
830
+ if (Array.isArray(record.atoms)) {
831
+ nextRecord.atoms = _normalizeAndOrStructureInner(record.atoms, cache);
832
+ }
833
+ return nextRecord;
834
+ });
835
+ }
836
+ return _nextItem0;
837
+ }
838
+ if (item.type === TypeEnum.sort) {
839
+ var _nextItem1 = _objectSpread({}, item);
840
+ cache.set(item, _nextItem1);
841
+ if (Array.isArray(item.sort)) {
842
+ _nextItem1.sort = item.sort.map(function (record) {
843
+ if (!record || _typeof(record) !== 'object') return record;
844
+ if (cache.has(record)) return cache.get(record);
845
+ var nextRecord = _objectSpread({}, record);
846
+ cache.set(record, nextRecord);
847
+ if (Array.isArray(record.expression)) {
848
+ nextRecord.expression = _normalizeAndOrStructureInner(record.expression, cache);
849
+ }
850
+ return nextRecord;
851
+ });
852
+ }
853
+ return _nextItem1;
854
+ }
855
+ if (item.type === TypeEnum.union) {
856
+ var _nextItem10 = _objectSpread({}, item);
857
+ cache.set(item, _nextItem10);
858
+ if (Array.isArray(item.subquery)) {
859
+ _nextItem10.subquery = _normalizeAndOrStructureInner(item.subquery, cache);
860
+ }
861
+ return _nextItem10;
862
+ }
863
+ cache.set(item, item);
864
+ return item;
865
+ };
866
+ export var normalizeAndOrStructure = function normalizeAndOrStructure(data) {
867
+ return _normalizeAndOrStructureInner(data, new WeakMap());
631
868
  };
632
869
  var buildCaseWhenQuotes = function buildCaseWhenQuotes(item) {
633
870
  var caseAtomsText = (item.caseAtoms || []).map(_getAtomDisplayText).join(' ');
@@ -734,23 +971,23 @@ var syncAtomQuotes = function syncAtomQuotes(item) {
734
971
  });
735
972
  }
736
973
  if (item.type === AtomsTypeEnum.FORMULA) {
737
- var _nextItem = _objectSpread(_objectSpread({}, item), {}, {
974
+ var _nextItem11 = _objectSpread(_objectSpread({}, item), {}, {
738
975
  args: syncAtomQuotesList(item.args || [])
739
976
  });
740
- return _objectSpread(_objectSpread({}, _nextItem), {}, {
741
- quotes: buildFormulaQuotes(_nextItem)
977
+ return _objectSpread(_objectSpread({}, _nextItem11), {}, {
978
+ quotes: buildFormulaQuotes(_nextItem11)
742
979
  });
743
980
  }
744
981
  if (item.type === AtomsTypeEnum.COLLECTION) {
745
- var _nextItem2 = _objectSpread(_objectSpread({}, item), {}, {
982
+ var _nextItem12 = _objectSpread(_objectSpread({}, item), {}, {
746
983
  list: syncAtomQuotesList(item.list || [])
747
984
  });
748
- return _objectSpread(_objectSpread({}, _nextItem2), {}, {
749
- quotes: (_nextItem2.list || []).map(_getAtomDisplayText).join(' ')
985
+ return _objectSpread(_objectSpread({}, _nextItem12), {}, {
986
+ quotes: (_nextItem12.list || []).map(_getAtomDisplayText).join(' ')
750
987
  });
751
988
  }
752
989
  if (item.type === AtomsTypeEnum.CASE_WHEN) {
753
- var _nextItem3 = _objectSpread(_objectSpread({}, item), {}, {
990
+ var _nextItem13 = _objectSpread(_objectSpread({}, item), {}, {
754
991
  caseAtoms: syncAtomQuotesList(item.caseAtoms || []),
755
992
  whenClauses: (item.whenClauses || []).map(function (clause) {
756
993
  return _objectSpread(_objectSpread({}, clause), {}, {
@@ -760,21 +997,20 @@ var syncAtomQuotes = function syncAtomQuotes(item) {
760
997
  }),
761
998
  elseAtoms: syncAtomQuotesList(item.elseAtoms || [])
762
999
  });
763
- return _objectSpread(_objectSpread({}, _nextItem3), {}, {
764
- quotes: buildCaseWhenQuotes(_nextItem3)
1000
+ return _objectSpread(_objectSpread({}, _nextItem13), {}, {
1001
+ quotes: buildCaseWhenQuotes(_nextItem13)
765
1002
  });
766
1003
  }
767
1004
  if (item.type === AtomsTypeEnum.AND_OR) {
768
- var hasBinarySides = Array.isArray(item.leftAtoms) || Array.isArray(item.rightAtoms);
769
- var _nextItem4 = _objectSpread(_objectSpread({}, item), hasBinarySides ? {
770
- atoms: undefined,
771
- leftAtoms: syncAtomQuotesList(item.leftAtoms || []),
772
- rightAtoms: syncAtomQuotesList(item.rightAtoms || [])
773
- } : {
774
- atoms: syncAtomQuotesList(item.atoms || [])
775
- });
776
- return _objectSpread(_objectSpread({}, _nextItem4), {}, {
777
- quotes: buildAndOrQuotes(_nextItem4)
1005
+ var _nextItem14 = syncAndOrBinaryFields(_objectSpread(_objectSpread({}, item), {}, {
1006
+ items: normalizeAndOrItems(item).map(function (logicItem) {
1007
+ return _objectSpread(_objectSpread({}, logicItem), {}, {
1008
+ atoms: syncAtomQuotesList(logicItem.atoms || [])
1009
+ });
1010
+ })
1011
+ }));
1012
+ return _objectSpread(_objectSpread({}, _nextItem14), {}, {
1013
+ quotes: buildAndOrQuotes(_nextItem14)
778
1014
  });
779
1015
  }
780
1016
  return item;
@@ -893,14 +1129,13 @@ var _changeAlias = function changeAlias(items, val, type) {
893
1129
  elseAtoms: _changeAlias(v.elseAtoms || [], val, type)
894
1130
  });
895
1131
  } else if (v.type === AtomsTypeEnum.AND_OR) {
896
- var hasBinarySides = Array.isArray(v.leftAtoms) || Array.isArray(v.rightAtoms);
897
- nextItem = _objectSpread(_objectSpread({}, v), hasBinarySides ? {
898
- atoms: undefined,
899
- leftAtoms: _changeAlias(v.leftAtoms || [], val, type),
900
- rightAtoms: _changeAlias(v.rightAtoms || [], val, type)
901
- } : {
902
- atoms: _changeAlias(v.atoms || [], val, type)
903
- });
1132
+ nextItem = syncAndOrBinaryFields(_objectSpread(_objectSpread({}, v), {}, {
1133
+ items: normalizeAndOrItems(v).map(function (logicItem) {
1134
+ return _objectSpread(_objectSpread({}, logicItem), {}, {
1135
+ atoms: _changeAlias(logicItem.atoms || [], val, type)
1136
+ });
1137
+ })
1138
+ }));
904
1139
  } else {
905
1140
  nextItem = v;
906
1141
  }
@@ -1105,7 +1340,7 @@ export function splitByUnion(data) {
1105
1340
  i++;
1106
1341
  } else if (item.type === 'union') {
1107
1342
  var list = item.list,
1108
- otehr = _objectWithoutProperties(item, _excluded);
1343
+ otehr = _objectWithoutProperties(item, _excluded4);
1109
1344
  var nextItem = original[i + 1];
1110
1345
  if (nextItem && nextItem.type === 'group') {
1111
1346
  result.push(_objectSpread(_objectSpread({}, otehr), {}, {
@@ -1176,7 +1411,7 @@ var normalizeSummarizeByForSave = function normalizeSummarizeByForSave(record) {
1176
1411
  };
1177
1412
  var _normalizeLegacySummarizeForSave = function normalizeLegacySummarizeForSave() {
1178
1413
  var metas = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
1179
- return metas.map(function (meta) {
1414
+ var normalizedMetas = metas.map(function (meta) {
1180
1415
  if (meta.type === TypeEnum.summarize) {
1181
1416
  return _objectSpread(_objectSpread({}, meta), {}, {
1182
1417
  group: meta.group.map(function (item) {
@@ -1194,6 +1429,7 @@ var _normalizeLegacySummarizeForSave = function normalizeLegacySummarizeForSave(
1194
1429
  }
1195
1430
  return meta;
1196
1431
  });
1432
+ return normalizeAndOrStructure(normalizedMetas);
1197
1433
  };
1198
1434
  export { _normalizeLegacySummarizeForSave as normalizeLegacySummarizeForSave };
1199
1435
  export var getObjTem = function getObjTem(arr) {
@@ -1497,14 +1733,13 @@ var _changeCopyField = function changeCopyField(items, data) {
1497
1733
  v.args = _changeCopyField(v.args, data);
1498
1734
  return v;
1499
1735
  } else if (v.type === AtomsTypeEnum.AND_OR) {
1500
- var hasBinarySides = Array.isArray(v.leftAtoms) || Array.isArray(v.rightAtoms);
1501
- return _objectSpread(_objectSpread({}, v), hasBinarySides ? {
1502
- atoms: undefined,
1503
- leftAtoms: _changeCopyField(v.leftAtoms || [], data),
1504
- rightAtoms: _changeCopyField(v.rightAtoms || [], data)
1505
- } : {
1506
- atoms: _changeCopyField(v.atoms || [], data)
1507
- });
1736
+ return syncAndOrBinaryFields(_objectSpread(_objectSpread({}, v), {}, {
1737
+ items: normalizeAndOrItems(v).map(function (logicItem) {
1738
+ return _objectSpread(_objectSpread({}, logicItem), {}, {
1739
+ atoms: _changeCopyField(logicItem.atoms || [], data)
1740
+ });
1741
+ })
1742
+ }));
1508
1743
  } else if (v.type === AtomsTypeEnum.COLLECTION) {
1509
1744
  v.list = _changeCopyField(v.list, data);
1510
1745
  return v;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gingkoo/pandora-metabase",
3
- "version": "1.0.140",
3
+ "version": "1.0.141-alpha.4",
4
4
  "description": "",
5
5
  "main": "lib/es/index.js",
6
6
  "module": "lib/es/index.js",