@ims360/svelte-ivory 0.0.6 → 0.0.8
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 +7 -0
- package/dist/components/ai/AiMessage.svelte.d.ts +1 -0
- package/dist/components/ai/AiMessage.svelte.d.ts.map +1 -0
- package/dist/components/ai/AttachedFile.svelte.d.ts +1 -0
- package/dist/components/ai/AttachedFile.svelte.d.ts.map +1 -0
- package/dist/components/ai/Chat.svelte.d.ts +1 -0
- package/dist/components/ai/Chat.svelte.d.ts.map +1 -0
- package/dist/components/ai/Markdown.svelte.d.ts +1 -0
- package/dist/components/ai/Markdown.svelte.d.ts.map +1 -0
- package/dist/components/ai/UserMessage.svelte.d.ts +1 -0
- package/dist/components/ai/UserMessage.svelte.d.ts.map +1 -0
- package/dist/components/ai/index.d.ts +1 -0
- package/dist/components/ai/index.d.ts.map +1 -0
- package/dist/components/basic/checkbox/Checkbox.svelte.d.ts +1 -0
- package/dist/components/basic/checkbox/Checkbox.svelte.d.ts.map +1 -0
- package/dist/components/basic/index.d.ts +1 -0
- package/dist/components/basic/index.d.ts.map +1 -0
- package/dist/components/basic/toggle/Toggle.svelte +5 -3
- package/dist/components/basic/toggle/Toggle.svelte.d.ts +1 -0
- package/dist/components/basic/toggle/Toggle.svelte.d.ts.map +1 -0
- package/dist/components/buttons/CopyToClipboardButton.svelte.d.ts +1 -0
- package/dist/components/buttons/CopyToClipboardButton.svelte.d.ts.map +1 -0
- package/dist/components/layout/drawer/Drawer.svelte.d.ts +1 -0
- package/dist/components/layout/drawer/Drawer.svelte.d.ts.map +1 -0
- package/dist/components/layout/heading/Heading.svelte +1 -1
- package/dist/components/layout/heading/Heading.svelte.d.ts +1 -0
- package/dist/components/layout/heading/Heading.svelte.d.ts.map +1 -0
- package/dist/components/layout/heading/index.d.ts +1 -0
- package/dist/components/layout/heading/index.d.ts.map +1 -0
- package/dist/components/layout/hiddenBackground/HiddenBackground.svelte +3 -3
- package/dist/components/layout/hiddenBackground/HiddenBackground.svelte.d.ts +2 -1
- package/dist/components/layout/hiddenBackground/HiddenBackground.svelte.d.ts.map +1 -0
- package/dist/components/layout/hiddenBackground/index.d.ts +7 -0
- package/dist/components/layout/hiddenBackground/index.d.ts.map +1 -0
- package/dist/components/layout/index.d.ts +1 -0
- package/dist/components/layout/index.d.ts.map +1 -0
- package/dist/components/layout/modal/Modal.svelte.d.ts +1 -0
- package/dist/components/layout/modal/Modal.svelte.d.ts.map +1 -0
- package/dist/components/layout/modal/ModalTest.svelte.d.ts +1 -0
- package/dist/components/layout/modal/ModalTest.svelte.d.ts.map +1 -0
- package/dist/components/layout/popover/Popover.svelte.d.ts +1 -0
- package/dist/components/layout/popover/Popover.svelte.d.ts.map +1 -0
- package/dist/components/layout/portal/Portal.svelte.d.ts +1 -0
- package/dist/components/layout/portal/Portal.svelte.d.ts.map +1 -0
- package/dist/components/layout/tabs/Tab.svelte +3 -3
- package/dist/components/layout/tabs/Tab.svelte.d.ts +2 -1
- package/dist/components/layout/tabs/Tab.svelte.d.ts.map +1 -0
- package/dist/components/layout/tabs/TabPanel.svelte.d.ts +1 -0
- package/dist/components/layout/tabs/TabPanel.svelte.d.ts.map +1 -0
- package/dist/components/layout/tabs/Tabs.svelte.d.ts +1 -0
- package/dist/components/layout/tabs/Tabs.svelte.d.ts.map +1 -0
- package/dist/components/layout/tabs/index.d.ts +2 -1
- package/dist/components/layout/tabs/index.d.ts.map +1 -0
- package/dist/components/layout/tooltip/Tooltip.svelte +11 -10
- package/dist/components/layout/tooltip/Tooltip.svelte.d.ts +1 -0
- package/dist/components/layout/tooltip/Tooltip.svelte.d.ts.map +1 -0
- package/dist/components/table/index.d.ts +6 -0
- package/dist/components/table/index.d.ts.map +1 -0
- package/dist/components/table/index.js +5 -0
- package/dist/components/table/plugins/expandAll.svelte.d.ts +7 -0
- package/dist/components/table/plugins/expandAll.svelte.d.ts.map +1 -0
- package/dist/components/table/plugins/expandAll.svelte.js +24 -0
- package/dist/components/table/plugins/search.svelte.d.ts +13 -0
- package/dist/components/table/plugins/search.svelte.d.ts.map +1 -0
- package/dist/components/table/plugins/search.svelte.js +52 -0
- package/dist/components/table/table/Column.svelte +78 -0
- package/dist/components/table/table/Column.svelte.d.ts +16 -0
- package/dist/components/table/table/Column.svelte.d.ts.map +1 -0
- package/dist/components/table/table/ColumnHead.svelte +73 -0
- package/dist/components/table/table/ColumnHead.svelte.d.ts +11 -0
- package/dist/components/table/table/ColumnHead.svelte.d.ts.map +1 -0
- package/dist/components/table/table/Row.svelte +67 -0
- package/dist/components/table/table/Row.svelte.d.ts +13 -0
- package/dist/components/table/table/Row.svelte.d.ts.map +1 -0
- package/dist/components/table/table/Table.svelte +137 -0
- package/dist/components/table/table/Table.svelte.d.ts +52 -0
- package/dist/components/table/table/Table.svelte.d.ts.map +1 -0
- package/dist/components/table/table/VirtualList.svelte +101 -0
- package/dist/components/table/table/VirtualList.svelte.d.ts +41 -0
- package/dist/components/table/table/VirtualList.svelte.d.ts.map +1 -0
- package/dist/components/table/table/column.svelte.d.ts +21 -0
- package/dist/components/table/table/column.svelte.d.ts.map +1 -0
- package/dist/components/table/table/column.svelte.js +47 -0
- package/dist/components/table/table/index.d.ts +12 -0
- package/dist/components/table/table/index.d.ts.map +1 -0
- package/dist/components/table/table/index.js +11 -0
- package/dist/components/table/table/table.svelte.d.ts +36 -0
- package/dist/components/table/table/table.svelte.d.ts.map +1 -0
- package/dist/components/table/table/table.svelte.js +92 -0
- package/dist/components/toast/Toast.svelte.d.ts +1 -0
- package/dist/components/toast/Toast.svelte.d.ts.map +1 -0
- package/dist/components/toast/index.d.ts +1 -0
- package/dist/components/toast/index.d.ts.map +1 -0
- package/dist/components/toast/toasts.svelte.d.ts +1 -0
- package/dist/components/toast/toasts.svelte.d.ts.map +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/utils/actions/clickOutside.d.ts +1 -0
- package/dist/utils/actions/clickOutside.d.ts.map +1 -0
- package/dist/utils/actions/focusTrap.d.ts +1 -0
- package/dist/utils/actions/focusTrap.d.ts.map +1 -0
- package/dist/utils/actions/index.d.ts +2 -0
- package/dist/utils/actions/index.d.ts.map +1 -0
- package/dist/utils/actions/index.js +1 -0
- package/dist/utils/actions/portal.d.ts +1 -0
- package/dist/utils/actions/portal.d.ts.map +1 -0
- package/dist/utils/actions/resize.d.ts +6 -0
- package/dist/utils/actions/resize.d.ts.map +1 -0
- package/dist/utils/actions/resize.js +25 -0
- package/dist/utils/actions/shortcut.d.ts +1 -0
- package/dist/utils/actions/shortcut.d.ts.map +1 -0
- package/dist/utils/actions/visible.d.ts +1 -0
- package/dist/utils/actions/visible.d.ts.map +1 -0
- package/dist/utils/functions/cookie.d.ts +1 -0
- package/dist/utils/functions/cookie.d.ts.map +1 -0
- package/dist/utils/functions/index.d.ts +1 -0
- package/dist/utils/functions/index.d.ts.map +1 -0
- package/dist/utils/functions/pseudoRandomId.d.ts +1 -0
- package/dist/utils/functions/pseudoRandomId.d.ts.map +1 -0
- package/dist/utils/functions/queryParams.d.ts +1 -0
- package/dist/utils/functions/queryParams.d.ts.map +1 -0
- package/package.json +8 -2
- package/src/lib/components/basic/toggle/Toggle.svelte +5 -3
- package/src/lib/components/layout/heading/Heading.svelte +1 -1
- package/src/lib/components/layout/hiddenBackground/HiddenBackground.svelte +3 -3
- package/src/lib/components/layout/tabs/Tab.svelte +3 -3
- package/src/lib/components/layout/tooltip/Tooltip.svelte +11 -10
- package/src/lib/components/table/index.ts +5 -0
- package/src/lib/components/table/plugins/expandAll.svelte.ts +34 -0
- package/src/lib/components/table/plugins/search.svelte.ts +75 -0
- package/src/lib/components/table/table/Column.svelte +78 -0
- package/src/lib/components/table/table/ColumnHead.svelte +73 -0
- package/src/lib/components/table/table/Row.svelte +67 -0
- package/src/lib/components/table/table/Table.svelte +137 -0
- package/src/lib/components/table/table/VirtualList.svelte +101 -0
- package/src/lib/components/table/table/column.svelte.ts +59 -0
- package/src/lib/components/table/table/index.ts +15 -0
- package/src/lib/components/table/table/table.svelte.ts +124 -0
- package/src/lib/utils/actions/index.ts +1 -0
- package/src/lib/utils/actions/resize.ts +35 -0
- package/dist/components/index.d.ts +0 -0
- package/dist/components/index.js +0 -1
- package/src/lib/components/basic/checkbox/checkbox.svelte.spec.ts +0 -39
- package/src/lib/components/basic/toggle/toggle.svelte.spec.ts +0 -19
- package/src/lib/components/index.ts +0 -0
- package/src/lib/components/layout/modal/modal.svelte.spec.ts +0 -39
- package/src/lib/components/layout/tabs/Tabs.test.svelte +0 -5
- package/src/lib/utils/actions/clickOutside.svelte.spec.ts +0 -67
- package/src/lib/utils/actions/shortcut.svelte.spec.ts +0 -19
- package/src/lib/utils/functions/cookie.svelte.spec.ts +0 -55
- package/src/lib/utils/functions/pseudoRandomId.spec.ts +0 -19
- package/src/lib/utils/functions/queryParams.spec.ts +0 -25
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
<script lang="ts" module>
|
|
2
|
+
import clsx from 'clsx';
|
|
3
|
+
import { type Snippet } from 'svelte';
|
|
4
|
+
import type { ClassValue } from 'svelte/elements';
|
|
5
|
+
import { twMerge } from 'tailwind-merge';
|
|
6
|
+
import type { ColumnConfig } from './column.svelte';
|
|
7
|
+
import { getTableContext } from './Table.svelte';
|
|
8
|
+
|
|
9
|
+
let defaultClasses = $state<ClassValue>();
|
|
10
|
+
|
|
11
|
+
export function setClasses(c: ClassValue) {
|
|
12
|
+
defaultClasses = c;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export interface ColumnProps extends ColumnConfig {
|
|
16
|
+
class?: ClassValue;
|
|
17
|
+
/** If the type is incorrect pass the "row" property with the right type */
|
|
18
|
+
children: Snippet;
|
|
19
|
+
onclick?: (e: Event) => void | Promise<void>;
|
|
20
|
+
/** Cannot be used with resizable columns*/
|
|
21
|
+
ignoreWidth?: boolean;
|
|
22
|
+
}
|
|
23
|
+
</script>
|
|
24
|
+
|
|
25
|
+
<script lang="ts">
|
|
26
|
+
let {
|
|
27
|
+
class: clazz = 'py-2 flex flex-row items-center',
|
|
28
|
+
children,
|
|
29
|
+
onclick,
|
|
30
|
+
ignoreWidth = false,
|
|
31
|
+
// ColumnConfig
|
|
32
|
+
resizable = true,
|
|
33
|
+
...props
|
|
34
|
+
}: ColumnProps = $props();
|
|
35
|
+
|
|
36
|
+
// Register the new column if this is the first table row that was rendered
|
|
37
|
+
const table = getTableContext();
|
|
38
|
+
const column = table.registerColumn({ resizable, ...props });
|
|
39
|
+
const allowClicking = $derived(!!onclick);
|
|
40
|
+
|
|
41
|
+
// passes updated props to the column
|
|
42
|
+
$effect(() => {
|
|
43
|
+
column.updateConfig({ resizable, ...props });
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
// this must be separate to the above effect, since otherwise the width would be reset on every scroll
|
|
47
|
+
$effect(() => {
|
|
48
|
+
if (!column.resizable) column.resize(props.width);
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
function onClick(e: MouseEvent) {
|
|
52
|
+
e.stopPropagation();
|
|
53
|
+
e.preventDefault();
|
|
54
|
+
onclick?.(e);
|
|
55
|
+
}
|
|
56
|
+
</script>
|
|
57
|
+
|
|
58
|
+
<!-- svelte-ignore a11y_no_static_element_interactions -->
|
|
59
|
+
<svelte:element
|
|
60
|
+
this={allowClicking ? 'button' : 'div'}
|
|
61
|
+
onclick={allowClicking ? onClick : undefined}
|
|
62
|
+
type={onclick ? 'button' : undefined}
|
|
63
|
+
style={ignoreWidth ? '' : `width: ${column.width}px !important;`}
|
|
64
|
+
class={twMerge(
|
|
65
|
+
clsx(
|
|
66
|
+
'flex shrink-0 flex-row items-stretch justify-start truncate',
|
|
67
|
+
!ignoreWidth && [
|
|
68
|
+
'border-r border-transparent',
|
|
69
|
+
column.dragging && 'border-primary-400-600',
|
|
70
|
+
!column.dragging && column.hovering && 'border-surface-300-700'
|
|
71
|
+
],
|
|
72
|
+
defaultClasses,
|
|
73
|
+
clazz
|
|
74
|
+
)
|
|
75
|
+
)}
|
|
76
|
+
>
|
|
77
|
+
{@render children()}
|
|
78
|
+
</svelte:element>
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { type Snippet } from 'svelte';
|
|
2
|
+
import type { ClassValue } from 'svelte/elements';
|
|
3
|
+
import type { ColumnConfig } from './column.svelte';
|
|
4
|
+
export declare function setClasses(c: ClassValue): void;
|
|
5
|
+
export interface ColumnProps extends ColumnConfig {
|
|
6
|
+
class?: ClassValue;
|
|
7
|
+
/** If the type is incorrect pass the "row" property with the right type */
|
|
8
|
+
children: Snippet;
|
|
9
|
+
onclick?: (e: Event) => void | Promise<void>;
|
|
10
|
+
/** Cannot be used with resizable columns*/
|
|
11
|
+
ignoreWidth?: boolean;
|
|
12
|
+
}
|
|
13
|
+
declare const Column: import("svelte").Component<ColumnProps, {}, "">;
|
|
14
|
+
type Column = ReturnType<typeof Column>;
|
|
15
|
+
export default Column;
|
|
16
|
+
//# sourceMappingURL=Column.svelte.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Column.svelte.d.ts","sourceRoot":"","sources":["../../../../src/lib/components/table/table/Column.svelte.ts"],"names":[],"mappings":"AAII,OAAO,EAAE,KAAK,OAAO,EAAE,MAAM,QAAQ,CAAC;AACtC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAElD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAKpD,wBAAgB,UAAU,CAAC,CAAC,EAAE,UAAU,QAEvC;AAED,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;CACzB;AAuDL,QAAA,MAAM,MAAM,iDAAwC,CAAC;AACrD,KAAK,MAAM,GAAG,UAAU,CAAC,OAAO,MAAM,CAAC,CAAC;AACxC,eAAe,MAAM,CAAC"}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
<script lang="ts" module>
|
|
2
|
+
import { getContext, setContext, type Snippet } from 'svelte';
|
|
3
|
+
import { resize } from '../../../utils/actions';
|
|
4
|
+
import type { Column } from './column.svelte';
|
|
5
|
+
|
|
6
|
+
const CONTEXT = {};
|
|
7
|
+
function setColumnHeadContext(column: Column) {
|
|
8
|
+
setContext(CONTEXT, column);
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export function getColumnHeadContext(): Column {
|
|
12
|
+
return getContext(CONTEXT);
|
|
13
|
+
}
|
|
14
|
+
</script>
|
|
15
|
+
|
|
16
|
+
<script lang="ts">
|
|
17
|
+
type Props = {
|
|
18
|
+
column: Column;
|
|
19
|
+
children: Snippet;
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
let { column, children }: Props = $props();
|
|
23
|
+
setColumnHeadContext(column);
|
|
24
|
+
|
|
25
|
+
let target = $state<HTMLElement | undefined>();
|
|
26
|
+
let dragging = $state(false);
|
|
27
|
+
|
|
28
|
+
const onHoverStart = () => {
|
|
29
|
+
column.hovering = true;
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
const onHoverEnd = () => {
|
|
33
|
+
column.hovering = false;
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
const onResize = (mouseX: number) => {
|
|
37
|
+
if (!target) return;
|
|
38
|
+
let newWidth = mouseX - target.getBoundingClientRect().left;
|
|
39
|
+
column.resize(newWidth + 2);
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
const onDragging = (d: boolean) => {
|
|
43
|
+
dragging = d;
|
|
44
|
+
column.dragging = d;
|
|
45
|
+
};
|
|
46
|
+
</script>
|
|
47
|
+
|
|
48
|
+
<div
|
|
49
|
+
class={['group flex shrink-0 flex-row justify-start']}
|
|
50
|
+
bind:this={target}
|
|
51
|
+
style="width: {column.width}px;"
|
|
52
|
+
>
|
|
53
|
+
{@render children()}
|
|
54
|
+
{#if column.resizable}
|
|
55
|
+
<button
|
|
56
|
+
type="button"
|
|
57
|
+
class={[
|
|
58
|
+
'ml-auto flex h-full w-4 shrink-0 translate-x-px cursor-col-resize justify-center border-r bg-inherit',
|
|
59
|
+
dragging
|
|
60
|
+
? '!border-primary-400-600'
|
|
61
|
+
: 'group-hover:!border-surface-300-700 border-transparent'
|
|
62
|
+
]}
|
|
63
|
+
use:resize={{ resized: onResize, dragging: onDragging }}
|
|
64
|
+
onmouseenter={onHoverStart}
|
|
65
|
+
onmouseleave={onHoverEnd}
|
|
66
|
+
onfocusin={onHoverStart}
|
|
67
|
+
onfocusout={onHoverEnd}
|
|
68
|
+
tabindex="-1"
|
|
69
|
+
aria-label="Resize column"
|
|
70
|
+
>
|
|
71
|
+
</button>
|
|
72
|
+
{/if}
|
|
73
|
+
</div>
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { type Snippet } from 'svelte';
|
|
2
|
+
import type { Column } from './column.svelte';
|
|
3
|
+
export declare function getColumnHeadContext(): Column;
|
|
4
|
+
type Props = {
|
|
5
|
+
column: Column;
|
|
6
|
+
children: Snippet;
|
|
7
|
+
};
|
|
8
|
+
declare const ColumnHead: import("svelte").Component<Props, {}, "">;
|
|
9
|
+
type ColumnHead = ReturnType<typeof ColumnHead>;
|
|
10
|
+
export default ColumnHead;
|
|
11
|
+
//# sourceMappingURL=ColumnHead.svelte.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ColumnHead.svelte.d.ts","sourceRoot":"","sources":["../../../../src/lib/components/table/table/ColumnHead.svelte.ts"],"names":[],"mappings":"AAGI,OAAO,EAA0B,KAAK,OAAO,EAAE,MAAM,QAAQ,CAAC;AAE9D,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAO9C,wBAAgB,oBAAoB,IAAI,MAAM,CAE7C;AAED,KAAK,KAAK,GAAG;IACT,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,OAAO,CAAC;CACrB,CAAC;AA+CN,QAAA,MAAM,UAAU,2CAAwC,CAAC;AACzD,KAAK,UAAU,GAAG,UAAU,CAAC,OAAO,UAAU,CAAC,CAAC;AAChD,eAAe,UAAU,CAAC"}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
<script lang="ts" module>
|
|
2
|
+
import clsx from 'clsx';
|
|
3
|
+
import { type Snippet } from 'svelte';
|
|
4
|
+
import type { ClassValue } from 'svelte/elements';
|
|
5
|
+
import { twMerge } from 'tailwind-merge';
|
|
6
|
+
|
|
7
|
+
let defaultClasses = $state<ClassValue>();
|
|
8
|
+
|
|
9
|
+
export function setClasses(c: ClassValue) {
|
|
10
|
+
defaultClasses = c;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export interface Props {
|
|
14
|
+
class?: ClassValue;
|
|
15
|
+
onclick?: () => void;
|
|
16
|
+
href?: string;
|
|
17
|
+
children: Snippet;
|
|
18
|
+
}
|
|
19
|
+
</script>
|
|
20
|
+
|
|
21
|
+
<script lang="ts">
|
|
22
|
+
let {
|
|
23
|
+
class: clazz = 'hover:bg-surface-950-50/10 transition-colors',
|
|
24
|
+
onclick,
|
|
25
|
+
href,
|
|
26
|
+
children
|
|
27
|
+
}: Props = $props();
|
|
28
|
+
|
|
29
|
+
const elementProps: {
|
|
30
|
+
this: 'button' | 'a' | 'div';
|
|
31
|
+
type?: 'button';
|
|
32
|
+
onclick?: () => void;
|
|
33
|
+
href?: string;
|
|
34
|
+
} = $derived.by(() => {
|
|
35
|
+
if (onclick) {
|
|
36
|
+
return {
|
|
37
|
+
this: 'button',
|
|
38
|
+
type: 'button',
|
|
39
|
+
onclick
|
|
40
|
+
};
|
|
41
|
+
} else if (href) {
|
|
42
|
+
return {
|
|
43
|
+
this: 'a',
|
|
44
|
+
href: href
|
|
45
|
+
};
|
|
46
|
+
} else {
|
|
47
|
+
return {
|
|
48
|
+
this: 'div'
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
});
|
|
52
|
+
</script>
|
|
53
|
+
|
|
54
|
+
<!-- svelte-ignore a11y_no_static_element_interactions -->
|
|
55
|
+
<svelte:element
|
|
56
|
+
this={elementProps.this}
|
|
57
|
+
{...elementProps}
|
|
58
|
+
class={twMerge(
|
|
59
|
+
clsx(
|
|
60
|
+
'flex h-full min-w-full grow flex-row items-stretch gap-2 overflow-hidden pr-4 pl-2',
|
|
61
|
+
defaultClasses,
|
|
62
|
+
clazz
|
|
63
|
+
)
|
|
64
|
+
)}
|
|
65
|
+
>
|
|
66
|
+
{@render children()}
|
|
67
|
+
</svelte:element>
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { type Snippet } from 'svelte';
|
|
2
|
+
import type { ClassValue } from 'svelte/elements';
|
|
3
|
+
export declare function setClasses(c: ClassValue): void;
|
|
4
|
+
export interface Props {
|
|
5
|
+
class?: ClassValue;
|
|
6
|
+
onclick?: () => void;
|
|
7
|
+
href?: string;
|
|
8
|
+
children: Snippet;
|
|
9
|
+
}
|
|
10
|
+
declare const Row: import("svelte").Component<Props, {}, "">;
|
|
11
|
+
type Row = ReturnType<typeof Row>;
|
|
12
|
+
export default Row;
|
|
13
|
+
//# sourceMappingURL=Row.svelte.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Row.svelte.d.ts","sourceRoot":"","sources":["../../../../src/lib/components/table/table/Row.svelte.ts"],"names":[],"mappings":"AAII,OAAO,EAAE,KAAK,OAAO,EAAE,MAAM,QAAQ,CAAC;AACtC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAKlD,wBAAgB,UAAU,CAAC,CAAC,EAAE,UAAU,QAEvC;AAED,MAAM,WAAW,KAAK;IAClB,KAAK,CAAC,EAAE,UAAU,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,OAAO,CAAC;CACrB;AAkDL,QAAA,MAAM,GAAG,2CAAwC,CAAC;AAClD,KAAK,GAAG,GAAG,UAAU,CAAC,OAAO,GAAG,CAAC,CAAC;AAClC,eAAe,GAAG,CAAC"}
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
<script lang="ts" module>
|
|
2
|
+
import { ChevronRight } from '@lucide/svelte';
|
|
3
|
+
import clsx from 'clsx';
|
|
4
|
+
import { getContext, setContext, type Snippet } from 'svelte';
|
|
5
|
+
import type { ClassValue } from 'svelte/elements';
|
|
6
|
+
import { twMerge } from 'tailwind-merge';
|
|
7
|
+
import Column from './Column.svelte';
|
|
8
|
+
import ColumnHead from './ColumnHead.svelte';
|
|
9
|
+
import Row from './Row.svelte';
|
|
10
|
+
import { TableController, type TablePlugin, type TableRow } from './table.svelte';
|
|
11
|
+
import VirtualList from './VirtualList.svelte';
|
|
12
|
+
|
|
13
|
+
export interface TableProps<T extends { id: string }> {
|
|
14
|
+
class?: ClassValue;
|
|
15
|
+
data: T[];
|
|
16
|
+
onclick?: (row: T) => void;
|
|
17
|
+
href?: (row: T) => string | undefined;
|
|
18
|
+
rowHeight?: number;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
const TABLE_CONTEXT = {};
|
|
22
|
+
function setTableContext<T extends { id: string; children?: T[] | undefined }>(
|
|
23
|
+
table: TableController<T>
|
|
24
|
+
) {
|
|
25
|
+
setContext(TABLE_CONTEXT, table);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export function getTableContext<
|
|
29
|
+
T extends { id: string; children?: T[] | undefined }
|
|
30
|
+
>(): TableController<T> {
|
|
31
|
+
return getContext<TableController<T>>(TABLE_CONTEXT);
|
|
32
|
+
}
|
|
33
|
+
</script>
|
|
34
|
+
|
|
35
|
+
<script lang="ts" generics="T extends TableRow<T>">
|
|
36
|
+
interface Props<TI extends { id: string }> extends TableProps<TI> {
|
|
37
|
+
/** Renders the rows */
|
|
38
|
+
children: Snippet<[{ row: TI; nestingLevel?: number; index: number }]>;
|
|
39
|
+
/** Add columns in front of the tree-indicator */
|
|
40
|
+
firstColumn?: Snippet<[{ row: TI }]>;
|
|
41
|
+
rowClass?: ClassValue;
|
|
42
|
+
headerClass?: ClassValue;
|
|
43
|
+
plugins?: TablePlugin<TI>[];
|
|
44
|
+
controller?: TableController<TI>;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
let {
|
|
48
|
+
class: clazz,
|
|
49
|
+
data,
|
|
50
|
+
children: passedChildren,
|
|
51
|
+
firstColumn,
|
|
52
|
+
rowClass,
|
|
53
|
+
headerClass,
|
|
54
|
+
rowHeight = 64,
|
|
55
|
+
onclick,
|
|
56
|
+
href,
|
|
57
|
+
plugins = [],
|
|
58
|
+
controller: table = new TableController()
|
|
59
|
+
}: Props<T> = $props();
|
|
60
|
+
|
|
61
|
+
$effect(() => {
|
|
62
|
+
table.refresh({
|
|
63
|
+
data,
|
|
64
|
+
plugins
|
|
65
|
+
});
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
setTableContext(table);
|
|
69
|
+
const treeIndicatorId = crypto.randomUUID();
|
|
70
|
+
</script>
|
|
71
|
+
|
|
72
|
+
<VirtualList
|
|
73
|
+
data={table.results.entries}
|
|
74
|
+
class={['border-transparent', clazz, 'flex flex-col overflow-hidden']}
|
|
75
|
+
bind:b_scrollTop={table.scrollTop}
|
|
76
|
+
{rowHeight}
|
|
77
|
+
>
|
|
78
|
+
{#snippet header()}
|
|
79
|
+
<div
|
|
80
|
+
class={twMerge(
|
|
81
|
+
clsx(
|
|
82
|
+
'flex w-fit min-w-full flex-row gap-2 border-b border-inherit pr-4 pl-2',
|
|
83
|
+
headerClass
|
|
84
|
+
)
|
|
85
|
+
)}
|
|
86
|
+
>
|
|
87
|
+
{#each table.columns as column (column.id)}
|
|
88
|
+
<ColumnHead {column}>
|
|
89
|
+
{#if typeof column.header === 'function'}
|
|
90
|
+
{@render column.header()}
|
|
91
|
+
{:else}
|
|
92
|
+
<div
|
|
93
|
+
class="flex grow flex-row items-center justify-start gap-4 py-2 text-start select-none"
|
|
94
|
+
>
|
|
95
|
+
{column.header}
|
|
96
|
+
</div>
|
|
97
|
+
{/if}
|
|
98
|
+
</ColumnHead>
|
|
99
|
+
{/each}
|
|
100
|
+
</div>
|
|
101
|
+
{/snippet}
|
|
102
|
+
{#snippet children({ row: { node, id, nestingLevel }, index })}
|
|
103
|
+
<Row
|
|
104
|
+
onclick={onclick ? () => onclick(node) : undefined}
|
|
105
|
+
href={href?.(node)}
|
|
106
|
+
class={rowClass}
|
|
107
|
+
>
|
|
108
|
+
{@render firstColumn?.({ row: node })}
|
|
109
|
+
<Column
|
|
110
|
+
id={treeIndicatorId}
|
|
111
|
+
resizable={false}
|
|
112
|
+
header=""
|
|
113
|
+
onclick={() => {
|
|
114
|
+
table.toggleExpansion(node.id);
|
|
115
|
+
}}
|
|
116
|
+
ignoreWidth={table.results.someHaveChildren}
|
|
117
|
+
width={table.results.someHaveChildren ? 24 : 0}
|
|
118
|
+
minWidth={0}
|
|
119
|
+
>
|
|
120
|
+
<div
|
|
121
|
+
class="flex h-full items-center justify-end"
|
|
122
|
+
style="width: calc(var(--spacing) * {nestingLevel * 4} + 24px);"
|
|
123
|
+
>
|
|
124
|
+
{#if node.children}
|
|
125
|
+
<ChevronRight
|
|
126
|
+
class={[
|
|
127
|
+
'ml-auto aspect-square shrink-0 transition-transform duration-100',
|
|
128
|
+
table.expanded.has(id) && 'rotate-90'
|
|
129
|
+
]}
|
|
130
|
+
/>
|
|
131
|
+
{/if}
|
|
132
|
+
</div>
|
|
133
|
+
</Column>
|
|
134
|
+
{@render passedChildren?.({ row: node, nestingLevel, index })}
|
|
135
|
+
</Row>
|
|
136
|
+
{/snippet}
|
|
137
|
+
</VirtualList>
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { type Snippet } from 'svelte';
|
|
2
|
+
import type { ClassValue } from 'svelte/elements';
|
|
3
|
+
import { TableController, type TablePlugin, type TableRow } from './table.svelte';
|
|
4
|
+
export interface TableProps<T extends {
|
|
5
|
+
id: string;
|
|
6
|
+
}> {
|
|
7
|
+
class?: ClassValue;
|
|
8
|
+
data: T[];
|
|
9
|
+
onclick?: (row: T) => void;
|
|
10
|
+
href?: (row: T) => string | undefined;
|
|
11
|
+
rowHeight?: number;
|
|
12
|
+
}
|
|
13
|
+
export declare function getTableContext<T extends {
|
|
14
|
+
id: string;
|
|
15
|
+
children?: T[] | undefined;
|
|
16
|
+
}>(): TableController<T>;
|
|
17
|
+
interface Props<TI extends {
|
|
18
|
+
id: string;
|
|
19
|
+
}> extends TableProps<TI> {
|
|
20
|
+
/** Renders the rows */
|
|
21
|
+
children: Snippet<[{
|
|
22
|
+
row: TI;
|
|
23
|
+
nestingLevel?: number;
|
|
24
|
+
index: number;
|
|
25
|
+
}]>;
|
|
26
|
+
/** Add columns in front of the tree-indicator */
|
|
27
|
+
firstColumn?: Snippet<[{
|
|
28
|
+
row: TI;
|
|
29
|
+
}]>;
|
|
30
|
+
rowClass?: ClassValue;
|
|
31
|
+
headerClass?: ClassValue;
|
|
32
|
+
plugins?: TablePlugin<TI>[];
|
|
33
|
+
controller?: TableController<TI>;
|
|
34
|
+
}
|
|
35
|
+
declare class __sveltets_Render<T extends TableRow<T>> {
|
|
36
|
+
props(): Props<T>;
|
|
37
|
+
events(): {};
|
|
38
|
+
slots(): {};
|
|
39
|
+
bindings(): "";
|
|
40
|
+
exports(): {};
|
|
41
|
+
}
|
|
42
|
+
interface $$IsomorphicComponent {
|
|
43
|
+
new <T extends TableRow<T>>(options: import('svelte').ComponentConstructorOptions<ReturnType<__sveltets_Render<T>['props']>>): import('svelte').SvelteComponent<ReturnType<__sveltets_Render<T>['props']>, ReturnType<__sveltets_Render<T>['events']>, ReturnType<__sveltets_Render<T>['slots']>> & {
|
|
44
|
+
$$bindings?: ReturnType<__sveltets_Render<T>['bindings']>;
|
|
45
|
+
} & ReturnType<__sveltets_Render<T>['exports']>;
|
|
46
|
+
<T extends TableRow<T>>(internal: unknown, props: ReturnType<__sveltets_Render<T>['props']> & {}): ReturnType<__sveltets_Render<T>['exports']>;
|
|
47
|
+
z_$$bindings?: ReturnType<__sveltets_Render<any>['bindings']>;
|
|
48
|
+
}
|
|
49
|
+
declare const Table: $$IsomorphicComponent;
|
|
50
|
+
type Table<T extends TableRow<T>> = InstanceType<typeof Table<T>>;
|
|
51
|
+
export default Table;
|
|
52
|
+
//# sourceMappingURL=Table.svelte.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Table.svelte.d.ts","sourceRoot":"","sources":["../../../../src/lib/components/table/table/Table.svelte.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
<script lang="ts" generics="T extends { id: string }">
|
|
2
|
+
import clsx from 'clsx';
|
|
3
|
+
import { onMount, type Snippet } from 'svelte';
|
|
4
|
+
import type { ClassValue } from 'svelte/elements';
|
|
5
|
+
import { twMerge } from 'tailwind-merge';
|
|
6
|
+
|
|
7
|
+
type Props<T> = {
|
|
8
|
+
class?: ClassValue;
|
|
9
|
+
data: T[];
|
|
10
|
+
children: Snippet<[{ row: T; domIndex: number; index: number }]>;
|
|
11
|
+
header?: Snippet;
|
|
12
|
+
b_scrollTop?: number;
|
|
13
|
+
rowHeight: number;
|
|
14
|
+
overscan?: number;
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
let {
|
|
18
|
+
class: clazz,
|
|
19
|
+
data,
|
|
20
|
+
children,
|
|
21
|
+
header,
|
|
22
|
+
b_scrollTop = $bindable(0),
|
|
23
|
+
rowHeight,
|
|
24
|
+
overscan = 2
|
|
25
|
+
}: Props<T> = $props();
|
|
26
|
+
|
|
27
|
+
let scroll_top = $state(b_scrollTop);
|
|
28
|
+
let scroll_left = $state(0);
|
|
29
|
+
let header_width = $state(0);
|
|
30
|
+
let viewport = $state<HTMLElement>();
|
|
31
|
+
let viewport_height = $state(0);
|
|
32
|
+
|
|
33
|
+
const start = $derived(Math.max(0, Math.floor(scroll_top / rowHeight) - overscan));
|
|
34
|
+
|
|
35
|
+
const end = $derived(
|
|
36
|
+
Math.min(data.length, Math.ceil((scroll_top + viewport_height) / rowHeight) + overscan)
|
|
37
|
+
);
|
|
38
|
+
|
|
39
|
+
const visible = $derived(
|
|
40
|
+
data.slice(start, end).map((data, i) => {
|
|
41
|
+
return { index: i + start, data };
|
|
42
|
+
})
|
|
43
|
+
);
|
|
44
|
+
|
|
45
|
+
const top = $derived(start * rowHeight);
|
|
46
|
+
const bottom = $derived((data.length - end) * rowHeight);
|
|
47
|
+
|
|
48
|
+
function onscroll() {
|
|
49
|
+
if (!viewport) return;
|
|
50
|
+
scroll_top = viewport.scrollTop;
|
|
51
|
+
scroll_left = viewport.scrollLeft;
|
|
52
|
+
b_scrollTop = scroll_top;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
onMount(() => {
|
|
56
|
+
if (!viewport) return;
|
|
57
|
+
viewport.scrollTop = b_scrollTop;
|
|
58
|
+
});
|
|
59
|
+
</script>
|
|
60
|
+
|
|
61
|
+
<div
|
|
62
|
+
class={twMerge(
|
|
63
|
+
clsx(['scroll relative flex grow flex-col overflow-hidden border-inherit', clazz])
|
|
64
|
+
)}
|
|
65
|
+
>
|
|
66
|
+
{#if header}
|
|
67
|
+
<div class="h-fit w-full border-inherit">
|
|
68
|
+
<div
|
|
69
|
+
class="w-fit min-w-full border-inherit"
|
|
70
|
+
style="transform: translateX(-{scroll_left}px);"
|
|
71
|
+
bind:clientWidth={header_width}
|
|
72
|
+
>
|
|
73
|
+
{@render header?.()}
|
|
74
|
+
</div>
|
|
75
|
+
</div>
|
|
76
|
+
{/if}
|
|
77
|
+
<div
|
|
78
|
+
class="flex !min-w-full grow overflow-auto [scrollbar-gutter:stable]"
|
|
79
|
+
bind:this={viewport}
|
|
80
|
+
bind:offsetHeight={viewport_height}
|
|
81
|
+
{onscroll}
|
|
82
|
+
>
|
|
83
|
+
<div
|
|
84
|
+
class="flex h-fit shrink-0 flex-col"
|
|
85
|
+
style="padding-top: {top}px; padding-bottom: {bottom}px; min-width: max(100%, {header_width}px) !important;"
|
|
86
|
+
>
|
|
87
|
+
{#each visible as row, i (row.data.id)}
|
|
88
|
+
<virtual-list-row
|
|
89
|
+
class="flex w-full shrink-0 grow flex-row items-center overflow-hidden"
|
|
90
|
+
style="height: {rowHeight}px !important;"
|
|
91
|
+
>
|
|
92
|
+
{@render children({
|
|
93
|
+
row: row.data,
|
|
94
|
+
domIndex: i,
|
|
95
|
+
index: row.index
|
|
96
|
+
})}
|
|
97
|
+
</virtual-list-row>
|
|
98
|
+
{/each}
|
|
99
|
+
</div>
|
|
100
|
+
</div>
|
|
101
|
+
</div>
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { type Snippet } from 'svelte';
|
|
2
|
+
import type { ClassValue } from 'svelte/elements';
|
|
3
|
+
type Props<T> = {
|
|
4
|
+
class?: ClassValue;
|
|
5
|
+
data: T[];
|
|
6
|
+
children: Snippet<[{
|
|
7
|
+
row: T;
|
|
8
|
+
domIndex: number;
|
|
9
|
+
index: number;
|
|
10
|
+
}]>;
|
|
11
|
+
header?: Snippet;
|
|
12
|
+
b_scrollTop?: number;
|
|
13
|
+
rowHeight: number;
|
|
14
|
+
overscan?: number;
|
|
15
|
+
};
|
|
16
|
+
declare class __sveltets_Render<T extends {
|
|
17
|
+
id: string;
|
|
18
|
+
}> {
|
|
19
|
+
props(): Props<T>;
|
|
20
|
+
events(): {};
|
|
21
|
+
slots(): {};
|
|
22
|
+
bindings(): "b_scrollTop";
|
|
23
|
+
exports(): {};
|
|
24
|
+
}
|
|
25
|
+
interface $$IsomorphicComponent {
|
|
26
|
+
new <T extends {
|
|
27
|
+
id: string;
|
|
28
|
+
}>(options: import('svelte').ComponentConstructorOptions<ReturnType<__sveltets_Render<T>['props']>>): import('svelte').SvelteComponent<ReturnType<__sveltets_Render<T>['props']>, ReturnType<__sveltets_Render<T>['events']>, ReturnType<__sveltets_Render<T>['slots']>> & {
|
|
29
|
+
$$bindings?: ReturnType<__sveltets_Render<T>['bindings']>;
|
|
30
|
+
} & ReturnType<__sveltets_Render<T>['exports']>;
|
|
31
|
+
<T extends {
|
|
32
|
+
id: string;
|
|
33
|
+
}>(internal: unknown, props: ReturnType<__sveltets_Render<T>['props']> & {}): ReturnType<__sveltets_Render<T>['exports']>;
|
|
34
|
+
z_$$bindings?: ReturnType<__sveltets_Render<any>['bindings']>;
|
|
35
|
+
}
|
|
36
|
+
declare const VirtualList: $$IsomorphicComponent;
|
|
37
|
+
type VirtualList<T extends {
|
|
38
|
+
id: string;
|
|
39
|
+
}> = InstanceType<typeof VirtualList<T>>;
|
|
40
|
+
export default VirtualList;
|
|
41
|
+
//# sourceMappingURL=VirtualList.svelte.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"VirtualList.svelte.d.ts","sourceRoot":"","sources":["../../../../src/lib/components/table/table/VirtualList.svelte.ts"],"names":[],"mappings":"AAIA,OAAO,EAAW,KAAK,OAAO,EAAE,MAAM,QAAQ,CAAC;AAC/C,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,QAAQ,CAAC,EAAE,MAAM,CAAC;CACrB,CAAC;AA+EN,cAAM,iBAAiB,CAAC,CAAC,SAAS;IAAE,EAAE,EAAE,MAAM,CAAA;CAAE;IAC5C,KAAK;IAGL,MAAM;IAGN,KAAK;IAGL,QAAQ;IACR,OAAO;CACV;AAED,UAAU,qBAAqB;IAC3B,KAAK,CAAC,SAAS;QAAE,EAAE,EAAE,MAAM,CAAA;KAAE,EAAE,OAAO,EAAE,OAAO,QAAQ,EAAE,2BAA2B,CAAC,UAAU,CAAC,iBAAiB,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,QAAQ,EAAE,eAAe,CAAC,UAAU,CAAC,iBAAiB,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,EAAE,UAAU,CAAC,iBAAiB,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,UAAU,CAAC,iBAAiB,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG;QAAE,UAAU,CAAC,EAAE,UAAU,CAAC,iBAAiB,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAA;KAAE,GAAG,UAAU,CAAC,iBAAiB,CAAC,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"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { Snippet } from 'svelte';
|
|
2
|
+
export interface ColumnConfig {
|
|
3
|
+
id: string;
|
|
4
|
+
width?: number;
|
|
5
|
+
minWidth?: number;
|
|
6
|
+
resizable?: boolean;
|
|
7
|
+
header: Snippet | string;
|
|
8
|
+
}
|
|
9
|
+
export declare class Column {
|
|
10
|
+
id: string;
|
|
11
|
+
header: string | Snippet<[]>;
|
|
12
|
+
width: number | undefined;
|
|
13
|
+
private minimalWidth;
|
|
14
|
+
hovering: boolean;
|
|
15
|
+
resizable: boolean;
|
|
16
|
+
dragging: boolean;
|
|
17
|
+
constructor(conf: ColumnConfig);
|
|
18
|
+
updateConfig(conf: ColumnConfig): void;
|
|
19
|
+
resize(newWidth?: number): void;
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=column.svelte.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"column.svelte.d.ts","sourceRoot":"","sources":["../../../../src/lib/components/table/table/column.svelte.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAC;AAKtC,MAAM,WAAW,YAAY;IACzB,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,MAAM,EAAE,OAAO,GAAG,MAAM,CAAC;CAC5B;AAED,qBAAa,MAAM;IACf,EAAE,SAAc;IAChB,MAAM,uBAAgC;IAGtC,KAAK,qBAAoB;IACzB,OAAO,CAAC,YAAY,CAAyB;IAC7C,QAAQ,UAAiB;IACzB,SAAS,UAAiB;IAC1B,QAAQ,UAAiB;gBAEb,IAAI,EAAE,YAAY;IAS9B,YAAY,CAAC,IAAI,EAAE,YAAY;IAiB/B,MAAM,CAAC,QAAQ,CAAC,EAAE,MAAM;CAQ3B"}
|