@emamid/svelte-data-table 0.0.22 → 1.0.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/dist/DataTable.svelte +303 -239
- package/dist/DataTable.svelte.d.ts +30 -60
- package/dist/DataTableDataCell.svelte +157 -90
- package/dist/DataTableDataCell.svelte.d.ts +18 -27
- package/dist/DataTableHeaderCell.svelte +63 -21
- package/dist/DataTableHeaderCell.svelte.d.ts +9 -23
- package/dist/DataTableIcon.svelte +25 -0
- package/dist/DataTableIcon.svelte.d.ts +9 -0
- package/dist/DataTableRow.svelte +150 -80
- package/dist/DataTableRow.svelte.d.ts +26 -34
- package/dist/cells/Actions.d.ts +1 -1
- package/dist/cells/Actions.js +10 -11
- package/dist/cells/ActionsCell.svelte +56 -33
- package/dist/cells/ActionsCell.svelte.d.ts +9 -47
- package/dist/cells/ButtonCell.svelte +58 -16
- package/dist/cells/ButtonCell.svelte.d.ts +11 -20
- package/dist/cells/CheckboxCell.svelte +72 -19
- package/dist/cells/CheckboxCell.svelte.d.ts +11 -22
- package/dist/cells/InputCell.svelte +93 -48
- package/dist/cells/InputCell.svelte.d.ts +14 -25
- package/dist/cells/MultiSelectCell.svelte +85 -25
- package/dist/cells/MultiSelectCell.svelte.d.ts +15 -26
- package/dist/cells/NumberInputCell.svelte +90 -44
- package/dist/cells/NumberInputCell.svelte.d.ts +13 -24
- package/dist/cells/RadioCell.svelte +66 -0
- package/dist/cells/RadioCell.svelte.d.ts +12 -0
- package/dist/cells/RangeCell.svelte +66 -17
- package/dist/cells/RangeCell.svelte.d.ts +13 -22
- package/dist/cells/SelectCell.svelte +87 -25
- package/dist/cells/SelectCell.svelte.d.ts +15 -26
- package/dist/cells/SpinCell.svelte +91 -42
- package/dist/cells/SpinCell.svelte.d.ts +13 -28
- package/dist/cells/TabWrapper.svelte +23 -21
- package/dist/cells/TabWrapper.svelte.d.ts +10 -22
- package/dist/cells/index.d.ts +2 -4
- package/dist/cells/index.js +2 -4
- package/dist/common.d.ts +199 -53
- package/dist/common.js +30 -11
- package/dist/index.d.ts +2 -2
- package/dist/index.js +1 -1
- package/dist/themes/active.d.ts +4 -0
- package/dist/themes/active.js +12 -0
- package/dist/themes/daisyUI.d.ts +2 -0
- package/dist/themes/daisyUI.js +47 -0
- package/dist/themes/default.d.ts +2 -0
- package/dist/themes/default.js +57 -0
- package/dist/themes/iconify.d.ts +2 -0
- package/dist/themes/iconify.js +33 -0
- package/dist/themes/index.d.ts +4 -0
- package/dist/themes/index.js +4 -0
- package/package.json +28 -32
- package/dist/DataTable.doc.d.ts +0 -81
- package/dist/DataTable.doc.js +0 -81
- package/dist/cells/ActionsCell.doc.d.ts +0 -28
- package/dist/cells/ActionsCell.doc.js +0 -28
- package/dist/cells/ButtonCell.doc.d.ts +0 -9
- package/dist/cells/ButtonCell.doc.js +0 -9
- package/dist/cells/CheckboxCell.doc.d.ts +0 -6
- package/dist/cells/CheckboxCell.doc.js +0 -6
- package/dist/cells/InputCell.doc.d.ts +0 -6
- package/dist/cells/InputCell.doc.js +0 -6
- package/dist/cells/MultiSelectCell.doc.d.ts +0 -8
- package/dist/cells/MultiSelectCell.doc.js +0 -8
- package/dist/cells/NumberInputCell.doc.d.ts +0 -6
- package/dist/cells/NumberInputCell.doc.js +0 -6
- package/dist/cells/RangeCell.doc.d.ts +0 -7
- package/dist/cells/RangeCell.doc.js +0 -7
- package/dist/cells/RatingCell.doc.d.ts +0 -7
- package/dist/cells/RatingCell.doc.js +0 -7
- package/dist/cells/RatingCell.svelte +0 -13
- package/dist/cells/RatingCell.svelte.d.ts +0 -22
- package/dist/cells/SelectCell.doc.d.ts +0 -8
- package/dist/cells/SelectCell.doc.js +0 -8
- package/dist/cells/SpinCell.doc.d.ts +0 -13
- package/dist/cells/SpinCell.doc.js +0 -13
- package/dist/cells/TabWrapper.doc.d.ts +0 -5
- package/dist/cells/TabWrapper.doc.js +0 -5
- package/dist/cells/ToggleCell.doc.d.ts +0 -6
- package/dist/cells/ToggleCell.doc.js +0 -6
- package/dist/cells/ToggleCell.svelte +0 -21
- package/dist/cells/ToggleCell.svelte.d.ts +0 -23
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
<!-- @migration-task Error while migrating Svelte code: $$props is used together with named props in a way that cannot be automatically migrated. -->
|
|
2
|
+
<script lang="ts">
|
|
3
|
+
import {
|
|
4
|
+
getDataTableContext,
|
|
5
|
+
joinInputClasses,
|
|
6
|
+
} from '../common';
|
|
7
|
+
import type {
|
|
8
|
+
ColumnConfig,
|
|
9
|
+
DataCellChangedEvent,
|
|
10
|
+
} from '../common';
|
|
11
|
+
import { activeTheme } from '../themes/active';
|
|
12
|
+
|
|
13
|
+
interface Props {
|
|
14
|
+
column: ColumnConfig;
|
|
15
|
+
item: any;
|
|
16
|
+
maxValue: number;
|
|
17
|
+
oncellchanged?: (event: DataCellChangedEvent) => void;
|
|
18
|
+
value: number;
|
|
19
|
+
[key: string]: any;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
let {
|
|
23
|
+
column,
|
|
24
|
+
item,
|
|
25
|
+
maxValue,
|
|
26
|
+
oncellchanged,
|
|
27
|
+
value,
|
|
28
|
+
...inputProps
|
|
29
|
+
}: Props = $props();
|
|
30
|
+
|
|
31
|
+
let internalValue: number = $derived(value);
|
|
32
|
+
const tableTheme = getDataTableContext()?.theme || {};
|
|
33
|
+
|
|
34
|
+
const getClass = (element: string) => joinInputClasses(
|
|
35
|
+
'radio',
|
|
36
|
+
element, [
|
|
37
|
+
activeTheme,
|
|
38
|
+
tableTheme,
|
|
39
|
+
column.theme,
|
|
40
|
+
],
|
|
41
|
+
)
|
|
42
|
+
|
|
43
|
+
const spanClass = $derived(getClass('span'));
|
|
44
|
+
const inputClass = $derived(getClass('input'));
|
|
45
|
+
</script>
|
|
46
|
+
|
|
47
|
+
<span class={spanClass}>
|
|
48
|
+
{#each { length: maxValue}, buttonNum}
|
|
49
|
+
<input
|
|
50
|
+
checked={internalValue === buttonNum + 1}
|
|
51
|
+
class={inputClass}
|
|
52
|
+
onchange={() => {
|
|
53
|
+
internalValue = buttonNum + 1;
|
|
54
|
+
console.log('Radio selected value:', internalValue);
|
|
55
|
+
oncellchanged?.({
|
|
56
|
+
column,
|
|
57
|
+
item,
|
|
58
|
+
oldValue: value,
|
|
59
|
+
newValue: internalValue,
|
|
60
|
+
});
|
|
61
|
+
}}
|
|
62
|
+
type="radio"
|
|
63
|
+
{...inputProps}
|
|
64
|
+
/>
|
|
65
|
+
{/each}
|
|
66
|
+
</span>
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { ColumnConfig, DataCellChangedEvent } from '../common';
|
|
2
|
+
interface Props {
|
|
3
|
+
column: ColumnConfig;
|
|
4
|
+
item: any;
|
|
5
|
+
maxValue: number;
|
|
6
|
+
oncellchanged?: (event: DataCellChangedEvent) => void;
|
|
7
|
+
value: number;
|
|
8
|
+
[key: string]: any;
|
|
9
|
+
}
|
|
10
|
+
declare const RadioCell: import("svelte").Component<Props, {}, "">;
|
|
11
|
+
type RadioCell = ReturnType<typeof RadioCell>;
|
|
12
|
+
export default RadioCell;
|
|
@@ -1,19 +1,68 @@
|
|
|
1
|
-
<script
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import {
|
|
3
|
+
getDataTableContext,
|
|
4
|
+
joinInputClasses,
|
|
5
|
+
} from '../common';
|
|
6
|
+
import type {
|
|
7
|
+
ColumnConfig,
|
|
8
|
+
DataCellChangedEvent,
|
|
9
|
+
} from '../common.ts';
|
|
10
|
+
import { activeTheme } from '../themes/active';
|
|
11
|
+
|
|
12
|
+
interface Props {
|
|
13
|
+
caption?: string;
|
|
14
|
+
column: ColumnConfig;
|
|
15
|
+
item: any;
|
|
16
|
+
max: number;
|
|
17
|
+
min: number;
|
|
18
|
+
oncellchanged?: (event: DataCellChangedEvent) => void;
|
|
19
|
+
value: number;
|
|
20
|
+
[key: string]: any;
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
let {
|
|
24
|
+
caption,
|
|
25
|
+
column,
|
|
26
|
+
inputType = 'text',
|
|
27
|
+
item,
|
|
28
|
+
max = 100,
|
|
29
|
+
min = 0,
|
|
30
|
+
oncellchanged,
|
|
31
|
+
value,
|
|
32
|
+
...inputProps
|
|
33
|
+
}: Props = $props();
|
|
34
|
+
|
|
35
|
+
let internalValue = $derived(value);
|
|
36
|
+
const tableTheme = getDataTableContext()?.theme || {};
|
|
37
|
+
|
|
38
|
+
const changed = () => {
|
|
39
|
+
if (value !== internalValue) {
|
|
40
|
+
oncellchanged?.({
|
|
41
|
+
column,
|
|
42
|
+
item,
|
|
43
|
+
oldValue: value,
|
|
44
|
+
newValue: internalValue,
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
const inputClass = $derived(joinInputClasses(
|
|
50
|
+
'range',
|
|
51
|
+
'input', [
|
|
52
|
+
activeTheme,
|
|
53
|
+
tableTheme,
|
|
54
|
+
column.theme,
|
|
55
|
+
],
|
|
56
|
+
))
|
|
17
57
|
</script>
|
|
18
58
|
|
|
19
|
-
<
|
|
59
|
+
<input
|
|
60
|
+
class={inputClass}
|
|
61
|
+
{max}
|
|
62
|
+
{min}
|
|
63
|
+
onchange={changed}
|
|
64
|
+
type="range"
|
|
65
|
+
bind:value={internalValue}
|
|
66
|
+
{...inputProps}
|
|
67
|
+
/>
|
|
68
|
+
{#if caption}{caption}{/if}
|
|
@@ -1,23 +1,14 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
events: {
|
|
12
|
-
cellChanged: CustomEvent<any>;
|
|
13
|
-
} & {
|
|
14
|
-
[evt: string]: CustomEvent<any>;
|
|
15
|
-
};
|
|
16
|
-
slots: {};
|
|
17
|
-
};
|
|
18
|
-
export type RangeCellProps = typeof __propDef.props;
|
|
19
|
-
export type RangeCellEvents = typeof __propDef.events;
|
|
20
|
-
export type RangeCellSlots = typeof __propDef.slots;
|
|
21
|
-
export default class RangeCell extends SvelteComponent<RangeCellProps, RangeCellEvents, RangeCellSlots> {
|
|
1
|
+
import type { ColumnConfig, DataCellChangedEvent } from '../common.ts';
|
|
2
|
+
interface Props {
|
|
3
|
+
caption?: string;
|
|
4
|
+
column: ColumnConfig;
|
|
5
|
+
item: any;
|
|
6
|
+
max: number;
|
|
7
|
+
min: number;
|
|
8
|
+
oncellchanged?: (event: DataCellChangedEvent) => void;
|
|
9
|
+
value: number;
|
|
10
|
+
[key: string]: any;
|
|
22
11
|
}
|
|
23
|
-
|
|
12
|
+
declare const RangeCell: import("svelte").Component<Props, {}, "">;
|
|
13
|
+
type RangeCell = ReturnType<typeof RangeCell>;
|
|
14
|
+
export default RangeCell;
|
|
@@ -1,29 +1,91 @@
|
|
|
1
|
-
<script
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import {
|
|
3
|
+
getDataTableContext,
|
|
4
|
+
joinInputClasses,
|
|
5
|
+
} from '../common';
|
|
6
|
+
import type {
|
|
7
|
+
ColumnConfig,
|
|
8
|
+
DataCellChangedEvent,
|
|
9
|
+
DataCellEvent,
|
|
10
|
+
} from '../common';
|
|
11
|
+
import { activeTheme } from '../themes/active';
|
|
12
|
+
|
|
13
|
+
import TabWrapper from './TabWrapper.svelte';
|
|
14
|
+
|
|
15
|
+
interface Props {
|
|
16
|
+
column: ColumnConfig;
|
|
17
|
+
item: any;
|
|
18
|
+
displayProp?: string;
|
|
19
|
+
valueProp?: string;
|
|
20
|
+
items: any[];
|
|
21
|
+
oncellchanged?: (event: DataCellChangedEvent) => void;
|
|
22
|
+
onnexttab?: (event: DataCellEvent) => void;
|
|
23
|
+
onprevtab?: (event: DataCellEvent) => void;
|
|
24
|
+
value: any;
|
|
25
|
+
[key: string]: any;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
let {
|
|
29
|
+
column,
|
|
30
|
+
item,
|
|
31
|
+
displayProp = 'name',
|
|
32
|
+
valueProp = 'id',
|
|
33
|
+
items,
|
|
34
|
+
oncellchanged,
|
|
35
|
+
onnexttab,
|
|
36
|
+
onprevtab,
|
|
37
|
+
value,
|
|
38
|
+
...inputProps
|
|
39
|
+
}: Props = $props();
|
|
40
|
+
|
|
41
|
+
let newValue = $derived(value);
|
|
42
|
+
const tableTheme = getDataTableContext()?.theme || {};
|
|
43
|
+
|
|
44
|
+
const dispatchCellChanged = () => {
|
|
45
|
+
if (value !== newValue) {
|
|
46
|
+
oncellchanged?.({
|
|
47
|
+
column,
|
|
48
|
+
item,
|
|
49
|
+
oldValue: value,
|
|
50
|
+
newValue: newValue,
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
const getClass = (element: string) => joinInputClasses(
|
|
56
|
+
'select',
|
|
57
|
+
element, [
|
|
58
|
+
activeTheme,
|
|
59
|
+
tableTheme,
|
|
60
|
+
column.theme,
|
|
61
|
+
],
|
|
62
|
+
)
|
|
63
|
+
|
|
64
|
+
const selectClass = $derived(getClass('select'));
|
|
65
|
+
const optionClass = $derived(getClass('option'));
|
|
20
66
|
</script>
|
|
21
67
|
|
|
22
|
-
<TabWrapper
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
68
|
+
<TabWrapper
|
|
69
|
+
{column}
|
|
70
|
+
{item}
|
|
71
|
+
{onprevtab}
|
|
72
|
+
{onnexttab}
|
|
73
|
+
>
|
|
74
|
+
<!-- svelte-ignore a11y_autofocus -->
|
|
75
|
+
<select
|
|
27
76
|
autofocus
|
|
28
|
-
|
|
77
|
+
class={selectClass}
|
|
78
|
+
onchange={dispatchCellChanged}
|
|
79
|
+
bind:value={newValue}
|
|
80
|
+
{...inputProps}
|
|
81
|
+
>
|
|
82
|
+
{#each items as selectItem}
|
|
83
|
+
<option
|
|
84
|
+
class={optionClass}
|
|
85
|
+
value={selectItem[valueProp]}
|
|
86
|
+
>
|
|
87
|
+
{selectItem[displayProp]}
|
|
88
|
+
</option>
|
|
89
|
+
{/each}
|
|
90
|
+
</select>
|
|
29
91
|
</TabWrapper>
|
|
@@ -1,27 +1,16 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
events: {
|
|
14
|
-
prevTab: CustomEvent<any>;
|
|
15
|
-
nextTab: CustomEvent<any>;
|
|
16
|
-
cellChanged: CustomEvent<any>;
|
|
17
|
-
} & {
|
|
18
|
-
[evt: string]: CustomEvent<any>;
|
|
19
|
-
};
|
|
20
|
-
slots: {};
|
|
21
|
-
};
|
|
22
|
-
export type SelectCellProps = typeof __propDef.props;
|
|
23
|
-
export type SelectCellEvents = typeof __propDef.events;
|
|
24
|
-
export type SelectCellSlots = typeof __propDef.slots;
|
|
25
|
-
export default class SelectCell extends SvelteComponent<SelectCellProps, SelectCellEvents, SelectCellSlots> {
|
|
1
|
+
import type { ColumnConfig, DataCellChangedEvent, DataCellEvent } from '../common';
|
|
2
|
+
interface Props {
|
|
3
|
+
column: ColumnConfig;
|
|
4
|
+
item: any;
|
|
5
|
+
displayProp?: string;
|
|
6
|
+
valueProp?: string;
|
|
7
|
+
items: any[];
|
|
8
|
+
oncellchanged?: (event: DataCellChangedEvent) => void;
|
|
9
|
+
onnexttab?: (event: DataCellEvent) => void;
|
|
10
|
+
onprevtab?: (event: DataCellEvent) => void;
|
|
11
|
+
value: any;
|
|
12
|
+
[key: string]: any;
|
|
26
13
|
}
|
|
27
|
-
|
|
14
|
+
declare const SelectCell: import("svelte").Component<Props, {}, "">;
|
|
15
|
+
type SelectCell = ReturnType<typeof SelectCell>;
|
|
16
|
+
export default SelectCell;
|
|
@@ -1,52 +1,101 @@
|
|
|
1
|
-
<script
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import {
|
|
3
|
+
getDataTableContext,
|
|
4
|
+
getInputIcon,
|
|
5
|
+
joinInputClasses,
|
|
6
|
+
} from '../common';
|
|
7
|
+
import type {
|
|
8
|
+
ColumnConfig,
|
|
9
|
+
DataCellChangedEvent,
|
|
10
|
+
} from '../common';
|
|
11
|
+
import { activeTheme } from '../themes/active';
|
|
12
|
+
|
|
13
|
+
import DataTableIcon from '../DataTableIcon.svelte';
|
|
14
|
+
|
|
15
|
+
interface Props {
|
|
16
|
+
column: ColumnConfig;
|
|
17
|
+
decValue?: number;
|
|
18
|
+
incValue?: number;
|
|
19
|
+
item: any;
|
|
20
|
+
maxValue?: number | undefined;
|
|
21
|
+
minValue?: number | undefined;
|
|
22
|
+
oncellchanged?: (event: DataCellChangedEvent) => void;
|
|
23
|
+
value: any;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
let {
|
|
27
|
+
column,
|
|
28
|
+
decValue = 1,
|
|
29
|
+
incValue = 1,
|
|
30
|
+
item,
|
|
31
|
+
maxValue = undefined,
|
|
32
|
+
minValue = undefined,
|
|
33
|
+
oncellchanged,
|
|
34
|
+
value,
|
|
35
|
+
}: Props = $props();
|
|
36
|
+
|
|
37
|
+
const tableTheme = getDataTableContext()?.theme || {};
|
|
38
|
+
|
|
39
|
+
const decrement = () => {
|
|
40
|
+
oncellchanged?.({
|
|
41
|
+
column,
|
|
42
|
+
item,
|
|
43
|
+
oldValue: value,
|
|
44
|
+
newValue: (value || 0) - decValue,
|
|
45
|
+
});
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
const increment = () => {
|
|
49
|
+
oncellchanged?.({
|
|
50
|
+
column,
|
|
51
|
+
item,
|
|
52
|
+
oldValue: value,
|
|
53
|
+
newValue: (value || 0) + incValue,
|
|
54
|
+
});
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
const getClass = (element: string) => joinInputClasses(
|
|
58
|
+
'spinner',
|
|
59
|
+
element, [
|
|
60
|
+
activeTheme,
|
|
61
|
+
tableTheme,
|
|
62
|
+
column.theme,
|
|
63
|
+
],
|
|
64
|
+
)
|
|
65
|
+
|
|
66
|
+
const getIcon = (propName: string) => getInputIcon(
|
|
67
|
+
'spinner',
|
|
68
|
+
propName, [
|
|
69
|
+
activeTheme,
|
|
70
|
+
tableTheme,
|
|
71
|
+
column.theme,
|
|
72
|
+
],
|
|
73
|
+
)
|
|
74
|
+
|
|
75
|
+
let divClass = $derived(getClass('div'));
|
|
76
|
+
let minusButtonClass = $derived(getClass('minusButton'));
|
|
77
|
+
let plusButtonClass = $derived(getClass('plusButton'));
|
|
78
|
+
|
|
79
|
+
let minusIcon = $derived(getIcon('minusIcon'));
|
|
80
|
+
let plusIcon =$derived(getIcon('plusIcon'));
|
|
32
81
|
</script>
|
|
33
82
|
|
|
34
|
-
<div class=
|
|
35
|
-
<
|
|
36
|
-
color="none"
|
|
37
|
-
class="pr-1"
|
|
38
|
-
on:click={decrement}
|
|
83
|
+
<div class={divClass}>
|
|
84
|
+
<button
|
|
39
85
|
disabled={minValue !== undefined && value - decValue < minValue}
|
|
40
|
-
|
|
86
|
+
class={minusButtonClass}
|
|
87
|
+
onclick={decrement}
|
|
41
88
|
>
|
|
89
|
+
<DataTableIcon icon={minusIcon}/>
|
|
90
|
+
</button>
|
|
42
91
|
{value || 0}
|
|
43
|
-
<
|
|
44
|
-
color="none"
|
|
45
|
-
class="pl-1"
|
|
46
|
-
on:click={increment}
|
|
92
|
+
<button
|
|
47
93
|
disabled={maxValue !== undefined && value + incValue > maxValue}
|
|
48
|
-
|
|
94
|
+
class={plusButtonClass}
|
|
95
|
+
onclick={increment}
|
|
49
96
|
>
|
|
97
|
+
<DataTableIcon icon={plusIcon}/>
|
|
98
|
+
</button>
|
|
50
99
|
</div>
|
|
51
100
|
|
|
52
101
|
<style>
|
|
@@ -1,29 +1,14 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
maxValue?: number | undefined;
|
|
12
|
-
minusIcon?: ConstructorOfATypedSvelteComponent | undefined;
|
|
13
|
-
minusIconClass?: string | undefined;
|
|
14
|
-
plusIcon?: ConstructorOfATypedSvelteComponent | undefined;
|
|
15
|
-
plusIconClass?: string | undefined;
|
|
16
|
-
};
|
|
17
|
-
events: {
|
|
18
|
-
cellChanged: CustomEvent<any>;
|
|
19
|
-
} & {
|
|
20
|
-
[evt: string]: CustomEvent<any>;
|
|
21
|
-
};
|
|
22
|
-
slots: {};
|
|
23
|
-
};
|
|
24
|
-
export type SpinCellProps = typeof __propDef.props;
|
|
25
|
-
export type SpinCellEvents = typeof __propDef.events;
|
|
26
|
-
export type SpinCellSlots = typeof __propDef.slots;
|
|
27
|
-
export default class SpinCell extends SvelteComponent<SpinCellProps, SpinCellEvents, SpinCellSlots> {
|
|
1
|
+
import type { ColumnConfig, DataCellChangedEvent } from '../common';
|
|
2
|
+
interface Props {
|
|
3
|
+
column: ColumnConfig;
|
|
4
|
+
decValue?: number;
|
|
5
|
+
incValue?: number;
|
|
6
|
+
item: any;
|
|
7
|
+
maxValue?: number | undefined;
|
|
8
|
+
minValue?: number | undefined;
|
|
9
|
+
oncellchanged?: (event: DataCellChangedEvent) => void;
|
|
10
|
+
value: any;
|
|
28
11
|
}
|
|
29
|
-
|
|
12
|
+
declare const SpinCell: import("svelte").Component<Props, {}, "">;
|
|
13
|
+
type SpinCell = ReturnType<typeof SpinCell>;
|
|
14
|
+
export default SpinCell;
|
|
@@ -1,23 +1,25 @@
|
|
|
1
|
-
<script
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { ColumnConfig, DataCellEvent } from '../common';
|
|
3
|
+
|
|
4
|
+
interface Props {
|
|
5
|
+
item: any;
|
|
6
|
+
column: ColumnConfig;
|
|
7
|
+
children?: import('svelte').Snippet;
|
|
8
|
+
onnexttab?: (event: DataCellEvent) => void;
|
|
9
|
+
onprevtab?: (event: DataCellEvent) => void;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
let {
|
|
13
|
+
item,
|
|
14
|
+
column,
|
|
15
|
+
children,
|
|
16
|
+
onnexttab,
|
|
17
|
+
onprevtab,
|
|
18
|
+
}: Props = $props();
|
|
17
19
|
</script>
|
|
18
20
|
|
|
19
|
-
<!-- svelte-ignore
|
|
20
|
-
<div tabindex="0"
|
|
21
|
-
|
|
22
|
-
<!-- svelte-ignore
|
|
23
|
-
<div tabindex="0"
|
|
21
|
+
<!-- svelte-ignore a11y_no_noninteractive_tabindex-->
|
|
22
|
+
<div tabindex="0" onfocus={() => onprevtab?.({ column, item })}></div>
|
|
23
|
+
{@render children?.()}
|
|
24
|
+
<!-- svelte-ignore a11y_no_noninteractive_tabindex-->
|
|
25
|
+
<div tabindex="0" onfocus={() => onnexttab?.({ column, item })}></div>
|
|
@@ -1,23 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
events: {
|
|
9
|
-
prevTab: CustomEvent<any>;
|
|
10
|
-
nextTab: CustomEvent<any>;
|
|
11
|
-
} & {
|
|
12
|
-
[evt: string]: CustomEvent<any>;
|
|
13
|
-
};
|
|
14
|
-
slots: {
|
|
15
|
-
default: {};
|
|
16
|
-
};
|
|
17
|
-
};
|
|
18
|
-
export type TabWrapperProps = typeof __propDef.props;
|
|
19
|
-
export type TabWrapperEvents = typeof __propDef.events;
|
|
20
|
-
export type TabWrapperSlots = typeof __propDef.slots;
|
|
21
|
-
export default class TabWrapper extends SvelteComponent<TabWrapperProps, TabWrapperEvents, TabWrapperSlots> {
|
|
1
|
+
import type { ColumnConfig, DataCellEvent } from '../common';
|
|
2
|
+
interface Props {
|
|
3
|
+
item: any;
|
|
4
|
+
column: ColumnConfig;
|
|
5
|
+
children?: import('svelte').Snippet;
|
|
6
|
+
onnexttab?: (event: DataCellEvent) => void;
|
|
7
|
+
onprevtab?: (event: DataCellEvent) => void;
|
|
22
8
|
}
|
|
23
|
-
|
|
9
|
+
declare const TabWrapper: import("svelte").Component<Props, {}, "">;
|
|
10
|
+
type TabWrapper = ReturnType<typeof TabWrapper>;
|
|
11
|
+
export default TabWrapper;
|
package/dist/cells/index.d.ts
CHANGED
|
@@ -13,13 +13,11 @@ export * from './NumberInputCell.svelte';
|
|
|
13
13
|
export { default as NumberInputCell } from './NumberInputCell.svelte';
|
|
14
14
|
export * from './RangeCell.svelte';
|
|
15
15
|
export { default as RangeCell } from './RangeCell.svelte';
|
|
16
|
-
export * from './
|
|
17
|
-
export { default as
|
|
16
|
+
export * from './RadioCell.svelte';
|
|
17
|
+
export { default as RadioCell } from './RadioCell.svelte';
|
|
18
18
|
export * from './SelectCell.svelte';
|
|
19
19
|
export { default as SelectCell } from './SelectCell.svelte';
|
|
20
20
|
export * from './SpinCell.svelte';
|
|
21
21
|
export { default as SpinCell } from './SpinCell.svelte';
|
|
22
22
|
export * from './TabWrapper.svelte';
|
|
23
23
|
export { default as TabWrapper } from './TabWrapper.svelte';
|
|
24
|
-
export * from './ToggleCell.svelte';
|
|
25
|
-
export { default as ToggleCell } from './ToggleCell.svelte';
|
package/dist/cells/index.js
CHANGED
|
@@ -13,13 +13,11 @@ export * from './NumberInputCell.svelte';
|
|
|
13
13
|
export { default as NumberInputCell } from './NumberInputCell.svelte';
|
|
14
14
|
export * from './RangeCell.svelte';
|
|
15
15
|
export { default as RangeCell } from './RangeCell.svelte';
|
|
16
|
-
export * from './
|
|
17
|
-
export { default as
|
|
16
|
+
export * from './RadioCell.svelte';
|
|
17
|
+
export { default as RadioCell } from './RadioCell.svelte';
|
|
18
18
|
export * from './SelectCell.svelte';
|
|
19
19
|
export { default as SelectCell } from './SelectCell.svelte';
|
|
20
20
|
export * from './SpinCell.svelte';
|
|
21
21
|
export { default as SpinCell } from './SpinCell.svelte';
|
|
22
22
|
export * from './TabWrapper.svelte';
|
|
23
23
|
export { default as TabWrapper } from './TabWrapper.svelte';
|
|
24
|
-
export * from './ToggleCell.svelte';
|
|
25
|
-
export { default as ToggleCell } from './ToggleCell.svelte';
|