autoql-fe-utils 1.0.21 → 1.0.22
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/index.d.ts +414 -245
- package/dist/index.global.js +594 -173
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +615 -176
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +605 -175
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1017,20 +1017,6 @@ var require_lodash = __commonJS({
|
|
|
1017
1017
|
}
|
|
1018
1018
|
});
|
|
1019
1019
|
|
|
1020
|
-
// src/HelperFns/stringHelpers.ts
|
|
1021
|
-
var capitalizeFirstChar = (string) => {
|
|
1022
|
-
let capitalized = string;
|
|
1023
|
-
try {
|
|
1024
|
-
capitalized = string.charAt(0).toUpperCase() + string.slice(1);
|
|
1025
|
-
} catch (error) {
|
|
1026
|
-
console.error(error);
|
|
1027
|
-
}
|
|
1028
|
-
return capitalized;
|
|
1029
|
-
};
|
|
1030
|
-
var isNumber = (str) => {
|
|
1031
|
-
return /^\d+$/.test(str);
|
|
1032
|
-
};
|
|
1033
|
-
|
|
1034
1020
|
// src/dayjsWithPlugins.ts
|
|
1035
1021
|
import dayjs from "dayjs";
|
|
1036
1022
|
import advancedFormat from "dayjs/plugin/advancedFormat.js";
|
|
@@ -1069,6 +1055,26 @@ dayjs.extend(customParseFormat);
|
|
|
1069
1055
|
})();
|
|
1070
1056
|
var dayjsWithPlugins_default = dayjs;
|
|
1071
1057
|
|
|
1058
|
+
// src/HelperFns/stringHelpers.ts
|
|
1059
|
+
var capitalizeFirstChar = (string) => {
|
|
1060
|
+
let capitalized = string;
|
|
1061
|
+
try {
|
|
1062
|
+
capitalized = string.charAt(0).toUpperCase() + string.slice(1);
|
|
1063
|
+
} catch (error) {
|
|
1064
|
+
console.error(error);
|
|
1065
|
+
}
|
|
1066
|
+
return capitalized;
|
|
1067
|
+
};
|
|
1068
|
+
var isNumber = (str) => {
|
|
1069
|
+
return /^\d+$/.test(str);
|
|
1070
|
+
};
|
|
1071
|
+
var getTitleCase = (str) => {
|
|
1072
|
+
if ((str == null ? void 0 : str.length) < 2) {
|
|
1073
|
+
return str;
|
|
1074
|
+
}
|
|
1075
|
+
return str[0].toUpperCase() + str.substring(1);
|
|
1076
|
+
};
|
|
1077
|
+
|
|
1072
1078
|
// src/HelperFns/columnHelpers.ts
|
|
1073
1079
|
import { v4 as uuid } from "uuid";
|
|
1074
1080
|
import _cloneDeep from "lodash.clonedeep";
|
|
@@ -1109,11 +1115,19 @@ var ColumnTypes = /* @__PURE__ */ ((ColumnTypes2) => {
|
|
|
1109
1115
|
ColumnTypes2["DATE_STRING"] = "DATE_STRING";
|
|
1110
1116
|
return ColumnTypes2;
|
|
1111
1117
|
})(ColumnTypes || {});
|
|
1112
|
-
var DataExplorerTypes = /* @__PURE__ */ ((
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1118
|
+
var DataExplorerTypes = /* @__PURE__ */ ((DataExplorerTypes3) => {
|
|
1119
|
+
DataExplorerTypes3["SUBJECT_TYPE"] = "SUBJECT";
|
|
1120
|
+
DataExplorerTypes3["VL_TYPE"] = "VL";
|
|
1121
|
+
DataExplorerTypes3["TEXT_TYPE"] = "TEXT";
|
|
1122
|
+
return DataExplorerTypes3;
|
|
1116
1123
|
})(DataExplorerTypes || {});
|
|
1124
|
+
var SampleQueryReplacementTypes = /* @__PURE__ */ ((SampleQueryReplacementTypes2) => {
|
|
1125
|
+
SampleQueryReplacementTypes2["SAMPLE_QUERY_TEXT_TYPE"] = "TEXT";
|
|
1126
|
+
SampleQueryReplacementTypes2["SAMPLE_QUERY_VL_TYPE"] = "VL";
|
|
1127
|
+
SampleQueryReplacementTypes2["SAMPLE_QUERY_TIME_TYPE"] = "DUCKLING_TIME";
|
|
1128
|
+
SampleQueryReplacementTypes2["SAMPLE_QUERY_AMOUNT_TYPE"] = "DUCKLING_AMOUNT";
|
|
1129
|
+
return SampleQueryReplacementTypes2;
|
|
1130
|
+
})(SampleQueryReplacementTypes || {});
|
|
1117
1131
|
var DisplayTypes = /* @__PURE__ */ ((DisplayTypes2) => {
|
|
1118
1132
|
DisplayTypes2["TABLE"] = "table";
|
|
1119
1133
|
DisplayTypes2["PIVOT_TABLE"] = "pivot_table";
|
|
@@ -1132,7 +1146,48 @@ var DisplayTypes = /* @__PURE__ */ ((DisplayTypes2) => {
|
|
|
1132
1146
|
return DisplayTypes2;
|
|
1133
1147
|
})(DisplayTypes || {});
|
|
1134
1148
|
|
|
1135
|
-
// src/
|
|
1149
|
+
// src/Classes/ColumnType.ts
|
|
1150
|
+
var ColumnType = class {
|
|
1151
|
+
constructor({
|
|
1152
|
+
type,
|
|
1153
|
+
description,
|
|
1154
|
+
continuous,
|
|
1155
|
+
ordinal,
|
|
1156
|
+
aggOptions,
|
|
1157
|
+
aggregable,
|
|
1158
|
+
isNumber: isNumber2,
|
|
1159
|
+
icon,
|
|
1160
|
+
unit
|
|
1161
|
+
}) {
|
|
1162
|
+
var _a, _b;
|
|
1163
|
+
this.type = (_a = type != null ? type : description) != null ? _a : "";
|
|
1164
|
+
this.description = (_b = description != null ? description : type) != null ? _b : "";
|
|
1165
|
+
this.continuous = !!continuous;
|
|
1166
|
+
this.ordinal = !!ordinal;
|
|
1167
|
+
this.aggOptions = aggOptions != null ? aggOptions : aggregable ? Object.values(AggTypes) : [];
|
|
1168
|
+
this.aggregable = !!this.aggOptions.length;
|
|
1169
|
+
this.isNumber = !!isNumber2;
|
|
1170
|
+
this.icon = icon;
|
|
1171
|
+
this.unit = this.isNumber ? unit != null ? unit : "none" : void 0;
|
|
1172
|
+
}
|
|
1173
|
+
};
|
|
1174
|
+
|
|
1175
|
+
// src/Classes/Column.ts
|
|
1176
|
+
var { DOLLAR_AMT, QUANTITY, PERCENT, RATIO, STRING, DATE, DATE_STRING } = ColumnTypes;
|
|
1177
|
+
var Column = class {
|
|
1178
|
+
constructor(options) {
|
|
1179
|
+
Object.assign(this, options);
|
|
1180
|
+
this.isNumberType = [DOLLAR_AMT, QUANTITY, PERCENT, RATIO].includes(this.type);
|
|
1181
|
+
this.isStringType = [STRING, DATE, DATE_STRING].includes(this.type);
|
|
1182
|
+
this.isDateType = [STRING, DATE].includes(this.type);
|
|
1183
|
+
this.title = this.display_name;
|
|
1184
|
+
if (this.drilldownGroupby) {
|
|
1185
|
+
this.title = `${this.title} <em>(Clicked: "${this.drilldownGroupby.value}")</em>`;
|
|
1186
|
+
}
|
|
1187
|
+
}
|
|
1188
|
+
};
|
|
1189
|
+
|
|
1190
|
+
// src/Classes/AggType.ts
|
|
1136
1191
|
var AggType = class {
|
|
1137
1192
|
constructor({ type, displayName, tooltip, unit, supportsStrings = false, symbol: symbol2, fn = () => {
|
|
1138
1193
|
} }) {
|
|
@@ -1146,35 +1201,73 @@ var AggType = class {
|
|
|
1146
1201
|
}
|
|
1147
1202
|
};
|
|
1148
1203
|
|
|
1204
|
+
// src/Classes/DataExplorerSubject.ts
|
|
1205
|
+
function isSubject(obj) {
|
|
1206
|
+
return obj.query !== void 0;
|
|
1207
|
+
}
|
|
1208
|
+
function isValueLabel(obj) {
|
|
1209
|
+
return obj.canonical !== void 0;
|
|
1210
|
+
}
|
|
1211
|
+
function isPlainText(obj) {
|
|
1212
|
+
return obj.type === "TEXT" /* TEXT_TYPE */;
|
|
1213
|
+
}
|
|
1214
|
+
var DataExplorerSubject = class {
|
|
1215
|
+
constructor(obj) {
|
|
1216
|
+
if (isSubject(obj)) {
|
|
1217
|
+
const { display_name, name, query } = obj;
|
|
1218
|
+
this.id = name;
|
|
1219
|
+
this.type = "SUBJECT" /* SUBJECT_TYPE */;
|
|
1220
|
+
this.query = query;
|
|
1221
|
+
this.formattedType = "Topic";
|
|
1222
|
+
this.displayName = display_name;
|
|
1223
|
+
this.context = name;
|
|
1224
|
+
} else if (isValueLabel(obj)) {
|
|
1225
|
+
const { canonical, keyword, show_message, format_txt } = obj;
|
|
1226
|
+
this.id = canonical;
|
|
1227
|
+
this.type = "VL" /* VL_TYPE */;
|
|
1228
|
+
this.displayName = format_txt != null ? format_txt : keyword;
|
|
1229
|
+
this.formattedType = show_message;
|
|
1230
|
+
this.valueLabel = obj;
|
|
1231
|
+
} else if (isPlainText(obj)) {
|
|
1232
|
+
const { displayName, type } = obj;
|
|
1233
|
+
this.id = displayName;
|
|
1234
|
+
this.type = type;
|
|
1235
|
+
this.text = displayName;
|
|
1236
|
+
this.displayName = displayName;
|
|
1237
|
+
}
|
|
1238
|
+
this.isSubject = () => isSubject(obj);
|
|
1239
|
+
this.isValueLabel = () => isValueLabel(obj);
|
|
1240
|
+
this.isPlainText = () => isPlainText(obj);
|
|
1241
|
+
}
|
|
1242
|
+
};
|
|
1243
|
+
|
|
1149
1244
|
// src/Constants/visualizationConstants.ts
|
|
1150
|
-
var TABLE_TYPES = [
|
|
1151
|
-
"pivot_table",
|
|
1152
|
-
"pivot_column",
|
|
1153
|
-
"date_pivot",
|
|
1154
|
-
"table",
|
|
1155
|
-
"compare_table",
|
|
1156
|
-
"compare_table_budget"
|
|
1157
|
-
];
|
|
1245
|
+
var TABLE_TYPES = ["pivot_table" /* PIVOT_TABLE */, "table" /* TABLE */];
|
|
1158
1246
|
var CHART_TYPES = [
|
|
1159
|
-
"bar"
|
|
1160
|
-
"bubble"
|
|
1161
|
-
"
|
|
1162
|
-
"
|
|
1163
|
-
"
|
|
1164
|
-
"
|
|
1165
|
-
"
|
|
1166
|
-
"
|
|
1167
|
-
"
|
|
1168
|
-
"
|
|
1169
|
-
"
|
|
1170
|
-
"
|
|
1171
|
-
"scatterplot"
|
|
1247
|
+
"bar" /* BAR */,
|
|
1248
|
+
"bubble" /* BUBBLE */,
|
|
1249
|
+
"column" /* COLUMN */,
|
|
1250
|
+
"heatmap" /* HEATMAP */,
|
|
1251
|
+
"line" /* LINE */,
|
|
1252
|
+
"pie" /* PIE */,
|
|
1253
|
+
"stacked_bar" /* STACKED_BAR */,
|
|
1254
|
+
"stacked_column" /* STACKED_COLUMN */,
|
|
1255
|
+
"stacked_line" /* STACKED_LINE */,
|
|
1256
|
+
"column_line" /* COLUMN_LINE */,
|
|
1257
|
+
"histogram" /* HISTOGRAM */,
|
|
1258
|
+
"scatterplot" /* SCATTERPLOT */
|
|
1172
1259
|
];
|
|
1173
|
-
var CHARTS_WITHOUT_LEGENDS = [
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1260
|
+
var CHARTS_WITHOUT_LEGENDS = [
|
|
1261
|
+
"pie" /* PIE */,
|
|
1262
|
+
"heatmap" /* HEATMAP */,
|
|
1263
|
+
"bubble" /* BUBBLE */,
|
|
1264
|
+
"scatterplot" /* SCATTERPLOT */,
|
|
1265
|
+
"histogram" /* HISTOGRAM */
|
|
1266
|
+
];
|
|
1267
|
+
var CHARTS_WITHOUT_AGGREGATED_DATA = ["histogram" /* HISTOGRAM */, "scatterplot" /* SCATTERPLOT */];
|
|
1268
|
+
var DATE_ONLY_CHART_TYPES = ["line" /* LINE */, "stacked_line" /* STACKED_LINE */];
|
|
1269
|
+
var DOUBLE_AXIS_CHART_TYPES = ["column_line" /* COLUMN_LINE */];
|
|
1270
|
+
var CHARTS_WITHOUT_AXES = ["pie" /* PIE */];
|
|
1178
1271
|
var DEFAULT_CHART_CONFIG = {
|
|
1179
1272
|
isScaled: false
|
|
1180
1273
|
};
|
|
@@ -1205,17 +1298,6 @@ var DAYJS_PRECISION_FORMATS = {
|
|
|
1205
1298
|
DATE_HOUR: "ll h:00A",
|
|
1206
1299
|
DATE_MINUTE: "ll h:mmA"
|
|
1207
1300
|
};
|
|
1208
|
-
var PRECISION_TYPES = {
|
|
1209
|
-
DAY: "DAY",
|
|
1210
|
-
MONTH: "MONTH",
|
|
1211
|
-
YEAR: "YEAR",
|
|
1212
|
-
WEEK: "WEEK",
|
|
1213
|
-
QUARTER: "QUARTER",
|
|
1214
|
-
DATE_HOUR: "DATE_HOUR",
|
|
1215
|
-
DATE_MINUTE: "DATE_MINUTE",
|
|
1216
|
-
HOUR: "HOUR",
|
|
1217
|
-
MINUTE: "MINUTE"
|
|
1218
|
-
};
|
|
1219
1301
|
var MAX_LEGEND_LABELS = 22;
|
|
1220
1302
|
var MIN_HISTOGRAM_SAMPLE = 20;
|
|
1221
1303
|
var DEFAULT_AGG_TYPE = "SUM" /* SUM */;
|
|
@@ -1285,6 +1367,124 @@ var AGG_TYPES = {
|
|
|
1285
1367
|
// tooltip: 'The variance will be shown for all data points with the same label.',
|
|
1286
1368
|
// }),
|
|
1287
1369
|
};
|
|
1370
|
+
var DISPLAY_TYPES = {
|
|
1371
|
+
TABLE: {
|
|
1372
|
+
type: "table" /* TABLE */,
|
|
1373
|
+
isTableType: true
|
|
1374
|
+
},
|
|
1375
|
+
PIVOT_TABLE: {
|
|
1376
|
+
type: "pivot_table" /* PIVOT_TABLE */,
|
|
1377
|
+
isTableType: true
|
|
1378
|
+
},
|
|
1379
|
+
BAR: {
|
|
1380
|
+
type: "bar" /* BAR */,
|
|
1381
|
+
isChartType: true,
|
|
1382
|
+
allowLegend: true,
|
|
1383
|
+
allowAgg: true,
|
|
1384
|
+
hasAxes: true,
|
|
1385
|
+
datesOnly: false,
|
|
1386
|
+
multiAxis: false
|
|
1387
|
+
},
|
|
1388
|
+
COLUMN: {
|
|
1389
|
+
type: "column" /* COLUMN */,
|
|
1390
|
+
isChartType: true,
|
|
1391
|
+
allowLegend: true,
|
|
1392
|
+
allowAgg: true,
|
|
1393
|
+
hasAxes: true,
|
|
1394
|
+
datesOnly: false,
|
|
1395
|
+
multiAxis: false
|
|
1396
|
+
},
|
|
1397
|
+
LINE: {
|
|
1398
|
+
type: "line" /* LINE */,
|
|
1399
|
+
isChartType: true,
|
|
1400
|
+
allowLegend: true,
|
|
1401
|
+
allowAgg: true,
|
|
1402
|
+
hasAxes: true,
|
|
1403
|
+
datesOnly: true,
|
|
1404
|
+
multiAxis: false
|
|
1405
|
+
},
|
|
1406
|
+
STACKED_COLUMN: {
|
|
1407
|
+
type: "stacked_column" /* STACKED_COLUMN */,
|
|
1408
|
+
isChartType: true,
|
|
1409
|
+
allowLegend: true,
|
|
1410
|
+
allowAgg: true,
|
|
1411
|
+
hasAxes: true,
|
|
1412
|
+
dateOnly: false,
|
|
1413
|
+
multiAxis: false
|
|
1414
|
+
},
|
|
1415
|
+
STACKED_BAR: {
|
|
1416
|
+
type: "stacked_bar" /* STACKED_BAR */,
|
|
1417
|
+
isChartType: true,
|
|
1418
|
+
allowLegend: true,
|
|
1419
|
+
allowAgg: true,
|
|
1420
|
+
hasAxes: true,
|
|
1421
|
+
dateOnly: false,
|
|
1422
|
+
multiAxis: false
|
|
1423
|
+
},
|
|
1424
|
+
STACKED_LINE: {
|
|
1425
|
+
type: "stacked_line" /* STACKED_LINE */,
|
|
1426
|
+
isChartType: true,
|
|
1427
|
+
allowLegend: true,
|
|
1428
|
+
allowAgg: true,
|
|
1429
|
+
hasAxes: true,
|
|
1430
|
+
dateOnly: false,
|
|
1431
|
+
multiAxis: false
|
|
1432
|
+
},
|
|
1433
|
+
BUBBLE: {
|
|
1434
|
+
type: "bubble" /* BUBBLE */,
|
|
1435
|
+
isChartType: true,
|
|
1436
|
+
allowLegend: false,
|
|
1437
|
+
allowAgg: true,
|
|
1438
|
+
hasAxes: true,
|
|
1439
|
+
dateOnly: false,
|
|
1440
|
+
multiAxis: false
|
|
1441
|
+
},
|
|
1442
|
+
HEATMAP: {
|
|
1443
|
+
type: "heatmap" /* HEATMAP */,
|
|
1444
|
+
isChartType: true,
|
|
1445
|
+
allowLegend: false,
|
|
1446
|
+
allowAgg: true,
|
|
1447
|
+
hasAxes: true,
|
|
1448
|
+
dateOnly: false,
|
|
1449
|
+
multiAxis: false
|
|
1450
|
+
},
|
|
1451
|
+
PIE: {
|
|
1452
|
+
type: "pie" /* PIE */,
|
|
1453
|
+
isChartType: true,
|
|
1454
|
+
allowLegend: false,
|
|
1455
|
+
allowAgg: true,
|
|
1456
|
+
hasAxes: false,
|
|
1457
|
+
dateOnly: false,
|
|
1458
|
+
multiAxis: false
|
|
1459
|
+
},
|
|
1460
|
+
HISTOGRAM: {
|
|
1461
|
+
type: "histogram" /* HISTOGRAM */,
|
|
1462
|
+
isChartType: true,
|
|
1463
|
+
allowLegend: false,
|
|
1464
|
+
allowAgg: false,
|
|
1465
|
+
hasAxes: true,
|
|
1466
|
+
dateOnly: false,
|
|
1467
|
+
multiAxis: false
|
|
1468
|
+
},
|
|
1469
|
+
SCATTERPLOT: {
|
|
1470
|
+
type: "scatterplot" /* SCATTERPLOT */,
|
|
1471
|
+
isChartType: true,
|
|
1472
|
+
allowLegend: false,
|
|
1473
|
+
allowAgg: false,
|
|
1474
|
+
hasAxes: true,
|
|
1475
|
+
dateOnly: false,
|
|
1476
|
+
multiAxis: false
|
|
1477
|
+
},
|
|
1478
|
+
COLUMN_LINE: {
|
|
1479
|
+
type: "column_line" /* COLUMN_LINE */,
|
|
1480
|
+
isChartType: true,
|
|
1481
|
+
allowLegend: true,
|
|
1482
|
+
allowAgg: true,
|
|
1483
|
+
hasAxes: true,
|
|
1484
|
+
dateOnly: false,
|
|
1485
|
+
multiAxis: true
|
|
1486
|
+
}
|
|
1487
|
+
};
|
|
1288
1488
|
|
|
1289
1489
|
// src/HelperFns/arrayHelpers.ts
|
|
1290
1490
|
import isEqual from "lodash.isequal";
|
|
@@ -2084,47 +2284,6 @@ var EVALUATION_FREQUENCY_OPTIONS = {
|
|
|
2084
2284
|
}
|
|
2085
2285
|
};
|
|
2086
2286
|
|
|
2087
|
-
// src/Classes/ColumnType.ts
|
|
2088
|
-
var ColumnType = class {
|
|
2089
|
-
constructor({
|
|
2090
|
-
type,
|
|
2091
|
-
description,
|
|
2092
|
-
continuous,
|
|
2093
|
-
ordinal,
|
|
2094
|
-
aggOptions,
|
|
2095
|
-
aggregable,
|
|
2096
|
-
isNumber: isNumber2,
|
|
2097
|
-
icon,
|
|
2098
|
-
unit
|
|
2099
|
-
}) {
|
|
2100
|
-
var _a, _b;
|
|
2101
|
-
this.type = (_a = type != null ? type : description) != null ? _a : "";
|
|
2102
|
-
this.description = (_b = description != null ? description : type) != null ? _b : "";
|
|
2103
|
-
this.continuous = !!continuous;
|
|
2104
|
-
this.ordinal = !!ordinal;
|
|
2105
|
-
this.aggOptions = aggOptions != null ? aggOptions : aggregable ? Object.values(AggTypes) : [];
|
|
2106
|
-
this.aggregable = !!this.aggOptions.length;
|
|
2107
|
-
this.isNumber = !!isNumber2;
|
|
2108
|
-
this.icon = icon;
|
|
2109
|
-
this.unit = this.isNumber ? unit != null ? unit : "none" : void 0;
|
|
2110
|
-
}
|
|
2111
|
-
};
|
|
2112
|
-
|
|
2113
|
-
// src/Classes/Column.ts
|
|
2114
|
-
var { DOLLAR_AMT, QUANTITY, PERCENT, RATIO, STRING, DATE, DATE_STRING } = ColumnTypes;
|
|
2115
|
-
var Column2 = class {
|
|
2116
|
-
constructor(options) {
|
|
2117
|
-
Object.assign(this, options);
|
|
2118
|
-
this.isNumberType = [DOLLAR_AMT, QUANTITY, PERCENT, RATIO].includes(this.type);
|
|
2119
|
-
this.isStringType = [STRING, DATE, DATE_STRING].includes(this.type);
|
|
2120
|
-
this.isDateType = [STRING, DATE].includes(this.type);
|
|
2121
|
-
this.title = this.display_name;
|
|
2122
|
-
if (this.drilldownGroupby) {
|
|
2123
|
-
this.title = `${this.title} <em>(Clicked: "${this.drilldownGroupby.value}")</em>`;
|
|
2124
|
-
}
|
|
2125
|
-
}
|
|
2126
|
-
};
|
|
2127
|
-
|
|
2128
2287
|
// src/Constants/columnConstants.ts
|
|
2129
2288
|
var COLUMN_TYPES = {
|
|
2130
2289
|
DOLLAR_AMT: new ColumnType({
|
|
@@ -3128,7 +3287,7 @@ var isColumnIndexConfigValid = ({ response, columnIndexConfig, columns, displayT
|
|
|
3128
3287
|
console.debug("Table config invalid: Some of the string columns were hidden.");
|
|
3129
3288
|
return false;
|
|
3130
3289
|
}
|
|
3131
|
-
if (displayType === "column_line" || displayType === "scatterplot") {
|
|
3290
|
+
if (displayType === "column_line" /* COLUMN_LINE */ || displayType === "scatterplot" /* SCATTERPLOT */) {
|
|
3132
3291
|
if (!isColumnIndexValid(columnIndexConfig.numberColumnIndex, columns) || !isColumnIndexValid(columnIndexConfig.numberColumnIndex2, columns) || columnIndexConfig.numberColumnIndex === columnIndexConfig.numberColumnIndex2) {
|
|
3133
3292
|
console.debug(
|
|
3134
3293
|
`Two unique number column indices were not found. This is required for display type: ${displayType}`,
|
|
@@ -3785,13 +3944,23 @@ var formatChartLabel = ({
|
|
|
3785
3944
|
formattedLabel = formatDateStringType(d, col, config);
|
|
3786
3945
|
break;
|
|
3787
3946
|
}
|
|
3947
|
+
case "RATIO" /* RATIO */: {
|
|
3948
|
+
const dNumber = parseFloat(`${d}`);
|
|
3949
|
+
if (!isNaN(dNumber)) {
|
|
3950
|
+
formattedLabel = new Intl.NumberFormat(languageCode, {
|
|
3951
|
+
minimumFractionDigits,
|
|
3952
|
+
maximumFractionDigits
|
|
3953
|
+
}).format(dNumber);
|
|
3954
|
+
}
|
|
3955
|
+
break;
|
|
3956
|
+
}
|
|
3788
3957
|
case "PERCENT" /* PERCENT */: {
|
|
3789
3958
|
if (Number(d) || Number(d) === 0) {
|
|
3790
3959
|
const p = Number(d) / 100;
|
|
3791
3960
|
formattedLabel = new Intl.NumberFormat(languageCode, {
|
|
3792
3961
|
style: "percent",
|
|
3793
|
-
minimumFractionDigits
|
|
3794
|
-
maximumFractionDigits
|
|
3962
|
+
minimumFractionDigits,
|
|
3963
|
+
maximumFractionDigits
|
|
3795
3964
|
}).format(p);
|
|
3796
3965
|
}
|
|
3797
3966
|
break;
|
|
@@ -4149,6 +4318,7 @@ var LIGHT_THEME = {
|
|
|
4149
4318
|
"table-border-color": "#EFEFEF",
|
|
4150
4319
|
"hover-color": "#F6F7F9",
|
|
4151
4320
|
"text-color-primary": "#343434",
|
|
4321
|
+
"text-color-secondary": "#8b8b8b",
|
|
4152
4322
|
"text-color-accent": "#FFFFFF",
|
|
4153
4323
|
"text-color-placeholder": "#0000004D",
|
|
4154
4324
|
"dashboard-title-color": "#28A8E0",
|
|
@@ -4183,6 +4353,7 @@ var DARK_THEME = {
|
|
|
4183
4353
|
"border-color": "#53565c",
|
|
4184
4354
|
"hover-color": "#4a4f56",
|
|
4185
4355
|
"text-color-primary": "#ececec",
|
|
4356
|
+
"text-color-secondary": "#bababa",
|
|
4186
4357
|
"text-color-accent": "#ffffff",
|
|
4187
4358
|
"text-color-placeholder": "#ffffff6e",
|
|
4188
4359
|
"dashboard-title-color": "#193a48",
|
|
@@ -4215,6 +4386,7 @@ var defaultThemeConfig = {
|
|
|
4215
4386
|
accentColor: "#26A7E9",
|
|
4216
4387
|
fontFamily: "sans-serif",
|
|
4217
4388
|
textColor: void 0,
|
|
4389
|
+
textColorSecondary: void 0,
|
|
4218
4390
|
accentTextColor: void 0,
|
|
4219
4391
|
dashboardTitleColor: void 0,
|
|
4220
4392
|
backgroundColorPrimary: void 0,
|
|
@@ -4226,7 +4398,7 @@ var getThemeConfig = (customThemeConfig = {}) => {
|
|
|
4226
4398
|
...customThemeConfig
|
|
4227
4399
|
};
|
|
4228
4400
|
};
|
|
4229
|
-
var
|
|
4401
|
+
var getRBGFromHex = (hex) => {
|
|
4230
4402
|
let color2 = hex;
|
|
4231
4403
|
if (color2.slice(0, 1) === "#") {
|
|
4232
4404
|
color2 = color2.slice(1);
|
|
@@ -4237,6 +4409,10 @@ var getYIQFromHex = (hex) => {
|
|
|
4237
4409
|
const r = parseInt(color2.substr(0, 2), 16);
|
|
4238
4410
|
const g = parseInt(color2.substr(2, 2), 16);
|
|
4239
4411
|
const b = parseInt(color2.substr(4, 2), 16);
|
|
4412
|
+
return { r, g, b };
|
|
4413
|
+
};
|
|
4414
|
+
var getYIQFromHex = (hex) => {
|
|
4415
|
+
const { r, g, b } = getRBGFromHex(hex);
|
|
4240
4416
|
const yiq = (r * 299 + g * 587 + b * 114) / 1e3;
|
|
4241
4417
|
return yiq;
|
|
4242
4418
|
};
|
|
@@ -4324,11 +4500,11 @@ var setChartColors = (providedChartColors, themeStyles) => {
|
|
|
4324
4500
|
}
|
|
4325
4501
|
chartColors.forEach((color2, i) => {
|
|
4326
4502
|
themeStyles[`chart-color-${i}`] = color2;
|
|
4327
|
-
const darkerColor = lightenDarkenColor(color2, -
|
|
4503
|
+
const darkerColor = lightenDarkenColor(color2, -50);
|
|
4328
4504
|
themeStyles[`chart-color-dark-${i}`] = darkerColor;
|
|
4329
4505
|
});
|
|
4330
4506
|
};
|
|
4331
|
-
var configureTheme = (customThemeConfig = {}) => {
|
|
4507
|
+
var configureTheme = (customThemeConfig = {}, prefix = "react-autoql") => {
|
|
4332
4508
|
const {
|
|
4333
4509
|
theme,
|
|
4334
4510
|
textColor,
|
|
@@ -4336,6 +4512,7 @@ var configureTheme = (customThemeConfig = {}) => {
|
|
|
4336
4512
|
chartColors,
|
|
4337
4513
|
accentColor,
|
|
4338
4514
|
accentTextColor,
|
|
4515
|
+
textColorSecondary,
|
|
4339
4516
|
dashboardTitleColor,
|
|
4340
4517
|
backgroundColorPrimary,
|
|
4341
4518
|
backgroundColorSecondary
|
|
@@ -4344,6 +4521,9 @@ var configureTheme = (customThemeConfig = {}) => {
|
|
|
4344
4521
|
if (textColor) {
|
|
4345
4522
|
themeStyles["text-color-primary"] = textColor;
|
|
4346
4523
|
}
|
|
4524
|
+
if (textColorSecondary) {
|
|
4525
|
+
themeStyles["text-color-secondary"] = textColorSecondary;
|
|
4526
|
+
}
|
|
4347
4527
|
if (accentTextColor) {
|
|
4348
4528
|
themeStyles["text-color-accent"] = accentTextColor;
|
|
4349
4529
|
} else {
|
|
@@ -4364,7 +4544,15 @@ var configureTheme = (customThemeConfig = {}) => {
|
|
|
4364
4544
|
}
|
|
4365
4545
|
setChartColors(chartColors, themeStyles);
|
|
4366
4546
|
for (const property in themeStyles) {
|
|
4367
|
-
document.documentElement.style.setProperty(
|
|
4547
|
+
document.documentElement.style.setProperty(`--${prefix}-${property}`, themeStyles[property]);
|
|
4548
|
+
}
|
|
4549
|
+
try {
|
|
4550
|
+
const { r, g, b } = getRBGFromHex(themeStyles["accent-color"]);
|
|
4551
|
+
document.documentElement.style.setProperty(`--${prefix}-accent-color-R`, `${r}`);
|
|
4552
|
+
document.documentElement.style.setProperty(`--${prefix}-accent-color-G`, `${g}`);
|
|
4553
|
+
document.documentElement.style.setProperty(`--${prefix}-accent-color-B`, `${b}`);
|
|
4554
|
+
} catch (error) {
|
|
4555
|
+
console.error(error);
|
|
4368
4556
|
}
|
|
4369
4557
|
};
|
|
4370
4558
|
|
|
@@ -4787,7 +4975,7 @@ var generateDatePivotData = ({ rows, columns, tableConfig, dataFormatting } = {}
|
|
|
4787
4975
|
headerFilter: false,
|
|
4788
4976
|
headerFilterPlaceholder: "filter..."
|
|
4789
4977
|
};
|
|
4790
|
-
const firstPivotColumn = new
|
|
4978
|
+
const firstPivotColumn = new Column({
|
|
4791
4979
|
...pivotMonthColumn,
|
|
4792
4980
|
formatter: (cell) => formatElement({
|
|
4793
4981
|
element: cell.getValue(),
|
|
@@ -4798,7 +4986,7 @@ var generateDatePivotData = ({ rows, columns, tableConfig, dataFormatting } = {}
|
|
|
4798
4986
|
});
|
|
4799
4987
|
const pivotTableColumns = [firstPivotColumn];
|
|
4800
4988
|
Object.keys(uniqueYears).forEach((year, i) => {
|
|
4801
|
-
const pivotColumn = new
|
|
4989
|
+
const pivotColumn = new Column({
|
|
4802
4990
|
...columns[numberColumnIndex],
|
|
4803
4991
|
origColumn: columns[numberColumnIndex],
|
|
4804
4992
|
origValues: {},
|
|
@@ -4877,6 +5065,22 @@ var generateFilterDrilldownResponse = ({ response, rows, index, value }) => {
|
|
|
4877
5065
|
console.error(error);
|
|
4878
5066
|
}
|
|
4879
5067
|
};
|
|
5068
|
+
var uuidv4 = () => {
|
|
5069
|
+
return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, (c) => {
|
|
5070
|
+
var r = Math.random() * 16 | 0, v = c == "x" ? r : r & 3 | 8;
|
|
5071
|
+
return v.toString(16);
|
|
5072
|
+
});
|
|
5073
|
+
};
|
|
5074
|
+
var parseJwt = (token) => {
|
|
5075
|
+
var base64Url = token.split(".")[1];
|
|
5076
|
+
var base64 = base64Url.replace(/-/g, "+").replace(/_/g, "/");
|
|
5077
|
+
var jsonPayload = decodeURIComponent(
|
|
5078
|
+
window.atob(base64).split("").map(function(c) {
|
|
5079
|
+
return "%" + ("00" + c.charCodeAt(0).toString(16)).slice(-2);
|
|
5080
|
+
}).join("")
|
|
5081
|
+
);
|
|
5082
|
+
return JSON.parse(jsonPayload);
|
|
5083
|
+
};
|
|
4880
5084
|
|
|
4881
5085
|
// src/HelperFns/tableHelpers.ts
|
|
4882
5086
|
var formatTableParams = (params, columns) => {
|
|
@@ -7484,7 +7688,7 @@ var transformQueryResponseColumns = (response) => {
|
|
|
7484
7688
|
}
|
|
7485
7689
|
const transformedColumns = columns.map((col, i) => {
|
|
7486
7690
|
const drilldownGroupby = getDrilldownGroupby(response, col);
|
|
7487
|
-
return new
|
|
7691
|
+
return new Column({
|
|
7488
7692
|
...col,
|
|
7489
7693
|
field: `${i}`,
|
|
7490
7694
|
index: i,
|
|
@@ -8119,53 +8323,125 @@ var reportProblem = ({
|
|
|
8119
8323
|
return Promise.reject((_a = error == null ? void 0 : error.response) == null ? void 0 : _a.data);
|
|
8120
8324
|
});
|
|
8121
8325
|
};
|
|
8122
|
-
|
|
8123
|
-
|
|
8124
|
-
|
|
8326
|
+
|
|
8327
|
+
// src/Api/dataExplorerService.ts
|
|
8328
|
+
var getSampleQueryRegex = (suggestionValues) => {
|
|
8329
|
+
const valueArray = Object.keys(suggestionValues);
|
|
8330
|
+
const valueRegexArray = valueArray.map((value) => `(${value})`);
|
|
8331
|
+
const valueRegex = new RegExp(valueRegexArray.join("|"), "gm");
|
|
8332
|
+
return valueRegex;
|
|
8333
|
+
};
|
|
8334
|
+
var getSampleQueryText = (query, values) => {
|
|
8335
|
+
try {
|
|
8336
|
+
const valueArray = Object.keys(values);
|
|
8337
|
+
let queryText = query;
|
|
8338
|
+
valueArray.forEach((valueKey) => {
|
|
8339
|
+
var _a;
|
|
8340
|
+
const valueRegex = new RegExp(`${valueKey}`, "gm");
|
|
8341
|
+
if (values[valueKey]) {
|
|
8342
|
+
queryText = query.replace(valueRegex, (_a = values[valueKey]) == null ? void 0 : _a.value);
|
|
8343
|
+
}
|
|
8344
|
+
});
|
|
8345
|
+
return queryText;
|
|
8346
|
+
} catch (error) {
|
|
8347
|
+
console.error(error);
|
|
8348
|
+
return void 0;
|
|
8125
8349
|
}
|
|
8126
|
-
|
|
8127
|
-
|
|
8128
|
-
|
|
8129
|
-
|
|
8130
|
-
|
|
8131
|
-
|
|
8132
|
-
|
|
8350
|
+
};
|
|
8351
|
+
var transformSuggestionResponse = (suggestions) => {
|
|
8352
|
+
const newSuggestions = [];
|
|
8353
|
+
suggestions.forEach((suggestion) => {
|
|
8354
|
+
const initialQuery = suggestion.query;
|
|
8355
|
+
const initialValues = transformSampleQueryValues(suggestion.values);
|
|
8356
|
+
const chunked = getSampleQueryChunk(suggestion.query, initialValues);
|
|
8357
|
+
const queryText = getSampleQueryText(suggestion.query, initialValues);
|
|
8358
|
+
const newSuggestion = {
|
|
8359
|
+
initialQuery,
|
|
8360
|
+
initialValues,
|
|
8361
|
+
chunked,
|
|
8362
|
+
queryText
|
|
8363
|
+
};
|
|
8364
|
+
newSuggestions.push(newSuggestion);
|
|
8365
|
+
});
|
|
8366
|
+
return newSuggestions;
|
|
8367
|
+
};
|
|
8368
|
+
var transformSampleQueryValues = (originalValues) => {
|
|
8369
|
+
const newValues = {};
|
|
8370
|
+
Object.keys(originalValues).forEach((key) => {
|
|
8133
8371
|
var _a;
|
|
8134
|
-
|
|
8372
|
+
newValues[key] = {
|
|
8373
|
+
replacement: originalValues[key],
|
|
8374
|
+
value: (_a = originalValues[key]) == null ? void 0 : _a.format_txt,
|
|
8375
|
+
type: getSampleQueryReplacementType(key, originalValues[key])
|
|
8376
|
+
};
|
|
8135
8377
|
});
|
|
8378
|
+
return newValues;
|
|
8379
|
+
};
|
|
8380
|
+
var getSampleQueryReplacementType = (key, replacement) => {
|
|
8381
|
+
if (!replacement) {
|
|
8382
|
+
return "TEXT" /* SAMPLE_QUERY_TEXT_TYPE */;
|
|
8383
|
+
} else if (key === "DUCKLING_TIME") {
|
|
8384
|
+
return "DUCKLING_TIME" /* SAMPLE_QUERY_TIME_TYPE */;
|
|
8385
|
+
} else if (key === "DUCKLING_AMOUNT") {
|
|
8386
|
+
return "DUCKLING_AMOUNT" /* SAMPLE_QUERY_AMOUNT_TYPE */;
|
|
8387
|
+
} else if (replacement == null ? void 0 : replacement.canonical) {
|
|
8388
|
+
return "VL" /* SAMPLE_QUERY_VL_TYPE */;
|
|
8389
|
+
} else {
|
|
8390
|
+
console.warn("There was a sample query replacement item but we didnt recognize its type: ", replacement);
|
|
8391
|
+
return;
|
|
8392
|
+
}
|
|
8136
8393
|
};
|
|
8137
|
-
var
|
|
8138
|
-
|
|
8139
|
-
|
|
8140
|
-
|
|
8141
|
-
|
|
8142
|
-
|
|
8143
|
-
|
|
8144
|
-
|
|
8145
|
-
|
|
8146
|
-
|
|
8147
|
-
|
|
8394
|
+
var getSampleQueryChunk = (query, values) => {
|
|
8395
|
+
const valueArray = Object.keys(values);
|
|
8396
|
+
const valueRegexArray = valueArray.map((value) => `(${value})`);
|
|
8397
|
+
const valueRegex = new RegExp(valueRegexArray.join("|"), "gm");
|
|
8398
|
+
const splitStrArray = query.split(valueRegex);
|
|
8399
|
+
const chunkedSuggestion = splitStrArray.map((key) => {
|
|
8400
|
+
var _a;
|
|
8401
|
+
const replacement = (_a = values[key]) == null ? void 0 : _a.replacement;
|
|
8402
|
+
const type = getSampleQueryReplacementType(key, replacement);
|
|
8403
|
+
if (type == "DUCKLING_TIME" /* SAMPLE_QUERY_TIME_TYPE */) {
|
|
8404
|
+
return {
|
|
8405
|
+
type: "TEXT" /* SAMPLE_QUERY_TEXT_TYPE */,
|
|
8406
|
+
value: replacement == null ? void 0 : replacement.format_txt
|
|
8407
|
+
};
|
|
8408
|
+
} else if (type == "DUCKLING_AMOUNT" /* SAMPLE_QUERY_AMOUNT_TYPE */) {
|
|
8409
|
+
return {
|
|
8410
|
+
type: "DUCKLING_AMOUNT" /* SAMPLE_QUERY_AMOUNT_TYPE */,
|
|
8411
|
+
value: replacement == null ? void 0 : replacement.format_txt,
|
|
8412
|
+
name: key,
|
|
8413
|
+
replacement
|
|
8414
|
+
};
|
|
8415
|
+
} else if (type == "VL" /* SAMPLE_QUERY_VL_TYPE */) {
|
|
8416
|
+
return {
|
|
8417
|
+
type: "VL" /* SAMPLE_QUERY_VL_TYPE */,
|
|
8418
|
+
value: replacement == null ? void 0 : replacement.format_txt,
|
|
8419
|
+
name: key,
|
|
8420
|
+
replacement
|
|
8421
|
+
};
|
|
8422
|
+
} else if (type == "TEXT" /* SAMPLE_QUERY_TEXT_TYPE */) {
|
|
8423
|
+
return {
|
|
8424
|
+
type: "TEXT" /* SAMPLE_QUERY_TEXT_TYPE */,
|
|
8425
|
+
value: key
|
|
8426
|
+
};
|
|
8427
|
+
}
|
|
8428
|
+
});
|
|
8429
|
+
return chunkedSuggestion;
|
|
8430
|
+
};
|
|
8431
|
+
var transformDataExplorerAutocompleteResponse = (response) => {
|
|
8432
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
8433
|
+
let vlMatches = [];
|
|
8434
|
+
if ((_d = (_c = (_b = (_a = response == null ? void 0 : response.data) == null ? void 0 : _a.data) == null ? void 0 : _b.suggestions) == null ? void 0 : _c.value_labels) == null ? void 0 : _d.length) {
|
|
8435
|
+
const vlMatchesTrimmed = response.data.data.suggestions.value_labels.slice(0, 10);
|
|
8436
|
+
vlMatches = vlMatchesTrimmed.map((vl) => new DataExplorerSubject(vl));
|
|
8148
8437
|
}
|
|
8149
|
-
|
|
8150
|
-
|
|
8438
|
+
let subjectMatches = [];
|
|
8439
|
+
if ((_h = (_g = (_f = (_e = response == null ? void 0 : response.data) == null ? void 0 : _e.data) == null ? void 0 : _f.suggestions) == null ? void 0 : _g.subjects) == null ? void 0 : _h.length) {
|
|
8440
|
+
subjectMatches = response.data.data.suggestions.subjects.map((subject) => new DataExplorerSubject(subject));
|
|
8151
8441
|
}
|
|
8152
|
-
const
|
|
8153
|
-
|
|
8154
|
-
headers: {
|
|
8155
|
-
Authorization: `Bearer ${token}`
|
|
8156
|
-
},
|
|
8157
|
-
cancelToken
|
|
8158
|
-
};
|
|
8159
|
-
const data = {
|
|
8160
|
-
subject,
|
|
8161
|
-
page_size: numRows,
|
|
8162
|
-
source,
|
|
8163
|
-
date_format: "ISO8601"
|
|
8164
|
-
};
|
|
8165
|
-
return axios.post(url, data, config).then((response) => Promise.resolve(response)).catch((error) => Promise.reject(error));
|
|
8442
|
+
const allMatches = [...subjectMatches, ...vlMatches];
|
|
8443
|
+
return Promise.resolve(allMatches);
|
|
8166
8444
|
};
|
|
8167
|
-
|
|
8168
|
-
// src/Api/dataExplorerService.ts
|
|
8169
8445
|
var fetchDataExplorerAutocomplete = ({
|
|
8170
8446
|
suggestion,
|
|
8171
8447
|
domain,
|
|
@@ -8187,29 +8463,7 @@ var fetchDataExplorerAutocomplete = ({
|
|
|
8187
8463
|
cancelToken
|
|
8188
8464
|
};
|
|
8189
8465
|
return axios2.get(url, config).then((response) => {
|
|
8190
|
-
|
|
8191
|
-
let vlMatches = [];
|
|
8192
|
-
if ((_d = (_c = (_b = (_a = response == null ? void 0 : response.data) == null ? void 0 : _a.data) == null ? void 0 : _b.suggestions) == null ? void 0 : _c.value_labels) == null ? void 0 : _d.length) {
|
|
8193
|
-
const vlMatchesTrimmed = response.data.data.suggestions.value_labels.slice(0, 10);
|
|
8194
|
-
vlMatches = vlMatchesTrimmed.map((vl) => {
|
|
8195
|
-
return {
|
|
8196
|
-
...vl,
|
|
8197
|
-
display_name: `${vl.keyword} (${vl.show_message})`,
|
|
8198
|
-
type: "VL" /* VL_TYPE */
|
|
8199
|
-
};
|
|
8200
|
-
});
|
|
8201
|
-
}
|
|
8202
|
-
let subjectMatches = [];
|
|
8203
|
-
if ((_h = (_g = (_f = (_e = response == null ? void 0 : response.data) == null ? void 0 : _e.data) == null ? void 0 : _f.suggestions) == null ? void 0 : _g.subjects) == null ? void 0 : _h.length) {
|
|
8204
|
-
subjectMatches = response.data.data.suggestions.subjects.map((subject) => {
|
|
8205
|
-
return {
|
|
8206
|
-
...subject,
|
|
8207
|
-
type: "subject" /* SUBJECT_TYPE */
|
|
8208
|
-
};
|
|
8209
|
-
});
|
|
8210
|
-
}
|
|
8211
|
-
const allMatches = [...subjectMatches, ...vlMatches];
|
|
8212
|
-
return Promise.resolve(allMatches);
|
|
8466
|
+
return transformDataExplorerAutocompleteResponse(response);
|
|
8213
8467
|
}).catch((error) => {
|
|
8214
8468
|
var _a;
|
|
8215
8469
|
if ((error == null ? void 0 : error.message) === REQUEST_CANCELLED_ERROR) {
|
|
@@ -8227,6 +8481,109 @@ var transformVLForDataExplorerSuggestions = (vl) => {
|
|
|
8227
8481
|
canonical: vl.canonical
|
|
8228
8482
|
};
|
|
8229
8483
|
};
|
|
8484
|
+
var fetchDataExplorerSuggestionsV2 = async ({
|
|
8485
|
+
pageSize,
|
|
8486
|
+
pageNumber,
|
|
8487
|
+
domain,
|
|
8488
|
+
apiKey,
|
|
8489
|
+
token,
|
|
8490
|
+
text,
|
|
8491
|
+
context,
|
|
8492
|
+
selectedVL,
|
|
8493
|
+
userVLSelection = [],
|
|
8494
|
+
skipQueryValidation,
|
|
8495
|
+
columns
|
|
8496
|
+
} = {}) => {
|
|
8497
|
+
var _a, _b, _c;
|
|
8498
|
+
if (!skipQueryValidation && text) {
|
|
8499
|
+
const queryValidationResponse = await runQueryValidation({
|
|
8500
|
+
text,
|
|
8501
|
+
domain,
|
|
8502
|
+
apiKey,
|
|
8503
|
+
token
|
|
8504
|
+
});
|
|
8505
|
+
if (((_c = (_b = (_a = queryValidationResponse == null ? void 0 : queryValidationResponse.data) == null ? void 0 : _a.data) == null ? void 0 : _b.replacements) == null ? void 0 : _c.length) > 0) {
|
|
8506
|
+
return Promise.resolve(queryValidationResponse);
|
|
8507
|
+
}
|
|
8508
|
+
}
|
|
8509
|
+
const exploreQueriesUrl = `${domain}/autoql/api/v1/query/query-builder?key=${apiKey}`;
|
|
8510
|
+
const config = {
|
|
8511
|
+
headers: {
|
|
8512
|
+
Authorization: `Bearer ${token}`
|
|
8513
|
+
}
|
|
8514
|
+
};
|
|
8515
|
+
let vlInfo = [];
|
|
8516
|
+
if (selectedVL) {
|
|
8517
|
+
vlInfo.push(transformVLForDataExplorerSuggestions(selectedVL));
|
|
8518
|
+
}
|
|
8519
|
+
if (userVLSelection) {
|
|
8520
|
+
const transformedVLs = userVLSelection.map((vl) => transformVLForDataExplorerSuggestions(vl));
|
|
8521
|
+
vlInfo = [...vlInfo, ...transformedVLs];
|
|
8522
|
+
}
|
|
8523
|
+
const data = {
|
|
8524
|
+
page: pageNumber,
|
|
8525
|
+
page_size: pageSize,
|
|
8526
|
+
search_terms: text,
|
|
8527
|
+
context,
|
|
8528
|
+
value_label_info: vlInfo
|
|
8529
|
+
};
|
|
8530
|
+
const suggestionsMock = [
|
|
8531
|
+
{
|
|
8532
|
+
query: "total units sold above DUCKLING_AMOUNT",
|
|
8533
|
+
values: {
|
|
8534
|
+
DUCKLING_AMOUNT: {
|
|
8535
|
+
canonical: "DUCKLING_AMOUNT",
|
|
8536
|
+
format_txt: "100",
|
|
8537
|
+
keyword: "100",
|
|
8538
|
+
display_name: "100"
|
|
8539
|
+
}
|
|
8540
|
+
}
|
|
8541
|
+
},
|
|
8542
|
+
{
|
|
8543
|
+
query: "total sales DUCKLING_TIME",
|
|
8544
|
+
values: {
|
|
8545
|
+
DUCKLING_TIME: {
|
|
8546
|
+
canonical: "DUCKLING_TIME",
|
|
8547
|
+
format_txt: "last year",
|
|
8548
|
+
keyword: "last year",
|
|
8549
|
+
display_name: "last year"
|
|
8550
|
+
}
|
|
8551
|
+
}
|
|
8552
|
+
},
|
|
8553
|
+
{
|
|
8554
|
+
query: "all sales for PUBLIC_0_CUSTOMER_DIMENSION_0_CUSTOMER_NAME_VALUE_LABEL",
|
|
8555
|
+
values: {
|
|
8556
|
+
PUBLIC_0_CUSTOMER_DIMENSION_0_CUSTOMER_NAME_VALUE_LABEL: {
|
|
8557
|
+
show_message: "PUBLIC_0_CUSTOMER_DIMENSION_0_CUSTOMER_NAME_VALUE_LABEL",
|
|
8558
|
+
keyword: "Jack . Li",
|
|
8559
|
+
format_txt: "Jack . Li",
|
|
8560
|
+
canonical: "PUBLIC_0_CUSTOMER_DIMENSION_0_CUSTOMER_NAME_VALUE_LABEL"
|
|
8561
|
+
}
|
|
8562
|
+
}
|
|
8563
|
+
}
|
|
8564
|
+
];
|
|
8565
|
+
const promise = new Promise((res, rej) => {
|
|
8566
|
+
setTimeout(() => {
|
|
8567
|
+
var _a2, _b2;
|
|
8568
|
+
try {
|
|
8569
|
+
const testResponse = {
|
|
8570
|
+
data: {
|
|
8571
|
+
data: {
|
|
8572
|
+
suggestions: suggestionsMock
|
|
8573
|
+
}
|
|
8574
|
+
}
|
|
8575
|
+
};
|
|
8576
|
+
const suggestions = transformSuggestionResponse((_b2 = (_a2 = testResponse == null ? void 0 : testResponse.data) == null ? void 0 : _a2.data) == null ? void 0 : _b2.suggestions);
|
|
8577
|
+
testResponse.data.data.suggestions = suggestions;
|
|
8578
|
+
res(testResponse);
|
|
8579
|
+
} catch (error) {
|
|
8580
|
+
console.error(error);
|
|
8581
|
+
rej(error);
|
|
8582
|
+
}
|
|
8583
|
+
}, 500);
|
|
8584
|
+
});
|
|
8585
|
+
return promise;
|
|
8586
|
+
};
|
|
8230
8587
|
var fetchDataExplorerSuggestions = async ({
|
|
8231
8588
|
pageSize,
|
|
8232
8589
|
pageNumber,
|
|
@@ -8243,7 +8600,7 @@ var fetchDataExplorerSuggestions = async ({
|
|
|
8243
8600
|
if (!token || !domain || !apiKey) {
|
|
8244
8601
|
return Promise.reject(new Error("Unauthenticated"));
|
|
8245
8602
|
}
|
|
8246
|
-
if (!skipQueryValidation) {
|
|
8603
|
+
if (!skipQueryValidation && text) {
|
|
8247
8604
|
const queryValidationResponse = await runQueryValidation({
|
|
8248
8605
|
text,
|
|
8249
8606
|
domain,
|
|
@@ -8280,6 +8637,62 @@ var fetchDataExplorerSuggestions = async ({
|
|
|
8280
8637
|
return Promise.reject((_a2 = error == null ? void 0 : error.response) == null ? void 0 : _a2.data);
|
|
8281
8638
|
});
|
|
8282
8639
|
};
|
|
8640
|
+
var fetchSubjectList = ({ domain, apiKey, token }) => {
|
|
8641
|
+
if (!token || !domain || !apiKey) {
|
|
8642
|
+
return Promise.reject(new Error("Unauthenticated"));
|
|
8643
|
+
}
|
|
8644
|
+
const url = `${domain}/autoql/api/v1/query/subjects?key=${apiKey}`;
|
|
8645
|
+
const config = {
|
|
8646
|
+
headers: {
|
|
8647
|
+
Authorization: `Bearer ${token}`
|
|
8648
|
+
}
|
|
8649
|
+
};
|
|
8650
|
+
return axios2.get(url, config).then((response) => {
|
|
8651
|
+
var _a, _b;
|
|
8652
|
+
let subjectList = [];
|
|
8653
|
+
if ((_b = (_a = response == null ? void 0 : response.data) == null ? void 0 : _a.data) == null ? void 0 : _b.subjects) {
|
|
8654
|
+
subjectList = response.data.data.subjects.map((subject) => new DataExplorerSubject(subject)).sort((a, b) => {
|
|
8655
|
+
const aName = a.displayName;
|
|
8656
|
+
const bName = b.displayName;
|
|
8657
|
+
aName.localeCompare(bName);
|
|
8658
|
+
});
|
|
8659
|
+
}
|
|
8660
|
+
return Promise.resolve(subjectList);
|
|
8661
|
+
}).catch((error) => {
|
|
8662
|
+
var _a;
|
|
8663
|
+
return Promise.reject((_a = error == null ? void 0 : error.response) == null ? void 0 : _a.data);
|
|
8664
|
+
});
|
|
8665
|
+
};
|
|
8666
|
+
var fetchDataPreview = ({
|
|
8667
|
+
subject,
|
|
8668
|
+
domain,
|
|
8669
|
+
apiKey,
|
|
8670
|
+
token,
|
|
8671
|
+
source = DEFAULT_SOURCE,
|
|
8672
|
+
numRows = 10,
|
|
8673
|
+
cancelToken
|
|
8674
|
+
} = {}) => {
|
|
8675
|
+
if (!subject) {
|
|
8676
|
+
return Promise.reject(new Error("No subject supplied for data preview"));
|
|
8677
|
+
}
|
|
8678
|
+
if (!token || !domain || !apiKey) {
|
|
8679
|
+
return Promise.reject(new Error("Unauthenticated"));
|
|
8680
|
+
}
|
|
8681
|
+
const url = `${domain}/autoql/api/v1/query/preview?key=${apiKey}`;
|
|
8682
|
+
const config = {
|
|
8683
|
+
headers: {
|
|
8684
|
+
Authorization: `Bearer ${token}`
|
|
8685
|
+
},
|
|
8686
|
+
cancelToken
|
|
8687
|
+
};
|
|
8688
|
+
const data = {
|
|
8689
|
+
subject,
|
|
8690
|
+
page_size: numRows,
|
|
8691
|
+
source,
|
|
8692
|
+
date_format: "ISO8601"
|
|
8693
|
+
};
|
|
8694
|
+
return axios2.post(url, data, config).then((response) => Promise.resolve(response)).catch((error) => Promise.reject(error));
|
|
8695
|
+
};
|
|
8283
8696
|
|
|
8284
8697
|
// src/Api/notificationService.ts
|
|
8285
8698
|
import axios3 from "axios";
|
|
@@ -8296,10 +8709,18 @@ var fetchNotificationData = ({ id, domain, apiKey, token }) => {
|
|
|
8296
8709
|
return axiosInstance.get(url).then((response) => {
|
|
8297
8710
|
var _a, _b;
|
|
8298
8711
|
const queryResult = (_b = (_a = response == null ? void 0 : response.data) == null ? void 0 : _a.data) == null ? void 0 : _b.query_result;
|
|
8299
|
-
|
|
8712
|
+
let hasQueryResult = false;
|
|
8713
|
+
for (let key in queryResult) {
|
|
8714
|
+
if (queryResult.hasOwnProperty(key)) {
|
|
8715
|
+
hasQueryResult = true;
|
|
8716
|
+
break;
|
|
8717
|
+
}
|
|
8718
|
+
}
|
|
8719
|
+
if (hasQueryResult) {
|
|
8300
8720
|
return Promise.resolve({ data: queryResult });
|
|
8721
|
+
} else {
|
|
8722
|
+
return Promise.reject({ response: { data: { message: GENERAL_ERROR, hasQueryResult } } });
|
|
8301
8723
|
}
|
|
8302
|
-
return Promise.reject({ response: { data: { message: GENERAL_ERROR } } });
|
|
8303
8724
|
}).catch((error) => {
|
|
8304
8725
|
var _a;
|
|
8305
8726
|
return Promise.reject({ data: (_a = error == null ? void 0 : error.response) == null ? void 0 : _a.data });
|
|
@@ -9407,7 +9828,7 @@ export {
|
|
|
9407
9828
|
COMPARE_TYPE,
|
|
9408
9829
|
CONTINUOUS_TYPE,
|
|
9409
9830
|
CUSTOM_TYPE,
|
|
9410
|
-
|
|
9831
|
+
Column as ColumnObj,
|
|
9411
9832
|
ColumnType,
|
|
9412
9833
|
ColumnTypes,
|
|
9413
9834
|
DATA_ALERT_CONDITION_TYPES,
|
|
@@ -9427,8 +9848,10 @@ export {
|
|
|
9427
9848
|
DEFAULT_LEGEND_PADDING_TOP,
|
|
9428
9849
|
DEFAULT_MAX_LEGEND_WIDTH,
|
|
9429
9850
|
DEFAULT_SOURCE,
|
|
9851
|
+
DISPLAY_TYPES,
|
|
9430
9852
|
DOUBLE_AXIS_CHART_TYPES,
|
|
9431
9853
|
DOW_STYLES,
|
|
9854
|
+
DataExplorerSubject,
|
|
9432
9855
|
DataExplorerTypes,
|
|
9433
9856
|
DateUTC,
|
|
9434
9857
|
DisplayTypes,
|
|
@@ -9457,7 +9880,6 @@ export {
|
|
|
9457
9880
|
NUMBER_TERM_TYPE,
|
|
9458
9881
|
PATH_SMOOTHING,
|
|
9459
9882
|
PERIODIC_TYPE,
|
|
9460
|
-
PRECISION_TYPES,
|
|
9461
9883
|
PROJECT_TYPE,
|
|
9462
9884
|
PrecisionTypes,
|
|
9463
9885
|
QUERY_TERM_TYPE,
|
|
@@ -9467,6 +9889,7 @@ export {
|
|
|
9467
9889
|
SCHEDULE_FREQUENCY_OPTIONS,
|
|
9468
9890
|
SCHEDULE_INTERVAL_OPTIONS,
|
|
9469
9891
|
SEASON_NAMES,
|
|
9892
|
+
SampleQueryReplacementTypes,
|
|
9470
9893
|
TABLE_TYPES,
|
|
9471
9894
|
TITLE_FONT_SIZE,
|
|
9472
9895
|
ThemeType,
|
|
@@ -9506,6 +9929,7 @@ export {
|
|
|
9506
9929
|
dataStructureChanged,
|
|
9507
9930
|
dateSortFn,
|
|
9508
9931
|
dateStringSortFn,
|
|
9932
|
+
dayjsWithPlugins_default as dayjs,
|
|
9509
9933
|
deepEqual,
|
|
9510
9934
|
deleteDataAlert,
|
|
9511
9935
|
deleteNotification,
|
|
@@ -9519,6 +9943,7 @@ export {
|
|
|
9519
9943
|
fetchDataAlerts,
|
|
9520
9944
|
fetchDataExplorerAutocomplete,
|
|
9521
9945
|
fetchDataExplorerSuggestions,
|
|
9946
|
+
fetchDataExplorerSuggestionsV2,
|
|
9522
9947
|
fetchDataPreview,
|
|
9523
9948
|
fetchExploreQueries,
|
|
9524
9949
|
fetchFilters,
|
|
@@ -9644,6 +10069,8 @@ export {
|
|
|
9644
10069
|
getRangeForAxis,
|
|
9645
10070
|
getRowNumberListForPopover,
|
|
9646
10071
|
getSVGBase64,
|
|
10072
|
+
getSampleQueryRegex,
|
|
10073
|
+
getSampleQueryText,
|
|
9647
10074
|
getScheduleFrequencyObject,
|
|
9648
10075
|
getStartAndEndDateFromDateStrs,
|
|
9649
10076
|
getStringColumnIndices,
|
|
@@ -9659,6 +10086,7 @@ export {
|
|
|
9659
10086
|
getTimeRangeFromDateArray,
|
|
9660
10087
|
getTimeRangeFromRT,
|
|
9661
10088
|
getTimeScale,
|
|
10089
|
+
getTitleCase,
|
|
9662
10090
|
getTooltipContent,
|
|
9663
10091
|
getTotalBottomPadding,
|
|
9664
10092
|
getTotalHorizontalPadding,
|
|
@@ -9714,6 +10142,7 @@ export {
|
|
|
9714
10142
|
onTableCellClick,
|
|
9715
10143
|
onlySeriesVisibilityChanged,
|
|
9716
10144
|
onlyUnique,
|
|
10145
|
+
parseJwt,
|
|
9717
10146
|
potentiallySupportsDatePivot,
|
|
9718
10147
|
potentiallySupportsPivot,
|
|
9719
10148
|
removeElementAtIndex,
|
|
@@ -9764,6 +10193,7 @@ export {
|
|
|
9764
10193
|
updateDataAlert,
|
|
9765
10194
|
updateDataAlertStatus,
|
|
9766
10195
|
usePivotDataForChart,
|
|
10196
|
+
uuidv4,
|
|
9767
10197
|
validateExpression
|
|
9768
10198
|
};
|
|
9769
10199
|
//# sourceMappingURL=index.mjs.map
|