@datarailsshared/dr_renderer 1.2.233-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.233-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,6 +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
  }
650
+
656
651
  try {
657
652
  if (is_drill_down_pie && !highchartsRenderer.selfStartsWith(series_name,"Series ")) {
658
653
  let temp = cols;
@@ -660,9 +655,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
660
655
  rows = temp;
661
656
  }
662
657
 
663
- var category_text = `<span style="font-weight: bold;">
664
- ${ lodash.get(this, 'point.options.colsForTotal') ? isWaterfallWalkthrough ? this.key : cols[0] : cols } ${ isWaterfallBreakdown ? ': ' : ' ' }
665
- </span>`;
658
+ var category_text = `<span style="font-weight: bold;">${ cols }${ isWaterfallBreakdown ? ': ' : ' ' }</span>`;
666
659
  if (this.category) {
667
660
  category_text = '';
668
661
  }
@@ -671,7 +664,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
671
664
  series_text += ': '
672
665
  }
673
666
 
674
- if (pivotData.rowAttrs.length == 0 && !isTrendSeries) {
667
+ if (pivotData.rowAttrs.length == 0) {
675
668
  series_text = ': ';
676
669
  }
677
670
 
@@ -679,15 +672,13 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
679
672
  const modifiedRowsAndCols = highchartsRenderer.transformRowsAndColsForBreakdown(rows, cols, this.point, opts);
680
673
  rows = modifiedRowsAndCols.rows;
681
674
  cols = modifiedRowsAndCols.cols;
682
- }
675
+ }
683
676
 
684
677
  var aggr = pivotData.getAggregator(rows, cols);
685
678
 
686
679
  let formatted_value_to_return = $.pivotUtilities.getFormattedNumber(y, null, opts);
687
680
  if (aggr.value() || isWaterfallBreakdown) {
688
- formatted_value_to_return = $.pivotUtilities.getFormattedNumber(
689
- isWaterfallBreakdown || isWaterfallWalkthrough || isTrendSeries ? y : aggr.value(), aggr, opts
690
- );
681
+ formatted_value_to_return = $.pivotUtilities.getFormattedNumber(isWaterfallBreakdown ? y : aggr.value(), aggr, opts);
691
682
  }
692
683
 
693
684
  let wrappedFormattedValue = highchartsRenderer.getSpanWrapper(formatted_value_to_return);
@@ -1094,7 +1085,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
1094
1085
 
1095
1086
  const trendSeries = lodash.clone(chart_series[chart_series.length - 1]);
1096
1087
  trendSeries.className = 'trendSeries';
1097
- trendSeries.name = highchartsRenderer.getTrendSeriesName(trendSeries);
1088
+ trendSeries.name = 'Trend Line (' + trendSeries.name + ')';
1098
1089
  trendSeries.dashStyle = 'shortdot';
1099
1090
  trendSeries.type = 'line';
1100
1091
  trendSeries.data = trendSeries.data.map((el, index) => a + b * (index + 1));
@@ -1263,7 +1254,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
1263
1254
 
1264
1255
  const trendSeries = lodash.clone(chart_series[chart_series.length - 1]);
1265
1256
  trendSeries.className = 'trendSeries';
1266
- trendSeries.name = highchartsRenderer.getTrendSeriesName(trendSeries);
1257
+ trendSeries.name = 'Trend Line (' + trendSeries.name + ')';
1267
1258
  trendSeries.dashStyle = 'shortdot';
1268
1259
  trendSeries.type = 'line';
1269
1260
  trendSeries.data = trendSeries.data.map((data, index) => ({name: data.name, y: a + b * (index + 1)}));
@@ -1423,89 +1414,6 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
1423
1414
  return chart_series;
1424
1415
  }
1425
1416
 
