svelte-tably 1.0.0-next.5 → 1.0.0-next.6

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.
@@ -12,7 +12,8 @@
12
12
 
13
13
  export interface TableState<T extends Record<PropertyKey, any> = Record<PropertyKey, any>> {
14
14
  columns: Record<string, TColumn<T, unknown>>
15
- panels: Record<string, TPanel>
15
+ panels: Record<string, TPanel<T>>
16
+ selected: T[] | null
16
17
  sortby?: string
17
18
  positions: {
18
19
  sticky: string[]
@@ -20,7 +21,10 @@
20
21
  hidden: string[]
21
22
  toggle(key: string): void
22
23
  }
24
+ readonly resizeable: boolean
23
25
  readonly data: T[]
26
+ /** Rows become anchors */
27
+ readonly href?: (item: T) => string
24
28
  addColumn(key: string, options: TColumn<T, unknown>): void
25
29
  removeColumn(key: string): void
26
30
  }
@@ -38,13 +42,23 @@
38
42
  import Panel, { PanelTween, type Panel as TPanel } from './Panel.svelte'
39
43
  import { fly } from 'svelte/transition'
40
44
  import { sineInOut } from 'svelte/easing'
45
+ import { get } from 'svelte/store'
46
+ import { on } from 'svelte/events'
47
+ import { ka_GE } from '@faker-js/faker'
41
48
 
42
49
  interface Props {
43
- content: Snippet<[context: { Column: typeof Column<T>, Panel: typeof Panel, readonly state: TableState<T>, readonly data: T[] }]>
50
+ content: Snippet<[context: { Column: typeof Column<T>, Panel: typeof Panel, readonly table: TableState<T>, readonly data: T[] }]>
44
51
 
45
52
  panel?: string
46
53
  data?: T[]
47
54
  id?: string
55
+ href?: (item: T) => string
56
+ /**
57
+ * Can you change the width of the columns?
58
+ * @default true
59
+ */
60
+ resizeable?: boolean
61
+ selectable?: 'hover' | 'always' | 'never'
48
62
  }
49
63
 
50
64
  let {
@@ -52,10 +66,13 @@
52
66
 
53
67
  panel = $bindable(),
54
68
  data: _data = [],
55
- id = Array.from({length: 12}, () => String.fromCharCode(Math.floor(Math.random() * 26) + 97)).join('')
69
+ id = Array.from({length: 12}, () => String.fromCharCode(Math.floor(Math.random() * 26) + 97)).join(''),
70
+ href,
71
+ resizeable = true,
72
+ selectable = 'never'
56
73
  }: Props = $props()
57
74
 
58
- const data = $derived(_data.toSorted())
75
+ const data = $derived([..._data])
59
76
 
60
77
  const elements = $state({}) as Record<'headers' | 'statusbar' | 'rows', HTMLElement>
61
78
 
@@ -64,36 +81,34 @@
64
81
  let scrollTop = $state(0)
65
82
  let viewportHeight = $state(0)
66
83
 
67
- let _heightPerItem = 24
68
- let renderItemLength = $derived(Math.ceil(Math.max(30, viewportHeight / (_heightPerItem / 3))))
69
-
70
84
  let heightPerItem = $derived.by(() => {
71
85
  data
72
86
  if(!elements.rows)
73
87
  return 8
74
88
  const result = elements.rows.scrollHeight / elements.rows.childNodes.length
75
- _heightPerItem = result
76
89
  return result
77
90
  })
78
91
 
92
+ let renderItemLength = $derived(Math.ceil(Math.max(30, (viewportHeight / heightPerItem) * 2)))
93
+
94
+ const spacing = () => viewportHeight / 2
79
95
  let virtualTop = $derived.by(() => {
80
- let spacing = untrack(() => (renderItemLength/3)) * heightPerItem
81
- let scroll = scrollTop - spacing
96
+ let scroll = scrollTop - spacing()
82
97
  let virtualTop = Math.max(scroll, 0)
83
98
  virtualTop -= virtualTop % heightPerItem
84
99
  return virtualTop
85
100
  })
