@honed/table 0.9.2 → 0.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +38 -28
- package/dist/index.es.js +447 -440
- package/dist/index.umd.js +1 -1
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { Binding } from '@honed/action';
|
|
1
2
|
import { BulkOperation } from '@honed/action';
|
|
2
3
|
import { BulkSelection } from '@honed/action';
|
|
3
4
|
import { Executable } from '@honed/action';
|
|
@@ -7,11 +8,20 @@ import { MaybeEndpoint } from '@honed/action';
|
|
|
7
8
|
import { MaybeId } from '@honed/action';
|
|
8
9
|
import { PageOperation } from '@honed/action';
|
|
9
10
|
import { PageOperationData } from '@honed/action';
|
|
11
|
+
import { RecordBinding } from '@honed/action';
|
|
10
12
|
import { Refine } from '@honed/refine';
|
|
11
13
|
import { Sort } from '@honed/refine';
|
|
12
14
|
import { VisitOptions } from '@inertiajs/core';
|
|
13
15
|
|
|
14
|
-
export declare interface
|
|
16
|
+
export declare interface Classes {
|
|
17
|
+
classes?: string;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export declare interface CollectionPaginate {
|
|
21
|
+
empty: boolean;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export declare interface Column<T extends Record<string, any> = Record<string, any>> {
|
|
15
25
|
name: keyof T;
|
|
16
26
|
label: string;
|
|
17
27
|
type?: ColumnType;
|
|
@@ -20,19 +30,10 @@ export declare interface BaseColumn<T extends Record<string, any> = Record<strin
|
|
|
20
30
|
badge?: boolean;
|
|
21
31
|
toggleable: boolean;
|
|
22
32
|
class?: string;
|
|
23
|
-
record_class?: string;
|
|
24
33
|
icon?: string;
|
|
25
34
|
sort?: Pick<Sort, "active" | "direction" | "next">;
|
|
26
35
|
}
|
|
27
36
|
|
|
28
|
-
export declare interface CollectionPaginate {
|
|
29
|
-
empty: boolean;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
export declare interface Column<T extends Record<string, any> = Record<string, any>> extends BaseColumn<T> {
|
|
33
|
-
toggle: (options: VisitOptions) => void;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
37
|
export declare type ColumnType = "array" | "badge" | "boolean" | "color" | "date" | "datetime" | "icon" | "image" | "numeric" | "text" | "time" | string;
|
|
37
38
|
|
|
38
39
|
export declare interface CursorPaginate extends CollectionPaginate {
|
|
@@ -48,12 +49,17 @@ export declare interface EmptyState {
|
|
|
48
49
|
operations: PageOperation[];
|
|
49
50
|
}
|
|
50
51
|
|
|
51
|
-
export declare interface Heading<T extends Record<string, any> = Record<string, any>> extends
|
|
52
|
+
export declare interface Heading<T extends Record<string, any> = Record<string, any>> extends Column<T> {
|
|
52
53
|
isSorting: boolean;
|
|
53
|
-
toggleSort: (options
|
|
54
|
+
toggleSort: (options?: VisitOptions) => void;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
export declare interface HonedColumn<T extends Record<string, any> = Record<string, any>> extends Column<T> {
|
|
58
|
+
toggle: (options: VisitOptions) => void;
|
|
54
59
|
}
|
|
55
60
|
|
|
56
61
|
export declare interface HonedTable<T extends Record<string, any> = Record<string, any>, K extends Paginate = "length-aware"> extends HonedRefine {
|
|
62
|
+
id: Exclude<MaybeId, undefined>;
|
|
57
63
|
meta: Record<string, any> | null;
|
|
58
64
|
emptyState: EmptyState | null;
|
|
59
65
|
views: View[];
|
|
@@ -62,8 +68,16 @@ export declare interface HonedTable<T extends Record<string, any> = Record<strin
|
|
|
62
68
|
isPageable: boolean;
|
|
63
69
|
isToggleable: boolean;
|
|
64
70
|
getRecordKey: (record: TableEntry<T>) => Identifier;
|
|
71
|
+
getEntry: (record: TableEntry<T>, column: Column<T> | string) => {
|
|
72
|
+
v: any;
|
|
73
|
+
e: any;
|
|
74
|
+
c: string | null;
|
|
75
|
+
f: boolean;
|
|
76
|
+
} | null;
|
|
77
|
+
getValue: (record: TableEntry<T>, column: Column<T> | string) => any;
|
|
78
|
+
getExtra: (record: TableEntry<T>, column: Column<T> | string) => any;
|
|
65
79
|
headings: Heading<T>[];
|
|
66
|
-
columns:
|
|
80
|
+
columns: HonedColumn<T>[];
|
|
67
81
|
records: TableRecord<T>[];
|
|
68
82
|
inline: boolean;
|
|
69
83
|
bulk: Executable<BulkOperation>[];
|
|
@@ -86,9 +100,9 @@ export declare interface HonedTable<T extends Record<string, any> = Record<strin
|
|
|
86
100
|
deselectAll: () => void;
|
|
87
101
|
isPageSelected: boolean;
|
|
88
102
|
hasSelected: boolean;
|
|
89
|
-
bindCheckbox: (record: TableEntry<T>) =>
|
|
90
|
-
bindPage: () =>
|
|
91
|
-
bindAll: () =>
|
|
103
|
+
bindCheckbox: (record: TableEntry<T>) => RecordBinding<Identifier>;
|
|
104
|
+
bindPage: () => Binding;
|
|
105
|
+
bindAll: () => Binding;
|
|
92
106
|
}
|
|
93
107
|
|
|
94
108
|
export declare type Identifier = string | number;
|
|
@@ -104,11 +118,6 @@ export declare interface LengthAwarePaginate extends SimplePaginate {
|
|
|
104
118
|
links: PaginatorLink[];
|
|
105
119
|
}
|
|
106
120
|
|
|
107
|
-
export declare interface PageBinding {
|
|
108
|
-
"onUpdate:modelValue": (checked: boolean | "indeterminate") => void;
|
|
109
|
-
modelValue: boolean;
|
|
110
|
-
}
|
|
111
|
-
|
|
112
121
|
export declare interface PageOption {
|
|
113
122
|
value: number;
|
|
114
123
|
active: boolean;
|
|
@@ -144,7 +153,7 @@ export declare interface Table<T extends Record<string, any> = Record<string, an
|
|
|
144
153
|
operations: InlineOperation[];
|
|
145
154
|
}>;
|
|
146
155
|
paginate: PaginateMap[K];
|
|
147
|
-
columns:
|
|
156
|
+
columns: Column<T>[];
|
|
148
157
|
pages: PageOption[];
|
|
149
158
|
toggleable: boolean;
|
|
150
159
|
operations: {
|
|
@@ -157,14 +166,14 @@ export declare interface Table<T extends Record<string, any> = Record<string, an
|
|
|
157
166
|
meta: Record<string, any>;
|
|
158
167
|
}
|
|
159
168
|
|
|
160
|
-
export declare type TableEntry<T extends Record<string, any> = any
|
|
169
|
+
export declare type TableEntry<T extends Record<string, any> = Record<string, any>> = {
|
|
161
170
|
[K in keyof T]: {
|
|
162
171
|
v: T[K];
|
|
163
172
|
e: any;
|
|
164
173
|
c: string | null;
|
|
165
174
|
f: boolean;
|
|
166
175
|
};
|
|
167
|
-
};
|
|
176
|
+
} & Classes;
|
|
168
177
|
|
|
169
178
|
export declare interface TableOptions<T extends Record<string, any> = Record<string, any>> extends VisitOptions {
|
|
170
179
|
/**
|
|
@@ -175,15 +184,16 @@ export declare interface TableOptions<T extends Record<string, any> = Record<str
|
|
|
175
184
|
|
|
176
185
|
export declare interface TableRecord<T extends Record<string, any> = Record<string, any>> {
|
|
177
186
|
operations: Executable<InlineOperation>[];
|
|
187
|
+
class: string | null;
|
|
178
188
|
default: (options?: VisitOptions) => void;
|
|
179
189
|
select: () => void;
|
|
180
190
|
deselect: () => void;
|
|
181
191
|
toggle: () => void;
|
|
182
192
|
selected: boolean;
|
|
183
|
-
bind: () =>
|
|
184
|
-
entry: (column:
|
|
185
|
-
value: (column:
|
|
186
|
-
extra: (column:
|
|
193
|
+
bind: () => RecordBinding<Identifier>;
|
|
194
|
+
entry: (column: HonedColumn<T> | string) => TableEntry<T>[keyof T] | null;
|
|
195
|
+
value: (column: HonedColumn<T> | string) => TableEntry<T>[keyof T]["v"] | null;
|
|
196
|
+
extra: (column: HonedColumn<T> | string) => TableEntry<T>[keyof T]["e"] | null;
|
|
187
197
|
}
|
|
188
198
|
|
|
189
199
|
export declare type UseTable = typeof useTable;
|