svelte-tably 1.0.0-next.8 → 1.0.0-next.9

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.
@@ -1,9 +1,10 @@
1
1
  import { SvelteComponent } from "svelte";
2
2
  export interface TableState<T extends Record<PropertyKey, any> = Record<PropertyKey, any>> {
3
- columns: Record<string, TColumn<T, unknown>>;
3
+ columns: Record<string, ColumnState<T>>;
4
4
  panels: Record<string, TPanel<T>>;
5
5
  selected: T[] | null;
6
6
  sortby?: string;
7
+ sortReverse: boolean;
7
8
  positions: {
8
9
  sticky: string[];
9
10
  scroll: string[];
@@ -14,7 +15,7 @@ export interface TableState<T extends Record<PropertyKey, any> = Record<Property
14
15
  readonly data: T[];
15
16
  /** Rows become anchors */
16
17
  readonly href?: (item: T) => string;
17
- addColumn(key: string, options: TColumn<T, unknown>): void;
18
+ addColumn(key: string, options: ColumnState<T>): void;
18
19
  removeColumn(key: string): void;
19
20
  }
20
21
  export declare function getTableState<T extends Record<PropertyKey, any> = Record<PropertyKey, any>>(): TableState<T>;
@@ -24,7 +25,7 @@ export type HeaderSelectCtx<T = any> = {
24
25
  readonly selected: T[];
25
26
  /**
26
27
  * See [MDN :indeterminate](https://developer.mozilla.org/en-US/docs/Web/CSS/:indeterminate)
27
- */
28
+ */
28
29
  readonly indeterminate: boolean;
29
30
  };
30
31
  export type RowSelectCtx<T = any> = {
@@ -34,59 +35,16 @@ export type RowSelectCtx<T = any> = {
34
35
  isSelected: boolean;
35
36
  };
36
37
  import { type Snippet } from 'svelte';
37
- import Column, { type RowCtx, type Column as TColumn } from './Column.svelte';
38
+ import { type ColumnProps, type RowCtx, type ColumnState } from './Column.svelte';
38
39
  import Panel, { type Panel as TPanel } from './Panel.svelte';
39
40
  declare class __sveltets_Render<T extends Record<PropertyKey, unknown>> {
40
41
  props(): {
41
42
  content: Snippet<[context: {
42
43
  Column: {
43
- (internal: unknown, props: {
44
- header?: Column<T_1, V>["header"];
45
- row: Column<T_1, V>["row"];
46
- statusbar?: Column<T_1, V>["statusbar"];
47
- id: string;
48
- sticky?: boolean;
49
- fixed?: boolean;
50
- sort?: boolean;
51
- show?: boolean;
52
- width?: number;
53
- value?: Column<T_1, V>["options"]["value"];
54
- sorting?: Column<T_1, V>["options"]["sorting"];
55
- resizeable?: boolean;
56
- table?: TableState;
57
- }): {};
58
- new (options: import("svelte").ComponentConstructorOptions<{
59
- header?: Column<T_1, V>["header"];
60
- row: Column<T_1, V>["row"];
61
- statusbar?: Column<T_1, V>["statusbar"];
62
- id: string;
63
- sticky?: boolean;
64
- fixed?: boolean;
65
- sort?: boolean;
66
- show?: boolean;
67
- width?: number;
68
- value?: Column<T_1, V>["options"]["value"];
69
- sorting?: Column<T_1, V>["options"]["sorting"];
70
- resizeable?: boolean;
71
- table?: TableState;
72
- }>): SvelteComponent<{
73
- header?: Column<T_1, V>["header"];
74
- row: Column<T_1, V>["row"];
75
- statusbar?: Column<T_1, V>["statusbar"];
76
- id: string;
77
- sticky?: boolean;
78
- fixed?: boolean;
79
- sort?: boolean;
80
- show?: boolean;
81
- width?: number;
82
- value?: Column<T_1, V>["options"]["value"];
83
- sorting?: Column<T_1, V>["options"]["sorting"];
84
- resizeable?: boolean;
85
- table?: TableState;
86
- }, {}, {}> & {
44
+ <V>(internal: unknown, props: ColumnProps<T, V>): {};
45
+ new <V>(options: import("svelte").ComponentConstructorOptions<ColumnProps<T, V>>): SvelteComponent<ColumnProps<T, V>, {}, {}> & {
87
46
  $$bindings?: ReturnType<() => "">;
88
- };
89
- z_$$bindings?: ReturnType<() => "">;
47
+ } & {};
90
48
  };
91
49
  Panel: typeof Panel;
92
50
  readonly table: TableState<T>;
@@ -99,7 +57,7 @@ declare class __sveltets_Render<T extends Record<PropertyKey, unknown>> {
99
57
  /**
100
58
  * Can you change the width of the columns?
101
59
  * @default true
102
- */
60
+ */
103
61
  resizeable?: boolean;
104
62
  selected?: T[] | undefined;
105
63
  select?: boolean | {
@@ -115,7 +73,7 @@ declare class __sveltets_Render<T extends Record<PropertyKey, unknown>> {
115
73
  /**
116
74
  * When to show the row-select, when not selected?
117
75
  * @default 'hover'
118
- */
76
+ */
119
77
  show?: "hover" | "always" | "never";
120
78
  /**
121
79
  * Custom snippet
@@ -132,7 +90,7 @@ declare class __sveltets_Render<T extends Record<PropertyKey, unknown>> {
132
90
  positions: TableState<T_1>["positions"];
133
91
  data: T[];
134
92
  href: ((item: T) => string) | undefined;
135
- columns: Record<string, TColumn<T, unknown>>;
93
+ columns: Record<string, ColumnState<T, unknown, ColumnProps<T, unknown>>>;
136
94
  };
137
95
  }
138
96
  interface $$IsomorphicComponent {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "svelte-tably",
3
- "version": "1.0.0-next.8",
3
+ "version": "1.0.0-next.9",
4
4
  "repository": "github:refzlund/svelte-tably",
5
5
  "homepage": "https://github.com/Refzlund/svelte-tably",
6
6
  "bugs": {