@fibery/views 14.0.1 → 15.0.1

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 (2) hide show
  1. package/lib/views.js +14 -1
  2. package/package.json +4 -4
package/lib/views.js CHANGED
@@ -1338,6 +1338,7 @@ const visitView = (view, visitor) => immutableUpdate__default["default"](view, {
1338
1338
  const removedItemsIndexes = items.map((item, index) => visitor.visitQueryExpression(item.query) ? null : index).filter(value => value !== null);
1339
1339
  return items.map(item => {
1340
1340
  const fromType = ___default["default"].get(item, ["query", "q/from"]);
1341
+ const hasGroupingExpression = ___default["default"].has(item, ["groupingExpression"]);
1341
1342
  return fromType ? immutableUpdate__default["default"](item, {
1342
1343
  yExpression: {
1343
1344
  $apply: yExpression => yExpression ? visitor.visitExpression(fromType, yExpression) : yExpression
@@ -1388,7 +1389,19 @@ const visitView = (view, visitor) => immutableUpdate__default["default"](view, {
1388
1389
  const removedItemsBeforeTargetLengths = groupByIndexes.map(groupByIndex => removedItemsIndexes.filter(n => n < groupByIndex).length);
1389
1390
  return visitor.visitGroupByExpression(groupBy, fromType, removedItemsBeforeTargetLengths);
1390
1391
  }
1391
- }
1392
+ },
1393
+ ...(hasGroupingExpression ? {
1394
+ groupingExpression: {
1395
+ $apply: groupingExpression => {
1396
+ if (!groupingExpression) {
1397
+ return null;
1398
+ }
1399
+ const groupingExpressionIndexes = Object.keys(groupingExpression).map(key => parseInt(key));
1400
+ const removedItemsBeforeTargetLengths = groupingExpressionIndexes.map(groupByIndex => removedItemsIndexes.filter(n => n < groupByIndex).length);
1401
+ return visitor.visitGroupByExpression(groupingExpression, fromType, removedItemsBeforeTargetLengths);
1402
+ }
1403
+ }
1404
+ } : undefined)
1392
1405
  }) : item;
1393
1406
  }).filter(item => {
1394
1407
  const {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fibery/views",
3
- "version": "14.0.1",
3
+ "version": "15.0.1",
4
4
  "description": "Operations on view objects",
5
5
  "license": "UNLICENSED",
6
6
  "author": "Fibery",
@@ -20,11 +20,11 @@
20
20
  "microbundle": "0.15.1",
21
21
  "@fibery/babel-preset": "7.4.0",
22
22
  "@fibery/eslint-config": "8.6.1",
23
- "@fibery/schema": "10.2.8",
24
- "@fibery/expression-utils": "9.2.1"
23
+ "@fibery/expression-utils": "9.3.0",
24
+ "@fibery/schema": "10.2.8"
25
25
  },
26
26
  "peerDependencies": {
27
- "@fibery/expression-utils": "^9.2.1",
27
+ "@fibery/expression-utils": "^9.3.0",
28
28
  "@fibery/schema": "^10.2.8",
29
29
  "immutability-helper": "^2.4.0",
30
30
  "lodash": "^4.17.21"