86
101
  let virtualBottom = $derived.by(() => {
87
- const virtualBottom = (heightPerItem * data.length) - virtualTop
88
- return virtualBottom
102
+ const virtualBottom = (heightPerItem * data.length) - virtualTop - spacing() * 4
103
+ return Math.max(virtualBottom, 0)
89
104
  })
90
-
91
105
  /** The area of data that is rendered */
92
106
  const area = $derived.by(() => {
93
107
  const index = (virtualTop / heightPerItem) || 0
108
+ const end = index + untrack(() => renderItemLength)
94
109
  return data.slice(
95
110
  index,
96
- index + untrack(() => renderItemLength)
111
+ end
97
112
  )
98
113
  })
99
114
  // * --- Virtualization --- *
@@ -101,6 +116,7 @@
101
116
 
102
117
  const table: TableState<T> = $state({
103
118
  columns: {},
119
+ selected: selectable === 'never' ? null : [],
104
120
  panels: {},
105
121
  positions: {
106
122
  sticky: [],
@@ -113,9 +129,15 @@
113
129
  table.positions.hidden.push(key)
114
130
  }
115
131
  },
132
+ get href() {
133
+ return href
134
+ },
116
135
  get data() {
117
136
  return data
118
137
  },
138
+ get resizeable() {
139
+ return resizeable
140
+ },
119
141
  addColumn(key, column) {
120
142
  table.columns[key] = column
121
143
 
@@ -144,28 +166,48 @@
144
166
 
145
167
  const panelTween = new PanelTween(() => panel, 24)
146
168
 
169
+ let hoveredRow: T | null = $state(null)
170
+
147
171
  /** Order of columns */
148
- const columns = $derived([...table.positions.sticky, ...table.positions.scroll].filter(key => !table.positions.hidden.includes(key)))
172
+ const notHidden = (key: string) => !table.positions.hidden.includes(key)
173
+ const sticky = $derived(table.positions.sticky.filter(notHidden))
174
+ const scrolled = $derived(table.positions.scroll.filter(notHidden))
175
+ const columns = $derived([...sticky, ...scrolled])
149
176
 
150
177
  /** Width of each column */
151
- const widths = $state({}) as Record<string, number>
178
+ const columnWidths = $state({}) as Record<string, number>
179
+
180
+ const getWidth = (key: string, def: number = 150) => columnWidths[key] || table.columns[key]?.defaults.width || def
152
181
 
153
182
  /** grid-template-columns for widths */
154
183
  const style = $derived(`
155
- #${id} > .headers, #${id} > .content > .rows > .row, #${id} > .statusbar, #${id} > .content > .virtual.bottom {
156
- grid-template-columns: ${columns.map((key, i, arr) => i === arr.length - 1 ? `minmax(${widths[key] || 150}px, 1fr)` : `${widths[key] || 150}px`).join(' ')};
157
- }
158
- `)
159
-
160
- const observer = typeof MutationObserver === 'undefined' ? undefined : new MutationObserver(mutations => {
161
- const target = mutations[0].target as HTMLDivElement
162
- widths[target.getAttribute('data-column')!] = parseFloat(target.style.width)
163
- })
164
-
165
- function observe(node: HTMLDivElement, isHeader = false) {
184
+ #${id} > .headers,
185
+ #${id} > .content > .rows > .row,
186
+ #${id} > .statusbar,
187
+ #${id} > .content > .virtual.bottom {
188
+ grid-template-columns: ${
189
+ columns.map((key, i, arr) => {
190
+ const width = getWidth(key)
191
+ if(i === arr.length - 1)
192
+ return `minmax(${width}px, 1fr)`
193
+ return `${width}px`
194
+ }).join(' ')
195
+ };
196
+ }
197
+ ` + sticky.map((key, i, arr) => `
198
+ #${id} .column.sticky[data-column='${key}'] {
199
+ left: ${getWidth(arr[i - 1], 0)}px;
200
+ }
201
+ `).join(''))
202
+
203
+ function observeColumnWidth(node: HTMLDivElement, isHeader = false) {
166
204
  if(!isHeader) return
167
- observer?.observe(node, {attributes: true})
168
- return { destroy: () => observer?.disconnect() }
205
+ const observer = new MutationObserver(mutations => {
206
+ const target = mutations[0].target as HTMLElement
207
+ columnWidths[target.getAttribute('data-column')!] = parseFloat(target.style.width)
208
+ })
209
+ observer.observe(node, {attributes: true})
210
+ return { destroy: () => observer.disconnect() }
169
211
  }
170
212
 
171
213
  function onscroll(event: Event) {
@@ -179,6 +221,10 @@
179
221
  elements.statusbar.scrollLeft = target.scrollLeft
180
222
  }
181
223
 
224
+ export {
225
+ table as state
226
+ }
227
+
182
228
  </script>
183
229
  <!---------------------------------------------------->
184
230
 
@@ -194,8 +240,13 @@
194
240
  {#each table.positions.sticky as column, i (column)}
195
241
  {#if !table.positions.hidden.includes(column)}
196
242
  {@const args = arg ? arg(column) : []}
197
- {@const props = isHeader ? { 'data-column': column } : {}}
198
- <div class='column sticky' {...props} use:observe={isHeader} class:border={i == table.positions.sticky.length - 1}>
243
+ <div
244
+ class='column sticky'
245
+ use:observeColumnWidth={isHeader}
246
+ data-column={column}
247
+ class:resizeable={table.columns[column].options.resizeable && table.resizeable}
248
+ class:border={i == table.positions.sticky.length - 1}
249
+ >
199
250
  {@render renderable(column)?.(args[0], args[1])}
200
251
  </div>
201
252
  {/if}
@@ -203,8 +254,12 @@
203
254
  {#each table.positions.scroll as column, i (column)}
204
255
  {#if !table.positions.hidden.includes(column)}
205
256
  {@const args = arg ? arg(column) : []}
206
- {@const props = isHeader ? { 'data-column': column } : {}}
207
- <div class='column' {...props} use:observe={isHeader}>
257
+ <div
258
+ class='column'
259
+ data-column={column}
260
+ use:observeColumnWidth={isHeader}
261
+ class:resizeable={table.columns[column].options.resizeable && table.resizeable}
262
+ >
208
263
  {@render renderable(column)?.(args[0], args[1])}
209
264
  </div>
210
265
  {/if}
@@ -214,7 +269,7 @@
214
269
  <div id={id} class='table svelte-tably'>
215
270
 
216
271
  <div class='headers' bind:this={elements.headers}>
217
- {@render columnsSnippet((column) => table.columns[column]?.header, null, true)}
272
+ {@render columnsSnippet((column) => table.columns[column]?.header, () => [true], true)}
218
273
  </div>
219
274
 
220
275
  <div class='content' {onscroll} bind:clientHeight={viewportHeight}>
@@ -222,15 +277,35 @@
222
277
 
223
278
  <div class='rows' bind:this={elements.rows}>
224
279
  {#each area as item, i (item)}
225
- <div class='row'>
280
+ {@const props = table.href ? { href: table.href(item) } : {}}
281
+ <!-- note: <svelte:element this={table.href ? 'a' : 'div'}> will break the virtualization for some reason -->
282
+ <a
283
+ class='row'
284
+ {...props}
285
+ onpointerenter={() => hoveredRow = item}
286
+ onpointerleave={() => hoveredRow = null}
287
+ >
288
+ {#if table.selected && (((selectable === 'hover' && hoveredRow === item) || selectable === 'always') || table.selected.includes(item))}
289
+ <div class='select' class:hover={selectable === 'hover'}>
290
+ <input type='checkbox' bind:checked={
291
+ () => table.selected!.includes(item),
292
+ (value) => value ? table.selected!.push(item) : table.selected!.splice(table.selected!.indexOf(item), 1)
293
+ }>
294
+ </div>
295
+ {/if}
296
+
226
297
  {@render columnsSnippet(
227
298
  (column) => table.columns[column]!.row,
228
299
  (column) => {
229
300
  const col = table.columns[column]!
230
- return [item, col.options.value ? col.options.value(item) : undefined]
301
+ return [item, {
302
+ get index() { return _data.indexOf(item) },
303
+ get value() { return col.options.value ? col.options.value(item) : undefined },
304
+ get isHovered() { return hoveredRow === item }
305
+ }]
231
306
  }
232
307
  )}
233
- </div>
308
+ </a>
234
309
  {/each}
235
310
  </div>
236
311
  <div class='virtual bottom' style='height: {virtualBottom}px'>
@@ -250,7 +325,7 @@
250
325
  in:fly={{ x: 100, easing: sineInOut, duration:300 }}
251
326
  out:fly={{ x:100, duration:200, easing: sineInOut }}
252
327
  >
253
- {@render table.panels[panel].content()}
328
+ {@render table.panels[panel].content({ get table() { return table }, get data() { return data } })}
254
329
  </div>
255
330
  {/if}
256
331
  </div>
@@ -264,12 +339,44 @@
264
339
  </div>
265
340
 
266
341
 
267
- {@render content?.({ Column, Panel, get state() { return table }, get data() { return data } })}
342
+ {@render content?.({ Column, Panel, get table() { return table }, get data() { return data } })}
268
343
 
269
344
 
270
345
 
271
346
  <!---------------------------------------------------->
272
347
  <style>
348
+
349
+ .row {
350
+ > .select {
351
+ display: block;
352
+ position: absolute;
353
+ z-index: 3;
354
+ opacity: 1;
355
+ left: 2px;
356
+ overflow: visible;
357
+ background-color: transparent;
358
+ transition: .15s ease;
359
+ > input {
360
+ width: 18px;
361
+ height: 18px;
362
+ border-radius: 1rem;
363
+ cursor: pointer;
364
+ }
365
+
366
+ &.hover {
367
+ @starting-style {
368
+ opacity: 0;
369
+ left: -2px;
370
+ }
371
+ }
372
+ }
373
+ }
374
+
375
+
376
+ a.row {
377
+ color: inherit;
378
+ text-decoration: inherit;
379
+ }
273
380
 
274
381
  .table, .table * {
275
382
  box-sizing: border-box;
@@ -304,15 +411,10 @@
304
411
  .table {
305
412
  color: var(--tably-color, hsl(0, 0%, 0%));
306
413
  background-color: var(--tably-bg, hsl(0, 0%, 100%));
307
-
308
- --tably-padding-x: 1rem;
309
- --tably-padding-y: .5rem;
310
- --tably-radius: .25rem;
311
414
  }
312
415
 
313
416
  .sticky {
314
417
  position: sticky;
315
- left: 0px;
316
418
  /* right: 100px; */
317
419
  z-index: 1;
318
420
  }
@@ -323,9 +425,12 @@
323
425
 
324
426
  .headers > .column {
325
427
  border-right: 1px solid var(--tably-border, hsl(0, 0%, 90%));
326
- resize: horizontal;
327
428
  overflow: hidden;
328
- padding: var(--tably-padding-y) 0;
429
+ padding: var(--tably-padding-y, .5rem) 0;
430
+
431
+ &.resizeable {
432
+ resize: horizontal;
433
+ }
329
434
  }
330
435
 
331
436
  .table {
@@ -378,39 +483,41 @@
378
483
  .statusbar {
379
484
  grid-area: statusbar;
380
485
  overflow: hidden;
486
+ background-color: var(--tably-statusbar, hsl(0, 0%, 98%));
381
487
  }
382
488
 
383
489
  .statusbar > .column {
384
490
  border-top: 1px solid var(--tably-border, hsl(0, 0%, 90%));
385
- padding: calc(var(--tably-padding-y) / 2) 0;
491
+ padding: calc(var(--tably-padding-y, .5rem) / 2) 0;
386
492
  }
387
493
 
388
494
  .headers, .row, .statusbar {
495
+ position: relative;
389
496
  display: grid;
390
497
  width: 100%;
391
498
  height: 100%;
392
499
 
393
500
  & > .column {
394
501
  display: flex;
395
- padding-left: var(--tably-padding-x);
502
+ padding-left: var(--tably-padding-x, 1rem);
396
503
  overflow: hidden;
397
504
  }
398
505
 
399
506
  & > *:last-child {
400
507
  width: 100%;
401
- padding-right: var(--tably-padding-x);
508
+ padding-right: var(--tably-padding-x, 1rem);
402
509
  }
403
510
  }
404
511
 
405
512
  .row:first-child > * {
406
- padding-top: calc(var(--tably-padding-y) + calc(var(--tably-padding-y) / 2));
513
+ padding-top: calc(var(--tably-padding-y, .5rem) + calc(var(--tably-padding-y, .5rem) / 2));
407
514
  }
408
515
  .row:last-child > * {
409
- padding-bottom: calc(var(--tably-padding-y) + calc(var(--tably-padding-y) / 2));
516
+ padding-bottom: calc(var(--tably-padding-y, .5rem) + calc(var(--tably-padding-y, .5rem) / 2));
410
517
  }
411
518
 
412
519
  .row > * {
413
- padding: calc(var(--tably-padding-y) / 2) 0;
520
+ padding: calc(var(--tably-padding-y, .5rem) / 2) 0;
414
521
  }
415
522
 
416
523
  .panel {
@@ -429,7 +536,7 @@
429
536
  right: 0;
430
537
  width: min-content;
431
538
  overflow: auto;
432
- padding: var(--tably-padding-y) 0;
539
+ padding: var(--tably-padding-y, .5rem) 0;
433
540
  }
434
541
  }
435
542
 
@@ -1,7 +1,8 @@
1
1
  import { SvelteComponent } from "svelte";
2
2
  export interface TableState<T extends Record<PropertyKey, any> = Record<PropertyKey, any>> {
3
3
  columns: Record<string, TColumn<T, unknown>>;
4
- panels: Record<string, TPanel>;
4
+ panels: Record<string, TPanel<T>>;
5
+ selected: T[] | null;
5
6
  sortby?: string;
6
7
  positions: {
7
8
  sticky: string[];
@@ -9,7 +10,10 @@ export interface TableState<T extends Record<PropertyKey, any> = Record<Property
9
10
  hidden: string[];
10
11
  toggle(key: string): void;
11
12
  };
13
+ readonly resizeable: boolean;
12
14
  readonly data: T[];
15
+ /** Rows become anchors */
16
+ readonly href?: (item: T) => string;
13
17
  addColumn(key: string, options: TColumn<T, unknown>): void;
14
18
  removeColumn(key: string): void;
15
19
  }
@@ -22,53 +26,68 @@ declare class __sveltets_Render<T extends Record<PropertyKey, unknown>> {
22
26
  content: Snippet<[context: {
23
27
  Column: {
24
28
  (internal: unknown, props: {
25
- header: Column<T_1, V>["header"];
29
+ header?: Column<T_1, V>["header"];
26
30
  row: Column<T_1, V>["row"];
27
31
  statusbar?: Column<T_1, V>["statusbar"];
28
32
  id: string;
29
33
  sticky?: boolean;
30
34
  sort?: boolean;
31
35
  show?: boolean;
36
+ width?: number;
32
37
  value?: Column<T_1, V>["options"]["value"];
33
38
  sorting?: Column<T_1, V>["options"]["sorting"];
39
+ resizeable?: boolean;
34
40
  }): {};
35
41
  new (options: import("svelte").ComponentConstructorOptions<{
36
- header: Column<T_1, V>["header"];
42
+ header?: Column<T_1, V>["header"];
37
43
  row: Column<T_1, V>["row"];
38
44
  statusbar?: Column<T_1, V>["statusbar"];
39
45
  id: string;
40
46
  sticky?: boolean;
41
47
  sort?: boolean;
42
48
  show?: boolean;
49
+ width?: number;
43
50
  value?: Column<T_1, V>["options"]["value"];
44
51
  sorting?: Column<T_1, V>["options"]["sorting"];
52
+ resizeable?: boolean;
45
53
  }>): SvelteComponent<{
46
- header: Column<T_1, V>["header"];
54
+ header?: Column<T_1, V>["header"];
47
55
  row: Column<T_1, V>["row"];
48
56
  statusbar?: Column<T_1, V>["statusbar"];
49
57
  id: string;
50
58
  sticky?: boolean;
51
59
  sort?: boolean;
52
60
  show?: boolean;
61
+ width?: number;
53
62
  value?: Column<T_1, V>["options"]["value"];
54
63
  sorting?: Column<T_1, V>["options"]["sorting"];
64
+ resizeable?: boolean;
55
65
  }, {}, {}> & {
56
66
  $$bindings?: ReturnType<() => "">;
57
67
  };
58
68
  z_$$bindings?: ReturnType<() => "">;
59
69
  };
60
70
  Panel: typeof Panel;
61
- readonly state: TableState<T>;
71
+ readonly table: TableState<T>;
62
72
  readonly data: T[];
63
73
  }]>;
64
74
  panel?: string;
65
75
  data?: T[] | undefined;
66
76
  id?: string;
77
+ href?: ((item: T) => string) | undefined;
78
+ /**
79
+ * Can you change the width of the columns?
80
+ * @default true
81
+ */
82
+ resizeable?: boolean;
83
+ selectable?: "hover" | "always" | "never";
67
84
  };
68
85
  events(): {};
69
86
  slots(): {};
70
87
  bindings(): "panel";
71
- exports(): {};
88
+ exports(): {
89
+ state: TableState<T>;
90
+ };
72
91
  }
73
92
  interface $$IsomorphicComponent {
74
93
  new <T extends Record<PropertyKey, unknown>>(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']>> & {
package/dist/index.d.ts CHANGED
@@ -1,2 +1,3 @@
1
- import { Table } from './Table/index.js';
2
- export default Table;
1
+ export { default as default } from './Table.svelte';
2
+ export { default as Panel } from './Panel.svelte';
3
+ export { default as Column } from './Column.svelte';
package/dist/index.js CHANGED
@@ -1,2 +1,3 @@
1
- import { Table } from './Table/index.js';
2
- export default Table;
1
+ export { default as default } from './Table.svelte';
2
+ export { default as Panel } from './Panel.svelte';
3
+ export { default as Column } from './Column.svelte';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "svelte-tably",
3
- "version": "1.0.0-next.5",
3
+ "version": "1.0.0-next.6",
4
4
  "repository": "github:refzlund/svelte-tably",
5
5
  "homepage": "https://github.com/Refzlund/svelte-tably",
6
6
  "bugs": {
@@ -11,7 +11,9 @@
11
11
  "@sveltejs/kit": "^2.9.0",
12
12
  "@sveltejs/package": "^2.0.0",
13
13
  "@sveltejs/vite-plugin-svelte": "^5.0.0",
14
+ "floating-runes": "^1.0.0",
14
15
  "publint": "^0.2.0",
16
+ "runic-reorder": "^1.0.0-next.1",
15
17
  "svelte": "^5.0.0",
16
18
  "svelte-check": "^4.0.0",
17
19
  "typescript": "^5.0.0",
@@ -1,31 +0,0 @@
1
- export interface Panel {
2
- /** A darkened backdrop? */
3
- backdrop: boolean;
4
- content: Snippet;
5
- }
6
- export declare class PanelTween {
7
- #private;
8
- current: number;
9
- transitioning: boolean;
10
- /** bind:clientWidth */
11
- width: number;
12
- set target(value: number);
13
- constructor(cb: () => string | undefined, added?: number);
14
- }
15
- import { type Snippet } from 'svelte';
16
- interface Props {
17
- id: string;
18
- /** A darkened backdrop? */
19
- backdrop?: boolean;
20
- children: Snippet;
21
- }
22
- /**
23
- * This is a description, \
24
- * on how to use this.
25
- *
26
- * @example
27
- * <Component />
28
- */
29
- declare const Panel: import("svelte").Component<Props, {}, "">;
30
- type Panel = ReturnType<typeof Panel>;
31
- export default Panel;
@@ -1 +0,0 @@
1
- export { default as Table } from './Table.svelte';
@@ -1 +0,0 @@
1
- export { default as Table } from './Table.svelte';
@@ -1,33 +0,0 @@
1
- <!-- @component
2
-
3
- This is a description, \
4
- on how to use this.
5
-
6
- @example
7
- <Component />
8
-
9
- -->
10
-
11
- <script lang="ts">
12
- import type { Snippet } from 'svelte'
13
- import { getTableState, type ColumnOptions } from '../Table.svelte'
14
-
15
- interface Props {
16
- [key: string]: Snippet<[options: ColumnOptions]>
17
- }
18
-
19
- let headers: Props = $props()
20
- const table = getTableState()
21
-
22
- let keys = [] as string[]
23
-
24
- $effect.pre(() => {
25
- keys.forEach((key) => delete table.columns[key].header)
26
- keys = []
27
-
28
- for (const [key, value] of Object.entries(headers)) {
29
- table.updateColumn(key, { header: value })
30
- keys.push(key)
31
- }
32
- })
33
- </script>
@@ -1,15 +0,0 @@
1
- import type { Snippet } from 'svelte';
2
- import { type ColumnOptions } from '../Table.svelte';
3
- interface Props {
4
- [key: string]: Snippet<[options: ColumnOptions]>;
5
- }
6
- /**
7
- * This is a description, \
8
- * on how to use this.
9
- *
10
- * @example
11
- * <Component />
12
- */
13
- declare const Headers: import("svelte").Component<Props, {}, "">;
14
- type Headers = ReturnType<typeof Headers>;
15
- export default Headers;
@@ -1,25 +0,0 @@
1
- <!-- @component
2
-
3
- This is a description, \
4
- on how to use this.
5
-
6
- @example
7
- <Component />
8
-
9
- -->
10
-
11
- <script lang='ts'>
12
-
13
- import type { Snippet } from 'svelte'
14
- import { getTableState, type TableState } from './Table.svelte'
15
-
16
- interface Props {
17
- [key: string]: Snippet<[table: TableState]>
18
- }
19
-
20
- let panels: Props = $props()
21
-
22
- getTableState().panels = panels
23
-
24
- </script>
25
- <!---------------------------------------------------->
@@ -1,15 +0,0 @@
1
- import type { Snippet } from 'svelte';
2
- import { type TableState } from './Table.svelte';
3
- interface Props {
4
- [key: string]: Snippet<[table: TableState]>;
5
- }
6
- /**
7
- * This is a description, \
8
- * on how to use this.
9
- *
10
- * @example
11
- * <Component />
12
- */
13
- declare const Panels: import("svelte").Component<Props, {}, "">;
14
- type Panels = ReturnType<typeof Panels>;
15
- export default Panels;