@fibery/views 1.1.0 → 1.1.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.
- package/lib/views.js +437 -285
- package/package.json +2 -2
package/lib/views.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
+
var utils = require('@fibery/expression-utils/utils');
|
|
1
2
|
var immutableUpdate = require('immutability-helper');
|
|
2
3
|
var _ = require('lodash');
|
|
3
4
|
var visitors = require('@fibery/expression-utils/visitors');
|
|
4
|
-
var utils = require('@fibery/expression-utils/utils');
|
|
5
5
|
|
|
6
6
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
7
7
|
|
|
@@ -26,6 +26,35 @@ function _extends() {
|
|
|
26
26
|
return _extends.apply(this, arguments);
|
|
27
27
|
}
|
|
28
28
|
|
|
29
|
+
const fixViewUnit = (schema, fromType, unit) => {
|
|
30
|
+
const {
|
|
31
|
+
type,
|
|
32
|
+
expression
|
|
33
|
+
} = unit;
|
|
34
|
+
|
|
35
|
+
if (type === "date") {
|
|
36
|
+
const [field] = expression;
|
|
37
|
+
|
|
38
|
+
if (schema.typeObjectsByName[fromType].fieldObjectsByName[field].type === "fibery/date-time") {
|
|
39
|
+
return _extends({}, unit, {
|
|
40
|
+
type: "date-time"
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
if (type === "date-range") {
|
|
46
|
+
const [field] = expression;
|
|
47
|
+
|
|
48
|
+
if (schema.typeObjectsByName[fromType].fieldObjectsByName[field].type === "fibery/date-time-range") {
|
|
49
|
+
return _extends({}, unit, {
|
|
50
|
+
type: "date-time-range"
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
return unit;
|
|
56
|
+
};
|
|
57
|
+
|
|
29
58
|
const deleteExpressionWithNotFoundFieldsOrTypesInQueryExpression = (schema, queryExpression) => {
|
|
30
59
|
const {
|
|
31
60
|
"q/from": fromExpression,
|
|
@@ -132,27 +161,160 @@ const isUnitExpressionValid = unit => {
|
|
|
132
161
|
return true;
|
|
133
162
|
};
|
|
134
163
|
|
|
135
|
-
const
|
|
164
|
+
const visitQueryExpressionHolder = (queryHolder, visitor) => {
|
|
165
|
+
if (queryHolder) {
|
|
166
|
+
const {
|
|
167
|
+
query
|
|
168
|
+
} = queryHolder;
|
|
169
|
+
|
|
170
|
+
if (query) {
|
|
171
|
+
const queryNew = visitor.visitQueryExpression(query);
|
|
172
|
+
return queryNew ? _extends({}, queryHolder, {
|
|
173
|
+
query: queryNew
|
|
174
|
+
}) : null;
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
return queryHolder;
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
return queryHolder;
|
|
181
|
+
};
|
|
182
|
+
|
|
183
|
+
const visitAxisUnits = (axis, fromType, visitor) => {
|
|
184
|
+
return fromType ? immutableUpdate__default["default"](axis, {
|
|
185
|
+
contextExpression: {
|
|
186
|
+
$apply: contextExpression => contextExpression ? visitor.visitExpression(fromType, contextExpression) : contextExpression
|
|
187
|
+
},
|
|
188
|
+
units: {
|
|
189
|
+
$apply: units => units ? units.map(unit => visitViewUnit(fromType, unit, visitor)).filter(unit => isUnitExpressionValid(unit)).map(unit => visitor.visitViewUnit ? visitor.visitViewUnit(fromType, unit) : unit) : undefined
|
|
190
|
+
}
|
|
191
|
+
}) : axis;
|
|
192
|
+
};
|
|
193
|
+
|
|
194
|
+
const visitAxis$1 = (axis, visitor) => {
|
|
195
|
+
if (axis && axis.hasOwnProperty("query")) {
|
|
196
|
+
const fromType = ___default["default"].get(axis, ["query", "q/from"]);
|
|
197
|
+
|
|
198
|
+
const axisWithVisitedQuery = visitQueryExpressionHolder(axis, visitor);
|
|
199
|
+
|
|
200
|
+
if (axisWithVisitedQuery) {
|
|
201
|
+
return visitAxisUnits(axisWithVisitedQuery, fromType, visitor);
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
return axisWithVisitedQuery;
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
if (axis && axis.hasOwnProperty("enums")) {
|
|
208
|
+
const axisNew = immutableUpdate__default["default"](axis, {
|
|
209
|
+
enums: {
|
|
210
|
+
$apply: enums => visitor.visitEnums(enums)
|
|
211
|
+
}
|
|
212
|
+
});
|
|
213
|
+
const {
|
|
214
|
+
enums
|
|
215
|
+
} = axisNew;
|
|
216
|
+
return enums ? axisNew : null;
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
return axis;
|
|
220
|
+
};
|
|
221
|
+
|
|
222
|
+
const ensureAxisAndItemExpressionInvariant$1 = view => {
|
|
223
|
+
const actions = [];
|
|
224
|
+
|
|
225
|
+
const x = ___default["default"].get(view, ["fibery/meta", "x"]);
|
|
226
|
+
|
|
227
|
+
const y = ___default["default"].get(view, ["fibery/meta", "y"]);
|
|
228
|
+
|
|
229
|
+
const items = ___default["default"].get(view, ["fibery/meta", "items"]);
|
|
230
|
+
|
|
231
|
+
if (x === null) {
|
|
232
|
+
const resetActions = items.map(item => () => item.xExpression = null);
|
|
233
|
+
actions.push(...resetActions);
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
if (x !== null && ___default["default"].some(items, ({
|
|
237
|
+
xExpression
|
|
238
|
+
}) => xExpression === null)) {
|
|
239
|
+
const resetActions = items.map(item => () => item.xExpression = null);
|
|
240
|
+
actions.push(...resetActions);
|
|
241
|
+
actions.push(() => ___default["default"].set(view, ["fibery/meta", "x"], null));
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
if (y === null) {
|
|
245
|
+
const resetActions = items.map(item => () => item.yExpression = null);
|
|
246
|
+
actions.push(...resetActions);
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
if (y !== null && ___default["default"].some(items, ({
|
|
250
|
+
yExpression
|
|
251
|
+
}) => yExpression === null)) {
|
|
252
|
+
const resetActions = items.map(item => () => item.yExpression = null);
|
|
253
|
+
actions.push(...resetActions);
|
|
254
|
+
actions.push(() => ___default["default"].set(view, ["fibery/meta", "y"], null));
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
if (x !== null && ___default["default"].isEmpty(items)) {
|
|
258
|
+
actions.push(() => ___default["default"].set(view, ["fibery/meta", "x"], null));
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
if (y !== null && ___default["default"].isEmpty(items)) {
|
|
262
|
+
actions.push(() => ___default["default"].set(view, ["fibery/meta", "y"], null));
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
if (x !== null && ___default["default"].some(items, ({
|
|
266
|
+
xExpression
|
|
267
|
+
}) => !utils.isAxisFieldExpression(xExpression))) {
|
|
268
|
+
const resetActions = items.map(item => () => item.xExpression = null);
|
|
269
|
+
actions.push(...resetActions);
|
|
270
|
+
actions.push(() => ___default["default"].set(view, ["fibery/meta", "x"], null));
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
if (y !== null && ___default["default"].some(items, ({
|
|
274
|
+
yExpression
|
|
275
|
+
}) => !utils.isAxisFieldExpression(yExpression))) {
|
|
276
|
+
const resetActions = items.map(item => () => item.yExpression = null);
|
|
277
|
+
actions.push(...resetActions);
|
|
278
|
+
actions.push(() => ___default["default"].set(view, ["fibery/meta", "y"], null));
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
actions.forEach(action => action());
|
|
282
|
+
return view;
|
|
283
|
+
};
|
|
284
|
+
|
|
285
|
+
const visitView$4 = (view, visitor) => immutableUpdate__default["default"](view, {
|
|
136
286
|
"fibery/meta": {
|
|
287
|
+
x: {
|
|
288
|
+
$apply: x => visitAxis$1(x, visitor)
|
|
289
|
+
},
|
|
290
|
+
y: {
|
|
291
|
+
$apply: y => visitAxis$1(y, visitor)
|
|
292
|
+
},
|
|
137
293
|
items: {
|
|
138
294
|
$apply: items => items.map(item => {
|
|
139
295
|
const fromType = ___default["default"].get(item, ["query", "q/from"]);
|
|
140
296
|
|
|
141
297
|
return fromType ? immutableUpdate__default["default"](item, {
|
|
142
|
-
|
|
143
|
-
$apply:
|
|
298
|
+
xExpression: {
|
|
299
|
+
$apply: xExpression => xExpression ? visitor.visitExpression(fromType, xExpression) : xExpression
|
|
300
|
+
},
|
|
301
|
+
yExpression: {
|
|
302
|
+
$apply: yExpression => yExpression ? visitor.visitExpression(fromType, yExpression) : yExpression
|
|
144
303
|
},
|
|
145
304
|
contextExpression: {
|
|
146
305
|
$apply: contextExpression => contextExpression ? visitor.visitExpression(fromType, contextExpression) : contextExpression
|
|
147
306
|
},
|
|
307
|
+
query: {
|
|
308
|
+
$apply: query => query ? visitor.visitQueryExpression(query) : null
|
|
309
|
+
},
|
|
148
310
|
units: {
|
|
149
|
-
$apply: units => units ? units.map(unit => visitViewUnit(fromType, unit, visitor)).filter(unit => isUnitExpressionValid(unit)) :
|
|
311
|
+
$apply: units => units ? units.map(unit => visitViewUnit(fromType, unit, visitor)).filter(unit => isUnitExpressionValid(unit)).map(unit => visitor.visitViewUnit ? visitor.visitViewUnit(fromType, unit) : unit) : undefined
|
|
150
312
|
},
|
|
151
313
|
colorCoding: {
|
|
152
314
|
$apply: colorCodings => {
|
|
153
|
-
return colorCodings
|
|
315
|
+
return colorCodings ? colorCodings.map(colorCoding => _extends({}, colorCoding, {
|
|
154
316
|
expression: visitor.visitExpression(fromType, colorCoding.expression)
|
|
155
|
-
})).filter(colorCoding => colorCoding.expression !== null);
|
|
317
|
+
})).filter(colorCoding => colorCoding.expression !== null) : undefined;
|
|
156
318
|
}
|
|
157
319
|
}
|
|
158
320
|
}) : item;
|
|
@@ -166,20 +328,96 @@ const visitView$3 = (view, visitor) => immutableUpdate__default["default"](view,
|
|
|
166
328
|
}
|
|
167
329
|
});
|
|
168
330
|
|
|
169
|
-
const
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
});
|
|
177
|
-
const deleteExpressionWithNotFoundFieldsOrTypesInTableView = (schema, view) => visitView$3(view, {
|
|
178
|
-
visitQueryExpression: queryExpression => deleteExpressionWithNotFoundFieldsOrTypesInQueryExpression(schema, queryExpression),
|
|
179
|
-
visitExpression: (fromType, expression) => deleteExpressionWithNotFoundFieldsOrTypesInExpression(schema, fromType, expression)
|
|
180
|
-
});
|
|
331
|
+
const replaceNamesWithIdsViewVisitor = schema => {
|
|
332
|
+
const visitor = {
|
|
333
|
+
visitQueryExpression: queryExpression => replaceNamesWithIdsInQueryExpression(schema, queryExpression),
|
|
334
|
+
visitExpression: (fromType, expression) => replaceNamesWithIdsInExpression(schema, fromType, expression),
|
|
335
|
+
visitEnums: enums => ___default["default"].entries(enums).reduce((result, [type, queryHolder]) => {
|
|
336
|
+
if (schema.typeObjectsByName.hasOwnProperty(type)) {
|
|
337
|
+
const typeObject = schema.typeObjectsByName[type];
|
|
181
338
|
|
|
182
|
-
const
|
|
339
|
+
const fromType = ___default["default"].get(queryHolder, ["query", "q/from"]);
|
|
340
|
+
|
|
341
|
+
const axisWithVisitedQuery = visitQueryExpressionHolder(queryHolder, visitor);
|
|
342
|
+
result[typeObject.id] = visitAxisUnits(axisWithVisitedQuery, fromType, visitor);
|
|
343
|
+
} else {
|
|
344
|
+
result[type] = queryHolder;
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
return result;
|
|
348
|
+
}, {})
|
|
349
|
+
};
|
|
350
|
+
return visitor;
|
|
351
|
+
};
|
|
352
|
+
|
|
353
|
+
const replaceIdsWithNamesViewVisitor = schema => {
|
|
354
|
+
const visitor = {
|
|
355
|
+
visitQueryExpression: queryExpression => replaceIdsWithNamesInQueryExpression(schema, queryExpression),
|
|
356
|
+
visitExpression: (fromType, expression) => replaceIdsWithNamesInExpression(schema, fromType, expression),
|
|
357
|
+
visitEnums: enums => ___default["default"].entries(enums).reduce((result, [typeId, queryHolder]) => {
|
|
358
|
+
if (schema.typeObjectsById.hasOwnProperty(typeId)) {
|
|
359
|
+
const typeObject = schema.typeObjectsById[typeId];
|
|
360
|
+
|
|
361
|
+
const fromType = ___default["default"].get(queryHolder, ["query", "q/from"]);
|
|
362
|
+
|
|
363
|
+
const axisWithVisitedQuery = visitQueryExpressionHolder(queryHolder, visitor);
|
|
364
|
+
result[typeObject.name] = visitAxisUnits(axisWithVisitedQuery, fromType, visitor);
|
|
365
|
+
} else {
|
|
366
|
+
result[typeId] = queryHolder;
|
|
367
|
+
}
|
|
368
|
+
|
|
369
|
+
return result;
|
|
370
|
+
}, {})
|
|
371
|
+
};
|
|
372
|
+
return visitor;
|
|
373
|
+
};
|
|
374
|
+
|
|
375
|
+
const deleteExpressionWithNotFoundFieldsOrTypesViewVisitor = schema => {
|
|
376
|
+
const visitor = {
|
|
377
|
+
visitQueryExpression: queryExpression => deleteExpressionWithNotFoundFieldsOrTypesInQueryExpression(schema, queryExpression),
|
|
378
|
+
visitExpression: (fromType, expression) => deleteExpressionWithNotFoundFieldsOrTypesInExpression(schema, fromType, expression),
|
|
379
|
+
visitEnums: enums => {
|
|
380
|
+
const enumsNew = ___default["default"].entries(enums).reduce((result, [type, queryHolder]) => {
|
|
381
|
+
if (schema.typeObjectsByName.hasOwnProperty(type)) {
|
|
382
|
+
const typeObject = schema.typeObjectsByName[type];
|
|
383
|
+
const queryHolderResult = visitQueryExpressionHolder(queryHolder, visitor);
|
|
384
|
+
|
|
385
|
+
if (queryHolderResult) {
|
|
386
|
+
result[typeObject.name] = queryHolderResult;
|
|
387
|
+
}
|
|
388
|
+
|
|
389
|
+
return result;
|
|
390
|
+
}
|
|
391
|
+
|
|
392
|
+
return result;
|
|
393
|
+
}, {});
|
|
394
|
+
|
|
395
|
+
return ___default["default"].isEmpty(enumsNew) ? null : enumsNew;
|
|
396
|
+
}
|
|
397
|
+
};
|
|
398
|
+
return visitor;
|
|
399
|
+
};
|
|
400
|
+
|
|
401
|
+
const fixUserSelectedUnitsViewVisitor = schema => {
|
|
402
|
+
return {
|
|
403
|
+
visitQueryExpression: queryExpression => queryExpression,
|
|
404
|
+
visitExpression: (fromType, expression) => expression,
|
|
405
|
+
visitEnums: enums => enums,
|
|
406
|
+
visitViewUnit: (fromType, unit) => fixViewUnit(schema, fromType, unit)
|
|
407
|
+
};
|
|
408
|
+
};
|
|
409
|
+
|
|
410
|
+
const replaceIdsWithNamesInBoardView = (schema, view) => visitView$4(view, replaceIdsWithNamesViewVisitor(schema));
|
|
411
|
+
const replaceNamesWithIdsInBoardView = (schema, view) => visitView$4(view, replaceNamesWithIdsViewVisitor(schema));
|
|
412
|
+
const deleteExpressionWithNotFoundOrInvalidFieldsOrTypesInBoardView = (schema, view, ensureAxisInvariant = true) => {
|
|
413
|
+
const viewNew = visitView$4(view, deleteExpressionWithNotFoundFieldsOrTypesViewVisitor(schema));
|
|
414
|
+
return ensureAxisInvariant ? ensureAxisAndItemExpressionInvariant$1(viewNew) : viewNew;
|
|
415
|
+
};
|
|
416
|
+
const fixUserSelectedUnitsInBoardView = (schema, view) => {
|
|
417
|
+
return visitView$4(view, fixUserSelectedUnitsViewVisitor(schema));
|
|
418
|
+
};
|
|
419
|
+
|
|
420
|
+
const visitView$3 = (view, visitor) => immutableUpdate__default["default"](view, {
|
|
183
421
|
"fibery/meta": {
|
|
184
422
|
items: {
|
|
185
423
|
$apply: items => items.map(item => {
|
|
@@ -199,7 +437,7 @@ const visitView$2 = (view, visitor) => immutableUpdate__default["default"](view,
|
|
|
199
437
|
$apply: query => query ? visitor.visitQueryExpression(query) : null
|
|
200
438
|
},
|
|
201
439
|
units: {
|
|
202
|
-
$apply: units => units ? units.map(unit => visitViewUnit(fromType, unit, visitor)).filter(unit => isUnitExpressionValid(unit)) :
|
|
440
|
+
$apply: units => units ? units.map(unit => visitViewUnit(fromType, unit, visitor)).filter(unit => isUnitExpressionValid(unit)).map(unit => visitor.visitViewUnit ? visitor.visitViewUnit(fromType, unit) : unit) : undefined
|
|
203
441
|
},
|
|
204
442
|
colorCoding: {
|
|
205
443
|
$apply: colorCodings => {
|
|
@@ -220,32 +458,100 @@ const visitView$2 = (view, visitor) => immutableUpdate__default["default"](view,
|
|
|
220
458
|
});
|
|
221
459
|
|
|
222
460
|
const replaceNamesWithIdsInCalendarView = (schema, view) => {
|
|
223
|
-
return visitView$
|
|
461
|
+
return visitView$3(view, {
|
|
224
462
|
visitExpression: (fromType, expression) => replaceNamesWithIdsInExpression(schema, fromType, expression),
|
|
225
463
|
visitQueryExpression: query => replaceNamesWithIdsInQueryExpression(schema, query)
|
|
226
464
|
});
|
|
227
465
|
};
|
|
228
466
|
const replaceIdsWithNamesInCalendarView = (schema, view) => {
|
|
229
|
-
return visitView$
|
|
467
|
+
return visitView$3(view, {
|
|
230
468
|
visitExpression: (fromType, expression) => replaceIdsWithNamesInExpression(schema, fromType, expression),
|
|
231
469
|
visitQueryExpression: query => replaceIdsWithNamesInQueryExpression(schema, query)
|
|
232
470
|
});
|
|
233
471
|
};
|
|
234
|
-
const deleteExpressionWithNotFoundFieldsOrTypesInCalendarView = (schema, view) => visitView$
|
|
472
|
+
const deleteExpressionWithNotFoundFieldsOrTypesInCalendarView = (schema, view) => visitView$3(view, {
|
|
235
473
|
visitQueryExpression: queryExpression => deleteExpressionWithNotFoundFieldsOrTypesInQueryExpression(schema, queryExpression),
|
|
236
474
|
visitExpression: (fromType, expression) => deleteExpressionWithNotFoundFieldsOrTypesInExpression(schema, fromType, expression)
|
|
237
475
|
});
|
|
476
|
+
const fixUserSelectedUnitsInCalendarView = (schema, view) => {
|
|
477
|
+
return visitView$3(view, {
|
|
478
|
+
visitExpression: (fromType, expression) => expression,
|
|
479
|
+
visitQueryExpression: query => query,
|
|
480
|
+
visitViewUnit: (fromType, unit) => fixViewUnit(schema, fromType, unit)
|
|
481
|
+
});
|
|
482
|
+
};
|
|
238
483
|
|
|
239
|
-
const
|
|
484
|
+
const visitView$2 = (view, visitor) => immutableUpdate__default["default"](view, {
|
|
240
485
|
"fibery/meta": {
|
|
241
486
|
items: {
|
|
242
|
-
$apply: items => {
|
|
243
|
-
const
|
|
244
|
-
|
|
245
|
-
return
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
}
|
|
487
|
+
$apply: items => items.map(item => {
|
|
488
|
+
const fromType = ___default["default"].get(item, ["query", "q/from"]);
|
|
489
|
+
|
|
490
|
+
return fromType ? immutableUpdate__default["default"](item, {
|
|
491
|
+
postExpression: {
|
|
492
|
+
$apply: postExpression => postExpression ? visitor.visitExpression(fromType, postExpression) : postExpression
|
|
493
|
+
},
|
|
494
|
+
contextExpression: {
|
|
495
|
+
$apply: contextExpression => contextExpression ? visitor.visitExpression(fromType, contextExpression) : contextExpression
|
|
496
|
+
},
|
|
497
|
+
query: {
|
|
498
|
+
$apply: query => query ? visitor.visitQueryExpression(query) : null
|
|
499
|
+
},
|
|
500
|
+
units: {
|
|
501
|
+
$apply: units => units ? units.map(unit => visitViewUnit(fromType, unit, visitor)).filter(unit => isUnitExpressionValid(unit)).map(unit => visitor.visitViewUnit ? visitor.visitViewUnit(fromType, unit) : unit) : undefined
|
|
502
|
+
},
|
|
503
|
+
colorCoding: {
|
|
504
|
+
$apply: colorCodings => {
|
|
505
|
+
return colorCodings && colorCodings.map(colorCoding => _extends({}, colorCoding, {
|
|
506
|
+
expression: visitor.visitExpression(fromType, colorCoding.expression)
|
|
507
|
+
})).filter(colorCoding => colorCoding.expression !== null);
|
|
508
|
+
}
|
|
509
|
+
}
|
|
510
|
+
}) : item;
|
|
511
|
+
}).filter(item => {
|
|
512
|
+
const {
|
|
513
|
+
query
|
|
514
|
+
} = item;
|
|
515
|
+
return query ? item : null;
|
|
516
|
+
})
|
|
517
|
+
}
|
|
518
|
+
}
|
|
519
|
+
});
|
|
520
|
+
|
|
521
|
+
const replaceNamesWithIdsInFeedView = (schema, view) => {
|
|
522
|
+
return visitView$2(view, {
|
|
523
|
+
visitExpression: (fromType, expression) => replaceNamesWithIdsInExpression(schema, fromType, expression),
|
|
524
|
+
visitQueryExpression: query => replaceNamesWithIdsInQueryExpression(schema, query)
|
|
525
|
+
});
|
|
526
|
+
};
|
|
527
|
+
const replaceIdsWithNamesInFeedView = (schema, view) => {
|
|
528
|
+
return visitView$2(view, {
|
|
529
|
+
visitExpression: (fromType, expression) => replaceIdsWithNamesInExpression(schema, fromType, expression),
|
|
530
|
+
visitQueryExpression: query => replaceIdsWithNamesInQueryExpression(schema, query)
|
|
531
|
+
});
|
|
532
|
+
};
|
|
533
|
+
const deleteExpressionWithNotFoundFieldsOrTypesInFeedView = (schema, view) => visitView$2(view, {
|
|
534
|
+
visitQueryExpression: queryExpression => deleteExpressionWithNotFoundFieldsOrTypesInQueryExpression(schema, queryExpression),
|
|
535
|
+
visitExpression: (fromType, expression) => deleteExpressionWithNotFoundFieldsOrTypesInExpression(schema, fromType, expression)
|
|
536
|
+
});
|
|
537
|
+
const fixUserSelectedUnitsInFeedView = (schema, view) => {
|
|
538
|
+
return visitView$2(view, {
|
|
539
|
+
visitExpression: (fromType, expression) => expression,
|
|
540
|
+
visitQueryExpression: query => query,
|
|
541
|
+
visitViewUnit: (fromType, unit) => fixViewUnit(schema, fromType, unit)
|
|
542
|
+
});
|
|
543
|
+
};
|
|
544
|
+
|
|
545
|
+
const visitSmartFolder = (smartFolder, visitor) => immutableUpdate__default["default"](smartFolder, {
|
|
546
|
+
"fibery/meta": {
|
|
547
|
+
items: {
|
|
548
|
+
$apply: items => {
|
|
549
|
+
const isOldSmartFolder = !items.every(item => item.hasOwnProperty("groupBy"));
|
|
550
|
+
let removedItems = [];
|
|
551
|
+
return items.map((item, index) => {
|
|
552
|
+
if (isOldSmartFolder) {
|
|
553
|
+
return item;
|
|
554
|
+
}
|
|
249
555
|
|
|
250
556
|
const fromType = ___default["default"].get(item, ["query", "q/from"]);
|
|
251
557
|
|
|
@@ -374,7 +680,59 @@ const deleteExpressionWithNotFoundFieldsOrTypesInSmartFolder = (schema, smartFol
|
|
|
374
680
|
visitExpression: (fromType, expression) => deleteExpressionWithNotFoundFieldsOrTypesInExpression(schema, fromType, expression)
|
|
375
681
|
});
|
|
376
682
|
|
|
377
|
-
const
|
|
683
|
+
const visitView$1 = (view, visitor) => immutableUpdate__default["default"](view, {
|
|
684
|
+
"fibery/meta": {
|
|
685
|
+
items: {
|
|
686
|
+
$apply: items => items.map(item => {
|
|
687
|
+
const fromType = ___default["default"].get(item, ["query", "q/from"]);
|
|
688
|
+
|
|
689
|
+
return fromType ? immutableUpdate__default["default"](item, {
|
|
690
|
+
query: {
|
|
691
|
+
$apply: query => query ? visitor.visitQueryExpression(query) : null
|
|
692
|
+
},
|
|
693
|
+
contextExpression: {
|
|
694
|
+
$apply: contextExpression => contextExpression ? visitor.visitExpression(fromType, contextExpression) : contextExpression
|
|
695
|
+
},
|
|
696
|
+
units: {
|
|
697
|
+
$apply: units => units ? units.map(unit => visitViewUnit(fromType, unit, visitor)).filter(unit => isUnitExpressionValid(unit)).map(unit => visitor.visitViewUnit ? visitor.visitViewUnit(fromType, unit) : unit) : undefined
|
|
698
|
+
},
|
|
699
|
+
colorCoding: {
|
|
700
|
+
$apply: colorCodings => {
|
|
701
|
+
return colorCodings && colorCodings.map(colorCoding => _extends({}, colorCoding, {
|
|
702
|
+
expression: visitor.visitExpression(fromType, colorCoding.expression)
|
|
703
|
+
})).filter(colorCoding => colorCoding.expression !== null);
|
|
704
|
+
}
|
|
705
|
+
}
|
|
706
|
+
}) : item;
|
|
707
|
+
}).filter(item => {
|
|
708
|
+
const {
|
|
709
|
+
query
|
|
710
|
+
} = item;
|
|
711
|
+
return query ? item : null;
|
|
712
|
+
})
|
|
713
|
+
}
|
|
714
|
+
}
|
|
715
|
+
});
|
|
716
|
+
|
|
717
|
+
const replaceNamesWithIdsInTableView = (schema, view) => visitView$1(view, {
|
|
718
|
+
visitExpression: (fromType, expression) => replaceNamesWithIdsInExpression(schema, fromType, expression),
|
|
719
|
+
visitQueryExpression: query => replaceNamesWithIdsInQueryExpression(schema, query)
|
|
720
|
+
});
|
|
721
|
+
const replaceIdsWithNamesInTableView = (schema, view) => visitView$1(view, {
|
|
722
|
+
visitExpression: (fromType, expression) => replaceIdsWithNamesInExpression(schema, fromType, expression),
|
|
723
|
+
visitQueryExpression: query => replaceIdsWithNamesInQueryExpression(schema, query)
|
|
724
|
+
});
|
|
725
|
+
const deleteExpressionWithNotFoundFieldsOrTypesInTableView = (schema, view) => visitView$1(view, {
|
|
726
|
+
visitQueryExpression: queryExpression => deleteExpressionWithNotFoundFieldsOrTypesInQueryExpression(schema, queryExpression),
|
|
727
|
+
visitExpression: (fromType, expression) => deleteExpressionWithNotFoundFieldsOrTypesInExpression(schema, fromType, expression)
|
|
728
|
+
});
|
|
729
|
+
const fixUserSelectedUnitsInTableView = (schema, view) => visitView$1(view, {
|
|
730
|
+
visitExpression: (fromType, expression) => expression,
|
|
731
|
+
visitQueryExpression: query => query,
|
|
732
|
+
visitViewUnit: (fromType, unit) => fixViewUnit(schema, fromType, unit)
|
|
733
|
+
});
|
|
734
|
+
|
|
735
|
+
const visitAxis = (axis, visitor) => {
|
|
378
736
|
if (!axis) {
|
|
379
737
|
return axis;
|
|
380
738
|
}
|
|
@@ -401,10 +759,10 @@ const visitAxis$1 = (axis, visitor) => {
|
|
|
401
759
|
return axisResult;
|
|
402
760
|
};
|
|
403
761
|
|
|
404
|
-
const visitView
|
|
762
|
+
const visitView = (view, visitor) => immutableUpdate__default["default"](view, {
|
|
405
763
|
"fibery/meta": {
|
|
406
764
|
y: {
|
|
407
|
-
$apply: y => visitAxis
|
|
765
|
+
$apply: y => visitAxis(y, visitor)
|
|
408
766
|
},
|
|
409
767
|
items: {
|
|
410
768
|
$apply: items => items.map(item => {
|
|
@@ -427,7 +785,7 @@ const visitView$1 = (view, visitor) => immutableUpdate__default["default"](view,
|
|
|
427
785
|
$apply: query => query ? visitor.visitQueryExpression(query) : null
|
|
428
786
|
},
|
|
429
787
|
units: {
|
|
430
|
-
$apply: units => units ? units.map(unit => visitViewUnit(fromType, unit, visitor)).filter(unit => isUnitExpressionValid(unit)) :
|
|
788
|
+
$apply: units => units ? units.map(unit => visitViewUnit(fromType, unit, visitor)).filter(unit => isUnitExpressionValid(unit)).map(unit => visitor.visitViewUnit ? visitor.visitViewUnit(fromType, unit) : unit) : undefined
|
|
431
789
|
},
|
|
432
790
|
colorCoding: {
|
|
433
791
|
$apply: colorCodings => {
|
|
@@ -473,19 +831,19 @@ const visitView$1 = (view, visitor) => immutableUpdate__default["default"](view,
|
|
|
473
831
|
});
|
|
474
832
|
|
|
475
833
|
const replaceNamesWithIdsInTimelineView = (schema, view) => {
|
|
476
|
-
return visitView
|
|
834
|
+
return visitView(view, {
|
|
477
835
|
visitQueryExpression: query => replaceNamesWithIdsInQueryExpression(schema, query),
|
|
478
836
|
visitExpression: (fromType, expression) => replaceNamesWithIdsInExpression(schema, fromType, expression)
|
|
479
837
|
});
|
|
480
838
|
};
|
|
481
839
|
const replaceIdsWithNamesInTimelineView = (schema, view) => {
|
|
482
|
-
return visitView
|
|
840
|
+
return visitView(view, {
|
|
483
841
|
visitQueryExpression: query => replaceIdsWithNamesInQueryExpression(schema, query),
|
|
484
842
|
visitExpression: (fromType, expression) => replaceIdsWithNamesInExpression(schema, fromType, expression)
|
|
485
843
|
});
|
|
486
844
|
};
|
|
487
845
|
|
|
488
|
-
const ensureAxisAndItemExpressionInvariant
|
|
846
|
+
const ensureAxisAndItemExpressionInvariant = view => {
|
|
489
847
|
const actions = [];
|
|
490
848
|
|
|
491
849
|
const y = ___default["default"].get(view, ["fibery/meta", "y"]);
|
|
@@ -521,274 +879,61 @@ const ensureAxisAndItemExpressionInvariant$1 = view => {
|
|
|
521
879
|
return view;
|
|
522
880
|
};
|
|
523
881
|
|
|
524
|
-
const deleteExpressionWithNotFoundFieldsOrTypesInTimelineView = (schema, view) => {
|
|
525
|
-
const viewNew = visitView
|
|
882
|
+
const deleteExpressionWithNotFoundFieldsOrTypesInTimelineView = (schema, view, ensureAxisInvariant = true) => {
|
|
883
|
+
const viewNew = visitView(view, {
|
|
526
884
|
visitQueryExpression: queryExpression => deleteExpressionWithNotFoundFieldsOrTypesInQueryExpression(schema, queryExpression),
|
|
527
885
|
visitExpression: (fromType, expression) => deleteExpressionWithNotFoundFieldsOrTypesInExpression(schema, fromType, expression)
|
|
528
886
|
});
|
|
529
|
-
return ensureAxisAndItemExpressionInvariant
|
|
887
|
+
return ensureAxisInvariant ? ensureAxisAndItemExpressionInvariant(viewNew) : viewNew;
|
|
530
888
|
};
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
if (query) {
|
|
539
|
-
const queryNew = visitor.visitQueryExpression(query);
|
|
540
|
-
return queryNew ? _extends({}, queryHolder, {
|
|
541
|
-
query: queryNew
|
|
542
|
-
}) : null;
|
|
543
|
-
}
|
|
544
|
-
|
|
545
|
-
return queryHolder;
|
|
546
|
-
}
|
|
547
|
-
|
|
548
|
-
return queryHolder;
|
|
549
|
-
};
|
|
550
|
-
|
|
551
|
-
const visitAxisUnits = (axis, fromType, visitor) => {
|
|
552
|
-
return fromType ? immutableUpdate__default["default"](axis, {
|
|
553
|
-
contextExpression: {
|
|
554
|
-
$apply: contextExpression => contextExpression ? visitor.visitExpression(fromType, contextExpression) : contextExpression
|
|
555
|
-
},
|
|
556
|
-
units: {
|
|
557
|
-
$apply: units => units ? units.map(unit => visitViewUnit(fromType, unit, visitor)).filter(unit => isUnitExpressionValid(unit)) : undefined
|
|
558
|
-
}
|
|
559
|
-
}) : axis;
|
|
560
|
-
};
|
|
561
|
-
|
|
562
|
-
const visitAxis = (axis, visitor) => {
|
|
563
|
-
if (axis && axis.hasOwnProperty("query")) {
|
|
564
|
-
const fromType = ___default["default"].get(axis, ["query", "q/from"]);
|
|
565
|
-
|
|
566
|
-
const axisWithVisitedQuery = visitQueryExpressionHolder(axis, visitor);
|
|
567
|
-
|
|
568
|
-
if (axisWithVisitedQuery) {
|
|
569
|
-
return visitAxisUnits(axisWithVisitedQuery, fromType, visitor);
|
|
570
|
-
}
|
|
571
|
-
|
|
572
|
-
return axisWithVisitedQuery;
|
|
573
|
-
}
|
|
574
|
-
|
|
575
|
-
if (axis && axis.hasOwnProperty("enums")) {
|
|
576
|
-
const axisNew = immutableUpdate__default["default"](axis, {
|
|
577
|
-
enums: {
|
|
578
|
-
$apply: enums => visitor.visitEnums(enums)
|
|
579
|
-
}
|
|
580
|
-
});
|
|
581
|
-
const {
|
|
582
|
-
enums
|
|
583
|
-
} = axisNew;
|
|
584
|
-
return enums ? axisNew : null;
|
|
585
|
-
}
|
|
586
|
-
|
|
587
|
-
return axis;
|
|
889
|
+
const fixUserSelectedUnitsInTimelineView = (schema, view) => {
|
|
890
|
+
return visitView(view, {
|
|
891
|
+
visitQueryExpression: query => query,
|
|
892
|
+
visitExpression: (fromType, expression) => expression,
|
|
893
|
+
visitViewUnit: (fromType, unit) => fixViewUnit(schema, fromType, unit)
|
|
894
|
+
});
|
|
588
895
|
};
|
|
589
896
|
|
|
590
|
-
const
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
const y = ___default["default"].get(view, ["fibery/meta", "y"]);
|
|
596
|
-
|
|
597
|
-
const items = ___default["default"].get(view, ["fibery/meta", "items"]);
|
|
598
|
-
|
|
599
|
-
if (x === null) {
|
|
600
|
-
const resetActions = items.map(item => () => item.xExpression = null);
|
|
601
|
-
actions.push(...resetActions);
|
|
602
|
-
}
|
|
603
|
-
|
|
604
|
-
if (x !== null && ___default["default"].some(items, ({
|
|
605
|
-
xExpression
|
|
606
|
-
}) => xExpression === null)) {
|
|
607
|
-
const resetActions = items.map(item => () => item.xExpression = null);
|
|
608
|
-
actions.push(...resetActions);
|
|
609
|
-
actions.push(() => ___default["default"].set(view, ["fibery/meta", "x"], null));
|
|
610
|
-
}
|
|
611
|
-
|
|
612
|
-
if (y === null) {
|
|
613
|
-
const resetActions = items.map(item => () => item.yExpression = null);
|
|
614
|
-
actions.push(...resetActions);
|
|
615
|
-
}
|
|
616
|
-
|
|
617
|
-
if (y !== null && ___default["default"].some(items, ({
|
|
618
|
-
yExpression
|
|
619
|
-
}) => yExpression === null)) {
|
|
620
|
-
const resetActions = items.map(item => () => item.yExpression = null);
|
|
621
|
-
actions.push(...resetActions);
|
|
622
|
-
actions.push(() => ___default["default"].set(view, ["fibery/meta", "y"], null));
|
|
623
|
-
}
|
|
624
|
-
|
|
625
|
-
if (x !== null && ___default["default"].isEmpty(items)) {
|
|
626
|
-
actions.push(() => ___default["default"].set(view, ["fibery/meta", "x"], null));
|
|
627
|
-
}
|
|
897
|
+
const deleteExpressionWithNotFoundFieldsOrTypesInView = (schema, view, ensureAxisInvariant = true) => {
|
|
898
|
+
switch (view["fibery/type"]) {
|
|
899
|
+
case "board":
|
|
900
|
+
return deleteExpressionWithNotFoundOrInvalidFieldsOrTypesInBoardView(schema, view, ensureAxisInvariant);
|
|
628
901
|
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
}
|
|
902
|
+
case "list":
|
|
903
|
+
return deleteExpressionWithNotFoundFieldsOrTypesInSmartFolder(schema, view);
|
|
632
904
|
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
}) => !utils.isAxisFieldExpression(xExpression))) {
|
|
636
|
-
const resetActions = items.map(item => () => item.xExpression = null);
|
|
637
|
-
actions.push(...resetActions);
|
|
638
|
-
actions.push(() => ___default["default"].set(view, ["fibery/meta", "x"], null));
|
|
639
|
-
}
|
|
905
|
+
case "timeline":
|
|
906
|
+
return deleteExpressionWithNotFoundFieldsOrTypesInTimelineView(schema, view, ensureAxisInvariant);
|
|
640
907
|
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
}) => !utils.isAxisFieldExpression(yExpression))) {
|
|
644
|
-
const resetActions = items.map(item => () => item.yExpression = null);
|
|
645
|
-
actions.push(...resetActions);
|
|
646
|
-
actions.push(() => ___default["default"].set(view, ["fibery/meta", "y"], null));
|
|
647
|
-
}
|
|
908
|
+
case "calendar":
|
|
909
|
+
return deleteExpressionWithNotFoundFieldsOrTypesInCalendarView(schema, view);
|
|
648
910
|
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
};
|
|
911
|
+
case "table":
|
|
912
|
+
return deleteExpressionWithNotFoundFieldsOrTypesInTableView(schema, view);
|
|
652
913
|
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
x: {
|
|
656
|
-
$apply: x => visitAxis(x, visitor)
|
|
657
|
-
},
|
|
658
|
-
y: {
|
|
659
|
-
$apply: y => visitAxis(y, visitor)
|
|
660
|
-
},
|
|
661
|
-
items: {
|
|
662
|
-
$apply: items => items.map(item => {
|
|
663
|
-
const fromType = ___default["default"].get(item, ["query", "q/from"]);
|
|
914
|
+
case "feed":
|
|
915
|
+
return deleteExpressionWithNotFoundFieldsOrTypesInFeedView(schema, view);
|
|
664
916
|
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
$apply: xExpression => xExpression ? visitor.visitExpression(fromType, xExpression) : xExpression
|
|
668
|
-
},
|
|
669
|
-
yExpression: {
|
|
670
|
-
$apply: yExpression => yExpression ? visitor.visitExpression(fromType, yExpression) : yExpression
|
|
671
|
-
},
|
|
672
|
-
contextExpression: {
|
|
673
|
-
$apply: contextExpression => contextExpression ? visitor.visitExpression(fromType, contextExpression) : contextExpression
|
|
674
|
-
},
|
|
675
|
-
query: {
|
|
676
|
-
$apply: query => query ? visitor.visitQueryExpression(query) : null
|
|
677
|
-
},
|
|
678
|
-
units: {
|
|
679
|
-
$apply: units => units ? units.map(unit => visitViewUnit(fromType, unit, visitor)).filter(unit => isUnitExpressionValid(unit)) : null
|
|
680
|
-
},
|
|
681
|
-
colorCoding: {
|
|
682
|
-
$apply: colorCodings => {
|
|
683
|
-
return colorCodings ? colorCodings.map(colorCoding => _extends({}, colorCoding, {
|
|
684
|
-
expression: visitor.visitExpression(fromType, colorCoding.expression)
|
|
685
|
-
})).filter(colorCoding => colorCoding.expression !== null) : undefined;
|
|
686
|
-
}
|
|
687
|
-
}
|
|
688
|
-
}) : item;
|
|
689
|
-
}).filter(item => {
|
|
690
|
-
const {
|
|
691
|
-
query
|
|
692
|
-
} = item;
|
|
693
|
-
return query ? item : null;
|
|
694
|
-
})
|
|
695
|
-
}
|
|
917
|
+
default:
|
|
918
|
+
return view;
|
|
696
919
|
}
|
|
697
|
-
});
|
|
698
|
-
|
|
699
|
-
const replaceNamesWithIdsViewVisitor = schema => {
|
|
700
|
-
const visitor = {
|
|
701
|
-
visitQueryExpression: queryExpression => replaceNamesWithIdsInQueryExpression(schema, queryExpression),
|
|
702
|
-
visitExpression: (fromType, expression) => replaceNamesWithIdsInExpression(schema, fromType, expression),
|
|
703
|
-
visitEnums: enums => ___default["default"].entries(enums).reduce((result, [type, queryHolder]) => {
|
|
704
|
-
if (schema.typeObjectsByName.hasOwnProperty(type)) {
|
|
705
|
-
const typeObject = schema.typeObjectsByName[type];
|
|
706
|
-
|
|
707
|
-
const fromType = ___default["default"].get(queryHolder, ["query", "q/from"]);
|
|
708
|
-
|
|
709
|
-
const axisWithVisitedQuery = visitQueryExpressionHolder(queryHolder, visitor);
|
|
710
|
-
result[typeObject.id] = visitAxisUnits(axisWithVisitedQuery, fromType, visitor);
|
|
711
|
-
} else {
|
|
712
|
-
result[type] = queryHolder;
|
|
713
|
-
}
|
|
714
|
-
|
|
715
|
-
return result;
|
|
716
|
-
}, {})
|
|
717
|
-
};
|
|
718
|
-
return visitor;
|
|
719
920
|
};
|
|
720
|
-
|
|
721
|
-
const replaceIdsWithNamesViewVisitor = schema => {
|
|
722
|
-
const visitor = {
|
|
723
|
-
visitQueryExpression: queryExpression => replaceIdsWithNamesInQueryExpression(schema, queryExpression),
|
|
724
|
-
visitExpression: (fromType, expression) => replaceIdsWithNamesInExpression(schema, fromType, expression),
|
|
725
|
-
visitEnums: enums => ___default["default"].entries(enums).reduce((result, [typeId, queryHolder]) => {
|
|
726
|
-
if (schema.typeObjectsById.hasOwnProperty(typeId)) {
|
|
727
|
-
const typeObject = schema.typeObjectsById[typeId];
|
|
728
|
-
|
|
729
|
-
const fromType = ___default["default"].get(queryHolder, ["query", "q/from"]);
|
|
730
|
-
|
|
731
|
-
const axisWithVisitedQuery = visitQueryExpressionHolder(queryHolder, visitor);
|
|
732
|
-
result[typeObject.name] = visitAxisUnits(axisWithVisitedQuery, fromType, visitor);
|
|
733
|
-
} else {
|
|
734
|
-
result[typeId] = queryHolder;
|
|
735
|
-
}
|
|
736
|
-
|
|
737
|
-
return result;
|
|
738
|
-
}, {})
|
|
739
|
-
};
|
|
740
|
-
return visitor;
|
|
741
|
-
};
|
|
742
|
-
|
|
743
|
-
const deleteExpressionWithNotFoundFieldsOrTypesViewVisitor = schema => {
|
|
744
|
-
const visitor = {
|
|
745
|
-
visitQueryExpression: queryExpression => deleteExpressionWithNotFoundFieldsOrTypesInQueryExpression(schema, queryExpression),
|
|
746
|
-
visitExpression: (fromType, expression) => deleteExpressionWithNotFoundFieldsOrTypesInExpression(schema, fromType, expression),
|
|
747
|
-
visitEnums: enums => {
|
|
748
|
-
const enumsNew = ___default["default"].entries(enums).reduce((result, [type, queryHolder]) => {
|
|
749
|
-
if (schema.typeObjectsByName.hasOwnProperty(type)) {
|
|
750
|
-
const typeObject = schema.typeObjectsByName[type];
|
|
751
|
-
const queryHolderResult = visitQueryExpressionHolder(queryHolder, visitor);
|
|
752
|
-
|
|
753
|
-
if (queryHolderResult) {
|
|
754
|
-
result[typeObject.name] = queryHolderResult;
|
|
755
|
-
}
|
|
756
|
-
|
|
757
|
-
return result;
|
|
758
|
-
}
|
|
759
|
-
|
|
760
|
-
return result;
|
|
761
|
-
}, {});
|
|
762
|
-
|
|
763
|
-
return ___default["default"].isEmpty(enumsNew) ? null : enumsNew;
|
|
764
|
-
}
|
|
765
|
-
};
|
|
766
|
-
return visitor;
|
|
767
|
-
};
|
|
768
|
-
|
|
769
|
-
const replaceIdsWithNamesInBoardView = (schema, view) => visitView(view, replaceIdsWithNamesViewVisitor(schema));
|
|
770
|
-
const replaceNamesWithIdsInBoardView = (schema, view) => visitView(view, replaceNamesWithIdsViewVisitor(schema));
|
|
771
|
-
const deleteExpressionWithNotFoundOrInvalidFieldsOrTypesInBoardView = (schema, view) => {
|
|
772
|
-
const viewNew = visitView(view, deleteExpressionWithNotFoundFieldsOrTypesViewVisitor(schema));
|
|
773
|
-
return ensureAxisAndItemExpressionInvariant(viewNew);
|
|
774
|
-
};
|
|
775
|
-
|
|
776
|
-
const deleteExpressionWithNotFoundFieldsOrTypesInView = (schema, view) => {
|
|
921
|
+
const fixUserSelectedUnits = (schema, view) => {
|
|
777
922
|
switch (view["fibery/type"]) {
|
|
778
923
|
case "board":
|
|
779
|
-
return
|
|
924
|
+
return fixUserSelectedUnitsInBoardView(schema, view);
|
|
780
925
|
|
|
781
|
-
case "
|
|
782
|
-
return
|
|
926
|
+
case "table":
|
|
927
|
+
return fixUserSelectedUnitsInTableView(schema, view);
|
|
783
928
|
|
|
784
929
|
case "timeline":
|
|
785
|
-
return
|
|
930
|
+
return fixUserSelectedUnitsInTimelineView(schema, view);
|
|
786
931
|
|
|
787
932
|
case "calendar":
|
|
788
|
-
return
|
|
933
|
+
return fixUserSelectedUnitsInCalendarView(schema, view);
|
|
789
934
|
|
|
790
|
-
case "
|
|
791
|
-
return
|
|
935
|
+
case "feed":
|
|
936
|
+
return fixUserSelectedUnitsInFeedView(schema, view);
|
|
792
937
|
|
|
793
938
|
default:
|
|
794
939
|
return view;
|
|
@@ -811,6 +956,9 @@ const replaceNamesWithIdsInView = (schema, view) => {
|
|
|
811
956
|
case "calendar":
|
|
812
957
|
return replaceNamesWithIdsInCalendarView(schema, view);
|
|
813
958
|
|
|
959
|
+
case "feed":
|
|
960
|
+
return replaceNamesWithIdsInFeedView(schema, view);
|
|
961
|
+
|
|
814
962
|
default:
|
|
815
963
|
return view;
|
|
816
964
|
}
|
|
@@ -832,6 +980,9 @@ const replaceIdsWithNamesInView = (schema, view) => {
|
|
|
832
980
|
case "calendar":
|
|
833
981
|
return replaceIdsWithNamesInCalendarView(schema, view);
|
|
834
982
|
|
|
983
|
+
case "feed":
|
|
984
|
+
return replaceIdsWithNamesInFeedView(schema, view);
|
|
985
|
+
|
|
835
986
|
default:
|
|
836
987
|
return view;
|
|
837
988
|
}
|
|
@@ -848,6 +999,7 @@ const getViewCardTypes = ({
|
|
|
848
999
|
|
|
849
1000
|
exports.deleteExpressionWithNotFoundFieldsOrTypesInSmartFolder = deleteExpressionWithNotFoundFieldsOrTypesInSmartFolder;
|
|
850
1001
|
exports.deleteExpressionWithNotFoundFieldsOrTypesInView = deleteExpressionWithNotFoundFieldsOrTypesInView;
|
|
1002
|
+
exports.fixUserSelectedUnits = fixUserSelectedUnits;
|
|
851
1003
|
exports.getViewCardTypes = getViewCardTypes;
|
|
852
1004
|
exports.replaceIdsWithNamesInSmartFolder = replaceIdsWithNamesInSmartFolder;
|
|
853
1005
|
exports.replaceIdsWithNamesInView = replaceIdsWithNamesInView;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fibery/views",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.4",
|
|
4
4
|
"description": "Operations on view objects",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"author": "Fibery",
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
"microbundle": "0.14.1"
|
|
22
22
|
},
|
|
23
23
|
"peerDependencies": {
|
|
24
|
-
"@fibery/expression-utils": "^1.1.
|
|
24
|
+
"@fibery/expression-utils": "^1.1.4",
|
|
25
25
|
"fibery-schema": "^7.0.6",
|
|
26
26
|
"immutability-helper": "^2.4.0",
|
|
27
27
|
"lodash": "^4.17.21"
|