@datarailsshared/dr_renderer 1.2.232-dragons → 1.2.234-rocket

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.
@@ -31,12 +31,6 @@ jobs:
31
31
  - run:
32
32
  name: Authenticate with registry
33
33
  command: echo "//registry.npmjs.org/:_authToken=$npm_TOKEN" > ~/repo/.npmrc
34
- - run:
35
- name: Install dependencies
36
- command: npm install
37
- - run:
38
- name: Run npm test
39
- command: npm test
40
34
  - run:
41
35
  name: Publish package
42
36
  command: npm publish . --access=public
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@datarailsshared/dr_renderer",
3
- "version": "1.2.232-dragons",
3
+ "version": "1.2.234-rocket",
4
4
  "description": "DataRails charts and tables renderer",
5
5
  "keywords": [
6
6
  "datarails",
@@ -9,8 +9,7 @@
9
9
  "tables"
10
10
  ],
11
11
  "scripts": {
12
- "login": "npm login",
13
- "test": "jest --coverage"
12
+ "login": "npm login"
14
13
  },
15
14
  "author": "Sergey Spivakov",
16
15
  "repository": {
@@ -18,21 +17,6 @@
18
17
  "url": "git+https://bitbucket.org/datarails/dr_renderer.git"
19
18
  },
20
19
  "license": "",
21
- "dependencies": {
22
- "jquery": "^3.6.0",
23
- "lodash": "^4.17.20",
24
- "regenerator-runtime": "^0.13.5"
25
- },
26
- "devDependencies": {
27
- "@babel/core": "^7.20.12",
28
- "@babel/preset-env": "^7.20.2",
29
- "@testing-library/dom": "^7.2.1",
30
- "@testing-library/jest-dom": "^5.5.0",
31
- "babel-jest": "^25.5.1",
32
- "jest": "^25.3.0",
33
- "moment": "^2.29.1",
34
- "serve": "^11.3.0"
35
- },
36
20
  "bugs": {
37
21
  "url": ""
38
22
  },
@@ -40,10 +24,5 @@
40
24
  "whitelistedNonPeerDependencies": [],
41
25
  "main": "src/index.js",
42
26
  "module": "src/index.js",
43
- "sideEffects": false,
44
- "jest": {
45
- "setupFiles": [
46
- "./setup-jest.js"
47
- ]
48
- }
27
+ "sideEffects": false
49
28
  }
@@ -1,6 +1,5 @@
1
1
  const SERIES_CLASSNAMES = {
2
2
  WATERFALL_BREAKDOWN: 'waterfallBreakdown',
3
- WATERFALL_WALKTHROUGH: 'waterfallWalkthrough',
4
3
  TOTAL_SERIES: 'totalSeries',
5
4
  TREND_SERIES: 'trendSeries',
6
5
  };
@@ -26,7 +25,6 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
26
25
  const textColor = "#151a41";
27
26
  const chartLabelColor = "#cfd7dd";
28
27
  const HIGHCHARTS_FONT_FAMILY = 'Poppins';
29
- let firstBarColor = null;
30
28
 
