@ims360/svelte-ivory 0.0.45 → 0.0.47

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.
Files changed (35) hide show
  1. package/dist/components/table/Column.svelte +28 -25
  2. package/dist/components/table/Column.svelte.d.ts.map +1 -1
  3. package/dist/components/table/ColumnHead.svelte +5 -7
  4. package/dist/components/table/ColumnHead.svelte.d.ts +1 -1
  5. package/dist/components/table/ColumnHead.svelte.d.ts.map +1 -1
  6. package/dist/components/table/Row.svelte +25 -52
  7. package/dist/components/table/Row.svelte.d.ts +6 -4
  8. package/dist/components/table/Row.svelte.d.ts.map +1 -1
  9. package/dist/components/table/Table.svelte +86 -35
  10. package/dist/components/table/Table.svelte.d.ts +18 -8
  11. package/dist/components/table/Table.svelte.d.ts.map +1 -1
  12. package/dist/components/table/VirtualList.svelte +8 -5
  13. package/dist/components/table/VirtualList.svelte.d.ts +13 -3
  14. package/dist/components/table/VirtualList.svelte.d.ts.map +1 -1
  15. package/dist/components/table/controller.d.ts +3 -2
  16. package/dist/components/table/controller.d.ts.map +1 -1
  17. package/dist/components/table/index.d.ts +1 -2
  18. package/dist/components/table/index.d.ts.map +1 -1
  19. package/dist/components/table/index.js +0 -1
  20. package/dist/components/table/search.svelte.d.ts +8 -0
  21. package/dist/components/table/search.svelte.d.ts.map +1 -0
  22. package/dist/components/table/search.svelte.js +28 -0
  23. package/package.json +33 -32
  24. package/src/lib/components/table/Column.svelte +28 -25
  25. package/src/lib/components/table/ColumnHead.svelte +5 -7
  26. package/src/lib/components/table/Row.svelte +25 -52
  27. package/src/lib/components/table/Table.svelte +86 -35
  28. package/src/lib/components/table/VirtualList.svelte +8 -5
  29. package/src/lib/components/table/controller.ts +4 -2
  30. package/src/lib/components/table/index.ts +1 -2
  31. package/src/lib/components/table/search.svelte.ts +34 -0
  32. package/dist/components/table/plugins/search.svelte.d.ts +0 -14
  33. package/dist/components/table/plugins/search.svelte.d.ts.map +0 -1
  34. package/dist/components/table/plugins/search.svelte.js +0 -55
  35. package/src/lib/components/table/plugins/search.svelte.ts +0 -66
@@ -4,6 +4,7 @@
4
4
  import type { ClassValue } from 'svelte/elements';
5
5
  import { twMerge } from 'tailwind-merge';
6
6
  import type { ColumnConfig } from './columnController.svelte';
7
+ import { getRowContext } from './Row.svelte';
7
8
  import { getTableContext } from './Table.svelte';
8
9
 
9
10
  let defaultClasses = $state<ClassValue>();
@@ -36,10 +37,19 @@
36
37
  }: ColumnProps = $props();
37
38
 
38
39
  // Register the new column if this is the first table row that was rendered
39
- const { registerColumn, nestingInset } = getTableContext();
40
- const column = registerColumn({ resizable, ...props });
40
+ const tableContext = getTableContext();
41
+ const rowContext = getRowContext();
42
+ const column = tableContext.registerColumn({ resizable, ...props });
43
+
44
+ const finalOnClick = $derived(onclick || rowContext.onclick);
41
45
  const allowClicking = $derived(!!onclick);
42
46
 
47
+ const element = $derived.by(() => {
48
+ if (finalOnClick) return 'button';
49
+ if (rowContext.href) return 'a';
50
+ return 'div';
51
+ });
52
+
43
53
  // passes updated props to the column
