@honed/table 0.9.1 → 0.9.2

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,30 +1,14 @@
1
- import { BindingOptions } from '@honed/refine';
2
1
  import { BulkOperation } from '@honed/action';
3
2
  import { BulkSelection } from '@honed/action';
4
- import { ComputedRef } from 'vue';
5
- import { Direction } from '@honed/refine';
6
3
  import { Executable } from '@honed/action';
7
- import { Filter } from '@honed/refine';
8
- import { FilterBinding } from '@honed/refine';
9
- import { FilterValue } from '@honed/refine';
10
- import { HonedFilter } from '@honed/refine';
11
4
  import { HonedRefine } from '@honed/refine';
12
- import { HonedSearch } from '@honed/refine';
13
- import { HonedSort } from '@honed/refine';
14
5
  import { InlineOperation } from '@honed/action';
15
- import { MatchBinding } from '@honed/refine';
16
6
  import { MaybeEndpoint } from '@honed/action';
17
7
  import { MaybeId } from '@honed/action';
18
8
  import { PageOperation } from '@honed/action';
19
9
  import { PageOperationData } from '@honed/action';
20
- import { Ref } from 'vue';
21
10
  import { Refine } from '@honed/refine';
22
- import { Search } from '@honed/refine';
23
- import { SearchBinding } from '@honed/refine';
24
11
  import { Sort } from '@honed/refine';
25
- import { SortBinding } from '@honed/refine';
26
- import { Visit } from '@inertiajs/core';
27
- import { VisitCallbacks } from '@inertiajs/core';
28
12
  import { VisitOptions } from '@inertiajs/core';
29
13
 
30
14
  export declare interface BaseColumn<T extends Record<string, any> = Record<string, any>> {
@@ -70,25 +54,28 @@ export declare interface Heading<T extends Record<string, any> = Record<string,
70
54
  }
71
55
 
