@isoftdata/svelte-table 2.10.0-beta.1 → 2.10.1
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/README.md +1 -0
- package/dist/Table.svelte +15 -3
- package/dist/Td.svelte +4 -2
- package/dist/column-info-store.svelte.js +2 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -35,6 +35,7 @@ This component uses a generic type `R` to represent the type of a single row pas
|
|
|
35
35
|
| class | `string` | Any extra classes to apply to the `table`. | `""` |
|
|
36
36
|
| columnClickedMethod | `(column: Column, direction: SortDirection) => void` | Called when a column is clicked. Should update `previousSortOrder`, `previousSortDirection`, `previousSortColumn`, and `sortedRows`. | `defaultColumnClicked` |
|
|
37
37
|
| columnHidingEnabled | `boolean` | When enabled, the user will be able to right click a column header and hide/show it. | `false` |
|
|
38
|
+
| columnPinningEnabled | `boolean` | When enabled, the user will be able to right click a column header and pin or unpin it. | `false` |
|
|
38
39
|
| columnResizingEnabled | `boolean` | When enabled, the user will be able to drag on the edge of a column header and resize it. | `false` |
|
|
39
40
|
| columns | `Array<Column>` | The definition of the columns. See columns docs below. | **Required** |
|
|
40
41
|
| currentPageNumber | `number` | The current page number. | `1` |
|
package/dist/Table.svelte
CHANGED
|
@@ -1000,14 +1000,26 @@
|
|
|
1000
1000
|
<DropdownItem
|
|
1001
1001
|
icon={isPinned ? 'thumbtack-angle-slash' : 'thumbtack-angle'}
|
|
1002
1002
|
title={isPinned
|
|
1003
|
-
? 'Unpinning this column will make it scroll normally'
|
|
1004
|
-
:
|
|
1003
|
+
? translate('common:tableUnpinColumnTitle', 'Unpinning this column will make it scroll normally')
|
|
1004
|
+
: translate(
|
|
1005
|
+
'common:tablePinColumnTitle',
|
|
1006
|
+
'Pinning this column will keep it visible as you scroll to the right',
|
|
1007
|
+
)}
|
|
1005
1008
|
onclick={() => {
|
|
1006
1009
|
if (contextMenuColumn) {
|
|
1007
1010
|
pinUnpinColumn(contextMenuColumn)
|
|
1008
1011
|
}
|
|
1009
1012
|
}}
|
|
1010
|
-
>{
|
|
1013
|
+
>{#if contextMenuColumn?.name}
|
|
1014
|
+
{isPinned
|
|
1015
|
+
? translate('common:tableUnpinColumnName', 'Unpin {{name}}', { name: contextMenuColumn.name })
|
|
1016
|
+
: translate('common:tablePinColumnName', 'Pin {{name}}', { name: contextMenuColumn.name })}
|
|
1017
|
+
{:else}
|
|
1018
|
+
{isPinned ? translate('common:tableUnpinColumn', 'Unpin') : translate('common:tablePinColumn', 'Pin')}
|
|
1019
|
+
{#if contextMenuColumn?.icon}
|
|
1020
|
+
<Icon icon={contextMenuColumn.icon}></Icon>
|
|
1021
|
+
{/if}
|
|
1022
|
+
{/if}
|
|
1011
1023
|
</DropdownItem>
|
|
1012
1024
|
|
|
1013
1025
|
{#if columnHidingEnabled || columnResizingEnabled}
|
package/dist/Td.svelte
CHANGED
|
@@ -46,7 +46,9 @@
|
|
|
46
46
|
...rest
|
|
47
47
|
}: Props = $props()
|
|
48
48
|
|
|
49
|
-
const thisColumnInfo = $derived(
|
|
49
|
+
const thisColumnInfo = $derived(
|
|
50
|
+
columnInfo.current[property] as (typeof columnInfo.current)[typeof property] | undefined,
|
|
51
|
+
)
|
|
50
52
|
const alignClass = $derived.by(() => {
|
|
51
53
|
let alignment = align || thisColumnInfo?.align || (thisColumnInfo?.numeric ? 'right' : undefined)
|
|
52
54
|
if (bs5 && alignment === 'right') {
|
|
@@ -118,7 +120,7 @@
|
|
|
118
120
|
style:text-overflow={$columnResizingEnabled ? 'ellipsis' : undefined}
|
|
119
121
|
style:position={thisColumnInfo?.pinned ? 'sticky' : undefined}
|
|
120
122
|
style:left={thisColumnInfo?.pinned ? columnInfo.getPinnedColumnOffset(property) : undefined}
|
|
121
|
-
style:z-index={thisColumnInfo
|
|
123
|
+
style:z-index={thisColumnInfo?.pinned ? 5 : undefined}
|
|
122
124
|
>
|
|
123
125
|
<!--
|
|
124
126
|
Don't listen to events that the user hasn't turned on the features for.
|
|
@@ -77,7 +77,7 @@ export class ColumnInfoRunicStore {
|
|
|
77
77
|
return '0px';
|
|
78
78
|
}
|
|
79
79
|
else if (colIndex === 0) {
|
|
80
|
-
return '
|
|
80
|
+
return '-1px'; // Fix the gap on the left side of the first column
|
|
81
81
|
}
|
|
82
82
|
const offsetPx = this.pinnedColumns.slice(0, colIndex).reduce((acc, col) => {
|
|
83
83
|
if (col.userWidth && col.visible) {
|
|
@@ -88,7 +88,7 @@ export class ColumnInfoRunicStore {
|
|
|
88
88
|
}
|
|
89
89
|
return acc;
|
|
90
90
|
}, 0);
|
|
91
|
-
return `${offsetPx}px`;
|
|
91
|
+
return `${offsetPx - colIndex - 1}px`;
|
|
92
92
|
}
|
|
93
93
|
getStoreValFromColumns(columns, storeValue) {
|
|
94
94
|
const columnInfo = columns.reduce((acc, column) => {
|