intelica-library-ui 0.1.88 → 0.1.90
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.
|
@@ -2802,8 +2802,8 @@ class HtmlToExcelService {
|
|
|
2802
2802
|
const groupedIndices = new Set();
|
|
2803
2803
|
if (headerGroups.length > 0) {
|
|
2804
2804
|
for (const group of headerGroups) {
|
|
2805
|
-
const startChar = this.
|
|
2806
|
-
const endChar = this.
|
|
2805
|
+
const startChar = this.GetExcelColumnLetter(group.startColumn);
|
|
2806
|
+
const endChar = this.GetExcelColumnLetter(group.endColumn);
|
|
2807
2807
|
const range = `${startChar}${startRow}:${endChar}${startRow}`;
|
|
2808
2808
|
worksheet.mergeCells(range);
|
|
2809
2809
|
const cellGroup = `${startChar}${startRow}`;
|
|
@@ -2831,7 +2831,7 @@ class HtmlToExcelService {
|
|
|
2831
2831
|
}
|
|
2832
2832
|
}
|
|
2833
2833
|
for (let i = 0; i < columns.length; i++) {
|
|
2834
|
-
const colLetter = this.
|
|
2834
|
+
const colLetter = this.GetExcelColumnLetter(i);
|
|
2835
2835
|
const topCell = `${colLetter}${startRow}`;
|
|
2836
2836
|
const bottomCell = `${colLetter}${startRow + 1}`;
|
|
2837
2837
|
if (groupedIndices.has(i)) {
|
|
@@ -2889,7 +2889,7 @@ class HtmlToExcelService {
|
|
|
2889
2889
|
}
|
|
2890
2890
|
});
|
|
2891
2891
|
columns.forEach((col, index) => {
|
|
2892
|
-
const cellAddress = `${this.
|
|
2892
|
+
const cellAddress = `${this.GetExcelColumnLetter(index)}${startRow}`;
|
|
2893
2893
|
const cell = worksheet.getCell(cellAddress);
|
|
2894
2894
|
cell.font = {
|
|
2895
2895
|
name: "Arial",
|
|
@@ -2911,7 +2911,6 @@ class HtmlToExcelService {
|
|
|
2911
2911
|
for (let colIndex = 0; colIndex < columns.length; colIndex++) {
|
|
2912
2912
|
rowValues.push(colIndex === 0 ? `${rowIndex + 1}` : rows[rowIndex][columns[colIndex].columnName] ?? "");
|
|
2913
2913
|
}
|
|
2914
|
-
console.log(rowValues);
|
|
2915
2914
|
const insertedRow = worksheet.addRow(rowValues);
|
|
2916
2915
|
insertedRow.eachCell((cell, colNumber) => {
|
|
2917
2916
|
const col = columns[colNumber - 1];
|
|
@@ -2967,7 +2966,7 @@ class HtmlToExcelService {
|
|
|
2967
2966
|
});
|
|
2968
2967
|
//Subtitulos: Se inserta al final para evitar altere el autoajuste de las columnas
|
|
2969
2968
|
for (let i = 0; i < subtitles.length; i++) {
|
|
2970
|
-
const range = `A${6 + i}:${this.
|
|
2969
|
+
const range = `A${6 + i}:${this.GetExcelColumnLetter(columns.length - 1)}${6 + i}`;
|
|
2971
2970
|
worksheet.mergeCells(range);
|
|
2972
2971
|
const cell = worksheet.getCell(`A${6 + i}`);
|
|
2973
2972
|
cell.value = subtitles[i];
|
|
@@ -3034,7 +3033,7 @@ class HtmlToExcelService {
|
|
|
3034
3033
|
return;
|
|
3035
3034
|
if (columns[index] == undefined)
|
|
3036
3035
|
return;
|
|
3037
|
-
let columnWidth = columns[index].width ?? Math.max(...column.values.map(v => (v ? v.toString().length : 0)).filter(v => typeof v === "number"), columns[index].displayColumnName.length) * 1.
|
|
3036
|
+
let columnWidth = columns[index].width ?? Math.max(...column.values.map(v => (v ? v.toString().length : 0)).filter(v => typeof v === "number"), columns[index].displayColumnName.length) * 1.4;
|
|
3038
3037
|
column.width = Math.min(Math.max(columnWidth, 5), 100);
|
|
3039
3038
|
});
|
|
3040
3039
|
worksheet.eachRow((row, rowIndex) => {
|
|
@@ -3060,7 +3059,7 @@ class HtmlToExcelService {
|
|
|
3060
3059
|
worksheet.views = [{ showGridLines: false }];
|
|
3061
3060
|
const allColumns = orderColumn ? [{ displayColumnName: "N°" }, ...columns] : columns;
|
|
3062
3061
|
allColumns.forEach((col, index) => {
|
|
3063
|
-
const columnLetter = this.
|
|
3062
|
+
const columnLetter = this.GetExcelColumnLetter(index);
|
|
3064
3063
|
const headerCell = worksheet.getCell(`${columnLetter}1`);
|
|
3065
3064
|
headerCell.value = col.displayColumnName;
|
|
3066
3065
|
headerCell.alignment = { horizontal: "center", vertical: "middle" };
|
|
@@ -3094,7 +3093,7 @@ class HtmlToExcelService {
|
|
|
3094
3093
|
const buffer = await workbook.xlsx.writeBuffer();
|
|
3095
3094
|
saveAs(new Blob([buffer]), excelName);
|
|
3096
3095
|
}
|
|
3097
|
-
|
|
3096
|
+
GetExcelColumnLetter(columnNumber) {
|
|
3098
3097
|
let letter = "";
|
|
3099
3098
|
while (columnNumber >= 0) {
|
|
3100
3099
|
letter = String.fromCharCode(65 + (columnNumber % 26)) + letter;
|
|
@@ -3169,15 +3168,6 @@ class EchartService {
|
|
|
3169
3168
|
}
|
|
3170
3169
|
return axisConfiguration;
|
|
3171
3170
|
}
|
|
3172
|
-
getTooltipFormatter(color, title, body) {
|
|
3173
|
-
return `
|
|
3174
|
-
<div style="font-size: 12px; color: ${color}; border-radius: 6px; min-width: 120px; text-align: center;">
|
|
3175
|
-
<b style=" font-size: 13px;">${title} </b><br>
|
|
3176
|
-
<hr style="border: 1px solid ${color}; margin: 4px 0;">
|
|
3177
|
-
${body}
|
|
3178
|
-
</div>
|
|
3179
|
-
`;
|
|
3180
|
-
}
|
|
3181
3171
|
getGridConfiguration() {
|
|
3182
3172
|
return {
|
|
3183
3173
|
left: "0%",
|
|
@@ -3196,8 +3186,33 @@ class EchartService {
|
|
|
3196
3186
|
textStyle: { color: Color.blue, fontSize: 14 },
|
|
3197
3187
|
};
|
|
3198
3188
|
}
|
|
3189
|
+
/**
|
|
3190
|
+
*
|
|
3191
|
+
* @param color - Color of the tooltip
|
|
3192
|
+
* @param title - Title of the tooltip
|
|
3193
|
+
* @param body - Body of the tooltip
|
|
3194
|
+
* @returns - Tooltip HTML string
|
|
3195
|
+
*/
|
|
3196
|
+
getTooltipFormatter(color, title, body) {
|
|
3197
|
+
return `
|
|
3198
|
+
<div style="font-size: 12px; color: ${color}; border-radius: 6px; min-width: 120px; text-align: center;">
|
|
3199
|
+
<b style=" font-size: 13px;">${title} </b><br>
|
|
3200
|
+
<hr style="border: 1px solid ${color}; margin: 4px 0;">
|
|
3201
|
+
${body}
|
|
3202
|
+
</div>
|
|
3203
|
+
`;
|
|
3204
|
+
}
|
|
3199
3205
|
/// Charts Configuration
|
|
3200
3206
|
/// BAR CHARTS
|
|
3207
|
+
/**
|
|
3208
|
+
*
|
|
3209
|
+
* @param categories - Array of categories for the x-axis
|
|
3210
|
+
* @param series - Array of series data, each containing name, value, and color
|
|
3211
|
+
* @param labelConfig - Optional label configuration for the bars
|
|
3212
|
+
* @param tooltipConfig - Optional tooltip configuration for the bars
|
|
3213
|
+
* @param showLegend - Optional flag to show the legend
|
|
3214
|
+
* @returns - EChartsOption - Configuration object for the bar chart
|
|
3215
|
+
*/
|
|
3201
3216
|
getBarChartOptions(categories, series, labelConfig, tooltipConfig, showLegend = false) {
|
|
3202
3217
|
return {
|
|
3203
3218
|
xAxis: this.getCategoryAxisConfiguration(categories),
|
|
@@ -3230,6 +3245,15 @@ class EchartService {
|
|
|
3230
3245
|
legend: showLegend ? this.getLegendConfiguration() : undefined,
|
|
3231
3246
|
};
|
|
3232
3247
|
}
|
|
3248
|
+
/**
|
|
3249
|
+
*
|
|
3250
|
+
* @param categories - Array of categories for the x-axis
|
|
3251
|
+
* @param series - Array of series data, each containing name, value, and color
|
|
3252
|
+
* @param labelConfig - Optional label configuration for the bars
|
|
3253
|
+
* @param tooltipConfig - Optional tooltip configuration for the bars
|
|
3254
|
+
* @param showLegend - Optional flag to show the legend
|
|
3255
|
+
* @returns - EChartsOption - Configuration object for the bar chart
|
|
3256
|
+
*/
|
|
3233
3257
|
getBarChartStackOptions(categories, series, labelConfig, tooltipConfig, showLegend = false) {
|
|
3234
3258
|
let barBase = this.getBarChartOptions(categories, series, labelConfig, tooltipConfig, showLegend);
|
|
3235
3259
|
barBase.series.forEach((serie, index) => {
|
|
@@ -3243,6 +3267,15 @@ class EchartService {
|
|
|
3243
3267
|
});
|
|
3244
3268
|
return barBase;
|
|
3245
3269
|
}
|
|
3270
|
+
/**
|
|
3271
|
+
*
|
|
3272
|
+
* @param categories - Array of categories for the y-axis
|
|
3273
|
+
* @param series - Array of series data, each containing name, value, and color
|
|
3274
|
+
* @param labelConfig - Optional label configuration for the bars
|
|
3275
|
+
* @param tooltipConfig - Optional tooltip configuration for the bars
|
|
3276
|
+
* @param showLegend - Optional flag to show the legend
|
|
3277
|
+
* @returns - EChartsOption - Configuration object for the bar chart
|
|
3278
|
+
*/
|
|
3246
3279
|
getBarChartHorizontalOptions(categories, series, labelConfig, tooltipConfig, showLegend = false) {
|
|
3247
3280
|
let barBase = this.getBarChartOptions(categories, series, labelConfig, tooltipConfig, showLegend);
|
|
3248
3281
|
barBase.xAxis = this.getValueAxisConfiguration();
|
|
@@ -3252,8 +3285,23 @@ class EchartService {
|
|
|
3252
3285
|
serie.label.position = "right";
|
|
3253
3286
|
}
|
|
3254
3287
|
});
|
|
3288
|
+
if (barBase.grid) {
|
|
3289
|
+
barBase.grid.left = "10%";
|
|
3290
|
+
barBase.grid.right = "10%";
|
|
3291
|
+
barBase.grid.bottom = "10%";
|
|
3292
|
+
barBase.grid.containLabel = true;
|
|
3293
|
+
}
|
|
3255
3294
|
return barBase;
|
|
3256
3295
|
}
|
|
3296
|
+
/**
|
|
3297
|
+
*
|
|
3298
|
+
* @param categories - Array of categories for the y-axis
|
|
3299
|
+
* @param series - Array of series data, each containing name, value, and color
|
|
3300
|
+
* @param labelConfig - Optional label configuration for the bars
|
|
3301
|
+
* @param tooltipConfig - Optional tooltip configuration for the bars
|
|
3302
|
+
* @param showLegend - Optional flag to show the legend
|
|
3303
|
+
* @returns - EChartsOption - Configuration object for the bar chart
|
|
3304
|
+
*/
|
|
3257
3305
|
getBarChartHorizontalStackOptions(categories, series, labelConfig, tooltipConfig, showLegend = false) {
|
|
3258
3306
|
let barBase = this.getBarChartHorizontalOptions(categories, series, labelConfig, tooltipConfig, showLegend);
|
|
3259
3307
|
barBase.series.forEach((serie, index) => {
|
|
@@ -3268,13 +3316,26 @@ class EchartService {
|
|
|
3268
3316
|
serie.label = undefined;
|
|
3269
3317
|
}
|
|
3270
3318
|
});
|
|
3319
|
+
if (barBase.grid) {
|
|
3320
|
+
barBase.grid.left = "10%";
|
|
3321
|
+
barBase.grid.right = "10%";
|
|
3322
|
+
barBase.grid.bottom = "10%";
|
|
3323
|
+
barBase.grid.containLabel = true;
|
|
3324
|
+
}
|
|
3271
3325
|
return barBase;
|
|
3272
3326
|
}
|
|
3327
|
+
/**
|
|
3328
|
+
*
|
|
3329
|
+
* @param categories - Array of categories for the y-axis
|
|
3330
|
+
* @param series - Array of series data, each containing name, value, and color
|
|
3331
|
+
* @param labelConfig - Optional label configuration for the bars
|
|
3332
|
+
* @param tooltipConfig - Optional tooltip configuration for the bars
|
|
3333
|
+
* @param showLegend - Optional flag to show the legend
|
|
3334
|
+
* @returns - EChartsOption - Configuration object for the bar chart
|
|
3335
|
+
*/
|
|
3273
3336
|
getBarChartTopOptions(categories, series, categoryWidth = 240, labelConfig, tooltipConfig, showLegend = false) {
|
|
3274
3337
|
let barBase = this.getBarChartHorizontalOptions(categories, series, labelConfig, tooltipConfig, showLegend);
|
|
3275
3338
|
if (barBase.yAxis) {
|
|
3276
|
-
// (barBase.yAxis as YAXisComponentOption).show = true;
|
|
3277
|
-
// (barBase.yAxis as YAXisComponentOption).splitLine!.show = true;
|
|
3278
3339
|
barBase.yAxis.inverse = true;
|
|
3279
3340
|
barBase.yAxis.axisLabel.color = Color.blue;
|
|
3280
3341
|
barBase.yAxis.axisLabel.fontSize = 12;
|
|
@@ -3296,6 +3357,15 @@ class EchartService {
|
|
|
3296
3357
|
return barBase;
|
|
3297
3358
|
}
|
|
3298
3359
|
/// LINE CHARTS
|
|
3360
|
+
/**
|
|
3361
|
+
*
|
|
3362
|
+
* @param categories - Array of categories for the x-axis
|
|
3363
|
+
* @param series - Array of series data, each containing name, value, and color
|
|
3364
|
+
* @param labelConfig - Optional label configuration for the lines
|
|
3365
|
+
* @param tooltipConfig - Optional tooltip configuration for the lines
|
|
3366
|
+
* @param showLegend - Optional flag to show the legend
|
|
3367
|
+
* @returns - EChartsOption - Configuration object for the line chart
|
|
3368
|
+
*/
|
|
3299
3369
|
getLineChartOptions(categories, series, labelConfig, tooltipConfig, showLegend = false) {
|
|
3300
3370
|
return {
|
|
3301
3371
|
xAxis: this.getCategoryAxisConfiguration(categories),
|
|
@@ -3351,6 +3421,13 @@ class EchartService {
|
|
|
3351
3421
|
};
|
|
3352
3422
|
}
|
|
3353
3423
|
/// PIE CHARTS
|
|
3424
|
+
/**
|
|
3425
|
+
*
|
|
3426
|
+
* @param data - Array of series data, each containing name, value, and color
|
|
3427
|
+
* @param labelConfig - Optional label configuration
|
|
3428
|
+
* @param tooltipConfig - Optional tooltip configuration
|
|
3429
|
+
* @returns - EChartsOption - Configuration object for the pie
|
|
3430
|
+
*/
|
|
3354
3431
|
getDoughnutPieOptions(data, labelConfig, tooltipConfig) {
|
|
3355
3432
|
return {
|
|
3356
3433
|
series: [
|
|
@@ -3395,6 +3472,14 @@ class EchartService {
|
|
|
3395
3472
|
},
|
|
3396
3473
|
};
|
|
3397
3474
|
}
|
|
3475
|
+
/**
|
|
3476
|
+
*
|
|
3477
|
+
* @param letter - text to show in the center of the pie
|
|
3478
|
+
* @param value - rate value
|
|
3479
|
+
* @param textSize - size of the letter
|
|
3480
|
+
* @param color - color of the letter and pie
|
|
3481
|
+
* @returns
|
|
3482
|
+
*/
|
|
3398
3483
|
getRateDoughnutPieOptions(letter, value, textSize, color) {
|
|
3399
3484
|
const power = Math.ceil(Math.log10(value));
|
|
3400
3485
|
const placeholderValue = Math.pow(10, power);
|