@vizzly/dashboard 0.15.0-dev-c5f05b4321b2456a7b799661438c1d9b99f79de4 → 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
|
@@ -1119,26 +1119,98 @@ var FieldNotFoundInDataSet = /*#__PURE__*/function (_ValidationError) {
|
|
|
1119
1119
|
return FieldNotFoundInDataSet;
|
|
1120
1120
|
}(ValidationError);
|
|
1121
1121
|
|
|
1122
|
-
var
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1122
|
+
var VariableNotFoundForVariables = /*#__PURE__*/function (_ValidationError) {
|
|
1123
|
+
function VariableNotFoundForVariables(variableList, missingVariableId) {
|
|
1124
|
+
var _this;
|
|
1125
|
+
_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;
|
|
1126
|
+
_this.missingVariableId = void 0;
|
|
1127
|
+
_this.name = 'VariableNotFoundForVariables';
|
|
1128
|
+
_this.missingVariableId = missingVariableId;
|
|
1129
|
+
return _this;
|
|
1126
1130
|
}
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1131
|
+
_inheritsLoose(VariableNotFoundForVariables, _ValidationError);
|
|
1132
|
+
var _proto = VariableNotFoundForVariables.prototype;
|
|
1133
|
+
_proto.getMissingFieldId = function getMissingFieldId() {
|
|
1134
|
+
return this.missingVariableId;
|
|
1135
|
+
};
|
|
1136
|
+
return VariableNotFoundForVariables;
|
|
1137
|
+
}(ValidationError);
|
|
1138
|
+
|
|
1139
|
+
var detect = function detect(input) {
|
|
1140
|
+
var regex = /\{\{\s*([^\s{}][^{}]*?)\s*\}\}/g;
|
|
1141
|
+
var matches = [];
|
|
1142
|
+
var match;
|
|
1143
|
+
while ((match = regex.exec(input)) !== null) {
|
|
1144
|
+
matches.push(match[1].trim());
|
|
1145
|
+
}
|
|
1146
|
+
return matches.length > 0 ? matches : undefined;
|
|
1147
|
+
};
|
|
1148
|
+
var build$1 = function build(variables) {
|
|
1149
|
+
if (variables) {
|
|
1150
|
+
var dashboardDefinedVariables = variables();
|
|
1151
|
+
logInfo('Detected variables', dashboardDefinedVariables);
|
|
1152
|
+
return dashboardDefinedVariables;
|
|
1153
|
+
}
|
|
1154
|
+
return {};
|
|
1155
|
+
};
|
|
1156
|
+
var findVariable = function findVariable(value, detect, variableList) {
|
|
1157
|
+
if (!variableList) return undefined;
|
|
1158
|
+
|
|
1159
|
+
// Use the detect function to check if the value is a variable
|
|
1160
|
+
var variables = detect(value);
|
|
1161
|
+
|
|
1162
|
+
// If no variables are detected, return early
|
|
1163
|
+
if (!variables || variables.length === 0) {
|
|
1164
|
+
return undefined; // Early return if the value is not a variable
|
|
1130
1165
|
}
|
|
1166
|
+
var matchedVariables = [];
|
|
1131
1167
|
|
|
1132
|
-
//
|
|
1133
|
-
var
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1168
|
+
// Check for matching variables in the variable list
|
|
1169
|
+
for (var _iterator = _createForOfIteratorHelperLoose(variables), _step; !(_step = _iterator()).done;) {
|
|
1170
|
+
var variable = _step.value;
|
|
1171
|
+
var variableEntry = variableList[variable];
|
|
1172
|
+
if (variableEntry) {
|
|
1173
|
+
// If the variable is found but its value is undefined or empty, throw an error
|
|
1174
|
+
if (variableEntry.value === undefined || variableEntry.value === '') {
|
|
1175
|
+
throw new Error("Variable '" + variable + "' is defined in the list but has no value.");
|
|
1176
|
+
}
|
|
1177
|
+
|
|
1178
|
+
// Add the variable to the matched variables list
|
|
1179
|
+
matchedVariables.push(variable);
|
|
1180
|
+
}
|
|
1181
|
+
}
|
|
1182
|
+
|
|
1183
|
+
// If no matches are found, throw an error
|
|
1184
|
+
if (matchedVariables.length === 0 && value) {
|
|
1185
|
+
throw new VariableNotFoundForVariables(variableList, value);
|
|
1186
|
+
}
|
|
1187
|
+
return matchedVariables.length > 0 ? matchedVariables : undefined;
|
|
1188
|
+
};
|
|
1189
|
+
var useValue = function useValue(value, variables) {
|
|
1190
|
+
if (typeof value === 'string') {
|
|
1191
|
+
var valueHasVariables = detect(value);
|
|
1192
|
+
if (valueHasVariables && variables) {
|
|
1193
|
+
for (var _iterator2 = _createForOfIteratorHelperLoose(valueHasVariables), _step2; !(_step2 = _iterator2()).done;) {
|
|
1194
|
+
var key = _step2.value;
|
|
1195
|
+
if (key in variables) {
|
|
1196
|
+
return extractValue(variables, key);
|
|
1197
|
+
}
|
|
1198
|
+
}
|
|
1199
|
+
}
|
|
1200
|
+
}
|
|
1201
|
+
return value;
|
|
1202
|
+
};
|
|
1203
|
+
var validate = function validate(value, variables) {
|
|
1204
|
+
try {
|
|
1205
|
+
findVariable(value, detect, variables);
|
|
1206
|
+
return true;
|
|
1207
|
+
} catch (e) {
|
|
1138
1208
|
return false;
|
|
1139
1209
|
}
|
|
1140
|
-
return true;
|
|
1141
1210
|
};
|
|
1211
|
+
function extractValue(variables, key) {
|
|
1212
|
+
return variables[key].value;
|
|
1213
|
+
}
|
|
1142
1214
|
|
|
1143
1215
|
var _Joi$string, _Joi$string2;
|
|
1144
1216
|
var defaultDurationOptions = function defaultDurationOptions(textOverride) {
|
|
@@ -1252,107 +1324,6 @@ var buildRelativeRange = function buildRelativeRange(relativeFilters, dataSet, a
|
|
|
1252
1324
|
});
|
|
1253
1325
|
};
|
|
1254
1326
|
|
|
1255
|
-
var getUTCDate = function getUTCDate(date) {
|
|
1256
|
-
if (date !== null) {
|
|
1257
|
-
var momentDate = moment(new Date(date));
|
|
1258
|
-
return momentDate.tz(Intl.DateTimeFormat().resolvedOptions().timeZone)._d;
|
|
1259
|
-
}
|
|
1260
|
-
return date;
|
|
1261
|
-
};
|
|
1262
|
-
|
|
1263
|
-
var VariableNotFoundForVariables = /*#__PURE__*/function (_ValidationError) {
|
|
1264
|
-
function VariableNotFoundForVariables(variableList, missingVariableId) {
|
|
1265
|
-
var _this;
|
|
1266
|
-
_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;
|
|
1267
|
-
_this.missingVariableId = void 0;
|
|
1268
|
-
_this.name = 'VariableNotFoundForVariables';
|
|
1269
|
-
_this.missingVariableId = missingVariableId;
|
|
1270
|
-
return _this;
|
|
1271
|
-
}
|
|
1272
|
-
_inheritsLoose(VariableNotFoundForVariables, _ValidationError);
|
|
1273
|
-
var _proto = VariableNotFoundForVariables.prototype;
|
|
1274
|
-
_proto.getMissingFieldId = function getMissingFieldId() {
|
|
1275
|
-
return this.missingVariableId;
|
|
1276
|
-
};
|
|
1277
|
-
return VariableNotFoundForVariables;
|
|
1278
|
-
}(ValidationError);
|
|
1279
|
-
|
|
1280
|
-
var detect = function detect(input) {
|
|
1281
|
-
var regex = /\{\{\s*([^\s{}][^{}]*?)\s*\}\}/g;
|
|
1282
|
-
var matches = [];
|
|
1283
|
-
var match;
|
|
1284
|
-
while ((match = regex.exec(input)) !== null) {
|
|
1285
|
-
matches.push(match[1].trim());
|
|
1286
|
-
}
|
|
1287
|
-
return matches.length > 0 ? matches : undefined;
|
|
1288
|
-
};
|
|
1289
|
-
var build$1 = function build(variables) {
|
|
1290
|
-
if (variables) {
|
|
1291
|
-
var dashboardDefinedVariables = variables();
|
|
1292
|
-
logInfo('Detected variables', dashboardDefinedVariables);
|
|
1293
|
-
return dashboardDefinedVariables;
|
|
1294
|
-
}
|
|
1295
|
-
return {};
|
|
1296
|
-
};
|
|
1297
|
-
var findVariable = function findVariable(value, detect, variableList) {
|
|
1298
|
-
if (!variableList) return undefined;
|
|
1299
|
-
|
|
1300
|
-
// Use the detect function to check if the value is a variable
|
|
1301
|
-
var variables = detect(value);
|
|
1302
|
-
|
|
1303
|
-
// If no variables are detected, return early
|
|
1304
|
-
if (!variables || variables.length === 0) {
|
|
1305
|
-
return undefined; // Early return if the value is not a variable
|
|
1306
|
-
}
|
|
1307
|
-
var matchedVariables = [];
|
|
1308
|
-
|
|
1309
|
-
// Check for matching variables in the variable list
|
|
1310
|
-
for (var _iterator = _createForOfIteratorHelperLoose(variables), _step; !(_step = _iterator()).done;) {
|
|
1311
|
-
var variable = _step.value;
|
|
1312
|
-
var variableEntry = variableList[variable];
|
|
1313
|
-
if (variableEntry) {
|
|
1314
|
-
// If the variable is found but its value is undefined or empty, throw an error
|
|
1315
|
-
if (variableEntry.value === undefined || variableEntry.value === '') {
|
|
1316
|
-
throw new Error("Variable '" + variable + "' is defined in the list but has no value.");
|
|
1317
|
-
}
|
|
1318
|
-
|
|
1319
|
-
// Add the variable to the matched variables list
|
|
1320
|
-
matchedVariables.push(variable);
|
|
1321
|
-
}
|
|
1322
|
-
}
|
|
1323
|
-
|
|
1324
|
-
// If no matches are found, throw an error
|
|
1325
|
-
if (matchedVariables.length === 0 && value) {
|
|
1326
|
-
throw new VariableNotFoundForVariables(variableList, value);
|
|
1327
|
-
}
|
|
1328
|
-
return matchedVariables.length > 0 ? matchedVariables : undefined;
|
|
1329
|
-
};
|
|
1330
|
-
var useValue = function useValue(value, variables) {
|
|
1331
|
-
if (typeof value === 'string') {
|
|
1332
|
-
var valueHasVariables = detect(value);
|
|
1333
|
-
if (valueHasVariables && variables) {
|
|
1334
|
-
for (var _iterator2 = _createForOfIteratorHelperLoose(valueHasVariables), _step2; !(_step2 = _iterator2()).done;) {
|
|
1335
|
-
var key = _step2.value;
|
|
1336
|
-
if (key in variables) {
|
|
1337
|
-
return extractValue(variables, key);
|
|
1338
|
-
}
|
|
1339
|
-
}
|
|
1340
|
-
}
|
|
1341
|
-
}
|
|
1342
|
-
return value;
|
|
1343
|
-
};
|
|
1344
|
-
var validate = function validate(value, variables) {
|
|
1345
|
-
try {
|
|
1346
|
-
findVariable(value, detect, variables);
|
|
1347
|
-
return true;
|
|
1348
|
-
} catch (e) {
|
|
1349
|
-
return false;
|
|
1350
|
-
}
|
|
1351
|
-
};
|
|
1352
|
-
function extractValue(variables, key) {
|
|
1353
|
-
return variables[key].value;
|
|
1354
|
-
}
|
|
1355
|
-
|
|
1356
1327
|
/** Upcasts from an old global filter, to a new "additional filter" */
|
|
1357
1328
|
var upcastToAdditionalFilter = function upcastToAdditionalFilter(globalFilter) {
|
|
1358
1329
|
if (globalFilter.type == 'globalSelectFilter') {
|
|
@@ -1404,6 +1375,14 @@ var MULTI_SELECT_FILTER = 'multiSelectFilter';
|
|
|
1404
1375
|
var NUMERIC_FILTER = 'numericFilter';
|
|
1405
1376
|
var ADVANCED_FILTER = 'advancedFilter';
|
|
1406
1377
|
|
|
1378
|
+
var getUTCDate = function getUTCDate(date) {
|
|
1379
|
+
if (date !== null) {
|
|
1380
|
+
var momentDate = moment(new Date(date));
|
|
1381
|
+
return momentDate.tz(Intl.DateTimeFormat().resolvedOptions().timeZone)._d;
|
|
1382
|
+
}
|
|
1383
|
+
return date;
|
|
1384
|
+
};
|
|
1385
|
+
|
|
1407
1386
|
var toQueryAttributesFilter = function toQueryAttributesFilter(dataSet, filter, customTimeRangeFuncs) {
|
|
1408
1387
|
return filter.appliesToFields.flatMap(function (field) {
|
|
1409
1388
|
var _filter$value, _filter$value2, _filter$value3;
|
|
@@ -1413,11 +1392,11 @@ var toQueryAttributesFilter = function toQueryAttributesFilter(dataSet, filter,
|
|
|
1413
1392
|
|
|
1414
1393
|
// might be able to remove this
|
|
1415
1394
|
if (dataSetField.dataType == 'string[]' && filter.type !== MULTI_SELECT_FILTER && !isAdditionalFilter(filter.value)) {
|
|
1416
|
-
return [{
|
|
1395
|
+
return [[{
|
|
1417
1396
|
field: field.fieldId,
|
|
1418
1397
|
op: 'array_contains',
|
|
1419
1398
|
value: filter.value
|
|
1420
|
-
}];
|
|
1399
|
+
}]];
|
|
1421
1400
|
}
|
|
1422
1401
|
if ((filter.type == DATE_FILTER || filter.type == DATE_AND_TIME_FILTER) && ((_filter$value = filter.value) == null ? void 0 : _filter$value.type) == 'relativeRange') {
|
|
1423
1402
|
return [];
|
|
@@ -1425,7 +1404,7 @@ var toQueryAttributesFilter = function toQueryAttributesFilter(dataSet, filter,
|
|
|
1425
1404
|
if ((filter.type == DATE_FILTER || filter.type == DATE_AND_TIME_FILTER) && ((_filter$value2 = filter.value) == null ? void 0 : _filter$value2.type) == 'fixedRange') {
|
|
1426
1405
|
// We have a fixed time range, so we can use those values.
|
|
1427
1406
|
|
|
1428
|
-
return [{
|
|
1407
|
+
return [[{
|
|
1429
1408
|
field: field.fieldId,
|
|
1430
1409
|
op: inclusiveExclusiveCurrent(DateOp.Greater, filter),
|
|
1431
1410
|
value: getUTCDate(filter.value.after)
|
|
@@ -1433,27 +1412,31 @@ var toQueryAttributesFilter = function toQueryAttributesFilter(dataSet, filter,
|
|
|
1433
1412
|
field: field.fieldId,
|
|
1434
1413
|
op: inclusiveExclusiveCurrent(DateOp.Less, filter),
|
|
1435
1414
|
value: getUTCDate(filter.value.before)
|
|
1436
|
-
}];
|
|
1415
|
+
}]];
|
|
1437
1416
|
} else if ((filter.type == DATE_FILTER || filter.type == DATE_AND_TIME_FILTER) && ((_filter$value3 = filter.value) == null ? void 0 : _filter$value3.type) == 'relative') {
|
|
1438
1417
|
// We have a relative time filter, so need to call the time functions to get the values....
|
|
1439
1418
|
|
|
1440
1419
|
var _customTimeRangeFuncs = customTimeRangeFuncs[filter.value.value].range,
|
|
1441
1420
|
before = _customTimeRangeFuncs.before,
|
|
1442
1421
|
after = _customTimeRangeFuncs.after;
|
|
1443
|
-
var filters = [];
|
|
1422
|
+
var filters = [[]];
|
|
1444
1423
|
if (before) {
|
|
1445
|
-
filters =
|
|
1446
|
-
|
|
1447
|
-
|
|
1448
|
-
|
|
1449
|
-
|
|
1424
|
+
filters = filters.map(function (f) {
|
|
1425
|
+
return [].concat(f, [{
|
|
1426
|
+
field: field.fieldId,
|
|
1427
|
+
op: inclusiveExclusiveCurrent(DateOp.Less, filter),
|
|
1428
|
+
value: before
|
|
1429
|
+
}]);
|
|
1430
|
+
});
|
|
1450
1431
|
}
|
|
1451
1432
|
if (after) {
|
|
1452
|
-
filters =
|
|
1453
|
-
|
|
1454
|
-
|
|
1455
|
-
|
|
1456
|
-
|
|
1433
|
+
filters = filters.map(function (f) {
|
|
1434
|
+
return [].concat(f, [{
|
|
1435
|
+
field: field.fieldId,
|
|
1436
|
+
op: inclusiveExclusiveCurrent(DateOp.Greater, filter),
|
|
1437
|
+
value: after
|
|
1438
|
+
}]);
|
|
1439
|
+
});
|
|
1457
1440
|
}
|
|
1458
1441
|
return filters;
|
|
1459
1442
|
} else if (filter.type == SINGLE_SELECT_FILTER) {
|
|
@@ -1461,31 +1444,31 @@ var toQueryAttributesFilter = function toQueryAttributesFilter(dataSet, filter,
|
|
|
1461
1444
|
if (filter.value === NULL_VALUE_OPT) {
|
|
1462
1445
|
value = null;
|
|
1463
1446
|
}
|
|
1464
|
-
return [{
|
|
1447
|
+
return [[{
|
|
1465
1448
|
field: field.fieldId,
|
|
1466
1449
|
op: '=',
|
|
1467
1450
|
value: value
|
|
1468
|
-
}];
|
|
1451
|
+
}]];
|
|
1469
1452
|
} else if (isAdditionalFilter(filter.value)) {
|
|
1470
1453
|
return buildAdvancedFilters(filter.value, field, dataSet.id);
|
|
1471
1454
|
} else if (filter.type == MULTI_SELECT_FILTER && filter.value.length > 0) {
|
|
1472
|
-
return [{
|
|
1455
|
+
return [[{
|
|
1473
1456
|
field: field.fieldId,
|
|
1474
1457
|
op: 'is_one_of',
|
|
1475
1458
|
value: filter.value
|
|
1476
|
-
}];
|
|
1459
|
+
}]];
|
|
1477
1460
|
} 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) {
|
|
1478
1461
|
// No value set on the filter, so it cannot become a query attribute.
|
|
1479
1462
|
return [];
|
|
1480
1463
|
} else if (filter.type == NUMERIC_FILTER) {
|
|
1481
1464
|
if ('op' in filter.value && 'value' in filter.value) {
|
|
1482
|
-
return [{
|
|
1465
|
+
return [[{
|
|
1483
1466
|
field: field.fieldId,
|
|
1484
1467
|
op: filter.value.op,
|
|
1485
1468
|
value: filter.value.value
|
|
1486
|
-
}];
|
|
1469
|
+
}]];
|
|
1487
1470
|
}
|
|
1488
|
-
return [];
|
|
1471
|
+
return [[]];
|
|
1489
1472
|
}
|
|
1490
1473
|
throw "Cannot convert filter type " + filter.type + " to query attributes filter. " + JSON.stringify(filter);
|
|
1491
1474
|
});
|
|
@@ -1547,16 +1530,16 @@ var toRelativeQueryAttributesFilters = function toRelativeQueryAttributesFilters
|
|
|
1547
1530
|
var _filters$value;
|
|
1548
1531
|
if (((_filters$value = filters.value) == null ? void 0 : _filters$value.type) !== 'relativeRange') return [];
|
|
1549
1532
|
if (filters.value.filters.length === 0) return [];
|
|
1550
|
-
var resolvedFilters = [];
|
|
1551
1533
|
var preparedFilters = buildRelativeRange(filters.value.filters, dataSet, filters.appliesToFields);
|
|
1552
|
-
preparedFilters
|
|
1553
|
-
|
|
1554
|
-
|
|
1555
|
-
|
|
1556
|
-
|
|
1534
|
+
return preparedFilters.map(function (filter) {
|
|
1535
|
+
return filter.map(function (f) {
|
|
1536
|
+
return {
|
|
1537
|
+
field: f.field,
|
|
1538
|
+
op: f.op,
|
|
1539
|
+
value: calculateRelativeDate(f.value, startDate)
|
|
1540
|
+
};
|
|
1557
1541
|
});
|
|
1558
1542
|
});
|
|
1559
|
-
return resolvedFilters;
|
|
1560
1543
|
};
|
|
1561
1544
|
var hasActiveFilter = function hasActiveFilter(additionalFilters) {
|
|
1562
1545
|
return _.some(additionalFilters, function (_ref) {
|
|
@@ -1700,14 +1683,17 @@ function getCascadeOptionsFilters(globalFilters, dataSets, dateFilterOptions, ca
|
|
|
1700
1683
|
if (Array.isArray(dataObj.value) && dataObj.value.length === 0) {
|
|
1701
1684
|
return acc;
|
|
1702
1685
|
}
|
|
1703
|
-
dataObj.appliesToFields.
|
|
1704
|
-
|
|
1686
|
+
var uniqueDataSetIds = new Set(dataObj.appliesToFields.map(function (f) {
|
|
1687
|
+
return f.dataSetId;
|
|
1688
|
+
}));
|
|
1689
|
+
uniqueDataSetIds.forEach(function (dataSetId) {
|
|
1705
1690
|
var dataSet = find(dataSets, dataSetId);
|
|
1706
1691
|
if (!acc[dataSetId]) {
|
|
1707
1692
|
acc[dataSetId] = [];
|
|
1708
1693
|
}
|
|
1709
1694
|
if (dataSet !== null) {
|
|
1710
|
-
|
|
1695
|
+
var filters = toQueryAttributesFilter(dataSet, dataObj, dateFilterOptions);
|
|
1696
|
+
acc[dataSetId] = addAndFilters(acc[dataSetId], filters);
|
|
1711
1697
|
}
|
|
1712
1698
|
});
|
|
1713
1699
|
}
|
|
@@ -1733,14 +1719,21 @@ function removeEmptyConditions(conditions) {
|
|
|
1733
1719
|
}
|
|
1734
1720
|
var buildAdvancedFilters = function buildAdvancedFilters(filterValue, field, dataSetId) {
|
|
1735
1721
|
if (!filterValue) return [];
|
|
1736
|
-
|
|
1722
|
+
var hasValidConditions = Array.isArray(filterValue) && filterValue.every(function (conditionGroup) {
|
|
1723
|
+
return Array.isArray(conditionGroup);
|
|
1724
|
+
});
|
|
1725
|
+
if (hasValidConditions) {
|
|
1737
1726
|
filterValue = removeEmptyConditions(filterValue);
|
|
1738
1727
|
if (filterValue.length === 0) return [];
|
|
1739
1728
|
if (field.dataSetId !== dataSetId) return [];
|
|
1740
|
-
var correctFiltersForField = filterValue
|
|
1741
|
-
return filter
|
|
1729
|
+
var correctFiltersForField = filterValue.map(function (conditionGroup) {
|
|
1730
|
+
return conditionGroup.filter(function (filter) {
|
|
1731
|
+
return filter.field === field.fieldId;
|
|
1732
|
+
});
|
|
1733
|
+
}).filter(function (conditionGroup) {
|
|
1734
|
+
return conditionGroup.length > 0;
|
|
1742
1735
|
});
|
|
1743
|
-
return correctFiltersForField
|
|
1736
|
+
return correctFiltersForField;
|
|
1744
1737
|
}
|
|
1745
1738
|
return [];
|
|
1746
1739
|
};
|
|
@@ -1769,7 +1762,8 @@ var fromFilterConfig = function fromFilterConfig(filterConfig, dataSet, timeRang
|
|
|
1769
1762
|
if (additionalFilter.type === DATE_AND_TIME_FILTER || additionalFilter.type === DATE_FILTER) {
|
|
1770
1763
|
addFilter = toRelativeQueryAttributesFilters(additionalFilter, dataSet);
|
|
1771
1764
|
}
|
|
1772
|
-
filters =
|
|
1765
|
+
filters = addAndFilters(filters, addFilter);
|
|
1766
|
+
filters = addAndFilters(filters, toQueryAttributesFilter(dataSet, additionalFilter, timeRangeOptions));
|
|
1773
1767
|
});
|
|
1774
1768
|
var localAdditionalFilters = Object.values(filterConfig.localFilters || {}).flat();
|
|
1775
1769
|
localAdditionalFilters.forEach(function (additionalFilter) {
|
|
@@ -1777,24 +1771,57 @@ var fromFilterConfig = function fromFilterConfig(filterConfig, dataSet, timeRang
|
|
|
1777
1771
|
if (additionalFilter.type === DATE_AND_TIME_FILTER || additionalFilter.type === DATE_FILTER) {
|
|
1778
1772
|
addFilter = toRelativeQueryAttributesFilters(additionalFilter, dataSet);
|
|
1779
1773
|
}
|
|
1780
|
-
filters =
|
|
1774
|
+
filters = addAndFilters(filters, addFilter);
|
|
1775
|
+
filters = addAndFilters(filters, toQueryAttributesFilter(dataSet, additionalFilter, timeRangeOptions));
|
|
1781
1776
|
});
|
|
1782
1777
|
return filters;
|
|
1783
1778
|
};
|
|
1784
1779
|
|
|
1780
|
+
var filterIsDate = function filterIsDate(filter) {
|
|
1781
|
+
var isoDateRegex = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{3}Z$/;
|
|
1782
|
+
if (!isoDateRegex.test(filter.value)) {
|
|
1783
|
+
return false;
|
|
1784
|
+
}
|
|
1785
|
+
var date = new Date(filter.value);
|
|
1786
|
+
if (isNaN(date.getTime())) {
|
|
1787
|
+
return false;
|
|
1788
|
+
}
|
|
1789
|
+
|
|
1790
|
+
// Additional check to verify that the date parts match exactly
|
|
1791
|
+
var _filter$value$split$ = filter.value.split('T')[0].split('-').map(Number),
|
|
1792
|
+
year = _filter$value$split$[0],
|
|
1793
|
+
month = _filter$value$split$[1],
|
|
1794
|
+
day = _filter$value$split$[2];
|
|
1795
|
+
if (date.getUTCFullYear() !== year || date.getUTCMonth() + 1 !== month || date.getUTCDate() !== day) {
|
|
1796
|
+
return false;
|
|
1797
|
+
}
|
|
1798
|
+
return true;
|
|
1799
|
+
};
|
|
1800
|
+
|
|
1785
1801
|
var addAndFilters = function addAndFilters(filter, filterToAddToAll) {
|
|
1786
1802
|
if (_.isEmpty(filterToAddToAll)) return [].concat(filter);
|
|
1787
1803
|
if (!filter || _.isEmpty(filter)) filter = [[]];
|
|
1788
|
-
|
|
1789
|
-
|
|
1790
|
-
|
|
1804
|
+
var result = [];
|
|
1805
|
+
for (var _iterator = _createForOfIteratorHelperLoose(filterToAddToAll), _step; !(_step = _iterator()).done;) {
|
|
1806
|
+
var additionalAndFilter = _step.value;
|
|
1807
|
+
for (var _iterator2 = _createForOfIteratorHelperLoose(filter), _step2; !(_step2 = _iterator2()).done;) {
|
|
1808
|
+
var andFilter = _step2.value;
|
|
1809
|
+
var combined = [].concat(additionalAndFilter, andFilter);
|
|
1810
|
+
if (!_.isEmpty(combined)) {
|
|
1811
|
+
result.push(combined);
|
|
1812
|
+
}
|
|
1813
|
+
}
|
|
1814
|
+
}
|
|
1815
|
+
return result;
|
|
1791
1816
|
};
|
|
1792
1817
|
var filterAttributeToQueryFilter = function filterAttributeToQueryFilter(filterAttrs, queryEngineConfig, dataSet, params) {
|
|
1793
1818
|
var _params$filterConfig;
|
|
1794
1819
|
// Either build using the filter attributes passed in, or take the viewFilters in the filter config.
|
|
1795
1820
|
// They represent the same thing, however some view-filters are passed around in the filter config
|
|
1796
1821
|
// to reduce custom metrics arguments being passed around.
|
|
1797
|
-
var filter = filterAttrs.length > 0
|
|
1822
|
+
var filter = filterAttrs.length > 0 && filterAttrs.some(function (group) {
|
|
1823
|
+
return group.length > 0;
|
|
1824
|
+
}) ? filterAttrs : ((_params$filterConfig = params.filterConfig) == null ? void 0 : _params$filterConfig.viewFilters) || [];
|
|
1798
1825
|
var extraFilters = fromFilterConfig(params.filterConfig, dataSet, params.timeRangeOptions);
|
|
1799
1826
|
var combinedFilters = addAndFilters(filter, extraFilters);
|
|
1800
1827
|
if (Array.isArray(filter)) {
|
|
@@ -1885,17 +1912,6 @@ var combineFilters = function combineFilters(array1, array2) {
|
|
|
1885
1912
|
return [[].concat(validArray1[0] || [], validArray2[0] || [])];
|
|
1886
1913
|
}
|
|
1887
1914
|
};
|
|
1888
|
-
function combineForCustomMetricFilters(filters, customFilters) {
|
|
1889
|
-
var combinedFilters = [];
|
|
1890
|
-
if (customFilters && isAvailable(customFilters)) {
|
|
1891
|
-
customFilters.forEach(function (orFilterGroup) {
|
|
1892
|
-
combinedFilters = [].concat(combinedFilters, addAndFilters(filters != null ? filters : [], orFilterGroup));
|
|
1893
|
-
});
|
|
1894
|
-
} else {
|
|
1895
|
-
combinedFilters = filters != null ? filters : [];
|
|
1896
|
-
}
|
|
1897
|
-
return combinedFilters;
|
|
1898
|
-
}
|
|
1899
1915
|
|
|
1900
1916
|
var generateId = function generateId() {
|
|
1901
1917
|
return uuid.v4().replace(/-/g, '');
|
|
@@ -1926,8 +1942,7 @@ var init$1 = function init(publicName, denominatorFieldId, denominatorAggregate,
|
|
|
1926
1942
|
};
|
|
1927
1943
|
var build$2 = function build(customField, queryEngineConfig, dataSet, _queryHasDimension, params) {
|
|
1928
1944
|
var _params$filterConfig$, _params$filterConfig, _customField$numerato, _customField$numerato2, _customField$denomina, _customField$denomina2;
|
|
1929
|
-
var
|
|
1930
|
-
var _buildPercentageFilte = buildPercentageFilters(addAndFilters((_params$filterConfig$ = params == null || (_params$filterConfig = params.filterConfig) == null ? void 0 : _params$filterConfig.viewFilters) != null ? _params$filterConfig$ : [], localAndDashboardFilters), customField),
|
|
1945
|
+
var _buildPercentageFilte = buildPercentageFilters((_params$filterConfig$ = params == null || (_params$filterConfig = params.filterConfig) == null ? void 0 : _params$filterConfig.viewFilters) != null ? _params$filterConfig$ : [], customField),
|
|
1931
1946
|
combinedNominatorFilters = _buildPercentageFilte.combinedNominatorFilters,
|
|
1932
1947
|
combinedDenominatorFilters = _buildPercentageFilte.combinedDenominatorFilters;
|
|
1933
1948
|
var left = {
|
|
@@ -2015,16 +2030,12 @@ function buildPercentageFilters(filters, customField) {
|
|
|
2015
2030
|
var combinedNominatorFilters = [];
|
|
2016
2031
|
var combinedDenominatorFilters = [];
|
|
2017
2032
|
if (customField.numeratorFilter && isAvailable(customField.numeratorFilter)) {
|
|
2018
|
-
customField.numeratorFilter
|
|
2019
|
-
combinedNominatorFilters = [].concat(combinedNominatorFilters, addAndFilters(filters != null ? filters : [], orFilterGroup));
|
|
2020
|
-
});
|
|
2033
|
+
combinedNominatorFilters = addAndFilters(filters != null ? filters : [], customField.numeratorFilter);
|
|
2021
2034
|
} else {
|
|
2022
2035
|
combinedNominatorFilters = filters != null ? filters : [];
|
|
2023
2036
|
}
|
|
2024
2037
|
if (customField.denominatorFilter && isAvailable(customField.denominatorFilter)) {
|
|
2025
|
-
customField.denominatorFilter
|
|
2026
|
-
combinedDenominatorFilters = [].concat(combinedDenominatorFilters, addAndFilters(filters != null ? filters : [], orFilterGroup));
|
|
2027
|
-
});
|
|
2038
|
+
combinedDenominatorFilters = addAndFilters(filters != null ? filters : [], customField.denominatorFilter);
|
|
2028
2039
|
} else {
|
|
2029
2040
|
combinedDenominatorFilters = filters != null ? filters : [];
|
|
2030
2041
|
}
|
|
@@ -2308,6 +2319,13 @@ var init$7 = function init(publicName, metric, queryEngineConfig) {
|
|
|
2308
2319
|
};
|
|
2309
2320
|
};
|
|
2310
2321
|
|
|
2322
|
+
function combineForCustomMetricFilters(filters, customFilters) {
|
|
2323
|
+
if (customFilters && isAvailable(customFilters)) {
|
|
2324
|
+
return addAndFilters(filters != null ? filters : [], customFilters);
|
|
2325
|
+
}
|
|
2326
|
+
return filters != null ? filters : [];
|
|
2327
|
+
}
|
|
2328
|
+
|
|
2311
2329
|
var PropertyType = /*#__PURE__*/function (PropertyType) {
|
|
2312
2330
|
PropertyType["Operator"] = "operator";
|
|
2313
2331
|
PropertyType["IfLogic"] = "ifLogic";
|
|
@@ -2327,7 +2345,7 @@ var OperatorType = /*#__PURE__*/function (OperatorType) {
|
|
|
2327
2345
|
|
|
2328
2346
|
var build$8 = function build(measureAttribute, customField, dataSet, queryEngineConfig, params) {
|
|
2329
2347
|
if (customField.metric.type === PropertyType.IfLogic) {
|
|
2330
|
-
return buildIfLogic(customField.metric, dataSet,
|
|
2348
|
+
return buildIfLogic(customField.metric, dataSet, queryEngineConfig, params, measureAttribute);
|
|
2331
2349
|
}
|
|
2332
2350
|
if (customField.metric.type === PropertyType.Aggregate) {
|
|
2333
2351
|
return buildAggregate(customField.metric);
|
|
@@ -2340,7 +2358,7 @@ var build$8 = function build(measureAttribute, customField, dataSet, queryEngine
|
|
|
2340
2358
|
}
|
|
2341
2359
|
return buildOperator(customField.metric, dataSet, params, measureAttribute, false);
|
|
2342
2360
|
};
|
|
2343
|
-
var buildIfLogic = function buildIfLogic(ifLogic, dataSet,
|
|
2361
|
+
var buildIfLogic = function buildIfLogic(ifLogic, dataSet, queryEngineConfig, params, measureAttribute) {
|
|
2344
2362
|
var alwaysTrueFilter = [[{
|
|
2345
2363
|
value: 1,
|
|
2346
2364
|
op: '=',
|
|
@@ -2352,7 +2370,7 @@ var buildIfLogic = function buildIfLogic(ifLogic, dataSet, localAndDashboardFilt
|
|
|
2352
2370
|
var cases = function () {
|
|
2353
2371
|
var thenCases = ifLogic.cases.map(function (c) {
|
|
2354
2372
|
var _params$filterConfig$, _params$filterConfig;
|
|
2355
|
-
var customMetricFilter = combineForCustomMetricFilters(
|
|
2373
|
+
var customMetricFilter = combineForCustomMetricFilters((_params$filterConfig$ = params == null || (_params$filterConfig = params.filterConfig) == null ? void 0 : _params$filterConfig.viewFilters) != null ? _params$filterConfig$ : [], c.filter);
|
|
2356
2374
|
return {
|
|
2357
2375
|
returns: buildMetric(c.returns, dataSet, params, measureAttribute),
|
|
2358
2376
|
filter: filterAttributeToQueryFilter(customMetricFilter, queryEngineConfig, dataSet, params)
|
|
@@ -15109,9 +15127,8 @@ var fieldSchema = /*#__PURE__*/Joi.object({
|
|
|
15109
15127
|
dataSetId: /*#__PURE__*/Joi.string().required()
|
|
15110
15128
|
});
|
|
15111
15129
|
var optionsFiltersSchema = function optionsFiltersSchema(queryEngineConfig) {
|
|
15112
|
-
|
|
15113
|
-
|
|
15114
|
-
Joi.array().items(filterSchema(queryEngineConfig)).optional());
|
|
15130
|
+
var innerArraySchema = Joi.array().items(filterSchema(queryEngineConfig));
|
|
15131
|
+
return Joi.object().pattern(Joi.string(), Joi.array().items(innerArraySchema).optional());
|
|
15115
15132
|
};
|
|
15116
15133
|
var sharedAdditionalFilterSchema = function sharedAdditionalFilterSchema(queryEngineConfig) {
|
|
15117
15134
|
return {
|
|
@@ -26534,7 +26551,7 @@ var buildFilterQuery = function buildFilterQuery(dataSet, fieldId, optionsFilter
|
|
|
26534
26551
|
"function": 'count'
|
|
26535
26552
|
}];
|
|
26536
26553
|
var order = optionsOrders != null ? optionsOrders : [];
|
|
26537
|
-
var filter = optionsFilters ?
|
|
26554
|
+
var filter = optionsFilters != null ? optionsFilters : [];
|
|
26538
26555
|
var dimension = [{
|
|
26539
26556
|
field: fieldId,
|
|
26540
26557
|
"function": 'none'
|
|
@@ -39544,7 +39561,7 @@ var PanelProperty = function PanelProperty(props) {
|
|
|
39544
39561
|
|
|
39545
39562
|
var buildFieldOptions = function buildFieldOptions(filterType, dataSets, selectedDataSetIndexes) {
|
|
39546
39563
|
return [].concat(dataSets).flatMap(function (dataSet, dataSetIndex) {
|
|
39547
|
-
|
|
39564
|
+
if (!selectedDataSetIndexes.includes(dataSetIndex)) return [];
|
|
39548
39565
|
return [].concat(takeNonCustomFields(dataSet)).filter(function (field) {
|
|
39549
39566
|
var allowedDataTypes = allowedDataTypesForFilter(filterType);
|
|
39550
39567
|
return allowedDataTypes.includes(field.dataType);
|
|
@@ -39554,8 +39571,7 @@ var buildFieldOptions = function buildFieldOptions(filterType, dataSets, selecte
|
|
|
39554
39571
|
value: {
|
|
39555
39572
|
dataSetId: dataSet.id,
|
|
39556
39573
|
field: field
|
|
39557
|
-
}
|
|
39558
|
-
hide: hide
|
|
39574
|
+
}
|
|
39559
39575
|
};
|
|
39560
39576
|
});
|
|
39561
39577
|
});
|
|
@@ -39776,11 +39792,13 @@ var AddFilterForm = function AddFilterForm(props) {
|
|
|
39776
39792
|
filterType: filterType
|
|
39777
39793
|
});
|
|
39778
39794
|
};
|
|
39779
|
-
var setSelectedDataSets = function setSelectedDataSets(
|
|
39780
|
-
|
|
39781
|
-
|
|
39782
|
-
|
|
39783
|
-
|
|
39795
|
+
var setSelectedDataSets = function setSelectedDataSets(_, dataSetIndex) {
|
|
39796
|
+
if (dataSetIndex !== null) {
|
|
39797
|
+
dispatch({
|
|
39798
|
+
type: 'setSelectedDataSets',
|
|
39799
|
+
selectedDataSetIndexes: [dataSetIndex]
|
|
39800
|
+
});
|
|
39801
|
+
}
|
|
39784
39802
|
};
|
|
39785
39803
|
var setAdvancedOptions = function setAdvancedOptions(options) {
|
|
39786
39804
|
dispatch({
|
|
@@ -39788,11 +39806,13 @@ var AddFilterForm = function AddFilterForm(props) {
|
|
|
39788
39806
|
options: options
|
|
39789
39807
|
});
|
|
39790
39808
|
};
|
|
39791
|
-
var setSelectedFields = function setSelectedFields(
|
|
39792
|
-
|
|
39793
|
-
|
|
39794
|
-
|
|
39795
|
-
|
|
39809
|
+
var setSelectedFields = function setSelectedFields(_, fieldIndex) {
|
|
39810
|
+
if (fieldIndex !== null) {
|
|
39811
|
+
dispatch({
|
|
39812
|
+
type: 'setSelectedFields',
|
|
39813
|
+
selectedFieldIndexes: [fieldIndex]
|
|
39814
|
+
});
|
|
39815
|
+
}
|
|
39796
39816
|
};
|
|
39797
39817
|
var getFilterTypeOptions = function getFilterTypeOptions() {
|
|
39798
39818
|
var filterTypes = [{
|
|
@@ -39819,6 +39839,8 @@ var AddFilterForm = function AddFilterForm(props) {
|
|
|
39819
39839
|
}
|
|
39820
39840
|
return filterTypes;
|
|
39821
39841
|
};
|
|
39842
|
+
var selectedDataSet = selectedDataSetIndexes.length > 0 ? dataSetOptions[selectedDataSetIndexes[0]].value : null;
|
|
39843
|
+
var selectedField = selectedFieldIndexes.length > 0 ? fieldOptions[selectedFieldIndexes[0]].value : null;
|
|
39822
39844
|
return jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
39823
39845
|
children: [jsxRuntime.jsx(Modal.Header, {
|
|
39824
39846
|
title: textOverride('new_filter', 'New filter'),
|
|
@@ -39835,13 +39857,13 @@ var AddFilterForm = function AddFilterForm(props) {
|
|
|
39835
39857
|
}
|
|
39836
39858
|
})
|
|
39837
39859
|
}), dataSetOptions.length > 1 && jsxRuntime.jsx(PanelProperty, {
|
|
39838
|
-
children: jsxRuntime.jsx(
|
|
39860
|
+
children: jsxRuntime.jsx(Select$2, {
|
|
39839
39861
|
id: "data-set",
|
|
39840
39862
|
label: textOverride('data_sets', 'Data sets'),
|
|
39841
39863
|
placeholder: textOverride('data_sets_placeholder', 'Which data sets will this filter impact?'),
|
|
39842
39864
|
options: dataSetOptions,
|
|
39843
|
-
selected:
|
|
39844
|
-
|
|
39865
|
+
selected: selectedDataSet,
|
|
39866
|
+
onChange: setSelectedDataSets,
|
|
39845
39867
|
textOverride: textOverride
|
|
39846
39868
|
})
|
|
39847
39869
|
}), jsxRuntime.jsx(PanelProperty, {
|
|
@@ -39855,13 +39877,13 @@ var AddFilterForm = function AddFilterForm(props) {
|
|
|
39855
39877
|
textOverride: textOverride
|
|
39856
39878
|
})
|
|
39857
39879
|
}), jsxRuntime.jsx(PanelProperty, {
|
|
39858
|
-
children: jsxRuntime.jsx(
|
|
39880
|
+
children: jsxRuntime.jsx(Select$2, {
|
|
39859
39881
|
label: textOverride('fields', 'Fields'),
|
|
39860
39882
|
id: "data-set-fields",
|
|
39861
39883
|
placeholder: textOverride('fields_placeholder', 'Which fields will this filter impact?'),
|
|
39862
39884
|
options: fieldOptions,
|
|
39863
|
-
selected:
|
|
39864
|
-
|
|
39885
|
+
selected: selectedField,
|
|
39886
|
+
onChange: setSelectedFields,
|
|
39865
39887
|
textOverride: textOverride
|
|
39866
39888
|
})
|
|
39867
39889
|
}), draftFilter.type === 'dateFilter' && jsxRuntime.jsx(PanelProperty, {
|
|
@@ -40250,9 +40272,9 @@ var _GlobalFiltersView = /*#__PURE__*/withCustomRenderGuard(function (props) {
|
|
|
40250
40272
|
}),
|
|
40251
40273
|
filterIndex: globalFilterIndex,
|
|
40252
40274
|
onChange: function onChange(newFilter) {
|
|
40253
|
-
var
|
|
40254
|
-
|
|
40255
|
-
props.setGlobalFilters(
|
|
40275
|
+
var newGlobalFilters = [].concat(props.globalFilters);
|
|
40276
|
+
newGlobalFilters[globalFilterIndex] = newFilter;
|
|
40277
|
+
props.setGlobalFilters(newGlobalFilters);
|
|
40256
40278
|
}
|
|
40257
40279
|
}, globalFilterIndex);
|
|
40258
40280
|
})
|
|
@@ -44457,7 +44479,7 @@ var buildMargin = function buildMargin(yTicks, showYAxisLabels, hasYAxisTitle, h
|
|
|
44457
44479
|
};
|
|
44458
44480
|
var buildMarginForHorizontalChart = function buildMarginForHorizontalChart(xTicks, yTicks, showXAxisLabels, showYAxisLabels, hasYAxisTitle, hasXAxisTitle) {
|
|
44459
44481
|
var maxWidth = _.max(yTicks.map(function (tick) {
|
|
44460
|
-
return (tick.formattedValue || '').length * ASSUMED_AVERAGE_CHAR_WIDTH;
|
|
44482
|
+
return (tick.formattedValue || '').split(/[\n\s]+/)[0].length * ASSUMED_AVERAGE_CHAR_WIDTH;
|
|
44461
44483
|
}));
|
|
44462
44484
|
var showXTicks = showXAxisLabels && xTicks.length > 0;
|
|
44463
44485
|
var showYTicks = showYAxisLabels && yTicks.length > 0;
|
|
@@ -52761,17 +52783,19 @@ var CustomCell = function CustomCell(_ref) {
|
|
|
52761
52783
|
* Adds in drill down filters as `AND` conditions to the existing filter query.
|
|
52762
52784
|
*/
|
|
52763
52785
|
var addDrillDownFilters = function addDrillDownFilters(selectedRow, dimension, filter) {
|
|
52764
|
-
var drillDownFilters =
|
|
52765
|
-
var
|
|
52766
|
-
|
|
52767
|
-
|
|
52768
|
-
|
|
52769
|
-
|
|
52770
|
-
|
|
52771
|
-
|
|
52772
|
-
|
|
52773
|
-
|
|
52774
|
-
|
|
52786
|
+
var drillDownFilters = selectedRow.map(function (row) {
|
|
52787
|
+
var fields = Object.keys(row);
|
|
52788
|
+
return fields.map(function (field) {
|
|
52789
|
+
var _dimension$find;
|
|
52790
|
+
return {
|
|
52791
|
+
field: field,
|
|
52792
|
+
op: '=',
|
|
52793
|
+
value: row[field],
|
|
52794
|
+
"function": ((_dimension$find = dimension.find(function (d) {
|
|
52795
|
+
return d.field === field;
|
|
52796
|
+
})) == null ? void 0 : _dimension$find["function"]) || 'none'
|
|
52797
|
+
};
|
|
52798
|
+
});
|
|
52775
52799
|
});
|
|
52776
52800
|
return addAndFilters(filter, drillDownFilters);
|
|
52777
52801
|
};
|
|
@@ -74126,7 +74150,7 @@ var toQueries$1 = function toQueries$1(additionalFilter, dataSets, queryEngineCo
|
|
|
74126
74150
|
if (!dataSet) throw 'Data set not found for additional filter query';
|
|
74127
74151
|
var dataSetField = findField(dataSet, field.fieldId);
|
|
74128
74152
|
if (dataSetField.dataType == 'string[]') {
|
|
74129
|
-
var queryFilter = filterAttributeToQueryFilter(
|
|
74153
|
+
var queryFilter = filterAttributeToQueryFilter(getOptionsFilters(additionalFilter, field), queryEngineConfig, dataSet, params);
|
|
74130
74154
|
var _QueryLogic$buildUniq = buildUniqueArrayValuesPreparedQuery(field.dataSetId, dataSetField, queryFilter),
|
|
74131
74155
|
query = _QueryLogic$buildUniq.query,
|
|
74132
74156
|
resultFields = _QueryLogic$buildUniq.resultFields;
|
|
@@ -74149,9 +74173,20 @@ var toQueries$1 = function toQueries$1(additionalFilter, dataSets, queryEngineCo
|
|
|
74149
74173
|
};
|
|
74150
74174
|
};
|
|
74151
74175
|
function getOptionsFilters(additionalFilter, field) {
|
|
74152
|
-
|
|
74153
|
-
|
|
74154
|
-
|
|
74176
|
+
if (!additionalFilter.optionsFilters) {
|
|
74177
|
+
return [];
|
|
74178
|
+
}
|
|
74179
|
+
if (!(field.dataSetId in additionalFilter.optionsFilters)) {
|
|
74180
|
+
return [];
|
|
74181
|
+
}
|
|
74182
|
+
var optionsFilters = additionalFilter.optionsFilters[field.dataSetId];
|
|
74183
|
+
var orFilter = optionsFilters.map(function (filter) {
|
|
74184
|
+
return filter.filter(function (f) {
|
|
74185
|
+
return f.field !== field.fieldId;
|
|
74186
|
+
});
|
|
74187
|
+
});
|
|
74188
|
+
return orFilter.filter(function (f) {
|
|
74189
|
+
return f.length > 0;
|
|
74155
74190
|
});
|
|
74156
74191
|
}
|
|
74157
74192
|
function getOptionsOrders(dataSetField) {
|
|
@@ -74438,8 +74473,11 @@ var buildVizzlyQuery = function buildVizzlyQuery(thing, queryEngineConfig, param
|
|
|
74438
74473
|
query = _QueryLogic$buildPreA.query,
|
|
74439
74474
|
rF = _QueryLogic$buildPreA.resultFields;
|
|
74440
74475
|
var underlyingDataSet = find(params.dataSets, underlyingDataSetId);
|
|
74441
|
-
var
|
|
74442
|
-
|
|
74476
|
+
var filter = filterAttributeToQueryFilter([], queryEngineConfig, underlyingDataSet, _extends({}, params, {
|
|
74477
|
+
filterConfig: _extends({}, params.filterConfig, {
|
|
74478
|
+
viewFilters: undefined
|
|
74479
|
+
})
|
|
74480
|
+
}));
|
|
74443
74481
|
queriesToSend = [_extends({}, query, {
|
|
74444
74482
|
filter: (_filter = {}, _filter[underlyingDataSet.id] = filter, _filter)
|
|
74445
74483
|
})];
|