@fibery/views 10.6.0 → 10.7.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 +249 -90
- package/package.json +4 -4
package/lib/views.js
CHANGED
|
@@ -11,6 +11,37 @@ var ___default = /*#__PURE__*/_interopDefaultLegacy(_);
|
|
|
11
11
|
// Return this symbol from a visitor callback to remove the node from the
|
|
12
12
|
// output. Not supported in all places, add support as needed.
|
|
13
13
|
const REMOVE = Symbol("remove");
|
|
14
|
+
function visitDeleteExpressionInFilterGroup(filter, visitExpression) {
|
|
15
|
+
if (filter.kind !== "group") {
|
|
16
|
+
return null;
|
|
17
|
+
}
|
|
18
|
+
const value = filter.value.map(nestedFilter => {
|
|
19
|
+
if (nestedFilter.kind === "group") {
|
|
20
|
+
return visitFilterGroup(nestedFilter, visitExpression);
|
|
21
|
+
}
|
|
22
|
+
const expression = visitExpression(nestedFilter.value.expression);
|
|
23
|
+
if (!expression) {
|
|
24
|
+
return null;
|
|
25
|
+
}
|
|
26
|
+
return {
|
|
27
|
+
...nestedFilter,
|
|
28
|
+
value: {
|
|
29
|
+
...nestedFilter.value,
|
|
30
|
+
expression: expression
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
}).filter(Boolean);
|
|
34
|
+
if (value.length === 0) {
|
|
35
|
+
return null;
|
|
36
|
+
}
|
|
37
|
+
return {
|
|
38
|
+
...filter,
|
|
39
|
+
value: value
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
const deleteExpressionWithNotFoundFieldsOrTypesInFilter = (schema, fromType, filter) => {
|
|
43
|
+
return visitDeleteExpressionInFilterGroup(filter, expression => deleteExpressionWithNotFoundFieldsOrTypesInExpression(schema, fromType, expression));
|
|
44
|
+
};
|
|
14
45
|
const deleteExpressionWithNotFoundFieldsOrTypesInQueryExpression = (schema, queryExpression) => {
|
|
15
46
|
const {
|
|
16
47
|
"q/from": fromExpression,
|
|
@@ -86,6 +117,40 @@ const replaceIdsWithNamesInQueryExpression = (schema, queryExpression) => {
|
|
|
86
117
|
}
|
|
87
118
|
return queryExpression;
|
|
88
119
|
};
|
|
120
|
+
function visitFilterGroup(filter, visitExpression, type) {
|
|
121
|
+
if (filter.kind !== "group") {
|
|
122
|
+
return null;
|
|
123
|
+
}
|
|
124
|
+
return {
|
|
125
|
+
...filter,
|
|
126
|
+
value: filter.value.map(nestedFilter => {
|
|
127
|
+
if (nestedFilter.kind === "group") {
|
|
128
|
+
return visitFilterGroup(nestedFilter, visitExpression);
|
|
129
|
+
}
|
|
130
|
+
return {
|
|
131
|
+
...nestedFilter,
|
|
132
|
+
value: {
|
|
133
|
+
...nestedFilter.value,
|
|
134
|
+
expression: visitExpression(nestedFilter.value.expression)
|
|
135
|
+
}
|
|
136
|
+
};
|
|
137
|
+
})
|
|
138
|
+
};
|
|
139
|
+
}
|
|
140
|
+
const replaceIdsWithNamesInFilter = (schema, fromType, filter) => {
|
|
141
|
+
if (schema.typeObjectsById.hasOwnProperty(fromType)) {
|
|
142
|
+
const typeObject = schema.typeObjectsById[fromType];
|
|
143
|
+
return filter ? visitFilterGroup(filter, expression => visitors.replaceIdsWithNamesVisitor(typeObject).visitExpression(expression)) : null;
|
|
144
|
+
}
|
|
145
|
+
return filter;
|
|
146
|
+
};
|
|
147
|
+
const replaceNamesWithIdsInFilter = (schema, fromType, filter) => {
|
|
148
|
+
if (schema.typeObjectsByName.hasOwnProperty(fromType)) {
|
|
149
|
+
const typeObject = schema.typeObjectsByName[fromType];
|
|
150
|
+
return filter ? visitFilterGroup(filter, expression => visitors.replaceNamesWithIdsVisitor(typeObject).visitExpression(expression)) : null;
|
|
151
|
+
}
|
|
152
|
+
return filter;
|
|
153
|
+
};
|
|
89
154
|
const replaceNamesWithIdsInQueryExpression = (schema, queryExpression) => {
|
|
90
155
|
const {
|
|
91
156
|
"q/from": fromExpression,
|
|
@@ -126,6 +191,63 @@ const isUnitExpressionValid = unit => {
|
|
|
126
191
|
}
|
|
127
192
|
return true;
|
|
128
193
|
};
|
|
194
|
+
const getFieldObjectsById = (smartFolder, schema) => {
|
|
195
|
+
const types = smartFolder["fibery/meta"].items.map(item => item.query["q/from"]);
|
|
196
|
+
return types.reduce((acc, type) => {
|
|
197
|
+
if (!(type in schema.typeObjectsById)) {
|
|
198
|
+
return acc;
|
|
199
|
+
}
|
|
200
|
+
const fieldObjects = schema.typeObjectsById[type].fieldObjectsById;
|
|
201
|
+
return {
|
|
202
|
+
...acc,
|
|
203
|
+
...fieldObjects
|
|
204
|
+
};
|
|
205
|
+
}, {});
|
|
206
|
+
};
|
|
207
|
+
const replaceIdsWithNamesInUnitGroupKey = (unitGroupKey, fieldObjectsById) => {
|
|
208
|
+
const keyParts = unitGroupKey.split("|");
|
|
209
|
+
return keyParts.map(keyPart => {
|
|
210
|
+
const [unitType, ...rest] = keyPart.split("_");
|
|
211
|
+
if (unitType === "user-button") {
|
|
212
|
+
return keyPart;
|
|
213
|
+
}
|
|
214
|
+
const fieldId = rest.join("_");
|
|
215
|
+
if (!fieldId) {
|
|
216
|
+
return keyPart;
|
|
217
|
+
}
|
|
218
|
+
const fieldObject = fieldObjectsById[fieldId];
|
|
219
|
+
if (!fieldObject) {
|
|
220
|
+
return keyPart;
|
|
221
|
+
}
|
|
222
|
+
return `${unitType}_${fieldObject.holderType}:${fieldObject.name}`;
|
|
223
|
+
}).filter(Boolean).join("|");
|
|
224
|
+
};
|
|
225
|
+
const replaceNamesWithIdsInUnitGroupKey = (unitGroupKey, schema) => {
|
|
226
|
+
const keyParts = unitGroupKey.split("|");
|
|
227
|
+
return keyParts.map(keyPart => {
|
|
228
|
+
const [unitType, ...rest] = keyPart.split("_");
|
|
229
|
+
if (unitType === "user-button") {
|
|
230
|
+
return keyPart;
|
|
231
|
+
}
|
|
232
|
+
const name = rest.join("_");
|
|
233
|
+
if (!name) {
|
|
234
|
+
return keyPart;
|
|
235
|
+
}
|
|
236
|
+
const [type, field] = name.split(":");
|
|
237
|
+
if (!field) {
|
|
238
|
+
return keyPart;
|
|
239
|
+
}
|
|
240
|
+
if (!(type in schema.typeObjectsByName)) {
|
|
241
|
+
return keyPart;
|
|
242
|
+
}
|
|
243
|
+
const typeObject = schema.typeObjectsByName[type];
|
|
244
|
+
if (!(field in typeObject.fieldObjectsByName)) {
|
|
245
|
+
return keyPart;
|
|
246
|
+
}
|
|
247
|
+
const fieldObject = typeObject.fieldObjectsByName[field];
|
|
248
|
+
return `${unitType}_${fieldObject.id}`;
|
|
249
|
+
}).filter(Boolean).join("|");
|
|
250
|
+
};
|
|
129
251
|
|
|
130
252
|
const getField = (schema, fromType, field) => Object.hasOwn(schema.typeObjectsByName, fromType) && Object.hasOwn(schema.typeObjectsByName[fromType].fieldObjectsByName, field) ? schema.typeObjectsByName[fromType].fieldObjectsByName[field] : undefined;
|
|
131
253
|
const getFieldType = (schema, fromType, field) => {
|
|
@@ -251,18 +373,32 @@ const enableHideWhenEmptyForCheckedEditableUnit = unit => {
|
|
|
251
373
|
const visitQueryExpressionHolder = (queryHolder, visitor) => {
|
|
252
374
|
if (queryHolder) {
|
|
253
375
|
const {
|
|
254
|
-
query
|
|
376
|
+
query,
|
|
377
|
+
filter
|
|
255
378
|
} = queryHolder;
|
|
379
|
+
const newQueryHolder = {
|
|
380
|
+
...queryHolder
|
|
381
|
+
};
|
|
256
382
|
if (query) {
|
|
257
383
|
const queryNew = visitor.visitQueryExpression(query);
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
384
|
+
if (queryNew) {
|
|
385
|
+
newQueryHolder.query = queryNew;
|
|
386
|
+
} else {
|
|
387
|
+
return null;
|
|
388
|
+
}
|
|
389
|
+
const {
|
|
390
|
+
"q/from": fromType
|
|
391
|
+
} = query;
|
|
392
|
+
if (filter && fromType) {
|
|
393
|
+
const filterNew = visitor.visitFilter(fromType, filter);
|
|
394
|
+
if (filterNew) {
|
|
395
|
+
newQueryHolder.filter = filterNew;
|
|
396
|
+
} else {
|
|
397
|
+
newQueryHolder.filter = null;
|
|
262
398
|
}
|
|
263
|
-
}
|
|
399
|
+
}
|
|
264
400
|
}
|
|
265
|
-
return
|
|
401
|
+
return newQueryHolder;
|
|
266
402
|
}
|
|
267
403
|
return queryHolder;
|
|
268
404
|
};
|
|
@@ -376,6 +512,9 @@ const visitView$5 = (view, visitor) => immutableUpdate__default["default"](view,
|
|
|
376
512
|
query: {
|
|
377
513
|
$apply: query => query ? visitor.visitQueryExpression(query) : null
|
|
378
514
|
},
|
|
515
|
+
filter: {
|
|
516
|
+
$apply: filter => filter ? visitor.visitFilter(fromType, filter) : null
|
|
517
|
+
},
|
|
379
518
|
units: {
|
|
380
519
|
$apply: units => units ? units.filter(unit => Boolean(unit)).map(unit => visitViewUnit(fromType, unit, visitor)).filter(unit => isUnitExpressionValid(unit)).map((unit, idx, units) => visitor.visitViewUnit ? visitor.visitViewUnit(fromType, unit, units) : unit).filter(unit => unit !== REMOVE) : undefined
|
|
381
520
|
},
|
|
@@ -400,6 +539,7 @@ const visitView$5 = (view, visitor) => immutableUpdate__default["default"](view,
|
|
|
400
539
|
const replaceNamesWithIdsViewVisitor = schema => {
|
|
401
540
|
const visitor = {
|
|
402
541
|
visitQueryExpression: queryExpression => replaceNamesWithIdsInQueryExpression(schema, queryExpression),
|
|
542
|
+
visitFilter: (fromType, filter) => replaceNamesWithIdsInFilter(schema, fromType, filter),
|
|
403
543
|
visitExpression: (fromType, expression) => replaceNamesWithIdsInExpression(schema, fromType, expression),
|
|
404
544
|
visitEnums: enums => ___default["default"].entries(enums).reduce((result, [type, queryHolder]) => {
|
|
405
545
|
if (schema.typeObjectsByName.hasOwnProperty(type)) {
|
|
@@ -418,6 +558,10 @@ const replaceNamesWithIdsViewVisitor = schema => {
|
|
|
418
558
|
const replaceIdsWithNamesViewVisitor = schema => {
|
|
419
559
|
const visitor = {
|
|
420
560
|
visitQueryExpression: queryExpression => replaceIdsWithNamesInQueryExpression(schema, queryExpression),
|
|
561
|
+
visitFilter: (fromType, filter) => {
|
|
562
|
+
const replaceIdsWithNamesInFilter1 = replaceIdsWithNamesInFilter(schema, fromType, filter);
|
|
563
|
+
return replaceIdsWithNamesInFilter1;
|
|
564
|
+
},
|
|
421
565
|
visitExpression: (fromType, expression) => replaceIdsWithNamesInExpression(schema, fromType, expression),
|
|
422
566
|
visitEnums: enums => ___default["default"].entries(enums).reduce((result, [typeId, queryHolder]) => {
|
|
423
567
|
if (schema.typeObjectsById.hasOwnProperty(typeId)) {
|
|
@@ -436,6 +580,7 @@ const replaceIdsWithNamesViewVisitor = schema => {
|
|
|
436
580
|
const deleteExpressionWithNotFoundFieldsOrTypesViewVisitor = schema => {
|
|
437
581
|
const visitor = {
|
|
438
582
|
visitQueryExpression: queryExpression => deleteExpressionWithNotFoundFieldsOrTypesInQueryExpression(schema, queryExpression),
|
|
583
|
+
visitFilter: (fromType, filter) => deleteExpressionWithNotFoundFieldsOrTypesInFilter(schema, fromType, filter),
|
|
439
584
|
visitExpression: (fromType, expression) => deleteExpressionWithNotFoundFieldsOrTypesInExpression(schema, fromType, expression),
|
|
440
585
|
visitEnums: enums => {
|
|
441
586
|
const enumsNew = ___default["default"].entries(enums).reduce((result, [type, queryHolder]) => {
|
|
@@ -460,7 +605,8 @@ const fixUserSelectedUnitsViewVisitor = (schema, {
|
|
|
460
605
|
}) => {
|
|
461
606
|
return {
|
|
462
607
|
visitQueryExpression: queryExpression => queryExpression,
|
|
463
|
-
|
|
608
|
+
visitFilter: (_fromType, filter) => filter,
|
|
609
|
+
visitExpression: (_fromType, expression) => expression,
|
|
464
610
|
visitEnums: enums => enums,
|
|
465
611
|
visitViewUnit: (fromType, unit, units) => fixViewUnit(schema, fromType, unit, units, {
|
|
466
612
|
unitDefinitions,
|
|
@@ -485,13 +631,15 @@ const fixUserSelectedUnitsInBoardView = (schema, view, {
|
|
|
485
631
|
};
|
|
486
632
|
const fixContextExpressionWithBrokenPath$7 = (schema, view, defaultContextExpression) => visitView$5(view, {
|
|
487
633
|
visitQueryExpression: query => query,
|
|
488
|
-
|
|
634
|
+
visitFilter: (_fromType, filter) => filter,
|
|
635
|
+
visitExpression: (_fromType, expression) => expression,
|
|
489
636
|
visitEnums: enums => enums,
|
|
490
637
|
visitContextExpression: (fromType, expression) => resetContextExpressionIfBroken(schema, fromType, expression, defaultContextExpression)
|
|
491
638
|
});
|
|
492
639
|
const collectGarbage$7 = view => {
|
|
493
640
|
return visitView$5(view, {
|
|
494
641
|
visitQueryExpression: queryExpression => queryExpression,
|
|
642
|
+
visitFilter: (_fromType, filter) => filter,
|
|
495
643
|
visitExpression: (fromType, expression) => expression,
|
|
496
644
|
visitEnums: enums => enums,
|
|
497
645
|
visitViewUnit: (fromType, unit) => unit.checked ? unit : REMOVE
|
|
@@ -516,6 +664,7 @@ const enableHideWhenEmptyForCovers = view => {
|
|
|
516
664
|
};
|
|
517
665
|
const enableHideWhenEmptyForCheckedEditableUnits$1 = view => {
|
|
518
666
|
return visitView$5(view, {
|
|
667
|
+
visitFilter: (_fromType, filter) => filter,
|
|
519
668
|
visitQueryExpression: queryExpression => queryExpression,
|
|
520
669
|
visitGroupByExpression: groupBy => groupBy,
|
|
521
670
|
visitExpression: (fromType, expression) => expression,
|
|
@@ -542,6 +691,9 @@ const visitView$4 = (view, visitor) => immutableUpdate__default["default"](view,
|
|
|
542
691
|
query: {
|
|
543
692
|
$apply: query => query ? visitor.visitQueryExpression(query) : null
|
|
544
693
|
},
|
|
694
|
+
filter: {
|
|
695
|
+
$apply: filter => filter ? visitor.visitFilter(fromType, filter) : null
|
|
696
|
+
},
|
|
545
697
|
units: {
|
|
546
698
|
$apply: units => units ? units.filter(unit => Boolean(unit)).map(unit => visitViewUnit(fromType, unit, visitor)).filter(unit => isUnitExpressionValid(unit)).map((unit, idx, units) => visitor.visitViewUnit ? visitor.visitViewUnit(fromType, unit, units) : unit).filter(unit => unit !== REMOVE) : undefined
|
|
547
699
|
},
|
|
@@ -566,17 +718,20 @@ const visitView$4 = (view, visitor) => immutableUpdate__default["default"](view,
|
|
|
566
718
|
const replaceNamesWithIdsInCalendarView = (schema, view) => {
|
|
567
719
|
return visitView$4(view, {
|
|
568
720
|
visitExpression: (fromType, expression) => replaceNamesWithIdsInExpression(schema, fromType, expression),
|
|
721
|
+
visitFilter: (fromType, expression) => replaceNamesWithIdsInFilter(schema, fromType, expression),
|
|
569
722
|
visitQueryExpression: query => replaceNamesWithIdsInQueryExpression(schema, query)
|
|
570
723
|
});
|
|
571
724
|
};
|
|
572
725
|
const replaceIdsWithNamesInCalendarView = (schema, view) => {
|
|
573
726
|
return visitView$4(view, {
|
|
574
727
|
visitExpression: (fromType, expression) => replaceIdsWithNamesInExpression(schema, fromType, expression),
|
|
728
|
+
visitFilter: (fromType, expression) => replaceIdsWithNamesInFilter(schema, fromType, expression),
|
|
575
729
|
visitQueryExpression: query => replaceIdsWithNamesInQueryExpression(schema, query)
|
|
576
730
|
});
|
|
577
731
|
};
|
|
578
732
|
const deleteExpressionWithNotFoundFieldsOrTypesInCalendarView = (schema, view) => visitView$4(view, {
|
|
579
733
|
visitQueryExpression: queryExpression => deleteExpressionWithNotFoundFieldsOrTypesInQueryExpression(schema, queryExpression),
|
|
734
|
+
visitFilter: (fromType, expression) => deleteExpressionWithNotFoundFieldsOrTypesInFilter(schema, fromType, expression),
|
|
580
735
|
visitExpression: (fromType, expression) => deleteExpressionWithNotFoundFieldsOrTypesInExpression(schema, fromType, expression)
|
|
581
736
|
});
|
|
582
737
|
const fixUserSelectedUnitsInCalendarView = (schema, view, {
|
|
@@ -584,7 +739,8 @@ const fixUserSelectedUnitsInCalendarView = (schema, view, {
|
|
|
584
739
|
getDefaultUnitTypeForField
|
|
585
740
|
}) => {
|
|
586
741
|
return visitView$4(view, {
|
|
587
|
-
visitExpression: (
|
|
742
|
+
visitExpression: (_fromType, expression) => expression,
|
|
743
|
+
visitFilter: (_fromType, filter) => filter,
|
|
588
744
|
visitQueryExpression: query => query,
|
|
589
745
|
visitViewUnit: (fromType, unit, units) => fixViewUnit(schema, fromType, unit, units, {
|
|
590
746
|
unitDefinitions,
|
|
@@ -594,12 +750,14 @@ const fixUserSelectedUnitsInCalendarView = (schema, view, {
|
|
|
594
750
|
};
|
|
595
751
|
const fixContextExpressionWithBrokenPath$6 = (schema, view, defaultContextExpression) => visitView$4(view, {
|
|
596
752
|
visitQueryExpression: query => query,
|
|
753
|
+
visitFilter: (_fromType, filter) => filter,
|
|
597
754
|
visitExpression: (fromType, expression) => expression,
|
|
598
755
|
visitContextExpression: (fromType, expression) => resetContextExpressionIfBroken(schema, fromType, expression, defaultContextExpression)
|
|
599
756
|
});
|
|
600
757
|
const collectGarbage$6 = view => {
|
|
601
758
|
return visitView$4(view, {
|
|
602
759
|
visitExpression: (fromType, expression) => expression,
|
|
760
|
+
visitFilter: (_fromType, filter) => filter,
|
|
603
761
|
visitQueryExpression: query => query,
|
|
604
762
|
visitViewUnit: (fromType, unit) => unit.checked ? unit : REMOVE
|
|
605
763
|
});
|
|
@@ -607,6 +765,7 @@ const collectGarbage$6 = view => {
|
|
|
607
765
|
const enableHideWhenEmptyForCheckedUnits$3 = view => {
|
|
608
766
|
return visitView$4(view, {
|
|
609
767
|
visitQueryExpression: queryExpression => queryExpression,
|
|
768
|
+
visitFilter: (_fromType, filter) => filter,
|
|
610
769
|
visitGroupByExpression: groupBy => groupBy,
|
|
611
770
|
visitExpression: (fromType, expression) => expression,
|
|
612
771
|
visitEnums: enums => enums,
|
|
@@ -629,6 +788,9 @@ const visitView$3 = (view, visitor) => immutableUpdate__default["default"](view,
|
|
|
629
788
|
query: {
|
|
630
789
|
$apply: query => query ? visitor.visitQueryExpression(query) : null
|
|
631
790
|
},
|
|
791
|
+
filter: {
|
|
792
|
+
$apply: filter => filter ? visitor.visitFilter(fromType, filter) : null
|
|
793
|
+
},
|
|
632
794
|
units: {
|
|
633
795
|
$apply: units => units ? units.filter(unit => Boolean(unit)).map(unit => visitViewUnit(fromType, unit, visitor)).filter(unit => isUnitExpressionValid(unit)).map((unit, idx, units) => visitor.visitViewUnit ? visitor.visitViewUnit(fromType, unit, units) : unit).filter(unit => unit !== REMOVE) : undefined
|
|
634
796
|
},
|
|
@@ -653,17 +815,20 @@ const visitView$3 = (view, visitor) => immutableUpdate__default["default"](view,
|
|
|
653
815
|
const replaceNamesWithIdsInFeedView = (schema, view) => {
|
|
654
816
|
return visitView$3(view, {
|
|
655
817
|
visitExpression: (fromType, expression) => replaceNamesWithIdsInExpression(schema, fromType, expression),
|
|
818
|
+
visitFilter: (fromType, expression) => replaceNamesWithIdsInFilter(schema, fromType, expression),
|
|
656
819
|
visitQueryExpression: query => replaceNamesWithIdsInQueryExpression(schema, query)
|
|
657
820
|
});
|
|
658
821
|
};
|
|
659
822
|
const replaceIdsWithNamesInFeedView = (schema, view) => {
|
|
660
823
|
return visitView$3(view, {
|
|
661
824
|
visitExpression: (fromType, expression) => replaceIdsWithNamesInExpression(schema, fromType, expression),
|
|
825
|
+
visitFilter: (fromType, expression) => replaceIdsWithNamesInFilter(schema, fromType, expression),
|
|
662
826
|
visitQueryExpression: query => replaceIdsWithNamesInQueryExpression(schema, query)
|
|
663
827
|
});
|
|
664
828
|
};
|
|
665
829
|
const deleteExpressionWithNotFoundFieldsOrTypesInFeedView = (schema, view) => visitView$3(view, {
|
|
666
830
|
visitQueryExpression: queryExpression => deleteExpressionWithNotFoundFieldsOrTypesInQueryExpression(schema, queryExpression),
|
|
831
|
+
visitFilter: (fromType, expression) => deleteExpressionWithNotFoundFieldsOrTypesInFilter(schema, fromType, expression),
|
|
667
832
|
visitExpression: (fromType, expression) => deleteExpressionWithNotFoundFieldsOrTypesInExpression(schema, fromType, expression)
|
|
668
833
|
});
|
|
669
834
|
const fixUserSelectedUnitsInFeedView = (schema, view, {
|
|
@@ -671,7 +836,8 @@ const fixUserSelectedUnitsInFeedView = (schema, view, {
|
|
|
671
836
|
getDefaultUnitTypeForField
|
|
672
837
|
}) => {
|
|
673
838
|
return visitView$3(view, {
|
|
674
|
-
visitExpression: (
|
|
839
|
+
visitExpression: (_fromType, expression) => expression,
|
|
840
|
+
visitFilter: (_fromType, filter) => filter,
|
|
675
841
|
visitQueryExpression: query => query,
|
|
676
842
|
visitViewUnit: (fromType, unit, units) => fixViewUnit(schema, fromType, unit, units, {
|
|
677
843
|
unitDefinitions,
|
|
@@ -681,12 +847,14 @@ const fixUserSelectedUnitsInFeedView = (schema, view, {
|
|
|
681
847
|
};
|
|
682
848
|
const fixContextExpressionWithBrokenPath$5 = (schema, view, defaultContextExpression) => visitView$3(view, {
|
|
683
849
|
visitQueryExpression: query => query,
|
|
684
|
-
|
|
850
|
+
visitFilter: (_fromType, filter) => filter,
|
|
851
|
+
visitExpression: (_fromType, expression) => expression,
|
|
685
852
|
visitContextExpression: (fromType, expression) => resetContextExpressionIfBroken(schema, fromType, expression, defaultContextExpression)
|
|
686
853
|
});
|
|
687
854
|
const collectGarbage$5 = view => {
|
|
688
855
|
return visitView$3(view, {
|
|
689
|
-
visitExpression: (
|
|
856
|
+
visitExpression: (_fromType, expression) => expression,
|
|
857
|
+
visitFilter: (_fromType, filter) => filter,
|
|
690
858
|
visitQueryExpression: query => query,
|
|
691
859
|
visitViewUnit: (fromType, unit) => unit.checked ? unit : REMOVE
|
|
692
860
|
});
|
|
@@ -695,9 +863,10 @@ const enableHideWhenEmptyForCheckedUnits$2 = view => {
|
|
|
695
863
|
return visitView$3(view, {
|
|
696
864
|
visitQueryExpression: queryExpression => queryExpression,
|
|
697
865
|
visitGroupByExpression: groupBy => groupBy,
|
|
698
|
-
|
|
866
|
+
visitFilter: (_fromType, filter) => filter,
|
|
867
|
+
visitExpression: (_fromType, expression) => expression,
|
|
699
868
|
visitEnums: enums => enums,
|
|
700
|
-
visitViewUnit: (
|
|
869
|
+
visitViewUnit: (_fromType, unit) => enableHideWhenEmptyForCheckedEditableUnit(unit)
|
|
701
870
|
});
|
|
702
871
|
};
|
|
703
872
|
|
|
@@ -779,6 +948,9 @@ const visitView$2 = (view, visitor) => immutableUpdate__default["default"](view,
|
|
|
779
948
|
query: {
|
|
780
949
|
$apply: query => query ? visitor.visitQueryExpression(query) : null
|
|
781
950
|
},
|
|
951
|
+
filter: {
|
|
952
|
+
$apply: filter => filter ? visitor.visitFilter(fromType, filter) : null
|
|
953
|
+
},
|
|
782
954
|
units: {
|
|
783
955
|
$apply: units => units ? units.filter(unit => Boolean(unit)).map(unit => visitViewUnit(fromType, unit, visitor)).filter(unit => isUnitExpressionValid(unit)).map((unit, idx, units) => visitor.visitViewUnit ? visitor.visitViewUnit(fromType, unit, units) : unit).filter(unit => unit !== REMOVE) : undefined
|
|
784
956
|
},
|
|
@@ -803,17 +975,20 @@ const visitView$2 = (view, visitor) => immutableUpdate__default["default"](view,
|
|
|
803
975
|
const replaceNamesWithIdsInMapView = (schema, view) => {
|
|
804
976
|
return visitView$2(view, {
|
|
805
977
|
visitQueryExpression: query => replaceNamesWithIdsInQueryExpression(schema, query),
|
|
978
|
+
visitFilter: (fromType, expression) => replaceNamesWithIdsInFilter(schema, fromType, expression),
|
|
806
979
|
visitExpression: (fromType, expression) => replaceNamesWithIdsInExpression(schema, fromType, expression)
|
|
807
980
|
});
|
|
808
981
|
};
|
|
809
982
|
const replaceIdsWithNamesInMapView = (schema, view) => {
|
|
810
983
|
return visitView$2(view, {
|
|
811
984
|
visitQueryExpression: query => replaceIdsWithNamesInQueryExpression(schema, query),
|
|
985
|
+
visitFilter: (fromType, expression) => replaceIdsWithNamesInFilter(schema, fromType, expression),
|
|
812
986
|
visitExpression: (fromType, expression) => replaceIdsWithNamesInExpression(schema, fromType, expression)
|
|
813
987
|
});
|
|
814
988
|
};
|
|
815
989
|
const deleteExpressionWithNotFoundFieldsOrTypesInMapView = (schema, view) => visitView$2(view, {
|
|
816
990
|
visitQueryExpression: queryExpression => deleteExpressionWithNotFoundFieldsOrTypesInQueryExpression(schema, queryExpression),
|
|
991
|
+
visitFilter: (fromType, expression) => deleteExpressionWithNotFoundFieldsOrTypesInFilter(schema, fromType, expression),
|
|
817
992
|
visitExpression: (fromType, expression) => deleteExpressionWithNotFoundFieldsOrTypesInExpression(schema, fromType, expression)
|
|
818
993
|
});
|
|
819
994
|
const fixUserSelectedUnitsInMapView = (schema, view, {
|
|
@@ -822,7 +997,8 @@ const fixUserSelectedUnitsInMapView = (schema, view, {
|
|
|
822
997
|
}) => {
|
|
823
998
|
return visitView$2(view, {
|
|
824
999
|
visitQueryExpression: query => query,
|
|
825
|
-
|
|
1000
|
+
visitFilter: (_fromType, filter) => filter,
|
|
1001
|
+
visitExpression: (_fromType, expression) => expression,
|
|
826
1002
|
visitViewUnit: (fromType, unit, units) => fixViewUnit(schema, fromType, unit, units, {
|
|
827
1003
|
unitDefinitions,
|
|
828
1004
|
getDefaultUnitTypeForField
|
|
@@ -830,24 +1006,27 @@ const fixUserSelectedUnitsInMapView = (schema, view, {
|
|
|
830
1006
|
});
|
|
831
1007
|
};
|
|
832
1008
|
const fixContextExpressionWithBrokenPath$4 = (schema, view, defaultContextExpression) => visitView$2(view, {
|
|
833
|
-
visitExpression: (
|
|
1009
|
+
visitExpression: (_fromType, expression) => expression,
|
|
834
1010
|
visitQueryExpression: query => query,
|
|
1011
|
+
visitFilter: (_fromType, filter) => filter,
|
|
835
1012
|
visitContextExpression: (fromType, expression) => resetContextExpressionIfBroken(schema, fromType, expression, defaultContextExpression)
|
|
836
1013
|
});
|
|
837
1014
|
const collectGarbage$4 = view => {
|
|
838
1015
|
return visitView$2(view, {
|
|
839
1016
|
visitQueryExpression: query => query,
|
|
840
|
-
|
|
841
|
-
|
|
1017
|
+
visitFilter: (_fromType, filter) => filter,
|
|
1018
|
+
visitExpression: (_fromType, expression) => expression,
|
|
1019
|
+
visitViewUnit: (_fromType, unit) => unit.checked ? unit : REMOVE
|
|
842
1020
|
});
|
|
843
1021
|
};
|
|
844
1022
|
const enableHideWhenEmptyForCheckedUnits$1 = view => {
|
|
845
1023
|
return visitView$2(view, {
|
|
846
1024
|
visitQueryExpression: queryExpression => queryExpression,
|
|
847
1025
|
visitGroupByExpression: groupBy => groupBy,
|
|
848
|
-
|
|
1026
|
+
visitFilter: (_fromType, filter) => filter,
|
|
1027
|
+
visitExpression: (_fromType, expression) => expression,
|
|
849
1028
|
visitEnums: enums => enums,
|
|
850
|
-
visitViewUnit: (
|
|
1029
|
+
visitViewUnit: (_fromType, unit) => enableHideWhenEmptyForCheckedEditableUnit(unit)
|
|
851
1030
|
});
|
|
852
1031
|
};
|
|
853
1032
|
|
|
@@ -894,6 +1073,9 @@ const visitSmartFolder = (smartFolder, visitor) => immutableUpdate__default["def
|
|
|
894
1073
|
}).map(item => {
|
|
895
1074
|
const fromType = ___default["default"].get(item, ["query", "q/from"]);
|
|
896
1075
|
return fromType ? immutableUpdate__default["default"](item, {
|
|
1076
|
+
filter: {
|
|
1077
|
+
$apply: filter => filter ? visitor.visitFilter(fromType, filter) : null
|
|
1078
|
+
},
|
|
897
1079
|
query: {
|
|
898
1080
|
$apply: query => {
|
|
899
1081
|
const visitedQuery = visitor.visitQueryExpression(query);
|
|
@@ -1010,78 +1192,29 @@ const replaceNamesWithIdsInGroupByExpression = (schema, groupByExpression, fromT
|
|
|
1010
1192
|
};
|
|
1011
1193
|
const replaceNamesWithIdsInSmartFolder = (schema, smartFolder) => visitSmartFolder(smartFolder, {
|
|
1012
1194
|
visitQueryExpression: query => replaceNamesWithIdsInQueryExpression(schema, query),
|
|
1195
|
+
visitFilter: (fromType, expression) => replaceNamesWithIdsInFilter(schema, fromType, expression),
|
|
1013
1196
|
visitGroupByExpression: (groupBy, fromType) => replaceNamesWithIdsInGroupByExpression(schema, groupBy, fromType, Object.keys(groupBy).map(() => 0)),
|
|
1014
1197
|
visitExpression: (fromType, expression) => replaceNamesWithIdsInExpression(schema, fromType, expression),
|
|
1015
|
-
visitUnitGroupKey: unitGroupKey =>
|
|
1016
|
-
const keyParts = unitGroupKey.split("|");
|
|
1017
|
-
return keyParts.map(keyPart => {
|
|
1018
|
-
const [unitType, ...rest] = keyPart.split("_");
|
|
1019
|
-
if (unitType === "user-button") {
|
|
1020
|
-
return keyPart;
|
|
1021
|
-
}
|
|
1022
|
-
const name = rest.join("_");
|
|
1023
|
-
if (!name) {
|
|
1024
|
-
return keyPart;
|
|
1025
|
-
}
|
|
1026
|
-
const [type, field] = name.split(":");
|
|
1027
|
-
if (!field) {
|
|
1028
|
-
return keyPart;
|
|
1029
|
-
}
|
|
1030
|
-
if (!(type in schema.typeObjectsByName)) {
|
|
1031
|
-
return keyPart;
|
|
1032
|
-
}
|
|
1033
|
-
const typeObject = schema.typeObjectsByName[type];
|
|
1034
|
-
if (!(field in typeObject.fieldObjectsByName)) {
|
|
1035
|
-
return keyPart;
|
|
1036
|
-
}
|
|
1037
|
-
const fieldObject = typeObject.fieldObjectsByName[field];
|
|
1038
|
-
return `${unitType}_${fieldObject.id}`;
|
|
1039
|
-
}).filter(Boolean).join("|");
|
|
1040
|
-
}
|
|
1198
|
+
visitUnitGroupKey: unitGroupKey => replaceNamesWithIdsInUnitGroupKey(unitGroupKey, schema)
|
|
1041
1199
|
});
|
|
1042
1200
|
const replaceIdsWithNamesInSmartFolder = (schema, smartFolder) => visitSmartFolder(smartFolder, {
|
|
1043
1201
|
visitQueryExpression: query => replaceIdsWithNamesInQueryExpression(schema, query),
|
|
1202
|
+
visitFilter: (fromType, expression) => replaceIdsWithNamesInFilter(schema, fromType, expression),
|
|
1044
1203
|
visitGroupByExpression: (groupBy, fromType) => replaceIdsWithNamesInGroupByExpression(schema, groupBy, fromType, Object.keys(groupBy).map(() => 0)),
|
|
1045
1204
|
visitExpression: (fromType, expression) => replaceIdsWithNamesInExpression(schema, fromType, expression),
|
|
1046
|
-
visitUnitGroupKey: unitGroupKey =>
|
|
1047
|
-
const types = smartFolder["fibery/meta"].items.map(item => item.query["q/from"]);
|
|
1048
|
-
const fieldObjectsById = types.reduce((acc, type) => {
|
|
1049
|
-
if (!(type in schema.typeObjectsById)) {
|
|
1050
|
-
return acc;
|
|
1051
|
-
}
|
|
1052
|
-
const fieldObjects = schema.typeObjectsById[type].fieldObjectsById;
|
|
1053
|
-
return {
|
|
1054
|
-
...acc,
|
|
1055
|
-
...fieldObjects
|
|
1056
|
-
};
|
|
1057
|
-
}, {});
|
|
1058
|
-
const keyParts = unitGroupKey.split("|");
|
|
1059
|
-
return keyParts.map(keyPart => {
|
|
1060
|
-
const [unitType, ...rest] = keyPart.split("_");
|
|
1061
|
-
if (unitType === "user-button") {
|
|
1062
|
-
return keyPart;
|
|
1063
|
-
}
|
|
1064
|
-
const fieldId = rest.join("_");
|
|
1065
|
-
if (!fieldId) {
|
|
1066
|
-
return keyPart;
|
|
1067
|
-
}
|
|
1068
|
-
const fieldObject = fieldObjectsById[fieldId];
|
|
1069
|
-
if (!fieldObject) {
|
|
1070
|
-
return keyPart;
|
|
1071
|
-
}
|
|
1072
|
-
return `${unitType}_${fieldObject.holderType}:${fieldObject.name}`;
|
|
1073
|
-
}).filter(Boolean).join("|");
|
|
1074
|
-
}
|
|
1205
|
+
visitUnitGroupKey: unitGroupKey => replaceIdsWithNamesInUnitGroupKey(unitGroupKey, getFieldObjectsById(smartFolder, schema))
|
|
1075
1206
|
});
|
|
1076
1207
|
const deleteExpressionWithNotFoundFieldsOrTypesInSmartFolder = (schema, smartFolder) => visitSmartFolder(smartFolder, {
|
|
1077
1208
|
visitQueryExpression: query => deleteExpressionWithNotFoundFieldsOrTypesInQueryExpression(schema, query),
|
|
1078
1209
|
visitGroupByExpression: (groupBy, fromType, removedItems) => deleteExpressionWithNotFoundFieldsOrTypesInGroupByExpression(schema, groupBy, fromType, removedItems),
|
|
1210
|
+
visitFilter: (fromType, expression) => deleteExpressionWithNotFoundFieldsOrTypesInFilter(schema, fromType, expression),
|
|
1079
1211
|
visitExpression: (fromType, expression) => deleteExpressionWithNotFoundFieldsOrTypesInExpression(schema, fromType, expression)
|
|
1080
1212
|
});
|
|
1081
1213
|
const fixContextExpressionWithBrokenPath$3 = (schema, view, defaultContextExpression) => visitSmartFolder(view, {
|
|
1082
1214
|
visitQueryExpression: query => query,
|
|
1083
1215
|
visitGroupByExpression: groupBy => groupBy,
|
|
1084
|
-
visitExpression: (
|
|
1216
|
+
visitExpression: (_fromType, expression) => expression,
|
|
1217
|
+
visitFilter: (_fromType, filter) => filter,
|
|
1085
1218
|
visitContextExpression: (fromType, expression) => resetContextExpressionIfBroken(schema, fromType, expression, defaultContextExpression)
|
|
1086
1219
|
});
|
|
1087
1220
|
const fixUserSelectedUnitsInSmartFolder = (schema, view, {
|
|
@@ -1091,7 +1224,8 @@ const fixUserSelectedUnitsInSmartFolder = (schema, view, {
|
|
|
1091
1224
|
return visitSmartFolder(view, {
|
|
1092
1225
|
visitQueryExpression: query => query,
|
|
1093
1226
|
visitGroupByExpression: groupBy => groupBy,
|
|
1094
|
-
|
|
1227
|
+
visitFilter: (_fromType, filter) => filter,
|
|
1228
|
+
visitExpression: (_fromType, expression) => expression,
|
|
1095
1229
|
visitViewUnit: (fromType, unit, units) => {
|
|
1096
1230
|
const {
|
|
1097
1231
|
type,
|
|
@@ -1117,18 +1251,20 @@ const fixUserSelectedUnitsInSmartFolder = (schema, view, {
|
|
|
1117
1251
|
const collectGarbage$3 = view => {
|
|
1118
1252
|
return visitSmartFolder(view, {
|
|
1119
1253
|
visitQueryExpression: query => query,
|
|
1254
|
+
visitFilter: (_fromType, filter) => filter,
|
|
1120
1255
|
visitGroupByExpression: groupBy => groupBy,
|
|
1121
|
-
visitExpression: (
|
|
1122
|
-
visitViewUnit: (
|
|
1256
|
+
visitExpression: (_fromType, expression) => expression,
|
|
1257
|
+
visitViewUnit: (_fromType, unit) => unit.checked ? unit : REMOVE
|
|
1123
1258
|
});
|
|
1124
1259
|
};
|
|
1125
1260
|
const enableHideWhenEmptyForCheckedUnits = view => {
|
|
1126
1261
|
return visitSmartFolder(view, {
|
|
1127
1262
|
visitQueryExpression: queryExpression => queryExpression,
|
|
1128
1263
|
visitGroupByExpression: groupBy => groupBy,
|
|
1129
|
-
visitExpression: (
|
|
1264
|
+
visitExpression: (_fromType, expression) => expression,
|
|
1265
|
+
visitFilter: (_fromType, filter) => filter,
|
|
1130
1266
|
visitEnums: enums => enums,
|
|
1131
|
-
visitViewUnit: (
|
|
1267
|
+
visitViewUnit: (_fromType, unit) => enableHideWhenEmptyForCheckedEditableUnit(unit)
|
|
1132
1268
|
});
|
|
1133
1269
|
};
|
|
1134
1270
|
|
|
@@ -1141,6 +1277,9 @@ const visitView$1 = (view, visitor) => immutableUpdate__default["default"](view,
|
|
|
1141
1277
|
query: {
|
|
1142
1278
|
$apply: query => query ? visitor.visitQueryExpression(query) : null
|
|
1143
1279
|
},
|
|
1280
|
+
filter: {
|
|
1281
|
+
$apply: filter => filter ? visitor.visitFilter(fromType, filter) : null
|
|
1282
|
+
},
|
|
1144
1283
|
contextExpression: {
|
|
1145
1284
|
$apply: contextExpression => contextExpression ? visitor.visitExpression(fromType, contextExpression) : contextExpression
|
|
1146
1285
|
},
|
|
@@ -1167,35 +1306,41 @@ const visitView$1 = (view, visitor) => immutableUpdate__default["default"](view,
|
|
|
1167
1306
|
});
|
|
1168
1307
|
const replaceNamesWithIdsInTableView = (schema, view) => visitView$1(view, {
|
|
1169
1308
|
visitExpression: (fromType, expression) => replaceNamesWithIdsInExpression(schema, fromType, expression),
|
|
1309
|
+
visitFilter: (fromType, expression) => replaceNamesWithIdsInFilter(schema, fromType, expression),
|
|
1170
1310
|
visitQueryExpression: query => replaceNamesWithIdsInQueryExpression(schema, query)
|
|
1171
1311
|
});
|
|
1172
1312
|
const replaceIdsWithNamesInTableView = (schema, view) => visitView$1(view, {
|
|
1173
1313
|
visitExpression: (fromType, expression) => replaceIdsWithNamesInExpression(schema, fromType, expression),
|
|
1314
|
+
visitFilter: (fromType, expression) => replaceIdsWithNamesInFilter(schema, fromType, expression),
|
|
1174
1315
|
visitQueryExpression: query => replaceIdsWithNamesInQueryExpression(schema, query)
|
|
1175
1316
|
});
|
|
1176
1317
|
const deleteExpressionWithNotFoundFieldsOrTypesInTableView = (schema, view) => visitView$1(view, {
|
|
1177
1318
|
visitQueryExpression: queryExpression => deleteExpressionWithNotFoundFieldsOrTypesInQueryExpression(schema, queryExpression),
|
|
1319
|
+
visitFilter: (fromType, expression) => deleteExpressionWithNotFoundFieldsOrTypesInFilter(schema, fromType, expression),
|
|
1178
1320
|
visitExpression: (fromType, expression) => deleteExpressionWithNotFoundFieldsOrTypesInExpression(schema, fromType, expression)
|
|
1179
1321
|
});
|
|
1180
1322
|
const fixUserSelectedUnitsInTableView = (schema, view, {
|
|
1181
1323
|
unitDefinitions,
|
|
1182
1324
|
getDefaultUnitTypeForField
|
|
1183
1325
|
}) => visitView$1(view, {
|
|
1184
|
-
visitExpression: (
|
|
1326
|
+
visitExpression: (_fromType, expression) => expression,
|
|
1185
1327
|
visitQueryExpression: query => query,
|
|
1328
|
+
visitFilter: (_fromType, filter) => filter,
|
|
1186
1329
|
visitViewUnit: (fromType, unit, units) => fixViewUnit(schema, fromType, unit, units, {
|
|
1187
1330
|
unitDefinitions,
|
|
1188
1331
|
getDefaultUnitTypeForField
|
|
1189
1332
|
})
|
|
1190
1333
|
});
|
|
1191
1334
|
const fixContextExpressionWithBrokenPath$2 = (schema, view, defaultContextExpression) => visitView$1(view, {
|
|
1192
|
-
visitExpression: (
|
|
1335
|
+
visitExpression: (_fromType, expression) => expression,
|
|
1336
|
+
visitFilter: (_fromType, filter) => filter,
|
|
1193
1337
|
visitQueryExpression: query => query,
|
|
1194
1338
|
visitContextExpression: (fromType, expression) => resetContextExpressionIfBroken(schema, fromType, expression, defaultContextExpression)
|
|
1195
1339
|
});
|
|
1196
1340
|
const collectGarbage$2 = view => {
|
|
1197
1341
|
return visitView$1(view, {
|
|
1198
1342
|
visitExpression: (fromType, expression) => expression,
|
|
1343
|
+
visitFilter: (_fromType, filter) => filter,
|
|
1199
1344
|
visitQueryExpression: query => query,
|
|
1200
1345
|
visitViewUnit: (fromType, unit) => unit.checked ? unit : REMOVE
|
|
1201
1346
|
});
|
|
@@ -1209,6 +1354,7 @@ const visitAxis = (axis, visitor) => {
|
|
|
1209
1354
|
const firstOrNull = x => ___default["default"].first(x) || null;
|
|
1210
1355
|
const axisResult = {
|
|
1211
1356
|
...axis,
|
|
1357
|
+
filter: axis.filter ? visitor.visitFilter(fromType, axis.filter) : null,
|
|
1212
1358
|
query: axis.query && visitor.visitQueryExpression(axis.query),
|
|
1213
1359
|
contextExpression: visitContextExpression(fromType, axis.contextExpression, visitor),
|
|
1214
1360
|
units: axis.units && axis.units.map(unit => visitViewUnit(fromType, unit, visitor)).filter(unit => isUnitExpressionValid(unit)).map((unit, idx, units) => visitor.visitViewUnit ? visitor.visitViewUnit(fromType, unit, units) : unit).filter(unit => unit !== REMOVE),
|
|
@@ -1249,6 +1395,9 @@ const visitView = (view, visitor) => immutableUpdate__default["default"](view, {
|
|
|
1249
1395
|
contextExpression: {
|
|
1250
1396
|
$apply: contextExpression => visitContextExpression(fromType, contextExpression, visitor)
|
|
1251
1397
|
},
|
|
1398
|
+
filter: {
|
|
1399
|
+
$apply: filter => filter ? visitor.visitFilter(fromType, filter) : null
|
|
1400
|
+
},
|
|
1252
1401
|
query: {
|
|
1253
1402
|
$apply: query => query ? visitor.visitQueryExpression(query) : null
|
|
1254
1403
|
},
|
|
@@ -1282,6 +1431,9 @@ const visitView = (view, visitor) => immutableUpdate__default["default"](view, {
|
|
|
1282
1431
|
dateExpression: {
|
|
1283
1432
|
$apply: startExpression => startExpression ? visitor.visitExpression(fromType, startExpression) : startExpression
|
|
1284
1433
|
},
|
|
1434
|
+
filter: {
|
|
1435
|
+
$apply: filter => filter ? visitor.visitFilter(fromType, filter) : null
|
|
1436
|
+
},
|
|
1285
1437
|
query: {
|
|
1286
1438
|
$apply: query => query ? visitor.visitQueryExpression(query) : null
|
|
1287
1439
|
},
|
|
@@ -1302,12 +1454,14 @@ const visitView = (view, visitor) => immutableUpdate__default["default"](view, {
|
|
|
1302
1454
|
const replaceNamesWithIdsInTimelineView = (schema, view) => {
|
|
1303
1455
|
return visitView(view, {
|
|
1304
1456
|
visitQueryExpression: query => replaceNamesWithIdsInQueryExpression(schema, query),
|
|
1457
|
+
visitFilter: (fromType, expression) => replaceNamesWithIdsInFilter(schema, fromType, expression),
|
|
1305
1458
|
visitExpression: (fromType, expression) => replaceNamesWithIdsInExpression(schema, fromType, expression)
|
|
1306
1459
|
});
|
|
1307
1460
|
};
|
|
1308
1461
|
const replaceIdsWithNamesInTimelineView = (schema, view) => {
|
|
1309
1462
|
return visitView(view, {
|
|
1310
1463
|
visitQueryExpression: query => replaceIdsWithNamesInQueryExpression(schema, query),
|
|
1464
|
+
visitFilter: (fromType, expression) => replaceIdsWithNamesInFilter(schema, fromType, expression),
|
|
1311
1465
|
visitExpression: (fromType, expression) => replaceIdsWithNamesInExpression(schema, fromType, expression)
|
|
1312
1466
|
});
|
|
1313
1467
|
};
|
|
@@ -1340,6 +1494,7 @@ const ensureAxisAndItemExpressionInvariant = view => {
|
|
|
1340
1494
|
const deleteExpressionWithNotFoundFieldsOrTypesInTimelineView = (schema, view, ensureAxisInvariant = true) => {
|
|
1341
1495
|
const viewNew = visitView(view, {
|
|
1342
1496
|
visitQueryExpression: queryExpression => deleteExpressionWithNotFoundFieldsOrTypesInQueryExpression(schema, queryExpression),
|
|
1497
|
+
visitFilter: (fromType, expression) => deleteExpressionWithNotFoundFieldsOrTypesInFilter(schema, fromType, expression),
|
|
1343
1498
|
visitExpression: (fromType, expression) => deleteExpressionWithNotFoundFieldsOrTypesInExpression(schema, fromType, expression)
|
|
1344
1499
|
});
|
|
1345
1500
|
return ensureAxisInvariant ? ensureAxisAndItemExpressionInvariant(viewNew) : viewNew;
|
|
@@ -1350,7 +1505,8 @@ const fixUserSelectedUnitsInTimelineView = (schema, view, {
|
|
|
1350
1505
|
}) => {
|
|
1351
1506
|
return visitView(view, {
|
|
1352
1507
|
visitQueryExpression: query => query,
|
|
1353
|
-
visitExpression: (
|
|
1508
|
+
visitExpression: (_fromType, expression) => expression,
|
|
1509
|
+
visitFilter: (_fromType, filter) => filter,
|
|
1354
1510
|
visitViewUnit: (fromType, unit, units) => fixViewUnit(schema, fromType, unit, units, {
|
|
1355
1511
|
unitDefinitions,
|
|
1356
1512
|
getDefaultUnitTypeForField
|
|
@@ -1358,24 +1514,27 @@ const fixUserSelectedUnitsInTimelineView = (schema, view, {
|
|
|
1358
1514
|
});
|
|
1359
1515
|
};
|
|
1360
1516
|
const fixContextExpressionWithBrokenPath$1 = (schema, view, defaultContextExpression) => visitView(view, {
|
|
1361
|
-
visitExpression: (
|
|
1517
|
+
visitExpression: (_fromType, expression) => expression,
|
|
1518
|
+
visitFilter: (_fromType, filter) => filter,
|
|
1362
1519
|
visitQueryExpression: query => query,
|
|
1363
1520
|
visitContextExpression: (fromType, expression) => resetContextExpressionIfBroken(schema, fromType, expression, defaultContextExpression)
|
|
1364
1521
|
});
|
|
1365
1522
|
const collectGarbage$1 = view => {
|
|
1366
1523
|
return visitView(view, {
|
|
1367
1524
|
visitQueryExpression: query => query,
|
|
1368
|
-
|
|
1369
|
-
|
|
1525
|
+
visitFilter: (_fromType, filter) => filter,
|
|
1526
|
+
visitExpression: (_fromType, expression) => expression,
|
|
1527
|
+
visitViewUnit: (_fromType, unit) => unit.checked ? unit : REMOVE
|
|
1370
1528
|
});
|
|
1371
1529
|
};
|
|
1372
1530
|
const enableHideWhenEmptyForCheckedEditableUnits = view => {
|
|
1373
1531
|
return visitView(view, {
|
|
1374
1532
|
visitQueryExpression: queryExpression => queryExpression,
|
|
1375
1533
|
visitGroupByExpression: groupBy => groupBy,
|
|
1376
|
-
visitExpression: (
|
|
1534
|
+
visitExpression: (_fromType, expression) => expression,
|
|
1535
|
+
visitFilter: (_fromType, filter) => filter,
|
|
1377
1536
|
visitEnums: enums => enums,
|
|
1378
|
-
visitViewUnit: (
|
|
1537
|
+
visitViewUnit: (_fromType, unit) => enableHideWhenEmptyForCheckedEditableUnit(unit)
|
|
1379
1538
|
});
|
|
1380
1539
|
};
|
|
1381
1540
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fibery/views",
|
|
3
|
-
"version": "10.
|
|
3
|
+
"version": "10.7.0",
|
|
4
4
|
"description": "Operations on view objects",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"author": "Fibery",
|
|
@@ -18,10 +18,10 @@
|
|
|
18
18
|
"jest-junit": "13.0.0",
|
|
19
19
|
"lodash": "4.17.21",
|
|
20
20
|
"microbundle": "0.15.1",
|
|
21
|
-
"@fibery/babel-preset": "7.4.0",
|
|
22
21
|
"@fibery/eslint-config": "8.6.0",
|
|
23
|
-
"@fibery/
|
|
24
|
-
"@fibery/expression-utils": "9.0.5"
|
|
22
|
+
"@fibery/babel-preset": "7.4.0",
|
|
23
|
+
"@fibery/expression-utils": "9.0.5",
|
|
24
|
+
"@fibery/schema": "10.2.1"
|
|
25
25
|
},
|
|
26
26
|
"peerDependencies": {
|
|
27
27
|
"@fibery/expression-utils": "^9.0.5",
|