autoql-fe-utils 1.0.21 → 1.0.23
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 +599 -187
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +620 -190
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +610 -189
- 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
|
-
|
|
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 */
|
|
1259
|
+
];
|
|
1260
|
+
var CHARTS_WITHOUT_LEGENDS = [
|
|
1261
|
+
"pie" /* PIE */,
|
|
1262
|
+
"heatmap" /* HEATMAP */,
|
|
1263
|
+
"bubble" /* BUBBLE */,
|
|
1264
|
+
"scatterplot" /* SCATTERPLOT */,
|
|
1265
|
+
"histogram" /* HISTOGRAM */
|
|
1172
1266
|
];
|
|
1173
|
-
var
|
|
1174
|
-
var
|
|
1175
|
-
var
|
|
1176
|
-
var
|
|
1177
|
-
var CHARTS_WITHOUT_AXES = ["pie"];
|
|
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) => {
|
|
@@ -5407,26 +5611,17 @@ var calculateMinAndMaxSums = (data, stringColumnIndex, numberColumnIndices, isSc
|
|
|
5407
5611
|
const positiveSumsObject = {};
|
|
5408
5612
|
const negativeSumsObject = {};
|
|
5409
5613
|
data.forEach((row) => {
|
|
5410
|
-
const label = row[stringColumnIndex]
|
|
5614
|
+
const label = `${row[stringColumnIndex]}`;
|
|
5411
5615
|
numberColumnIndices.forEach((colIndex) => {
|
|
5616
|
+
var _a;
|
|
5412
5617
|
const rawValue = row[colIndex];
|
|
5413
5618
|
let value = Number(rawValue);
|
|
5414
5619
|
if (isNaN(value)) {
|
|
5415
5620
|
value = 0;
|
|
5416
5621
|
}
|
|
5417
|
-
|
|
5418
|
-
|
|
5419
|
-
|
|
5420
|
-
} else {
|
|
5421
|
-
positiveSumsObject[label] = value;
|
|
5422
|
-
}
|
|
5423
|
-
} else if (value < 0) {
|
|
5424
|
-
if (negativeSumsObject[label]) {
|
|
5425
|
-
negativeSumsObject[label] -= value;
|
|
5426
|
-
} else {
|
|
5427
|
-
negativeSumsObject[label] = value;
|
|
5428
|
-
}
|
|
5429
|
-
}
|
|
5622
|
+
const sumsObject = value >= 0 ? positiveSumsObject : negativeSumsObject;
|
|
5623
|
+
const previousValue = (_a = sumsObject[label]) != null ? _a : 0;
|
|
5624
|
+
sumsObject[label] = previousValue + value;
|
|
5430
5625
|
});
|
|
5431
5626
|
});
|
|
5432
5627
|
let maxValue = getMaxValueFromKeyValueObj(positiveSumsObject);
|
|
@@ -7484,7 +7679,7 @@ var transformQueryResponseColumns = (response) => {
|
|
|
7484
7679
|
}
|
|
7485
7680
|
const transformedColumns = columns.map((col, i) => {
|
|
7486
7681
|
const drilldownGroupby = getDrilldownGroupby(response, col);
|
|
7487
|
-
return new
|
|
7682
|
+
return new Column({
|
|
7488
7683
|
...col,
|
|
7489
7684
|
field: `${i}`,
|
|
7490
7685
|
index: i,
|
|
@@ -8119,53 +8314,125 @@ var reportProblem = ({
|
|
|
8119
8314
|
return Promise.reject((_a = error == null ? void 0 : error.response) == null ? void 0 : _a.data);
|
|
8120
8315
|
});
|
|
8121
8316
|
};
|
|
8122
|
-
|
|
8123
|
-
|
|
8124
|
-
|
|
8317
|
+
|
|
8318
|
+
// src/Api/dataExplorerService.ts
|
|
8319
|
+
var getSampleQueryRegex = (suggestionValues) => {
|
|
8320
|
+
const valueArray = Object.keys(suggestionValues);
|
|
8321
|
+
const valueRegexArray = valueArray.map((value) => `(${value})`);
|
|
8322
|
+
const valueRegex = new RegExp(valueRegexArray.join("|"), "gm");
|
|
8323
|
+
return valueRegex;
|
|
8324
|
+
};
|
|
8325
|
+
var getSampleQueryText = (query, values) => {
|
|
8326
|
+
try {
|
|
8327
|
+
const valueArray = Object.keys(values);
|
|
8328
|
+
let queryText = query;
|
|
8329
|
+
valueArray.forEach((valueKey) => {
|
|
8330
|
+
var _a;
|
|
8331
|
+
const valueRegex = new RegExp(`${valueKey}`, "gm");
|
|
8332
|
+
if (values[valueKey]) {
|
|
8333
|
+
queryText = query.replace(valueRegex, (_a = values[valueKey]) == null ? void 0 : _a.value);
|
|
8334
|
+
}
|
|
8335
|
+
});
|
|
8336
|
+
return queryText;
|
|
8337
|
+
} catch (error) {
|
|
8338
|
+
console.error(error);
|
|
8339
|
+
return void 0;
|
|
8125
8340
|
}
|
|
8126
|
-
|
|
8127
|
-
|
|
8128
|
-
|
|
8129
|
-
|
|
8130
|
-
|
|
8131
|
-
|
|
8132
|
-
|
|
8341
|
+
};
|
|
8342
|
+
var transformSuggestionResponse = (suggestions) => {
|
|
8343
|
+
const newSuggestions = [];
|
|
8344
|
+
suggestions.forEach((suggestion) => {
|
|
8345
|
+
const initialQuery = suggestion.query;
|
|
8346
|
+
const initialValues = transformSampleQueryValues(suggestion.values);
|
|
8347
|
+
const chunked = getSampleQueryChunk(suggestion.query, initialValues);
|
|
8348
|
+
const queryText = getSampleQueryText(suggestion.query, initialValues);
|
|
8349
|
+
const newSuggestion = {
|
|
8350
|
+
initialQuery,
|
|
8351
|
+
initialValues,
|
|
8352
|
+
chunked,
|
|
8353
|
+
queryText
|
|
8354
|
+
};
|
|
8355
|
+
newSuggestions.push(newSuggestion);
|
|
8356
|
+
});
|
|
8357
|
+
return newSuggestions;
|
|
8358
|
+
};
|
|
8359
|
+
var transformSampleQueryValues = (originalValues) => {
|
|
8360
|
+
const newValues = {};
|
|
8361
|
+
Object.keys(originalValues).forEach((key) => {
|
|
8133
8362
|
var _a;
|
|
8134
|
-
|
|
8363
|
+
newValues[key] = {
|
|
8364
|
+
replacement: originalValues[key],
|
|
8365
|
+
value: (_a = originalValues[key]) == null ? void 0 : _a.format_txt,
|
|
8366
|
+
type: getSampleQueryReplacementType(key, originalValues[key])
|
|
8367
|
+
};
|
|
8135
8368
|
});
|
|
8369
|
+
return newValues;
|
|
8370
|
+
};
|
|
8371
|
+
var getSampleQueryReplacementType = (key, replacement) => {
|
|
8372
|
+
if (!replacement) {
|
|
8373
|
+
return "TEXT" /* SAMPLE_QUERY_TEXT_TYPE */;
|
|
8374
|
+
} else if (key === "DUCKLING_TIME") {
|
|
8375
|
+
return "DUCKLING_TIME" /* SAMPLE_QUERY_TIME_TYPE */;
|
|
8376
|
+
} else if (key === "DUCKLING_AMOUNT") {
|
|
8377
|
+
return "DUCKLING_AMOUNT" /* SAMPLE_QUERY_AMOUNT_TYPE */;
|
|
8378
|
+
} else if (replacement == null ? void 0 : replacement.canonical) {
|
|
8379
|
+
return "VL" /* SAMPLE_QUERY_VL_TYPE */;
|
|
8380
|
+
} else {
|
|
8381
|
+
console.warn("There was a sample query replacement item but we didnt recognize its type: ", replacement);
|
|
8382
|
+
return;
|
|
8383
|
+
}
|
|
8136
8384
|
};
|
|
8137
|
-
var
|
|
8138
|
-
|
|
8139
|
-
|
|
8140
|
-
|
|
8141
|
-
|
|
8142
|
-
|
|
8143
|
-
|
|
8144
|
-
|
|
8145
|
-
|
|
8146
|
-
|
|
8147
|
-
|
|
8385
|
+
var getSampleQueryChunk = (query, values) => {
|
|
8386
|
+
const valueArray = Object.keys(values);
|
|
8387
|
+
const valueRegexArray = valueArray.map((value) => `(${value})`);
|
|
8388
|
+
const valueRegex = new RegExp(valueRegexArray.join("|"), "gm");
|
|
8389
|
+
const splitStrArray = query.split(valueRegex);
|
|
8390
|
+
const chunkedSuggestion = splitStrArray.map((key) => {
|
|
8391
|
+
var _a;
|
|
8392
|
+
const replacement = (_a = values[key]) == null ? void 0 : _a.replacement;
|
|
8393
|
+
const type = getSampleQueryReplacementType(key, replacement);
|
|
8394
|
+
if (type == "DUCKLING_TIME" /* SAMPLE_QUERY_TIME_TYPE */) {
|
|
8395
|
+
return {
|
|
8396
|
+
type: "TEXT" /* SAMPLE_QUERY_TEXT_TYPE */,
|
|
8397
|
+
value: replacement == null ? void 0 : replacement.format_txt
|
|
8398
|
+
};
|
|
8399
|
+
} else if (type == "DUCKLING_AMOUNT" /* SAMPLE_QUERY_AMOUNT_TYPE */) {
|
|
8400
|
+
return {
|
|
8401
|
+
type: "DUCKLING_AMOUNT" /* SAMPLE_QUERY_AMOUNT_TYPE */,
|
|
8402
|
+
value: replacement == null ? void 0 : replacement.format_txt,
|
|
8403
|
+
name: key,
|
|
8404
|
+
replacement
|
|
8405
|
+
};
|
|
8406
|
+
} else if (type == "VL" /* SAMPLE_QUERY_VL_TYPE */) {
|
|
8407
|
+
return {
|
|
8408
|
+
type: "VL" /* SAMPLE_QUERY_VL_TYPE */,
|
|
8409
|
+
value: replacement == null ? void 0 : replacement.format_txt,
|
|
8410
|
+
name: key,
|
|
8411
|
+
replacement
|
|
8412
|
+
};
|
|
8413
|
+
} else if (type == "TEXT" /* SAMPLE_QUERY_TEXT_TYPE */) {
|
|
8414
|
+
return {
|
|
8415
|
+
type: "TEXT" /* SAMPLE_QUERY_TEXT_TYPE */,
|
|
8416
|
+
value: key
|
|
8417
|
+
};
|
|
8418
|
+
}
|
|
8419
|
+
});
|
|
8420
|
+
return chunkedSuggestion;
|
|
8421
|
+
};
|
|
8422
|
+
var transformDataExplorerAutocompleteResponse = (response) => {
|
|
8423
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
8424
|
+
let vlMatches = [];
|
|
8425
|
+
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) {
|
|
8426
|
+
const vlMatchesTrimmed = response.data.data.suggestions.value_labels.slice(0, 10);
|
|
8427
|
+
vlMatches = vlMatchesTrimmed.map((vl) => new DataExplorerSubject(vl));
|
|
8148
8428
|
}
|
|
8149
|
-
|
|
8150
|
-
|
|
8429
|
+
let subjectMatches = [];
|
|
8430
|
+
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) {
|
|
8431
|
+
subjectMatches = response.data.data.suggestions.subjects.map((subject) => new DataExplorerSubject(subject));
|
|
8151
8432
|
}
|
|
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));
|
|
8433
|
+
const allMatches = [...subjectMatches, ...vlMatches];
|
|
8434
|
+
return Promise.resolve(allMatches);
|
|
8166
8435
|
};
|
|
8167
|
-
|
|
8168
|
-
// src/Api/dataExplorerService.ts
|
|
8169
8436
|
var fetchDataExplorerAutocomplete = ({
|
|
8170
8437
|
suggestion,
|
|
8171
8438
|
domain,
|
|
@@ -8187,29 +8454,7 @@ var fetchDataExplorerAutocomplete = ({
|
|
|
8187
8454
|
cancelToken
|
|
8188
8455
|
};
|
|
8189
8456
|
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);
|
|
8457
|
+
return transformDataExplorerAutocompleteResponse(response);
|
|
8213
8458
|
}).catch((error) => {
|
|
8214
8459
|
var _a;
|
|
8215
8460
|
if ((error == null ? void 0 : error.message) === REQUEST_CANCELLED_ERROR) {
|
|
@@ -8227,6 +8472,109 @@ var transformVLForDataExplorerSuggestions = (vl) => {
|
|
|
8227
8472
|
canonical: vl.canonical
|
|
8228
8473
|
};
|
|
8229
8474
|
};
|
|
8475
|
+
var fetchDataExplorerSuggestionsV2 = async ({
|
|
8476
|
+
pageSize,
|
|
8477
|
+
pageNumber,
|
|
8478
|
+
domain,
|
|
8479
|
+
apiKey,
|
|
8480
|
+
token,
|
|
8481
|
+
text,
|
|
8482
|
+
context,
|
|
8483
|
+
selectedVL,
|
|
8484
|
+
userVLSelection = [],
|
|
8485
|
+
skipQueryValidation,
|
|
8486
|
+
columns
|
|
8487
|
+
} = {}) => {
|
|
8488
|
+
var _a, _b, _c;
|
|
8489
|
+
if (!skipQueryValidation && text) {
|
|
8490
|
+
const queryValidationResponse = await runQueryValidation({
|
|
8491
|
+
text,
|
|
8492
|
+
domain,
|
|
8493
|
+
apiKey,
|
|
8494
|
+
token
|
|
8495
|
+
});
|
|
8496
|
+
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) {
|
|
8497
|
+
return Promise.resolve(queryValidationResponse);
|
|
8498
|
+
}
|
|
8499
|
+
}
|
|
8500
|
+
const exploreQueriesUrl = `${domain}/autoql/api/v1/query/query-builder?key=${apiKey}`;
|
|
8501
|
+
const config = {
|
|
8502
|
+
headers: {
|
|
8503
|
+
Authorization: `Bearer ${token}`
|
|
8504
|
+
}
|
|
8505
|
+
};
|
|
8506
|
+
let vlInfo = [];
|
|
8507
|
+
if (selectedVL) {
|
|
8508
|
+
vlInfo.push(transformVLForDataExplorerSuggestions(selectedVL));
|
|
8509
|
+
}
|
|
8510
|
+
if (userVLSelection) {
|
|
8511
|
+
const transformedVLs = userVLSelection.map((vl) => transformVLForDataExplorerSuggestions(vl));
|
|
8512
|
+
vlInfo = [...vlInfo, ...transformedVLs];
|
|
8513
|
+
}
|
|
8514
|
+
const data = {
|
|
8515
|
+
page: pageNumber,
|
|
8516
|
+
page_size: pageSize,
|
|
8517
|
+
search_terms: text,
|
|
8518
|
+
context,
|
|
8519
|
+
value_label_info: vlInfo
|
|
8520
|
+
};
|
|
8521
|
+
const suggestionsMock = [
|
|
8522
|
+
{
|
|
8523
|
+
query: "total units sold above DUCKLING_AMOUNT",
|
|
8524
|
+
values: {
|
|
8525
|
+
DUCKLING_AMOUNT: {
|
|
8526
|
+
canonical: "DUCKLING_AMOUNT",
|
|
8527
|
+
format_txt: "100",
|
|
8528
|
+
keyword: "100",
|
|
8529
|
+
display_name: "100"
|
|
8530
|
+
}
|
|
8531
|
+
}
|
|
8532
|
+
},
|
|
8533
|
+
{
|
|
8534
|
+
query: "total sales DUCKLING_TIME",
|
|
8535
|
+
values: {
|
|
8536
|
+
DUCKLING_TIME: {
|
|
8537
|
+
canonical: "DUCKLING_TIME",
|
|
8538
|
+
format_txt: "last year",
|
|
8539
|
+
keyword: "last year",
|
|
8540
|
+
display_name: "last year"
|
|
8541
|
+
}
|
|
8542
|
+
}
|
|
8543
|
+
},
|
|
8544
|
+
{
|
|
8545
|
+
query: "all sales for PUBLIC_0_CUSTOMER_DIMENSION_0_CUSTOMER_NAME_VALUE_LABEL",
|
|
8546
|
+
values: {
|
|
8547
|
+
PUBLIC_0_CUSTOMER_DIMENSION_0_CUSTOMER_NAME_VALUE_LABEL: {
|
|
8548
|
+
show_message: "PUBLIC_0_CUSTOMER_DIMENSION_0_CUSTOMER_NAME_VALUE_LABEL",
|
|
8549
|
+
keyword: "Jack . Li",
|
|
8550
|
+
format_txt: "Jack . Li",
|
|
8551
|
+
canonical: "PUBLIC_0_CUSTOMER_DIMENSION_0_CUSTOMER_NAME_VALUE_LABEL"
|
|
8552
|
+
}
|
|
8553
|
+
}
|
|
8554
|
+
}
|
|
8555
|
+
];
|
|
8556
|
+
const promise = new Promise((res, rej) => {
|
|
8557
|
+
setTimeout(() => {
|
|
8558
|
+
var _a2, _b2;
|
|
8559
|
+
try {
|
|
8560
|
+
const testResponse = {
|
|
8561
|
+
data: {
|
|
8562
|
+
data: {
|
|
8563
|
+
suggestions: suggestionsMock
|
|
8564
|
+
}
|
|
8565
|
+
}
|
|
8566
|
+
};
|
|
8567
|
+
const suggestions = transformSuggestionResponse((_b2 = (_a2 = testResponse == null ? void 0 : testResponse.data) == null ? void 0 : _a2.data) == null ? void 0 : _b2.suggestions);
|
|
8568
|
+
testResponse.data.data.suggestions = suggestions;
|
|
8569
|
+
res(testResponse);
|
|
8570
|
+
} catch (error) {
|
|
8571
|
+
console.error(error);
|
|
8572
|
+
rej(error);
|
|
8573
|
+
}
|
|
8574
|
+
}, 500);
|
|
8575
|
+
});
|
|
8576
|
+
return promise;
|
|
8577
|
+
};
|
|
8230
8578
|
var fetchDataExplorerSuggestions = async ({
|
|
8231
8579
|
pageSize,
|
|
8232
8580
|
pageNumber,
|
|
@@ -8243,7 +8591,7 @@ var fetchDataExplorerSuggestions = async ({
|
|
|
8243
8591
|
if (!token || !domain || !apiKey) {
|
|
8244
8592
|
return Promise.reject(new Error("Unauthenticated"));
|
|
8245
8593
|
}
|
|
8246
|
-
if (!skipQueryValidation) {
|
|
8594
|
+
if (!skipQueryValidation && text) {
|
|
8247
8595
|
const queryValidationResponse = await runQueryValidation({
|
|
8248
8596
|
text,
|
|
8249
8597
|
domain,
|
|
@@ -8280,6 +8628,62 @@ var fetchDataExplorerSuggestions = async ({
|
|
|
8280
8628
|
return Promise.reject((_a2 = error == null ? void 0 : error.response) == null ? void 0 : _a2.data);
|
|
8281
8629
|
});
|
|
8282
8630
|
};
|
|
8631
|
+
var fetchSubjectList = ({ domain, apiKey, token }) => {
|
|
8632
|
+
if (!token || !domain || !apiKey) {
|
|
8633
|
+
return Promise.reject(new Error("Unauthenticated"));
|
|
8634
|
+
}
|
|
8635
|
+
const url = `${domain}/autoql/api/v1/query/subjects?key=${apiKey}`;
|
|
8636
|
+
const config = {
|
|
8637
|
+
headers: {
|
|
8638
|
+
Authorization: `Bearer ${token}`
|
|
8639
|
+
}
|
|
8640
|
+
};
|
|
8641
|
+
return axios2.get(url, config).then((response) => {
|
|
8642
|
+
var _a, _b;
|
|
8643
|
+
let subjectList = [];
|
|
8644
|
+
if ((_b = (_a = response == null ? void 0 : response.data) == null ? void 0 : _a.data) == null ? void 0 : _b.subjects) {
|
|
8645
|
+
subjectList = response.data.data.subjects.map((subject) => new DataExplorerSubject(subject)).sort((a, b) => {
|
|
8646
|
+
const aName = a.displayName;
|
|
8647
|
+
const bName = b.displayName;
|
|
8648
|
+
aName.localeCompare(bName);
|
|
8649
|
+
});
|
|
8650
|
+
}
|
|
8651
|
+
return Promise.resolve(subjectList);
|
|
8652
|
+
}).catch((error) => {
|
|
8653
|
+
var _a;
|
|
8654
|
+
return Promise.reject((_a = error == null ? void 0 : error.response) == null ? void 0 : _a.data);
|
|
8655
|
+
});
|
|
8656
|
+
};
|
|
8657
|
+
var fetchDataPreview = ({
|
|
8658
|
+
subject,
|
|
8659
|
+
domain,
|
|
8660
|
+
apiKey,
|
|
8661
|
+
token,
|
|
8662
|
+
source = DEFAULT_SOURCE,
|
|
8663
|
+
numRows = 10,
|
|
8664
|
+
cancelToken
|
|
8665
|
+
} = {}) => {
|
|
8666
|
+
if (!subject) {
|
|
8667
|
+
return Promise.reject(new Error("No subject supplied for data preview"));
|
|
8668
|
+
}
|
|
8669
|
+
if (!token || !domain || !apiKey) {
|
|
8670
|
+
return Promise.reject(new Error("Unauthenticated"));
|
|
8671
|
+
}
|
|
8672
|
+
const url = `${domain}/autoql/api/v1/query/preview?key=${apiKey}`;
|
|
8673
|
+
const config = {
|
|
8674
|
+
headers: {
|
|
8675
|
+
Authorization: `Bearer ${token}`
|
|
8676
|
+
},
|
|
8677
|
+
cancelToken
|
|
8678
|
+
};
|
|
8679
|
+
const data = {
|
|
8680
|
+
subject,
|
|
8681
|
+
page_size: numRows,
|
|
8682
|
+
source,
|
|
8683
|
+
date_format: "ISO8601"
|
|
8684
|
+
};
|
|
8685
|
+
return axios2.post(url, data, config).then((response) => Promise.resolve(response)).catch((error) => Promise.reject(error));
|
|
8686
|
+
};
|
|
8283
8687
|
|
|
8284
8688
|
// src/Api/notificationService.ts
|
|
8285
8689
|
import axios3 from "axios";
|
|
@@ -8296,10 +8700,18 @@ var fetchNotificationData = ({ id, domain, apiKey, token }) => {
|
|
|
8296
8700
|
return axiosInstance.get(url).then((response) => {
|
|
8297
8701
|
var _a, _b;
|
|
8298
8702
|
const queryResult = (_b = (_a = response == null ? void 0 : response.data) == null ? void 0 : _a.data) == null ? void 0 : _b.query_result;
|
|
8299
|
-
|
|
8703
|
+
let hasQueryResult = false;
|
|
8704
|
+
for (let key in queryResult) {
|
|
8705
|
+
if (queryResult.hasOwnProperty(key)) {
|
|
8706
|
+
hasQueryResult = true;
|
|
8707
|
+
break;
|
|
8708
|
+
}
|
|
8709
|
+
}
|
|
8710
|
+
if (hasQueryResult) {
|
|
8300
8711
|
return Promise.resolve({ data: queryResult });
|
|
8712
|
+
} else {
|
|
8713
|
+
return Promise.reject({ response: { data: { message: GENERAL_ERROR, hasQueryResult } } });
|
|
8301
8714
|
}
|
|
8302
|
-
return Promise.reject({ response: { data: { message: GENERAL_ERROR } } });
|
|
8303
8715
|
}).catch((error) => {
|
|
8304
8716
|
var _a;
|
|
8305
8717
|
return Promise.reject({ data: (_a = error == null ? void 0 : error.response) == null ? void 0 : _a.data });
|
|
@@ -9407,7 +9819,7 @@ export {
|
|
|
9407
9819
|
COMPARE_TYPE,
|
|
9408
9820
|
CONTINUOUS_TYPE,
|
|
9409
9821
|
CUSTOM_TYPE,
|
|
9410
|
-
|
|
9822
|
+
Column as ColumnObj,
|
|
9411
9823
|
ColumnType,
|
|
9412
9824
|
ColumnTypes,
|
|
9413
9825
|
DATA_ALERT_CONDITION_TYPES,
|
|
@@ -9427,8 +9839,10 @@ export {
|
|
|
9427
9839
|
DEFAULT_LEGEND_PADDING_TOP,
|
|
9428
9840
|
DEFAULT_MAX_LEGEND_WIDTH,
|
|
9429
9841
|
DEFAULT_SOURCE,
|
|
9842
|
+
DISPLAY_TYPES,
|
|
9430
9843
|
DOUBLE_AXIS_CHART_TYPES,
|
|
9431
9844
|
DOW_STYLES,
|
|
9845
|
+
DataExplorerSubject,
|
|
9432
9846
|
DataExplorerTypes,
|
|
9433
9847
|
DateUTC,
|
|
9434
9848
|
DisplayTypes,
|
|
@@ -9457,7 +9871,6 @@ export {
|
|
|
9457
9871
|
NUMBER_TERM_TYPE,
|
|
9458
9872
|
PATH_SMOOTHING,
|
|
9459
9873
|
PERIODIC_TYPE,
|
|
9460
|
-
PRECISION_TYPES,
|
|
9461
9874
|
PROJECT_TYPE,
|
|
9462
9875
|
PrecisionTypes,
|
|
9463
9876
|
QUERY_TERM_TYPE,
|
|
@@ -9467,6 +9880,7 @@ export {
|
|
|
9467
9880
|
SCHEDULE_FREQUENCY_OPTIONS,
|
|
9468
9881
|
SCHEDULE_INTERVAL_OPTIONS,
|
|
9469
9882
|
SEASON_NAMES,
|
|
9883
|
+
SampleQueryReplacementTypes,
|
|
9470
9884
|
TABLE_TYPES,
|
|
9471
9885
|
TITLE_FONT_SIZE,
|
|
9472
9886
|
ThemeType,
|
|
@@ -9506,6 +9920,7 @@ export {
|
|
|
9506
9920
|
dataStructureChanged,
|
|
9507
9921
|
dateSortFn,
|
|
9508
9922
|
dateStringSortFn,
|
|
9923
|
+
dayjsWithPlugins_default as dayjs,
|
|
9509
9924
|
deepEqual,
|
|
9510
9925
|
deleteDataAlert,
|
|
9511
9926
|
deleteNotification,
|
|
@@ -9519,6 +9934,7 @@ export {
|
|
|
9519
9934
|
fetchDataAlerts,
|
|
9520
9935
|
fetchDataExplorerAutocomplete,
|
|
9521
9936
|
fetchDataExplorerSuggestions,
|
|
9937
|
+
fetchDataExplorerSuggestionsV2,
|
|
9522
9938
|
fetchDataPreview,
|
|
9523
9939
|
fetchExploreQueries,
|
|
9524
9940
|
fetchFilters,
|
|
@@ -9644,6 +10060,8 @@ export {
|
|
|
9644
10060
|
getRangeForAxis,
|
|
9645
10061
|
getRowNumberListForPopover,
|
|
9646
10062
|
getSVGBase64,
|
|
10063
|
+
getSampleQueryRegex,
|
|
10064
|
+
getSampleQueryText,
|
|
9647
10065
|
getScheduleFrequencyObject,
|
|
9648
10066
|
getStartAndEndDateFromDateStrs,
|
|
9649
10067
|
getStringColumnIndices,
|
|
@@ -9659,6 +10077,7 @@ export {
|
|
|
9659
10077
|
getTimeRangeFromDateArray,
|
|
9660
10078
|
getTimeRangeFromRT,
|
|
9661
10079
|
getTimeScale,
|
|
10080
|
+
getTitleCase,
|
|
9662
10081
|
getTooltipContent,
|
|
9663
10082
|
getTotalBottomPadding,
|
|
9664
10083
|
getTotalHorizontalPadding,
|
|
@@ -9714,6 +10133,7 @@ export {
|
|
|
9714
10133
|
onTableCellClick,
|
|
9715
10134
|
onlySeriesVisibilityChanged,
|
|
9716
10135
|
onlyUnique,
|
|
10136
|
+
parseJwt,
|
|
9717
10137
|
potentiallySupportsDatePivot,
|
|
9718
10138
|
potentiallySupportsPivot,
|
|
9719
10139
|
removeElementAtIndex,
|
|
@@ -9764,6 +10184,7 @@ export {
|
|
|
9764
10184
|
updateDataAlert,
|
|
9765
10185
|
updateDataAlertStatus,
|
|
9766
10186
|
usePivotDataForChart,
|
|
10187
|
+
uuidv4,
|
|
9767
10188
|
validateExpression
|
|
9768
10189
|
};
|
|
9769
10190
|
//# sourceMappingURL=index.mjs.map
|