@softwareone/spi-sv5-library 1.10.4 → 1.10.5
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/dist/Button/Button.svelte +2 -1
- package/dist/Table/excel.js +11 -1
- package/package.json +1 -1
|
@@ -17,6 +17,7 @@
|
|
|
17
17
|
variant = 'primary',
|
|
18
18
|
variantColor = 'primary',
|
|
19
19
|
loading = false,
|
|
20
|
+
disabled = false,
|
|
20
21
|
children,
|
|
21
22
|
...props
|
|
22
23
|
}: ButtonProps = $props();
|
|
@@ -29,7 +30,7 @@
|
|
|
29
30
|
<button
|
|
30
31
|
{@attach clearButtonFocus}
|
|
31
32
|
class={['btn', `btn-${variant}-${variantColor}`, loading && 'loading']}
|
|
32
|
-
disabled={loading ||
|
|
33
|
+
disabled={loading || disabled}
|
|
33
34
|
{...props}
|
|
34
35
|
>
|
|
35
36
|
{#if loading}
|
package/dist/Table/excel.js
CHANGED
|
@@ -5,10 +5,12 @@ import { ColumnFormat } from './excel-setting.js';
|
|
|
5
5
|
export const exportExcel = async (table, excelSetting) => {
|
|
6
6
|
const workbook = new ExcelJS.Workbook();
|
|
7
7
|
const worksheet = workbook.addWorksheet('Sheet 1');
|
|
8
|
-
|
|
8
|
+
const columns = getColumns(table, excelSetting);
|
|
9
|
+
worksheet.columns = columns;
|
|
9
10
|
const rows = getRows(table, excelSetting);
|
|
10
11
|
worksheet.addRows(rows);
|
|
11
12
|
setStyle(worksheet);
|
|
13
|
+
setAutoFilter(worksheet, columns.length, rows.length);
|
|
12
14
|
await downloadFile(workbook, excelSetting.fileName);
|
|
13
15
|
};
|
|
14
16
|
const getColumns = (table, excelSetting) => {
|
|
@@ -58,6 +60,14 @@ const setStyle = (worksheet) => {
|
|
|
58
60
|
cell.font = { bold: true };
|
|
59
61
|
});
|
|
60
62
|
};
|
|
63
|
+
const setAutoFilter = (worksheet, columnCount, rowCount) => {
|
|
64
|
+
if (columnCount && rowCount) {
|
|
65
|
+
worksheet.autoFilter = {
|
|
66
|
+
from: { row: 1, column: 1 },
|
|
67
|
+
to: { row: rowCount + 1, column: columnCount }
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
};
|
|
61
71
|
const downloadFile = async (workbook, fileName) => {
|
|
62
72
|
const buffer = await workbook.xlsx.writeBuffer();
|
|
63
73
|
const blob = new Blob([buffer]);
|