@vizzly/dashboard 0.15.0-dev-c26eea398f17837a76a9c9b8753b763acc4820b8 → 0.15.0-dev-641cbfac7b4b489d218fea2f77a8c1c3eb2b0d96
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/dist/dashboard.cjs.development.js +261 -223
- package/dist/dashboard.cjs.production.min.js +1 -1
- package/dist/dashboard.esm.js +261 -223
- package/dist/results-driver/src/driver/VizzlyQuery/AdditionalFilter/toQueries.d.ts +4 -0
- package/dist/shared-logic/src/AdditionalFilter/AdditionalFilter.d.ts +6 -6
- package/dist/shared-logic/src/AdditionalFilter/FilterConfig.d.ts +1 -1
- package/dist/shared-logic/src/AdditionalFilter/toQueryAttributesFilter.d.ts +2 -2
- package/dist/shared-logic/src/AdditionalFilter/types.d.ts +1 -1
- package/dist/shared-logic/src/CustomField/CustomMetric/build.d.ts +1 -1
- package/dist/shared-logic/src/CustomField/CustomMetric/combineForCustomMetricFilters.d.ts +2 -0
- package/dist/shared-logic/src/CustomField/Percentage/index.d.ts +2 -2
- package/dist/shared-logic/src/Filter/Filter.d.ts +3 -3
- package/dist/shared-logic/src/Filter/combineFilters.d.ts +0 -1
- package/dist/shared-logic/src/Query/Query.d.ts +1 -1
- package/package.json +1 -1
- package/dist/shared-logic/src/CustomField/CustomMetric/combineFilters.d.ts +0 -2
package/dist/dashboard.esm.js
CHANGED
|
@@ -1110,26 +1110,98 @@ var FieldNotFoundInDataSet = /*#__PURE__*/function (_ValidationError) {
|
|
|
1110
1110
|
return FieldNotFoundInDataSet;
|
|
1111
1111
|
}(ValidationError);
|
|
1112
1112
|
|
|
1113
|
-
var
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1113
|
+
var VariableNotFoundForVariables = /*#__PURE__*/function (_ValidationError) {
|
|
1114
|
+
function VariableNotFoundForVariables(variableList, missingVariableId) {
|
|
1115
|
+
var _this;
|
|
1116
|
+
_this = _ValidationError.call(this, "\n An expected variable is missing from the defined Variables.\n\n Missing '" + missingVariableId + "'. Got;\n " + JSON.stringify(variableList) + "\n ") || this;
|
|
1117
|
+
_this.missingVariableId = void 0;
|
|
1118
|
+
_this.name = 'VariableNotFoundForVariables';
|
|
1119
|
+
_this.missingVariableId = missingVariableId;
|
|
1120
|
+
return _this;
|
|
1117
1121
|
}
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1122
|
+
_inheritsLoose(VariableNotFoundForVariables, _ValidationError);
|
|
1123
|
+
var _proto = VariableNotFoundForVariables.prototype;
|
|
1124
|
+
_proto.getMissingFieldId = function getMissingFieldId() {
|
|
1125
|
+
return this.missingVariableId;
|
|
1126
|
+
};
|
|
1127
|
+
return VariableNotFoundForVariables;
|
|
1128
|
+
}(ValidationError);
|
|
1129
|
+
|
|
1130
|
+
var detect = function detect(input) {
|
|
1131
|
+
var regex = /\{\{\s*([^\s{}][^{}]*?)\s*\}\}/g;
|
|
1132
|
+
var matches = [];
|
|
1133
|
+
var match;
|
|
1134
|
+
while ((match = regex.exec(input)) !== null) {
|
|
1135
|
+
matches.push(match[1].trim());
|
|
1136
|
+
}
|
|
1137
|
+
return matches.length > 0 ? matches : undefined;
|
|
1138
|
+
};
|
|
1139
|
+
var build$1 = function build(variables) {
|
|
1140
|
+
if (variables) {
|
|
1141
|
+
var dashboardDefinedVariables = variables();
|
|
1142
|
+
logInfo('Detected variables', dashboardDefinedVariables);
|
|
1143
|
+
return dashboardDefinedVariables;
|
|
1144
|
+
}
|
|
1145
|
+
return {};
|
|
1146
|
+
};
|
|
1147
|
+
var findVariable = function findVariable(value, detect, variableList) {
|
|
1148
|
+
if (!variableList) return undefined;
|
|
1149
|
+
|
|
1150
|
+
// Use the detect function to check if the value is a variable
|
|
1151
|
+
var variables = detect(value);
|
|
1152
|
+
|
|
1153
|
+
// If no variables are detected, return early
|
|
1154
|
+
if (!variables || variables.length === 0) {
|
|
1155
|
+
return undefined; // Early return if the value is not a variable
|
|
1121
1156
|
}
|
|
1157
|
+
var matchedVariables = [];
|
|
1122
1158
|
|
|
1123
|
-
//
|
|
1124
|
-
var
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1159
|
+
// Check for matching variables in the variable list
|
|
1160
|
+
for (var _iterator = _createForOfIteratorHelperLoose(variables), _step; !(_step = _iterator()).done;) {
|
|
1161
|
+
var variable = _step.value;
|
|
1162
|
+
var variableEntry = variableList[variable];
|
|
1163
|
+
if (variableEntry) {
|
|
1164
|
+
// If the variable is found but its value is undefined or empty, throw an error
|
|
1165
|
+
if (variableEntry.value === undefined || variableEntry.value === '') {
|
|
1166
|
+
throw new Error("Variable '" + variable + "' is defined in the list but has no value.");
|
|
1167
|
+
}
|
|
1168
|
+
|
|
1169
|
+
// Add the variable to the matched variables list
|
|
1170
|
+
matchedVariables.push(variable);
|
|
1171
|
+
}
|
|
1172
|
+
}
|
|
1173
|
+
|
|
1174
|
+
// If no matches are found, throw an error
|
|
1175
|
+
if (matchedVariables.length === 0 && value) {
|
|
1176
|
+
throw new VariableNotFoundForVariables(variableList, value);
|
|
1177
|
+
}
|
|
1178
|
+
return matchedVariables.length > 0 ? matchedVariables : undefined;
|
|
1179
|
+
};
|
|
1180
|
+
var useValue = function useValue(value, variables) {
|
|
1181
|
+
if (typeof value === 'string') {
|
|
1182
|
+
var valueHasVariables = detect(value);
|
|
1183
|
+
if (valueHasVariables && variables) {
|
|
1184
|
+
for (var _iterator2 = _createForOfIteratorHelperLoose(valueHasVariables), _step2; !(_step2 = _iterator2()).done;) {
|
|
1185
|
+
var key = _step2.value;
|
|
1186
|
+
if (key in variables) {
|
|
1187
|
+
return extractValue(variables, key);
|
|
1188
|
+
}
|
|
1189
|
+
}
|
|
1190
|
+
}
|
|
1191
|
+
}
|
|
1192
|
+
return value;
|
|
1193
|
+
};
|
|
1194
|
+
var validate = function validate(value, variables) {
|
|
1195
|
+
try {
|
|
1196
|
+
findVariable(value, detect, variables);
|
|
1197
|
+
return true;
|
|
1198
|
+
} catch (e) {
|
|
1129
1199
|
return false;
|
|
1130
1200
|
}
|
|
1131
|
-
return true;
|
|
1132
1201
|
};
|
|
1202
|
+
function extractValue(variables, key) {
|
|
1203
|
+
return variables[key].value;
|
|
1204
|
+
}
|
|
1133
1205
|
|
|
1134
1206
|
var _Joi$string, _Joi$string2;
|
|
1135
1207
|
var defaultDurationOptions = function defaultDurationOptions(textOverride) {
|
|
@@ -1243,107 +1315,6 @@ var buildRelativeRange = function buildRelativeRange(relativeFilters, dataSet, a
|
|
|
1243
1315
|
});
|
|
1244
1316
|
};
|
|
1245
1317
|
|
|
1246
|
-
var getUTCDate = function getUTCDate(date) {
|
|
1247
|
-
if (date !== null) {
|
|
1248
|
-
var momentDate = moment(new Date(date));
|
|
1249
|
-
return momentDate.tz(Intl.DateTimeFormat().resolvedOptions().timeZone)._d;
|
|
1250
|
-
}
|
|
1251
|
-
return date;
|
|
1252
|
-
};
|
|
1253
|
-
|
|
1254
|
-
var VariableNotFoundForVariables = /*#__PURE__*/function (_ValidationError) {
|
|
1255
|
-
function VariableNotFoundForVariables(variableList, missingVariableId) {
|
|
1256
|
-
var _this;
|
|
1257
|
-
_this = _ValidationError.call(this, "\n An expected variable is missing from the defined Variables.\n\n Missing '" + missingVariableId + "'. Got;\n " + JSON.stringify(variableList) + "\n ") || this;
|
|
1258
|
-
_this.missingVariableId = void 0;
|
|
1259
|
-
_this.name = 'VariableNotFoundForVariables';
|
|
1260
|
-
_this.missingVariableId = missingVariableId;
|
|
1261
|
-
return _this;
|
|
1262
|
-
}
|
|
1263
|
-
_inheritsLoose(VariableNotFoundForVariables, _ValidationError);
|
|
1264
|
-
var _proto = VariableNotFoundForVariables.prototype;
|
|
1265
|
-
_proto.getMissingFieldId = function getMissingFieldId() {
|
|
1266
|
-
return this.missingVariableId;
|
|
1267
|
-
};
|
|
1268
|
-
return VariableNotFoundForVariables;
|
|
1269
|
-
}(ValidationError);
|
|
1270
|
-
|
|
1271
|
-
var detect = function detect(input) {
|
|
1272
|
-
var regex = /\{\{\s*([^\s{}][^{}]*?)\s*\}\}/g;
|
|
1273
|
-
var matches = [];
|
|
1274
|
-
var match;
|
|
1275
|
-
while ((match = regex.exec(input)) !== null) {
|
|
1276
|
-
matches.push(match[1].trim());
|
|
1277
|
-
}
|
|
1278
|
-
return matches.length > 0 ? matches : undefined;
|
|
1279
|
-
};
|
|
1280
|
-
var build$1 = function build(variables) {
|
|
1281
|
-
if (variables) {
|
|
1282
|
-
var dashboardDefinedVariables = variables();
|
|
1283
|
-
logInfo('Detected variables', dashboardDefinedVariables);
|
|
1284
|
-
return dashboardDefinedVariables;
|
|
1285
|
-
}
|
|
1286
|
-
return {};
|
|
1287
|
-
};
|
|
1288
|
-
var findVariable = function findVariable(value, detect, variableList) {
|
|
1289
|
-
if (!variableList) return undefined;
|
|
1290
|
-
|
|
1291
|
-
// Use the detect function to check if the value is a variable
|
|
1292
|
-
var variables = detect(value);
|
|
1293
|
-
|
|
1294
|
-
// If no variables are detected, return early
|
|
1295
|
-
if (!variables || variables.length === 0) {
|
|
1296
|
-
return undefined; // Early return if the value is not a variable
|
|
1297
|
-
}
|
|
1298
|
-
var matchedVariables = [];
|
|
1299
|
-
|
|
1300
|
-
// Check for matching variables in the variable list
|
|
1301
|
-
for (var _iterator = _createForOfIteratorHelperLoose(variables), _step; !(_step = _iterator()).done;) {
|
|
1302
|
-
var variable = _step.value;
|
|
1303
|
-
var variableEntry = variableList[variable];
|
|
1304
|
-
if (variableEntry) {
|
|
1305
|
-
// If the variable is found but its value is undefined or empty, throw an error
|
|
1306
|
-
if (variableEntry.value === undefined || variableEntry.value === '') {
|
|
1307
|
-
throw new Error("Variable '" + variable + "' is defined in the list but has no value.");
|
|
1308
|
-
}
|
|
1309
|
-
|
|
1310
|
-
// Add the variable to the matched variables list
|
|
1311
|
-
matchedVariables.push(variable);
|
|
1312
|
-
}
|
|
1313
|
-
}
|
|
1314
|
-
|
|
1315
|
-
// If no matches are found, throw an error
|
|
1316
|
-
if (matchedVariables.length === 0 && value) {
|
|
1317
|
-
throw new VariableNotFoundForVariables(variableList, value);
|
|
1318
|
-
}
|
|
1319
|
-
return matchedVariables.length > 0 ? matchedVariables : undefined;
|
|
1320
|
-
};
|
|
1321
|
-
var useValue = function useValue(value, variables) {
|
|
1322
|
-
if (typeof value === 'string') {
|
|
1323
|
-
var valueHasVariables = detect(value);
|
|
1324
|
-
if (valueHasVariables && variables) {
|
|
1325
|
-
for (var _iterator2 = _createForOfIteratorHelperLoose(valueHasVariables), _step2; !(_step2 = _iterator2()).done;) {
|
|
1326
|
-
var key = _step2.value;
|
|
1327
|
-
if (key in variables) {
|
|
1328
|
-
return extractValue(variables, key);
|
|
1329
|
-
}
|
|
1330
|
-
}
|
|
1331
|
-
}
|
|
1332
|
-
}
|
|
1333
|
-
return value;
|
|
1334
|
-
};
|
|
1335
|
-
var validate = function validate(value, variables) {
|
|
1336
|
-
try {
|
|
1337
|
-
findVariable(value, detect, variables);
|
|
1338
|
-
return true;
|
|
1339
|
-
} catch (e) {
|
|
1340
|
-
return false;
|
|
1341
|
-
}
|
|
1342
|
-
};
|
|
1343
|
-
function extractValue(variables, key) {
|
|
1344
|
-
return variables[key].value;
|
|
1345
|
-
}
|
|
1346
|
-
|
|
1347
1318
|
/** Upcasts from an old global filter, to a new "additional filter" */
|
|
1348
1319
|
var upcastToAdditionalFilter = function upcastToAdditionalFilter(globalFilter) {
|
|
1349
1320
|
if (globalFilter.type == 'globalSelectFilter') {
|
|
@@ -1395,6 +1366,14 @@ var MULTI_SELECT_FILTER = 'multiSelectFilter';
|
|
|
1395
1366
|
var NUMERIC_FILTER = 'numericFilter';
|
|
1396
1367
|
var ADVANCED_FILTER = 'advancedFilter';
|
|
1397
1368
|
|
|
1369
|
+
var getUTCDate = function getUTCDate(date) {
|
|
1370
|
+
if (date !== null) {
|
|
1371
|
+
var momentDate = moment(new Date(date));
|
|
1372
|
+
return momentDate.tz(Intl.DateTimeFormat().resolvedOptions().timeZone)._d;
|
|
1373
|
+
}
|
|
1374
|
+
return date;
|
|
1375
|
+
};
|
|
1376
|
+
|
|
1398
1377
|
var toQueryAttributesFilter = function toQueryAttributesFilter(dataSet, filter, customTimeRangeFuncs) {
|
|
1399
1378
|
return filter.appliesToFields.flatMap(function (field) {
|
|
1400
1379
|
var _filter$value, _filter$value2, _filter$value3;
|
|
@@ -1404,11 +1383,11 @@ var toQueryAttributesFilter = function toQueryAttributesFilter(dataSet, filter,
|
|
|
1404
1383
|
|
|
1405
1384
|
// might be able to remove this
|
|
1406
1385
|
if (dataSetField.dataType == 'string[]' && filter.type !== MULTI_SELECT_FILTER && !isAdditionalFilter(filter.value)) {
|
|
1407
|
-
return [{
|
|
1386
|
+
return [[{
|
|
1408
1387
|
field: field.fieldId,
|
|
1409
1388
|
op: 'array_contains',
|
|
1410
1389
|
value: filter.value
|
|
1411
|
-
}];
|
|
1390
|
+
}]];
|
|
1412
1391
|
}
|
|
1413
1392
|
if ((filter.type == DATE_FILTER || filter.type == DATE_AND_TIME_FILTER) && ((_filter$value = filter.value) == null ? void 0 : _filter$value.type) == 'relativeRange') {
|
|
1414
1393
|
return [];
|
|
@@ -1416,7 +1395,7 @@ var toQueryAttributesFilter = function toQueryAttributesFilter(dataSet, filter,
|
|
|
1416
1395
|
if ((filter.type == DATE_FILTER || filter.type == DATE_AND_TIME_FILTER) && ((_filter$value2 = filter.value) == null ? void 0 : _filter$value2.type) == 'fixedRange') {
|
|
1417
1396
|
// We have a fixed time range, so we can use those values.
|
|
1418
1397
|
|
|
1419
|
-
return [{
|
|
1398
|
+
return [[{
|
|
1420
1399
|
field: field.fieldId,
|
|
1421
1400
|
op: inclusiveExclusiveCurrent(DateOp.Greater, filter),
|
|
1422
1401
|
value: getUTCDate(filter.value.after)
|
|
@@ -1424,27 +1403,31 @@ var toQueryAttributesFilter = function toQueryAttributesFilter(dataSet, filter,
|
|
|
1424
1403
|
field: field.fieldId,
|
|
1425
1404
|
op: inclusiveExclusiveCurrent(DateOp.Less, filter),
|
|
1426
1405
|
value: getUTCDate(filter.value.before)
|
|
1427
|
-
}];
|
|
1406
|
+
}]];
|
|
1428
1407
|
} else if ((filter.type == DATE_FILTER || filter.type == DATE_AND_TIME_FILTER) && ((_filter$value3 = filter.value) == null ? void 0 : _filter$value3.type) == 'relative') {
|
|
1429
1408
|
// We have a relative time filter, so need to call the time functions to get the values....
|
|
1430
1409
|
|
|
1431
1410
|
var _customTimeRangeFuncs = customTimeRangeFuncs[filter.value.value].range,
|
|
1432
1411
|
before = _customTimeRangeFuncs.before,
|
|
1433
1412
|
after = _customTimeRangeFuncs.after;
|
|
1434
|
-
var filters = [];
|
|
1413
|
+
var filters = [[]];
|
|
1435
1414
|
if (before) {
|
|
1436
|
-
filters =
|
|
1437
|
-
|
|
1438
|
-
|
|
1439
|
-
|
|
1440
|
-
|
|
1415
|
+
filters = filters.map(function (f) {
|
|
1416
|
+
return [].concat(f, [{
|
|
1417
|
+
field: field.fieldId,
|
|
1418
|
+
op: inclusiveExclusiveCurrent(DateOp.Less, filter),
|
|
1419
|
+
value: before
|
|
1420
|
+
}]);
|
|
1421
|
+
});
|
|
1441
1422
|
}
|
|
1442
1423
|
if (after) {
|
|
1443
|
-
filters =
|
|
1444
|
-
|
|
1445
|
-
|
|
1446
|
-
|
|
1447
|
-
|
|
1424
|
+
filters = filters.map(function (f) {
|
|
1425
|
+
return [].concat(f, [{
|
|
1426
|
+
field: field.fieldId,
|
|
1427
|
+
op: inclusiveExclusiveCurrent(DateOp.Greater, filter),
|
|
1428
|
+
value: after
|
|
1429
|
+
}]);
|
|
1430
|
+
});
|
|
1448
1431
|
}
|
|
1449
1432
|
return filters;
|
|
1450
1433
|
} else if (filter.type == SINGLE_SELECT_FILTER) {
|
|
@@ -1452,31 +1435,31 @@ var toQueryAttributesFilter = function toQueryAttributesFilter(dataSet, filter,
|
|
|
1452
1435
|
if (filter.value === NULL_VALUE_OPT) {
|
|
1453
1436
|
value = null;
|
|
1454
1437
|
}
|
|
1455
|
-
return [{
|
|
1438
|
+
return [[{
|
|
1456
1439
|
field: field.fieldId,
|
|
1457
1440
|
op: '=',
|
|
1458
1441
|
value: value
|
|
1459
|
-
}];
|
|
1442
|
+
}]];
|
|
1460
1443
|
} else if (isAdditionalFilter(filter.value)) {
|
|
1461
1444
|
return buildAdvancedFilters(filter.value, field, dataSet.id);
|
|
1462
1445
|
} else if (filter.type == MULTI_SELECT_FILTER && filter.value.length > 0) {
|
|
1463
|
-
return [{
|
|
1446
|
+
return [[{
|
|
1464
1447
|
field: field.fieldId,
|
|
1465
1448
|
op: 'is_one_of',
|
|
1466
1449
|
value: filter.value
|
|
1467
|
-
}];
|
|
1450
|
+
}]];
|
|
1468
1451
|
} else if (filter.type == DATE_FILTER && !filter.value || filter.type == DATE_AND_TIME_FILTER && !filter.value || filter.type == MULTI_SELECT_FILTER && filter.value.length === 0) {
|
|
1469
1452
|
// No value set on the filter, so it cannot become a query attribute.
|
|
1470
1453
|
return [];
|
|
1471
1454
|
} else if (filter.type == NUMERIC_FILTER) {
|
|
1472
1455
|
if ('op' in filter.value && 'value' in filter.value) {
|
|
1473
|
-
return [{
|
|
1456
|
+
return [[{
|
|
1474
1457
|
field: field.fieldId,
|
|
1475
1458
|
op: filter.value.op,
|
|
1476
1459
|
value: filter.value.value
|
|
1477
|
-
}];
|
|
1460
|
+
}]];
|
|
1478
1461
|
}
|
|
1479
|
-
return [];
|
|
1462
|
+
return [[]];
|
|
1480
1463
|
}
|
|
1481
1464
|
throw "Cannot convert filter type " + filter.type + " to query attributes filter. " + JSON.stringify(filter);
|
|
1482
1465
|
});
|
|
@@ -1538,16 +1521,16 @@ var toRelativeQueryAttributesFilters = function toRelativeQueryAttributesFilters
|
|
|
1538
1521
|
var _filters$value;
|
|
1539
1522
|
if (((_filters$value = filters.value) == null ? void 0 : _filters$value.type) !== 'relativeRange') return [];
|
|
1540
1523
|
if (filters.value.filters.length === 0) return [];
|
|
1541
|
-
var resolvedFilters = [];
|
|
1542
1524
|
var preparedFilters = buildRelativeRange(filters.value.filters, dataSet, filters.appliesToFields);
|
|
1543
|
-
preparedFilters
|
|
1544
|
-
|
|
1545
|
-
|
|
1546
|
-
|
|
1547
|
-
|
|
1525
|
+
return preparedFilters.map(function (filter) {
|
|
1526
|
+
return filter.map(function (f) {
|
|
1527
|
+
return {
|
|
1528
|
+
field: f.field,
|
|
1529
|
+
op: f.op,
|
|
1530
|
+
value: calculateRelativeDate(f.value, startDate)
|
|
1531
|
+
};
|
|
1548
1532
|
});
|
|
1549
1533
|
});
|
|
1550
|
-
return resolvedFilters;
|
|
1551
1534
|
};
|
|
1552
1535
|
var hasActiveFilter = function hasActiveFilter(additionalFilters) {
|
|
1553
1536
|
return some(additionalFilters, function (_ref) {
|
|
@@ -1691,14 +1674,17 @@ function getCascadeOptionsFilters(globalFilters, dataSets, dateFilterOptions, ca
|
|
|
1691
1674
|
if (Array.isArray(dataObj.value) && dataObj.value.length === 0) {
|
|
1692
1675
|
return acc;
|
|
1693
1676
|
}
|
|
1694
|
-
dataObj.appliesToFields.
|
|
1695
|
-
|
|
1677
|
+
var uniqueDataSetIds = new Set(dataObj.appliesToFields.map(function (f) {
|
|
1678
|
+
return f.dataSetId;
|
|
1679
|
+
}));
|
|
1680
|
+
uniqueDataSetIds.forEach(function (dataSetId) {
|
|
1696
1681
|
var dataSet = find(dataSets, dataSetId);
|
|
1697
1682
|
if (!acc[dataSetId]) {
|
|
1698
1683
|
acc[dataSetId] = [];
|
|
1699
1684
|
}
|
|
1700
1685
|
if (dataSet !== null) {
|
|
1701
|
-
|
|
1686
|
+
var filters = toQueryAttributesFilter(dataSet, dataObj, dateFilterOptions);
|
|
1687
|
+
acc[dataSetId] = addAndFilters(acc[dataSetId], filters);
|
|
1702
1688
|
}
|
|
1703
1689
|
});
|
|
1704
1690
|
}
|
|
@@ -1724,14 +1710,21 @@ function removeEmptyConditions(conditions) {
|
|
|
1724
1710
|
}
|
|
1725
1711
|
var buildAdvancedFilters = function buildAdvancedFilters(filterValue, field, dataSetId) {
|
|
1726
1712
|
if (!filterValue) return [];
|
|
1727
|
-
|
|
1713
|
+
var hasValidConditions = Array.isArray(filterValue) && filterValue.every(function (conditionGroup) {
|
|
1714
|
+
return Array.isArray(conditionGroup);
|
|
1715
|
+
});
|
|
1716
|
+
if (hasValidConditions) {
|
|
1728
1717
|
filterValue = removeEmptyConditions(filterValue);
|
|
1729
1718
|
if (filterValue.length === 0) return [];
|
|
1730
1719
|
if (field.dataSetId !== dataSetId) return [];
|
|
1731
|
-
var correctFiltersForField = filterValue
|
|
1732
|
-
return filter
|
|
1720
|
+
var correctFiltersForField = filterValue.map(function (conditionGroup) {
|
|
1721
|
+
return conditionGroup.filter(function (filter) {
|
|
1722
|
+
return filter.field === field.fieldId;
|
|
1723
|
+
});
|
|
1724
|
+
}).filter(function (conditionGroup) {
|
|
1725
|
+
return conditionGroup.length > 0;
|
|
1733
1726
|
});
|
|
1734
|
-
return correctFiltersForField
|
|
1727
|
+
return correctFiltersForField;
|
|
1735
1728
|
}
|
|
1736
1729
|
return [];
|
|
1737
1730
|
};
|
|
@@ -1760,7 +1753,8 @@ var fromFilterConfig = function fromFilterConfig(filterConfig, dataSet, timeRang
|
|
|
1760
1753
|
if (additionalFilter.type === DATE_AND_TIME_FILTER || additionalFilter.type === DATE_FILTER) {
|
|
1761
1754
|
addFilter = toRelativeQueryAttributesFilters(additionalFilter, dataSet);
|
|
1762
1755
|
}
|
|
1763
|
-
filters =
|
|
1756
|
+
filters = addAndFilters(filters, addFilter);
|
|
1757
|
+
filters = addAndFilters(filters, toQueryAttributesFilter(dataSet, additionalFilter, timeRangeOptions));
|
|
1764
1758
|
});
|
|
1765
1759
|
var localAdditionalFilters = Object.values(filterConfig.localFilters || {}).flat();
|
|
1766
1760
|
localAdditionalFilters.forEach(function (additionalFilter) {
|
|
@@ -1768,24 +1762,57 @@ var fromFilterConfig = function fromFilterConfig(filterConfig, dataSet, timeRang
|
|
|
1768
1762
|
if (additionalFilter.type === DATE_AND_TIME_FILTER || additionalFilter.type === DATE_FILTER) {
|
|
1769
1763
|
addFilter = toRelativeQueryAttributesFilters(additionalFilter, dataSet);
|
|
1770
1764
|
}
|
|
1771
|
-
filters =
|
|
1765
|
+
filters = addAndFilters(filters, addFilter);
|
|
1766
|
+
filters = addAndFilters(filters, toQueryAttributesFilter(dataSet, additionalFilter, timeRangeOptions));
|
|
1772
1767
|
});
|
|
1773
1768
|
return filters;
|
|
1774
1769
|
};
|
|
1775
1770
|
|
|
1771
|
+
var filterIsDate = function filterIsDate(filter) {
|
|
1772
|
+
var isoDateRegex = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{3}Z$/;
|
|
1773
|
+
if (!isoDateRegex.test(filter.value)) {
|
|
1774
|
+
return false;
|
|
1775
|
+
}
|
|
1776
|
+
var date = new Date(filter.value);
|
|
1777
|
+
if (isNaN(date.getTime())) {
|
|
1778
|
+
return false;
|
|
1779
|
+
}
|
|
1780
|
+
|
|
1781
|
+
// Additional check to verify that the date parts match exactly
|
|
1782
|
+
var _filter$value$split$ = filter.value.split('T')[0].split('-').map(Number),
|
|
1783
|
+
year = _filter$value$split$[0],
|
|
1784
|
+
month = _filter$value$split$[1],
|
|
1785
|
+
day = _filter$value$split$[2];
|
|
1786
|
+
if (date.getUTCFullYear() !== year || date.getUTCMonth() + 1 !== month || date.getUTCDate() !== day) {
|
|
1787
|
+
return false;
|
|
1788
|
+
}
|
|
1789
|
+
return true;
|
|
1790
|
+
};
|
|
1791
|
+
|
|
1776
1792
|
var addAndFilters = function addAndFilters(filter, filterToAddToAll) {
|
|
1777
1793
|
if (isEmpty$2(filterToAddToAll)) return [].concat(filter);
|
|
1778
1794
|
if (!filter || isEmpty$2(filter)) filter = [[]];
|
|
1779
|
-
|
|
1780
|
-
|
|
1781
|
-
|
|
1795
|
+
var result = [];
|
|
1796
|
+
for (var _iterator = _createForOfIteratorHelperLoose(filterToAddToAll), _step; !(_step = _iterator()).done;) {
|
|
1797
|
+
var additionalAndFilter = _step.value;
|
|
1798
|
+
for (var _iterator2 = _createForOfIteratorHelperLoose(filter), _step2; !(_step2 = _iterator2()).done;) {
|
|
1799
|
+
var andFilter = _step2.value;
|
|
1800
|
+
var combined = [].concat(additionalAndFilter, andFilter);
|
|
1801
|
+
if (!isEmpty$2(combined)) {
|
|
1802
|
+
result.push(combined);
|
|
1803
|
+
}
|
|
1804
|
+
}
|
|
1805
|
+
}
|
|
1806
|
+
return result;
|
|
1782
1807
|
};
|
|
1783
1808
|
var filterAttributeToQueryFilter = function filterAttributeToQueryFilter(filterAttrs, queryEngineConfig, dataSet, params) {
|
|
1784
1809
|
var _params$filterConfig;
|
|
1785
1810
|
// Either build using the filter attributes passed in, or take the viewFilters in the filter config.
|
|
1786
1811
|
// They represent the same thing, however some view-filters are passed around in the filter config
|
|
1787
1812
|
// to reduce custom metrics arguments being passed around.
|
|
1788
|
-
var filter = filterAttrs.length > 0
|
|
1813
|
+
var filter = filterAttrs.length > 0 && filterAttrs.some(function (group) {
|
|
1814
|
+
return group.length > 0;
|
|
1815
|
+
}) ? filterAttrs : ((_params$filterConfig = params.filterConfig) == null ? void 0 : _params$filterConfig.viewFilters) || [];
|
|
1789
1816
|
var extraFilters = fromFilterConfig(params.filterConfig, dataSet, params.timeRangeOptions);
|
|
1790
1817
|
var combinedFilters = addAndFilters(filter, extraFilters);
|
|
1791
1818
|
if (Array.isArray(filter)) {
|
|
@@ -1876,17 +1903,6 @@ var combineFilters = function combineFilters(array1, array2) {
|
|
|
1876
1903
|
return [[].concat(validArray1[0] || [], validArray2[0] || [])];
|
|
1877
1904
|
}
|
|
1878
1905
|
};
|
|
1879
|
-
function combineForCustomMetricFilters(filters, customFilters) {
|
|
1880
|
-
var combinedFilters = [];
|
|
1881
|
-
if (customFilters && isAvailable(customFilters)) {
|
|
1882
|
-
customFilters.forEach(function (orFilterGroup) {
|
|
1883
|
-
combinedFilters = [].concat(combinedFilters, addAndFilters(filters != null ? filters : [], orFilterGroup));
|
|
1884
|
-
});
|
|
1885
|
-
} else {
|
|
1886
|
-
combinedFilters = filters != null ? filters : [];
|
|
1887
|
-
}
|
|
1888
|
-
return combinedFilters;
|
|
1889
|
-
}
|
|
1890
1906
|
|
|
1891
1907
|
var generateId = function generateId() {
|
|
1892
1908
|
return v4().replace(/-/g, '');
|
|
@@ -1917,8 +1933,7 @@ var init$1 = function init(publicName, denominatorFieldId, denominatorAggregate,
|
|
|
1917
1933
|
};
|
|
1918
1934
|
var build$2 = function build(customField, queryEngineConfig, dataSet, _queryHasDimension, params) {
|
|
1919
1935
|
var _params$filterConfig$, _params$filterConfig, _customField$numerato, _customField$numerato2, _customField$denomina, _customField$denomina2;
|
|
1920
|
-
var
|
|
1921
|
-
var _buildPercentageFilte = buildPercentageFilters(addAndFilters((_params$filterConfig$ = params == null || (_params$filterConfig = params.filterConfig) == null ? void 0 : _params$filterConfig.viewFilters) != null ? _params$filterConfig$ : [], localAndDashboardFilters), customField),
|
|
1936
|
+
var _buildPercentageFilte = buildPercentageFilters((_params$filterConfig$ = params == null || (_params$filterConfig = params.filterConfig) == null ? void 0 : _params$filterConfig.viewFilters) != null ? _params$filterConfig$ : [], customField),
|
|
1922
1937
|
combinedNominatorFilters = _buildPercentageFilte.combinedNominatorFilters,
|
|
1923
1938
|
combinedDenominatorFilters = _buildPercentageFilte.combinedDenominatorFilters;
|
|
1924
1939
|
var left = {
|
|
@@ -2006,16 +2021,12 @@ function buildPercentageFilters(filters, customField) {
|
|
|
2006
2021
|
var combinedNominatorFilters = [];
|
|
2007
2022
|
var combinedDenominatorFilters = [];
|
|
2008
2023
|
if (customField.numeratorFilter && isAvailable(customField.numeratorFilter)) {
|
|
2009
|
-
customField.numeratorFilter
|
|
2010
|
-
combinedNominatorFilters = [].concat(combinedNominatorFilters, addAndFilters(filters != null ? filters : [], orFilterGroup));
|
|
2011
|
-
});
|
|
2024
|
+
combinedNominatorFilters = addAndFilters(filters != null ? filters : [], customField.numeratorFilter);
|
|
2012
2025
|
} else {
|
|
2013
2026
|
combinedNominatorFilters = filters != null ? filters : [];
|
|
2014
2027
|
}
|
|
2015
2028
|
if (customField.denominatorFilter && isAvailable(customField.denominatorFilter)) {
|
|
2016
|
-
customField.denominatorFilter
|
|
2017
|
-
combinedDenominatorFilters = [].concat(combinedDenominatorFilters, addAndFilters(filters != null ? filters : [], orFilterGroup));
|
|
2018
|
-
});
|
|
2029
|
+
combinedDenominatorFilters = addAndFilters(filters != null ? filters : [], customField.denominatorFilter);
|
|
2019
2030
|
} else {
|
|
2020
2031
|
combinedDenominatorFilters = filters != null ? filters : [];
|
|
2021
2032
|
}
|
|
@@ -2299,6 +2310,13 @@ var init$7 = function init(publicName, metric, queryEngineConfig) {
|
|
|
2299
2310
|
};
|
|
2300
2311
|
};
|
|
2301
2312
|
|
|
2313
|
+
function combineForCustomMetricFilters(filters, customFilters) {
|
|
2314
|
+
if (customFilters && isAvailable(customFilters)) {
|
|
2315
|
+
return addAndFilters(filters != null ? filters : [], customFilters);
|
|
2316
|
+
}
|
|
2317
|
+
return filters != null ? filters : [];
|
|
2318
|
+
}
|
|
2319
|
+
|
|
2302
2320
|
var PropertyType = /*#__PURE__*/function (PropertyType) {
|
|
2303
2321
|
PropertyType["Operator"] = "operator";
|
|
2304
2322
|
PropertyType["IfLogic"] = "ifLogic";
|
|
@@ -2318,7 +2336,7 @@ var OperatorType = /*#__PURE__*/function (OperatorType) {
|
|
|
2318
2336
|
|
|
2319
2337
|
var build$8 = function build(measureAttribute, customField, dataSet, queryEngineConfig, params) {
|
|
2320
2338
|
if (customField.metric.type === PropertyType.IfLogic) {
|
|
2321
|
-
return buildIfLogic(customField.metric, dataSet,
|
|
2339
|
+
return buildIfLogic(customField.metric, dataSet, queryEngineConfig, params, measureAttribute);
|
|
2322
2340
|
}
|
|
2323
2341
|
if (customField.metric.type === PropertyType.Aggregate) {
|
|
2324
2342
|
return buildAggregate(customField.metric);
|
|
@@ -2331,7 +2349,7 @@ var build$8 = function build(measureAttribute, customField, dataSet, queryEngine
|
|
|
2331
2349
|
}
|
|
2332
2350
|
return buildOperator(customField.metric, dataSet, params, measureAttribute, false);
|
|
2333
2351
|
};
|
|
2334
|
-
var buildIfLogic = function buildIfLogic(ifLogic, dataSet,
|
|
2352
|
+
var buildIfLogic = function buildIfLogic(ifLogic, dataSet, queryEngineConfig, params, measureAttribute) {
|
|
2335
2353
|
var alwaysTrueFilter = [[{
|
|
2336
2354
|
value: 1,
|
|
2337
2355
|
op: '=',
|
|
@@ -2343,7 +2361,7 @@ var buildIfLogic = function buildIfLogic(ifLogic, dataSet, localAndDashboardFilt
|
|
|
2343
2361
|
var cases = function () {
|
|
2344
2362
|
var thenCases = ifLogic.cases.map(function (c) {
|
|
2345
2363
|
var _params$filterConfig$, _params$filterConfig;
|
|
2346
|
-
var customMetricFilter = combineForCustomMetricFilters(
|
|
2364
|
+
var customMetricFilter = combineForCustomMetricFilters((_params$filterConfig$ = params == null || (_params$filterConfig = params.filterConfig) == null ? void 0 : _params$filterConfig.viewFilters) != null ? _params$filterConfig$ : [], c.filter);
|
|
2347
2365
|
return {
|
|
2348
2366
|
returns: buildMetric(c.returns, dataSet, params, measureAttribute),
|
|
2349
2367
|
filter: filterAttributeToQueryFilter(customMetricFilter, queryEngineConfig, dataSet, params)
|
|
@@ -15104,9 +15122,8 @@ var fieldSchema = /*#__PURE__*/Joi.object({
|
|
|
15104
15122
|
dataSetId: /*#__PURE__*/Joi.string().required()
|
|
15105
15123
|
});
|
|
15106
15124
|
var optionsFiltersSchema = function optionsFiltersSchema(queryEngineConfig) {
|
|
15107
|
-
|
|
15108
|
-
|
|
15109
|
-
Joi.array().items(filterSchema(queryEngineConfig)).optional());
|
|
15125
|
+
var innerArraySchema = Joi.array().items(filterSchema(queryEngineConfig));
|
|
15126
|
+
return Joi.object().pattern(Joi.string(), Joi.array().items(innerArraySchema).optional());
|
|
15110
15127
|
};
|
|
15111
15128
|
var sharedAdditionalFilterSchema = function sharedAdditionalFilterSchema(queryEngineConfig) {
|
|
15112
15129
|
return {
|
|
@@ -26562,7 +26579,7 @@ var buildFilterQuery = function buildFilterQuery(dataSet, fieldId, optionsFilter
|
|
|
26562
26579
|
"function": 'count'
|
|
26563
26580
|
}];
|
|
26564
26581
|
var order = optionsOrders != null ? optionsOrders : [];
|
|
26565
|
-
var filter = optionsFilters ?
|
|
26582
|
+
var filter = optionsFilters != null ? optionsFilters : [];
|
|
26566
26583
|
var dimension = [{
|
|
26567
26584
|
field: fieldId,
|
|
26568
26585
|
"function": 'none'
|
|
@@ -39581,7 +39598,7 @@ var PanelProperty = function PanelProperty(props) {
|
|
|
39581
39598
|
|
|
39582
39599
|
var buildFieldOptions = function buildFieldOptions(filterType, dataSets, selectedDataSetIndexes) {
|
|
39583
39600
|
return [].concat(dataSets).flatMap(function (dataSet, dataSetIndex) {
|
|
39584
|
-
|
|
39601
|
+
if (!selectedDataSetIndexes.includes(dataSetIndex)) return [];
|
|
39585
39602
|
return [].concat(takeNonCustomFields(dataSet)).filter(function (field) {
|
|
39586
39603
|
var allowedDataTypes = allowedDataTypesForFilter(filterType);
|
|
39587
39604
|
return allowedDataTypes.includes(field.dataType);
|
|
@@ -39591,8 +39608,7 @@ var buildFieldOptions = function buildFieldOptions(filterType, dataSets, selecte
|
|
|
39591
39608
|
value: {
|
|
39592
39609
|
dataSetId: dataSet.id,
|
|
39593
39610
|
field: field
|
|
39594
|
-
}
|
|
39595
|
-
hide: hide
|
|
39611
|
+
}
|
|
39596
39612
|
};
|
|
39597
39613
|
});
|
|
39598
39614
|
});
|
|
@@ -39813,11 +39829,13 @@ var AddFilterForm = function AddFilterForm(props) {
|
|
|
39813
39829
|
filterType: filterType
|
|
39814
39830
|
});
|
|
39815
39831
|
};
|
|
39816
|
-
var setSelectedDataSets = function setSelectedDataSets(
|
|
39817
|
-
|
|
39818
|
-
|
|
39819
|
-
|
|
39820
|
-
|
|
39832
|
+
var setSelectedDataSets = function setSelectedDataSets(_, dataSetIndex) {
|
|
39833
|
+
if (dataSetIndex !== null) {
|
|
39834
|
+
dispatch({
|
|
39835
|
+
type: 'setSelectedDataSets',
|
|
39836
|
+
selectedDataSetIndexes: [dataSetIndex]
|
|
39837
|
+
});
|
|
39838
|
+
}
|
|
39821
39839
|
};
|
|
39822
39840
|
var setAdvancedOptions = function setAdvancedOptions(options) {
|
|
39823
39841
|
dispatch({
|
|
@@ -39825,11 +39843,13 @@ var AddFilterForm = function AddFilterForm(props) {
|
|
|
39825
39843
|
options: options
|
|
39826
39844
|
});
|
|
39827
39845
|
};
|
|
39828
|
-
var setSelectedFields = function setSelectedFields(
|
|
39829
|
-
|
|
39830
|
-
|
|
39831
|
-
|
|
39832
|
-
|
|
39846
|
+
var setSelectedFields = function setSelectedFields(_, fieldIndex) {
|
|
39847
|
+
if (fieldIndex !== null) {
|
|
39848
|
+
dispatch({
|
|
39849
|
+
type: 'setSelectedFields',
|
|
39850
|
+
selectedFieldIndexes: [fieldIndex]
|
|
39851
|
+
});
|
|
39852
|
+
}
|
|
39833
39853
|
};
|
|
39834
39854
|
var getFilterTypeOptions = function getFilterTypeOptions() {
|
|
39835
39855
|
var filterTypes = [{
|
|
@@ -39856,6 +39876,8 @@ var AddFilterForm = function AddFilterForm(props) {
|
|
|
39856
39876
|
}
|
|
39857
39877
|
return filterTypes;
|
|
39858
39878
|
};
|
|
39879
|
+
var selectedDataSet = selectedDataSetIndexes.length > 0 ? dataSetOptions[selectedDataSetIndexes[0]].value : null;
|
|
39880
|
+
var selectedField = selectedFieldIndexes.length > 0 ? fieldOptions[selectedFieldIndexes[0]].value : null;
|
|
39859
39881
|
return jsxs(Fragment$1, {
|
|
39860
39882
|
children: [jsx(Modal.Header, {
|
|
39861
39883
|
title: textOverride('new_filter', 'New filter'),
|
|
@@ -39872,13 +39894,13 @@ var AddFilterForm = function AddFilterForm(props) {
|
|
|
39872
39894
|
}
|
|
39873
39895
|
})
|
|
39874
39896
|
}), dataSetOptions.length > 1 && jsx(PanelProperty, {
|
|
39875
|
-
children: jsx(
|
|
39897
|
+
children: jsx(Select$2, {
|
|
39876
39898
|
id: "data-set",
|
|
39877
39899
|
label: textOverride('data_sets', 'Data sets'),
|
|
39878
39900
|
placeholder: textOverride('data_sets_placeholder', 'Which data sets will this filter impact?'),
|
|
39879
39901
|
options: dataSetOptions,
|
|
39880
|
-
selected:
|
|
39881
|
-
|
|
39902
|
+
selected: selectedDataSet,
|
|
39903
|
+
onChange: setSelectedDataSets,
|
|
39882
39904
|
textOverride: textOverride
|
|
39883
39905
|
})
|
|
39884
39906
|
}), jsx(PanelProperty, {
|
|
@@ -39892,13 +39914,13 @@ var AddFilterForm = function AddFilterForm(props) {
|
|
|
39892
39914
|
textOverride: textOverride
|
|
39893
39915
|
})
|
|
39894
39916
|
}), jsx(PanelProperty, {
|
|
39895
|
-
children: jsx(
|
|
39917
|
+
children: jsx(Select$2, {
|
|
39896
39918
|
label: textOverride('fields', 'Fields'),
|
|
39897
39919
|
id: "data-set-fields",
|
|
39898
39920
|
placeholder: textOverride('fields_placeholder', 'Which fields will this filter impact?'),
|
|
39899
39921
|
options: fieldOptions,
|
|
39900
|
-
selected:
|
|
39901
|
-
|
|
39922
|
+
selected: selectedField,
|
|
39923
|
+
onChange: setSelectedFields,
|
|
39902
39924
|
textOverride: textOverride
|
|
39903
39925
|
})
|
|
39904
39926
|
}), draftFilter.type === 'dateFilter' && jsx(PanelProperty, {
|
|
@@ -40287,9 +40309,9 @@ var _GlobalFiltersView = /*#__PURE__*/withCustomRenderGuard(function (props) {
|
|
|
40287
40309
|
}),
|
|
40288
40310
|
filterIndex: globalFilterIndex,
|
|
40289
40311
|
onChange: function onChange(newFilter) {
|
|
40290
|
-
var
|
|
40291
|
-
|
|
40292
|
-
props.setGlobalFilters(
|
|
40312
|
+
var newGlobalFilters = [].concat(props.globalFilters);
|
|
40313
|
+
newGlobalFilters[globalFilterIndex] = newFilter;
|
|
40314
|
+
props.setGlobalFilters(newGlobalFilters);
|
|
40293
40315
|
}
|
|
40294
40316
|
}, globalFilterIndex);
|
|
40295
40317
|
})
|
|
@@ -44509,7 +44531,7 @@ var buildMargin = function buildMargin(yTicks, showYAxisLabels, hasYAxisTitle, h
|
|
|
44509
44531
|
};
|
|
44510
44532
|
var buildMarginForHorizontalChart = function buildMarginForHorizontalChart(xTicks, yTicks, showXAxisLabels, showYAxisLabels, hasYAxisTitle, hasXAxisTitle) {
|
|
44511
44533
|
var maxWidth = max(yTicks.map(function (tick) {
|
|
44512
|
-
return (tick.formattedValue || '').length * ASSUMED_AVERAGE_CHAR_WIDTH;
|
|
44534
|
+
return (tick.formattedValue || '').split(/[\n\s]+/)[0].length * ASSUMED_AVERAGE_CHAR_WIDTH;
|
|
44513
44535
|
}));
|
|
44514
44536
|
var showXTicks = showXAxisLabels && xTicks.length > 0;
|
|
44515
44537
|
var showYTicks = showYAxisLabels && yTicks.length > 0;
|
|
@@ -52822,17 +52844,19 @@ var CustomCell = function CustomCell(_ref) {
|
|
|
52822
52844
|
* Adds in drill down filters as `AND` conditions to the existing filter query.
|
|
52823
52845
|
*/
|
|
52824
52846
|
var addDrillDownFilters = function addDrillDownFilters(selectedRow, dimension, filter) {
|
|
52825
|
-
var drillDownFilters =
|
|
52826
|
-
var
|
|
52827
|
-
|
|
52828
|
-
|
|
52829
|
-
|
|
52830
|
-
|
|
52831
|
-
|
|
52832
|
-
|
|
52833
|
-
|
|
52834
|
-
|
|
52835
|
-
|
|
52847
|
+
var drillDownFilters = selectedRow.map(function (row) {
|
|
52848
|
+
var fields = Object.keys(row);
|
|
52849
|
+
return fields.map(function (field) {
|
|
52850
|
+
var _dimension$find;
|
|
52851
|
+
return {
|
|
52852
|
+
field: field,
|
|
52853
|
+
op: '=',
|
|
52854
|
+
value: row[field],
|
|
52855
|
+
"function": ((_dimension$find = dimension.find(function (d) {
|
|
52856
|
+
return d.field === field;
|
|
52857
|
+
})) == null ? void 0 : _dimension$find["function"]) || 'none'
|
|
52858
|
+
};
|
|
52859
|
+
});
|
|
52836
52860
|
});
|
|
52837
52861
|
return addAndFilters(filter, drillDownFilters);
|
|
52838
52862
|
};
|
|
@@ -74187,7 +74211,7 @@ var toQueries$1 = function toQueries$1(additionalFilter, dataSets, queryEngineCo
|
|
|
74187
74211
|
if (!dataSet) throw 'Data set not found for additional filter query';
|
|
74188
74212
|
var dataSetField = findField(dataSet, field.fieldId);
|
|
74189
74213
|
if (dataSetField.dataType == 'string[]') {
|
|
74190
|
-
var queryFilter = filterAttributeToQueryFilter(
|
|
74214
|
+
var queryFilter = filterAttributeToQueryFilter(getOptionsFilters(additionalFilter, field), queryEngineConfig, dataSet, params);
|
|
74191
74215
|
var _QueryLogic$buildUniq = buildUniqueArrayValuesPreparedQuery(field.dataSetId, dataSetField, queryFilter),
|
|
74192
74216
|
query = _QueryLogic$buildUniq.query,
|
|
74193
74217
|
resultFields = _QueryLogic$buildUniq.resultFields;
|
|
@@ -74210,9 +74234,20 @@ var toQueries$1 = function toQueries$1(additionalFilter, dataSets, queryEngineCo
|
|
|
74210
74234
|
};
|
|
74211
74235
|
};
|
|
74212
74236
|
function getOptionsFilters(additionalFilter, field) {
|
|
74213
|
-
|
|
74214
|
-
|
|
74215
|
-
|
|
74237
|
+
if (!additionalFilter.optionsFilters) {
|
|
74238
|
+
return [];
|
|
74239
|
+
}
|
|
74240
|
+
if (!(field.dataSetId in additionalFilter.optionsFilters)) {
|
|
74241
|
+
return [];
|
|
74242
|
+
}
|
|
74243
|
+
var optionsFilters = additionalFilter.optionsFilters[field.dataSetId];
|
|
74244
|
+
var orFilter = optionsFilters.map(function (filter) {
|
|
74245
|
+
return filter.filter(function (f) {
|
|
74246
|
+
return f.field !== field.fieldId;
|
|
74247
|
+
});
|
|
74248
|
+
});
|
|
74249
|
+
return orFilter.filter(function (f) {
|
|
74250
|
+
return f.length > 0;
|
|
74216
74251
|
});
|
|
74217
74252
|
}
|
|
74218
74253
|
function getOptionsOrders(dataSetField) {
|
|
@@ -74499,8 +74534,11 @@ var buildVizzlyQuery = function buildVizzlyQuery(thing, queryEngineConfig, param
|
|
|
74499
74534
|
query = _QueryLogic$buildPreA.query,
|
|
74500
74535
|
rF = _QueryLogic$buildPreA.resultFields;
|
|
74501
74536
|
var underlyingDataSet = find(params.dataSets, underlyingDataSetId);
|
|
74502
|
-
var
|
|
74503
|
-
|
|
74537
|
+
var filter = filterAttributeToQueryFilter([], queryEngineConfig, underlyingDataSet, _extends({}, params, {
|
|
74538
|
+
filterConfig: _extends({}, params.filterConfig, {
|
|
74539
|
+
viewFilters: undefined
|
|
74540
|
+
})
|
|
74541
|
+
}));
|
|
74504
74542
|
queriesToSend = [_extends({}, query, {
|
|
74505
74543
|
filter: (_filter = {}, _filter[underlyingDataSet.id] = filter, _filter)
|
|
74506
74544
|
})];
|