31
29
  if(!Highcharts){
32
30
  Highcharts = {
@@ -84,7 +82,6 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
84
82
  KPI_WIDGET: 'kpi-widget',
85
83
  TEXT_WIDGET: 'text-widget',
86
84
  WATERFALL_BREAKDOWN: 'waterfall-chart-breakdown',
87
- WATERFALL_WALKTHROUGH: 'waterfall-chart-walkthrough',
88
85
  PUBLISHED_ITEM: 'published_item',
89
86
  RICH_TEXT: 'rich_text',
90
87
  EXCEL_VIEWER: 'excel_viewer',
@@ -469,7 +466,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
469
466
  highchartsRenderer.getOthersName(opts) :
470
467
  undefined;
471
468
  var drOthersInColumn = lodash.find(
472
- pivotData.getColKeys(),
469
+ pivotData.getColKeys(),
473
470
  keys => keys.length && (lodash.includes(keys, 'DR_Others') || lodash.includes(keys, othersName))
474
471
  );
475
472
 
@@ -489,7 +486,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
489
486
  rows = [];
490
487
  }
491
488
 
492
- var cols = lodash.get(this, 'point.options.colsForTotal') || this.key;
489
+ var cols = this.key;
493
490
  if (typeof (cols) == 'object' && cols.name) {
494
491
  cols = cols.name;
495
492
  }
@@ -497,7 +494,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
497
494
  if (!cols && is_drill_down_pie) {
498
495
  cols = this.point.name;
499
496
  }
500
-
497
+
501
498
  if (drOthersInColumn) {
502
499
  if (!lodash.isArray(cols) && othersName === cols) {
503
500
  cols = ['DR_Others'];
@@ -622,8 +619,6 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
622
619
 
623
620
  var func = function () {
624
621
  const isWaterfallBreakdown = this.series.options.className === SERIES_CLASSNAMES.WATERFALL_BREAKDOWN;
625
- const isWaterfallWalkthrough = this.series.options.className === SERIES_CLASSNAMES.WATERFALL_WALKTHROUGH;
626
- const isTrendSeries = this.series.options.className === SERIES_CLASSNAMES.TREND_SERIES;
627
622
 
628
623
  var y = parseFloat(this.y);
629
624
  if (pivotData) {
@@ -634,11 +629,10 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
634
629
  }
635
630
  if (pivotData.rowAttrs.length == 0
636
631
  || this.series.options.className === 'totalSeries'
637
- || isTrendSeries) {
632
+ || this.series.options.className === 'trendSeries') {
638
633
  rows = [];
639
634
  }
640
-
641
- var cols = lodash.get(this, 'point.options.colsForTotal') || this.key;
635
+ var cols = this.key;
642
636
  if (!cols && is_drill_down_pie) {
643
637
  cols = this.name;
644
638
  }
@@ -653,9 +647,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
653
647
  if (variant_name && rows && rows[0] && variant_name == rows[0]) {
654
648
  rows[0] = variant_name_default_name;
655
649
  }
656
- if (isWaterfallWalkthrough) {
657
- cols = [this.key]
658
- }
650
+
659
651
  try {
660
652
  if (is_drill_down_pie && !highchartsRenderer.selfStartsWith(series_name,"Series ")) {
661
653
  let temp = cols;
@@ -663,9 +655,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
663
655
  rows = temp;
664
656
  }
665
657
 
666
- var category_text = `<span style="font-weight: bold;">
667
- ${ lodash.get(this, 'point.options.colsForTotal') ? cols[0] : cols } ${ isWaterfallBreakdown ? ': ' : ' ' }
668
- </span>`;
658
+ var category_text = `<span style="font-weight: bold;">${ cols }${ isWaterfallBreakdown ? ': ' : ' ' }</span>`;
669
659
  if (this.category) {
670
660
  category_text = '';
671
661
  }
@@ -674,7 +664,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
674
664
  series_text += ': '
675
665
  }
676
666
 
677
- if (pivotData.rowAttrs.length == 0 && !isTrendSeries) {
667
+ if (pivotData.rowAttrs.length == 0) {
678
668
  series_text = ': ';
679
669
  }
680
670
 
@@ -682,15 +672,13 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
682
672
  const modifiedRowsAndCols = highchartsRenderer.transformRowsAndColsForBreakdown(rows, cols, this.point, opts);
683
673
  rows = modifiedRowsAndCols.rows;
684
674
  cols = modifiedRowsAndCols.cols;
685
- }
675
+ }
686
676
 
687
677
  var aggr = pivotData.getAggregator(rows, cols);
688
678
 
689
679
  let formatted_value_to_return = $.pivotUtilities.getFormattedNumber(y, null, opts);
690
680
  if (aggr.value() || isWaterfallBreakdown) {
691
- formatted_value_to_return = $.pivotUtilities.getFormattedNumber(
692
- isWaterfallBreakdown || isTrendSeries ? y : aggr.value(), aggr, opts
693
- );
681
+ formatted_value_to_return = $.pivotUtilities.getFormattedNumber(isWaterfallBreakdown ? y : aggr.value(), aggr, opts);
694
682
  }
695
683
 
696
684
  let wrappedFormattedValue = highchartsRenderer.getSpanWrapper(formatted_value_to_return);
@@ -1097,7 +1085,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
1097
1085
 
1098
1086
  const trendSeries = lodash.clone(chart_series[chart_series.length - 1]);
1099
1087
  trendSeries.className = 'trendSeries';
1100
- trendSeries.name = highchartsRenderer.getTrendSeriesName(trendSeries);
1088
+ trendSeries.name = 'Trend Line (' + trendSeries.name + ')';
1101
1089
  trendSeries.dashStyle = 'shortdot';
1102
1090
  trendSeries.type = 'line';
1103
1091
  trendSeries.data = trendSeries.data.map((el, index) => a + b * (index + 1));
@@ -1266,7 +1254,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
1266
1254
 
1267
1255
  const trendSeries = lodash.clone(chart_series[chart_series.length - 1]);
1268
1256
  trendSeries.className = 'trendSeries';
1269
- trendSeries.name = highchartsRenderer.getTrendSeriesName(trendSeries);
1257
+ trendSeries.name = 'Trend Line (' + trendSeries.name + ')';
1270
1258
  trendSeries.dashStyle = 'shortdot';
1271
1259
  trendSeries.type = 'line';
1272
1260
  trendSeries.data = trendSeries.data.map((data, index) => ({name: data.name, y: a + b * (index + 1)}));
@@ -1426,89 +1414,6 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
1426
1414
  return chart_series;
1427
1415
  }
1428
1416
 
1429
- highchartsRenderer.ptCreateWaterfallWalkthroughSeries = function (pivotData, onlyNumbers, additionOptions, opts) {
1430
- const waterfallOptions = opts.walkthrough_options;
1431
- const chart_series = [];
1432
- let resultObject = {
1433
- data: [],
1434
- dataLabels: {
1435
- allowOverlap: additionOptions && additionOptions.label ? additionOptions.label.overlap : false,
1436
- enabled: additionOptions && additionOptions.label ? additionOptions.label.show : true,
1437
- formatter: highchartsRenderer.defaultDataLabelFormatter(pivotData, {'chartOptions': additionOptions, total_value_options: opts.total_value_options}),
1438
- style: highchartsRenderer.getDataLabelsStyle(additionOptions),
1439
- },
1440
- upColor: waterfallOptions.colors.increase,
1441
- color: waterfallOptions.colors.decrease,
1442
- className: SERIES_CLASSNAMES.WATERFALL_WALKTHROUGH
1443
- };
1444
- resultObject = highchartsRenderer.getDataLabelsOptions(additionOptions, resultObject);
1445
- lodash.forEach(waterfallOptions.values.walkthrough, function(value, index) {
1446
-
1447
- let keys = [];
1448
- if (value.trend === 'total') {
1449
- keys = ['Total'];
1450
- } else {
1451
- _.forEach(value.key, (item) => {
1452
- const findKeyByValue = Object.keys(pivotData.dateValuesDictionary || {}).find(key => pivotData.dateValuesDictionary[key] === item);
1453
- keys.push(findKeyByValue ? findKeyByValue : item);
1454
- })
1455
- }
1456
-
1457
- const agg = pivotData.getAggregator([], keys);
1458
- let val = agg.value();
1459
-
1460
- if (val != null && $.isNumeric(val)) {
1461
- val = parseFloat(val);
1462
- } else if (onlyNumbers) {
1463
- val = NaN;
1464
- } else {
1465
- val = 0;
1466
- }
1467
-
1468
- if (value.trend === 'decrease') {
1469
- val = val * -1;
1470
- }
1471
-
1472
- const name = value.trend === 'total' ? value.formattedKey || value.key[0] : keys.join(highchartsRenderer.delimer);
1473
- let color = '';
1474
- if (value.trend !== 'total') {
1475
- if (index === 0 && !firstBarColor) {
1476
- color = waterfallOptions.colors.total;
1477
- firstBarColor = waterfallOptions.colors.total;
1478
- } else {
1479
- color = value.color
1480
- }
1481
- } else {
1482
- color = waterfallOptions.colors.total;
1483
- }
1484
-
1485
- resultObject.data.push({
1486
- y: val,
1487
- name: lodash.unescape(name).replace('DR_Others', highchartsRenderer.getOthersName(opts)),
1488
- isSum: value.trend === 'total',
1489
- isTotal: value.trend === 'total',
1490
- color,
1491
- colsForTotal: value.trend === 'total' ? keys : null,
1492
- });
1493
- });
1494
- chart_series.push(resultObject);
1495
- chart_series.push(
1496
- {
1497
- name: 'Positive',
1498
- visible: false,
1499
- color: waterfallOptions.colors.increase
1500
- });
1501
-
1502
- chart_series.push(
1503
- {
1504
- name: 'Negative',
1505
- visible: false,
1506
- color: waterfallOptions.colors.decrease
1507
- });
1508
-
1509
- return chart_series;
1510
- }
1511
-
1512
1417
  highchartsRenderer.setChartTypeBySeriesType = function (type, series) {
1513
1418
  const types = {
1514
1419
  'line-chart': 'line',
@@ -1712,7 +1617,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
1712
1617
  highchartsRenderer.getDataLabelsStylesForDrillDown = function(additionOptions) {
1713
1618
  let result = highchartsRenderer.getDataLabelsOptions(additionOptions, { dataLabels: {} });
1714
1619
 
1715
- if (!result.dataLabels) return {};
1620
+ if (!result.dataLabels) return {};
1716
1621
  return {
1717
1622
  activeDataLabelStyle: {
1718
1623
  color: result.dataLabels.color,
@@ -3268,7 +3173,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
3268
3173
 
3269
3174
  highchartsRenderer.ptRenderWaterfallBreakdown = function (pivotData, opts, drilldownFunc, chartType) {
3270
3175
  let chartOptions = {};
3271
- const additionOptions = opts.chartOptions
3176
+ const additionOptions = opts.chartOptions
3272
3177
  ? opts.chartOptions
3273
3178
  : highchartsRenderer.getDefaultValueForChart(highchartsRenderer.CHART_TYPES.WATERFALL_BREAKDOWN);
3274
3179
 
@@ -3367,121 +3272,6 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
3367
3272
  return highchartsRenderer.ptCreateElementAndDraw(chartOptions, opts);
3368
3273
  };
3369
3274
 
3370
- highchartsRenderer.ptRenderWaterfallWalkthrough = function (pivotData, opts) {
3371
- let chartOptions = {};
3372
- const waterfallOptions = opts?.walkthrough_options;
3373
- const additionOptions = opts.chartOptions
3374
- ? opts.chartOptions
3375
- : highchartsRenderer.getDefaultValueForChart(highchartsRenderer.CHART_TYPES.WATERFALL_WALKTHROUGH);
3376
-
3377
- chartOptions.chart = {
3378
- type: 'waterfall',
3379
- zoomType: additionOptions && additionOptions.chart && additionOptions.chart.zoom_type ? additionOptions.chart.zoom_type : 'None',
3380
- };
3381
- if (disableAnimation) {
3382
- chartOptions.chart.animation = false;
3383
- }
3384
-
3385
- chartOptions.xAxis = {
3386
- type: 'category',
3387
- crosshair: true,
3388
- min: 0,
3389
- title: {
3390
- text : additionOptions && additionOptions.axisX ? additionOptions.axisX.name : '',
3391
- },
3392
- uniqueNames: false,
3393
- };
3394
-
3395
- highchartsRenderer.setTitleAndSubTitle(chartOptions, opts, additionOptions);
3396
-
3397
- chartOptions.yAxis = {
3398
- min: null,
3399
- max: null,
3400
- title: {
3401
- text: additionOptions && additionOptions.axisY ? additionOptions.axisY.name : '',
3402
- autoylabel: additionOptions && additionOptions.axisY ? additionOptions.axisY.autoylabel : ''
3403
- },
3404
- labels: {
3405
- formatter: highchartsRenderer.defaultValueLabelsFormatter(pivotData, opts)
3406
- },
3407
- };
3408
- if (additionOptions) {
3409
- highchartsRenderer.setYAxisMinMax(chartOptions.yAxis, additionOptions.axisY);
3410
- }
3411
-
3412
- chartOptions.tooltip = {
3413
- formatter: highchartsRenderer.defaultFormatterToTooltip(pivotData, opts),
3414
- valueDecimals: 2,
3415
- };
3416
-
3417
- highchartsRenderer.handleGridLines(additionOptions, chartOptions);
3418
-
3419
- if (lodash.get(opts, 'paletteOptions.widgetPalette', null)) {
3420
- const mc_palette = lodash.find(lodash.get(opts.paletteOptions, 'monochromePalettes', []), { selected: true });
3421
- chartOptions.colors = mc_palette ? mc_palette.colors : opts.paletteOptions.widgetPalette;
3422
- } else if (lodash.get(opts, 'paletteOptions.dashboardPalette.colors', null)) {
3423
- chartOptions.colors = opts.paletteOptions.dashboardPalette.colors;
3424
- }
3425
- chartOptions.series = highchartsRenderer
3426
- .ptCreateWaterfallWalkthroughSeries(pivotData, null, additionOptions, opts);
3427
-
3428
- chartOptions = highchartsRenderer.prepareAxisX(chartOptions, additionOptions, pivotData.getColKeys());
3429
- chartOptions.plotOptions = {
3430
- waterfall: {
3431
- pointPadding: 0.2,
3432
- borderWidth: 0,
3433
- borderRadius: 1,
3434
- lineWidth: 0,
3435
- },
3436
- series: {
3437
- animation: !disableAnimation,
3438
- cropThreshold: 1000,
3439
- dataLabels: {
3440
- allowOverlap: additionOptions && additionOptions.label ? additionOptions.label.overlap : false,
3441
- enabled: additionOptions && additionOptions.label ? additionOptions.label.show : true,
3442
- formatter: highchartsRenderer.defaultDataLabelFormatter(pivotData, opts),
3443
- style: highchartsRenderer.getDataLabelsStyle(additionOptions),
3444
- inside: false
3445
- },
3446
- events: {
3447
- legendItemClick: () => {
3448
- return false;
3449
- }
3450
- }
3451
- }
3452
- };
3453
-
3454
- if (opts.drillDownListFunc) {
3455
- chartOptions.plotOptions.series.cursor = 'pointer';
3456
- chartOptions.plotOptions.series.point = {
3457
- events: {
3458
- click: opts.drillDownListFunc
3459
- }
3460
- };
3461
- }
3462
- if (waterfallOptions.colors) {
3463
- chartOptions.legend = highchartsRenderer.getOptionsForLegends(additionOptions, 3, false);
3464
- chartOptions.legend.useHTML = true;
3465
- chartOptions.legend.labelFormatter = function() {
3466
- const name = this.options.className ? 'Total': this.name;
3467
- const findTotal = _.find(this.options.data, {isTotal: true});
3468
- const color = findTotal?.color ? findTotal.color : this.color;
3469
- return '<span style="margin: 5px; vertical-align: middle; display:inline-block; background-color: '+ color + '; width: 12px; height: 12px; border-radius: 50%"></span><span style="color: #000; display: inline-block; margin: 5px; vertical-align: middle;">' + name + '</span>';
3470
- }
3471
-
3472
- chartOptions.legend.symbolPadding = 0;
3473
- chartOptions.legend.symbolWidth = 0;
3474
- chartOptions.legend.symbolHeight = 0;
3475
- chartOptions.legend.squareSymbol = false;
3476
- } else {
3477
- chartOptions.legend = {
3478
- enabled: false
3479
- }
3480
- }
3481
-
3482
- return highchartsRenderer.ptCreateElementAndDraw(chartOptions, opts);
3483
- }
3484
-
3485
3275
  highchartsRenderer.formatFieldValue = function (field, value) {
3486
3276
  let currentType = '';
3487
3277
  let format = field.format;
@@ -4550,17 +4340,6 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
4550
4340
  }
4551
4341
  };
4552
4342
 
4553
- highchartsRenderer.waterfallConstants = {
4554
- [highchartsRenderer.CHART_TYPES.WATERFALL_BREAKDOWN]: {
4555
- minCategoriesCount: 2,
4556
- maxCategoriesCount: 5,
4557
- },
4558
- [highchartsRenderer.CHART_TYPES.WATERFALL_WALKTHROUGH]: {
4559
- minCategoriesCount: 2,
4560
- maxCategoriesCount: 10,
4561
- }
4562
- };
4563
-
4564
4343
  highchartsRenderer.rhPivotView = function (rowData, options, isTable = false, widget = null) {
4565
4344
  if (!rowData || !rowData) {
4566
4345
  if (options.onlyOptions) {
@@ -4569,15 +4348,10 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
4569
4348
  return null;
4570
4349
  }
4571
4350
 
4572
- const isWaterfall = widget
4573
- && (
4574
- widget.chart_type === highchartsRenderer.CHART_TYPES.WATERFALL_BREAKDOWN
4575
- || widget.chart_type === highchartsRenderer.CHART_TYPES.WATERFALL_WALKTHROUGH
4576
- );
4577
-
4578
- if (isWaterfall) {
4579
- const maxCategories = highchartsRenderer.waterfallConstants[widget.chart_type].maxCategoriesCount;
4580
- const minCategories = highchartsRenderer.waterfallConstants[widget.chart_type].minCategoriesCount;
4351
+ if (widget && widget.chart_type === highchartsRenderer.CHART_TYPES.WATERFALL_BREAKDOWN) {
4352
+ const breakdownSettings = widget.options.breakdown_options.settings;
4353
+ const maxCategories = breakdownSettings.maxCategoriesCount;
4354
+ const minCategories = breakdownSettings.minCategoriesCount;
4581
4355
  const uniqueCategories = lodash.filter(
4582
4356
  lodash.uniq(
4583
4357
  lodash.map(rowData, row => row[widget.cols[0].name])
@@ -4587,8 +4361,6 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
4587
4361
 
4588
4362
  if (uniqueCategories && (uniqueCategories.length > maxCategories || uniqueCategories.length < minCategories )) {
4589
4363
  options.error_has_occurred = true;
4590
- const isDateField = widget.cols[0].type === 'Date';
4591
- const commonMessagePart = `This chart support a selection of ${minCategories}-${maxCategories} items from the category section. `;
4592
4364
  options.error_params = {
4593
4365
  title: 'Data Conflict',
4594
4366
  text: `Please adjust your dashboard's reference date and filter selections as \
@@ -4837,25 +4609,19 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
4837
4609
  return highchartsRenderer.getWeekNumber(dateObj);
4838
4610
  };
4839
4611
 
4840
- highchartsRenderer.check_values_not_for_convert = function (currentgraph, field_name) {
4841
- let vals_not_convert = [];
4612
+ highchartsRenderer.check_value_not_for_convert = function (currentgraph, field_name) {
4613
+ let val_not_convert = null;
4842
4614
  if (lodash.has(currentgraph, "options.chartOptions.delta_column") && currentgraph.options.chartOptions.delta_column) {
4843
4615
  let delta_options = currentgraph.options.chartOptions.delta_column;
4844
4616
  if (delta_options.field == 'series' && currentgraph.rows && currentgraph.rows[0] &&
4845
4617
  currentgraph.rows[0].name == field_name) {
4846
- vals_not_convert = [delta_options.name];
4618
+ val_not_convert = delta_options.name;
4847
4619
  } else if (delta_options.field == 'category' && currentgraph.rows && currentgraph.cols[0] &&
4848
4620
  currentgraph.cols[0].name == field_name) {
4849
- vals_not_convert = [delta_options.name];
4621
+ val_not_convert = delta_options.name;
4850
4622
  }
4851
- } else if (currentgraph.chart_type === highchartsRenderer.CHART_TYPES.WATERFALL_WALKTHROUGH) {
4852
- lodash.forEach(currentgraph.options.walkthrough_options.values.walkthrough, value => {
4853
- if (value.trend === 'total') {
4854
- vals_not_convert.push(value.key[0]);
4855
- }
4856
- });
4857
4623
  }
4858
- return vals_not_convert;
4624
+ return val_not_convert;
4859
4625
  };
4860
4626
 
4861
4627
  highchartsRenderer.updateFiltersShowNames = function (filters) {
@@ -4875,8 +4641,8 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
4875
4641
  })
4876
4642
  };
4877
4643
 
4878
- highchartsRenderer.returnRawDataValue = function (type, value, format, field_name, vals_not_for_convert) {
4879
- if (vals_not_for_convert && vals_not_for_convert.length && lodash.includes(vals_not_for_convert, value)) {
4644
+ highchartsRenderer.returnRawDataValue = function (type, value, format, field_name, val_not_for_convert) {
4645
+ if (val_not_for_convert && val_not_for_convert == value) {
4880
4646
  return value;
4881
4647
  }
4882
4648
 
@@ -4972,7 +4738,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
4972
4738
  };
4973
4739
 
4974
4740
  highchartsRenderer.isSystemField = function (field) {
4975
- var regex = new RegExp("^(Parent_Name|Parent_Id|FileBox_ID|FileBox_Name|DataMapper_Name|Doc_ID|Doc_version|Label|Submission_Date|User|table_id|Latest_In_Dim|Tab_name|CP_Name|DT_.+|VT_.+|System_.+)$", "m");
4741
+ var regex = new RegExp("^(Calc_Model_Name|Calc_Model_ID|Parent_Name|Parent_Id|FileBox_ID|FileBox_Name|DataMapper_Name|Doc_ID|Doc_version|Label|Submission_Date|User|table_id|Latest_In_Dim|Tab_name|CP_Name|DT_.+|VT_.+|System_.+)$", "m");
4976
4742
 
4977
4743
  return (field.category && field.category.includes("")) || regex.test(field.name)
4978
4744
  };
@@ -5335,34 +5101,102 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
5335
5101
 
5336
5102
  highchartsRenderer.addTemplateDataToCalcModel = function (selectedTemplate, calcModelOptions) {
5337
5103
  highchartsRenderer.setWidgetFieldsToTemplate(selectedTemplate);
5338
-
5339
- const scenarioName = 'scenario';
5340
5104
  const fields = highchartsRenderer.objectCopyJsonMethod(selectedTemplate.fields);
5341
- const fieldScenarioAlias = _.find(fields, field => (field.alias || '').toLowerCase() === scenarioName)
5342
- const fieldScenario = _.find(fields, field => (field.name || '').toLowerCase() === scenarioName)
5343
- const filters = calcModelOptions.config && calcModelOptions.config.filters;
5344
5105
 
5345
- const filterFields = [];
5346
- const valueFields = [];
5347
- const dateFields = [];
5348
- const dataTypeFields = [];
5349
- const dataSeriesFields = [];
5350
-
5351
- let scenarioField = lodash.get(calcModelOptions, 'config.scenario', undefined) || fieldScenarioAlias || fieldScenario;
5352
- let fieldOb;
5353
-
5354
- const fillData = (fieldsArr, destinationArr) => {
5106
+ const fillData = (fieldsArr, ignoreFieldsIdToRemove = []) => {
5107
+ const destinationArr = [];
5355
5108
  lodash.forEach(fieldsArr, function (valObj) {
5356
- fieldOb = lodash.find(fields, { id: valObj.id });
5109
+ const fieldOb = lodash.find(fields, { id: valObj.id });
5357
5110
  if (fieldOb) {
5358
5111
  destinationArr.push(fieldOb);
5359
- lodash.remove(fields, { id: fieldOb.id });
5112
+ !ignoreFieldsIdToRemove.includes(fieldOb.id) && lodash.remove(fields, { id: fieldOb.id });
5360
5113
  }
5361
5114
  });
5115
+
5116
+ return destinationArr;
5117
+ }
5118
+
5119
+ const canAssignPredefinedField = (() => {
5120
+ const assignedFields = {};
5121
+
5122
+ return function (predefinedData, type, field, bindValue, oppositeValue) {
5123
+ if (!assignedFields[type]) {
5124
+ assignedFields[type] = [];
5125
+ }
5126
+
5127
+ const isFieldMatch = predefinedData.regex.test((field[bindValue] || ''));
5128
+
5129
+ const isFieldTypeCorrect = predefinedData.allowedFieldTypes
5130
+ ? predefinedData.allowedFieldTypes.includes(field.type) : true;
5131
+
5132
+ const isFieldAssigned = assignedFields[type].includes(field[bindValue].toLowerCase())
5133
+ || assignedFields[type].includes(field[oppositeValue].toLowerCase());
5134
+
5135
+ if (!(isFieldMatch && isFieldTypeCorrect)) return false;
5136
+
5137
+ const loweredFieldValue = field[bindValue].toLowerCase();
5138
+ assignedFields[type].push(loweredFieldValue, loweredFieldValue.replaceAll('_', ' '));
5139
+
5140
+ return !isFieldAssigned;
5141
+ }
5142
+ })();
5143
+
5144
+ const predefinedField = {
5145
+ value: {
5146
+ regex: /posting[_\s]amount/i,
5147
+ allowedFieldTypes: ['Float', 'Integer'],
5148
+ fields: [],
5149
+ },
5150
+ dataType: {
5151
+ regex: /data[_\s]type/i,
5152
+ allowedFieldTypes: ['Text'],
5153
+ fields: [],
5154
+ },
5155
+ date: {
5156
+ regex: /reporting[_\s]month/i,
5157
+ allowedFieldTypes: ['Date'],
5158
+ fields: [],
5159
+ },
5160
+ filters: {
5161
+ isMultipleFields: true,
5162
+ regex: /^(scenario|DR_ACC_L0)$/i,
5163
+ fields: [],
5164
+ },
5165
+ dataSeries: {
5166
+ isMultipleFields: true,
5167
+ regex: /^(scenario|account[_\s]full|entity|intercompany|posting[_\s]currency|reporting[_\s]currency|report[_\s]field|USER_TO_DR_ACC_KEY|USER_TO_DR_KPI_KEY)$/i,
5168
+ fields: [],
5169
+ },
5170
+ };
5171
+
5172
+ if (!lodash.get(calcModelOptions, 'config', false)) {
5173
+ /**
5174
+ * alias stronger than name (order in array is important)
5175
+ * Firstly we try to get predefined field by aliases and then fill in by names
5176
+ * */
5177
+ const fieldsDataQueueConfig = [
5178
+ { value: 'alias', opposite: 'name' },
5179
+ { value: 'name', opposite: 'alias' }
5180
+ ];
5181
+
5182
+ for (const key in predefinedField) {
5183
+ lodash.forEach(fieldsDataQueueConfig, ({value, opposite}) => {
5184
+ const ignoredFields = predefinedField[key].ignoreAssignedFields;
5185
+ const result = predefinedField[key].isMultipleFields
5186
+ ? lodash.filter(fields, field => canAssignPredefinedField(predefinedField[key], key, field, value, opposite, ignoredFields))
5187
+ : [lodash.find(fields, field => canAssignPredefinedField(predefinedField[key], key, field, value, opposite, ignoredFields))].filter(f => !!f);
5188
+
5189
+ if (result && result.length) {
5190
+ predefinedField[key].fields.push(...result);
5191
+ }
5192
+ });
5193
+ }
5362
5194
  }
5363
5195
 
5196
+ const filters = lodash.get(calcModelOptions, 'config.filters', predefinedField.filters.fields);
5197
+
5364
5198
  lodash.forEach(filters, function (filterObj) {
5365
- fieldOb = lodash.find(fields, { id: filterObj.id });
5199
+ const fieldOb = lodash.find(fields, { id: filterObj.id });
5366
5200
  if (!fieldOb) return;
5367
5201
 
5368
5202
  filterObj.values = filterObj.values && lodash.map(filterObj.values, highchartsRenderer.decodeFunc);
@@ -5380,16 +5214,23 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
5380
5214
  }
5381
5215
  });
5382
5216
 
5383
- const storedGroupByFields = lodash.get(calcModelOptions, 'config.group_by', []);
5384
- const storedDateFields = [lodash.get(calcModelOptions, 'config.date_field', undefined)].filter(f => !!f);
5385
- const storedAggFields = [lodash.get(calcModelOptions, 'config.agg_field', undefined)].filter(f => !!f);
5386
- const storedDataTypeFields = [lodash.get(calcModelOptions, 'config.data_type_field', undefined)].filter(f => !!f);
5217
+ const storedGroupByFields = lodash.get(calcModelOptions, 'config.group_by', predefinedField.dataSeries.fields);
5218
+ const storedDateFields = [lodash.get(calcModelOptions, 'config.date_field', predefinedField.date.fields[0])].filter(f => !!f);
5219
+ const storedAggFields = [lodash.get(calcModelOptions, 'config.agg_field', predefinedField.value.fields[0])].filter(f => !!f);
5220
+ const storedDataTypeFields = [lodash.get(calcModelOptions, 'config.data_type_field', predefinedField.dataType.fields[0])].filter(f => !!f);
5221
+ const scenarioField = lodash.get(calcModelOptions, 'config.scenario', lodash.find(predefinedField.filters.fields, filter => [filter.name, filter.alias].includes('scenario')));
5222
+
5223
+ /**
5224
+ * We can have several common fields, so we should ignore deleting during fillData
5225
+ * */
5226
+ const commonFieldsId = [scenarioField.id];
5227
+ const filterFields = fillData(filters, commonFieldsId);
5228
+ const valueFields = fillData(storedAggFields, commonFieldsId);
5229
+ const dateFields = fillData(storedDateFields, commonFieldsId);
5230
+ const dataTypeFields = fillData(storedDataTypeFields, commonFieldsId);
5231
+ const dataSeriesFields = fillData(storedGroupByFields, commonFieldsId);
5387
5232
 
5388
- fillData(storedGroupByFields, dataSeriesFields);
5389
- fillData(storedDateFields, dateFields);
5390
- fillData(storedAggFields, valueFields);
5391
- fillData(storedDataTypeFields, dataTypeFields);
5392
- fillData(filters, filterFields);
5233
+ lodash.remove(fields, _field => commonFieldsId.includes(_field.id));
5393
5234
 
5394
5235
  calcModelOptions.pivot = {
5395
5236
  fieldsArray: fields,
@@ -5897,7 +5738,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
5897
5738
  return valToReturn;
5898
5739
  };
5899
5740
 
5900
-
5741
+
5901
5742
  highchartsRenderer.getChartAxisLabel = function(type) {
5902
5743
  return highchartsRenderer.chartsTypesInfo[type] ? highchartsRenderer.chartsTypesInfo[type].axisName : CHART_AXIS_DEFAULT_LABEL;
5903
5744
  };
@@ -6732,7 +6573,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
6732
6573
  value_name: 'show',
6733
6574
  default_value: true,
6734
6575
  disabled_str: '!{var}.show_out_of_x_axis && !{var}.show_out_of_data_series && !{var}.show_value && !{var}.show_x_axis && !{var}.show_data_series',
6735
- disabled_fn: (value) => !value.show_out_of_x_axis
6576
+ disabled_fn: (value) => !value.show_out_of_x_axis
6736
6577
  && !value.show_out_of_data_series
6737
6578
  && !value.show_value
6738
6579
  && !value.show_x_axis
@@ -6773,8 +6614,8 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
6773
6614
  element_label: '[X Axis]',
6774
6615
  value_name: 'show_x_axis',
6775
6616
  default_value: true,
6776
- clickFn: (value) => value.show = value.show
6777
- ? value.show_out_of_x_axis || value.show_out_of_data_series || value.show_value || value.show_x_axis || value.show_data_series
6617
+ clickFn: (value) => value.show = value.show
6618
+ ? value.show_out_of_x_axis || value.show_out_of_data_series || value.show_value || value.show_x_axis || value.show_data_series
6778
6619
  : value.show,
6779
6620
  },
6780
6621
  {
@@ -6782,8 +6623,8 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
6782
6623
  element_label: '[Data Series]',
6783
6624
  value_name: 'show_data_series',
6784
6625
  default_value: true,
6785
- clickFn: (value) => value.show = value.show
6786
- ? value.show_out_of_x_axis || value.show_out_of_data_series || value.show_value || value.show_x_axis || value.show_data_series
6626
+ clickFn: (value) => value.show = value.show
6627
+ ? value.show_out_of_x_axis || value.show_out_of_data_series || value.show_value || value.show_x_axis || value.show_data_series
6787
6628
  : value.show,
6788
6629
  },
6789
6630
  {
@@ -6791,8 +6632,8 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
6791
6632
  element_label: 'Value',
6792
6633
  value_name: 'show_value',
6793
6634
  default_value: true,
6794
- clickFn: (value) => value.show = value.show
6795
- ? value.show_out_of_x_axis || value.show_out_of_data_series || value.show_value || value.show_x_axis || value.show_data_series
6635
+ clickFn: (value) => value.show = value.show
6636
+ ? value.show_out_of_x_axis || value.show_out_of_data_series || value.show_value || value.show_x_axis || value.show_data_series
6796
6637
  : value.show,
6797
6638
  },
6798
6639
  {
@@ -6800,8 +6641,8 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
6800
6641
  element_label: '% Out of [X Axis]',
6801
6642
  value_name: 'show_out_of_x_axis',
6802
6643
  default_value: false,
6803
- clickFn: (value) => value.show = value.show
6804
- ? value.show_out_of_x_axis || value.show_out_of_data_series || value.show_value || value.show_x_axis || value.show_data_series
6644
+ clickFn: (value) => value.show = value.show
6645
+ ? value.show_out_of_x_axis || value.show_out_of_data_series || value.show_value || value.show_x_axis || value.show_data_series
6805
6646
  : value.show,
6806
6647
  },
6807
6648
  {
@@ -6809,8 +6650,8 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
6809
6650
  element_label: '% Out of [Data Series]',
6810
6651
  value_name: 'show_out_of_data_series',
6811
6652
  default_value: false,
6812
- clickFn: (value) => value.show = value.show
6813
- ? value.show_out_of_x_axis || value.show_out_of_data_series || value.show_value || value.show_x_axis || value.show_data_series
6653
+ clickFn: (value) => value.show = value.show
6654
+ ? value.show_out_of_x_axis || value.show_out_of_data_series || value.show_value || value.show_x_axis || value.show_data_series
6814
6655
  : value.show,
6815
6656
  },
6816
6657
  ]
@@ -6984,16 +6825,16 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
6984
6825
  value_name: 'name',
6985
6826
  element_label: 'Name',
6986
6827
  default_value: '_Variance'
6987
- }, {
6988
- element_type: 'input',
6989
- value_name: 'formula',
6990
- element_label: 'Formula',
6991
- default_value: 'x2-x1'
6992
6828
  }, {
6993
6829
  element_type: 'input',
6994
- value_name: 'color',
6995
- element_label: 'Color',
6996
- default_value: ''
6830
+ value_name: 'formula',
6831
+ element_label: 'Formula',
6832
+ default_value: 'x2-x1'
6833
+ }, {
6834
+ element_type: 'input',
6835
+ value_name: 'color',
6836
+ element_label: 'Color',
6837
+ default_value: ''
6997
6838
  }, {
6998
6839
  element_type: 'radio',
6999
6840
  value_name: 'chart',
@@ -7116,17 +6957,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
7116
6957
  axisTooltipDescription: 'The category (usually an independent variable) is shown on the x-axis and should be between 2 to 5 total columns. ',
7117
6958
  legendTooltipTitle: 'Drag one field to further configure your x-axis.',
7118
6959
  legendTooltipDescription: 'The breakdown subdivides the chart by a category field for further analysis of what’s contributing to the increase or decrease.',
7119
- },
7120
- [highchartsRenderer.CHART_TYPES.WATERFALL_WALKTHROUGH]: {
7121
- name: 'Waterfall Walkthrough Chart ',
7122
- label: 'Waterfall Walkthrough Chart ',
7123
- title: 'TODO: add text',
7124
- description: 'TODO: add text',
7125
- axisName: 'Category',
7126
- startedMessage: 'TODO: add text',
7127
- axisTooltipTitle: 'TODO: add text',
7128
- legendTooltipTitle: 'TODO: add text',
7129
- },
6960
+ },
7130
6961
  'combo-chart': {
7131
6962
  name: 'Combo Chart ',
7132
6963
  label: 'Combo Chart ',
@@ -7782,24 +7613,6 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
7782
7613
  highchartsRenderer.suboptions["legends"],
7783
7614
  ]
7784
7615
  },
7785
- {
7786
- type: highchartsRenderer.CHART_TYPES.WATERFALL_WALKTHROUGH,
7787
- name: highchartsRenderer.chartsTypesInfo[highchartsRenderer.CHART_TYPES.WATERFALL_WALKTHROUGH].name,
7788
- class: 'google-visualization-charteditor-thumbs-columnchart',
7789
- render: highchartsRenderer.ptRenderWaterfallWalkthrough,
7790
- suboptions: [
7791
- highchartsRenderer.suboptions["axisX"],
7792
- highchartsRenderer.suboptions["tooltips"],
7793
- highchartsRenderer.suboptions["label"],
7794
- highchartsRenderer.suboptions["subtitle"],
7795
- highchartsRenderer.suboptions["widget_library"],
7796
- highchartsRenderer.suboptions["chart"],
7797
- highchartsRenderer.suboptions["negative_number_format"],
7798
- highchartsRenderer.suboptions["advanced"],
7799
- highchartsRenderer.suboptions["legends"],
7800
- ],
7801
- hidden: true,
7802
- },
7803
7616
  ]
7804
7617
  },
7805
7618
  ];
@@ -7956,7 +7769,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
7956
7769
  _.forEach(Object.keys(dates), key => {
7957
7770
  const dateConfiguration = dates[key];
7958
7771
  const timestamp = dateConfiguration.timestamp;
7959
- if (timestamp) {
7772
+ if (timestamp) {
7960
7773
  const dateTzOffsetInSeconds = new Date(timestamp * 1000).getTimezoneOffset() * 60;
7961
7774
  dateConfiguration.displayedValue = new Date((timestamp + dateTzOffsetInSeconds) * 1000)
7962
7775
  .toLocaleDateString();
@@ -8255,7 +8068,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
8255
8068
  if (!(format && highchartsRenderer.isDateFormat(dateString, format) || highchartsRenderer.isDate(dateString))) {
8256
8069
  return null;
8257
8070
  }
8258
- const utcDate = format
8071
+ const utcDate = format
8259
8072
  ? moment_lib.utc(dateString, format, true)
8260
8073
  : moment_lib.utc(dateString);
8261
8074
  return utcDate.startOf('day').unix();
@@ -8273,7 +8086,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
8273
8086
  }
8274
8087
 
8275
8088
  let filters = [];
8276
-
8089
+
8277
8090
  if (widget.chart_type === highchartsRenderer.CHART_TYPES.WATERFALL_BREAKDOWN) {
8278
8091
  const colFilter = highchartsRenderer.createFilterObject(widget.cols[0]);
8279
8092
  const labels = [];
@@ -8301,7 +8114,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
8301
8114
  col_value,
8302
8115
  highchartsRenderer.getDateFieldFormat(widget, widget.cols[index])
8303
8116
  );
8304
-
8117
+
8305
8118
  if ($.isEmptyObject(datetrange)) {
8306
8119
  return;
8307
8120
  }
@@ -8544,7 +8357,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
8544
8357
  var data = res;
8545
8358
 
8546
8359
  lodash.forEach(datesFields, function (row) {
8547
- row.val_not_convert = highchartsRenderer.check_values_not_for_convert(widget, row.name);
8360
+ row.val_not_convert = highchartsRenderer.check_value_not_for_convert(widget, row.name);
8548
8361
  });
8549
8362
 
8550
8363
  if (datesFields.length > 0) {
@@ -8950,14 +8763,14 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
8950
8763
  return rightPosition;
8951
8764
  case 'none':
8952
8765
  return none;
8953
- }
8954
- } else if (isLine) {
8955
- return useNewUx ? leftPosition : rightPosition;
8956
- } else if (isPie) {
8957
- return useNewUx ? rightPosition : topPosition;
8958
8766
  }
8767
+ } else if (isLine) {
8768
+ return useNewUx ? leftPosition : rightPosition;
8769
+ } else if (isPie) {
8770
+ return useNewUx ? rightPosition : topPosition;
8771
+ }
8959
8772
 
8960
- return useNewUx ? topPosition : bottomPosition;
8773
+ return useNewUx ? topPosition : bottomPosition;
8961
8774
  }
8962
8775
 
8963
8776
  highchartsRenderer.setYAxisMinMax = function (yAxis, axisYOptions) {
@@ -8972,7 +8785,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
8972
8785
  }
8973
8786
 
8974
8787
  highchartsRenderer.getDateFieldFormat = function(widget, dateField) {
8975
- const aggregationConfig = widget.options && widget.options.date_aggregation_configs
8788
+ const aggregationConfig = widget.options && widget.options.date_aggregation_configs
8976
8789
  ? _.find(widget.options.date_aggregation_configs, { field_id: dateField.id })
8977
8790
  : null;
8978
8791
 
@@ -9022,10 +8835,6 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
9022
8835
  }
9023
8836
  }
9024
8837
 
9025
- highchartsRenderer.getTrendSeriesName = function(series) {
9026
- return series.name ? 'Trend Line (' + series.name + ')' : 'Trend Line';
9027
- }
9028
-
9029
8838
  return highchartsRenderer;
9030
8839
  };
9031
8840
 
package/babel.config.js DELETED
@@ -1,3 +0,0 @@
1
- module.exports = {
2
- presets: [['@babel/preset-env', {targets: {node: 'current'}}]],
3
- };
package/jest.config.js DELETED
@@ -1,27 +0,0 @@
1
- module.exports = {
2
- clearMocks: true,
3
- setupFilesAfterEnv: ['regenerator-runtime/runtime'],
4
- testPathIgnorePatterns: [
5
- "/node_modules/",
6
- ],
7
- transformIgnorePatterns: [
8
- "<rootDir>/node_modules/(?!jquery|lodash|moment/)",
9
- ],
10
- collectCoverage: true,
11
- collectCoverageFrom: [
12
- '**/*.js',
13
- '!**/*.config.js',
14
- '!**/build/**',
15
- '!**/coverage/**',
16
- '!**/node_modules/**',
17
- '!**/vendor/**'
18
- ],
19
- // coverageThreshold: {
20
- // "global": {
21
- // "branches": 100,
22
- // "functions": 100,
23
- // "lines": 100,
24
- // "statements": 100
25
- // }
26
- // },
27
- };
@@ -1,48 +0,0 @@
1
- import * as $ from 'jquery';
2
- import * as lodash from 'lodash';
3
- import * as moment from 'moment';
4
- import initPivotTable from "../src/pivottable";
5
- import initDRPivotTable from "../src/dr_pivottable";
6
-
7
- const getHighchartsRenderer = require('../src/highcharts_renderer');
8
- const DataFormatter = require('../src/dataformatter');
9
- const DEFAULT_USER_COLORS = {
10
- colors: ['#008aff', '#91e7e7', '#f37789', '#ffdc65', '#0e569d', '#bbe0ff', '#57b2ff', '#5ecfb9', '#c7ffda', '#179ab9'],
11
- variance_color: null
12
- };
13
-
14
- let highchartsRenderer = {};
15
- let _window = window;
16
- let _document = document;
17
-
18
- describe('highcharts_renderer', () => {
19
- beforeAll(() => {
20
- const Highcharts = {
21
- opt: {},
22
- setOptions: function(value) {Highcharts.opt = value;},
23
- numberFormat: function(value) { return value ;},
24
- getOptions: function() { return Highcharts.opt; }
25
- };
26
- _window.DataFormatter = DataFormatter;
27
- initPivotTable($, _window, _document);
28
- initDRPivotTable($, _window, _document);
29
-
30
- highchartsRenderer = getHighchartsRenderer($, _document, Highcharts, DEFAULT_USER_COLORS, highchartsRenderer,
31
- DataFormatter, lodash, moment, true)
32
- })
33
-
34
- describe('function isSystemField', () => {
35
- it('system name', () => {
36
- const field = {
37
- name: 'Doc_ID'
38
- };
39
- expect(highchartsRenderer.isSystemField(field)).toBe(true)
40
- });
41
- it('not system name', () => {
42
- const field = {
43
- name: 'field name'
44
- };
45
- expect(highchartsRenderer.isSystemField(field)).toBe(false)
46
- });
47
- });
48
- });