@emamid/svelte-data-table 0.0.9 → 0.0.11
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 +2 -0
- package/dist/DataTable.doc.d.ts +2 -0
- package/dist/DataTable.doc.js +2 -0
- package/dist/DataTable.svelte +6 -1
- package/dist/DataTable.svelte.d.ts +2 -0
- package/dist/DataTableHeaderCell.svelte +6 -3
- package/dist/DataTableHeaderCell.svelte.d.ts +2 -0
- package/dist/common.d.ts +4 -0
- package/package.json +1 -1
package/README.md
CHANGED
package/dist/DataTable.doc.d.ts
CHANGED
|
@@ -7,6 +7,8 @@
|
|
|
7
7
|
* @property {SortFunction} [sortFunction] - Function for more complex-sorting.
|
|
8
8
|
* @property {boolean} [reverseSort] - True when sorting is reversed.
|
|
9
9
|
* @property {string} [sortColumnID] - The id (or key) property of the column being sorted by.
|
|
10
|
+
* @property {ConstructorOfATypedSvelteComponent} [sortAscendingIcon] - Svelte component class to be displayed in columns that are sorting ascended. Defaults to AngleDownSolid from {@link https://flowbite.com/icons/}
|
|
11
|
+
* @property {ConstructorOfATypedSvelteComponent} [sortDescendingIcon] - Svelte component class to be displayed in columns that are sorting descended. Defaults to AngleUpSolid from {@link https://flowbite.com/icons/}
|
|
10
12
|
* @property {string} [itemKey] - Property to use when distinguish between rows. If not populated, the array index is used.
|
|
11
13
|
* @property {EnterAction} [enterAction] - Determines what pressing the enter key in a focused cell does. Can be 'next', 'down', or 'stay'. Default is 'next'. If 'next', enter will act the same as tab. If 'down', focus will move down to the row below the current one. If 'stay', the enter key will not cause movement.
|
|
12
14
|
* @property {string} [divClassAppend] - Classes to be appended to Table.divClass .
|
package/dist/DataTable.doc.js
CHANGED
|
@@ -8,6 +8,8 @@
|
|
|
8
8
|
* @property {SortFunction} [sortFunction] - Function for more complex-sorting.
|
|
9
9
|
* @property {boolean} [reverseSort] - True when sorting is reversed.
|
|
10
10
|
* @property {string} [sortColumnID] - The id (or key) property of the column being sorted by.
|
|
11
|
+
* @property {ConstructorOfATypedSvelteComponent} [sortAscendingIcon] - Svelte component class to be displayed in columns that are sorting ascended. Defaults to AngleDownSolid from {@link https://flowbite.com/icons/}
|
|
12
|
+
* @property {ConstructorOfATypedSvelteComponent} [sortDescendingIcon] - Svelte component class to be displayed in columns that are sorting descended. Defaults to AngleUpSolid from {@link https://flowbite.com/icons/}
|
|
11
13
|
* @property {string} [itemKey] - Property to use when distinguish between rows. If not populated, the array index is used.
|
|
12
14
|
* @property {EnterAction} [enterAction] - Determines what pressing the enter key in a focused cell does. Can be 'next', 'down', or 'stay'. Default is 'next'. If 'next', enter will act the same as tab. If 'down', focus will move down to the row below the current one. If 'stay', the enter key will not cause movement.
|
|
13
15
|
* @property {string} [divClassAppend] - Classes to be appended to Table.divClass .
|
package/dist/DataTable.svelte
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
<script>import { createEventDispatcher } from "svelte";
|
|
2
|
-
import {
|
|
2
|
+
import { Table, TableBody, TableBodyRow, TableHead } from "flowbite-svelte";
|
|
3
|
+
import { AngleDownSolid, AngleUpSolid } from "flowbite-svelte-icons";
|
|
3
4
|
import DataTableDataCell from "./DataTableDataCell.svelte";
|
|
4
5
|
import DataTableHeaderCell from "./DataTableHeaderCell.svelte";
|
|
5
6
|
import { joinClasses } from "./common.js";
|
|
@@ -9,6 +10,8 @@ export let sortKey = "";
|
|
|
9
10
|
export let sortFunction = null;
|
|
10
11
|
export let reverseSort = false;
|
|
11
12
|
export let sortColumnID = null;
|
|
13
|
+
export let sortAscendingIcon = AngleDownSolid;
|
|
14
|
+
export let sortDescendingIcon = AngleUpSolid;
|
|
12
15
|
export let itemKey = null;
|
|
13
16
|
export let enterAction = "next";
|
|
14
17
|
export let divClassAppend = "";
|
|
@@ -209,6 +212,8 @@ const rowClicked = (item) => {
|
|
|
209
212
|
{column}
|
|
210
213
|
isSorted={!!sortColumnID && getColumnID(column) === sortColumnID}
|
|
211
214
|
{reverseSort}
|
|
215
|
+
defaultSortAscendingIcon={sortAscendingIcon}
|
|
216
|
+
defaultSortDescendingIcon={sortDescendingIcon}
|
|
212
217
|
{thClass}
|
|
213
218
|
on:click={() => headerClicked(column)}
|
|
214
219
|
/>
|
|
@@ -8,6 +8,8 @@ declare const __propDef: {
|
|
|
8
8
|
sortFunction?: SortFunction | undefined | null;
|
|
9
9
|
reverseSort?: boolean | undefined;
|
|
10
10
|
sortColumnID?: string | null | undefined;
|
|
11
|
+
sortAscendingIcon?: ConstructorOfATypedSvelteComponent | undefined;
|
|
12
|
+
sortDescendingIcon?: ConstructorOfATypedSvelteComponent | undefined;
|
|
11
13
|
itemKey?: string | null | undefined;
|
|
12
14
|
enterAction?: EnterAction | undefined;
|
|
13
15
|
divClassAppend?: string | undefined;
|
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
<script>import { TableHeadCell } from "flowbite-svelte";
|
|
2
|
-
import { AngleDownSolid, AngleUpSolid } from "flowbite-svelte-icons";
|
|
3
2
|
import { joinClasses } from "./common.js";
|
|
4
3
|
export let column;
|
|
5
4
|
export let reverseSort;
|
|
6
5
|
export let isSorted;
|
|
6
|
+
export let defaultSortAscendingIcon;
|
|
7
|
+
export let defaultSortDescendingIcon;
|
|
7
8
|
export let thClass;
|
|
9
|
+
const sortAscendingIcon = column.sortAscendingIcon || defaultSortAscendingIcon;
|
|
10
|
+
const sortDescendingIcon = column.sortDescendingIcon || defaultSortDescendingIcon;
|
|
8
11
|
</script>
|
|
9
12
|
|
|
10
13
|
<TableHeadCell
|
|
@@ -13,9 +16,9 @@ export let thClass;
|
|
|
13
16
|
>
|
|
14
17
|
{#if isSorted}
|
|
15
18
|
{#if reverseSort}
|
|
16
|
-
<
|
|
19
|
+
<svelte:component this={sortAscendingIcon} class="inline h-3 w-3" />
|
|
17
20
|
{:else}
|
|
18
|
-
<
|
|
21
|
+
<svelte:component this={sortDescendingIcon} class="inline h-3 w-3" />
|
|
19
22
|
{/if}
|
|
20
23
|
{/if}
|
|
21
24
|
<span>{column.title}</span>
|
|
@@ -5,6 +5,8 @@ declare const __propDef: {
|
|
|
5
5
|
column: InternalColumnConfig;
|
|
6
6
|
reverseSort: boolean;
|
|
7
7
|
isSorted: boolean;
|
|
8
|
+
defaultSortAscendingIcon: ConstructorOfATypedSvelteComponent;
|
|
9
|
+
defaultSortDescendingIcon: ConstructorOfATypedSvelteComponent;
|
|
8
10
|
thClass: string;
|
|
9
11
|
};
|
|
10
12
|
events: {
|
package/dist/common.d.ts
CHANGED
|
@@ -70,6 +70,8 @@ b: any) => number;
|
|
|
70
70
|
* @property {string} [thClassOverride] - Class to replace existing CSS for header cells.
|
|
71
71
|
* @property {boolean} [canFocus] - True if cells in this column can be focused.
|
|
72
72
|
* @property {boolean} [canSort] - If true, clicking the column's header will set sorting to sortFunction or sortKey, or reverse it if already set.
|
|
73
|
+
* @property {ConstructorOfATypedSvelteComponent} [sortAscendingIcon] - Svelte component class to be displayed in the column is sorting ascended (overrides table).
|
|
74
|
+
* @property {ConstructorOfATypedSvelteComponent} [sortDescendingIcon] - Svelte component class to be displayed in the column is sorting descended (overrides table).
|
|
73
75
|
* @property {SortFunction} [sortFunction] - Comparison function for complex sorting.
|
|
74
76
|
* @property {string} [sortKey] - Item property to sort by, if sortFunction is not defined.
|
|
75
77
|
*/
|
|
@@ -93,6 +95,8 @@ export interface ColumnConfig {
|
|
|
93
95
|
canSort?: boolean;
|
|
94
96
|
sortFunction?: SortFunction;
|
|
95
97
|
sortKey?: string;
|
|
98
|
+
sortAscendingIcon?: ConstructorOfATypedSvelteComponent;
|
|
99
|
+
sortDescendingIcon?: ConstructorOfATypedSvelteComponent;
|
|
96
100
|
}
|
|
97
101
|
/**
|
|
98
102
|
* Returns the a class string for a data row.
|