@datarailsshared/dr_renderer 1.2.47 → 1.2.51

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@datarailsshared/dr_renderer",
3
- "version": "1.2.47",
3
+ "version": "1.2.51",
4
4
  "description": "DataRails charts and tables renderer",
5
5
  "keywords": [
6
6
  "datarails",
@@ -1003,6 +1003,10 @@ var DataFormatterImpl = function () {
1003
1003
 
1004
1004
  // Call function
1005
1005
  result = this.memoized[pattern].call(this, n, type);
1006
+
1007
+ if (result.value === result.pattern) {
1008
+ result.value = n;
1009
+ }
1006
1010
  }
1007
1011
  catch (e) {
1008
1012
 
@@ -133,21 +133,75 @@ let initDRPivotTable = function($, window, document) {
133
133
  return key;
134
134
  };
135
135
 
136
- DRPivotData.prototype.processRecord = function(record) {
136
+ let newProcessKey = function (record, totals, keys, attrs, getAggregator) {
137
+ var addKey, attr, flatKey, k, key, len, ref;
138
+ key = [];
139
+ addKey = false;
140
+ for (k = 0, len = attrs.length; k < len; k++) {
141
+ attr = attrs[k];
142
+ if (record.hasOwnProperty(attr)) {
143
+ key.push((ref = record[attr]));
144
+ flatKey = key.join(delim);
145
+ }
146
+ if (totals[flatKey] && totals[flatKey].isChangeable) {
147
+ continue;
148
+ }
149
+ if (!flatKey) return [];
150
+ if (!totals[flatKey]) {
151
+ totals[flatKey] = getAggregator(key.slice());
152
+ addKey = true;
153
+ } else {
154
+ totals[flatKey] = getAggregator(key.slice());
155
+ totals[flatKey].push(record);
156
+ }
157
+ }
158
+ if (addKey) {
159
+ keys.push(key);
160
+ }
161
+ return key;
162
+ };
163
+
164
+ DRPivotData.prototype.processRecord = function(record, useTotalsCalculation) {
137
165
  var colKey, fColKey, fRowKey, flatColKey, flatRowKey, i, j, k, m, n, ref, results, rowKey;
138
166
  rowKey = [];
139
167
  colKey = [];
140
- this.allTotal.push(record);
141
- rowKey = processKey(record, this.rowTotals, this.rowKeys, this.rowAttrs, (function(_this) {
142
- return function(key) {
143
- return _this.aggregator(_this, key, []);
144
- };
145
- })(this));
146
- colKey = processKey(record, this.colTotals, this.colKeys, this.colAttrs, (function(_this) {
147
- return function(key) {
148
- return _this.aggregator(_this, [], key);
149
- };
150
- })(this));
168
+ if (useTotalsCalculation) {
169
+ rowKey = newProcessKey(record, this.rowTotals, this.rowKeys, this.rowAttrs, (function(_this) {
170
+ return function(key) {
171
+ return _this.aggregator(_this, key, []);
172
+ };
173
+ })(this));
174
+ colKey = newProcessKey(record, this.colTotals, this.colKeys, this.colAttrs, (function(_this) {
175
+ return function(key) {
176
+ return _this.aggregator(_this, [], key);
177
+ };
178
+ })(this));
179
+
180
+ if (!colKey.length && !rowKey.length) {
181
+ this.allTotal.push(record);
182
+ }
183
+ if (!colKey.length && rowKey.length === 1) {
184
+ this.rowTotals[rowKey[0]].push(record);
185
+ this.rowTotals[rowKey[0]].isChangeable = true;
186
+ }
187
+ if (!rowKey.length && colKey.length === 1) {
188
+ this.colTotals[colKey[0]].push(record);
189
+ this.colTotals[colKey[0]].isChangeable = true;
190
+ }
191
+ } else {
192
+ this.allTotal.push(record);
193
+ rowKey = processKey(record, this.rowTotals, this.rowKeys, this.rowAttrs, (function(_this) {
194
+ return function(key) {
195
+ return _this.aggregator(_this, key, []);
196
+ };
197
+ })(this));
198
+ colKey = processKey(record, this.colTotals, this.colKeys, this.colAttrs, (function(_this) {
199
+ return function(key) {
200
+ return _this.aggregator(_this, [], key);
201
+ };
202
+ })(this));
203
+ }
204
+
151
205
  m = rowKey.length - 1;
152
206
  n = colKey.length - 1;
153
207
  if (m < 0 || n < 0) {
@@ -385,12 +439,13 @@ let initDRPivotTable = function($, window, document) {
385
439
  pvtData.colKeys = [];
386
440
  tooMuch = true;
387
441
  opts.error_has_occurred = true;
442
+ opts.error_params = $.pivotUtilities.errorHandling.placeholders.tooMuchData;
388
443
  }
389
- return SubtotalRenderer(pvtData, opts, charttype, tooMuch);
444
+ return SubtotalRenderer(pvtData, opts, charttype, tooMuch, opts.error_params);
390
445
  }
391
446
  }
392
447
 
393
- SubtotalRenderer = function(pivotData, opts, charttype, tooMuch = false) {
448
+ SubtotalRenderer = function(pivotData, opts, charttype, tooMuch = false, error_params) {
394
449
  var addClass, allTotal, arrowCollapsed, arrowExpanded, buildColHeaderHeader, buildColHeaderHeaders, buildColHeaderHeadersClickEvents, buildColHeaders, buildColTotals, buildColTotalsHeader, buildGrandTotal, buildRowHeaderHeaders, buildRowHeaderHeadersClickEvents, buildRowHeaders, buildRowTotalsHeader, buildValues, classColCollapsed, classColExpanded, classColHide, classColShow, classCollapsed, classExpanded, classRowCollapsed, classRowExpanded, classRowHide, classRowShow, clickStatusCollapsed, clickStatusExpanded, colAttrs, colDisableAfter, colKeys, colTotals, collapseCol, collapseColsAt, collapseHideDescendantRow, collapseRow, collapseRowsAt, collapseShowColSubtotal, collapseShowRowSubtotal, createElement, defaults, expandChildCol, expandChildRow, expandCol, expandColsAt, expandHideColSubtotal, expandHideRowSubtotal, expandRow, expandRowsAt, expandShowColSubtotal, expandShowRowSubtotal, getTableEventHandlers, hasClass, hideDescendantCol, isColDisable, isColDisableExpandCollapse, isColHideOnExpand, isRowDisable, isRowDisableExpandCollapse, isRowHideOnExpand, main, getSubtotalInBrackets, processKeys, encodeHtmlEntities, ref, ref1, ref2, ref3, ref4, ref5, ref6, ref7, removeClass, replaceClass, rowAttrs, rowDisableAfter, rowKeys, rowTotals, setAttributes, showChildCol, showChildRow, toggleCol, toggleColHeaderHeader, toggleRow, toggleRowHeaderHeader, tree, assumptionSubscribe;
395
450
  var createTotalValsBolder, createGrandTotalBolder, getHeaderColorProperties, colorizeRowLabelHeaders, colorizeTableIfNeed, valueNoDashes, getColorsWithOffsetForTable, offsetColors, handleFreezePanesScroll, selectFreezableElements, removeRowHeaderNullValue;
396
451
  var edit_assumptions;
@@ -2133,7 +2188,9 @@ let initDRPivotTable = function($, window, document) {
2133
2188
  }
2134
2189
 
2135
2190
  if (tooMuch) {
2136
- resultsArr.push($('<div class="noData"><i class="fa fa-info"></i> There are too many rows to display in the table.<br>Please filter or change the table type in options.</div>'));
2191
+ const defaultPlaceholder = $('<div class="noData"><i class="fa fa-info"></i> There are too many rows to display in the table.<br>Please filter or change the table type in options.</div>');
2192
+
2193
+ resultsArr.push($.pivotUtilities.errorHandling.getErrorPlaceholder(error_params, useNewUx) || defaultPlaceholder);
2137
2194
  } else {
2138
2195
  var tableContainer = document.createElement("div");
2139
2196
  tableContainer.className = "pivot-div";
@@ -1,8 +1,12 @@
1
1
  let getHighchartsRenderer = function ($, document, Highcharts, default_colors, highchartsRenderer,
2
2
  DataFormatter, lodash, moment_lib) {
3
3
 
4
- const useNewUx = document.ReportHippo && document.ReportHippo && document.ReportHippo.user &&
5
- document.ReportHippo.user.organization.settings && document.ReportHippo.user.organization.settings.use_new_ux;
4
+ let useNewUx = false;
5
+ let useTotalsCalculation = false;
6
+ if (document.ReportHippo && document.ReportHippo && document.ReportHippo.user) {
7
+ useTotalsCalculation = _.includes(document.ReportHippo.user.features, 'enable_server_totals_calculation');
8
+ useNewUx = document.ReportHippo.user.organization && document.ReportHippo.user.organization.settings && document.ReportHippo.user.organization.settings.use_new_ux;
9
+ }
6
10
  const textColor = "#151a41";
7
11
  const chartLabelColor = "#cfd7dd";
8
12
 
@@ -721,9 +725,9 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
721
725
  }
722
726
 
723
727
  if (to_match) {
724
- resultsArr.push($('<div class="noData"><i class="' + (useNewUx ? 'noData-image' : 'fa fa-info') + '"></i> Too much data to show</div>'));
728
+ resultsArr.push(highchartsRenderer.getWidgetPlaceholder(highchartsRenderer.widgetPlaceholders.tooMuchData));
725
729
  } else {
726
- resultsArr.push($('<div class="noData"><i class="' + (useNewUx ? 'noData-image' : 'fa fa-info') + '"></i> no data</div>'));
730
+ resultsArr.push(highchartsRenderer.getWidgetPlaceholder(highchartsRenderer.widgetPlaceholders.nodata));
727
731
  }
728
732
 
729
733
  temp_result.html(resultsArr);
@@ -731,6 +735,11 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
731
735
  return temp_result;
732
736
  };
733
737
 
738
+ highchartsRenderer.getWidgetPlaceholder = function(placeholder) {
739
+ const defaultPlaceholder = $('<div class="noData"><i class="' + (useNewUx ? 'noData-image' : 'fa fa-info') + '"></i> no data</div>');
740
+ return $.pivotUtilities.errorHandling.getErrorPlaceholder(placeholder, useNewUx) || defaultPlaceholder;
741
+ }
742
+
734
743
  highchartsRenderer.ptCreateElementAndDraw = function (chartOptions, opts) {
735
744
  if (lodash.get(opts, 'paletteOptions.widgetPalette', null)) {
736
745
  const mc_palette = lodash.find(lodash.get(opts.paletteOptions, 'monochromePalettes', []), { selected: true });
@@ -820,9 +829,12 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
820
829
 
821
830
  if (!seriesDataLength && !chartOptions.onlyText) {
822
831
  result = highchartsRenderer.getNoDataResult(chartOptions);
832
+ opts.error_has_occurred = true;
833
+ opts.error_params = highchartsRenderer.widgetPlaceholders.nodata;
823
834
  } else if (!chartOptions.onlyText && chartOptions.series && toMatch) {
824
835
  result = highchartsRenderer.getNoDataResult(chartOptions, toMatch);
825
836
  opts.error_has_occurred = true;
837
+ opts.error_params = highchartsRenderer.widgetPlaceholders.tooMuchData;
826
838
  } else {
827
839
  chartOptions = highchartsRenderer.updateChartOptions(chartOptions, opts);
828
840
  chartOptions = highchartsRenderer.updateChartOptions(chartOptions, {credits: {enabled: false}});
@@ -2840,6 +2852,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
2840
2852
  has_errors: false,
2841
2853
  widget_values_format: widget_values_format,
2842
2854
  calculated_formats: calculated_info.formats,
2855
+ isChangeable: false,
2843
2856
  push: function (record) {
2844
2857
  if (record.hasOwnProperty('data_types') && $.isArray(record['data_types'])) {
2845
2858
  this.data_types = this.data_types.concat(record['data_types']);
@@ -2860,7 +2873,10 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
2860
2873
  if (highchartsRenderer.ignoreIfCalculatedValue(data, rowKey, colKey, record, calculated_info.associated_fields, render_options, is_graph)) {
2861
2874
  this.ignoreValue = true;
2862
2875
  }
2863
- if (!isNaN(parseFloat(record[attr]))) {
2876
+
2877
+ if (useTotalsCalculation && !isNaN(parseFloat(record[attr]))) {
2878
+ return this.sum = parseFloat(record[attr]);
2879
+ } else if (!isNaN(parseFloat(record[attr]))) {
2864
2880
  return this.sum += parseFloat(record[attr]);
2865
2881
  }
2866
2882
  },
@@ -2991,6 +3007,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
2991
3007
  has_errors: false,
2992
3008
  widget_values_format: widget_values_format,
2993
3009
  calculated_formats: calculated_info.formats,
3010
+ isChangeable: false,
2994
3011
  push: function (record) {
2995
3012
  if (record.hasOwnProperty('data_types') && record['data_types']) {
2996
3013
  if (record['data_types'].length > 0) {
@@ -3023,7 +3040,11 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
3023
3040
  this.ignoreValue = true;
3024
3041
  }
3025
3042
 
3026
- return this.sum += val;
3043
+ if (useTotalsCalculation) {
3044
+ return this.sum = val;
3045
+ } else {
3046
+ return this.sum += val;
3047
+ }
3027
3048
  } else {
3028
3049
  return this.sum = NaN;
3029
3050
  }
@@ -3086,6 +3107,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
3086
3107
  has_errors: false,
3087
3108
  widget_values_format: widget_values_format,
3088
3109
  calculated_formats: calculated_info.formats,
3110
+ isChangeable: false,
3089
3111
  push: function (record) {
3090
3112
  if (record.hasOwnProperty('data_types') && record['data_types']) {
3091
3113
  if (record['data_types'].length > 0) {
@@ -3118,7 +3140,11 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
3118
3140
  if (highchartsRenderer.ignoreIfCalculatedValue(data, rowKey, colKey, record, calculated_info.associated_fields, render_options, is_graph)) {
3119
3141
  this.ignoreValue = true;
3120
3142
  }
3121
- return this.val = Math.min(x, (ref = this.val) != null ? ref : x);
3143
+ if (useTotalsCalculation) {
3144
+ return this.val = x;
3145
+ } else {
3146
+ return this.val = Math.min(x, (ref = this.val) != null ? ref : x);
3147
+ }
3122
3148
  }
3123
3149
  },
3124
3150
  value: function () {
@@ -3179,6 +3205,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
3179
3205
  has_errors: false,
3180
3206
  widget_values_format: widget_values_format,
3181
3207
  calculated_formats: calculated_info.formats,
3208
+ isChangeable: false,
3182
3209
  push: function (record) {
3183
3210
  if (record.hasOwnProperty('data_types') && record['data_types']) {
3184
3211
  if (record['data_types'].length > 0) {
@@ -3211,8 +3238,12 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
3211
3238
  if (highchartsRenderer.ignoreIfCalculatedValue(data, rowKey, colKey, record, calculated_info.associated_fields, render_options, is_graph)) {
3212
3239
  this.ignoreValue = true;
3213
3240
  }
3214
- return this.val = Math.max(x, (ref = this.val) != null ? ref : x);
3215
- }
3241
+
3242
+ if (useTotalsCalculation) {
3243
+ return this.val = x;
3244
+ } else {
3245
+ return this.val = Math.min(x, (ref = this.val) != null ? ref : x);
3246
+ } }
3216
3247
  },
3217
3248
  value: function () {
3218
3249
  if (this.ignoreValue) {
@@ -3273,6 +3304,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
3273
3304
  has_errors: false,
3274
3305
  widget_values_format: widget_values_format,
3275
3306
  calculated_formats: calculated_info.formats,
3307
+ isChangeable: false,
3276
3308
  push: function (record) {
3277
3309
  if (record.hasOwnProperty('data_types') && record['data_types']) {
3278
3310
  if (record['data_types'].length > 0) {
@@ -3306,7 +3338,13 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
3306
3338
  this.ignoreValue = true;
3307
3339
  }
3308
3340
 
3309
- this.sum += parseFloat(x);
3341
+
3342
+ if (useTotalsCalculation) {
3343
+ this.sum = parseFloat(x);
3344
+ } else {
3345
+ this.sum += parseFloat(x);
3346
+ }
3347
+
3310
3348
  return this.len++;
3311
3349
  }
3312
3350
  },
@@ -3466,6 +3504,30 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
3466
3504
  filter = (a) => a > bottomx;
3467
3505
  }
3468
3506
  break;
3507
+ case "filter_smallest":
3508
+ const smallest_sumOfFields = lodash.reduce(totals, (acc, curr) => acc += curr.sum, 0);
3509
+ const smallest = Math.floor((smallest_sumOfFields * vals[0])/100);
3510
+
3511
+ if (is_absolute)
3512
+ filter = (a) => Math.abs(a) > smallest;
3513
+ else
3514
+ filter = (a) => a > smallest;
3515
+ break;
3516
+ case "filter_largest":
3517
+ const largest_sumOfFields = lodash.reduce(totals, (acc, curr) => acc += curr.sum, 0);
3518
+ const largest = Math.floor((largest_sumOfFields * vals[0])/100);
3519
+
3520
+ if (is_absolute)
3521
+ filter = (a) => Math.abs(a) < largest;
3522
+ else
3523
+ filter = (a) => a < largest;
3524
+ break;
3525
+ case "filter_out_zero":
3526
+ if (is_absolute)
3527
+ filter = (a) => Math.abs(a) == 0;
3528
+ else
3529
+ filter = (a) => a == 0;
3530
+ break;
3469
3531
  default:
3470
3532
 
3471
3533
  }
@@ -3753,6 +3815,8 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
3753
3815
  return {};
3754
3816
  }
3755
3817
 
3818
+ options.error_has_occurred = true;
3819
+ options.error_params = highchartsRenderer.widgetPlaceholders.nodata;
3756
3820
  return highchartsRenderer.getNoDataResult(options.rendererOptions);
3757
3821
  }
3758
3822
 
@@ -3761,6 +3825,8 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
3761
3825
  return {};
3762
3826
  }
3763
3827
 
3828
+ options.error_has_occurred = true;
3829
+ options.error_params = highchartsRenderer.widgetPlaceholders.tooMuchData;
3764
3830
  return highchartsRenderer.getNoDataResult(options.rendererOptions, true);
3765
3831
  }
3766
3832
 
@@ -4679,6 +4745,8 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
4679
4745
  return valToReturn;
4680
4746
  };
4681
4747
 
4748
+ highchartsRenderer.widgetPlaceholders = Object.assign({}, $.pivotUtilities.errorHandling.placeholders);
4749
+
4682
4750
  highchartsRenderer.suboptions = {
4683
4751
  'default_show': {
4684
4752
  category_class: 'google-visualization-charteditor-mini-more',
package/src/pivottable.js CHANGED
@@ -7,7 +7,7 @@ let initPivotTable = function($, window, document) {
7
7
  /*
8
8
  Utilities
9
9
  */
10
- var PivotData, addSeparators, aggregatorTemplates, aggregators, dayNamesEn, derivers, getSort, locales, mthNamesEn, naturalSort, numberFormat, pivotTableRenderer, rd, renderers, rx, rz, sortAs, usFmt, usFmtInt, usFmtPct, zeroPad;
10
+ var PivotData, addSeparators, aggregatorTemplates, aggregators, dayNamesEn, derivers, getSort, locales, mthNamesEn, naturalSort, numberFormat, pivotTableRenderer, rd, renderers, rx, rz, sortAs, usFmt, usFmtInt, usFmtPct, zeroPad, errorHandling;
11
11
  addSeparators = function(nStr, thousandsSep, decimalSep) {
12
12
  var rgx, x, x1, x2;
13
13
  nStr += '';
@@ -20,6 +20,10 @@ let initPivotTable = function($, window, document) {
20
20
  }
21
21
  return x1 + x2;
22
22
  };
23
+ let useTotalsCalculation = false;
24
+ if (document.ReportHippo && document.ReportHippo && document.ReportHippo.user) {
25
+ useTotalsCalculation = _.includes(document.ReportHippo.user.features, 'enable_server_totals_calculation');
26
+ }
23
27
  numberFormat = function(opts) {
24
28
  var defaults;
25
29
  defaults = {
@@ -610,6 +614,47 @@ let initPivotTable = function($, window, document) {
610
614
  }
611
615
  return naturalSort;
612
616
  };
617
+ errorHandling = {
618
+ placeholders: {
619
+ nodata: {
620
+ title: 'No Data Available',
621
+ text: 'This might happen because of a global filter or a change in the underlying data',
622
+ btnText: '',
623
+ class: 'nodata',
624
+ },
625
+ noPermission: {
626
+ title: 'No Permission',
627
+ text: 'You do not have permission to view the data',
628
+ btnText: 'Request Permission',
629
+ class: 'no-permission',
630
+ },
631
+ tooMuchData: {
632
+ title: 'There is too much data. Please edit this widget',
633
+ text: '',
634
+ btnText: 'Edit Widget',
635
+ class: 'too-much-data',
636
+ },
637
+ noPublishItem: {
638
+ title: 'We can’t find the published item in the source file',
639
+ text: '',
640
+ btnText: 'Go to filebox',
641
+ class: 'no-publish-item',
642
+ },
643
+ },
644
+ getErrorPlaceholder: function(placeholder, useNewUx = true) {
645
+ if (placeholder && typeof placeholder === 'object') {
646
+ return $(`
647
+ <div class="noData">
648
+ <div class="noData-title">${placeholder.title}</div>
649
+ <i class="noData-image ${useNewUx ? placeholder.class : 'fa fa-info'}"></i>
650
+ <div class="noData-text">${placeholder.text}</div>
651
+ <div class="noData-error-action"></div>
652
+ </div>
653
+ `);
654
+ }
655
+ return null;
656
+ },
657
+ };
613
658
 
614
659
  /*
615
660
  Data Model class
@@ -648,7 +693,7 @@ let initPivotTable = function($, window, document) {
648
693
  PivotData.forEachRecord(this.input, this.derivedAttributes, (function(_this) {
649
694
  return function(record) {
650
695
  if (_this.filter(record)) {
651
- return _this.processRecord(record);
696
+ return _this.processRecord(record, useTotalsCalculation);
652
697
  }
653
698
  };
654
699
  })(this));
@@ -890,7 +935,8 @@ let initPivotTable = function($, window, document) {
890
935
  naturalSort: naturalSort,
891
936
  numberFormat: numberFormat,
892
937
  sortAs: sortAs,
893
- PivotData: PivotData
938
+ PivotData: PivotData,
939
+ errorHandling: errorHandling,
894
940
  };
895
941
 
896
942
  /*
@@ -1821,4 +1867,4 @@ let initPivotTable = function($, window, document) {
1821
1867
  };
1822
1868
  };
1823
1869
 
1824
- module.exports = initPivotTable;
1870
+ module.exports = initPivotTable;
@@ -124,8 +124,11 @@ let getPublishedItemsRenderer = function (publishedItemsRenderer) {
124
124
  const metaData = options.inputValuesData ? options.inputValuesData[name] : null;
125
125
  let newValue = inputElement.value;
126
126
  if (metaData) {
127
- if (metaData.type === 'editInput')
127
+ if (metaData.type === 'editInput') {
128
128
  newValue = parseFloat(newValue);
129
+ } else if (metaData.type === 'editInputPercent') {
130
+ newValue = parseFloat(newValue) + '%';
131
+ }
129
132
 
130
133
  if (metaData.value !== newValue) {
131
134
  metaData.value = newValue;
@@ -158,19 +161,14 @@ let getPublishedItemsRenderer = function (publishedItemsRenderer) {
158
161
  }, 1)
159
162
  });
160
163
 
161
- if (inputMetaData.type === 'editInputPercent')
162
- inEl.setAttribute("type", "text");
163
- else if (inputMetaData.type === 'editInput')
164
- inEl.setAttribute("type", "number");
165
-
164
+ inEl.setAttribute("type", "number");
166
165
  inEl.setAttribute("name", inputMetaData.name);
167
166
  inEl.setAttribute("style", "background: transparent;width: calc(100% - 15px);border: 0;margin: 5px;text-align: inherit;display: none;");
168
- inEl.value = inputMetaData.value;
167
+ inEl.value = inputMetaData.type === 'editInputPercent' ? parseFloat(inputMetaData.value.replace('%', '')) : inputMetaData.value;
169
168
  inEl.addEventListener("focusout", function (event) {
170
169
  event.preventDefault();
171
170
  publishedItemsRenderer.changedInputElement(event, scope, options);
172
171
  inEl.style.display = 'none';
173
- labelEl.innerText = inEl.value;
174
172
  labelEl.innerText = inputMetaData.format ? formatValue('n', inputMetaData.format, inEl.value).value : inputMetaData.value;
175
173
  labelEl.style.display = 'block';
176
174
  });