@ims360/svelte-ivory 0.1.9 → 0.1.10
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/components/table/Column.svelte +3 -5
- package/dist/components/table/Column.svelte.d.ts +1 -1
- package/dist/components/table/Column.svelte.d.ts.map +1 -1
- package/dist/components/table/VirtualList.svelte +5 -3
- package/dist/components/table/VirtualList.svelte.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/lib/components/table/Column.svelte +3 -5
- package/src/lib/components/table/VirtualList.svelte +5 -3
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
import { type Snippet } from 'svelte';
|
|
5
5
|
import type { ClassValue } from 'svelte/elements';
|
|
6
6
|
import { twMerge } from 'tailwind-merge';
|
|
7
|
-
import {
|
|
7
|
+
import type { ColumnConfig } from './columnController.svelte';
|
|
8
8
|
import { getRowContext } from './Row.svelte';
|
|
9
9
|
import { getTableContext } from './Table.svelte';
|
|
10
10
|
|
|
@@ -28,8 +28,6 @@
|
|
|
28
28
|
// ColumnConfig
|
|
29
29
|
resizable = true,
|
|
30
30
|
offsetNestingLevel = 0,
|
|
31
|
-
width,
|
|
32
|
-
minWidth,
|
|
33
31
|
...props
|
|
34
32
|
}: ColumnProps = $props();
|
|
35
33
|
|
|
@@ -49,12 +47,12 @@
|
|
|
49
47
|
|
|
50
48
|
// passes updated props to the column
|
|
51
49
|
$effect(() => {
|
|
52
|
-
column.updateConfig({ resizable,
|
|
50
|
+
column.updateConfig({ resizable, ...props });
|
|
53
51
|
});
|
|
54
52
|
|
|
55
53
|
// this must be separate to the above effect, since otherwise the width would be reset on every scroll
|
|
56
54
|
$effect(() => {
|
|
57
|
-
if (!column.resizable && width !== undefined) column.width
|
|
55
|
+
if (!column.resizable && props.width !== undefined) column.resize(props.width);
|
|
58
56
|
});
|
|
59
57
|
|
|
60
58
|
const widthStyle = $derived(
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type Snippet } from 'svelte';
|
|
2
2
|
import type { ClassValue } from 'svelte/elements';
|
|
3
|
-
import {
|
|
3
|
+
import type { ColumnConfig } from './columnController.svelte';
|
|
4
4
|
export interface ColumnProps extends ColumnConfig {
|
|
5
5
|
class?: ClassValue;
|
|
6
6
|
/** If the type is incorrect pass the "row" property with the right type */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Column.svelte.d.ts","sourceRoot":"","sources":["../../../src/lib/components/table/Column.svelte.ts"],"names":[],"mappings":"AAKI,OAAO,EAAE,KAAK,OAAO,EAAE,MAAM,QAAQ,CAAC;AACtC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAElD,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"Column.svelte.d.ts","sourceRoot":"","sources":["../../../src/lib/components/table/Column.svelte.ts"],"names":[],"mappings":"AAKI,OAAO,EAAE,KAAK,OAAO,EAAE,MAAM,QAAQ,CAAC;AACtC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAElD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAI9D,MAAM,WAAW,WAAY,SAAQ,YAAY;IAC7C,KAAK,CAAC,EAAE,UAAU,CAAC;IACnB,2EAA2E;IAC3E,QAAQ,EAAE,OAAO,CAAC;IAClB,OAAO,CAAC,EAAE,CAAC,CAAC,EAAE,KAAK,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC7C,2CAA2C;IAC3C,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,kBAAkB,CAAC,EAAE,MAAM,CAAC;CAC/B;AA2DL,QAAA,MAAM,MAAM,iDAAwC,CAAC;AACrD,KAAK,MAAM,GAAG,UAAU,CAAC,OAAO,MAAM,CAAC,CAAC;AACxC,eAAe,MAAM,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<script lang="ts" generics="T extends { id: string }">
|
|
2
2
|
import clsx from 'clsx';
|
|
3
|
-
import { onMount, tick, type Snippet } from 'svelte';
|
|
3
|
+
import { onMount, tick, untrack, type Snippet } from 'svelte';
|
|
4
4
|
import type { ClassValue } from 'svelte/elements';
|
|
5
5
|
import { twMerge } from 'tailwind-merge';
|
|
6
6
|
|
|
@@ -79,10 +79,12 @@
|
|
|
79
79
|
|
|
80
80
|
// update the scrolltop when the prop value changes
|
|
81
81
|
$effect(() => {
|
|
82
|
-
if (
|
|
82
|
+
if (
|
|
83
|
+
typeof b_scrollTop !== 'undefined' &&
|
|
84
|
+
untrack(() => viewport?.scrollTop) !== b_scrollTop
|
|
85
|
+
) {
|
|
83
86
|
scrollTo(b_scrollTop);
|
|
84
87
|
}
|
|
85
|
-
onscroll();
|
|
86
88
|
});
|
|
87
89
|
|
|
88
90
|
onMount(() => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"VirtualList.svelte.d.ts","sourceRoot":"","sources":["../../../src/lib/components/table/VirtualList.svelte.ts"],"names":[],"mappings":"AAIA,OAAO,
|
|
1
|
+
{"version":3,"file":"VirtualList.svelte.d.ts","sourceRoot":"","sources":["../../../src/lib/components/table/VirtualList.svelte.ts"],"names":[],"mappings":"AAIA,OAAO,EAA0B,KAAK,OAAO,EAAE,MAAM,QAAQ,CAAC;AAC9D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAI9C,KAAK,KAAK,CAAC,CAAC,IAAI;IACZ,KAAK,CAAC,EAAE,UAAU,CAAC;IACnB,IAAI,EAAE,CAAC,EAAE,CAAC;IACV,QAAQ,EAAE,OAAO,CAAC,CAAC;QAAE,GAAG,EAAE,CAAC,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC,CAAC;IACjE,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,SAAS,EAAE,MAAM,CAAC;IAClB,Q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AC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC;IACnZ,CAAC,CAAC,SAAS;QAAE,EAAE,EAAE,MAAM,CAAA;KAAE,EAAE,QAAQ,EAAE,OAAO,EAAE,KAAK,EAAE,UAAU,CAAC,iBAAiB,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,GAAG,EAAE,GAAG,UAAU,CAAC,iBAAiB,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC;IAClJ,YAAY,CAAC,EAAE,UAAU,CAAC,iBAAiB,CAAC,GAAG,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC;CACjE;AACD,QAAA,MAAM,WAAW,EAAE,qBAAmC,CAAC;AACrC,KAAK,WAAW,CAAC,CAAC,SAAS;IAAE,EAAE,EAAE,MAAM,CAAA;CAAE,IAAI,YAAY,CAAC,OAAO,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC;AACnF,eAAe,WAAW,CAAC"}
|
package/package.json
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
import { type Snippet } from 'svelte';
|
|
5
5
|
import type { ClassValue } from 'svelte/elements';
|
|
6
6
|
import { twMerge } from 'tailwind-merge';
|
|
7
|
-
import {
|
|
7
|
+
import type { ColumnConfig } from './columnController.svelte';
|
|
8
8
|
import { getRowContext } from './Row.svelte';
|
|
9
9
|
import { getTableContext } from './Table.svelte';
|
|
10
10
|
|
|
@@ -28,8 +28,6 @@
|
|
|
28
28
|
// ColumnConfig
|
|
29
29
|
resizable = true,
|
|
30
30
|
offsetNestingLevel = 0,
|
|
31
|
-
width,
|
|
32
|
-
minWidth,
|
|
33
31
|
...props
|
|
34
32
|
}: ColumnProps = $props();
|
|
35
33
|
|
|
@@ -49,12 +47,12 @@
|
|
|
49
47
|
|
|
50
48
|
// passes updated props to the column
|
|
51
49
|
$effect(() => {
|
|
52
|
-
column.updateConfig({ resizable,
|
|
50
|
+
column.updateConfig({ resizable, ...props });
|
|
53
51
|
});
|
|
54
52
|
|
|
55
53
|
// this must be separate to the above effect, since otherwise the width would be reset on every scroll
|
|
56
54
|
$effect(() => {
|
|
57
|
-
if (!column.resizable && width !== undefined) column.width
|
|
55
|
+
if (!column.resizable && props.width !== undefined) column.resize(props.width);
|
|
58
56
|
});
|
|
59
57
|
|
|
60
58
|
const widthStyle = $derived(
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<script lang="ts" generics="T extends { id: string }">
|
|
2
2
|
import clsx from 'clsx';
|
|
3
|
-
import { onMount, tick, type Snippet } from 'svelte';
|
|
3
|
+
import { onMount, tick, untrack, type Snippet } from 'svelte';
|
|
4
4
|
import type { ClassValue } from 'svelte/elements';
|
|
5
5
|
import { twMerge } from 'tailwind-merge';
|
|
6
6
|
|
|
@@ -79,10 +79,12 @@
|
|
|
79
79
|
|
|
80
80
|
// update the scrolltop when the prop value changes
|
|
81
81
|
$effect(() => {
|
|
82
|
-
if (
|
|
82
|
+
if (
|
|
83
|
+
typeof b_scrollTop !== 'undefined' &&
|
|
84
|
+
untrack(() => viewport?.scrollTop) !== b_scrollTop
|
|
85
|
+
) {
|
|
83
86
|
scrollTo(b_scrollTop);
|
|
84
87
|
}
|
|
85
|
-
onscroll();
|
|
86
88
|
});
|
|
87
89
|
|
|
88
90
|
onMount(() => {
|