@honed/table 0.12.0 → 0.14.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 CHANGED
@@ -1,11 +1,8 @@
1
1
  import { Binding } from '@honed/action';
2
2
  import { BulkOperation } from '@honed/action';
3
3
  import { BulkSelection } from '@honed/action';
4
- import { Executable } from '@honed/action';
5
4
  import { HonedRefine } from '@honed/refine';
6
5
  import { InlineOperation } from '@honed/action';
7
- import { MaybeEndpoint } from '@honed/action';
8
- import { MaybeId } from '@honed/action';
9
6
  import { PageOperation } from '@honed/action';
10
7
  import { PageOperationData } from '@honed/action';
11
8
  import { RecordBinding } from '@honed/action';
@@ -55,7 +52,6 @@ export declare interface HonedColumn<T extends Record<string, any> = Record<stri
55
52
  }
56
53
 
57
54
  export declare interface HonedTable<T extends Record<string, any> = Record<string, any>, K extends Paginate = "length-aware"> extends HonedRefine {
58
- id: Exclude<MaybeId, undefined>;
59
55
  meta: Record<string, any> | null;
60
56
  emptyState: EmptyState | null;
61
57
  views: View[];
@@ -76,14 +72,26 @@ export declare interface HonedTable<T extends Record<string, any> = Record<strin
76
72
  columns: HonedColumn<T>[];
77
73
  records: TableRecord<T>[];
78
74
  inline: boolean;
79
- bulk: Executable<BulkOperation>[];
80
- page: Executable<PageOperation>[];
75
+ bulk: (BulkOperation & {
76
+ execute: (options?: VisitOptions) => void;
77
+ })[];
78
+ page: (PageOperation & {
79
+ execute: (options?: VisitOptions) => void;
80
+ })[];
81
81
  pages: PageOption[];
82
82
  currentPage: PageOption | undefined;
83
83
  paginator: PaginateMap[K];
84
84
  executeInline: (operation: InlineOperation, data: TableEntry<T>, options?: VisitOptions) => void;
85
85
  executeBulk: (operation: BulkOperation, options?: VisitOptions) => void;
86
86
  executePage: (operation: PageOperation, data?: PageOperationData, options?: VisitOptions) => void;
87
+ getBulkData: () => {
88
+ all: boolean;
89
+ only: Identifier[];
90
+ except: Identifier[];
91
+ };
92
+ getRecordData: (record: TableEntry<T>) => {
93
+ id: Identifier;
94
+ };
87
95
  applyPage: (page: PageOption, options?: VisitOptions) => void;
88
96
  selection: BulkSelection<Identifier>;
89
97
  select: (record: TableEntry<T>) => void;
@@ -142,25 +150,22 @@ export declare interface SimplePaginate extends CursorPaginate {
142
150
  }
143
151
 
144
152
  export declare interface Table<T extends Record<string, any> = Record<string, any>, K extends Paginate = "length-aware"> extends Refine {
145
- id: MaybeId;
146
- endpoint: MaybeEndpoint;
147
- key: string;
148
- column?: string;
149
- record?: string;
150
- page?: string;
153
+ _column_key?: string;
154
+ _record_key?: string;
155
+ _page_key?: string;
156
+ toggleable: boolean;
151
157
  records: Array<TableEntry<T> & {
152
158
  operations: InlineOperation[];
153
159
  }>;
154
160
  paginate: PaginateMap[K];
155
161
  columns: Column<T>[];
156
162
  pages: PageOption[];
157
- toggleable: boolean;
158
163
  operations: {
159
164
  inline: boolean;
160
165
  bulk: BulkOperation[];
161
166
  page: PageOperation[];
162
167
  };
163
- emptyState?: EmptyState;
168
+ state?: EmptyState;
164
169
  views?: View[];
165
170
  meta: Record<string, any>;
166
171
  }
@@ -173,6 +178,7 @@ export declare type TableEntry<T extends Record<string, any> = Record<string, an
173
178
  f: boolean;
174
179
  };
175
180
  } & {
181
+ _key: Identifier;
176
182
  class: string | null;
177
183
  };
178
184
 
@@ -183,19 +189,20 @@ export declare interface TableOptions<T extends Record<string, any> = Record<str
183
189
  recordOperations?: Record<string, (record: TableEntry<T>) => void>;
184
190
  }
185
191
 
186
- export declare interface TableRecord<T extends Record<string, any> = Record<string, any>> {
187
- operations: Executable<InlineOperation>[];
188
- class: string | null;
192
+ export declare type TableRecord<T extends Record<string, any> = Record<string, any>> = TableEntry<T> & {
193
+ operations: (InlineOperation & {
194
+ execute: (options?: VisitOptions) => void;
195
+ })[];
196
+ selected: boolean;
189
197
  default: (options?: VisitOptions) => void;
190
198
  select: () => void;
191
199
  deselect: () => void;
192
200
  toggle: () => void;
193
- selected: boolean;
194
201
  bind: () => RecordBinding<Identifier>;
195
- entry: (column: HonedColumn<T> | string) => TableEntry<T>[keyof T] | null;
196
- value: (column: HonedColumn<T> | string) => TableEntry<T>[keyof T]["v"] | null;
197
- extra: (column: HonedColumn<T> | string) => TableEntry<T>[keyof T]["e"] | null;
198
- }
202
+ entry: (column: Column<T> | string) => TableEntry<T>[keyof T] | null;
203
+ value: (column: Column<T> | string) => TableEntry<T>[keyof T]["v"] | null;
204
+ extra: (column: Column<T> | string) => TableEntry<T>[keyof T]["e"] | null;
205
+ };
199
206
 
200
207
  export declare type UseTable = typeof useTable;
201
208