@vizzly/dashboard 0.15.0-dev-509defaf8b80e792fe01ec64fbeadf5c6b393948 → 0.15.0-dev-7a0950140407e5d00da47b05fcfee58cb3dd2399

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.
@@ -1062,8 +1062,8 @@ var removeField = function removeField(originalFields, removeFields) {
1062
1062
  return !fieldsToRemove.has(field.id);
1063
1063
  });
1064
1064
  };
1065
- var upcastStringDimensionsToObject = function upcastStringDimensionsToObject(dimensions) {
1066
- return dimensions.map(function (dimension) {
1065
+ var upcastDimensions = function upcastDimensions(dimensions, timeDimension) {
1066
+ var upcast = dimensions.map(function (dimension) {
1067
1067
  if (typeof dimension === 'string') {
1068
1068
  return {
1069
1069
  field: dimension,
@@ -1073,6 +1073,23 @@ var upcastStringDimensionsToObject = function upcastStringDimensionsToObject(dim
1073
1073
  return dimension;
1074
1074
  }
1075
1075
  });
1076
+ if (timeDimension) {
1077
+ var alreadyPresent = upcast.some(function (d) {
1078
+ return d.field === timeDimension.field && d["function"] === timeDimension.truncate;
1079
+ });
1080
+ var dimension = alreadyPresent ? upcast : [{
1081
+ field: timeDimension.field,
1082
+ "function": timeDimension.truncate
1083
+ }].concat(upcast);
1084
+ return {
1085
+ dimension: dimension,
1086
+ timeDimension: null
1087
+ };
1088
+ }
1089
+ return {
1090
+ dimension: upcast,
1091
+ timeDimension: null
1092
+ };
1076
1093
  };
1077
1094
  var isArrayDataType = function isArrayDataType(field) {
1078
1095
  return field.dataType == 'string[]';
@@ -4325,7 +4342,7 @@ var AreaChart = function AreaChart(config) {
4325
4342
  type: dumped.type,
4326
4343
  measure: upcastMeasure(dumped.measure),
4327
4344
  displayTitle: dumped.displayTitle,
4328
- dimension: upcastStringDimensionsToObject(dumped.dimension),
4345
+ dimension: upcastDimensions(dumped.dimension).dimension,
4329
4346
  timeDimension: dumped.timeDimension,
4330
4347
  displaySubject: dumped.displaySubject,
4331
4348
  viewId: upcastViewId(dumped.viewId),
@@ -4823,13 +4840,12 @@ var AreaChart$1 = function AreaChart(config) {
4823
4840
  },
4824
4841
  load: function load(dumped) {
4825
4842
  var _dumped$xAxisMin, _dumped$xAxisMax, _dumped$yAxisMin, _dumped$yAxisMax, _dumped$tags, _dumped$trends;
4826
- return {
4843
+ return _extends({
4827
4844
  updated_at: dumped.updated_at,
4828
4845
  type: dumped.type,
4829
4846
  measure: upcastMeasure(dumped.measure),
4830
- order: upcastOrder(dumped.order, dumped.timeDimension),
4831
- dimension: upcastStringDimensionsToObject(dumped.dimension),
4832
- // TODO: upcast dumped.timeDimension -> dimension
4847
+ order: upcastOrder(dumped.order, dumped.timeDimension)
4848
+ }, upcastDimensions(dumped.dimension, dumped.timeDimension), {
4833
4849
  displayTitle: dumped.displayTitle,
4834
4850
  displaySubject: dumped.displaySubject,
4835
4851
  protectedByOrganisation: dumped.protectedByOrganisation,
@@ -4837,7 +4853,6 @@ var AreaChart$1 = function AreaChart(config) {
4837
4853
  filter: upcastFilter(dumped.filter),
4838
4854
  dataSetId: dumped.dataSetId,
4839
4855
  limit: dumped.limit,
4840
- timeDimension: null,
4841
4856
  xAxisPostfix: dumped.xAxisPostfix,
4842
4857
  xAxisPrefix: dumped.xAxisPrefix,
4843
4858
  yAxisPostfix: dumped.yAxisPostfix,
@@ -4864,7 +4879,7 @@ var AreaChart$1 = function AreaChart(config) {
4864
4879
  tags: (_dumped$tags = dumped.tags) != null ? _dumped$tags : [],
4865
4880
  trends: (_dumped$trends = dumped.trends) != null ? _dumped$trends : [],
4866
4881
  stacked: dumped.stacked
4867
- };
4882
+ });
4868
4883
  },
4869
4884
  setAttributes: setAttributes$2(config),
4870
4885
  validate: function validate(attrs, dataSets) {
@@ -5220,7 +5235,7 @@ var BarChart = function BarChart(config) {
5220
5235
  order: upcastOrder(dumped.order, dumped.timeDimension),
5221
5236
  filter: upcastFilter(dumped.filter),
5222
5237
  viewId: upcastViewId(dumped.viewId),
5223
- dimension: upcastStringDimensionsToObject(dumped.dimension),
5238
+ dimension: upcastDimensions(dumped.dimension).dimension,
5224
5239
  approxXAxisLabelCount: upcastAxisLabel(dumped.approxXAxisLabelCount),
5225
5240
  approxYAxisLabelCount: upcastAxisLabel(dumped.approxYAxisLabelCount),
5226
5241
  parameters: upcastV1Parameters(dumped.parameters),
@@ -5770,9 +5785,8 @@ var BarChart$1 = function BarChart(config) {
5770
5785
  type: dumped.type,
5771
5786
  updated_at: dumped.updated_at,
5772
5787
  measure: upcastMeasure(dumped.measure),
5773
- order: upcastOrder(dumped.order, dumped.timeDimension),
5774
- dimension: upcastStringDimensionsToObject(dumped.dimension),
5775
- // TODO: upcast dumped.timeDimension -> dimension
5788
+ order: upcastOrder(dumped.order, dumped.timeDimension)
5789
+ }, upcastDimensions(dumped.dimension, dumped.timeDimension), {
5776
5790
  displayTitle: dumped.displayTitle,
5777
5791
  displaySubject: dumped.displaySubject,
5778
5792
  protectedByOrganisation: dumped.protectedByOrganisation,
@@ -5780,7 +5794,6 @@ var BarChart$1 = function BarChart(config) {
5780
5794
  filter: upcastFilter(dumped.filter),
5781
5795
  dataSetId: dumped.dataSetId,
5782
5796
  limit: dumped.limit,
5783
- timeDimension: null,
5784
5797
  xAxisPostfix: dumped.xAxisPostfix,
5785
5798
  xAxisPrefix: dumped.xAxisPrefix,
5786
5799
  yAxisPostfix: dumped.yAxisPostfix,
@@ -6105,7 +6118,7 @@ var BasicTable = function BasicTable(config) {
6105
6118
  measure: upcastMeasure(dumped.measure),
6106
6119
  order: upcastOrder(dumped.order, dumped.timeDimension),
6107
6120
  filter: upcastFilter(dumped.filter),
6108
- dimension: upcastStringDimensionsToObject(dumped.dimension),
6121
+ dimension: upcastDimensions(dumped.dimension).dimension,
6109
6122
  viewId: upcastViewId(dumped.viewId),
6110
6123
  conditionalFormattingRules: upcast$1(config.queryEngineConfig, dumped.conditionalFormattingRules),
6111
6124
  tags: (_dumped$tags = dumped.tags) != null ? _dumped$tags : [],
@@ -6460,7 +6473,7 @@ var BubbleChart = function BubbleChart(config) {
6460
6473
  xMeasure: upcastMeasure(dumped.xMeasure ? [dumped.xMeasure] : [])[0] || null,
6461
6474
  yMeasure: upcastMeasure(dumped.yMeasure ? [dumped.yMeasure] : [])[0] || null,
6462
6475
  zMeasure: upcastMeasure(dumped.zMeasure ? [dumped.zMeasure] : [])[0] || null,
6463
- dimension: upcastStringDimensionsToObject(dumped.dimension),
6476
+ dimension: upcastDimensions(dumped.dimension).dimension,
6464
6477
  viewId: upcastViewId(dumped.viewId),
6465
6478
  timeDimension: dumped.timeDimension,
6466
6479
  displayTitle: dumped.displayTitle,
@@ -6855,15 +6868,14 @@ var BubbleChartV2 = function BubbleChartV2(config) {
6855
6868
  },
6856
6869
  load: function load(dumped) {
6857
6870
  var _dumped$xAxisMin, _dumped$xAxisMax, _dumped$yAxisMin, _dumped$yAxisMax, _dumped$tags, _dumped$trends;
6858
- return {
6871
+ return _extends({
6859
6872
  updated_at: dumped.updated_at,
6860
6873
  type: dumped.type,
6861
6874
  measure: upcastMeasure(dumped.measure),
6862
6875
  zMeasure: upcastMeasure(dumped.zMeasure),
6863
6876
  xMeasure: upcastMeasure(dumped.xMeasure),
6864
- order: upcastOrder(dumped.order, dumped.timeDimension),
6865
- dimension: upcastStringDimensionsToObject(dumped.dimension),
6866
- // TODO: upcast dumped.timeDimension -> dimension
6877
+ order: upcastOrder(dumped.order, dumped.timeDimension)
6878
+ }, upcastDimensions(dumped.dimension, dumped.timeDimension), {
6867
6879
  displayTitle: dumped.displayTitle,
6868
6880
  displaySubject: dumped.displaySubject,
6869
6881
  protectedByOrganisation: dumped.protectedByOrganisation,
@@ -6871,7 +6883,6 @@ var BubbleChartV2 = function BubbleChartV2(config) {
6871
6883
  filter: upcastFilter(dumped.filter),
6872
6884
  dataSetId: dumped.dataSetId,
6873
6885
  limit: dumped.limit,
6874
- timeDimension: null,
6875
6886
  xAxisPostfix: dumped.xAxisPostfix,
6876
6887
  xAxisPrefix: dumped.xAxisPrefix,
6877
6888
  yAxisPostfix: dumped.yAxisPostfix,
@@ -6897,7 +6908,7 @@ var BubbleChartV2 = function BubbleChartV2(config) {
6897
6908
  axisTitles: dumped.axisTitles,
6898
6909
  tags: (_dumped$tags = dumped.tags) != null ? _dumped$tags : [],
6899
6910
  trends: (_dumped$trends = dumped.trends) != null ? _dumped$trends : []
6900
- };
6911
+ });
6901
6912
  },
6902
6913
  setAttributes: setAttributes$7(config),
6903
6914
  validate: function validate(attrs, dataSets) {
@@ -7111,8 +7122,8 @@ function upcast$3(raw, functionsToCheck, upcastApproxXAxisLabelCountWithAllOptio
7111
7122
  barMeasure: upcastMeasure(raw.barMeasure),
7112
7123
  order: upcastOrder(raw.order, raw.timeDimension || null),
7113
7124
  filter: upcastFilter(raw.filter),
7114
- lineDimension: upcastStringDimensionsToObject(raw.lineDimension || raw.dimension || []),
7115
- barDimension: upcastStringDimensionsToObject(raw.barDimension || raw.dimension || []),
7125
+ lineDimension: upcastDimensions(raw.lineDimension || raw.dimension || []).dimension,
7126
+ barDimension: upcastDimensions(raw.barDimension || raw.dimension || []).dimension,
7116
7127
  viewId: upcastViewId(raw.viewId),
7117
7128
  approxXAxisLabelCount: upcastApproxXAxisLabelCountWithAllOptions ? upcastAxisLabelWithAllOptions(raw.approxXAxisLabelCount) : upcastAxisLabel(raw.approxXAxisLabelCount),
7118
7129
  approxYAxisLabelCount: upcastAxisLabel(raw.approxYAxisLabelCount),
@@ -8277,7 +8288,7 @@ var DataTable = function DataTable(config) {
8277
8288
  displayTitle: dumped.displayTitle,
8278
8289
  dimension: upcastPivots(getGroupingWithTimeDimension({
8279
8290
  timeDimension: dumped.timeDimension,
8280
- dimension: upcastStringDimensionsToObject(dumped.dimension)
8291
+ dimension: upcastDimensions(dumped.dimension).dimension
8281
8292
  })),
8282
8293
  displaySubject: dumped.displaySubject,
8283
8294
  protectedByOrganisation: dumped.protectedByOrganisation,
@@ -8685,7 +8696,7 @@ var FunnelChart = function FunnelChart(config) {
8685
8696
  return _extends({}, dumped, {
8686
8697
  measure: upcastMeasure(dumped.measure),
8687
8698
  order: upcastOrder(dumped.order, dumped.timeDimension),
8688
- dimension: upcastStringDimensionsToObject(dumped.dimension),
8699
+ dimension: upcastDimensions(dumped.dimension).dimension,
8689
8700
  viewId: upcastViewId(dumped.viewId),
8690
8701
  filter: upcastFilter(dumped.filter),
8691
8702
  approxXAxisLabelCount: upcastAxisLabel(dumped.approxXAxisLabelCount),
@@ -9011,7 +9022,7 @@ var HorizontalBarChart = function HorizontalBarChart(config) {
9011
9022
  return _extends({}, dumped, {
9012
9023
  measure: upcastMeasure(dumped.measure),
9013
9024
  order: upcastOrder(dumped.order, dumped.timeDimension),
9014
- dimension: upcastStringDimensionsToObject(dumped.dimension),
9025
+ dimension: upcastDimensions(dumped.dimension).dimension,
9015
9026
  viewId: upcastViewId(dumped.viewId),
9016
9027
  filter: upcastFilter(dumped.filter),
9017
9028
  approxXAxisLabelCount: upcastAxisLabel(dumped.approxXAxisLabelCount),
@@ -9377,13 +9388,12 @@ var HorizontalBarChart$1 = function HorizontalBarChart(config) {
9377
9388
  },
9378
9389
  load: function load(dumped) {
9379
9390
  var _dumped$xAxisMin, _dumped$xAxisMax, _dumped$yAxisMin, _dumped$yAxisMax, _dumped$tags;
9380
- return {
9391
+ return _extends({
9381
9392
  updated_at: dumped.updated_at,
9382
9393
  type: dumped.type,
9383
9394
  measure: upcastMeasure(dumped.measure),
9384
- order: upcastOrder(dumped.order, dumped.timeDimension),
9385
- dimension: upcastStringDimensionsToObject(dumped.dimension),
9386
- // TODO: upcast dumped.timeDimension -> dimension
9395
+ order: upcastOrder(dumped.order, dumped.timeDimension)
9396
+ }, upcastDimensions(dumped.dimension, dumped.timeDimension), {
9387
9397
  displayTitle: dumped.displayTitle,
9388
9398
  displaySubject: dumped.displaySubject,
9389
9399
  protectedByOrganisation: dumped.protectedByOrganisation,
@@ -9391,7 +9401,6 @@ var HorizontalBarChart$1 = function HorizontalBarChart(config) {
9391
9401
  filter: upcastFilter(dumped.filter),
9392
9402
  dataSetId: dumped.dataSetId,
9393
9403
  limit: dumped.limit,
9394
- timeDimension: null,
9395
9404
  xAxisPostfix: dumped.xAxisPostfix,
9396
9405
  xAxisPrefix: dumped.xAxisPrefix,
9397
9406
  yAxisPostfix: dumped.yAxisPostfix,
@@ -9417,7 +9426,7 @@ var HorizontalBarChart$1 = function HorizontalBarChart(config) {
9417
9426
  stacked: dumped.stacked,
9418
9427
  parametersV2: upcast$2(dumped.parameters, dumped.parametersV2, config.queryEngineConfig)
9419
9428
  // drilldownOptions: dumped.drilldownOptions,
9420
- };
9429
+ });
9421
9430
  },
9422
9431
  setAttributes: setAttributes$d(config),
9423
9432
  validate: function validate(attrs, dataSets) {
@@ -9776,7 +9785,7 @@ var LineChart = function LineChart(config) {
9776
9785
  type: dumped.type,
9777
9786
  measure: upcastMeasure(dumped.measure),
9778
9787
  order: upcastOrder(dumped.order, dumped.timeDimension),
9779
- dimension: upcastStringDimensionsToObject(dumped.dimension),
9788
+ dimension: upcastDimensions(dumped.dimension).dimension,
9780
9789
  timeDimension: dumped.timeDimension,
9781
9790
  displayTitle: dumped.displayTitle,
9782
9791
  displaySubject: dumped.displaySubject,
@@ -10221,13 +10230,12 @@ var LineChart$1 = function LineChart(config) {
10221
10230
  },
10222
10231
  load: function load(dumped) {
10223
10232
  var _dumped$xAxisMin, _dumped$xAxisMax, _dumped$yAxisMin, _dumped$yAxisMax, _dumped$yDualAxisMin, _dumped$yDualAxisMax, _dumped$tags, _dumped$trends, _dumped$isDualAxisEna, _dumped$aggregateMetr;
10224
- return {
10233
+ return _extends({
10225
10234
  updated_at: dumped.updated_at,
10226
10235
  type: dumped.type,
10227
10236
  measure: upcastMeasure(dumped.measure),
10228
- order: upcastOrder(dumped.order, dumped.timeDimension),
10229
- dimension: upcastStringDimensionsToObject(dumped.dimension),
10230
- // TODO: upcast dumped.timeDimension -> dimension
10237
+ order: upcastOrder(dumped.order, dumped.timeDimension)
10238
+ }, upcastDimensions(dumped.dimension, dumped.timeDimension), {
10231
10239
  displayTitle: dumped.displayTitle,
10232
10240
  displaySubject: dumped.displaySubject,
10233
10241
  protectedByOrganisation: dumped.protectedByOrganisation,
@@ -10235,7 +10243,6 @@ var LineChart$1 = function LineChart(config) {
10235
10243
  filter: upcastFilter(dumped.filter),
10236
10244
  dataSetId: dumped.dataSetId,
10237
10245
  limit: dumped.limit,
10238
- timeDimension: null,
10239
10246
  xAxisFormat: dumped.xAxisFormat,
10240
10247
  xAxisPostfix: dumped.xAxisPostfix,
10241
10248
  xAxisPrefix: dumped.xAxisPrefix,
@@ -10269,7 +10276,7 @@ var LineChart$1 = function LineChart(config) {
10269
10276
  trends: (_dumped$trends = dumped.trends) != null ? _dumped$trends : [],
10270
10277
  isDualAxisEnabled: (_dumped$isDualAxisEna = dumped.isDualAxisEnabled) != null ? _dumped$isDualAxisEna : false,
10271
10278
  aggregateMetricGroup: (_dumped$aggregateMetr = dumped.aggregateMetricGroup) != null ? _dumped$aggregateMetr : false
10272
- };
10279
+ });
10273
10280
  },
10274
10281
  setAttributes: setAttributes$f(config),
10275
10282
  validate: function validate(attrs, dataSets) {
@@ -10786,7 +10793,7 @@ var PieChart = function PieChart(config) {
10786
10793
  type: dumped.type,
10787
10794
  measure: upcastMeasure(dumped.measure),
10788
10795
  order: upcastOrder(dumped.order, dumped.timeDimension),
10789
- dimension: upcastStringDimensionsToObject(dumped.dimension),
10796
+ dimension: upcastDimensions(dumped.dimension).dimension,
10790
10797
  viewId: upcastViewId(dumped.viewId),
10791
10798
  timeDimension: dumped.timeDimension,
10792
10799
  displayTitle: dumped.displayTitle,
@@ -11374,8 +11381,7 @@ var RadarChart = function RadarChart(config) {
11374
11381
  type: dumped.type,
11375
11382
  measure: upcastMeasure(dumped.measure),
11376
11383
  order: upcastOrder(dumped.order, dumped.timeDimension),
11377
- dimension: upcastStringDimensionsToObject(dumped.dimension),
11378
- // TODO: upcast dumped.timeDimension -> dimension
11384
+ dimension: upcastDimensions(dumped.dimension).dimension,
11379
11385
  displayTitle: dumped.displayTitle,
11380
11386
  displaySubject: dumped.displaySubject,
11381
11387
  protectedByOrganisation: dumped.protectedByOrganisation,
@@ -12037,7 +12043,7 @@ var ScatterChart = function ScatterChart(config) {
12037
12043
  type: dumped.type,
12038
12044
  xMeasure: upcastMeasure(dumped.xMeasure ? [dumped.xMeasure] : [])[0] || null,
12039
12045
  yMeasure: upcastMeasure(dumped.yMeasure ? [dumped.yMeasure] : [])[0] || null,
12040
- dimension: upcastStringDimensionsToObject(dumped.dimension),
12046
+ dimension: upcastDimensions(dumped.dimension).dimension,
12041
12047
  viewId: upcastViewId(dumped.viewId),
12042
12048
  timeDimension: dumped.timeDimension,
12043
12049
  displayTitle: dumped.displayTitle,
@@ -12419,13 +12425,13 @@ var ScatterChartV2 = function ScatterChartV2(config) {
12419
12425
  },
12420
12426
  load: function load(dumped) {
12421
12427
  var _dumped$xAxisMin, _dumped$xAxisMax, _dumped$yAxisMin, _dumped$yAxisMax, _dumped$tags, _dumped$trends;
12422
- return {
12428
+ return _extends({
12423
12429
  updated_at: dumped.updated_at,
12424
12430
  type: dumped.type,
12425
12431
  measure: upcastMeasure(dumped.measure),
12426
12432
  xMeasure: upcastMeasure(dumped.xMeasure),
12427
- order: upcastOrder(dumped.order, dumped.timeDimension),
12428
- dimension: upcastStringDimensionsToObject(dumped.dimension),
12433
+ order: upcastOrder(dumped.order, dumped.timeDimension)
12434
+ }, upcastDimensions(dumped.dimension, dumped.timeDimension), {
12429
12435
  displayTitle: dumped.displayTitle,
12430
12436
  displaySubject: dumped.displaySubject,
12431
12437
  protectedByOrganisation: dumped.protectedByOrganisation,
@@ -12433,7 +12439,6 @@ var ScatterChartV2 = function ScatterChartV2(config) {
12433
12439
  filter: upcastFilter(dumped.filter),
12434
12440
  dataSetId: dumped.dataSetId,
12435
12441
  limit: dumped.limit,
12436
- timeDimension: null,
12437
12442
  xAxisPostfix: dumped.xAxisPostfix,
12438
12443
  xAxisPrefix: dumped.xAxisPrefix,
12439
12444
  yAxisPostfix: dumped.yAxisPostfix,
@@ -12459,7 +12464,7 @@ var ScatterChartV2 = function ScatterChartV2(config) {
12459
12464
  tags: (_dumped$tags = dumped.tags) != null ? _dumped$tags : [],
12460
12465
  trends: (_dumped$trends = dumped.trends) != null ? _dumped$trends : [],
12461
12466
  parametersV2: upcast$2(dumped.parameters, dumped.parametersV2, config.queryEngineConfig)
12462
- };
12467
+ });
12463
12468
  },
12464
12469
  setAttributes: setAttributes$k(config),
12465
12470
  validate: function validate(attrs, dataSets) {
@@ -13013,7 +13018,7 @@ var SunburstChart = function SunburstChart(config) {
13013
13018
  type: dumped.type,
13014
13019
  measure: upcastMeasure(dumped.measure),
13015
13020
  order: upcastOrder(dumped.order, dumped.timeDimension),
13016
- dimension: upcastStringDimensionsToObject(dumped.dimension),
13021
+ dimension: upcastDimensions(dumped.dimension).dimension,
13017
13022
  viewId: upcastViewId(dumped.viewId),
13018
13023
  timeDimension: dumped.timeDimension,
13019
13024
  displayTitle: dumped.displayTitle,
@@ -13618,7 +13623,7 @@ var WaterfallChart = function WaterfallChart(config) {
13618
13623
  filter: upcastFilter(dumped.filter),
13619
13624
  dimension: getGroupingWithTimeDimension({
13620
13625
  timeDimension: (_dumped$timeDimension = dumped.timeDimension) != null ? _dumped$timeDimension : null,
13621
- dimension: upcastStringDimensionsToObject(dumped.dimension)
13626
+ dimension: upcastDimensions(dumped.dimension).dimension
13622
13627
  }),
13623
13628
  parameters: upcastV1Parameters(dumped.parameters),
13624
13629
  parametersV2: upcast$2(dumped.parameters, dumped.parametersV2, config.queryEngineConfig),
@@ -15071,7 +15076,7 @@ var HorizontalWaterfallChart = function HorizontalWaterfallChart(config) {
15071
15076
  filter: upcastFilter(dumped.filter),
15072
15077
  dimension: getGroupingWithTimeDimension({
15073
15078
  timeDimension: (_dumped$timeDimension = dumped.timeDimension) != null ? _dumped$timeDimension : null,
15074
- dimension: upcastStringDimensionsToObject(dumped.dimension)
15079
+ dimension: upcastDimensions(dumped.dimension).dimension
15075
15080
  }),
15076
15081
  parameters: upcastV1Parameters(dumped.parameters),
15077
15082
  parametersV2: upcast$2(dumped.parameters, dumped.parametersV2, config.queryEngineConfig),
@@ -15454,9 +15459,9 @@ var CurveViewerChart = function CurveViewerChart(config) {
15454
15459
  updated_at: dumped.updated_at,
15455
15460
  type: dumped.type,
15456
15461
  measure: upcastMeasure(dumped.measure),
15457
- xDimension: upcastStringDimensionsToObject(dumped.xDimension),
15462
+ xDimension: upcastDimensions(dumped.xDimension).dimension,
15458
15463
  order: upcastOrder(dumped.order, dumped.timeDimension),
15459
- dimension: upcastStringDimensionsToObject(dumped.dimension),
15464
+ dimension: upcastDimensions(dumped.dimension).dimension,
15460
15465
  displayTitle: dumped.displayTitle,
15461
15466
  displaySubject: dumped.displaySubject,
15462
15467
  protectedByOrganisation: dumped.protectedByOrganisation,
@@ -15476,8 +15481,8 @@ var CurveViewerChart = function CurveViewerChart(config) {
15476
15481
  legend: dumped.legend,
15477
15482
  legendSingleRow: dumped.legendSingleRow,
15478
15483
  showSpendMarkers: (_dumped$showSpendMark = dumped.showSpendMarkers) != null ? _dumped$showSpendMark : true,
15479
- pointNameDimension: upcastStringDimensionsToObject((_dumped$pointNameDime = dumped.pointNameDimension) != null ? _dumped$pointNameDime : []),
15480
- pointValueDimension: upcastStringDimensionsToObject((_dumped$pointValueDim = dumped.pointValueDimension) != null ? _dumped$pointValueDim : []),
15484
+ pointNameDimension: upcastDimensions((_dumped$pointNameDime = dumped.pointNameDimension) != null ? _dumped$pointNameDime : []).dimension,
15485
+ pointValueDimension: upcastDimensions((_dumped$pointValueDim = dumped.pointValueDimension) != null ? _dumped$pointValueDim : []).dimension,
15481
15486
  tags: (_dumped$tags = dumped.tags) != null ? _dumped$tags : [],
15482
15487
  parameters: upcastV1Parameters(dumped.parameters),
15483
15488
  parametersV2: upcast$2(dumped.parameters, dumped.parametersV2, config.queryEngineConfig),
@@ -16222,6 +16227,642 @@ var NewVizzlyImplementation = /*#__PURE__*/function (_Error) {
16222
16227
 
16223
16228
  var VizzlyTheming;
16224
16229
 
16230
+ var DEFAULT_ROW_HEIGHT = 350;
16231
+ var HEADER_ROW_HEIGHT = 52;
16232
+ var linearScale = function linearScale(colors, colorCount) {
16233
+ return chroma.scale(colors).colors(colorCount);
16234
+ };
16235
+ var themeToColorScale = function themeToColorScale(colors, colorCount) {
16236
+ var _colors$length;
16237
+ if ((colorCount != null ? colorCount : 0) <= ((_colors$length = colors == null ? void 0 : colors.length) != null ? _colors$length : 0)) {
16238
+ return colors;
16239
+ }
16240
+ return shuffle(linearScale(colors, colorCount));
16241
+ };
16242
+ var vizzlyDefaultTheme = {
16243
+ colors: ['#feae4a', '#5fbaff', '#e15e9d'],
16244
+ detail: 'minimal',
16245
+ fontFamily: 'Inter, sans-serif',
16246
+ rowLimit: 6,
16247
+ fontSize: '0.65rem'
16248
+ };
16249
+ var darkerColor = function darkerColor(color, darkenBy, opacity) {
16250
+ var newColor = chroma(color).darken(darkenBy);
16251
+ if (opacity) newColor = setOpacity(newColor, opacity);
16252
+ return newColor.hex();
16253
+ };
16254
+ var darkenListOfColors = function darkenListOfColors(colors, darkenBy) {
16255
+ if (darkenBy === void 0) {
16256
+ darkenBy = 1;
16257
+ }
16258
+ return [].concat(colors).map(function (color) {
16259
+ return darkerColor(color, darkenBy);
16260
+ });
16261
+ };
16262
+ var lighterColor = function lighterColor(color, brightenBy, opacity) {
16263
+ var newColor = chroma(color).brighten(brightenBy);
16264
+ if (opacity) newColor = setOpacity(newColor, opacity);
16265
+ return newColor.hex();
16266
+ };
16267
+ var TONAL_RAMP_LIGHTNESS_STEP = 40;
16268
+ var TONAL_RAMP_LIGHTNESS_MIN = 12;
16269
+ var TONAL_RAMP_LIGHTNESS_MAX = 92;
16270
+ var toneOfHue = function toneOfHue(color, targetLightness) {
16271
+ var baseLightness = color.get('lab.l');
16272
+ if (Math.abs(targetLightness - baseLightness) < 1e-9) return color.hex();
16273
+ if (targetLightness < baseLightness) {
16274
+ var _ratio = baseLightness <= 0 ? 1 : 1 - targetLightness / baseLightness;
16275
+ return chroma.mix(color, 'black', _ratio, 'lab').hex();
16276
+ }
16277
+ var ratio = baseLightness >= 100 ? 1 : (targetLightness - baseLightness) / (100 - baseLightness);
16278
+ return chroma.mix(color, 'white', ratio, 'lab').hex();
16279
+ };
16280
+ var getTonalShadeScale = function getTonalShadeScale(base, count) {
16281
+ if (!base) return [];
16282
+ var color;
16283
+ try {
16284
+ color = chroma(base);
16285
+ } catch (_unused) {
16286
+ return [];
16287
+ }
16288
+ if (count <= 1) return [color.hex()];
16289
+ var span = TONAL_RAMP_LIGHTNESS_MAX - TONAL_RAMP_LIGHTNESS_MIN;
16290
+ var step = Math.min(TONAL_RAMP_LIGHTNESS_STEP, span / (count - 1));
16291
+ var center = (TONAL_RAMP_LIGHTNESS_MIN + TONAL_RAMP_LIGHTNESS_MAX) / 2;
16292
+ var start = center - step * (count - 1) / 2;
16293
+ var end = start + step * (count - 1);
16294
+ var domainStops = [toneOfHue(color, start), toneOfHue(color, center), toneOfHue(color, end)];
16295
+ return chroma.scale(domainStops).mode('lab').colors(count);
16296
+ };
16297
+ var setOpacity = function setOpacity(color, opacity) {
16298
+ return chroma(color).alpha(opacity);
16299
+ };
16300
+ var highestContrast = function highestContrast(baseColor, colorOptions) {
16301
+ return _.maxBy(colorOptions, function (potentialTextColour) {
16302
+ return chroma.contrast(potentialTextColour, baseColor);
16303
+ }) || baseColor;
16304
+ };
16305
+
16306
+ // Typically anything over 4.5 is high enough contrast.
16307
+ var pickBestTextColor = function pickBestTextColor(backgroundColour, possibleTextColours) {
16308
+ return highestContrast(backgroundColour, possibleTextColours);
16309
+ };
16310
+
16311
+ // ------------------------------------------------------------------------------------
16312
+ // ------------------------------------------------------------------------------------
16313
+ // ------------------------------------------------------------------------------------
16314
+ // ------------------------------------------------------------------------------------
16315
+ // https://stackoverflow.com/questions/16801687/javascript-random-ordering-with-seed
16316
+
16317
+ var random = function random(seed) {
16318
+ var x = Math.sin(seed++) * 10000;
16319
+ return x - Math.floor(x);
16320
+ };
16321
+ var DEFAULT_RANDOM_SEED = 5;
16322
+ var shuffle = function shuffle(array, seed) {
16323
+ if (seed === void 0) {
16324
+ seed = DEFAULT_RANDOM_SEED;
16325
+ }
16326
+ var m = array.length,
16327
+ t,
16328
+ i;
16329
+
16330
+ // While there remain elements to shuffle…
16331
+ while (m) {
16332
+ // Pick a remaining element…
16333
+ i = Math.floor(random(seed) * m--);
16334
+
16335
+ // And swap it with the current element.
16336
+ t = array[m];
16337
+ array[m] = array[i];
16338
+ array[i] = t;
16339
+ ++seed;
16340
+ }
16341
+ return array;
16342
+ };
16343
+ var DEFAULT_CHART_FONT_SIZES = {
16344
+ title: 16,
16345
+ axisTitles: 11,
16346
+ tableText: 12.932,
16347
+ subject: 12,
16348
+ labels: 9,
16349
+ legend: 12,
16350
+ dataLabels: 10
16351
+ };
16352
+
16353
+ // ------------------------------------------------------------------------------------
16354
+ // ------------------------------------------------------------------------------------
16355
+ // ------------------------------------------------------------------------------------
16356
+ // ------------------------------------------------------------------------------------
16357
+
16358
+ var init$9 = function init(displayTitle) {
16359
+ return {
16360
+ displayTitle: displayTitle,
16361
+ colSpan: 12
16362
+ };
16363
+ };
16364
+ var isComponent = function isComponent(component) {
16365
+ return 'displayTitle' in component;
16366
+ };
16367
+ var HEADER_ROW_HEIGHT$1 = 52;
16368
+ var add = function add(display, rowIndex, initialTitle) {
16369
+ var updatedDisplay = [].concat(display);
16370
+ var newHeader = init$9(initialTitle);
16371
+ var newRow = initRow([newHeader], HEADER_ROW_HEIGHT$1);
16372
+ updatedDisplay.splice(rowIndex, 0, newRow);
16373
+ return updatedDisplay;
16374
+ };
16375
+
16376
+ var ALL_COMPONENT_TYPES = ['barChart', 'barChartV2', 'horizontalBarChart', 'horizontalBarChartV2', 'funnelChart', 'areaChart', 'areaChartV2', 'lineChart', 'lineChartV2', 'comboChartV2', 'scatterChart', 'scatterChartV2', 'bubbleChart', 'bubbleChartV2', 'pieChart', 'sunburstChart', 'singleStat', 'dataTable', 'basicTable', 'comboChart', 'mercatorMap', 'progress', 'richText', 'custom', 'waterfallChart', 'horizontalWaterfallChart', 'radarChart', 'curveViewerChart'];
16377
+ var ALL_VIZZLY_COMPONENT_TYPES = /*#__PURE__*/[].concat(ALL_COMPONENT_TYPES).filter(function (type) {
16378
+ return type != 'custom';
16379
+ });
16380
+
16381
+ var POPULATE_ONE_CELL = 1;
16382
+ var initial = function initial(attributes) {
16383
+ return {
16384
+ attributes: attributes,
16385
+ localFilters: [],
16386
+ colSpan: POPULATE_ONE_CELL,
16387
+ reports: []
16388
+ };
16389
+ };
16390
+ var isEmpty = function isEmpty(component) {
16391
+ return 'isEmpty' in component;
16392
+ };
16393
+ var removeField$3 = function removeField(component, fieldId) {
16394
+ var newComponent = _.cloneDeep(component);
16395
+ newComponent.attributes = getComponentInterface(component.attributes.type).removeField(component.attributes, fieldId);
16396
+ return newComponent;
16397
+ };
16398
+
16399
+ var load$1 = function load$1(dumped, componentInterfaceConfig) {
16400
+ if ('isEmpty' in dumped || isComponent(dumped)) return dumped;
16401
+ var _getComponentInterfac = getComponentInterface(dumped.attributes.type, componentInterfaceConfig),
16402
+ load$1 = _getComponentInterfac.load;
16403
+ var attributes = load$1(dumped.attributes);
16404
+ var localFilters = [];
16405
+ if (_.isArray(dumped.localFilters)) {
16406
+ localFilters = [].concat(dumped.localFilters ? dumped.localFilters : []).map(function (localFilter) {
16407
+ return load(localFilter);
16408
+ });
16409
+ }
16410
+ if ('addOns' in dumped.attributes && _.isEmpty(localFilters)) {
16411
+ dumped.attributes.addOns.forEach(function (addOn) {
16412
+ localFilters = [].concat(localFilters, [{
16413
+ type: addOn.type == 'dateFilter' ? 'dateFilter' : 'singleSelectFilter',
16414
+ value: null,
16415
+ requiresValue: false,
16416
+ managedByConfiguration: false,
16417
+ appliesToFields: [{
16418
+ fieldId: addOn.field,
16419
+ dataSetId: attributes.dataSetId
16420
+ }]
16421
+ }]);
16422
+ });
16423
+ }
16424
+
16425
+ // @ts-ignore
16426
+ delete dumped['addOns'];
16427
+ // @ts-ignore
16428
+ delete attributes['addOns'];
16429
+
16430
+ // @ts-ignore
16431
+ delete attributes['results'];
16432
+ return _extends({}, dumped, {
16433
+ localFilters: localFilters,
16434
+ attributes: attributes
16435
+ });
16436
+ };
16437
+ var dump$1 = function dump$1(hydrated) {
16438
+ if (isComponentEmpty(hydrated) || isComponent(hydrated)) return hydrated;
16439
+ var localFilters = [].concat(hydrated.localFilters && _.isArray(hydrated.localFilters) ? hydrated.localFilters : []).map(dump);
16440
+ return _extends({}, hydrated, {
16441
+ results: undefined,
16442
+ queries: undefined,
16443
+ attributes: _extends({}, hydrated.attributes, {
16444
+ offset: undefined
16445
+ }),
16446
+ localFilters: localFilters
16447
+ });
16448
+ };
16449
+
16450
+ var saveable = function saveable(component, protectedComponent) {
16451
+ var _component$localFilte;
16452
+ if (!component.attributes) {
16453
+ throw new Error('Component attributes are required in saveable');
16454
+ }
16455
+ return {
16456
+ attributes: _extends({}, component.attributes, {
16457
+ protectedByOrganisation: protectedComponent ? true : undefined
16458
+ }),
16459
+ localFilters: (_component$localFilte = component.localFilters) != null ? _component$localFilte : [],
16460
+ colSpan: 1,
16461
+ reports: []
16462
+ };
16463
+ };
16464
+
16465
+ var attributesSchema$r = function attributesSchema(config) {
16466
+ return Joi.alternatives().conditional('.type', {
16467
+ is: 'barChart',
16468
+ then: BarChart(config).schema
16469
+ }).conditional('.type', {
16470
+ is: 'richText',
16471
+ then: RichText(config).schema
16472
+ }).conditional('.type', {
16473
+ is: 'mercatorMap',
16474
+ then: MercatorMap(config).schema
16475
+ }).conditional('.type', {
16476
+ is: 'horizontalBarChart',
16477
+ then: HorizontalBarChart(config).schema
16478
+ }).conditional('.type', {
16479
+ is: 'lineChart',
16480
+ then: LineChart(config).schema
16481
+ }).conditional('.type', {
16482
+ is: 'lineChartV2',
16483
+ then: LineChart$1(config).schema
16484
+ }).conditional('.type', {
16485
+ is: 'barChartV2',
16486
+ then: BarChart$1(config).schema
16487
+ }).conditional('.type', {
16488
+ is: 'areaChartV2',
16489
+ then: AreaChart$1(config).schema
16490
+ }).conditional('.type', {
16491
+ is: 'comboChartV2',
16492
+ then: ComboChartV2(config).schema
16493
+ }).conditional('.type', {
16494
+ is: 'comboChart',
16495
+ then: ComboChart(config).schema
16496
+ }).conditional('.type', {
16497
+ is: 'areaChart',
16498
+ then: AreaChart(config).schema
16499
+ }).conditional('.type', {
16500
+ is: 'pieChart',
16501
+ then: PieChart(config).schema
16502
+ }).conditional('.type', {
16503
+ is: 'bubbleChart',
16504
+ then: BubbleChart(config).schema
16505
+ }).conditional('.type', {
16506
+ is: 'bubbleChartV2',
16507
+ then: BubbleChartV2(config).schema
16508
+ }).conditional('.type', {
16509
+ is: 'scatterChartV2',
16510
+ then: ScatterChartV2(config).schema
16511
+ }).conditional('.type', {
16512
+ is: 'sunburstChart',
16513
+ then: SunburstChart(config).schema
16514
+ }).conditional('.type', {
16515
+ is: 'scatterChart',
16516
+ then: ScatterChart(config).schema
16517
+ }).conditional('.type', {
16518
+ is: 'singleStat',
16519
+ then: SingleStat(config).schema
16520
+ }).conditional('.type', {
16521
+ is: 'dataTable',
16522
+ then: DataTable(config).schema
16523
+ }).conditional('.type', {
16524
+ is: 'basicTable',
16525
+ then: BasicTable(config).schema
16526
+ }).conditional('.type', {
16527
+ is: 'progress',
16528
+ then: Progress(config).schema
16529
+ }).conditional('.type', {
16530
+ is: 'custom',
16531
+ then: CustomChart(config).schema
16532
+ }).conditional('.type', {
16533
+ is: 'funnelChart',
16534
+ then: FunnelChart(config).schema
16535
+ }).conditional('.type', {
16536
+ is: 'waterfallChart',
16537
+ then: WaterfallChart(config).schema
16538
+ }).conditional('.type', {
16539
+ is: 'radarChart',
16540
+ then: RadarChart(config).schema
16541
+ }).conditional('.type', {
16542
+ is: 'curveViewerChart',
16543
+ then: CurveViewerChart(config).schema
16544
+ }).conditional('.type', {
16545
+ is: 'horizontalBarChartV2',
16546
+ then: HorizontalBarChart$1(config).schema
16547
+ }).conditional('.type', {
16548
+ is: 'horizontalWaterfallChart',
16549
+ then: HorizontalWaterfallChart(config).schema
16550
+ });
16551
+ };
16552
+
16553
+ var removeFieldReferences = function removeFieldReferences(display, fieldId) {
16554
+ var newDisplay = _.cloneDeep(display);
16555
+ newDisplay.map(function (row) {
16556
+ var rowComponents = row.components.map(function (cell) {
16557
+ if (isEmpty(cell) || isComponent(cell)) {
16558
+ return cell;
16559
+ } else {
16560
+ cell.attributes = getComponentInterface(cell.attributes.type).removeField(cell.attributes, fieldId);
16561
+ return cell;
16562
+ }
16563
+ });
16564
+ return _extends({}, row, {
16565
+ components: rowComponents
16566
+ });
16567
+ });
16568
+ return newDisplay;
16569
+ };
16570
+ var removeAllFieldReferences = function removeAllFieldReferences(display, fieldsToRemove) {
16571
+ var newDisplay = _.reduce(fieldsToRemove, function (display, fieldToRemove) {
16572
+ return removeFieldReferences(display, fieldToRemove.id);
16573
+ }, display);
16574
+ return newDisplay;
16575
+ };
16576
+
16577
+ var allComponentsInDirection = function allComponentsInDirection(display, rowIndex, cellIndex, direction) {
16578
+ var row = display[rowIndex];
16579
+ if (direction == 'left') {
16580
+ return [].concat(row.components).slice(0, cellIndex).reverse();
16581
+ } else {
16582
+ return [].concat(row.components).slice(cellIndex + 1, row.components.length);
16583
+ }
16584
+ };
16585
+ var getNextComponentIndexWithSpace = function getNextComponentIndexWithSpace(display, rowIndex, cellIndex, direction) {
16586
+ var componentsToCheck = allComponentsInDirection(display, rowIndex, cellIndex, direction);
16587
+ var componentsToCheckLastIndex = componentsToCheck.length - 1;
16588
+ var indexFromCell = componentsToCheck.findIndex(function (component) {
16589
+ return component.colSpan > 2;
16590
+ });
16591
+ if (indexFromCell == -1) return -1;
16592
+ return direction == 'left' ? componentsToCheckLastIndex - indexFromCell : indexFromCell + 1 + cellIndex;
16593
+ };
16594
+ var insertRow = function insertRow(display, rowIndex, height) {
16595
+ if (height === void 0) {
16596
+ height = DEFAULT_ROW_HEIGHT;
16597
+ }
16598
+ var newDisplay = [].concat(display);
16599
+ newDisplay.splice(rowIndex, 0, {
16600
+ components: [{
16601
+ isEmpty: true,
16602
+ colSpan: 12
16603
+ }],
16604
+ height: height
16605
+ });
16606
+ return newDisplay;
16607
+ };
16608
+ var newEmptyCell = function newEmptyCell(colSpan) {
16609
+ return {
16610
+ colSpan: colSpan,
16611
+ isEmpty: true
16612
+ };
16613
+ };
16614
+ var TOTAL_COLSPAN = 12;
16615
+ var SPAN_BREAK_POINT = 5;
16616
+
16617
+ /** ColSpan per cell when a row has `componentCount` cells (matches appendEmptyCell discretization). */
16618
+ function getDiscretizedColSpanForComponentCount(componentCount) {
16619
+ if (componentCount === 1) return TOTAL_COLSPAN;
16620
+ if (componentCount < SPAN_BREAK_POINT) return TOTAL_COLSPAN / componentCount;
16621
+ return 2;
16622
+ }
16623
+ function getColSpan(currentSpans) {
16624
+ return getDiscretizedColSpanForComponentCount(currentSpans);
16625
+ }
16626
+ var getIndexToCheck = function getIndexToCheck(panelLength) {
16627
+ if (panelLength > 2 && panelLength < SPAN_BREAK_POINT) return 3;
16628
+ return 2;
16629
+ };
16630
+
16631
+ /*
16632
+ Create space for a new cell to be appended to the row.
16633
+ */
16634
+ var appendEmptyCell = function appendEmptyCell(currentPanels, rowIndex) {
16635
+ var updatedRow = _.cloneDeep(currentPanels);
16636
+ var updatedPanels = [].concat(updatedRow[rowIndex].components);
16637
+ var emptyCell = newEmptyCell(getColSpan(updatedPanels.length + 1));
16638
+ updatedPanels = [].concat(updatedPanels, [emptyCell]);
16639
+ var lastCellIndex = updatedPanels.length - 1;
16640
+ for (var index = 0; index < getIndexToCheck(updatedPanels.length); index++) {
16641
+ var indexOfComponentToDecrease = getNextComponentIndexWithSpace(updatedRow, rowIndex, lastCellIndex, 'left');
16642
+ if (updatedPanels.length < SPAN_BREAK_POINT) {
16643
+ updatedPanels[index].colSpan = getColSpan(updatedPanels.length);
16644
+ } else {
16645
+ updatedPanels[indexOfComponentToDecrease].colSpan = updatedPanels[indexOfComponentToDecrease].colSpan - 1;
16646
+ }
16647
+ updatedRow[rowIndex] = {
16648
+ components: [].concat(updatedPanels),
16649
+ height: updatedRow[rowIndex].height
16650
+ };
16651
+ }
16652
+ return updatedRow;
16653
+ };
16654
+ var setComponent = function setComponent(display, component, rowIndex, cellIndex) {
16655
+ var newDisplay = [].concat(display);
16656
+ var newDisplayRowComponents = [].concat(newDisplay[rowIndex].components);
16657
+ var currentColSpan = newDisplayRowComponents[cellIndex].colSpan;
16658
+ newDisplayRowComponents[cellIndex] = _extends({}, component, {
16659
+ colSpan: currentColSpan
16660
+ });
16661
+ newDisplay[rowIndex] = {
16662
+ components: newDisplayRowComponents,
16663
+ height: newDisplay[rowIndex].height
16664
+ };
16665
+ return newDisplay;
16666
+ };
16667
+ var swapComponents = function swapComponents(display, positionA, positionB) {
16668
+ var componentA = _extends({}, display[positionA.rowIndex].components[positionA.cellIndex]);
16669
+ var componentB = _extends({}, display[positionB.rowIndex].components[positionB.cellIndex]);
16670
+ display = setComponent(display, componentA, positionB.rowIndex, positionB.cellIndex);
16671
+ display = setComponent(display, componentB, positionA.rowIndex, positionA.cellIndex);
16672
+ return display;
16673
+ };
16674
+ var initRow = function initRow(components, height) {
16675
+ return {
16676
+ components: components,
16677
+ height: height != null ? height : DEFAULT_ROW_HEIGHT
16678
+ };
16679
+ };
16680
+ var isComponentEmpty = function isComponentEmpty(component) {
16681
+ return 'isEmpty' in component;
16682
+ };
16683
+ function isDisplayComponentsEmpty(display) {
16684
+ for (var _iterator = _createForOfIteratorHelperLoose(display), _step; !(_step = _iterator()).done;) {
16685
+ var item = _step.value;
16686
+ for (var _iterator2 = _createForOfIteratorHelperLoose(item.components), _step2; !(_step2 = _iterator2()).done;) {
16687
+ var component = _step2.value;
16688
+ if (!('isEmpty' in component) || component.isEmpty !== true) {
16689
+ return false;
16690
+ }
16691
+ }
16692
+ }
16693
+ return true;
16694
+ }
16695
+ var moveDisplayToNewIndex = function moveDisplayToNewIndex(display, movingIndex, destinationIndex) {
16696
+ if (movingIndex === destinationIndex || movingIndex < 0 || destinationIndex < 0 || movingIndex >= display.length || destinationIndex >= display.length) {
16697
+ return [].concat(display);
16698
+ }
16699
+ var newDisplay = [].concat(display);
16700
+ var movingRow = newDisplay.splice(movingIndex, 1)[0];
16701
+ newDisplay.splice(destinationIndex, 0, movingRow);
16702
+ return newDisplay;
16703
+ };
16704
+ var countNonHeaderRows = function countNonHeaderRows(display) {
16705
+ var activeRows = 0;
16706
+ display.forEach(function (row) {
16707
+ var firstCell = row.components[0];
16708
+ if (firstCell && !isComponent(firstCell)) {
16709
+ activeRows = activeRows + 1;
16710
+ }
16711
+ });
16712
+ return activeRows;
16713
+ };
16714
+
16715
+ /**
16716
+ * Returns only display rows/cells whose view matches `viewId`.
16717
+ * When a row contains multiple views, only the matching cell is kept (colSpan 12).
16718
+ */
16719
+ var filterDisplayByViewId = function filterDisplayByViewId(display, viewId, options) {
16720
+ return display.map(function (row) {
16721
+ var matchingComponents = row.components.filter(function (component) {
16722
+ if (isComponentEmpty(component) || isComponent(component)) {
16723
+ return false;
16724
+ }
16725
+ return component.attributes.viewId === viewId;
16726
+ });
16727
+ if (matchingComponents.length === 0) {
16728
+ return null;
16729
+ }
16730
+ var components = matchingComponents.map(function (component) {
16731
+ var withColSpan = matchingComponents.length === 1 ? _extends({}, component, {
16732
+ colSpan: TOTAL_COLSPAN
16733
+ }) : component;
16734
+ if (!isComponentEmpty(withColSpan) && !isComponent(withColSpan) && ((options == null ? void 0 : options.globalFilters) !== undefined || (options == null ? void 0 : options.localFiltersOverride) !== undefined)) {
16735
+ var _options$globalFilter;
16736
+ return applySingleViewFiltersToComponent(withColSpan, {
16737
+ globalFilters: (_options$globalFilter = options == null ? void 0 : options.globalFilters) != null ? _options$globalFilter : [],
16738
+ localFiltersOverride: options == null ? void 0 : options.localFiltersOverride
16739
+ });
16740
+ }
16741
+ return withColSpan;
16742
+ });
16743
+ return _extends({}, row, {
16744
+ components: components
16745
+ });
16746
+ }).filter(function (row) {
16747
+ return row !== null;
16748
+ });
16749
+ };
16750
+ var findCellByViewId = function findCellByViewId(display, viewId) {
16751
+ for (var rowIndex = 0; rowIndex < display.length; rowIndex++) {
16752
+ for (var cellIndex = 0; cellIndex < display[rowIndex].components.length; cellIndex++) {
16753
+ var component = display[rowIndex].components[cellIndex];
16754
+ if (isComponentEmpty(component) || isComponent(component)) {
16755
+ continue;
16756
+ }
16757
+ if (component.attributes.viewId === viewId) {
16758
+ return {
16759
+ rowIndex: rowIndex,
16760
+ cellIndex: cellIndex,
16761
+ component: component
16762
+ };
16763
+ }
16764
+ }
16765
+ }
16766
+ return null;
16767
+ };
16768
+ var resolveDisplayCellIndices = function resolveDisplayCellIndices(display, rowIndex, cellIndex, cell, isSingleViewFiltered) {
16769
+ // The viewId-based lookup only makes sense when `display` here is a
16770
+ // filtered subset (single-view embed) and `rowIndex`/`cellIndex` are
16771
+ // positions within that subset rather than the source dashboard. In the
16772
+ // normal, unfiltered editor render loop those indices already ARE the
16773
+ // source indices, and matching by `viewId` can incorrectly collapse
16774
+ // multiple cells that happen to share the same viewId onto one index.
16775
+ if (isSingleViewFiltered && !isComponentEmpty(cell) && !isComponent(cell) && cell.attributes.viewId) {
16776
+ var match = findCellByViewId(display, cell.attributes.viewId);
16777
+ if (match) {
16778
+ return {
16779
+ rowIndex: match.rowIndex,
16780
+ cellIndex: match.cellIndex
16781
+ };
16782
+ }
16783
+ }
16784
+ return {
16785
+ rowIndex: rowIndex,
16786
+ cellIndex: cellIndex
16787
+ };
16788
+ };
16789
+
16790
+ var ensureTwelve = function ensureTwelve(row) {
16791
+ var newRow = [].concat(row);
16792
+ var total = _.sumBy(newRow, function (cell) {
16793
+ return cell.colSpan;
16794
+ });
16795
+ if (total == 12) return newRow;
16796
+ newRow[newRow.length - 1].colSpan += 12 - total;
16797
+ return newRow;
16798
+ };
16799
+ var upcastRowToIncludeHeight = function upcastRowToIncludeHeight(displayRow) {
16800
+ if ('components' in displayRow) {
16801
+ return displayRow;
16802
+ }
16803
+ return {
16804
+ components: displayRow,
16805
+ height: DEFAULT_ROW_HEIGHT
16806
+ };
16807
+ };
16808
+ var filterInvalidEmptyCells = function filterInvalidEmptyCells(cell) {
16809
+ if (cell && isComponentEmpty(cell) && cell.colSpan <= 0) {
16810
+ return false;
16811
+ }
16812
+ return true;
16813
+ };
16814
+ var upcastRow = function upcastRow(displayRow, componentInterfaceConfig) {
16815
+ var displayRowWithComponentsKey = upcastRowToIncludeHeight(displayRow);
16816
+ var allValidComponentsHaveColSpan = function allValidComponentsHaveColSpan(component) {
16817
+ if (component && component.colSpan <= 0) {
16818
+ return _extends({}, component, {
16819
+ colSpan: 1
16820
+ });
16821
+ }
16822
+ return component;
16823
+ };
16824
+ var filteredComponents = displayRowWithComponentsKey.components.filter(filterInvalidEmptyCells).map(allValidComponentsHaveColSpan);
16825
+ var nullCounts = _.sumBy(filteredComponents, function (cell) {
16826
+ return cell == null ? 1 : 0;
16827
+ });
16828
+ var filledCounts = _.sumBy(filteredComponents, function (cell) {
16829
+ return cell == null ? 0 : cell.colSpan;
16830
+ });
16831
+ var emptySpaceToFill = 12 - filledCounts;
16832
+ var fallbackColSpan = Math.floor(emptySpaceToFill / nullCounts);
16833
+ var upcastedComponents = [].concat(filteredComponents).map(function (rawComponent) {
16834
+ if (rawComponent === null) {
16835
+ return {
16836
+ isEmpty: true,
16837
+ colSpan: fallbackColSpan
16838
+ };
16839
+ }
16840
+ if (isComponentEmpty(rawComponent) || isComponent(rawComponent)) return rawComponent;
16841
+ return load$1(_extends({}, rawComponent, {
16842
+ colSpan: rawComponent.colSpan
16843
+ }), componentInterfaceConfig);
16844
+ });
16845
+ return {
16846
+ components: ensureTwelve(upcastedComponents),
16847
+ height: displayRowWithComponentsKey.height || DEFAULT_ROW_HEIGHT
16848
+ };
16849
+ };
16850
+
16851
+ var load$2 = function load(dumped, componentInterfaceConfig) {
16852
+ return dumped.map(function (row) {
16853
+ return upcastRow(row, componentInterfaceConfig);
16854
+ });
16855
+ };
16856
+ var dump$2 = function dump(hydrated) {
16857
+ return hydrated.map(function (row) {
16858
+ var saveableComponents = [].concat(row.components).map(dump$1);
16859
+ return {
16860
+ components: saveableComponents,
16861
+ height: row.height
16862
+ };
16863
+ });
16864
+ };
16865
+
16225
16866
  var SavingState = /*#__PURE__*/function (SavingState) {
16226
16867
  SavingState["InProgress"] = "InProgress";
16227
16868
  SavingState["Saved"] = "Saved";
@@ -16296,11 +16937,17 @@ var VizzlyStateManager = /*#__PURE__*/function () {
16296
16937
  });
16297
16938
  });
16298
16939
  };
16299
- _proto.setDashboard = function setDashboard(identifier, dashboard) {
16940
+ _proto.setDashboard = function setDashboard(identifier, dashboard, queryEngineConfig) {
16300
16941
  if (!this.subscribers[identifier]) return;
16942
+ var config = {
16943
+ queryEngineConfig: queryEngineConfig != null ? queryEngineConfig : getQueryEngineConfig('snowflake')
16944
+ };
16945
+ var hydratedDisplay = dashboard != null && dashboard.display ? load$2(dashboard.display, config) : undefined;
16301
16946
  this.subscribers[identifier].forEach(function (listener) {
16302
16947
  return listener({
16303
- dashboard: dashboard
16948
+ dashboard: _extends({}, dashboard, {
16949
+ display: hydratedDisplay
16950
+ })
16304
16951
  });
16305
16952
  });
16306
16953
  };
@@ -16861,7 +17508,7 @@ var isLoading = function isLoading(result) {
16861
17508
  var hasFailed = function hasFailed(result) {
16862
17509
  return result === null;
16863
17510
  };
16864
- var isEmpty = function isEmpty(result) {
17511
+ var isEmpty$1 = function isEmpty(result) {
16865
17512
  if (isLoading(result)) return true;
16866
17513
  if (hasFailed(result)) return true;
16867
17514
  return _.isEmpty(result.content);
@@ -17231,7 +17878,7 @@ function linearForecast(data, forecastUnits, key, timeUnit, includeForecast // N
17231
17878
  return trendlineWithForecast;
17232
17879
  }
17233
17880
 
17234
- var init$9 = function init(_ref) {
17881
+ var init$a = function init(_ref) {
17235
17882
  var pivotConfig = _ref.pivotConfig,
17236
17883
  measures = _ref.measures,
17237
17884
  resultSet = _ref.resultSet,
@@ -18073,134 +18720,6 @@ var TableLibraryWrapper = function TableLibraryWrapper(props) {
18073
18720
  });
18074
18721
  };
18075
18722
 
18076
- var DEFAULT_ROW_HEIGHT = 350;
18077
- var HEADER_ROW_HEIGHT = 52;
18078
- var linearScale = function linearScale(colors, colorCount) {
18079
- return chroma.scale(colors).colors(colorCount);
18080
- };
18081
- var themeToColorScale = function themeToColorScale(colors, colorCount) {
18082
- var _colors$length;
18083
- if ((colorCount != null ? colorCount : 0) <= ((_colors$length = colors == null ? void 0 : colors.length) != null ? _colors$length : 0)) {
18084
- return colors;
18085
- }
18086
- return shuffle(linearScale(colors, colorCount));
18087
- };
18088
- var vizzlyDefaultTheme = {
18089
- colors: ['#feae4a', '#5fbaff', '#e15e9d'],
18090
- detail: 'minimal',
18091
- fontFamily: 'Inter, sans-serif',
18092
- rowLimit: 6,
18093
- fontSize: '0.65rem'
18094
- };
18095
- var darkerColor = function darkerColor(color, darkenBy, opacity) {
18096
- var newColor = chroma(color).darken(darkenBy);
18097
- if (opacity) newColor = setOpacity(newColor, opacity);
18098
- return newColor.hex();
18099
- };
18100
- var darkenListOfColors = function darkenListOfColors(colors, darkenBy) {
18101
- if (darkenBy === void 0) {
18102
- darkenBy = 1;
18103
- }
18104
- return [].concat(colors).map(function (color) {
18105
- return darkerColor(color, darkenBy);
18106
- });
18107
- };
18108
- var lighterColor = function lighterColor(color, brightenBy, opacity) {
18109
- var newColor = chroma(color).brighten(brightenBy);
18110
- if (opacity) newColor = setOpacity(newColor, opacity);
18111
- return newColor.hex();
18112
- };
18113
- var TONAL_RAMP_LIGHTNESS_STEP = 40;
18114
- var TONAL_RAMP_LIGHTNESS_MIN = 12;
18115
- var TONAL_RAMP_LIGHTNESS_MAX = 92;
18116
- var toneOfHue = function toneOfHue(color, targetLightness) {
18117
- var baseLightness = color.get('lab.l');
18118
- if (Math.abs(targetLightness - baseLightness) < 1e-9) return color.hex();
18119
- if (targetLightness < baseLightness) {
18120
- var _ratio = baseLightness <= 0 ? 1 : 1 - targetLightness / baseLightness;
18121
- return chroma.mix(color, 'black', _ratio, 'lab').hex();
18122
- }
18123
- var ratio = baseLightness >= 100 ? 1 : (targetLightness - baseLightness) / (100 - baseLightness);
18124
- return chroma.mix(color, 'white', ratio, 'lab').hex();
18125
- };
18126
- var getTonalShadeScale = function getTonalShadeScale(base, count) {
18127
- if (!base) return [];
18128
- var color;
18129
- try {
18130
- color = chroma(base);
18131
- } catch (_unused) {
18132
- return [];
18133
- }
18134
- if (count <= 1) return [color.hex()];
18135
- var span = TONAL_RAMP_LIGHTNESS_MAX - TONAL_RAMP_LIGHTNESS_MIN;
18136
- var step = Math.min(TONAL_RAMP_LIGHTNESS_STEP, span / (count - 1));
18137
- var center = (TONAL_RAMP_LIGHTNESS_MIN + TONAL_RAMP_LIGHTNESS_MAX) / 2;
18138
- var start = center - step * (count - 1) / 2;
18139
- var end = start + step * (count - 1);
18140
- var domainStops = [toneOfHue(color, start), toneOfHue(color, center), toneOfHue(color, end)];
18141
- return chroma.scale(domainStops).mode('lab').colors(count);
18142
- };
18143
- var setOpacity = function setOpacity(color, opacity) {
18144
- return chroma(color).alpha(opacity);
18145
- };
18146
- var highestContrast = function highestContrast(baseColor, colorOptions) {
18147
- return _.maxBy(colorOptions, function (potentialTextColour) {
18148
- return chroma.contrast(potentialTextColour, baseColor);
18149
- }) || baseColor;
18150
- };
18151
-
18152
- // Typically anything over 4.5 is high enough contrast.
18153
- var pickBestTextColor = function pickBestTextColor(backgroundColour, possibleTextColours) {
18154
- return highestContrast(backgroundColour, possibleTextColours);
18155
- };
18156
-
18157
- // ------------------------------------------------------------------------------------
18158
- // ------------------------------------------------------------------------------------
18159
- // ------------------------------------------------------------------------------------
18160
- // ------------------------------------------------------------------------------------
18161
- // https://stackoverflow.com/questions/16801687/javascript-random-ordering-with-seed
18162
-
18163
- var random = function random(seed) {
18164
- var x = Math.sin(seed++) * 10000;
18165
- return x - Math.floor(x);
18166
- };
18167
- var DEFAULT_RANDOM_SEED = 5;
18168
- var shuffle = function shuffle(array, seed) {
18169
- if (seed === void 0) {
18170
- seed = DEFAULT_RANDOM_SEED;
18171
- }
18172
- var m = array.length,
18173
- t,
18174
- i;
18175
-
18176
- // While there remain elements to shuffle…
18177
- while (m) {
18178
- // Pick a remaining element…
18179
- i = Math.floor(random(seed) * m--);
18180
-
18181
- // And swap it with the current element.
18182
- t = array[m];
18183
- array[m] = array[i];
18184
- array[i] = t;
18185
- ++seed;
18186
- }
18187
- return array;
18188
- };
18189
- var DEFAULT_CHART_FONT_SIZES = {
18190
- title: 16,
18191
- axisTitles: 11,
18192
- tableText: 12.932,
18193
- subject: 12,
18194
- labels: 9,
18195
- legend: 12,
18196
- dataLabels: 10
18197
- };
18198
-
18199
- // ------------------------------------------------------------------------------------
18200
- // ------------------------------------------------------------------------------------
18201
- // ------------------------------------------------------------------------------------
18202
- // ------------------------------------------------------------------------------------
18203
-
18204
18723
  var _excluded$1 = ["fill", "width", "height"],
18205
18724
  _excluded2 = ["fill", "width", "height"],
18206
18725
  _excluded3 = ["fill", "gradient"],
@@ -19240,514 +19759,6 @@ var buildDefaults = function buildDefaults(partialFeatureToggles) {
19240
19759
  };
19241
19760
  };
19242
19761
 
19243
- var ALL_COMPONENT_TYPES = ['barChart', 'barChartV2', 'horizontalBarChart', 'horizontalBarChartV2', 'funnelChart', 'areaChart', 'areaChartV2', 'lineChart', 'lineChartV2', 'comboChartV2', 'scatterChart', 'scatterChartV2', 'bubbleChart', 'bubbleChartV2', 'pieChart', 'sunburstChart', 'singleStat', 'dataTable', 'basicTable', 'comboChart', 'mercatorMap', 'progress', 'richText', 'custom', 'waterfallChart', 'horizontalWaterfallChart', 'radarChart', 'curveViewerChart'];
19244
- var ALL_VIZZLY_COMPONENT_TYPES = /*#__PURE__*/[].concat(ALL_COMPONENT_TYPES).filter(function (type) {
19245
- return type != 'custom';
19246
- });
19247
-
19248
- var POPULATE_ONE_CELL = 1;
19249
- var initial = function initial(attributes) {
19250
- return {
19251
- attributes: attributes,
19252
- localFilters: [],
19253
- colSpan: POPULATE_ONE_CELL,
19254
- reports: []
19255
- };
19256
- };
19257
- var isEmpty$1 = function isEmpty(component) {
19258
- return 'isEmpty' in component;
19259
- };
19260
- var removeField$3 = function removeField(component, fieldId) {
19261
- var newComponent = _.cloneDeep(component);
19262
- newComponent.attributes = getComponentInterface(component.attributes.type).removeField(component.attributes, fieldId);
19263
- return newComponent;
19264
- };
19265
-
19266
- var init$a = function init(displayTitle) {
19267
- return {
19268
- displayTitle: displayTitle,
19269
- colSpan: 12
19270
- };
19271
- };
19272
- var isComponent = function isComponent(component) {
19273
- return 'displayTitle' in component;
19274
- };
19275
- var HEADER_ROW_HEIGHT$1 = 52;
19276
- var add = function add(display, rowIndex, initialTitle) {
19277
- var updatedDisplay = [].concat(display);
19278
- var newHeader = init$a(initialTitle);
19279
- var newRow = initRow([newHeader], HEADER_ROW_HEIGHT$1);
19280
- updatedDisplay.splice(rowIndex, 0, newRow);
19281
- return updatedDisplay;
19282
- };
19283
-
19284
- var removeFieldReferences = function removeFieldReferences(display, fieldId) {
19285
- var newDisplay = _.cloneDeep(display);
19286
- newDisplay.map(function (row) {
19287
- var rowComponents = row.components.map(function (cell) {
19288
- if (isEmpty$1(cell) || isComponent(cell)) {
19289
- return cell;
19290
- } else {
19291
- cell.attributes = getComponentInterface(cell.attributes.type).removeField(cell.attributes, fieldId);
19292
- return cell;
19293
- }
19294
- });
19295
- return _extends({}, row, {
19296
- components: rowComponents
19297
- });
19298
- });
19299
- return newDisplay;
19300
- };
19301
- var removeAllFieldReferences = function removeAllFieldReferences(display, fieldsToRemove) {
19302
- var newDisplay = _.reduce(fieldsToRemove, function (display, fieldToRemove) {
19303
- return removeFieldReferences(display, fieldToRemove.id);
19304
- }, display);
19305
- return newDisplay;
19306
- };
19307
-
19308
- var allComponentsInDirection = function allComponentsInDirection(display, rowIndex, cellIndex, direction) {
19309
- var row = display[rowIndex];
19310
- if (direction == 'left') {
19311
- return [].concat(row.components).slice(0, cellIndex).reverse();
19312
- } else {
19313
- return [].concat(row.components).slice(cellIndex + 1, row.components.length);
19314
- }
19315
- };
19316
- var getNextComponentIndexWithSpace = function getNextComponentIndexWithSpace(display, rowIndex, cellIndex, direction) {
19317
- var componentsToCheck = allComponentsInDirection(display, rowIndex, cellIndex, direction);
19318
- var componentsToCheckLastIndex = componentsToCheck.length - 1;
19319
- var indexFromCell = componentsToCheck.findIndex(function (component) {
19320
- return component.colSpan > 2;
19321
- });
19322
- if (indexFromCell == -1) return -1;
19323
- return direction == 'left' ? componentsToCheckLastIndex - indexFromCell : indexFromCell + 1 + cellIndex;
19324
- };
19325
- var insertRow = function insertRow(display, rowIndex, height) {
19326
- if (height === void 0) {
19327
- height = DEFAULT_ROW_HEIGHT;
19328
- }
19329
- var newDisplay = [].concat(display);
19330
- newDisplay.splice(rowIndex, 0, {
19331
- components: [{
19332
- isEmpty: true,
19333
- colSpan: 12
19334
- }],
19335
- height: height
19336
- });
19337
- return newDisplay;
19338
- };
19339
- var newEmptyCell = function newEmptyCell(colSpan) {
19340
- return {
19341
- colSpan: colSpan,
19342
- isEmpty: true
19343
- };
19344
- };
19345
- var TOTAL_COLSPAN = 12;
19346
- var SPAN_BREAK_POINT = 5;
19347
-
19348
- /** ColSpan per cell when a row has `componentCount` cells (matches appendEmptyCell discretization). */
19349
- function getDiscretizedColSpanForComponentCount(componentCount) {
19350
- if (componentCount === 1) return TOTAL_COLSPAN;
19351
- if (componentCount < SPAN_BREAK_POINT) return TOTAL_COLSPAN / componentCount;
19352
- return 2;
19353
- }
19354
- function getColSpan(currentSpans) {
19355
- return getDiscretizedColSpanForComponentCount(currentSpans);
19356
- }
19357
- var getIndexToCheck = function getIndexToCheck(panelLength) {
19358
- if (panelLength > 2 && panelLength < SPAN_BREAK_POINT) return 3;
19359
- return 2;
19360
- };
19361
-
19362
- /*
19363
- Create space for a new cell to be appended to the row.
19364
- */
19365
- var appendEmptyCell = function appendEmptyCell(currentPanels, rowIndex) {
19366
- var updatedRow = _.cloneDeep(currentPanels);
19367
- var updatedPanels = [].concat(updatedRow[rowIndex].components);
19368
- var emptyCell = newEmptyCell(getColSpan(updatedPanels.length + 1));
19369
- updatedPanels = [].concat(updatedPanels, [emptyCell]);
19370
- var lastCellIndex = updatedPanels.length - 1;
19371
- for (var index = 0; index < getIndexToCheck(updatedPanels.length); index++) {
19372
- var indexOfComponentToDecrease = getNextComponentIndexWithSpace(updatedRow, rowIndex, lastCellIndex, 'left');
19373
- if (updatedPanels.length < SPAN_BREAK_POINT) {
19374
- updatedPanels[index].colSpan = getColSpan(updatedPanels.length);
19375
- } else {
19376
- updatedPanels[indexOfComponentToDecrease].colSpan = updatedPanels[indexOfComponentToDecrease].colSpan - 1;
19377
- }
19378
- updatedRow[rowIndex] = {
19379
- components: [].concat(updatedPanels),
19380
- height: updatedRow[rowIndex].height
19381
- };
19382
- }
19383
- return updatedRow;
19384
- };
19385
- var setComponent = function setComponent(display, component, rowIndex, cellIndex) {
19386
- var newDisplay = [].concat(display);
19387
- var newDisplayRowComponents = [].concat(newDisplay[rowIndex].components);
19388
- var currentColSpan = newDisplayRowComponents[cellIndex].colSpan;
19389
- newDisplayRowComponents[cellIndex] = _extends({}, component, {
19390
- colSpan: currentColSpan
19391
- });
19392
- newDisplay[rowIndex] = {
19393
- components: newDisplayRowComponents,
19394
- height: newDisplay[rowIndex].height
19395
- };
19396
- return newDisplay;
19397
- };
19398
- var swapComponents = function swapComponents(display, positionA, positionB) {
19399
- var componentA = _extends({}, display[positionA.rowIndex].components[positionA.cellIndex]);
19400
- var componentB = _extends({}, display[positionB.rowIndex].components[positionB.cellIndex]);
19401
- display = setComponent(display, componentA, positionB.rowIndex, positionB.cellIndex);
19402
- display = setComponent(display, componentB, positionA.rowIndex, positionA.cellIndex);
19403
- return display;
19404
- };
19405
- var initRow = function initRow(components, height) {
19406
- return {
19407
- components: components,
19408
- height: height != null ? height : DEFAULT_ROW_HEIGHT
19409
- };
19410
- };
19411
- var isComponentEmpty = function isComponentEmpty(component) {
19412
- return 'isEmpty' in component;
19413
- };
19414
- function isDisplayComponentsEmpty(display) {
19415
- for (var _iterator = _createForOfIteratorHelperLoose(display), _step; !(_step = _iterator()).done;) {
19416
- var item = _step.value;
19417
- for (var _iterator2 = _createForOfIteratorHelperLoose(item.components), _step2; !(_step2 = _iterator2()).done;) {
19418
- var component = _step2.value;
19419
- if (!('isEmpty' in component) || component.isEmpty !== true) {
19420
- return false;
19421
- }
19422
- }
19423
- }
19424
- return true;
19425
- }
19426
- var moveDisplayToNewIndex = function moveDisplayToNewIndex(display, movingIndex, destinationIndex) {
19427
- if (movingIndex === destinationIndex || movingIndex < 0 || destinationIndex < 0 || movingIndex >= display.length || destinationIndex >= display.length) {
19428
- return [].concat(display);
19429
- }
19430
- var newDisplay = [].concat(display);
19431
- var movingRow = newDisplay.splice(movingIndex, 1)[0];
19432
- newDisplay.splice(destinationIndex, 0, movingRow);
19433
- return newDisplay;
19434
- };
19435
- var countNonHeaderRows = function countNonHeaderRows(display) {
19436
- var activeRows = 0;
19437
- display.forEach(function (row) {
19438
- var firstCell = row.components[0];
19439
- if (firstCell && !isComponent(firstCell)) {
19440
- activeRows = activeRows + 1;
19441
- }
19442
- });
19443
- return activeRows;
19444
- };
19445
-
19446
- /**
19447
- * Returns only display rows/cells whose view matches `viewId`.
19448
- * When a row contains multiple views, only the matching cell is kept (colSpan 12).
19449
- */
19450
- var filterDisplayByViewId = function filterDisplayByViewId(display, viewId, options) {
19451
- return display.map(function (row) {
19452
- var matchingComponents = row.components.filter(function (component) {
19453
- if (isComponentEmpty(component) || isComponent(component)) {
19454
- return false;
19455
- }
19456
- return component.attributes.viewId === viewId;
19457
- });
19458
- if (matchingComponents.length === 0) {
19459
- return null;
19460
- }
19461
- var components = matchingComponents.map(function (component) {
19462
- var withColSpan = matchingComponents.length === 1 ? _extends({}, component, {
19463
- colSpan: TOTAL_COLSPAN
19464
- }) : component;
19465
- if (!isComponentEmpty(withColSpan) && !isComponent(withColSpan) && ((options == null ? void 0 : options.globalFilters) !== undefined || (options == null ? void 0 : options.localFiltersOverride) !== undefined)) {
19466
- var _options$globalFilter;
19467
- return applySingleViewFiltersToComponent(withColSpan, {
19468
- globalFilters: (_options$globalFilter = options == null ? void 0 : options.globalFilters) != null ? _options$globalFilter : [],
19469
- localFiltersOverride: options == null ? void 0 : options.localFiltersOverride
19470
- });
19471
- }
19472
- return withColSpan;
19473
- });
19474
- return _extends({}, row, {
19475
- components: components
19476
- });
19477
- }).filter(function (row) {
19478
- return row !== null;
19479
- });
19480
- };
19481
- var findCellByViewId = function findCellByViewId(display, viewId) {
19482
- for (var rowIndex = 0; rowIndex < display.length; rowIndex++) {
19483
- for (var cellIndex = 0; cellIndex < display[rowIndex].components.length; cellIndex++) {
19484
- var component = display[rowIndex].components[cellIndex];
19485
- if (isComponentEmpty(component) || isComponent(component)) {
19486
- continue;
19487
- }
19488
- if (component.attributes.viewId === viewId) {
19489
- return {
19490
- rowIndex: rowIndex,
19491
- cellIndex: cellIndex,
19492
- component: component
19493
- };
19494
- }
19495
- }
19496
- }
19497
- return null;
19498
- };
19499
- var resolveDisplayCellIndices = function resolveDisplayCellIndices(display, rowIndex, cellIndex, cell, isSingleViewFiltered) {
19500
- // The viewId-based lookup only makes sense when `display` here is a
19501
- // filtered subset (single-view embed) and `rowIndex`/`cellIndex` are
19502
- // positions within that subset rather than the source dashboard. In the
19503
- // normal, unfiltered editor render loop those indices already ARE the
19504
- // source indices, and matching by `viewId` can incorrectly collapse
19505
- // multiple cells that happen to share the same viewId onto one index.
19506
- if (isSingleViewFiltered && !isComponentEmpty(cell) && !isComponent(cell) && cell.attributes.viewId) {
19507
- var match = findCellByViewId(display, cell.attributes.viewId);
19508
- if (match) {
19509
- return {
19510
- rowIndex: match.rowIndex,
19511
- cellIndex: match.cellIndex
19512
- };
19513
- }
19514
- }
19515
- return {
19516
- rowIndex: rowIndex,
19517
- cellIndex: cellIndex
19518
- };
19519
- };
19520
-
19521
- var ensureTwelve = function ensureTwelve(row) {
19522
- var newRow = [].concat(row);
19523
- var total = _.sumBy(newRow, function (cell) {
19524
- return cell.colSpan;
19525
- });
19526
- if (total == 12) return newRow;
19527
- newRow[newRow.length - 1].colSpan += 12 - total;
19528
- return newRow;
19529
- };
19530
- var upcastRowToIncludeHeight = function upcastRowToIncludeHeight(displayRow) {
19531
- if ('components' in displayRow) {
19532
- return displayRow;
19533
- }
19534
- return {
19535
- components: displayRow,
19536
- height: DEFAULT_ROW_HEIGHT
19537
- };
19538
- };
19539
- var filterInvalidEmptyCells = function filterInvalidEmptyCells(cell) {
19540
- if (cell && isComponentEmpty(cell) && cell.colSpan <= 0) {
19541
- return false;
19542
- }
19543
- return true;
19544
- };
19545
- var upcastRow = function upcastRow(displayRow, componentInterfaceConfig) {
19546
- var displayRowWithComponentsKey = upcastRowToIncludeHeight(displayRow);
19547
- var allValidComponentsHaveColSpan = function allValidComponentsHaveColSpan(component) {
19548
- if (component && component.colSpan <= 0) {
19549
- return _extends({}, component, {
19550
- colSpan: 1
19551
- });
19552
- }
19553
- return component;
19554
- };
19555
- var filteredComponents = displayRowWithComponentsKey.components.filter(filterInvalidEmptyCells).map(allValidComponentsHaveColSpan);
19556
- var nullCounts = _.sumBy(filteredComponents, function (cell) {
19557
- return cell == null ? 1 : 0;
19558
- });
19559
- var filledCounts = _.sumBy(filteredComponents, function (cell) {
19560
- return cell == null ? 0 : cell.colSpan;
19561
- });
19562
- var emptySpaceToFill = 12 - filledCounts;
19563
- var fallbackColSpan = Math.floor(emptySpaceToFill / nullCounts);
19564
- var upcastedComponents = [].concat(filteredComponents).map(function (rawComponent) {
19565
- if (rawComponent === null) {
19566
- return {
19567
- isEmpty: true,
19568
- colSpan: fallbackColSpan
19569
- };
19570
- }
19571
- if (isComponentEmpty(rawComponent) || isComponent(rawComponent)) return rawComponent;
19572
- return load$2(_extends({}, rawComponent, {
19573
- colSpan: rawComponent.colSpan
19574
- }), componentInterfaceConfig);
19575
- });
19576
- return {
19577
- components: ensureTwelve(upcastedComponents),
19578
- height: displayRowWithComponentsKey.height || DEFAULT_ROW_HEIGHT
19579
- };
19580
- };
19581
-
19582
- var load$1 = function load(dumped, componentInterfaceConfig) {
19583
- return dumped.map(function (row) {
19584
- return upcastRow(row, componentInterfaceConfig);
19585
- });
19586
- };
19587
- var dump$1 = function dump(hydrated) {
19588
- return hydrated.map(function (row) {
19589
- var saveableComponents = [].concat(row.components).map(dump$2);
19590
- return {
19591
- components: saveableComponents,
19592
- height: row.height
19593
- };
19594
- });
19595
- };
19596
-
19597
- var load$2 = function load$1(dumped, componentInterfaceConfig) {
19598
- if ('isEmpty' in dumped || isComponent(dumped)) return dumped;
19599
- var _getComponentInterfac = getComponentInterface(dumped.attributes.type, componentInterfaceConfig),
19600
- load$1 = _getComponentInterfac.load;
19601
- var attributes = load$1(dumped.attributes);
19602
- var localFilters = [];
19603
- if (_.isArray(dumped.localFilters)) {
19604
- localFilters = [].concat(dumped.localFilters ? dumped.localFilters : []).map(function (localFilter) {
19605
- return load(localFilter);
19606
- });
19607
- }
19608
- if ('addOns' in dumped.attributes && _.isEmpty(localFilters)) {
19609
- dumped.attributes.addOns.forEach(function (addOn) {
19610
- localFilters = [].concat(localFilters, [{
19611
- type: addOn.type == 'dateFilter' ? 'dateFilter' : 'singleSelectFilter',
19612
- value: null,
19613
- requiresValue: false,
19614
- managedByConfiguration: false,
19615
- appliesToFields: [{
19616
- fieldId: addOn.field,
19617
- dataSetId: attributes.dataSetId
19618
- }]
19619
- }]);
19620
- });
19621
- }
19622
-
19623
- // @ts-ignore
19624
- delete dumped['addOns'];
19625
- // @ts-ignore
19626
- delete attributes['addOns'];
19627
-
19628
- // @ts-ignore
19629
- delete attributes['results'];
19630
- return _extends({}, dumped, {
19631
- localFilters: localFilters,
19632
- attributes: attributes
19633
- });
19634
- };
19635
- var dump$2 = function dump$1(hydrated) {
19636
- if (isComponentEmpty(hydrated) || isComponent(hydrated)) return hydrated;
19637
- var localFilters = [].concat(hydrated.localFilters && _.isArray(hydrated.localFilters) ? hydrated.localFilters : []).map(dump);
19638
- return _extends({}, hydrated, {
19639
- results: undefined,
19640
- queries: undefined,
19641
- attributes: _extends({}, hydrated.attributes, {
19642
- offset: undefined
19643
- }),
19644
- localFilters: localFilters
19645
- });
19646
- };
19647
-
19648
- var saveable = function saveable(component, protectedComponent) {
19649
- var _component$localFilte;
19650
- if (!component.attributes) {
19651
- throw new Error('Component attributes are required in saveable');
19652
- }
19653
- return {
19654
- attributes: _extends({}, component.attributes, {
19655
- protectedByOrganisation: protectedComponent ? true : undefined
19656
- }),
19657
- localFilters: (_component$localFilte = component.localFilters) != null ? _component$localFilte : [],
19658
- colSpan: 1,
19659
- reports: []
19660
- };
19661
- };
19662
-
19663
- var attributesSchema$r = function attributesSchema(config) {
19664
- return Joi.alternatives().conditional('.type', {
19665
- is: 'barChart',
19666
- then: BarChart(config).schema
19667
- }).conditional('.type', {
19668
- is: 'richText',
19669
- then: RichText(config).schema
19670
- }).conditional('.type', {
19671
- is: 'mercatorMap',
19672
- then: MercatorMap(config).schema
19673
- }).conditional('.type', {
19674
- is: 'horizontalBarChart',
19675
- then: HorizontalBarChart(config).schema
19676
- }).conditional('.type', {
19677
- is: 'lineChart',
19678
- then: LineChart(config).schema
19679
- }).conditional('.type', {
19680
- is: 'lineChartV2',
19681
- then: LineChart$1(config).schema
19682
- }).conditional('.type', {
19683
- is: 'barChartV2',
19684
- then: BarChart$1(config).schema
19685
- }).conditional('.type', {
19686
- is: 'areaChartV2',
19687
- then: AreaChart$1(config).schema
19688
- }).conditional('.type', {
19689
- is: 'comboChartV2',
19690
- then: ComboChartV2(config).schema
19691
- }).conditional('.type', {
19692
- is: 'comboChart',
19693
- then: ComboChart(config).schema
19694
- }).conditional('.type', {
19695
- is: 'areaChart',
19696
- then: AreaChart(config).schema
19697
- }).conditional('.type', {
19698
- is: 'pieChart',
19699
- then: PieChart(config).schema
19700
- }).conditional('.type', {
19701
- is: 'bubbleChart',
19702
- then: BubbleChart(config).schema
19703
- }).conditional('.type', {
19704
- is: 'bubbleChartV2',
19705
- then: BubbleChartV2(config).schema
19706
- }).conditional('.type', {
19707
- is: 'scatterChartV2',
19708
- then: ScatterChartV2(config).schema
19709
- }).conditional('.type', {
19710
- is: 'sunburstChart',
19711
- then: SunburstChart(config).schema
19712
- }).conditional('.type', {
19713
- is: 'scatterChart',
19714
- then: ScatterChart(config).schema
19715
- }).conditional('.type', {
19716
- is: 'singleStat',
19717
- then: SingleStat(config).schema
19718
- }).conditional('.type', {
19719
- is: 'dataTable',
19720
- then: DataTable(config).schema
19721
- }).conditional('.type', {
19722
- is: 'basicTable',
19723
- then: BasicTable(config).schema
19724
- }).conditional('.type', {
19725
- is: 'progress',
19726
- then: Progress(config).schema
19727
- }).conditional('.type', {
19728
- is: 'custom',
19729
- then: CustomChart(config).schema
19730
- }).conditional('.type', {
19731
- is: 'funnelChart',
19732
- then: FunnelChart(config).schema
19733
- }).conditional('.type', {
19734
- is: 'waterfallChart',
19735
- then: WaterfallChart(config).schema
19736
- }).conditional('.type', {
19737
- is: 'radarChart',
19738
- then: RadarChart(config).schema
19739
- }).conditional('.type', {
19740
- is: 'curveViewerChart',
19741
- then: CurveViewerChart(config).schema
19742
- }).conditional('.type', {
19743
- is: 'horizontalBarChartV2',
19744
- then: HorizontalBarChart$1(config).schema
19745
- }).conditional('.type', {
19746
- is: 'horizontalWaterfallChart',
19747
- then: HorizontalWaterfallChart(config).schema
19748
- });
19749
- };
19750
-
19751
19762
  var filterIncludedAndExcludedViews = function filterIncludedAndExcludedViews(allComponents, includeComponents, excludeComponents) {
19752
19763
  var newList = includeComponents ? [].concat(includeComponents) : [].concat(allComponents);
19753
19764
  if (excludeComponents) {
@@ -27282,12 +27293,12 @@ var fromRaw = function fromRaw(rawDashboard, queryEngineConfig) {
27282
27293
  name: rawDashboard.name,
27283
27294
  globalFilters: removeBrokenFiltersThenLoad(rawDashboard.definition.globalFilters, componentInterfaceConfig),
27284
27295
  componentLibrary: [].concat(rawDashboard.definition.componentLibrary || []).map(function (rawComponent) {
27285
- return load$2(_extends({}, rawComponent, {
27296
+ return load$1(_extends({}, rawComponent, {
27286
27297
  colSpan: (rawComponent == null ? void 0 : rawComponent.colSpan) || POPULATE_ONE_CELL$1
27287
27298
  }), componentInterfaceConfig);
27288
27299
  }),
27289
27300
  theme: _extends({}, vizzlyDefaultTheme, rawDashboard.theme),
27290
- display: load$1(rawDashboard.definition.display, componentInterfaceConfig),
27301
+ display: load$2(rawDashboard.definition.display, componentInterfaceConfig),
27291
27302
  webhookId: rawDashboard.webhook_id || null,
27292
27303
  createdAt: new Date(rawDashboard.created_at),
27293
27304
  updatedAt: new Date(rawDashboard.updated_at),
@@ -27333,8 +27344,8 @@ var toSaveableDefinition = function toSaveableDefinition(dashboard) {
27333
27344
  return {
27334
27345
  isPlayground: dashboard.isPlayground,
27335
27346
  globalFilters: globalFilters,
27336
- componentLibrary: [].concat(componentLibrary).map(dump$2),
27337
- display: dump$1(dashboard.display),
27347
+ componentLibrary: [].concat(componentLibrary).map(dump$1),
27348
+ display: dump$2(dashboard.display),
27338
27349
  customFields: customFields
27339
27350
  };
27340
27351
  };
@@ -47013,7 +47024,7 @@ var SingleStatView = function SingleStatView(props) {
47013
47024
  var mainResult = props.results !== undefined ? props.results[0] : undefined;
47014
47025
  if (isLoading(mainResult)) return jsxRuntime.jsx(LoadingComponent, {});
47015
47026
  if (hasFailed(mainResult)) return jsxRuntime.jsx(FailedToLoadDataNotice, {});
47016
- if (isEmpty(mainResult)) return jsxRuntime.jsx(NoResultContentToShowNotice, _extends({}, headerProps));
47027
+ if (isEmpty$1(mainResult)) return jsxRuntime.jsx(NoResultContentToShowNotice, _extends({}, headerProps));
47017
47028
  props = mergeProps(props, {}, defaultProps);
47018
47029
  var noOfMeasures = props.attributes.measure.length;
47019
47030
  var GAP = SingleStatConfig[props.viewFor].statGap;
@@ -47300,7 +47311,7 @@ var AreaChartView = function AreaChartView(props) {
47300
47311
  }
47301
47312
  if (isLoading(props.result)) return jsxRuntime.jsx(LoadingComponent, {});
47302
47313
  if (hasFailed(props.result)) return jsxRuntime.jsx(FailedToLoadDataNotice, {});
47303
- if (isEmpty(props.result)) return jsxRuntime.jsx(NoResultContentToShowNotice, _extends({}, headerProps));
47314
+ if (isEmpty$1(props.result)) return jsxRuntime.jsx(NoResultContentToShowNotice, _extends({}, headerProps));
47304
47315
  var pivotConfig = init$c(props);
47305
47316
  var series$1 = series(pivotConfig, props.measure, props.result);
47306
47317
  var resultSet$1 = resultSet(props.result, props.measure, pivotConfig, props.stacked == '100%', checkForNullValue(props.dataSetId, props.dimension, props.timeDimension, textOverride, valueAlias));
@@ -48444,7 +48455,7 @@ var BarChartView = function BarChartView(props) {
48444
48455
  }
48445
48456
  if (isLoading(props.result)) return jsxRuntime.jsx(LoadingComponent, {});
48446
48457
  if (hasFailed(props.result)) return jsxRuntime.jsx(FailedToLoadDataNotice, {});
48447
- if (isEmpty(props.result)) return jsxRuntime.jsx(NoResultContentToShowNotice, _extends({}, headerProps));
48458
+ if (isEmpty$1(props.result)) return jsxRuntime.jsx(NoResultContentToShowNotice, _extends({}, headerProps));
48448
48459
  var pivotConfig = init$c(props);
48449
48460
  var series$1 = series(pivotConfig, props.measure, props.result);
48450
48461
  var resultSet$1 = resultSet(props.result, props.measure, pivotConfig, props.stacked == '100%', checkForNullValue(props.dataSetId, props.dimension, props.timeDimension, textOverride, valueAlias));
@@ -48847,13 +48858,13 @@ var LineChartView = function LineChartView(props) {
48847
48858
  }
48848
48859
  if (isLoading(props.result)) return jsxRuntime.jsx(LoadingComponent, {});
48849
48860
  if (hasFailed(props.result)) return jsxRuntime.jsx(FailedToLoadDataNotice, {});
48850
- if (isEmpty(props.result)) return jsxRuntime.jsx(NoResultContentToShowNotice, _extends({}, headerProps));
48861
+ if (isEmpty$1(props.result)) return jsxRuntime.jsx(NoResultContentToShowNotice, _extends({}, headerProps));
48851
48862
  var pivotConfig = init$c(props);
48852
48863
  var series$1 = series(pivotConfig, props.measure, props.result);
48853
48864
  var resultSet$1 = resultSet(props.result, props.measure, pivotConfig, props.stacked == '100%', checkForNullValue(props.dataSetId, props.dimension, props.timeDimension, textOverride, valueAlias));
48854
48865
  var buildTrends = function buildTrends() {
48855
48866
  if (props.order.length > 0 && props.trends && props.trends.length > 0 && acceptedTimeDimensions(props.timeDimension)) {
48856
- var trends = init$9({
48867
+ var trends = init$a({
48857
48868
  pivotConfig: pivotConfig,
48858
48869
  measures: props.measure,
48859
48870
  resultSet: resultSet$1,
@@ -49089,7 +49100,7 @@ var ScatterChartView = function ScatterChartView(props) {
49089
49100
  }
49090
49101
  if (isLoading(props.result)) return jsxRuntime.jsx(LoadingComponent, {});
49091
49102
  if (hasFailed(props.result)) return jsxRuntime.jsx(FailedToLoadDataNotice, {});
49092
- if (isEmpty(props.result)) return jsxRuntime.jsx(NoResultContentToShowNotice, _extends({}, headerProps));
49103
+ if (isEmpty$1(props.result)) return jsxRuntime.jsx(NoResultContentToShowNotice, _extends({}, headerProps));
49093
49104
  props = mergeProps(props, {}, defaultProps$4);
49094
49105
  var keys = props.result && props.xMeasure ? scatterXKeys(props.dimension, props.xMeasure, props.result) : [];
49095
49106
  if (!props.xMeasure || !props.yMeasure) return null;
@@ -50804,7 +50815,7 @@ var PieChartView = function PieChartView(props) {
50804
50815
  return jsxRuntime.jsx(ResultsToLargeNotice, {});
50805
50816
  }
50806
50817
  if (hasFailed(props.result)) return jsxRuntime.jsx(FailedToLoadDataNotice, {});
50807
- if (isEmpty(props.result)) return jsxRuntime.jsx(NoResultContentToShowNotice, _extends({}, headerProps));
50818
+ if (isEmpty$1(props.result)) return jsxRuntime.jsx(NoResultContentToShowNotice, _extends({}, headerProps));
50808
50819
  var pivotConfig = init$c({
50809
50820
  dimension: props.attributes.dimension
50810
50821
  });
@@ -55765,7 +55776,7 @@ var BubbleChartView = function BubbleChartView(props) {
55765
55776
  }
55766
55777
  if (isLoading(props.result)) return jsxRuntime.jsx(LoadingComponent, {});
55767
55778
  if (hasFailed(props.result)) return jsxRuntime.jsx(FailedToLoadDataNotice, {});
55768
- if (isEmpty(props.result)) return jsxRuntime.jsx(NoResultContentToShowNotice, _extends({}, headerProps));
55779
+ if (isEmpty$1(props.result)) return jsxRuntime.jsx(NoResultContentToShowNotice, _extends({}, headerProps));
55769
55780
  props = mergeProps(props, {}, defaultProps$5);
55770
55781
  var keys = props.result && props.xMeasure ? scatterXKeys(props.dimension, props.xMeasure, props.result) : [];
55771
55782
  if (!props.xMeasure || !props.yMeasure) return null;
@@ -66335,7 +66346,7 @@ var BubbleChartV2View = function BubbleChartV2View(props) {
66335
66346
  var BubbleChartV2Component = getComponentInterface(props.attributes.type);
66336
66347
  var pivotConfig = init$d(props.attributes.xMeasure, props.attributes.measure);
66337
66348
  var chartRepresentation = null;
66338
- if (!isLoading(props.result) && !hasFailed(props.result) && !isEmpty(props.result) && BubbleChartV2Component.isRunnable(props.attributes)) {
66349
+ if (!isLoading(props.result) && !hasFailed(props.result) && !isEmpty$1(props.result) && BubbleChartV2Component.isRunnable(props.attributes)) {
66339
66350
  var _theme$charts$colors, _theme$charts, _props$attributes$goa;
66340
66351
  chartRepresentation = buildBubbleChartRepresentation({
66341
66352
  zFieldId: id(props.attributes.zMeasure[0]),
@@ -66385,7 +66396,7 @@ var BubbleChartV2View = function BubbleChartV2View(props) {
66385
66396
  }).length) === 0) return jsxRuntime.jsx(LoadingComponent, {});
66386
66397
  if (isLoading(props.result)) return jsxRuntime.jsx(LoadingComponent, {});
66387
66398
  if (hasFailed(props.result)) return jsxRuntime.jsx(FailedToLoadDataNotice, {});
66388
- if (isEmpty(props.result)) return jsxRuntime.jsx(NoResultContentToShowNotice, _extends({}, headerProps));
66399
+ if (isEmpty$1(props.result)) return jsxRuntime.jsx(NoResultContentToShowNotice, _extends({}, headerProps));
66389
66400
  var xKeyField = getXKeyField(pivotConfig, (_props$result$fields = (_props$result4 = props.result) == null ? void 0 : _props$result4.fields) != null ? _props$result$fields : []);
66390
66401
  return jsxRuntime.jsx(React.Suspense, {
66391
66402
  fallback: jsxRuntime.jsx(LoadingComponent, {}),
@@ -67059,7 +67070,7 @@ var LineChartV2View = function LineChartV2View(props) {
67059
67070
  var LineChartV2Component = getComponentInterface(props.attributes.type);
67060
67071
  var pivotConfig = init$c(props.attributes);
67061
67072
  var chartRepresentation = null;
67062
- if (!isLoading(props.result) && !hasFailed(props.result) && !isEmpty(props.result) && LineChartV2Component.isRunnable(props.attributes)) {
67073
+ if (!isLoading(props.result) && !hasFailed(props.result) && !isEmpty$1(props.result) && LineChartV2Component.isRunnable(props.attributes)) {
67063
67074
  var _theme$charts$colors, _theme$charts, _props$attributes$goa;
67064
67075
  chartRepresentation = buildLineChartRepresentation({
67065
67076
  axisTitles: props.attributes.axisTitles,
@@ -67132,7 +67143,7 @@ var LineChartV2View = function LineChartV2View(props) {
67132
67143
  }
67133
67144
  if (isLoading(props.result)) return jsxRuntime.jsx(LoadingComponent, {});
67134
67145
  if (hasFailed(props.result)) return jsxRuntime.jsx(FailedToLoadDataNotice, {});
67135
- if (isEmpty(props.result)) return jsxRuntime.jsx(NoResultContentToShowNotice, _extends({}, headerProps));
67146
+ if (isEmpty$1(props.result)) return jsxRuntime.jsx(NoResultContentToShowNotice, _extends({}, headerProps));
67136
67147
  return jsxRuntime.jsx(React.Suspense, {
67137
67148
  fallback: jsxRuntime.jsx(LoadingComponent, {}),
67138
67149
  children: jsxRuntime.jsxs(ViewWrapper, {
@@ -67538,7 +67549,7 @@ var ScatterChartV2View = function ScatterChartV2View(props) {
67538
67549
  var ScatterChartV2Component = getComponentInterface(props.attributes.type);
67539
67550
  var pivotConfig = init$d(props.attributes.xMeasure, props.attributes.measure);
67540
67551
  var chartRepresentation = null;
67541
- if (!isLoading(props.result) && !hasFailed(props.result) && !isEmpty(props.result) && ScatterChartV2Component.isRunnable(props.attributes)) {
67552
+ if (!isLoading(props.result) && !hasFailed(props.result) && !isEmpty$1(props.result) && ScatterChartV2Component.isRunnable(props.attributes)) {
67542
67553
  var _theme$charts$colors, _theme$charts, _props$attributes$goa;
67543
67554
  chartRepresentation = buildScatterChartRepresentation({
67544
67555
  axisTitles: props.attributes.axisTitles,
@@ -67581,7 +67592,7 @@ var ScatterChartV2View = function ScatterChartV2View(props) {
67581
67592
  }).length) === 0) return jsxRuntime.jsx(LoadingComponent, {});
67582
67593
  if (isLoading(props.result)) return jsxRuntime.jsx(LoadingComponent, {});
67583
67594
  if (hasFailed(props.result)) return jsxRuntime.jsx(FailedToLoadDataNotice, {});
67584
- if (isEmpty(props.result)) return jsxRuntime.jsx(NoResultContentToShowNotice, _extends({}, headerProps));
67595
+ if (isEmpty$1(props.result)) return jsxRuntime.jsx(NoResultContentToShowNotice, _extends({}, headerProps));
67585
67596
  return jsxRuntime.jsx(React.Suspense, {
67586
67597
  fallback: jsxRuntime.jsx(LoadingComponent, {}),
67587
67598
  children: jsxRuntime.jsxs(ViewWrapper, {
@@ -67975,7 +67986,7 @@ var AreaChartV2View = function AreaChartV2View(props) {
67975
67986
  var AreaChartV2Component = getComponentInterface(props.attributes.type);
67976
67987
  var pivotConfig = init$c(props.attributes);
67977
67988
  var chartRepresentation = null;
67978
- if (!isLoading(props.result) && !hasFailed(props.result) && !isEmpty(props.result) && AreaChartV2Component.isRunnable(props.attributes)) {
67989
+ if (!isLoading(props.result) && !hasFailed(props.result) && !isEmpty$1(props.result) && AreaChartV2Component.isRunnable(props.attributes)) {
67979
67990
  var _theme$charts$colors, _theme$charts, _props$attributes$goa;
67980
67991
  chartRepresentation = buildAreaChartRepresentation({
67981
67992
  axisTitles: props.attributes.axisTitles,
@@ -68042,7 +68053,7 @@ var AreaChartV2View = function AreaChartV2View(props) {
68042
68053
  }
68043
68054
  if (isLoading(props.result)) return jsxRuntime.jsx(LoadingComponent, {});
68044
68055
  if (hasFailed(props.result)) return jsxRuntime.jsx(FailedToLoadDataNotice, {});
68045
- if (isEmpty(props.result)) return jsxRuntime.jsx(NoResultContentToShowNotice, _extends({}, headerProps));
68056
+ if (isEmpty$1(props.result)) return jsxRuntime.jsx(NoResultContentToShowNotice, _extends({}, headerProps));
68046
68057
  return jsxRuntime.jsx(React.Suspense, {
68047
68058
  fallback: jsxRuntime.jsx(LoadingComponent, {}),
68048
68059
  children: jsxRuntime.jsxs(ViewWrapper, {
@@ -68910,7 +68921,7 @@ var BarChartV2View = function BarChartV2View(props) {
68910
68921
  var pivotConfig = init$c(props.attributes);
68911
68922
  var numberOfDimensions = props.attributes.dimension.length;
68912
68923
  var chartRepresentation = React.useMemo(function () {
68913
- if (!isLoading(props.result) && !hasFailed(props.result) && !isEmpty(props.result) && BarChartV2Component.isRunnable(props.attributes)) {
68924
+ if (!isLoading(props.result) && !hasFailed(props.result) && !isEmpty$1(props.result) && BarChartV2Component.isRunnable(props.attributes)) {
68914
68925
  var _theme$charts$colors, _theme$charts, _props$attributes$goa;
68915
68926
  var sharedArgs = {
68916
68927
  isDualAxisEnabled: props.attributes.isDualAxisEnabled,
@@ -69030,7 +69041,7 @@ var BarChartV2View = function BarChartV2View(props) {
69030
69041
  }
69031
69042
  if (isLoading(props.result)) return jsxRuntime.jsx(LoadingComponent, {});
69032
69043
  if (hasFailed(props.result)) return jsxRuntime.jsx(FailedToLoadDataNotice, {});
69033
- if (isEmpty(props.result)) return jsxRuntime.jsx(NoResultContentToShowNotice, _extends({}, headerProps));
69044
+ if (isEmpty$1(props.result)) return jsxRuntime.jsx(NoResultContentToShowNotice, _extends({}, headerProps));
69034
69045
  return jsxRuntime.jsx(React.Suspense, {
69035
69046
  fallback: jsxRuntime.jsx(LoadingComponent, {}),
69036
69047
  children: jsxRuntime.jsxs(ViewWrapper, {
@@ -70351,7 +70362,7 @@ var ComboChartViewV2 = function ComboChartViewV2(props) {
70351
70362
  attributes: null
70352
70363
  };
70353
70364
  var barChartRepresentation = React.useMemo(function () {
70354
- if (!isLoading(props.barResult) && !hasFailed(props.barResult) && !isEmpty(props.barResult) && ComboChartComponent.isRunnable(props.attributes)) {
70365
+ if (!isLoading(props.barResult) && !hasFailed(props.barResult) && !isEmpty$1(props.barResult) && ComboChartComponent.isRunnable(props.attributes)) {
70355
70366
  var _theme$charts$colors, _theme$charts, _props$attributes$goa, _props$attributes$con, _props$attributes$con2, _props$attributes$sta;
70356
70367
  return buildBarChartRepresentation({
70357
70368
  axisTitles: props.attributes.axisTitles,
@@ -70415,7 +70426,7 @@ var ComboChartViewV2 = function ComboChartViewV2(props) {
70415
70426
  var resolvedDualYAxisLabelCount = props.attributes.approxDualYAxisLabelCount === undefined || props.attributes.approxDualYAxisLabelCount === 'auto' ? DEFAULT_TICK_COUNT : props.attributes.approxDualYAxisLabelCount;
70416
70427
  var approxYAxisLabelCountConsideringDualAxis = props.attributes.isDualAxisEnabled ? (barChartRepresentation == null ? void 0 : barChartRepresentation.y.ticks.length) || DEFAULT_TICK_COUNT : resolvedPrimaryYAxisLabelCount;
70417
70428
  var lineChartRepresentation = React.useMemo(function () {
70418
- if (!isLoading(props.lineResult) && !hasFailed(props.lineResult) && !isEmpty(props.lineResult) && ComboChartComponent.isRunnable(props.attributes)) {
70429
+ if (!isLoading(props.lineResult) && !hasFailed(props.lineResult) && !isEmpty$1(props.lineResult) && ComboChartComponent.isRunnable(props.attributes)) {
70419
70430
  var _theme$charts3, _props$attributes$goa2, _props$attributes$con3, _props$attributes$con4;
70420
70431
  return buildLineChartRepresentation({
70421
70432
  axisTitles: props.attributes.axisTitles,
@@ -70569,7 +70580,7 @@ var ComboChartV2$1 = function ComboChartV2(props) {
70569
70580
  var lineResult = (_results$LINE_QUERY_I = results == null ? void 0 : results[LINE_QUERY_INDEX$1]) != null ? _results$LINE_QUERY_I : null;
70570
70581
  var barResult = (_results$BAR_QUERY_IN = results == null ? void 0 : results[BAR_QUERY_INDEX$1]) != null ? _results$BAR_QUERY_IN : null;
70571
70582
  var hasNoDataToShow = [lineResult, barResult].every(function (result) {
70572
- return result && isEmpty(result);
70583
+ return result && isEmpty$1(result);
70573
70584
  });
70574
70585
  return jsxRuntime.jsx(ComboChartView$2, _extends({
70575
70586
  id: props.id
@@ -74048,7 +74059,7 @@ var DataTableView = function DataTableView(props) {
74048
74059
  if (tooManyColumns) {
74049
74060
  return jsxRuntime.jsx(TooManyColumns, {});
74050
74061
  }
74051
- if (isEmpty(props.result)) {
74062
+ if (isEmpty$1(props.result)) {
74052
74063
  return jsxRuntime.jsx(NoResultContentToShowNotice, _extends({}, headerProps, {
74053
74064
  children: tableFooter
74054
74065
  }));
@@ -74807,7 +74818,7 @@ var FunnelChartView = function FunnelChartView(props) {
74807
74818
  }
74808
74819
  if (isLoading(props.result)) return jsxRuntime.jsx(LoadingComponent, {});
74809
74820
  if (hasFailed(props.result)) return jsxRuntime.jsx(FailedToLoadDataNotice, {});
74810
- if (isEmpty(props.result)) return jsxRuntime.jsx(NoResultContentToShowNotice, _extends({}, headerProps));
74821
+ if (isEmpty$1(props.result)) return jsxRuntime.jsx(NoResultContentToShowNotice, _extends({}, headerProps));
74811
74822
  var pivotConfig = init$c(props.attributes);
74812
74823
  var _getFunnelXScaleProps = getFunnelXScaleProps(pivotConfig, props.result.fields),
74813
74824
  xScaleKey = _getFunnelXScaleProps.xScaleKey,
@@ -75226,7 +75237,7 @@ var HorizontalBarChartV2View = function HorizontalBarChartV2View(props) {
75226
75237
  var pivotConfig = init$c(props.attributes);
75227
75238
  var numberOfDimensions = props.attributes.dimension.length;
75228
75239
  var chartRepresentation = React.useMemo(function () {
75229
- if (!isLoading(props.result) && !hasFailed(props.result) && !isEmpty(props.result) && HorizontalBarChartV2Component.isRunnable(props.attributes)) {
75240
+ if (!isLoading(props.result) && !hasFailed(props.result) && !isEmpty$1(props.result) && HorizontalBarChartV2Component.isRunnable(props.attributes)) {
75230
75241
  var _theme$charts$colors, _theme$charts, _props$attributes$goa;
75231
75242
  return buildHorizontalBarChartRepresentation({
75232
75243
  axisTitles: props.attributes.axisTitles,
@@ -75327,7 +75338,7 @@ var HorizontalBarChartV2View = function HorizontalBarChartV2View(props) {
75327
75338
  }
75328
75339
  if (isLoading(props.result)) return jsxRuntime.jsx(LoadingComponent, {});
75329
75340
  if (hasFailed(props.result)) return jsxRuntime.jsx(FailedToLoadDataNotice, {});
75330
- if (isEmpty(props.result)) return jsxRuntime.jsx(NoResultContentToShowNotice, _extends({}, headerProps));
75341
+ if (isEmpty$1(props.result)) return jsxRuntime.jsx(NoResultContentToShowNotice, _extends({}, headerProps));
75331
75342
  return jsxRuntime.jsx(React.Suspense, {
75332
75343
  fallback: jsxRuntime.jsx(LoadingComponent, {}),
75333
75344
  children: jsxRuntime.jsxs(ViewWrapper, {
@@ -75704,7 +75715,7 @@ var ProgressView$1 = function ProgressView(props) {
75704
75715
  var mainResult = props.results !== undefined ? props.results[0] : undefined;
75705
75716
  if (isLoading(mainResult)) return jsxRuntime.jsx(LoadingComponent, {});
75706
75717
  if (hasFailed(mainResult)) return jsxRuntime.jsx(FailedToLoadDataNotice, {});
75707
- if (isEmpty(mainResult)) return jsxRuntime.jsx(NoResultContentToShowNotice, _extends({}, headerProps));
75718
+ if (isEmpty$1(mainResult)) return jsxRuntime.jsx(NoResultContentToShowNotice, _extends({}, headerProps));
75708
75719
  props = mergeProps(props, {}, defaultProps$7);
75709
75720
  var noOfMeasures = props.measure.length;
75710
75721
  var progressType = defaultProgressType(props.progressType);
@@ -76150,7 +76161,7 @@ var RadarChartView = function RadarChartView(props) {
76150
76161
  });
76151
76162
  if (isLoading(result)) return jsxRuntime.jsx(LoadingComponent, {});
76152
76163
  if (hasFailed(result)) return jsxRuntime.jsx(FailedToLoadDataNotice, {});
76153
- if (isEmpty(result)) return jsxRuntime.jsx(NoResultContentToShowNotice, _extends({}, headerProps));
76164
+ if (isEmpty$1(result)) return jsxRuntime.jsx(NoResultContentToShowNotice, _extends({}, headerProps));
76154
76165
  var showHeadline = headlineAvailable(order, headline, timeDimension);
76155
76166
  var pivotConfig = init$c(props.attributes);
76156
76167
  var chartRepresentation = buildRadarChartRepresentation({
@@ -76728,7 +76739,7 @@ var SunburstChartView = function SunburstChartView(props) {
76728
76739
  yScale.domain(yd(t)).range(yr(t));
76729
76740
  };
76730
76741
  var sunburstData = React.useMemo(function () {
76731
- if (isLoading(props.result) || hasFailed(props.result) || isEmpty(props.result) || !sunburstChartComponent.isRunnable(props.attributes)) {
76742
+ if (isLoading(props.result) || hasFailed(props.result) || isEmpty$1(props.result) || !sunburstChartComponent.isRunnable(props.attributes)) {
76732
76743
  return null;
76733
76744
  }
76734
76745
  var formattedData = formatResult(props.result, props.formatResultParams);
@@ -76802,7 +76813,7 @@ var SunburstChartView = function SunburstChartView(props) {
76802
76813
  }
76803
76814
  if (hasFailed(props.result)) return jsxRuntime.jsx(FailedToLoadDataNotice, {});
76804
76815
  if (isLoading(props.result) || props.result.fields.length !== totalFieldCount) return jsxRuntime.jsx(LoadingComponent, {});
76805
- if (isEmpty(props.result)) return jsxRuntime.jsx(NoResultContentToShowNotice, _extends({}, headerProps));
76816
+ if (isEmpty$1(props.result)) return jsxRuntime.jsx(NoResultContentToShowNotice, _extends({}, headerProps));
76806
76817
  var keys = (_root$children$map = root == null || (_root$children = root.children) == null ? void 0 : _root$children.map(function (child) {
76807
76818
  return child.data.name;
76808
76819
  })) != null ? _root$children$map : [];
@@ -77748,7 +77759,7 @@ function getWaterfallChartViewEarlyReturn(_ref) {
77748
77759
  if (isLoading(result)) return jsxRuntime.jsx(LoadingComponent, {});
77749
77760
  if (isLoadingWaterfallResult(result)) return jsxRuntime.jsx(LoadingComponent, {});
77750
77761
  if (hasFailed(result)) return jsxRuntime.jsx(FailedToLoadDataNotice, {});
77751
- if (isEmpty(result)) return jsxRuntime.jsx(NoResultContentToShowNotice, _extends({}, headerProps));
77762
+ if (isEmpty$1(result)) return jsxRuntime.jsx(NoResultContentToShowNotice, _extends({}, headerProps));
77752
77763
  return null;
77753
77764
  }
77754
77765
  function WaterfallChartViewFrame(_ref2) {
@@ -78693,7 +78704,7 @@ var CurveViewerChartView = function CurveViewerChartView(props) {
78693
78704
  });
78694
78705
  var chartRepresentation = React.useMemo(function () {
78695
78706
  var _theme$charts$colors, _theme$charts, _result$fields$find, _result$fields$find2;
78696
- if (!result || isLoading(result) || hasFailed(result) || isEmpty(result)) {
78707
+ if (!result || isLoading(result) || hasFailed(result) || isEmpty$1(result)) {
78697
78708
  return null;
78698
78709
  }
78699
78710
  if (!CurveViewerChartComponent.isRunnable(props.attributes)) {
@@ -78735,7 +78746,7 @@ var CurveViewerChartView = function CurveViewerChartView(props) {
78735
78746
  });
78736
78747
  if (isLoading(result)) return jsxRuntime.jsx(LoadingComponent, {});
78737
78748
  if (hasFailed(result)) return jsxRuntime.jsx(FailedToLoadDataNotice, {});
78738
- if (isEmpty(result)) return jsxRuntime.jsx(NoResultContentToShowNotice, _extends({}, headerProps));
78749
+ if (isEmpty$1(result)) return jsxRuntime.jsx(NoResultContentToShowNotice, _extends({}, headerProps));
78739
78750
  if (!chartRepresentation || chartRepresentation.data.length === 0) return jsxRuntime.jsx(NoResultContentToShowNotice, _extends({}, headerProps));
78740
78751
  var style = buildStyleOverrides({
78741
78752
  display: 'flex',
@@ -81452,7 +81463,7 @@ var download = /*#__PURE__*/function () {
81452
81463
  case 8:
81453
81464
  results = _context3.sent;
81454
81465
  result = results == null ? void 0 : results[0];
81455
- if (!(!hasFailed(result) && !isEmpty(result) && !isLoading(result))) {
81466
+ if (!(!hasFailed(result) && !isEmpty$1(result) && !isLoading(result))) {
81456
81467
  _context3.next = 22;
81457
81468
  break;
81458
81469
  }
@@ -94167,7 +94178,7 @@ var Header = /*#__PURE__*/function () {
94167
94178
  function Header(title) {
94168
94179
  /** The header component. */
94169
94180
  this.component = undefined;
94170
- var newHeader = init$a('New Header');
94181
+ var newHeader = init$9('New Header');
94171
94182
  if (title) {
94172
94183
  newHeader = _extends({}, newHeader, {
94173
94184
  displayTitle: title