@fibery/views 10.2.0 → 10.4.0
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/views.js +24 -22
- package/package.json +3 -3
package/lib/views.js
CHANGED
|
@@ -153,23 +153,17 @@ const migrateUnit = (schema, fromType, unit, units) => {
|
|
|
153
153
|
type,
|
|
154
154
|
expression
|
|
155
155
|
} = unit;
|
|
156
|
-
if (type === "date") {
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
type: "date-time"
|
|
162
|
-
};
|
|
163
|
-
}
|
|
156
|
+
if (type === "date-time") {
|
|
157
|
+
return {
|
|
158
|
+
...unit,
|
|
159
|
+
type: "date"
|
|
160
|
+
};
|
|
164
161
|
}
|
|
165
|
-
if (type === "date-range") {
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
type: "date-time-range"
|
|
171
|
-
};
|
|
172
|
-
}
|
|
162
|
+
if (type === "date-time-range") {
|
|
163
|
+
return {
|
|
164
|
+
...unit,
|
|
165
|
+
type: "date-range"
|
|
166
|
+
};
|
|
173
167
|
}
|
|
174
168
|
if (type === "text") {
|
|
175
169
|
const [field] = expression;
|
|
@@ -863,7 +857,7 @@ const visitSmartFolder = (smartFolder, visitor) => immutableUpdate__default["def
|
|
|
863
857
|
$apply: (items = []) => {
|
|
864
858
|
const isOldSmartFolder = !items.every(item => item.hasOwnProperty("groupBy"));
|
|
865
859
|
const removedItemsIndexes = items.map((item, index) => visitor.visitQueryExpression(item.query) ? null : index).filter(value => value !== null);
|
|
866
|
-
return items.map(
|
|
860
|
+
return items.map(item => {
|
|
867
861
|
if (isOldSmartFolder) {
|
|
868
862
|
return item;
|
|
869
863
|
}
|
|
@@ -871,12 +865,16 @@ const visitSmartFolder = (smartFolder, visitor) => immutableUpdate__default["def
|
|
|
871
865
|
return fromType ? immutableUpdate__default["default"](item, {
|
|
872
866
|
groupBy: {
|
|
873
867
|
$apply: groupBy => {
|
|
874
|
-
|
|
875
|
-
|
|
868
|
+
if (!groupBy) {
|
|
869
|
+
return null;
|
|
870
|
+
}
|
|
871
|
+
const groupByIndex = parseInt(Object.keys(groupBy)[0]);
|
|
872
|
+
const removedItemsBeforeTarget = removedItemsIndexes.filter(n => n < groupByIndex);
|
|
873
|
+
return visitor.visitGroupByExpression(groupBy, fromType, removedItemsBeforeTarget.length);
|
|
876
874
|
}
|
|
877
875
|
}
|
|
878
876
|
}) : item;
|
|
879
|
-
}).map(
|
|
877
|
+
}).map(item => {
|
|
880
878
|
if (isOldSmartFolder) {
|
|
881
879
|
return item;
|
|
882
880
|
}
|
|
@@ -884,8 +882,12 @@ const visitSmartFolder = (smartFolder, visitor) => immutableUpdate__default["def
|
|
|
884
882
|
return fromType ? immutableUpdate__default["default"](item, {
|
|
885
883
|
groupingExpression: {
|
|
886
884
|
$apply: groupingExpression => {
|
|
887
|
-
|
|
888
|
-
|
|
885
|
+
if (!groupingExpression) {
|
|
886
|
+
return null;
|
|
887
|
+
}
|
|
888
|
+
const groupingExpressionIndex = parseInt(Object.keys(groupingExpression)[0]);
|
|
889
|
+
const removedItemsBeforeTarget = removedItemsIndexes.filter(n => n < groupingExpressionIndex);
|
|
890
|
+
return visitor.visitGroupByExpression(groupingExpression, fromType, removedItemsBeforeTarget.length);
|
|
889
891
|
}
|
|
890
892
|
}
|
|
891
893
|
}) : item;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fibery/views",
|
|
3
|
-
"version": "10.
|
|
3
|
+
"version": "10.4.0",
|
|
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.0",
|
|
23
|
-
"@fibery/expression-utils": "9.0.
|
|
23
|
+
"@fibery/expression-utils": "9.0.5",
|
|
24
24
|
"@fibery/schema": "10.2.1"
|
|
25
25
|
},
|
|
26
26
|
"peerDependencies": {
|
|
27
|
-
"@fibery/expression-utils": "^9.0.
|
|
27
|
+
"@fibery/expression-utils": "^9.0.5",
|
|
28
28
|
"@fibery/schema": "^10.2.1",
|
|
29
29
|
"immutability-helper": "^2.4.0",
|
|
30
30
|
"lodash": "^4.17.21"
|