1426
- highchartsRenderer.ptCreateWaterfallWalkthroughSeries = function (pivotData, onlyNumbers, additionOptions, opts) {
1427
- const waterfallOptions = opts.walkthrough_options;
1428
- const chart_series = [];
1429
- let resultObject = {
1430
- data: [],
1431
- dataLabels: {
1432
- allowOverlap: additionOptions && additionOptions.label ? additionOptions.label.overlap : false,
1433
- enabled: additionOptions && additionOptions.label ? additionOptions.label.show : true,
1434
- formatter: highchartsRenderer.defaultDataLabelFormatter(pivotData, {'chartOptions': additionOptions, total_value_options: opts.total_value_options}),
1435
- style: highchartsRenderer.getDataLabelsStyle(additionOptions),
1436
- },
1437
- upColor: waterfallOptions.colors.increase,
1438
- color: waterfallOptions.colors.decrease,
1439
- className: SERIES_CLASSNAMES.WATERFALL_WALKTHROUGH
1440
- };
1441
- resultObject = highchartsRenderer.getDataLabelsOptions(additionOptions, resultObject);
1442
- lodash.forEach(waterfallOptions.values.walkthrough, function(value, index) {
1443
-
1444
- let keys = [];
1445
- if (value.trend === 'total') {
1446
- keys = ['Total'];
1447
- } else {
1448
- _.forEach(value.key, (item) => {
1449
- const findKeyByValue = Object.keys(pivotData.dateValuesDictionary || {}).find(key => pivotData.dateValuesDictionary[key] === item);
1450
- keys.push(findKeyByValue ? findKeyByValue : item);
1451
- })
1452
- }
1453
-
1454
- const agg = pivotData.getAggregator([], keys);
1455
- let val = agg.value();
1456
-
1457
- if (val != null && $.isNumeric(val)) {
1458
- val = parseFloat(val);
1459
- } else if (onlyNumbers) {
1460
- val = NaN;
1461
- } else {
1462
- val = 0;
1463
- }
1464
-
1465
- if (value.trend === 'decrease') {
1466
- val = val * -1;
1467
- }
1468
-
1469
- const name = value.trend === 'total' ? value.formattedKey || value.key[0] : keys.join(highchartsRenderer.delimer);
1470
- let color = '';
1471
- if (value.trend !== 'total') {
1472
- if (index === 0 && !firstBarColor) {
1473
- color = waterfallOptions.colors.total;
1474
- firstBarColor = waterfallOptions.colors.total;
1475
- } else {
1476
- color = value.color
1477
- }
1478
- } else {
1479
- color = waterfallOptions.colors.total;
1480
- }
1481
-
1482
- resultObject.data.push({
1483
- y: val,
1484
- name: lodash.unescape(name).replace('DR_Others', highchartsRenderer.getOthersName(opts)),
1485
- isSum: value.trend === 'total',
1486
- isTotal: value.trend === 'total',
1487
- color,
1488
- colsForTotal: value.trend === 'total' ? keys : null,
1489
- });
1490
- });
1491
- chart_series.push(resultObject);
1492
- chart_series.push(
1493
- {
1494
- name: 'Positive',
1495
- visible: false,
1496
- color: waterfallOptions.colors.increase
1497
- });
1498
-
1499
- chart_series.push(
1500
- {
1501
- name: 'Negative',
1502
- visible: false,
1503
- color: waterfallOptions.colors.decrease
1504
- });
1505
-
1506
- return chart_series;
1507
- }
1508
-
1509
1417
  highchartsRenderer.setChartTypeBySeriesType = function (type, series) {
1510
1418
  const types = {
1511
1419
  'line-chart': 'line',
@@ -1709,7 +1617,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
1709
1617
  highchartsRenderer.getDataLabelsStylesForDrillDown = function(additionOptions) {
1710
1618
  let result = highchartsRenderer.getDataLabelsOptions(additionOptions, { dataLabels: {} });
1711
1619
 
1712
- if (!result.dataLabels) return {};
1620
+ if (!result.dataLabels) return {};
1713
1621
  return {
1714
1622
  activeDataLabelStyle: {
1715
1623
  color: result.dataLabels.color,
@@ -3265,7 +3173,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
3265
3173
 
3266
3174
  highchartsRenderer.ptRenderWaterfallBreakdown = function (pivotData, opts, drilldownFunc, chartType) {
3267
3175
  let chartOptions = {};
3268
- const additionOptions = opts.chartOptions
3176
+ const additionOptions = opts.chartOptions
3269
3177
  ? opts.chartOptions
3270
3178
  : highchartsRenderer.getDefaultValueForChart(highchartsRenderer.CHART_TYPES.WATERFALL_BREAKDOWN);
3271
3179
 
@@ -3364,121 +3272,6 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
3364
3272
  return highchartsRenderer.ptCreateElementAndDraw(chartOptions, opts);
3365
3273
  };
3366
3274
 
3367
- highchartsRenderer.ptRenderWaterfallWalkthrough = function (pivotData, opts) {
3368
- let chartOptions = {};
3369
- const waterfallOptions = opts?.walkthrough_options;
3370
- const additionOptions = opts.chartOptions
3371
- ? opts.chartOptions
3372
- : highchartsRenderer.getDefaultValueForChart(highchartsRenderer.CHART_TYPES.WATERFALL_WALKTHROUGH);
3373
-
3374
- chartOptions.chart = {
3375
- type: 'waterfall',
3376
- zoomType: additionOptions && additionOptions.chart && additionOptions.chart.zoom_type ? additionOptions.chart.zoom_type : 'None',
3377
- };
3378
- if (disableAnimation) {
3379
- chartOptions.chart.animation = false;
3380
- }
3381
-
3382
- chartOptions.xAxis = {
3383
- type: 'category',
3384
- crosshair: true,
3385
- min: 0,
3386
- title: {
3387
- text : additionOptions && additionOptions.axisX ? additionOptions.axisX.name : '',
3388
- },
3389
- uniqueNames: false,
3390
- };
3391
-
3392
- highchartsRenderer.setTitleAndSubTitle(chartOptions, opts, additionOptions);
3393
-
3394
- chartOptions.yAxis = {
3395
- min: null,
3396
- max: null,
3397
- title: {
3398
- text: additionOptions && additionOptions.axisY ? additionOptions.axisY.name : '',
3399
- autoylabel: additionOptions && additionOptions.axisY ? additionOptions.axisY.autoylabel : ''
3400
- },
3401
- labels: {
3402
- formatter: highchartsRenderer.defaultValueLabelsFormatter(pivotData, opts)
3403
- },
3404
- };
3405
- if (additionOptions) {
3406
- highchartsRenderer.setYAxisMinMax(chartOptions.yAxis, additionOptions.axisY);
3407
- }
3408
-
3409
- chartOptions.tooltip = {
3410
- formatter: highchartsRenderer.defaultFormatterToTooltip(pivotData, opts),
3411
- valueDecimals: 2,
3412
- };
3413
-
3414
- highchartsRenderer.handleGridLines(additionOptions, chartOptions);
3415
-
3416
- if (lodash.get(opts, 'paletteOptions.widgetPalette', null)) {
3417
- const mc_palette = lodash.find(lodash.get(opts.paletteOptions, 'monochromePalettes', []), { selected: true });
3418
- chartOptions.colors = mc_palette ? mc_palette.colors : opts.paletteOptions.widgetPalette;
3419
- } else if (lodash.get(opts, 'paletteOptions.dashboardPalette.colors', null)) {
3420
- chartOptions.colors = opts.paletteOptions.dashboardPalette.colors;
3421
- }
3422
- chartOptions.series = highchartsRenderer
3423
- .ptCreateWaterfallWalkthroughSeries(pivotData, null, additionOptions, opts);
3424
-
3425
- chartOptions = highchartsRenderer.prepareAxisX(chartOptions, additionOptions, pivotData.getColKeys());
3426
- chartOptions.plotOptions = {
3427
- waterfall: {
3428
- pointPadding: 0.2,
3429
- borderWidth: 0,
3430
- borderRadius: 1,
3431
- lineWidth: 0,
3432
- },
3433
- series: {
3434
- animation: !disableAnimation,
3435
- cropThreshold: 1000,
3436
- dataLabels: {
3437
- allowOverlap: additionOptions && additionOptions.label ? additionOptions.label.overlap : false,
3438
- enabled: additionOptions && additionOptions.label ? additionOptions.label.show : true,
3439
- formatter: highchartsRenderer.defaultDataLabelFormatter(pivotData, opts),
3440
- style: highchartsRenderer.getDataLabelsStyle(additionOptions),
3441
- inside: false
3442
- },
3443
- events: {
3444
- legendItemClick: () => {
3445
- return false;
3446
- }
3447
- }
3448
- }
3449
- };
3450
-
3451
- if (opts.drillDownListFunc) {
3452
- chartOptions.plotOptions.series.cursor = 'pointer';
3453
- chartOptions.plotOptions.series.point = {
3454
- events: {
3455
- click: opts.drillDownListFunc
3456
- }
3457
- };
3458
- }
3459
- if (waterfallOptions.colors) {
3460
- chartOptions.legend = highchartsRenderer.getOptionsForLegends(additionOptions, 3, false);
3461
- chartOptions.legend.useHTML = true;
3462
- chartOptions.legend.labelFormatter = function() {
3463
- const name = this.options.className ? 'Total': this.name;
3464
- const findTotal = _.find(this.options.data, {isTotal: true});
3465
- const color = findTotal?.color ? findTotal.color : this.color;
3466
- 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>';
3467
- }
3468
-
3469
- chartOptions.legend.symbolPadding = 0;
3470
- chartOptions.legend.symbolWidth = 0;
3471
- chartOptions.legend.symbolHeight = 0;
3472
- chartOptions.legend.squareSymbol = false;
3473
- } else {
3474
- chartOptions.legend = {
3475
- enabled: false
3476
- }
3477
- }
3478
-
3479
- return highchartsRenderer.ptCreateElementAndDraw(chartOptions, opts);
3480
- }
3481
-
3482
3275
  highchartsRenderer.formatFieldValue = function (field, value) {
3483
3276
  let currentType = '';
3484
3277
  let format = field.format;
@@ -4547,17 +4340,6 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
4547
4340
  }
4548
4341
  };
4549
4342
 
4550
- highchartsRenderer.waterfallConstants = {
4551
- [highchartsRenderer.CHART_TYPES.WATERFALL_BREAKDOWN]: {
4552
- minCategoriesCount: 2,
4553
- maxCategoriesCount: 5,
4554
- },
4555
- [highchartsRenderer.CHART_TYPES.WATERFALL_WALKTHROUGH]: {
4556
- minCategoriesCount: 2,
4557
- maxCategoriesCount: 10,
4558
- }
4559
- };
4560
-
4561
4343
  highchartsRenderer.rhPivotView = function (rowData, options, isTable = false, widget = null) {
4562
4344
  if (!rowData || !rowData) {
4563
4345
  if (options.onlyOptions) {
@@ -4566,28 +4348,16 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
4566
4348
  return null;
4567
4349
  }
4568
4350
 
4569
- const isWalktrough = lodash.get(widget, 'chart_type') === highchartsRenderer.CHART_TYPES.WATERFALL_WALKTHROUGH;
4570
- const isBreakdown = lodash.get(widget, 'chart_type')=== highchartsRenderer.CHART_TYPES.WATERFALL_BREAKDOWN;
4571
- const isWaterfall = isWalktrough || isBreakdown;
4572
-
4573
- if (isWaterfall) {
4574
- const maxCategories = highchartsRenderer.waterfallConstants[widget.chart_type].maxCategoriesCount;
4575
- const minCategories = highchartsRenderer.waterfallConstants[widget.chart_type].minCategoriesCount;
4576
- let uniqueCategories = [];
4577
-
4578
- if (isBreakdown) {
4579
- uniqueCategories = lodash.filter(
4580
- lodash.uniq(
4581
- lodash.map(rowData, row => row[widget.cols[0].name])
4582
- ),
4583
- value => !!value
4584
- );
4585
- } else {
4586
- uniqueCategories = lodash.filter(
4587
- lodash.get(widget, 'options.walkthrough_options.values.walkthrough'),
4588
- (category) => category.trend !== 'total'
4589
- );
4590
- }
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;
4355
+ const uniqueCategories = lodash.filter(
4356
+ lodash.uniq(
4357
+ lodash.map(rowData, row => row[widget.cols[0].name])
4358
+ ),
4359
+ value => !!value
4360
+ );
4591
4361
 
4592
4362
  if (uniqueCategories && (uniqueCategories.length > maxCategories || uniqueCategories.length < minCategories )) {
4593
4363
  options.error_has_occurred = true;
@@ -4839,25 +4609,19 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
4839
4609
  return highchartsRenderer.getWeekNumber(dateObj);
4840
4610
  };
4841
4611
 
4842
- highchartsRenderer.check_values_not_for_convert = function (currentgraph, field_name) {
4843
- let vals_not_convert = [];
4612
+ highchartsRenderer.check_value_not_for_convert = function (currentgraph, field_name) {
4613
+ let val_not_convert = null;
4844
4614
  if (lodash.has(currentgraph, "options.chartOptions.delta_column") && currentgraph.options.chartOptions.delta_column) {
4845
4615
  let delta_options = currentgraph.options.chartOptions.delta_column;
4846
4616
  if (delta_options.field == 'series' && currentgraph.rows && currentgraph.rows[0] &&
4847
4617
  currentgraph.rows[0].name == field_name) {
4848
- vals_not_convert = [delta_options.name];
4618
+ val_not_convert = delta_options.name;
4849
4619
  } else if (delta_options.field == 'category' && currentgraph.rows && currentgraph.cols[0] &&
4850
4620
  currentgraph.cols[0].name == field_name) {
4851
- vals_not_convert = [delta_options.name];
4621
+ val_not_convert = delta_options.name;
4852
4622
  }
4853
- } else if (currentgraph.chart_type === highchartsRenderer.CHART_TYPES.WATERFALL_WALKTHROUGH) {
4854
- lodash.forEach(currentgraph.options.walkthrough_options.values.walkthrough, value => {
4855
- if (value.trend === 'total') {
4856
- vals_not_convert.push(value.key[0]);
4857
- }
4858
- });
4859
4623
  }
4860
- return vals_not_convert;
4624
+ return val_not_convert;
4861
4625
  };
4862
4626
 
4863
4627
  highchartsRenderer.updateFiltersShowNames = function (filters) {
@@ -4877,8 +4641,8 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
4877
4641
  })
4878
4642
  };
4879
4643
 
4880
- highchartsRenderer.returnRawDataValue = function (type, value, format, field_name, vals_not_for_convert) {
4881
- 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) {
4882
4646
  return value;
4883
4647
  }
4884
4648
 
@@ -4974,7 +4738,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
4974
4738
  };
4975
4739
 
4976
4740
  highchartsRenderer.isSystemField = function (field) {
4977
- 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");
4978
4742
 
4979
4743
  return (field.category && field.category.includes("")) || regex.test(field.name)
4980
4744
  };
@@ -5337,34 +5101,102 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
5337
5101
 
5338
5102
  highchartsRenderer.addTemplateDataToCalcModel = function (selectedTemplate, calcModelOptions) {
5339
5103
  highchartsRenderer.setWidgetFieldsToTemplate(selectedTemplate);
5340
-
5341
- const scenarioName = 'scenario';
5342
5104
  const fields = highchartsRenderer.objectCopyJsonMethod(selectedTemplate.fields);
5343
- const fieldScenarioAlias = _.find(fields, field => (field.alias || '').toLowerCase() === scenarioName)
5344
- const fieldScenario = _.find(fields, field => (field.name || '').toLowerCase() === scenarioName)
5345
- const filters = calcModelOptions.config && calcModelOptions.config.filters;
5346
-
5347
- const filterFields = [];
5348
- const valueFields = [];
5349
- const dateFields = [];
5350
- const dataTypeFields = [];
5351
- const dataSeriesFields = [];
5352
5105
 
5353
- let scenarioField = lodash.get(calcModelOptions, 'config.scenario', undefined) || fieldScenarioAlias || fieldScenario;
5354
- let fieldOb;
5355
-
5356
- const fillData = (fieldsArr, destinationArr) => {
5106
+ const fillData = (fieldsArr, ignoreFieldsIdToRemove = []) => {
5107
+ const destinationArr = [];
5357
5108
  lodash.forEach(fieldsArr, function (valObj) {
5358
- fieldOb = lodash.find(fields, { id: valObj.id });
5109
+ const fieldOb = lodash.find(fields, { id: valObj.id });
5359
5110
  if (fieldOb) {
5360
5111
  destinationArr.push(fieldOb);
5361
- lodash.remove(fields, { id: fieldOb.id });
5112
+ !ignoreFieldsIdToRemove.includes(fieldOb.id) && lodash.remove(fields, { id: fieldOb.id });
5362
5113
  }
5363
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
+ }
5364
5194
  }
5365
5195
 
5196
+ const filters = lodash.get(calcModelOptions, 'config.filters', predefinedField.filters.fields);
5197
+
5366
5198
  lodash.forEach(filters, function (filterObj) {
5367
- fieldOb = lodash.find(fields, { id: filterObj.id });
5199
+ const fieldOb = lodash.find(fields, { id: filterObj.id });
5368
5200
  if (!fieldOb) return;
5369
5201
 
5370
5202
  filterObj.values = filterObj.values && lodash.map(filterObj.values, highchartsRenderer.decodeFunc);
@@ -5382,16 +5214,23 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
5382
5214
  }
5383
5215
  });
5384
5216
 
5385
- const storedGroupByFields = lodash.get(calcModelOptions, 'config.group_by', []);
5386
- const storedDateFields = [lodash.get(calcModelOptions, 'config.date_field', undefined)].filter(f => !!f);
5387
- const storedAggFields = [lodash.get(calcModelOptions, 'config.agg_field', undefined)].filter(f => !!f);
5388
- 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);
5389
5232
 
5390
- fillData(storedGroupByFields, dataSeriesFields);
5391
- fillData(storedDateFields, dateFields);
5392
- fillData(storedAggFields, valueFields);
5393
- fillData(storedDataTypeFields, dataTypeFields);
5394
- fillData(filters, filterFields);
5233
+ lodash.remove(fields, _field => commonFieldsId.includes(_field.id));
5395
5234
 
5396
5235
  calcModelOptions.pivot = {
5397
5236
  fieldsArray: fields,
@@ -5899,7 +5738,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
5899
5738
  return valToReturn;
5900
5739
  };
5901
5740
 
5902
-
5741
+
5903
5742
  highchartsRenderer.getChartAxisLabel = function(type) {
5904
5743
  return highchartsRenderer.chartsTypesInfo[type] ? highchartsRenderer.chartsTypesInfo[type].axisName : CHART_AXIS_DEFAULT_LABEL;
5905
5744
  };
@@ -6734,7 +6573,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
6734
6573
  value_name: 'show',
6735
6574
  default_value: true,
6736
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',
6737
- disabled_fn: (value) => !value.show_out_of_x_axis
6576
+ disabled_fn: (value) => !value.show_out_of_x_axis
6738
6577
  && !value.show_out_of_data_series
6739
6578
  && !value.show_value
6740
6579
  && !value.show_x_axis
@@ -6775,8 +6614,8 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
6775
6614
  element_label: '[X Axis]',
6776
6615
  value_name: 'show_x_axis',
6777
6616
  default_value: true,
6778
- clickFn: (value) => value.show = value.show
6779
- ? 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
6780
6619
  : value.show,
6781
6620
  },
6782
6621
  {
@@ -6784,8 +6623,8 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
6784
6623
  element_label: '[Data Series]',
6785
6624
  value_name: 'show_data_series',
6786
6625
  default_value: true,
6787
- clickFn: (value) => value.show = value.show
6788
- ? 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
6789
6628
  : value.show,
6790
6629
  },
6791
6630
  {
@@ -6793,8 +6632,8 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
6793
6632
  element_label: 'Value',
6794
6633
  value_name: 'show_value',
6795
6634
  default_value: true,
6796
- clickFn: (value) => value.show = value.show
6797
- ? 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
6798
6637
  : value.show,
6799
6638
  },
6800
6639
  {
@@ -6802,8 +6641,8 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
6802
6641
  element_label: '% Out of [X Axis]',
6803
6642
  value_name: 'show_out_of_x_axis',
6804
6643
  default_value: false,
6805
- clickFn: (value) => value.show = value.show
6806
- ? 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
6807
6646
  : value.show,
6808
6647
  },
6809
6648
  {
@@ -6811,8 +6650,8 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
6811
6650
  element_label: '% Out of [Data Series]',
6812
6651
  value_name: 'show_out_of_data_series',
6813
6652
  default_value: false,
6814
- clickFn: (value) => value.show = value.show
6815
- ? 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
6816
6655
  : value.show,
6817
6656
  },
6818
6657
  ]
@@ -6986,16 +6825,16 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
6986
6825
  value_name: 'name',
6987
6826
  element_label: 'Name',
6988
6827
  default_value: '_Variance'
6989
- }, {
6990
- element_type: 'input',
6991
- value_name: 'formula',
6992
- element_label: 'Formula',
6993
- default_value: 'x2-x1'
6994
6828
  }, {
6995
6829
  element_type: 'input',
6996
- value_name: 'color',
6997
- element_label: 'Color',
6998
- 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: ''
6999
6838
  }, {
7000
6839
  element_type: 'radio',
7001
6840
  value_name: 'chart',
@@ -7118,17 +6957,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
7118
6957
  axisTooltipDescription: 'The category (usually an independent variable) is shown on the x-axis and should be between 2 to 5 total columns. ',
7119
6958
  legendTooltipTitle: 'Drag one field to further configure your x-axis.',
7120
6959
  legendTooltipDescription: 'The breakdown subdivides the chart by a category field for further analysis of what’s contributing to the increase or decrease.',
7121
- },
7122
- [highchartsRenderer.CHART_TYPES.WATERFALL_WALKTHROUGH]: {
7123
- name: 'Waterfall Walkthrough Chart ',
7124
- label: 'Waterfall Walkthrough Chart ',
7125
- title: 'TODO: add text',
7126
- description: 'TODO: add text',
7127
- axisName: 'Category',
7128
- startedMessage: 'TODO: add text',
7129
- axisTooltipTitle: 'TODO: add text',
7130
- legendTooltipTitle: 'TODO: add text',
7131
- },
6960
+ },
7132
6961
  'combo-chart': {
7133
6962
  name: 'Combo Chart ',
7134
6963
  label: 'Combo Chart ',
@@ -7784,24 +7613,6 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
7784
7613
  highchartsRenderer.suboptions["legends"],
7785
7614
  ]
7786
7615
  },
7787
- {
7788
- type: highchartsRenderer.CHART_TYPES.WATERFALL_WALKTHROUGH,
7789
- name: highchartsRenderer.chartsTypesInfo[highchartsRenderer.CHART_TYPES.WATERFALL_WALKTHROUGH].name,
7790
- class: 'google-visualization-charteditor-thumbs-columnchart',
7791
- render: highchartsRenderer.ptRenderWaterfallWalkthrough,
7792
- suboptions: [
7793
- highchartsRenderer.suboptions["axisX"],
7794
- highchartsRenderer.suboptions["tooltips"],
7795
- highchartsRenderer.suboptions["label"],
7796
- highchartsRenderer.suboptions["subtitle"],
7797
- highchartsRenderer.suboptions["widget_library"],
7798
- highchartsRenderer.suboptions["chart"],
7799
- highchartsRenderer.suboptions["negative_number_format"],
7800
- highchartsRenderer.suboptions["advanced"],
7801
- highchartsRenderer.suboptions["legends"],
7802
- ],
7803
- hidden: true,
7804
- },
7805
7616
  ]
