autoql-fe-utils 1.0.59 → 1.0.60
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 +13 -2
- package/dist/index.global.js +234 -94
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +130 -123
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +127 -120
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -31,7 +31,10 @@ declare enum AggTypes {
|
|
|
31
31
|
MIN = "MIN",
|
|
32
32
|
MAX = "MAX",
|
|
33
33
|
COUNT = "COUNT",
|
|
34
|
-
COUNT_DISTINCT = "COUNT_DISTINCT"
|
|
34
|
+
COUNT_DISTINCT = "COUNT_DISTINCT",
|
|
35
|
+
MEDIAN = "MEDIAN",
|
|
36
|
+
STD_DEV = "STD_DEV",
|
|
37
|
+
VARIANCE = "VARIANCE"
|
|
35
38
|
}
|
|
36
39
|
declare enum ColumnTypes {
|
|
37
40
|
DOLLAR_AMT = "DOLLAR_AMT",
|
|
@@ -120,7 +123,8 @@ declare class AggType {
|
|
|
120
123
|
supportsStrings?: boolean;
|
|
121
124
|
symbol?: string;
|
|
122
125
|
fn?: Function;
|
|
123
|
-
|
|
126
|
+
icon?: string;
|
|
127
|
+
constructor({ type, displayName, tooltip, unit, icon, supportsStrings, symbol, fn, }: AggTypeParams);
|
|
124
128
|
}
|
|
125
129
|
|
|
126
130
|
declare class DataExplorerSubject {
|
|
@@ -174,7 +178,13 @@ declare const DEFAULT_AGG_TYPE = AggTypes.SUM;
|
|
|
174
178
|
declare const AGG_TYPES: {
|
|
175
179
|
SUM: AggType;
|
|
176
180
|
AVG: AggType;
|
|
181
|
+
MIN: AggType;
|
|
182
|
+
MAX: AggType;
|
|
177
183
|
COUNT: AggType;
|
|
184
|
+
COUNT_DISTINCT: AggType;
|
|
185
|
+
MEDIAN: AggType;
|
|
186
|
+
STD_DEV: AggType;
|
|
187
|
+
VARIANCE: AggType;
|
|
178
188
|
};
|
|
179
189
|
declare const DISPLAY_TYPES: {
|
|
180
190
|
TABLE: {
|
|
@@ -602,6 +612,7 @@ type AggTypeParams = {
|
|
|
602
612
|
supportsStrings?: boolean;
|
|
603
613
|
symbol?: string;
|
|
604
614
|
fn?: Function;
|
|
615
|
+
icon?: string;
|
|
605
616
|
};
|
|
606
617
|
interface SubjectSuggestion {
|
|
607
618
|
name: string;
|
package/dist/index.global.js
CHANGED
|
@@ -13690,6 +13690,22 @@
|
|
|
13690
13690
|
function number(x) {
|
|
13691
13691
|
return x === null ? NaN : +x;
|
|
13692
13692
|
}
|
|
13693
|
+
function* numbers(values, valueof) {
|
|
13694
|
+
if (valueof === void 0) {
|
|
13695
|
+
for (let value of values) {
|
|
13696
|
+
if (value != null && (value = +value) >= value) {
|
|
13697
|
+
yield value;
|
|
13698
|
+
}
|
|
13699
|
+
}
|
|
13700
|
+
} else {
|
|
13701
|
+
let index = -1;
|
|
13702
|
+
for (let value of values) {
|
|
13703
|
+
if ((value = valueof(value, ++index, values)) != null && (value = +value) >= value) {
|
|
13704
|
+
yield value;
|
|
13705
|
+
}
|
|
13706
|
+
}
|
|
13707
|
+
}
|
|
13708
|
+
}
|
|
13693
13709
|
|
|
13694
13710
|
// node_modules/d3-array/src/bisect.js
|
|
13695
13711
|
var ascendingBisect = bisector(ascending);
|
|
@@ -13718,6 +13734,40 @@
|
|
|
13718
13734
|
return count2;
|
|
13719
13735
|
}
|
|
13720
13736
|
|
|
13737
|
+
// node_modules/d3-array/src/variance.js
|
|
13738
|
+
function variance(values, valueof) {
|
|
13739
|
+
let count2 = 0;
|
|
13740
|
+
let delta;
|
|
13741
|
+
let mean2 = 0;
|
|
13742
|
+
let sum2 = 0;
|
|
13743
|
+
if (valueof === void 0) {
|
|
13744
|
+
for (let value of values) {
|
|
13745
|
+
if (value != null && (value = +value) >= value) {
|
|
13746
|
+
delta = value - mean2;
|
|
13747
|
+
mean2 += delta / ++count2;
|
|
13748
|
+
sum2 += delta * (value - mean2);
|
|
13749
|
+
}
|
|
13750
|
+
}
|
|
13751
|
+
} else {
|
|
13752
|
+
let index = -1;
|
|
13753
|
+
for (let value of values) {
|
|
13754
|
+
if ((value = valueof(value, ++index, values)) != null && (value = +value) >= value) {
|
|
13755
|
+
delta = value - mean2;
|
|
13756
|
+
mean2 += delta / ++count2;
|
|
13757
|
+
sum2 += delta * (value - mean2);
|
|
13758
|
+
}
|
|
13759
|
+
}
|
|
13760
|
+
}
|
|
13761
|
+
if (count2 > 1)
|
|
13762
|
+
return sum2 / (count2 - 1);
|
|
13763
|
+
}
|
|
13764
|
+
|
|
13765
|
+
// node_modules/d3-array/src/deviation.js
|
|
13766
|
+
function deviation(values, valueof) {
|
|
13767
|
+
const v = variance(values, valueof);
|
|
13768
|
+
return v ? Math.sqrt(v) : v;
|
|
13769
|
+
}
|
|
13770
|
+
|
|
13721
13771
|
// node_modules/d3-array/src/extent.js
|
|
13722
13772
|
function extent(values, valueof) {
|
|
13723
13773
|
let min2;
|
|
@@ -13805,6 +13855,23 @@
|
|
|
13805
13855
|
return x;
|
|
13806
13856
|
}
|
|
13807
13857
|
|
|
13858
|
+
// node_modules/d3-array/src/sort.js
|
|
13859
|
+
function compareDefined(compare = ascending) {
|
|
13860
|
+
if (compare === ascending)
|
|
13861
|
+
return ascendingDefined;
|
|
13862
|
+
if (typeof compare !== "function")
|
|
13863
|
+
throw new TypeError("compare is not a function");
|
|
13864
|
+
return (a, b) => {
|
|
13865
|
+
const x = compare(a, b);
|
|
13866
|
+
if (x || x === 0)
|
|
13867
|
+
return x;
|
|
13868
|
+
return (compare(b, b) === 0) - (compare(a, a) === 0);
|
|
13869
|
+
};
|
|
13870
|
+
}
|
|
13871
|
+
function ascendingDefined(a, b) {
|
|
13872
|
+
return (a == null || !(a >= a)) - (b == null || !(b >= b)) || (a < b ? -1 : a > b ? 1 : 0);
|
|
13873
|
+
}
|
|
13874
|
+
|
|
13808
13875
|
// node_modules/d3-array/src/array.js
|
|
13809
13876
|
var array = Array.prototype;
|
|
13810
13877
|
var slice = array.slice;
|
|
@@ -14026,6 +14093,68 @@
|
|
|
14026
14093
|
return min2;
|
|
14027
14094
|
}
|
|
14028
14095
|
|
|
14096
|
+
// node_modules/d3-array/src/quickselect.js
|
|
14097
|
+
function quickselect(array3, k, left2 = 0, right2 = Infinity, compare) {
|
|
14098
|
+
k = Math.floor(k);
|
|
14099
|
+
left2 = Math.floor(Math.max(0, left2));
|
|
14100
|
+
right2 = Math.floor(Math.min(array3.length - 1, right2));
|
|
14101
|
+
if (!(left2 <= k && k <= right2))
|
|
14102
|
+
return array3;
|
|
14103
|
+
compare = compare === void 0 ? ascendingDefined : compareDefined(compare);
|
|
14104
|
+
while (right2 > left2) {
|
|
14105
|
+
if (right2 - left2 > 600) {
|
|
14106
|
+
const n = right2 - left2 + 1;
|
|
14107
|
+
const m = k - left2 + 1;
|
|
14108
|
+
const z = Math.log(n);
|
|
14109
|
+
const s = 0.5 * Math.exp(2 * z / 3);
|
|
14110
|
+
const sd = 0.5 * Math.sqrt(z * s * (n - s) / n) * (m - n / 2 < 0 ? -1 : 1);
|
|
14111
|
+
const newLeft = Math.max(left2, Math.floor(k - m * s / n + sd));
|
|
14112
|
+
const newRight = Math.min(right2, Math.floor(k + (n - m) * s / n + sd));
|
|
14113
|
+
quickselect(array3, k, newLeft, newRight, compare);
|
|
14114
|
+
}
|
|
14115
|
+
const t = array3[k];
|
|
14116
|
+
let i = left2;
|
|
14117
|
+
let j = right2;
|
|
14118
|
+
swap(array3, left2, k);
|
|
14119
|
+
if (compare(array3[right2], t) > 0)
|
|
14120
|
+
swap(array3, left2, right2);
|
|
14121
|
+
while (i < j) {
|
|
14122
|
+
swap(array3, i, j), ++i, --j;
|
|
14123
|
+
while (compare(array3[i], t) < 0)
|
|
14124
|
+
++i;
|
|
14125
|
+
while (compare(array3[j], t) > 0)
|
|
14126
|
+
--j;
|
|
14127
|
+
}
|
|
14128
|
+
if (compare(array3[left2], t) === 0)
|
|
14129
|
+
swap(array3, left2, j);
|
|
14130
|
+
else
|
|
14131
|
+
++j, swap(array3, j, right2);
|
|
14132
|
+
if (j <= k)
|
|
14133
|
+
left2 = j + 1;
|
|
14134
|
+
if (k <= j)
|
|
14135
|
+
right2 = j - 1;
|
|
14136
|
+
}
|
|
14137
|
+
return array3;
|
|
14138
|
+
}
|
|
14139
|
+
function swap(array3, i, j) {
|
|
14140
|
+
const t = array3[i];
|
|
14141
|
+
array3[i] = array3[j];
|
|
14142
|
+
array3[j] = t;
|
|
14143
|
+
}
|
|
14144
|
+
|
|
14145
|
+
// node_modules/d3-array/src/quantile.js
|
|
14146
|
+
function quantile(values, p, valueof) {
|
|
14147
|
+
values = Float64Array.from(numbers(values, valueof));
|
|
14148
|
+
if (!(n = values.length) || isNaN(p = +p))
|
|
14149
|
+
return;
|
|
14150
|
+
if (p <= 0 || n < 2)
|
|
14151
|
+
return min(values);
|
|
14152
|
+
if (p >= 1)
|
|
14153
|
+
return max(values);
|
|
14154
|
+
var n, i = (n - 1) * p, i0 = Math.floor(i), value0 = max(quickselect(values, i0).subarray(0, i0 + 1)), value1 = min(values.subarray(i0 + 1));
|
|
14155
|
+
return value0 + (value1 - value0) * (i - i0);
|
|
14156
|
+
}
|
|
14157
|
+
|
|
14029
14158
|
// node_modules/d3-array/src/mean.js
|
|
14030
14159
|
function mean(values, valueof) {
|
|
14031
14160
|
let count2 = 0;
|
|
@@ -14048,6 +14177,11 @@
|
|
|
14048
14177
|
return sum2 / count2;
|
|
14049
14178
|
}
|
|
14050
14179
|
|
|
14180
|
+
// node_modules/d3-array/src/median.js
|
|
14181
|
+
function median(values, valueof) {
|
|
14182
|
+
return quantile(values, 0.5, valueof);
|
|
14183
|
+
}
|
|
14184
|
+
|
|
14051
14185
|
// node_modules/d3-array/src/range.js
|
|
14052
14186
|
function range(start, stop, step) {
|
|
14053
14187
|
start = +start, stop = +stop, step = (n = arguments.length) < 2 ? (stop = start, start = 0, 1) : n < 3 ? 1 : +step;
|
|
@@ -14107,6 +14241,9 @@
|
|
|
14107
14241
|
AggTypes2["MAX"] = "MAX";
|
|
14108
14242
|
AggTypes2["COUNT"] = "COUNT";
|
|
14109
14243
|
AggTypes2["COUNT_DISTINCT"] = "COUNT_DISTINCT";
|
|
14244
|
+
AggTypes2["MEDIAN"] = "MEDIAN";
|
|
14245
|
+
AggTypes2["STD_DEV"] = "STD_DEV";
|
|
14246
|
+
AggTypes2["VARIANCE"] = "VARIANCE";
|
|
14110
14247
|
return AggTypes2;
|
|
14111
14248
|
})(AggTypes || {});
|
|
14112
14249
|
var ColumnTypes = /* @__PURE__ */ ((ColumnTypes2) => {
|
|
@@ -14200,8 +14337,17 @@
|
|
|
14200
14337
|
|
|
14201
14338
|
// src/Classes/AggType.ts
|
|
14202
14339
|
var AggType = class {
|
|
14203
|
-
constructor({
|
|
14204
|
-
|
|
14340
|
+
constructor({
|
|
14341
|
+
type,
|
|
14342
|
+
displayName,
|
|
14343
|
+
tooltip,
|
|
14344
|
+
unit: unit2,
|
|
14345
|
+
icon,
|
|
14346
|
+
supportsStrings = false,
|
|
14347
|
+
symbol,
|
|
14348
|
+
fn = () => {
|
|
14349
|
+
}
|
|
14350
|
+
}) {
|
|
14205
14351
|
this.type = type;
|
|
14206
14352
|
this.displayName = displayName ? displayName : "";
|
|
14207
14353
|
this.tooltip = tooltip;
|
|
@@ -14209,6 +14355,7 @@
|
|
|
14209
14355
|
this.supportsStrings = supportsStrings;
|
|
14210
14356
|
this.symbol = symbol;
|
|
14211
14357
|
this.fn = fn;
|
|
14358
|
+
this.icon = icon;
|
|
14212
14359
|
}
|
|
14213
14360
|
};
|
|
14214
14361
|
|
|
@@ -14323,7 +14470,8 @@
|
|
|
14323
14470
|
type: "SUM" /* SUM */,
|
|
14324
14471
|
displayName: "Sum",
|
|
14325
14472
|
tooltip: "<strong>Sum:</strong> Values that have the same chart axis label will be added up.",
|
|
14326
|
-
symbol: String.fromCharCode(931),
|
|
14473
|
+
// symbol: String.fromCharCode(931),
|
|
14474
|
+
icon: "sum",
|
|
14327
14475
|
fn: sum
|
|
14328
14476
|
}),
|
|
14329
14477
|
AVG: new AggType({
|
|
@@ -14333,20 +14481,20 @@
|
|
|
14333
14481
|
symbol: String.fromCharCode(956),
|
|
14334
14482
|
fn: mean
|
|
14335
14483
|
}),
|
|
14336
|
-
|
|
14337
|
-
|
|
14338
|
-
|
|
14339
|
-
|
|
14340
|
-
|
|
14341
|
-
|
|
14342
|
-
|
|
14343
|
-
|
|
14344
|
-
|
|
14345
|
-
|
|
14346
|
-
|
|
14347
|
-
|
|
14348
|
-
|
|
14349
|
-
|
|
14484
|
+
MIN: new AggType({
|
|
14485
|
+
type: "MIN" /* MIN */,
|
|
14486
|
+
displayName: "Minimum",
|
|
14487
|
+
tooltip: "<strong>Minimum:</strong> The smallest value will be shown for all data points with same label.",
|
|
14488
|
+
icon: "minimum",
|
|
14489
|
+
fn: min
|
|
14490
|
+
}),
|
|
14491
|
+
MAX: new AggType({
|
|
14492
|
+
type: "MAX" /* MAX */,
|
|
14493
|
+
displayName: "Maximum",
|
|
14494
|
+
tooltip: "<strong>Maximum:</strong> The largest value will be shown for all data points with same label.",
|
|
14495
|
+
icon: "maximum",
|
|
14496
|
+
fn: max
|
|
14497
|
+
}),
|
|
14350
14498
|
COUNT: new AggType({
|
|
14351
14499
|
type: "COUNT" /* COUNT */,
|
|
14352
14500
|
displayName: "Count",
|
|
@@ -14358,31 +14506,43 @@
|
|
|
14358
14506
|
var _a, _b;
|
|
14359
14507
|
return (_b = (_a = arr == null ? void 0 : arr.filter((value) => !!value)) == null ? void 0 : _a.length) != null ? _b : 0;
|
|
14360
14508
|
}
|
|
14509
|
+
}),
|
|
14510
|
+
COUNT_DISTINCT: new AggType({
|
|
14511
|
+
type: "COUNT_DISTINCT" /* COUNT_DISTINCT */,
|
|
14512
|
+
displayName: "Count Distinct",
|
|
14513
|
+
unit: "none",
|
|
14514
|
+
supportsStrings: true,
|
|
14515
|
+
tooltip: "<strong>Count Distinct:</strong> The total number of <em>unique</em> non-blank values will be shown for all data points with the same label.",
|
|
14516
|
+
symbol: "#!",
|
|
14517
|
+
fn: (arr) => {
|
|
14518
|
+
var _a, _b, _c;
|
|
14519
|
+
return (_c = (_b = (_a = arr == null ? void 0 : arr.filter((value) => !!value || value == 0)) == null ? void 0 : _a.filter(onlyUnique)) == null ? void 0 : _b.length) != null ? _c : 0;
|
|
14520
|
+
}
|
|
14521
|
+
}),
|
|
14522
|
+
MEDIAN: new AggType({
|
|
14523
|
+
type: "MEDIAN" /* MEDIAN */,
|
|
14524
|
+
displayName: "Median",
|
|
14525
|
+
tooltip: "The median (middle) value will be shown for all data points with same label.",
|
|
14526
|
+
// symbol: 'Median',
|
|
14527
|
+
icon: "median",
|
|
14528
|
+
fn: median
|
|
14529
|
+
}),
|
|
14530
|
+
STD_DEV: new AggType({
|
|
14531
|
+
type: "STD_DEV" /* STD_DEV */,
|
|
14532
|
+
displayName: "Standard deviation",
|
|
14533
|
+
unit: "none",
|
|
14534
|
+
tooltip: "The standard deviation will be shown for all data points with the same label.",
|
|
14535
|
+
symbol: "\u03C3",
|
|
14536
|
+
fn: deviation
|
|
14537
|
+
}),
|
|
14538
|
+
VARIANCE: new AggType({
|
|
14539
|
+
type: "VARIANCE" /* VARIANCE */,
|
|
14540
|
+
displayName: "Variance",
|
|
14541
|
+
unit: "none",
|
|
14542
|
+
tooltip: "The variance will be shown for all data points with the same label.",
|
|
14543
|
+
symbol: "\u03C3\xB2",
|
|
14544
|
+
fn: variance
|
|
14361
14545
|
})
|
|
14362
|
-
// COUNT_DISTINCT: new AggType({
|
|
14363
|
-
// type: AggTypes.COUNT_DISTINCT,
|
|
14364
|
-
// displayName: 'Count Distinct',
|
|
14365
|
-
// unit: 'none',
|
|
14366
|
-
// supportsStrings: true,
|
|
14367
|
-
// tooltip:
|
|
14368
|
-
// '<strong>Count Distinct:</strong> The total number of <em>unique</em> non-blank values will be shown for all data points with the same label.',
|
|
14369
|
-
// symbol: '#!',
|
|
14370
|
-
// fn: (arr) => arr?.filter((value) => !!value)?.filter(onlyUnique)?.length ?? 0,
|
|
14371
|
-
// }),
|
|
14372
|
-
// MEDIAN: new AggType({
|
|
14373
|
-
// displayName: 'Median',
|
|
14374
|
-
// tooltip: 'The median (middle) value will be shown for all data points with same label.',
|
|
14375
|
-
// }),
|
|
14376
|
-
// STD_DEV: new AggType({
|
|
14377
|
-
// displayName: 'Standard deviation',
|
|
14378
|
-
// unit: 'none',
|
|
14379
|
-
// tooltip: 'The standard deviation will be shown for all data points with the same label.',
|
|
14380
|
-
// }),
|
|
14381
|
-
// VARIANCE: new AggType({
|
|
14382
|
-
// displayName: 'Variance',
|
|
14383
|
-
// unit: 'none',
|
|
14384
|
-
// tooltip: 'The variance will be shown for all data points with the same label.',
|
|
14385
|
-
// }),
|
|
14386
14546
|
};
|
|
14387
14547
|
var DISPLAY_TYPES = {
|
|
14388
14548
|
TABLE: {
|
|
@@ -18817,8 +18977,6 @@
|
|
|
18817
18977
|
console.error("Unable to generate pivot data - rows, columns, or table config was not provided");
|
|
18818
18978
|
return {};
|
|
18819
18979
|
}
|
|
18820
|
-
let pivotTableRowsLimited = false;
|
|
18821
|
-
let pivotTableColumnsLimited = false;
|
|
18822
18980
|
try {
|
|
18823
18981
|
let tableData = rows == null ? void 0 : rows.filter((row) => row[0] !== null);
|
|
18824
18982
|
if (!(tableData == null ? void 0 : tableData.length)) {
|
|
@@ -18826,43 +18984,30 @@
|
|
|
18826
18984
|
return {};
|
|
18827
18985
|
}
|
|
18828
18986
|
const { legendColumnIndex, stringColumnIndex, numberColumnIndex } = tableConfig;
|
|
18829
|
-
const maxColumns = 20;
|
|
18830
|
-
const maxRows = 100;
|
|
18831
18987
|
if (isNaN(legendColumnIndex) || isNaN(stringColumnIndex) || isNaN(numberColumnIndex)) {
|
|
18832
18988
|
console.error(
|
|
18833
18989
|
"Unable to generate pivot data - table config provided was invalid. You must provide a valid legend, string, ad number column index."
|
|
18834
18990
|
);
|
|
18835
18991
|
return {};
|
|
18836
18992
|
}
|
|
18837
|
-
let
|
|
18838
|
-
let uniqueColumnHeaders = sortDataByDate(tableData, columns, "desc", "isTable").map((d) => d[legendColumnIndex]).filter(onlyUnique);
|
|
18839
|
-
let newStringColumnIndex = stringColumnIndex;
|
|
18840
|
-
let newLegendColumnIndex = legendColumnIndex;
|
|
18841
|
-
if (isFirstGeneration && Object.keys(uniqueColumnHeaders).length > Object.keys(uniqueRowHeaders).length && (!isColumnDateType(columns[stringColumnIndex]) || Object.keys(uniqueColumnHeaders).length > MAX_LEGEND_LABELS)) {
|
|
18842
|
-
newStringColumnIndex = legendColumnIndex;
|
|
18843
|
-
newLegendColumnIndex = stringColumnIndex;
|
|
18844
|
-
const tempValues = [...uniqueRowHeaders];
|
|
18845
|
-
uniqueRowHeaders = [...uniqueColumnHeaders];
|
|
18846
|
-
uniqueColumnHeaders = tempValues;
|
|
18847
|
-
}
|
|
18848
|
-
if ((uniqueRowHeaders == null ? void 0 : uniqueRowHeaders.length) > maxRows) {
|
|
18849
|
-
uniqueRowHeaders = uniqueRowHeaders.slice(0, maxRows);
|
|
18850
|
-
pivotTableRowsLimited = true;
|
|
18851
|
-
}
|
|
18852
|
-
const uniqueRowHeadersObj = uniqueRowHeaders.reduce((map4, title, i) => {
|
|
18993
|
+
let uniqueValues0 = sortDataByDate(tableData, columns, "desc", "isTable").map((d) => d[stringColumnIndex]).filter(onlyUnique).reduce((map4, title, i) => {
|
|
18853
18994
|
map4[title] = i;
|
|
18854
18995
|
return map4;
|
|
18855
18996
|
}, {});
|
|
18856
|
-
|
|
18857
|
-
uniqueColumnHeaders = uniqueColumnHeaders.slice(0, maxColumns);
|
|
18858
|
-
pivotTableColumnsLimited = true;
|
|
18859
|
-
}
|
|
18860
|
-
const uniqueColumnHeadersObj = uniqueColumnHeaders.reduce((map4, title, i) => {
|
|
18997
|
+
let uniqueValues1 = sortDataByDate(tableData, columns, "desc", "isTable").map((d) => d[legendColumnIndex]).filter(onlyUnique).reduce((map4, title, i) => {
|
|
18861
18998
|
map4[title] = i;
|
|
18862
18999
|
return map4;
|
|
18863
19000
|
}, {});
|
|
18864
|
-
|
|
18865
|
-
|
|
19001
|
+
let newStringColumnIndex = stringColumnIndex;
|
|
19002
|
+
let newLegendColumnIndex = legendColumnIndex;
|
|
19003
|
+
if (isFirstGeneration && Object.keys(uniqueValues1).length > Object.keys(uniqueValues0).length && (!isColumnDateType(columns[stringColumnIndex]) || Object.keys(uniqueValues1).length > MAX_LEGEND_LABELS)) {
|
|
19004
|
+
newStringColumnIndex = legendColumnIndex;
|
|
19005
|
+
newLegendColumnIndex = stringColumnIndex;
|
|
19006
|
+
const tempValues = (0, import_lodash5.default)(uniqueValues0);
|
|
19007
|
+
uniqueValues0 = (0, import_lodash5.default)(uniqueValues1);
|
|
19008
|
+
uniqueValues1 = (0, import_lodash5.default)(tempValues);
|
|
19009
|
+
}
|
|
19010
|
+
const firstColumn = {
|
|
18866
19011
|
...columns[newStringColumnIndex],
|
|
18867
19012
|
index: 0,
|
|
18868
19013
|
frozen: true,
|
|
@@ -18872,9 +19017,10 @@
|
|
|
18872
19017
|
cssClass: "pivot-category",
|
|
18873
19018
|
pivot: true,
|
|
18874
19019
|
headerFilter: false
|
|
18875
|
-
}
|
|
19020
|
+
};
|
|
19021
|
+
const pivotTableColumns = [firstColumn];
|
|
18876
19022
|
const fullDataFormatting = getDataFormatting(dataFormatting);
|
|
18877
|
-
|
|
19023
|
+
Object.keys(uniqueValues1).forEach((columnName, i) => {
|
|
18878
19024
|
const formattedColumnName = formatElement({
|
|
18879
19025
|
element: columnName,
|
|
18880
19026
|
column: columns[newLegendColumnIndex],
|
|
@@ -18896,38 +19042,30 @@
|
|
|
18896
19042
|
});
|
|
18897
19043
|
});
|
|
18898
19044
|
const pivotTableData = makeEmptyArray(
|
|
18899
|
-
|
|
19045
|
+
Object.keys(uniqueValues1).length + 1,
|
|
18900
19046
|
// Add one for the frozen first column
|
|
18901
|
-
|
|
19047
|
+
Object.keys(uniqueValues0).length
|
|
18902
19048
|
);
|
|
18903
19049
|
tableData.forEach((row) => {
|
|
18904
|
-
var _a
|
|
18905
|
-
const
|
|
18906
|
-
const
|
|
18907
|
-
|
|
18908
|
-
|
|
18909
|
-
}
|
|
18910
|
-
pivotTableData[pivotRowIndex][0] = pivotRowHeaderValue;
|
|
19050
|
+
var _a;
|
|
19051
|
+
const pivotCategoryIndex = uniqueValues0[row[newStringColumnIndex]];
|
|
19052
|
+
const pivotCategoryValue = row[newStringColumnIndex];
|
|
19053
|
+
pivotTableData[pivotCategoryIndex][0] = pivotCategoryValue;
|
|
19054
|
+
const pivotColumnIndex = uniqueValues1[row[newLegendColumnIndex]] + 1;
|
|
18911
19055
|
const pivotValue = Number(row[numberColumnIndex]);
|
|
18912
|
-
|
|
18913
|
-
|
|
18914
|
-
|
|
18915
|
-
|
|
18916
|
-
|
|
18917
|
-
drill_down: (_b = columns[newStringColumnIndex]) == null ? void 0 : _b.drill_down,
|
|
18918
|
-
value: pivotRowHeaderValue
|
|
18919
|
-
};
|
|
18920
|
-
}
|
|
19056
|
+
pivotTableData[pivotCategoryIndex][pivotColumnIndex] = pivotValue;
|
|
19057
|
+
pivotTableColumns[pivotColumnIndex].origValues[pivotCategoryValue] = {
|
|
19058
|
+
name: (_a = columns[newStringColumnIndex]) == null ? void 0 : _a.name,
|
|
19059
|
+
value: pivotCategoryValue
|
|
19060
|
+
};
|
|
18921
19061
|
});
|
|
18922
19062
|
const dataReturn = {
|
|
18923
19063
|
pivotTableColumns,
|
|
18924
19064
|
pivotTableData,
|
|
18925
19065
|
stringColumnIndex: newStringColumnIndex,
|
|
18926
19066
|
legendColumnIndex: newLegendColumnIndex,
|
|
18927
|
-
pivotColumnHeaders:
|
|
18928
|
-
pivotRowHeaders:
|
|
18929
|
-
pivotTableRowsLimited,
|
|
18930
|
-
pivotTableColumnsLimited
|
|
19067
|
+
pivotColumnHeaders: uniqueValues1,
|
|
19068
|
+
pivotRowHeaders: uniqueValues0
|
|
18931
19069
|
};
|
|
18932
19070
|
return dataReturn;
|
|
18933
19071
|
} catch (error) {
|
|
@@ -23459,8 +23597,10 @@
|
|
|
23459
23597
|
};
|
|
23460
23598
|
var applyStylesForHiddenSeries = ({ legendElement, legendLabels }) => {
|
|
23461
23599
|
try {
|
|
23462
|
-
select_default2(legendElement).selectAll(".cell").each(function(
|
|
23463
|
-
|
|
23600
|
+
select_default2(legendElement).selectAll(".cell").each(function() {
|
|
23601
|
+
var _a, _b;
|
|
23602
|
+
const cellData = JSON.parse((_b = (_a = select_default2(this)) == null ? void 0 : _a.data) == null ? void 0 : _b.call(_a));
|
|
23603
|
+
const legendLabel = legendLabels == null ? void 0 : legendLabels.find((l) => l.label === (cellData == null ? void 0 : cellData.label));
|
|
23464
23604
|
if (legendLabel) {
|
|
23465
23605
|
select_default2(this).select(".swatch").attr("stroke", legendLabel.color).attr("stroke-location", "outside");
|
|
23466
23606
|
if (legendLabel.hidden) {
|