@softwareone/spi-sv5-library 1.10.3 → 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.
@@ -1,5 +1,6 @@
1
1
  <script lang="ts">
2
2
  import type { Snippet } from 'svelte';
3
+ import type { Attachment } from 'svelte/attachments';
3
4
  import type { HTMLButtonAttributes } from 'svelte/elements';
4
5
 
5
6
  type Variant = 'primary' | 'secondary' | 'outline' | 'outline-none';
@@ -16,14 +17,20 @@
16
17
  variant = 'primary',
17
18
  variantColor = 'primary',
18
19
  loading = false,
20
+ disabled = false,
19
21
  children,
20
22
  ...props
21
23
  }: ButtonProps = $props();
24
+
25
+ const clearButtonFocus: Attachment<HTMLButtonElement> = (element: HTMLButtonElement) => {
26
+ if (loading) element.blur();
27
+ };
22
28
  </script>
23
29
 
24
30
  <button
31
+ {@attach clearButtonFocus}
25
32
  class={['btn', `btn-${variant}-${variantColor}`, loading && 'loading']}
26
- disabled={loading || props.disabled}
33
+ disabled={loading || disabled}
27
34
  {...props}
28
35
  >
29
36
  {#if loading}
@@ -101,10 +108,6 @@
101
108
  color: #dc182c;
102
109
  }
103
110
 
104
- .btn.loading {
105
- cursor: wait;
106
- }
107
-
108
111
  @keyframes spin {
109
112
  from {
110
113
  transform: rotate(0deg);
@@ -119,8 +122,8 @@
119
122
  cursor: pointer;
120
123
  }
121
124
 
122
- .btn:focus:not(:disabled),
123
- .btn:focus-visible:not(:disabled) {
125
+ .btn:focus:not(:disabled):not(.loading),
126
+ .btn:focus-visible:not(:disabled):not(.loading) {
124
127
  box-shadow: 0px 0px 0px 3px #959bff;
125
128
  outline: none;
126
129
  }
@@ -164,7 +164,7 @@
164
164
 
165
165
  .table-header-search {
166
166
  display: flex;
167
- width: 100%;
167
+ min-width: 144px;
168
168
  margin: var(--spacing-xs) 0;
169
169
  font-weight: var(--font-normal);
170
170
  }
@@ -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
- worksheet.columns = getColumns(table, excelSetting);
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]);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@softwareone/spi-sv5-library",
3
- "version": "1.10.3",
3
+ "version": "1.10.5",
4
4
  "description": "Svelte components",
5
5
  "keywords": [
6
6
  "svelte",