7806
7617
  },
7807
7618
  ];
@@ -7958,7 +7769,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
7958
7769
  _.forEach(Object.keys(dates), key => {
7959
7770
  const dateConfiguration = dates[key];
7960
7771
  const timestamp = dateConfiguration.timestamp;
7961
- if (timestamp) {
7772
+ if (timestamp) {
7962
7773
  const dateTzOffsetInSeconds = new Date(timestamp * 1000).getTimezoneOffset() * 60;
7963
7774
  dateConfiguration.displayedValue = new Date((timestamp + dateTzOffsetInSeconds) * 1000)
7964
7775
  .toLocaleDateString();
@@ -8257,7 +8068,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
8257
8068
  if (!(format && highchartsRenderer.isDateFormat(dateString, format) || highchartsRenderer.isDate(dateString))) {
8258
8069
  return null;
8259
8070
  }
8260
- const utcDate = format
8071
+ const utcDate = format
8261
8072
  ? moment_lib.utc(dateString, format, true)
8262
8073
  : moment_lib.utc(dateString);
8263
8074
  return utcDate.startOf('day').unix();
@@ -8275,7 +8086,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
8275
8086
  }
8276
8087
 
8277
8088
  let filters = [];
8278
-
8089
+
8279
8090
  if (widget.chart_type === highchartsRenderer.CHART_TYPES.WATERFALL_BREAKDOWN) {
8280
8091
  const colFilter = highchartsRenderer.createFilterObject(widget.cols[0]);
8281
8092
  const labels = [];
@@ -8303,7 +8114,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
8303
8114
  col_value,
8304
8115
  highchartsRenderer.getDateFieldFormat(widget, widget.cols[index])
8305
8116
  );
8306
-
8117
+
8307
8118
  if ($.isEmptyObject(datetrange)) {
8308
8119
  return;
8309
8120
  }
@@ -8546,7 +8357,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
8546
8357
  var data = res;
8547
8358
 
8548
8359
  lodash.forEach(datesFields, function (row) {
8549
- 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);
8550
8361
  });
8551
8362
 
8552
8363
  if (datesFields.length > 0) {
@@ -8952,14 +8763,14 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
8952
8763
  return rightPosition;
8953
8764
  case 'none':
8954
8765
  return none;
8955
- }
8956
- } else if (isLine) {
8957
- return useNewUx ? leftPosition : rightPosition;
8958
- } else if (isPie) {
8959
- return useNewUx ? rightPosition : topPosition;
8960
8766
  }
8767
+ } else if (isLine) {
8768
+ return useNewUx ? leftPosition : rightPosition;
8769
+ } else if (isPie) {
8770
+ return useNewUx ? rightPosition : topPosition;
8771
+ }
8961
8772
 
8962
- return useNewUx ? topPosition : bottomPosition;
8773
+ return useNewUx ? topPosition : bottomPosition;
8963
8774
  }
8964
8775
 
8965
8776
  highchartsRenderer.setYAxisMinMax = function (yAxis, axisYOptions) {
@@ -8974,7 +8785,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
8974
8785
  }
8975
8786
 
8976
8787
  highchartsRenderer.getDateFieldFormat = function(widget, dateField) {
8977
- const aggregationConfig = widget.options && widget.options.date_aggregation_configs
8788
+ const aggregationConfig = widget.options && widget.options.date_aggregation_configs
8978
8789
  ? _.find(widget.options.date_aggregation_configs, { field_id: dateField.id })
8979
8790
  : null;
8980
8791
 
@@ -9024,10 +8835,6 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
9024
8835
  }
9025
8836
  }
9026
8837
 
9027
- highchartsRenderer.getTrendSeriesName = function(series) {
9028
- return series.name ? 'Trend Line (' + series.name + ')' : 'Trend Line';
9029
- }
9030
-
9031
8838
  return highchartsRenderer;
9032
8839
  };
9033
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
- });