44
54
  $effect(() => {
45
55
  column.updateConfig({ resizable, ...props });
@@ -49,34 +59,27 @@
49
59
  $effect(() => {
50
60
  if (!column.resizable && props.width !== undefined) column.resize(props.width);
51
61
  });
52
-
53
- function onClick(e: MouseEvent) {
54
- e.stopPropagation();
55
- e.preventDefault();
56
- onclick?.(e);
57
- }
58
62
  </script>
59
63
 
60
64
  <!-- svelte-ignore a11y_no_static_element_interactions -->
61
65
  <svelte:element
62
- this={allowClicking ? 'button' : 'div'}
63
- onclick={allowClicking ? onClick : undefined}
64
- type={onclick ? 'button' : undefined}
66
+ this={element}
67
+ onclick={allowClicking ? finalOnClick : undefined}
68
+ href={rowContext.href}
69
+ type={allowClicking ? 'button' : undefined}
65
70
  style={ignoreWidth
66
71
  ? ''
67
- : `width: calc(${column.width ?? 0}px - var(--spacing) * ${offsetNestingLevel * nestingInset}) !important;`}
68
- class={twMerge(
69
- clsx(
70
- 'flex shrink-0 flex-row items-stretch justify-start truncate',
71
- !ignoreWidth && [
72
- 'border-r border-transparent',
73
- column.dragging && 'border-primary-400-600',
74
- !column.dragging && column.hovering && 'border-surface-300-700'
75
- ],
76
- defaultClasses,
77
- clazz
78
- )
79
- )}
72
+ : `width: calc(${column.width ?? 0}px - var(--spacing) * ${offsetNestingLevel * tableContext.nestingInset}) !important;`}
73
+ class={[
74
+ 'relative flex h-full shrink-0 flex-row items-stretch justify-start truncate',
75
+ !ignoreWidth && [
76
+ 'after:absolute after:inset-y-0 after:right-2 after:box-content after:w-px',
77
+ column.dragging && 'after:bg-primary-400-600',
78
+ !column.dragging && column.hovering && 'after:bg-surface-300-700'
79
+ ]
80
+ ]}
80
81
  >
81
- {@render children()}
82
+ <div class={twMerge(clsx(['flex flex-row items-center gap-1', defaultClasses, clazz]))}>
83
+ {@render children()}
84
+ </div>
82
85
  </svelte:element>
@@ -1 +1 @@
1
- {"version":3,"file":"Column.svelte.d.ts","sourceRoot":"","sources":["../../../src/lib/components/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,2BAA2B,CAAC;AAK9D,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;IACtB,kBAAkB,CAAC,EAAE,MAAM,CAAC;CAC/B;AA0DL,QAAA,MAAM,MAAM,iDAAwC,CAAC;AACrD,KAAK,MAAM,GAAG,UAAU,CAAC,OAAO,MAAM,CAAC,CAAC;AACxC,eAAe,MAAM,CAAC"}
1
+ {"version":3,"file":"Column.svelte.d.ts","sourceRoot":"","sources":["../../../src/lib/components/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,2BAA2B,CAAC;AAM9D,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;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"}
@@ -16,7 +16,7 @@
16
16
  <script lang="ts">
17
17
  type Props = {
18
18
  column: ColumnController;
19
- children: Snippet;
19
+ children?: Snippet;
20
20
  };
21
21
 
22
22
  let { column, children }: Props = $props();
@@ -36,7 +36,7 @@
36
36
  const onResize = (mouseX: number) => {
37
37
  if (!target) return;
38
38
  let newWidth = mouseX - target.getBoundingClientRect().left;
39
- column.resize(newWidth + 2);
39
+ column.resize(newWidth + 8);
40
40
  };
41
41
 
42
42
  const onDragging = (d: boolean) => {
@@ -50,15 +50,13 @@
50
50
  bind:this={target}
51
51
  style="width: {column.width}px;"
52
52
  >
53
- {@render children()}
53
+ {@render children?.()}
54
54
  {#if column.resizable}
55
55
  <button
56
56
  type="button"
57
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'
58
+ 'relative ml-auto h-full w-4 shrink-0 cursor-col-resize bg-inherit after:absolute after:top-0 after:right-2 after:h-full after:w-px',
59
+ dragging ? 'after:bg-primary-400-600' : 'group-hover:after:bg-surface-300-700'
62
60
  ]}
63
61
  use:resize={{ resized: onResize, dragging: onDragging }}
64
62
  onmouseenter={onHoverStart}
@@ -3,7 +3,7 @@ import type { ColumnController } from './columnController.svelte';
3
3
  export declare function getColumnHeadContext(): ColumnController;
4
4
  type Props = {
5
5
  column: ColumnController;
6
- children: Snippet;
6
+ children?: Snippet;
7
7
  };
8
8
  declare const ColumnHead: import("svelte").Component<Props, {}, "">;
9
9
  type ColumnHead = ReturnType<typeof ColumnHead>;
@@ -1 +1 @@
1
- {"version":3,"file":"ColumnHead.svelte.d.ts","sourceRoot":"","sources":["../../../src/lib/components/table/ColumnHead.svelte.ts"],"names":[],"mappings":"AAGI,OAAO,EAA0B,KAAK,OAAO,EAAE,MAAM,QAAQ,CAAC;AAE9D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAOlE,wBAAgB,oBAAoB,IAAI,gBAAgB,CAEvD;AAED,KAAK,KAAK,GAAG;IACT,MAAM,EAAE,gBAAgB,CAAC;IACzB,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"}
1
+ {"version":3,"file":"ColumnHead.svelte.d.ts","sourceRoot":"","sources":["../../../src/lib/components/table/ColumnHead.svelte.ts"],"names":[],"mappings":"AAGI,OAAO,EAA0B,KAAK,OAAO,EAAE,MAAM,QAAQ,CAAC;AAE9D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAOlE,wBAAgB,oBAAoB,IAAI,gBAAgB,CAEvD;AAED,KAAK,KAAK,GAAG;IACT,MAAM,EAAE,gBAAgB,CAAC;IACzB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACtB,CAAC;AA6CN,QAAA,MAAM,UAAU,2CAAwC,CAAC;AACzD,KAAK,UAAU,GAAG,UAAU,CAAC,OAAO,UAAU,CAAC,CAAC;AAChD,eAAe,UAAU,CAAC"}
@@ -1,66 +1,39 @@
1
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';
2
+ import { getContext, setContext, type Snippet } from 'svelte';
6
3
 
7
- let defaultClasses = $state<ClassValue>();
8
-
9
- export function setClasses(c: ClassValue) {
10
- defaultClasses = c;
11
- }
12
-
13
- export interface Props {
14
- class?: ClassValue;
4
+ interface Props {
15
5
  onclick?: () => void;
16
6
  href?: string;
17
7
  children: Snippet;
18
8
  }
9
+
10
+ interface RowContext {
11
+ readonly onclick?: () => void;
12
+ readonly href?: string;
13
+ }
14
+
15
+ const CONTEXT = {};
16
+
17
+ function setRowContext(context: RowContext) {
18
+ setContext(CONTEXT, context);
19
+ }
20
+
21
+ export function getRowContext(): RowContext {
22
+ return getContext(CONTEXT);
23
+ }
19
24
  </script>
20
25
 
21
26
  <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();
27
+ let { onclick, href, children }: Props = $props();
28
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
- };
29
+ setRowContext({
30
+ get onclick() {
31
+ return onclick;
32
+ },
33
+ get href() {
34
+ return href;
50
35
  }
51
36
  });
52
37
  </script>
53
38
 
54
- <svelte:element
55
- this={elementProps.this}
56
- {...elementProps}
57
- class={twMerge(
58
- clsx(
59
- 'flex h-full min-w-full grow flex-row items-stretch gap-2 overflow-hidden pr-4 pl-2',
60
- defaultClasses,
61
- clazz
62
- )
63
- )}
64
- >
65
- {@render children()}
66
- </svelte:element>
39
+ {@render children()}
@@ -1,12 +1,14 @@
1
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;
2
+ interface Props {
6
3
  onclick?: () => void;
7
4
  href?: string;
8
5
  children: Snippet;
9
6
  }
7
+ interface RowContext {
8
+ readonly onclick?: () => void;
9
+ readonly href?: string;
10
+ }
11
+ export declare function getRowContext(): RowContext;
10
12
  declare const Row: import("svelte").Component<Props, {}, "">;
11
13
  type Row = ReturnType<typeof Row>;
12
14
  export default Row;
@@ -1 +1 @@
1
- {"version":3,"file":"Row.svelte.d.ts","sourceRoot":"","sources":["../../../src/lib/components/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;AAiDL,QAAA,MAAM,GAAG,2CAAwC,CAAC;AAClD,KAAK,GAAG,GAAG,UAAU,CAAC,OAAO,GAAG,CAAC,CAAC;AAClC,eAAe,GAAG,CAAC"}
1
+ {"version":3,"file":"Row.svelte.d.ts","sourceRoot":"","sources":["../../../src/lib/components/table/Row.svelte.ts"],"names":[],"mappings":"AAGI,OAAO,EAA0B,KAAK,OAAO,EAAE,MAAM,QAAQ,CAAC;AAE9D,UAAU,KAAK;IACX,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,OAAO,CAAC;CACrB;AAED,UAAU,UAAU;IAChB,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IAC9B,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;CAC1B;AAQD,wBAAgB,aAAa,IAAI,UAAU,CAE1C;AAqBL,QAAA,MAAM,GAAG,2CAAwC,CAAC;AAClD,KAAK,GAAG,GAAG,UAAU,CAAC,OAAO,GAAG,CAAC,CAAC;AAClC,eAAe,GAAG,CAAC"}
@@ -1,17 +1,17 @@
1
1
  <script lang="ts" module>
2
- import { pseudoRandomId } from '../../utils/functions';
3
2
  import { ChevronRight } from '@lucide/svelte';
4
3
  import clsx from 'clsx';
5
- import { getContext, setContext, type Snippet } from 'svelte';
4
+ import { getContext, setContext, untrack, type Snippet } from 'svelte';
6
5
  import type { ClassValue } from 'svelte/elements';
7
6
  import { SvelteSet } from 'svelte/reactivity';
8
7
  import { twMerge } from 'tailwind-merge';
9
- import { Column as ColumnComponent, type TablePlugin, type TableRow } from '.';
8
+ import { Column as ColumnComponent, type TableRow } from '.';
9
+ import { ColumnController, type ColumnConfig } from './columnController.svelte';
10
10
  import ColumnHead from './ColumnHead.svelte';
11
+ import { treeWalker } from './controller';
11
12
  import Row from './Row.svelte';
13
+ import { searchData } from './search.svelte';
12
14
  import VirtualList from './VirtualList.svelte';
13
- import { ColumnController, type ColumnConfig } from './columnController.svelte';
14
- import { treeWalker, type TableState } from './controller';
15
15
 
16
16
  export interface TableProps<T extends TableRow<T>> {
17
17
  class?: ClassValue;
@@ -25,7 +25,10 @@
25
25
  firstColumn?: Snippet<[{ row: T }]>;
26
26
  rowClass?: ClassValue;
27
27
  headerClass?: ClassValue;
28
- plugins?: TablePlugin<T>[];
28
+ search?: {
29
+ term: string;
30
+ matches: (row: T) => boolean;
31
+ };
29
32
  /**
30
33
  * **Bindable**
31
34
  */
@@ -41,9 +44,9 @@
41
44
 
42
45
  const TABLE_CONTEXT = {};
43
46
  export type TableContext<T extends TableRow<T>> = {
44
- registerColumn: (config: ColumnConfig) => ColumnController;
45
- toggleExpansion: (id: string) => void;
46
- nestingInset: number;
47
+ readonly registerColumn: (config: ColumnConfig) => ColumnController;
48
+ readonly toggleExpansion: (id: string) => void;
49
+ readonly nestingInset: number;
47
50
  };
48
51
 
49
52
  function setTableContext<T extends TableRow<T>>(context: TableContext<T>) {
@@ -53,6 +56,9 @@
53
56
  export function getTableContext<T extends TableRow<T>>(): TableContext<T> {
54
57
  return getContext<TableContext<T>>(TABLE_CONTEXT);
55
58
  }
59
+
60
+ const treeIndicatorId = 'tree-chevron';
61
+ const treeIndicatorInset = 32;
56
62
  </script>
57
63
 
58
64
  <script lang="ts" generics="T extends TableRow<T>">
@@ -61,30 +67,87 @@
61
67
  data,
62
68
  children: passedChildren,
63
69
  firstColumn,
64
- rowClass,
70
+ rowClass = 'hover:bg-surface-950-50/10 transition-colors',
65
71
  headerClass,
66
72
  rowHeight = 64,
67
73
  onclick,
68
74
  href,
69
- plugins = [],
70
75
  expanded: expanded = new SvelteSet<string>(),
71
76
  nestingInset = 4,
72
77
  b_columns: externalColumns = $bindable(),
73
- b_scrollTop = $bindable()
78
+ b_scrollTop = $bindable(),
79
+ search
74
80
  }: TableProps<T> = $props();
75
81
 
76
82
  let columns = $state<ColumnController[]>(externalColumns ?? []);
77
- const results = $derived(computeResults(data, expanded, plugins));
83
+ let treeIndicatorColumn = $state<ColumnController>();
78
84
 
79
85
  function toggleExpansion(id: string) {
80
86
  if (expanded.has(id)) expanded.delete(id);
81
87
  else expanded.add(id);
82
88
  }
83
89
 
90
+ let expandedBeforeSearch = $state<SvelteSet<string> | null>(null);
91
+ let prevSearch = $state('');
92
+
93
+ const searchResult = $derived.by(() => {
94
+ if (!search)
95
+ return {
96
+ filteredData: data,
97
+ isSearching: false
98
+ };
99
+ const query = search.term.trim();
100
+ // Note: We only use the 'filteredData' part of the search result here.
101
+ const { hidden } = searchData(data, query, search.matches);
102
+ return {
103
+ filteredData: data.filter((d) => !hidden.has(d.id)),
104
+ isSearching: true
105
+ };
106
+ });
107
+ const results = $derived(treeWalker({ data: searchResult.filteredData, expanded }));
108
+
109
+ $effect(() => {
110
+ if (!search) return;
111
+ const currentSearch = search.term.trim();
112
+ const wasSearching = prevSearch !== '';
113
+ const isSearching = currentSearch !== '';
114
+
115
+ // Transition: Not Searching -> Searching
116
+ if (!wasSearching && isSearching) {
117
+ // Save the current expansion state before overwriting it.
118
+ expandedBeforeSearch = untrack(() => new SvelteSet(expanded));
119
+ const { expanded: searchExpanded } = searchData(data, currentSearch, search.matches);
120
+ expanded = searchExpanded; // Set the initial expansion for the search.
121
+ }
122
+
123
+ // Transition: Searching -> Not Searching
124
+ if (wasSearching && !isSearching) {
125
+ // Restore the saved expansion state.
126
+ if (expandedBeforeSearch) {
127
+ expanded = expandedBeforeSearch;
128
+ expandedBeforeSearch = null;
129
+ }
130
+ }
131
+
132
+ // Transition: Searching -> Searching (different query)
133
+ if (wasSearching && isSearching && currentSearch !== prevSearch) {
134
+ const { expanded: searchExpanded } = searchData(data, currentSearch, search.matches);
135
+ expanded = searchExpanded; // Update the expansion for the new search.
136
+ }
137
+
138
+ prevSearch = currentSearch;
139
+ });
140
+
84
141
  setTableContext({
85
142
  toggleExpansion,
86
143
  registerColumn(config: ColumnConfig) {
87
144
  let existingColumn: ColumnController | undefined = undefined;
145
+
146
+ if (config.id === treeIndicatorId) {
147
+ if (!treeIndicatorColumn) treeIndicatorColumn = new ColumnController(config);
148
+ return treeIndicatorColumn;
149
+ }
150
+
88
151
  for (const column of existingColumn || columns) {
89
152
  if (column.id !== config.id) continue;
90
153
  existingColumn = column;
@@ -99,19 +162,6 @@
99
162
  return nestingInset;
100
163
  }
101
164
  });
102
-
103
- function computeResults(data: T[], expanded: Set<string>, plugins: TablePlugin<T>[]) {
104
- let state: TableState<T> = {
105
- data,
106
- expanded
107
- };
108
- for (const plugin of plugins) {
109
- state = plugin(state);
110
- }
111
- return treeWalker(state);
112
- }
113
-
114
- const treeIndicatorId = pseudoRandomId('tree-indicator-');
115
165
  </script>
116
166
 
117
167
  <VirtualList
@@ -119,16 +169,20 @@
119
169
  class={twMerge(clsx(['flex flex-col overflow-hidden border-transparent', clazz]))}
120
170
  bind:b_scrollTop
121
171
  {rowHeight}
172
+ rowClass={['pl-2 pr-4', rowClass]}
122
173
  >
123
174
  {#snippet header()}
124
175
  <div
125
176
  class={twMerge(
126
177
  clsx(
127
- 'flex w-fit min-w-full flex-row gap-2 border-b border-inherit pr-4 pl-2',
178
+ 'flex w-fit min-w-full flex-row border-b border-inherit pr-4 pl-2',
128
179
  headerClass
129
180
  )
130
181
  )}
131
182
  >
183
+ {#if treeIndicatorColumn}
184
+ <ColumnHead column={treeIndicatorColumn}></ColumnHead>
185
+ {/if}
132
186
  {#each externalColumns || columns as column (column.id)}
133
187
  <ColumnHead {column}>
134
188
  {#if typeof column.header === 'function'}
@@ -145,11 +199,7 @@
145
199
  </div>
146
200
  {/snippet}
147
201
  {#snippet children({ row: { node, id, nestingLevel }, index })}
148
- <Row
149
- onclick={onclick ? () => onclick(node) : undefined}
150
- href={href?.(node)}
151
- class={rowClass}
152
- >
202
+ <Row href={href?.(node)} onclick={onclick ? () => onclick(node) : undefined}>
153
203
  {@render firstColumn?.({ row: node })}
154
204
  <ColumnComponent
155
205
  id={treeIndicatorId}
@@ -159,12 +209,13 @@
159
209
  toggleExpansion(node.id);
160
210
  }}
161
211
  ignoreWidth={results.someHaveChildren}
162
- width={results.someHaveChildren ? 24 : 0}
212
+ width={results.someHaveChildren ? treeIndicatorInset : 0}
163
213
  minWidth={0}
164
214
  >
165
215
  <div
166
- class="flex h-full items-center justify-end"
167
- style="width: calc(var(--spacing) * {nestingLevel * nestingInset} + 24px);"
216
+ class="flex h-full items-center justify-end pr-2"
217
+ style="width: calc(var(--spacing) * {nestingLevel *
218
+ nestingInset} + {treeIndicatorInset}px);"
168
219
  >
169
220
  {#if node.children}
170
221
  <ChevronRight
@@ -1,7 +1,7 @@
1
1
  import { type Snippet } from 'svelte';
2
2
  import type { ClassValue } from 'svelte/elements';
3
3
  import { SvelteSet } from 'svelte/reactivity';
4
- import { type TablePlugin, type TableRow } from '.';
4
+ import { type TableRow } from '.';
5
5
  import { ColumnController, type ColumnConfig } from './columnController.svelte';
6
6
  export interface TableProps<T extends TableRow<T>> {
7
7
  class?: ClassValue;
@@ -21,7 +21,10 @@ export interface TableProps<T extends TableRow<T>> {
21
21
  }]>;
22
22
  rowClass?: ClassValue;
23
23
  headerClass?: ClassValue;
24
- plugins?: TablePlugin<T>[];
24
+ search?: {
25
+ term: string;
26
+ matches: (row: T) => boolean;
27
+ };
25
28
  /**
26
29
  * **Bindable**
27
30
  */
@@ -35,15 +38,22 @@ export interface TableProps<T extends TableRow<T>> {
35
38
  nestingInset?: number;
36
39
  }
37
40
  export type TableContext<T extends TableRow<T>> = {
38
- registerColumn: (config: ColumnConfig) => ColumnController;
39
- toggleExpansion: (id: string) => void;
40
- nestingInset: number;
41
+ readonly registerColumn: (config: ColumnConfig) => ColumnController;
42
+ readonly toggleExpansion: (id: string) => void;
43
+ readonly nestingInset: number;
41
44
  };
42
45
  export declare function getTableContext<T extends TableRow<T>>(): TableContext<T>;
46
+ declare function $$render<T extends TableRow<T>>(): {
47
+ props: TableProps<T>;
48
+ exports: {};
49
+ bindings: "b_scrollTop" | "b_columns";
50
+ slots: {};
51
+ events: {};
52
+ };
43
53
  declare class __sveltets_Render<T extends TableRow<T>> {
44
- props(): TableProps<T>;
45
- events(): {};
46
- slots(): {};
54
+ props(): ReturnType<typeof $$render<T>>['props'];
55
+ events(): ReturnType<typeof $$render<T>>['events'];
56
+ slots(): ReturnType<typeof $$render<T>>['slots'];
47
57
  bindings(): "b_scrollTop" | "b_columns";
48
58
  exports(): {};
49
59
  }
@@ -1 +1 @@
1
- {"version":3,"file":"Table.svelte.d.ts","sourceRoot":"","sources":["../../../src/lib/components/table/Table.svelte.ts"],"names":[],"mappings":"AAMI,OAAO,EAA0B,KAAK,OAAO,EAAE,MAAM,QAAQ,CAAC;AAC9D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAE9C,OAAO,EAA6B,KAAK,WAAW,EAAE,KAAK,QAAQ,EAAE,MAAM,GAAG,CAAC;AAI/E,OAAO,EAAE,gBAAgB,EAAE,KAAK,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAGhF,MAAM,WAAW,UAAU,CAAC,CAAC,SAAS,QAAQ,CAAC,CAAC,CAAC;IAC7C,KAAK,CAAC,EAAE,UAAU,CAAC;IACnB,IAAI,EAAE,CAAC,EAAE,CAAC;IACV,OAAO,CAAC,EAAE,CAAC,GAAG,EAAE,CAAC,KAAK,IAAI,CAAC;IAC3B,IAAI,CAAC,EAAE,CAAC,GAAG,EAAE,CAAC,KAAK,MAAM,GAAG,SAAS,CAAC;IACtC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,uBAAuB;IACvB,QAAQ,CAAC,EAAE,OAAO,CAAC,CAAC;QAAE,GAAG,EAAE,CAAC,CAAC;QAAC,YAAY,CAAC,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC,CAAC;IACvE,iDAAiD;IACjD,WAAW,CAAC,EAAE,OAAO,CAAC,CAAC;QAAE,GAAG,EAAE,CAAC,CAAA;KAAE,CAAC,CAAC,CAAC;IACpC,QAAQ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,iBAAiB,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,GAAG,EAAE,GAAG,UAAU,CAAC,iBAAiB,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC;IAC/I,YAAY,CAAC,EAAE,UAAU,CAAC,iBAAiB,CAAC,GAAG,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC;CACjE;AACD,QAAA,MAAM,KAAK,EAAE,qBAAmC,CAAC;AAC/B,KAAK,KAAK,CAAC,CAAC,SAAS,QAAQ,CAAC,CAAC,CAAC,IAAI,YAAY,CAAC,OAAO,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;AACpE,eAAe,KAAK,CAAC"}
@@ -12,6 +12,7 @@
12
12
  b_scrollTop?: number;
13
13
  rowHeight: number;
14
14
  overscan?: number;
15
+ rowClass?: ClassValue;
15
16
  };
16
17
 
17
18
  let {
@@ -21,9 +22,14 @@
21
22
  header,
22
23
  b_scrollTop = $bindable(),
23
24
  rowHeight,
24
- overscan = 2
25
+ overscan = 2,
26
+ rowClass
25
27
  }: Props<T> = $props();
26
28
 
29
+ const finalRowClass = $derived(
30
+ twMerge(clsx(['flex w-full shrink-0 grow flex-row items-center overflow-hidden', rowClass]))
31
+ );
32
+
27
33
  let scroll_top = $state(b_scrollTop ?? 0);
28
34
  let scroll_left = $state(0);
29
35
  let header_width = $state(0);
@@ -85,10 +91,7 @@
85
91
  style="padding-top: {top}px; padding-bottom: {bottom}px; min-width: max(100%, {header_width}px) !important;"
86
92
  >
87
93
  {#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
- >
94
+ <virtual-list-row class={finalRowClass} style="height: {rowHeight}px !important;">
92
95
  {@render children({
93
96
  row: row.data,
94
97
  domIndex: i,
@@ -12,13 +12,23 @@ type Props<T> = {
12
12
  b_scrollTop?: number;
13
13
  rowHeight: number;
14
14
  overscan?: number;
15
+ rowClass?: ClassValue;
16
+ };
17
+ declare function $$render<T extends {
18
+ id: string;
19
+ }>(): {
20
+ props: Props<T>;
21
+ exports: {};
22
+ bindings: "b_scrollTop";
23
+ slots: {};
24
+ events: {};
15
25
  };
16
26
  declare class __sveltets_Render<T extends {
17
27
  id: string;
18
28
  }> {
19
- props(): Props<T>;
20
- events(): {};
21
- slots(): {};
29
+ props(): ReturnType<typeof $$render<T>>['props'];
30
+ events(): ReturnType<typeof $$render<T>>['events'];
31
+ slots(): ReturnType<typeof $$render<T>>['slots'];
22
32
  bindings(): "b_scrollTop";
23
33
  exports(): {};
24
34
  }
@@ -1 +1 @@
1
- {"version":3,"file":"VirtualList.svelte.d.ts","sourceRoot":"","sources":["../../../src/lib/components/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;K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,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"}
@@ -1,11 +1,12 @@
1
+ import type { SvelteSet } from 'svelte/reactivity';
1
2
  export type TableRow<T> = {
2
3
  id: string;
3
4
  children?: T[];
4
5
  };
5
- export type TablePlugin<T extends TableRow<T>> = (state: TableState<T>) => TableState<T>;
6
+ export type TablePlugin<T extends TableRow<T>> = (state: TableState<T>) => void;
6
7
  export interface TableState<T extends TableRow<T>> {
7
8
  data: T[];
8
- expanded: Set<string>;
9
+ expanded: SvelteSet<string>;
9
10
  }
10
11
  interface TreeRow<T> {
11
12
  node: T;
@@ -1 +1 @@
1
- {"version":3,"file":"controller.d.ts","sourceRoot":"","sources":["../../../src/lib/components/table/controller.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,QAAQ,CAAC,CAAC,IAAI;IAAE,EAAE,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,EAAE,CAAC,EAAE,CAAA;CAAE,CAAC;AACzD,MAAM,MAAM,WAAW,CAAC,CAAC,SAAS,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,EAAE,UAAU,CAAC,CAAC,CAAC,KAAK,UAAU,CAAC,CAAC,CAAC,CAAC;AAEzF,MAAM,WAAW,UAAU,CAAC,CAAC,SAAS,QAAQ,CAAC,CAAC,CAAC;IAC7C,IAAI,EAAE,CAAC,EAAE,CAAC;IACV,QAAQ,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;CACzB;AAED,UAAU,OAAO,CAAC,CAAC;IACf,IAAI,EAAE,CAAC,CAAC;IACR,YAAY,EAAE,MAAM,CAAC;IACrB,EAAE,EAAE,MAAM,CAAC;CACd;AAED,0HAA0H;AAC1H,wBAAgB,UAAU,CAAC,CAAC,SAAS,QAAQ,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,UAAU,CAAC,CAAC,CAAC;;;;EAmDtE;AAED,wBAAgB,SAAS,CAAC,CAAC,SAAS,QAAQ,CAAC,CAAC,CAAC,EAAE,GAAG,KAAK,EAAE,CAAC,EAAE,GAAG,MAAM,EAAE,CAMxE"}
1
+ {"version":3,"file":"controller.d.ts","sourceRoot":"","sources":["../../../src/lib/components/table/controller.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAEnD,MAAM,MAAM,QAAQ,CAAC,CAAC,IAAI;IAAE,EAAE,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,EAAE,CAAC,EAAE,CAAA;CAAE,CAAC;AACzD,MAAM,MAAM,WAAW,CAAC,CAAC,SAAS,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,EAAE,UAAU,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC;AAEhF,MAAM,WAAW,UAAU,CAAC,CAAC,SAAS,QAAQ,CAAC,CAAC,CAAC;IAC7C,IAAI,EAAE,CAAC,EAAE,CAAC;IACV,QAAQ,EAAE,SAAS,CAAC,MAAM,CAAC,CAAC;CAC/B;AAED,UAAU,OAAO,CAAC,CAAC;IACf,IAAI,EAAE,CAAC,CAAC;IACR,YAAY,EAAE,MAAM,CAAC;IACrB,EAAE,EAAE,MAAM,CAAC;CACd;AAED,0HAA0H;AAC1H,wBAAgB,UAAU,CAAC,CAAC,SAAS,QAAQ,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,UAAU,CAAC,CAAC,CAAC;;;;EAmDtE;AAED,wBAAgB,SAAS,CAAC,CAAC,SAAS,QAAQ,CAAC,CAAC,CAAC,EAAE,GAAG,KAAK,EAAE,CAAC,EAAE,GAAG,MAAM,EAAE,CAMxE"}
@@ -1,7 +1,6 @@
1
1
  export { default as Column, type ColumnProps } from './Column.svelte';
2
2
  export { ColumnController, type ColumnConfig } from './columnController.svelte';
3
3
  export { getColumnHeadContext } from './ColumnHead.svelte';
4
- export { getAllIds, type TablePlugin, type TableRow, type TableState } from './controller';
5
- export { searchPlugin } from './plugins/search.svelte';
4
+ export { getAllIds, type TableRow, type TableState } from './controller';
6
5
  export { getTableContext, default as Table, type TableContext, type TableProps } from './Table.svelte';
7
6
  //# sourceMappingURL=index.d.ts.map