@datarailsshared/dr_renderer 1.2.49 → 1.2.53
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 +1 -1
- package/src/dataformatter.js +1 -1
- package/src/dr_pivottable.js +78 -14
- package/src/highcharts_renderer.js +61 -18
- package/src/pivottable.js +6 -2
- package/src/published_items_renderer.js +6 -8
package/package.json
CHANGED
package/src/dataformatter.js
CHANGED
|
@@ -1004,7 +1004,7 @@ var DataFormatterImpl = function () {
|
|
|
1004
1004
|
// Call function
|
|
1005
1005
|
result = this.memoized[pattern].call(this, n, type);
|
|
1006
1006
|
|
|
1007
|
-
if (result.value === result.pattern) {
|
|
1007
|
+
if (result.value === result.pattern && !(String(n) === '0' && result.value.includes('0'))) {
|
|
1008
1008
|
result.value = n;
|
|
1009
1009
|
}
|
|
1010
1010
|
}
|
package/src/dr_pivottable.js
CHANGED
|
@@ -3,7 +3,7 @@ let initDRPivotTable = function($, window, document) {
|
|
|
3
3
|
var slice = [].slice;
|
|
4
4
|
var extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };
|
|
5
5
|
|
|
6
|
-
var DRPivotData, sortDateStrings, getSort, processKey, SubtotalRenderer, getFormattedNumber, largeToSmallSort, NovixRenderer;
|
|
6
|
+
var DRPivotData, sortDateStrings, getSort, processKey, SubtotalRenderer, getFormattedNumber, largeToSmallSort, largeToSmallSortByAbsolute, NovixRenderer;
|
|
7
7
|
|
|
8
8
|
var delim = " , ";
|
|
9
9
|
const newTableColors = ['rgb(127, 196, 255)', 'rgb(200, 243,243)', 'rgb(247, 161, 173)', 'rgb(255, 237, 178)', 'rgb(221, 239, 255)',
|
|
@@ -133,21 +133,75 @@ let initDRPivotTable = function($, window, document) {
|
|
|
133
133
|
return key;
|
|
134
134
|
};
|
|
135
135
|
|
|
136
|
-
|
|
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 && key.length === attrs.length) {
|
|
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
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
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) {
|
|
184
|
+
this.rowTotals[rowKey.join(delim)].push(record);
|
|
185
|
+
this.rowTotals[rowKey.join(delim)].isChangeable = true;
|
|
186
|
+
}
|
|
187
|
+
if (!rowKey.length && colKey.length) {
|
|
188
|
+
this.colTotals[colKey.join(delim)].push(record);
|
|
189
|
+
this.colTotals[colKey.join(delim)].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) {
|
|
@@ -286,7 +340,11 @@ let initDRPivotTable = function($, window, document) {
|
|
|
286
340
|
};
|
|
287
341
|
};
|
|
288
342
|
|
|
289
|
-
|
|
343
|
+
largeToSmallSortByAbsolute = function (as, bs) {
|
|
344
|
+
return largeToSmallSort(as , bs, true);
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
largeToSmallSort = function(as, bs, is_abs = false) {
|
|
290
348
|
var a, a1, b, b1, rd, rx, rz;
|
|
291
349
|
rx = /(\d+)|(\D+)/g;
|
|
292
350
|
rd = /\d/;
|
|
@@ -298,6 +356,11 @@ let initDRPivotTable = function($, window, document) {
|
|
|
298
356
|
if (isNaN(bs)) {
|
|
299
357
|
return 1;
|
|
300
358
|
}
|
|
359
|
+
|
|
360
|
+
if (is_abs) {
|
|
361
|
+
return Math.abs(bs) - Math.abs(as);
|
|
362
|
+
}
|
|
363
|
+
|
|
301
364
|
return bs - as;
|
|
302
365
|
}
|
|
303
366
|
a = String(as).toLowerCase();
|
|
@@ -2163,6 +2226,7 @@ let initDRPivotTable = function($, window, document) {
|
|
|
2163
2226
|
$.pivotUtilities.getFormattedNumber = getFormattedNumber;
|
|
2164
2227
|
$.pivotUtilities.sortDateStrings = sortDateStrings;
|
|
2165
2228
|
$.pivotUtilities.largeToSmallSort = largeToSmallSort;
|
|
2229
|
+
$.pivotUtilities.largeToSmallSortByAbsolute = largeToSmallSortByAbsolute;
|
|
2166
2230
|
$.pivotUtilities.getPivotDataModel = function(input, opts){ return new DRPivotData(input, opts); }
|
|
2167
2231
|
$.pivotUtilities.getPivotTableFormula = function(rowData, opts, func, colFields, rowFields, aggregationDefaults, utils) {
|
|
2168
2232
|
let totalStr = 'Grand Totals';
|
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
let getHighchartsRenderer = function ($, document, Highcharts, default_colors, highchartsRenderer,
|
|
2
2
|
DataFormatter, lodash, moment_lib) {
|
|
3
3
|
|
|
4
|
-
|
|
5
|
-
|
|
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
|
|
|
@@ -2848,6 +2852,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
|
2848
2852
|
has_errors: false,
|
|
2849
2853
|
widget_values_format: widget_values_format,
|
|
2850
2854
|
calculated_formats: calculated_info.formats,
|
|
2855
|
+
isChangeable: false,
|
|
2851
2856
|
push: function (record) {
|
|
2852
2857
|
if (record.hasOwnProperty('data_types') && $.isArray(record['data_types'])) {
|
|
2853
2858
|
this.data_types = this.data_types.concat(record['data_types']);
|
|
@@ -2868,7 +2873,10 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
|
2868
2873
|
if (highchartsRenderer.ignoreIfCalculatedValue(data, rowKey, colKey, record, calculated_info.associated_fields, render_options, is_graph)) {
|
|
2869
2874
|
this.ignoreValue = true;
|
|
2870
2875
|
}
|
|
2871
|
-
|
|
2876
|
+
|
|
2877
|
+
if (useTotalsCalculation && !isNaN(parseFloat(record[attr]))) {
|
|
2878
|
+
return this.sum = parseFloat(record[attr]);
|
|
2879
|
+
} else if (!isNaN(parseFloat(record[attr]))) {
|
|
2872
2880
|
return this.sum += parseFloat(record[attr]);
|
|
2873
2881
|
}
|
|
2874
2882
|
},
|
|
@@ -2999,6 +3007,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
|
2999
3007
|
has_errors: false,
|
|
3000
3008
|
widget_values_format: widget_values_format,
|
|
3001
3009
|
calculated_formats: calculated_info.formats,
|
|
3010
|
+
isChangeable: false,
|
|
3002
3011
|
push: function (record) {
|
|
3003
3012
|
if (record.hasOwnProperty('data_types') && record['data_types']) {
|
|
3004
3013
|
if (record['data_types'].length > 0) {
|
|
@@ -3031,7 +3040,11 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
|
3031
3040
|
this.ignoreValue = true;
|
|
3032
3041
|
}
|
|
3033
3042
|
|
|
3034
|
-
|
|
3043
|
+
if (useTotalsCalculation) {
|
|
3044
|
+
return this.sum = val;
|
|
3045
|
+
} else {
|
|
3046
|
+
return this.sum += val;
|
|
3047
|
+
}
|
|
3035
3048
|
} else {
|
|
3036
3049
|
return this.sum = NaN;
|
|
3037
3050
|
}
|
|
@@ -3094,6 +3107,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
|
3094
3107
|
has_errors: false,
|
|
3095
3108
|
widget_values_format: widget_values_format,
|
|
3096
3109
|
calculated_formats: calculated_info.formats,
|
|
3110
|
+
isChangeable: false,
|
|
3097
3111
|
push: function (record) {
|
|
3098
3112
|
if (record.hasOwnProperty('data_types') && record['data_types']) {
|
|
3099
3113
|
if (record['data_types'].length > 0) {
|
|
@@ -3126,7 +3140,11 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
|
3126
3140
|
if (highchartsRenderer.ignoreIfCalculatedValue(data, rowKey, colKey, record, calculated_info.associated_fields, render_options, is_graph)) {
|
|
3127
3141
|
this.ignoreValue = true;
|
|
3128
3142
|
}
|
|
3129
|
-
|
|
3143
|
+
if (useTotalsCalculation) {
|
|
3144
|
+
return this.val = x;
|
|
3145
|
+
} else {
|
|
3146
|
+
return this.val = Math.min(x, (ref = this.val) != null ? ref : x);
|
|
3147
|
+
}
|
|
3130
3148
|
}
|
|
3131
3149
|
},
|
|
3132
3150
|
value: function () {
|
|
@@ -3187,6 +3205,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
|
3187
3205
|
has_errors: false,
|
|
3188
3206
|
widget_values_format: widget_values_format,
|
|
3189
3207
|
calculated_formats: calculated_info.formats,
|
|
3208
|
+
isChangeable: false,
|
|
3190
3209
|
push: function (record) {
|
|
3191
3210
|
if (record.hasOwnProperty('data_types') && record['data_types']) {
|
|
3192
3211
|
if (record['data_types'].length > 0) {
|
|
@@ -3219,8 +3238,12 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
|
3219
3238
|
if (highchartsRenderer.ignoreIfCalculatedValue(data, rowKey, colKey, record, calculated_info.associated_fields, render_options, is_graph)) {
|
|
3220
3239
|
this.ignoreValue = true;
|
|
3221
3240
|
}
|
|
3222
|
-
|
|
3223
|
-
|
|
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
|
+
} }
|
|
3224
3247
|
},
|
|
3225
3248
|
value: function () {
|
|
3226
3249
|
if (this.ignoreValue) {
|
|
@@ -3281,6 +3304,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
|
3281
3304
|
has_errors: false,
|
|
3282
3305
|
widget_values_format: widget_values_format,
|
|
3283
3306
|
calculated_formats: calculated_info.formats,
|
|
3307
|
+
isChangeable: false,
|
|
3284
3308
|
push: function (record) {
|
|
3285
3309
|
if (record.hasOwnProperty('data_types') && record['data_types']) {
|
|
3286
3310
|
if (record['data_types'].length > 0) {
|
|
@@ -3314,7 +3338,13 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
|
3314
3338
|
this.ignoreValue = true;
|
|
3315
3339
|
}
|
|
3316
3340
|
|
|
3317
|
-
|
|
3341
|
+
|
|
3342
|
+
if (useTotalsCalculation) {
|
|
3343
|
+
this.sum = parseFloat(x);
|
|
3344
|
+
} else {
|
|
3345
|
+
this.sum += parseFloat(x);
|
|
3346
|
+
}
|
|
3347
|
+
|
|
3318
3348
|
return this.len++;
|
|
3319
3349
|
}
|
|
3320
3350
|
},
|
|
@@ -3849,11 +3879,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
|
3849
3879
|
pivotData.sorters = new_sorting_function;
|
|
3850
3880
|
}
|
|
3851
3881
|
|
|
3852
|
-
|
|
3853
|
-
result = highchartsRenderer.generateFilteredResult(totalFilters, optsFiltered, rowData, opts, pivotData);
|
|
3854
|
-
} else {
|
|
3855
|
-
result = opts.renderer(pivotData, opts.rendererOptions);
|
|
3856
|
-
}
|
|
3882
|
+
result = opts.renderer(pivotData, opts.rendererOptions);
|
|
3857
3883
|
} catch (_error) {
|
|
3858
3884
|
e = _error;
|
|
3859
3885
|
if (typeof console !== "undefined" && console !== null) {
|
|
@@ -4804,6 +4830,12 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
|
4804
4830
|
value_name: 'remove_underscores',
|
|
4805
4831
|
default_value: true
|
|
4806
4832
|
},
|
|
4833
|
+
{
|
|
4834
|
+
element_type: 'checkbox',
|
|
4835
|
+
element_label: 'Use big data table',
|
|
4836
|
+
value_name: 'use_handsOnTable',
|
|
4837
|
+
default_value: false
|
|
4838
|
+
},
|
|
4807
4839
|
{
|
|
4808
4840
|
element_type: 'checkbox',
|
|
4809
4841
|
element_label: 'Use new table design',
|
|
@@ -5355,12 +5387,14 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
|
5355
5387
|
element_type: 'checkbox',
|
|
5356
5388
|
element_label: 'Sort by variance',
|
|
5357
5389
|
value_name: 'sort_by_variance',
|
|
5358
|
-
default_value: false
|
|
5390
|
+
default_value: false,
|
|
5391
|
+
hidden: true
|
|
5359
5392
|
}, {
|
|
5360
5393
|
element_type: 'checkbox',
|
|
5361
5394
|
element_label: 'Sort by absolute variance',
|
|
5362
5395
|
value_name: 'sort_by_absolute_variance',
|
|
5363
|
-
default_value: false
|
|
5396
|
+
default_value: false,
|
|
5397
|
+
hidden: true
|
|
5364
5398
|
}]
|
|
5365
5399
|
},
|
|
5366
5400
|
'delta_column_for_drill_down': {
|
|
@@ -5426,12 +5460,14 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
|
5426
5460
|
element_type: 'checkbox',
|
|
5427
5461
|
element_label: 'Sort by variance',
|
|
5428
5462
|
value_name: 'sort_by_variance',
|
|
5429
|
-
default_value: false
|
|
5463
|
+
default_value: false,
|
|
5464
|
+
hidden: true
|
|
5430
5465
|
}, {
|
|
5431
5466
|
element_type: 'checkbox',
|
|
5432
5467
|
element_label: 'Sort by absolute variance',
|
|
5433
5468
|
value_name: 'sort_by_absolute_variance',
|
|
5434
|
-
default_value: false
|
|
5469
|
+
default_value: false,
|
|
5470
|
+
hidden: true
|
|
5435
5471
|
}, {
|
|
5436
5472
|
element_type: 'checkbox',
|
|
5437
5473
|
element_label: 'Filter zero values',
|
|
@@ -6631,6 +6667,10 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
|
6631
6667
|
};
|
|
6632
6668
|
|
|
6633
6669
|
highchartsRenderer.setNewFieldNames = function (res) {
|
|
6670
|
+
if (useTotalsCalculation) {
|
|
6671
|
+
return res;
|
|
6672
|
+
}
|
|
6673
|
+
|
|
6634
6674
|
if (res && res[0] && res[0]['DR_Values']) {
|
|
6635
6675
|
lodash.forEach(res, function (item) {
|
|
6636
6676
|
item['DR_Values'] = highchartsRenderer.getFieldName(item['DR_Values']);
|
|
@@ -6712,7 +6752,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
|
6712
6752
|
"name": field.name,
|
|
6713
6753
|
"type": field.type,
|
|
6714
6754
|
"values": [],
|
|
6715
|
-
"sorting": field.sorting
|
|
6755
|
+
"sorting": field.sorting,
|
|
6716
6756
|
});
|
|
6717
6757
|
}
|
|
6718
6758
|
} else if (field.sorting && field.sorting.type == "CustomOrder" && field.sorting.values) {
|
|
@@ -6797,6 +6837,9 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
|
6797
6837
|
if (field.sorting && field.sorting.type == "DateString") {
|
|
6798
6838
|
return $.pivotUtilities.sortDateStrings(field.sorting.month_order);
|
|
6799
6839
|
} else if (field.sorting && field.sorting.type == "largestToSmallest") {
|
|
6840
|
+
if (field.sorting.is_absolute)
|
|
6841
|
+
return $.pivotUtilities.largeToSmallSortByAbsolute;
|
|
6842
|
+
|
|
6800
6843
|
return $.pivotUtilities.largeToSmallSort;
|
|
6801
6844
|
} else {
|
|
6802
6845
|
return $.pivotUtilities.sortAs(field.values);
|
package/src/pivottable.js
CHANGED
|
@@ -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 = {
|
|
@@ -689,7 +693,7 @@ let initPivotTable = function($, window, document) {
|
|
|
689
693
|
PivotData.forEachRecord(this.input, this.derivedAttributes, (function(_this) {
|
|
690
694
|
return function(record) {
|
|
691
695
|
if (_this.filter(record)) {
|
|
692
|
-
return _this.processRecord(record);
|
|
696
|
+
return _this.processRecord(record, useTotalsCalculation);
|
|
693
697
|
}
|
|
694
698
|
};
|
|
695
699
|
})(this));
|
|
@@ -1863,4 +1867,4 @@ let initPivotTable = function($, window, document) {
|
|
|
1863
1867
|
};
|
|
1864
1868
|
};
|
|
1865
1869
|
|
|
1866
|
-
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
|
-
|
|
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
|
});
|