@datarailsshared/dr_renderer 1.5.66 → 1.5.72

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.
@@ -37,10 +37,9 @@ jobs:
37
37
  publish-gh-packages:
38
38
  name: Publish to GitHub Packages
39
39
  needs: publish-npm
40
- uses: datarails/dr_github_reusable/.github/workflows/npm-publish-gh-packages.yml@DEVOPS-628
40
+ uses: datarails/dr_github_reusable/.github/workflows/npm-publish-gh-packages.yml@main
41
41
  with:
42
42
  node_version: '14.16.1'
43
43
  package_scope: '@datarails'
44
- use_auto_increment: true
45
- version_prefix: '1.5'
44
+ version: ${{ needs.publish-npm.outputs.version }}
46
45
  secrets: inherit
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@datarailsshared/dr_renderer",
3
- "version": "1.5.66",
3
+ "version": "1.5.72",
4
4
  "description": "DataRails charts and tables renderer",
5
5
  "keywords": [
6
6
  "datarails",
@@ -3738,6 +3738,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
3738
3738
  }
3739
3739
 
3740
3740
  highchartsRenderer.rhPivotCount = function (arg, widget_values_format, is_graph, render_options, calculated_info) {
3741
+ render_options = lodash.cloneDeep(render_options);
3741
3742
  var attr = arg[0];
3742
3743
  return function (data, rowKey, colKey) {
3743
3744
  return {
@@ -3819,6 +3820,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
3819
3820
  };
3820
3821
 
3821
3822
  highchartsRenderer.rhPivotAggregatorUniqValues = function (arg, widget_values_format, is_graph, render_options, calculated_info) {
3823
+ render_options = lodash.cloneDeep(render_options);
3822
3824
  var attr;
3823
3825
  attr = arg[0];
3824
3826
  var sep = '<br>';
@@ -3894,6 +3896,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
3894
3896
  };
3895
3897
 
3896
3898
  highchartsRenderer.rhPivotAggregatorSum = function (arg, widget_values_format, is_graph, render_options, calculated_info) {
3899
+ render_options = lodash.cloneDeep(render_options);
3897
3900
  var attr = arg[0];
3898
3901
  return function (data, rowKey, colKey) {
3899
3902
  return {
@@ -3987,6 +3990,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
3987
3990
  };
3988
3991
 
3989
3992
  highchartsRenderer.rhPivotAggregatorMin = function (arg, widget_values_format, is_graph, render_options, calculated_info) {
3993
+ render_options = lodash.cloneDeep(render_options);
3990
3994
  var attr = arg[0];
3991
3995
  return function (data, rowKey, colKey) {
3992
3996
  return {
@@ -4079,6 +4083,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
4079
4083
  };
4080
4084
 
4081
4085
  highchartsRenderer.rhPivotAggregatorMax = function (arg, widget_values_format, is_graph, render_options, calculated_info) {
4086
+ render_options = lodash.cloneDeep(render_options);
4082
4087
  var attr = arg[0];
4083
4088
  return function (data, rowKey, colKey) {
4084
4089
  return {
@@ -4171,6 +4176,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
4171
4176
  };
4172
4177
 
4173
4178
  highchartsRenderer.rhPivotAggregatorAverage = function (arg, widget_values_format, is_graph, render_options, calculated_info) {
4179
+ render_options = lodash.cloneDeep(render_options);
4174
4180
  var attr = arg[0];
4175
4181
  return function (data, rowKey, colKey) {
4176
4182
  return {
@@ -2361,6 +2361,30 @@ describe('highcharts_renderer', () => {
2361
2361
  });
2362
2362
 
2363
2363
  describe('Aggregators functions', () => {
2364
+ const testMutationIsolation = (factory) => {
2365
+ // Use mockImplementationOnce to override the mock only for this test
2366
+ let appliedOptions = null;
2367
+ getAggregatorPercentageValueIfRequiredMock
2368
+ .mockImplementationOnce((value, opts) => {
2369
+ appliedOptions = lodash.cloneDeep(opts);
2370
+ return 'INITIAL';
2371
+ })
2372
+ .mockImplementationOnce((value, opts) => {
2373
+ const mutated = !lodash.isEqual(opts, appliedOptions);
2374
+ return mutated ? 'MUTATED' : 'INITIAL';
2375
+ });
2376
+
2377
+ const render_options = { chartOptions: { delta_column: { is_percentage: true } } };
2378
+ const aggregatorFn = factory([], '#,###%', true, render_options, {});
2379
+ const agg = aggregatorFn({}, [], []);
2380
+ const before = agg.format(100, false);
2381
+ render_options.chartOptions.delta_column.is_percentage = false;
2382
+ const after = agg.format(100, false);
2383
+
2384
+ expect(before).toBe('INITIAL');
2385
+ expect(after).toBe('INITIAL');
2386
+ };
2387
+
2364
2388
  describe('Sum aggregator', () => {
2365
2389
  let arg;
2366
2390
  let widget_values_format;
@@ -2415,6 +2439,10 @@ describe('highcharts_renderer', () => {
2415
2439
  expect(aggObject.numInputs).toBe(1);
2416
2440
  });
2417
2441
 
2442
+ it('Should ignore external mutations after initialization', () => {
2443
+ testMutationIsolation(highchartsRenderer.rhPivotAggregatorSum);
2444
+ });
2445
+
2418
2446
  describe('Push method', () => {
2419
2447
  beforeEach(() => {
2420
2448
  aggregator = highchartsRenderer.rhPivotAggregatorSum(arg, widget_values_format, is_graph, render_options, calculated_info);
@@ -2620,6 +2648,10 @@ describe('highcharts_renderer', () => {
2620
2648
  expect(aggObject.numInputs).toBe(1);
2621
2649
  });
2622
2650
 
2651
+ it('Should ignore external mutations after initialization', () => {
2652
+ testMutationIsolation(highchartsRenderer.rhPivotCount);
2653
+ });
2654
+
2623
2655
  describe('Push method', () => {
2624
2656
  beforeEach(() => {
2625
2657
  aggregator = highchartsRenderer.rhPivotCount(arg, widget_values_format, is_graph, render_options, calculated_info);
@@ -2822,6 +2854,10 @@ describe('highcharts_renderer', () => {
2822
2854
  expect(aggObject.numInputs).toBe(1);
2823
2855
  });
2824
2856
 
2857
+ it('Should ignore external mutations after initialization', () => {
2858
+ testMutationIsolation(highchartsRenderer.rhPivotAggregatorUniqValues);
2859
+ });
2860
+
2825
2861
  describe('Push method', () => {
2826
2862
  beforeEach(() => {
2827
2863
  aggregator = highchartsRenderer.rhPivotAggregatorUniqValues(arg, widget_values_format, is_graph, render_options, calculated_info);
@@ -2975,6 +3011,10 @@ describe('highcharts_renderer', () => {
2975
3011
  expect(aggObject.numInputs).toBe(1);
2976
3012
  });
2977
3013
 
3014
+ it('Should ignore external mutations after initialization', () => {
3015
+ testMutationIsolation(highchartsRenderer.rhPivotAggregatorAverage);
3016
+ });
3017
+
2978
3018
  describe('Push method', () => {
2979
3019
  beforeEach(() => {
2980
3020
  aggregator = highchartsRenderer.rhPivotAggregatorAverage(arg, widget_values_format, is_graph, render_options, calculated_info);
@@ -3183,6 +3223,10 @@ describe('highcharts_renderer', () => {
3183
3223
  expect(aggObject.numInputs).toBe(1);
3184
3224
  });
3185
3225
 
3226
+ it('Should ignore external mutations after initialization', () => {
3227
+ testMutationIsolation(highchartsRenderer.rhPivotAggregatorMin);
3228
+ });
3229
+
3186
3230
  describe('Push method', () => {
3187
3231
  beforeEach(() => {
3188
3232
  aggregator = highchartsRenderer.rhPivotAggregatorMin(arg, widget_values_format, is_graph, render_options, calculated_info);
@@ -3389,6 +3433,10 @@ describe('highcharts_renderer', () => {
3389
3433
  expect(aggObject.numInputs).toBe(1);
3390
3434
  });
3391
3435
 
3436
+ it('Should ignore external mutations after initialization', () => {
3437
+ testMutationIsolation(highchartsRenderer.rhPivotAggregatorMax);
3438
+ });
3439
+
3392
3440
  describe('Push method', () => {
3393
3441
  beforeEach(() => {
3394
3442
  aggregator = highchartsRenderer.rhPivotAggregatorMax(arg, widget_values_format, is_graph, render_options, calculated_info);