@beeblock/svelar-datatable 0.1.7 → 0.2.0
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 +347 -154
- package/dist/SvelarDatatablePlugin.d.ts +57 -2
- package/dist/index.js +7 -7
- package/dist/plugin.js +1 -1
- package/dist/server/DataTableService.d.ts +21 -0
- package/dist/server/index.js +1 -1
- package/dist/state/ServerDataTableStore.d.ts +2 -0
- package/dist/types.d.ts +2 -0
- package/package.json +82 -76
- package/src/state/ServerDataTableStore.ts +14 -0
- package/src/types.ts +2 -0
- package/src/ui/DataTable.svelte +8 -4
- package/src/ui/DataTableBody.svelte +3 -1
- package/src/ui/DataTableBubbleEditor.svelte +4 -1
- package/src/ui/DataTableButtons.svelte +12 -6
- package/src/ui/DataTableCell.svelte +3 -1
- package/src/ui/DataTableColumnToggle.svelte +2 -1
- package/src/ui/DataTableEditor.svelte +3 -1
- package/src/ui/DataTableEditorField.svelte +3 -1
- package/src/ui/DataTableEditorForm.svelte +1 -1
- package/src/ui/DataTableFooter.svelte +3 -1
- package/src/ui/DataTableHead.svelte +3 -1
- package/src/ui/DataTableModalEditor.svelte +4 -1
- package/src/ui/DataTablePagination.svelte +3 -1
- package/src/ui/DataTableRow.svelte +22 -3
- package/src/ui/DataTableSearch.svelte +3 -1
- package/src/ui/DataTableToolbar.svelte +3 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
import type { EditorFieldDef, DataTableStore } from '../index.
|
|
2
|
+
import type { EditorFieldDef, DataTableStore } from '../index.ts';
|
|
3
3
|
|
|
4
4
|
interface Props {
|
|
5
5
|
field: EditorFieldDef;
|
|
@@ -7,6 +7,8 @@
|
|
|
7
7
|
}
|
|
8
8
|
let { field, store }: Props = $props();
|
|
9
9
|
|
|
10
|
+
// svelte-ignore state_referenced_locally
|
|
11
|
+
|
|
10
12
|
let state = $state(store.getState());
|
|
11
13
|
$effect(() => {
|
|
12
14
|
return store.subscribe(() => {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
import type { ColumnDef, DataTableStore, SelectionMode, DataTableClassNames } from '../index.
|
|
2
|
+
import type { ColumnDef, DataTableStore, SelectionMode, DataTableClassNames } from '../index.ts';
|
|
3
3
|
|
|
4
4
|
interface Props {
|
|
5
5
|
columns: ColumnDef[];
|
|
@@ -10,6 +10,8 @@
|
|
|
10
10
|
}
|
|
11
11
|
let { columns, store, selectable = 'none', expandable = false, classNames = {} }: Props = $props();
|
|
12
12
|
|
|
13
|
+
// svelte-ignore state_referenced_locally
|
|
14
|
+
|
|
13
15
|
let state = $state(store.getState());
|
|
14
16
|
$effect(() => {
|
|
15
17
|
return store.subscribe(() => {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
import type { ColumnDef, DataTableStore, SelectionMode, DataTableClassNames } from '../index.
|
|
2
|
+
import type { ColumnDef, DataTableStore, SelectionMode, DataTableClassNames } from '../index.ts';
|
|
3
3
|
|
|
4
4
|
interface Props {
|
|
5
5
|
columns: ColumnDef[];
|
|
@@ -11,6 +11,8 @@
|
|
|
11
11
|
}
|
|
12
12
|
let { columns, store, selectable = 'none', sortable = true, expandable = false, classNames = {} }: Props = $props();
|
|
13
13
|
|
|
14
|
+
// svelte-ignore state_referenced_locally
|
|
15
|
+
|
|
14
16
|
let state = $state(store.getState());
|
|
15
17
|
$effect(() => {
|
|
16
18
|
return store.subscribe(() => {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
import type { EditorFieldDef, DataTableStore, DataTableClassNames } from '../index.
|
|
2
|
+
import type { EditorFieldDef, DataTableStore, DataTableClassNames } from '../index.ts';
|
|
3
3
|
import DataTableEditorForm from './DataTableEditorForm.svelte';
|
|
4
4
|
|
|
5
5
|
interface Props {
|
|
@@ -11,6 +11,8 @@
|
|
|
11
11
|
}
|
|
12
12
|
let { fields, store, title = 'Edit Record', classNames = {}, onsubmit }: Props = $props();
|
|
13
13
|
|
|
14
|
+
// svelte-ignore state_referenced_locally
|
|
15
|
+
|
|
14
16
|
let state = $state(store.getState());
|
|
15
17
|
$effect(() => {
|
|
16
18
|
return store.subscribe(() => {
|
|
@@ -40,6 +42,7 @@
|
|
|
40
42
|
|
|
41
43
|
{#if isOpen}
|
|
42
44
|
<!-- svelte-ignore a11y_no_static_element_interactions -->
|
|
45
|
+
<!-- svelte-ignore a11y_click_events_have_key_events -->
|
|
43
46
|
<div class="sdt-modal-backdrop {classNames.editorBackdrop ?? ''}" onclick={handleBackdrop}>
|
|
44
47
|
<div class="sdt-modal {classNames.editorModal ?? ''}" role="dialog" aria-modal="true">
|
|
45
48
|
<div class="sdt-modal-header">
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
import type { DataTableStore, DataTableClassNames } from '../index.
|
|
2
|
+
import type { DataTableStore, DataTableClassNames } from '../index.ts';
|
|
3
3
|
|
|
4
4
|
interface Props {
|
|
5
5
|
store: DataTableStore;
|
|
@@ -8,6 +8,8 @@
|
|
|
8
8
|
}
|
|
9
9
|
let { store, perPageOptions = [10, 15, 25, 50, 100], classNames = {} }: Props = $props();
|
|
10
10
|
|
|
11
|
+
// svelte-ignore state_referenced_locally
|
|
12
|
+
|
|
11
13
|
let state = $state(store.getState());
|
|
12
14
|
$effect(() => {
|
|
13
15
|
return store.subscribe(() => {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
import type { ColumnDef, DataTableStore, SelectionMode, EditorMode, DataTableClassNames } from '../index.
|
|
2
|
+
import type { ColumnDef, DataTableStore, SelectionMode, EditorMode, DataTableClassNames } from '../index.ts';
|
|
3
3
|
import type { Snippet } from 'svelte';
|
|
4
4
|
import DataTableCell from './DataTableCell.svelte';
|
|
5
5
|
import DataTableExpandedRow from './DataTableExpandedRow.svelte';
|
|
@@ -41,6 +41,8 @@
|
|
|
41
41
|
classNames = {},
|
|
42
42
|
}: Props = $props();
|
|
43
43
|
|
|
44
|
+
// svelte-ignore state_referenced_locally
|
|
45
|
+
|
|
44
46
|
let state = $state(store.getState());
|
|
45
47
|
$effect(() => {
|
|
46
48
|
return store.subscribe(() => {
|
|
@@ -113,11 +115,28 @@
|
|
|
113
115
|
>
|
|
114
116
|
{#if selectable === 'multi'}
|
|
115
117
|
<td class="sdt-cell sdt-cell-checkbox {classNames.td ?? ''}">
|
|
116
|
-
<input
|
|
118
|
+
<input
|
|
119
|
+
type="checkbox"
|
|
120
|
+
checked={isSelected}
|
|
121
|
+
onclick={(e) => e.stopPropagation()}
|
|
122
|
+
onchange={(e) => {
|
|
123
|
+
e.stopPropagation();
|
|
124
|
+
store.toggleSelect(rowId);
|
|
125
|
+
}}
|
|
126
|
+
/>
|
|
117
127
|
</td>
|
|
118
128
|
{:else if selectable === 'single'}
|
|
119
129
|
<td class="sdt-cell sdt-cell-checkbox {classNames.td ?? ''}">
|
|
120
|
-
<input
|
|
130
|
+
<input
|
|
131
|
+
type="radio"
|
|
132
|
+
checked={isSelected}
|
|
133
|
+
name="sdt-select"
|
|
134
|
+
onclick={(e) => e.stopPropagation()}
|
|
135
|
+
onchange={(e) => {
|
|
136
|
+
e.stopPropagation();
|
|
137
|
+
store.selectSingle(rowId);
|
|
138
|
+
}}
|
|
139
|
+
/>
|
|
121
140
|
</td>
|
|
122
141
|
{/if}
|
|
123
142
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
import type { DataTableStore } from '../index.
|
|
2
|
+
import type { DataTableStore } from '../index.ts';
|
|
3
3
|
|
|
4
4
|
interface Props {
|
|
5
5
|
store: DataTableStore;
|
|
@@ -9,6 +9,8 @@
|
|
|
9
9
|
}
|
|
10
10
|
let { store, debounceMs = 300, placeholder = 'Search...', searchInputClass = '' }: Props = $props();
|
|
11
11
|
|
|
12
|
+
// svelte-ignore state_referenced_locally
|
|
13
|
+
|
|
12
14
|
let inputValue = $state(store.getState().globalSearch);
|
|
13
15
|
let timer: ReturnType<typeof setTimeout> | null = null;
|
|
14
16
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
import type { ColumnDef, ButtonDef, ExportFormat, DataTableStore, EditorMode, DataTableClassNames } from '../index.
|
|
2
|
+
import type { ColumnDef, ButtonDef, ExportFormat, DataTableStore, EditorMode, DataTableClassNames } from '../index.ts';
|
|
3
3
|
import DataTableSearch from './DataTableSearch.svelte';
|
|
4
4
|
import DataTableColumnToggle from './DataTableColumnToggle.svelte';
|
|
5
5
|
import DataTableButtons from './DataTableButtons.svelte';
|
|
@@ -29,6 +29,8 @@
|
|
|
29
29
|
onDeleteClick,
|
|
30
30
|
}: Props = $props();
|
|
31
31
|
|
|
32
|
+
// svelte-ignore state_referenced_locally
|
|
33
|
+
|
|
32
34
|
let state = $state(store.getState());
|
|
33
35
|
$effect(() => {
|
|
34
36
|
return store.subscribe(() => {
|