72
56
  export declare interface HonedTable<T extends Record<string, any> = Record<string, any>, K extends Paginate = "length-aware"> extends HonedRefine {
73
- meta: ComputedRef<Record<string, any> | null>;
74
- isEmpty: ComputedRef<boolean>;
75
- isPageable: ComputedRef<boolean>;
76
- isToggleable: ComputedRef<boolean>;
57
+ meta: Record<string, any> | null;
58
+ emptyState: EmptyState | null;
59
+ views: View[];
60
+ placeholder: string | null;
61
+ isEmpty: boolean;
62
+ isPageable: boolean;
63
+ isToggleable: boolean;
77
64
  getRecordKey: (record: TableEntry<T>) => Identifier;
78
- headings: ComputedRef<Heading<T>[]>;
79
- columns: ComputedRef<Column<T>[]>;
80
- records: ComputedRef<TableRecord<T>[]>;
81
- inline: ComputedRef<boolean>;
82
- bulk: ComputedRef<Executable<BulkOperation>[]>;
83
- page: ComputedRef<Executable<PageOperation>[]>;
84
- pages: ComputedRef<PageOption[]>;
85
- currentPage: ComputedRef<PageOption | undefined>;
86
- paginator: ComputedRef<PaginateMap[K]>;
65
+ headings: Heading<T>[];
66
+ columns: Column<T>[];
67
+ records: TableRecord<T>[];
68
+ inline: boolean;
69
+ bulk: Executable<BulkOperation>[];
70
+ page: Executable<PageOperation>[];
71
+ pages: PageOption[];
72
+ currentPage: PageOption | undefined;
73
+ paginator: PaginateMap[K];
87
74
  executeInline: (operation: InlineOperation, data: TableEntry<T>, options?: VisitOptions) => void;
88
75
  executeBulk: (operation: BulkOperation, options?: VisitOptions) => void;
89
76
  executePage: (operation: PageOperation, data?: PageOperationData, options?: VisitOptions) => void;
90
77
  applyPage: (page: PageOption, options?: VisitOptions) => void;
91
- selection: Ref<BulkSelection<Identifier>, BulkSelection<Identifier>>;
78
+ selection: BulkSelection<Identifier>;
92
79
  select: (record: TableEntry<T>) => void;
93
80
  deselect: (record: TableEntry<T>) => void;
94
81
  toggle: (record: TableEntry<T>) => void;
@@ -97,8 +84,8 @@ export declare interface HonedTable<T extends Record<string, any> = Record<strin
97
84
  selected: (record: TableEntry<T>) => boolean;
98
85
  selectAll: () => void;
99
86
  deselectAll: () => void;
100
- isPageSelected: ComputedRef<boolean>;
101
- hasSelected: ComputedRef<boolean>;
87
+ isPageSelected: boolean;
88
+ hasSelected: boolean;
102
89
  bindCheckbox: (record: TableEntry<T>) => void;
103
90
  bindPage: () => void;
104
91
  bindAll: () => void;
@@ -201,94 +188,7 @@ export declare interface TableRecord<T extends Record<string, any> = Record<stri
201
188
 
202
189
  export declare type UseTable = typeof useTable;
203
190
 
204
- export declare function useTable<T extends Record<string, Table>, K extends Record<string, any> = Record<string, any>, U extends Paginate = "length-aware">(props: T, key: keyof T, defaults?: TableOptions): {
205
- filters: HonedFilter[];
206
- sorts: HonedSort[];
207
- searches: HonedSearch[];
208
- currentFilters: HonedFilter[];
209
- currentSort: HonedSort | undefined;
210
- currentSearches: HonedSearch[];
211
- isSortable: boolean;
212
- isSearchable: boolean;
213
- isMatchable: boolean;
214
- isFiltering: (name?: string | Filter | undefined) => boolean;
215
- isSorting: (name?: string | Sort | undefined) => boolean;
216
- isSearching: (name?: string | Search | undefined) => boolean;
217
- getFilter: (filter: string | Filter) => Filter | undefined;
218
- getSort: (sort: string | Sort, dir?: Direction | undefined) => Sort | undefined;
219
- getSearch: (search: string | Search) => Search | undefined;
220
- apply: (values: Record<string, FilterValue>, options?: Partial<Visit & VisitCallbacks> | undefined) => void;
221
- applyFilter: (filter: string | Filter, value: any, options?: Partial<Visit & VisitCallbacks> | undefined) => void;
222
- applySort: (sort: string | Sort, direction?: Direction | undefined, options?: Partial<Visit & VisitCallbacks> | undefined) => void;
223
- applySearch: (value: string | null | undefined, options?: Partial<Visit & VisitCallbacks> | undefined) => void;
224
- applyMatch: (search: string | Search, options?: Partial<Visit & VisitCallbacks> | undefined) => void;
225
- clearFilter: (filter?: string | Filter | undefined, options?: Partial<Visit & VisitCallbacks> | undefined) => void;
226
- clearSort: (options?: Partial<Visit & VisitCallbacks> | undefined) => void;
227
- clearSearch: (options?: Partial<Visit & VisitCallbacks> | undefined) => void;
228
- clearMatch: (options?: Partial<Visit & VisitCallbacks> | undefined) => void;
229
- reset: (options?: Partial<Visit & VisitCallbacks> | undefined) => void;
230
- bindFilter: (filter: string | Filter, options?: BindingOptions | undefined) => void | FilterBinding;
231
- bindSort: (sort: string | Sort, options?: BindingOptions | undefined) => void | SortBinding;
232
- bindSearch: (options?: BindingOptions | undefined) => void | SearchBinding;
233
- bindMatch: (match: string | Search, options?: BindingOptions | undefined) => void | MatchBinding;
234
- stringValue: (value: any) => any;
235
- omitValue: (value: any) => any;
236
- toggleValue: (value: any, values: any) => any;
237
- delimitArray: (value: any) => string;
238
- meta: Record<string, any>;
239
- isEmpty: boolean;
240
- isPageable: boolean;
241
- isToggleable: boolean;
242
- getRecordKey: (record: TableEntry<K>) => Identifier;
243
- headings: Heading<K>[];
244
- columns: Column<K>[];
245
- records: TableRecord<K>[];
246
- inline: boolean;
247
- bulk: Executable<BulkOperation>[];
248
- page: Executable<PageOperation>[];
249
- pages: PageOption[];
250
- currentPage: PageOption | undefined;
251
- paginator: PaginateMap[U] & {
252
- links?: {
253
- navigate: (options?: VisitOptions) => void | "" | null;
254
- url: string | null;
255
- label: string;
256
- active: boolean;
257
- }[] | undefined;
258
- next: (options?: VisitOptions) => void;
259
- previous: (options?: VisitOptions) => void;
260
- first: (options?: VisitOptions) => void;
261
- last: (options?: VisitOptions) => void;
262
- };
263
- executeInline: (operation: InlineOperation, data: TableEntry<K>, options?: VisitOptions) => void;
264
- executeBulk: (operation: BulkOperation, options?: VisitOptions) => void;
265
- executePage: (operation: PageOperation, data?: PageOperationData, options?: VisitOptions) => boolean;
266
- applyPage: (page: PageOption, options?: VisitOptions) => void;
267
- selection: BulkSelection<Identifier>;
268
- select: (record: TableEntry<K>) => void;
269
- deselect: (record: TableEntry<K>) => void;
270
- selectPage: () => void;
271
- deselectPage: () => void;
272
- toggle: (record: TableEntry<K>) => void;
273
- selected: (record: TableEntry<K>) => boolean;
274
- selectAll: () => void;
275
- deselectAll: () => void;
276
- isPageSelected: boolean;
277
- hasSelected: boolean;
278
- bindCheckbox: (record: TableEntry<K>) => {
279
- "onUpdate:modelValue": (checked: boolean | "indeterminate") => void;
280
- modelValue: boolean;
281
- value: Identifier;
282
- };
283
- bindPage: () => {
284
- "onUpdate:modelValue": (checked: boolean | "indeterminate") => void;
285
- modelValue: boolean;
286
- };
287
- bindAll: () => {
288
- "onUpdate:modelValue": (checked: boolean | "indeterminate") => void;
289
- modelValue: boolean;
290
- };
291
- };
191
+ export declare function useTable<T extends Record<string, Table>, K extends Record<string, any> = Record<string, any>, U extends Paginate = "length-aware">(props: T, key: keyof T, defaults?: TableOptions): HonedTable<K, U>;
292
192
 
293
193
  export declare interface View {
294
194
  id: number;