@eturnity/eturnity_reusable_components 8.16.9-EPDM-14690.3 → 8.16.9-EPDM-14690.4

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": "@eturnity/eturnity_reusable_components",
3
- "version": "8.16.9-EPDM-14690.3",
3
+ "version": "8.16.9-EPDM-14690.4",
4
4
  "files": [
5
5
  "dist",
6
6
  "src"
@@ -217,6 +217,7 @@
217
217
  const data = item.data.map((d, dIndex) => ({
218
218
  label: d.label,
219
219
  value: d.value,
220
+ percentage: d.percentage,
220
221
  originalValue: currentSeriesData.length
221
222
  ? currentSeriesData[itemIndex].data[dIndex].originalValue
222
223
  : d.value,
@@ -276,58 +277,27 @@
276
277
  return data.find((d) => d.label === label)?.value
277
278
  }
278
279
 
279
- const value = data.find((d) => d.label === label)?.value || 0
280
-
281
- const total = seriesData.value.reduce((sum, series) => {
282
- const value =
283
- series.data.find((d) => d.label === label)?.originalValue || 0
284
- return sum + value
285
- }, 0)
286
-
287
- return shouldRound ? (value / total) * 100 : (value / total) * 100
280
+ return data.find((d) => d.label === label)?.percentage
288
281
  }
289
282
 
290
283
  const calculatePercentageTotal = (label) => {
291
- const originalTotal = seriesData.value.reduce((sum, series) => {
292
- const originalValue =
293
- series.data.find((d) => d.label === label)?.originalValue || 0
294
- return sum + originalValue
295
- }, 0)
296
-
297
- const totalPercentage = seriesData.value.reduce((sum, series) => {
298
- const value = series.data.find((d) => d.label === label)?.value || 0
299
- const percentage = originalTotal
300
- ? Number((value / originalTotal) * 100)
301
- : 0
284
+ const percentageTotal = seriesData.value.reduce((sum, series) => {
285
+ const percentage =
286
+ series.data.find((d) => d.label === label)?.percentage || 0
302
287
  return sum + percentage
303
288
  }, 0)
304
289
 
305
- return Math.round(totalPercentage)
290
+ return Math.round(percentageTotal)
306
291
  }
307
292
 
308
293
  const handleInputBlur = (_value, seriesName, label, currentSeriesData) => {
309
294
  let value = Number(_value)
310
295
 
311
- if (props.fieldMode === 'percentage') {
312
- const total = seriesData.value.reduce((sum, series) => {
313
- const value =
314
- series.data.find((d) => d.label === label)?.originalValue || 0
315
- return sum + value
316
- }, 0)
317
-
318
- value = (value / 100) * total
319
- }
320
-
321
296
  const payload = seriesName
322
297
  ? {
323
298
  seriesName,
324
299
  label,
325
300
  value,
326
- inputValue: _value,
327
- percentage: Number(
328
- getDisplayValue(currentSeriesData, label, false).toFixed(2)
329
- ),
330
- totalSeriesValue: calculateTotalOriginalValue(label),
331
301
  }
332
302
  : { label, value }
333
303
  emit('input-blur', payload)
@@ -365,11 +335,6 @@
365
335
  emit('sync-scroll', event.target.scrollLeft)
366
336
  }
367
337
 
368
- const toFixedNoRounding = (number, decimals) => {
369
- const factor = Math.pow(10, decimals)
370
- return Math.floor(number * factor) / factor
371
- }
372
-
373
338
  defineExpose({
374
339
  syncScroll,
375
340
  })