next-data-kit 9.2.0 → 9.4.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.
Files changed (73) hide show
  1. package/dist/client.cjs +2951 -0
  2. package/dist/client.cjs.map +1 -0
  3. package/dist/client.d.cts +60 -0
  4. package/dist/client.d.ts +1 -0
  5. package/dist/client.d.ts.map +1 -1
  6. package/dist/client.js +2907 -7
  7. package/dist/client.js.map +1 -1
  8. package/dist/index-CzDzNX62.d.cts +558 -0
  9. package/dist/index-CzDzNX62.d.ts +558 -0
  10. package/dist/index.cjs +99 -105
  11. package/dist/index.cjs.map +1 -1
  12. package/dist/index.d.cts +5 -557
  13. package/dist/index.d.ts +5 -557
  14. package/dist/index.js +99 -105
  15. package/dist/index.js.map +1 -1
  16. package/dist/styles.css +1 -1
  17. package/dist/types/index.js +2 -6
  18. package/dist/types/index.js.map +1 -1
  19. package/package.json +1 -1
  20. package/dist/client/components/data-kit-infinity.js +0 -86
  21. package/dist/client/components/data-kit-infinity.js.map +0 -1
  22. package/dist/client/components/data-kit-table.js +0 -190
  23. package/dist/client/components/data-kit-table.js.map +0 -1
  24. package/dist/client/components/data-kit.js +0 -79
  25. package/dist/client/components/data-kit.js.map +0 -1
  26. package/dist/client/components/index.js +0 -4
  27. package/dist/client/components/index.js.map +0 -1
  28. package/dist/client/components/ui/button.js +0 -36
  29. package/dist/client/components/ui/button.js.map +0 -1
  30. package/dist/client/components/ui/checkbox.js +0 -10
  31. package/dist/client/components/ui/checkbox.js.map +0 -1
  32. package/dist/client/components/ui/dropdown-menu.js +0 -52
  33. package/dist/client/components/ui/dropdown-menu.js.map +0 -1
  34. package/dist/client/components/ui/index.js +0 -8
  35. package/dist/client/components/ui/index.js.map +0 -1
  36. package/dist/client/components/ui/pagination.js +0 -31
  37. package/dist/client/components/ui/pagination.js.map +0 -1
  38. package/dist/client/components/ui/popover.js +0 -18
  39. package/dist/client/components/ui/popover.js.map +0 -1
  40. package/dist/client/components/ui/select.js +0 -39
  41. package/dist/client/components/ui/select.js.map +0 -1
  42. package/dist/client/components/ui/table.js +0 -29
  43. package/dist/client/components/ui/table.js.map +0 -1
  44. package/dist/client/context/index.js +0 -28
  45. package/dist/client/context/index.js.map +0 -1
  46. package/dist/client/hooks/index.js +0 -7
  47. package/dist/client/hooks/index.js.map +0 -1
  48. package/dist/client/hooks/useDataKit.js +0 -308
  49. package/dist/client/hooks/useDataKit.js.map +0 -1
  50. package/dist/client/hooks/usePagination.js +0 -51
  51. package/dist/client/hooks/usePagination.js.map +0 -1
  52. package/dist/client/hooks/useSelection.js +0 -93
  53. package/dist/client/hooks/useSelection.js.map +0 -1
  54. package/dist/client/index.js +0 -15
  55. package/dist/client/index.js.map +0 -1
  56. package/dist/client/utils/cn.js +0 -22
  57. package/dist/client/utils/cn.js.map +0 -1
  58. package/dist/client/utils/index.js +0 -133
  59. package/dist/client/utils/index.js.map +0 -1
  60. package/dist/server/utils.js +0 -117
  61. package/dist/server/utils.js.map +0 -1
  62. package/dist/types/client/component.js +0 -7
  63. package/dist/types/client/component.js.map +0 -1
  64. package/dist/types/client/hook.js +0 -7
  65. package/dist/types/client/hook.js.map +0 -1
  66. package/dist/types/client/selectable.js +0 -7
  67. package/dist/types/client/selectable.js.map +0 -1
  68. package/dist/types/next-data-kit.js +0 -7
  69. package/dist/types/next-data-kit.js.map +0 -1
  70. package/dist/types/server/action.js +0 -7
  71. package/dist/types/server/action.js.map +0 -1
  72. package/dist/types/server/database/mongo.js +0 -7
  73. package/dist/types/server/database/mongo.js.map +0 -1
package/dist/index.d.cts CHANGED
@@ -1,158 +1,8 @@
1
+ import { T as TDataKitInput, a as TMongoFilterQuery, b as TFilterCustomConfigWithFilter, c as TSortOptions, d as TDataKitAdapter, e as TDataKitResult, f as TMongoModel, g as TPaginationInfo } from './index-CzDzNX62.cjs';
2
+ export { n as DataKit, m as DataKitContext, D as DataKitProvider, I as TDataKitActions, U as TDataKitBulkAction, K as TDataKitColumn, R as TDataKitComponentColumn, z as TDataKitContextValue, V as TDataKitController, S as TDataKitFilterItem, X as TDataKitMemoryMode, Y as TDataKitRef, W as TDataKitSelectableItem, H as TDataKitState, Q as TExtractDataKitItemType, F as TFilterConfig, G as TFilterCustomConfig, B as TMongoFilterOperators, C as TMongoRootFilterOperators, P as TSelectable, M as TSelectionActions, O as TSelectionMode, L as TSelectionState, E as TSortEntry, A as TSortOrder, x as TUseDataKitOptions, J as TUseDataKitReturn, y as TUsePaginationReturn, N as TUseSelectionReturn, k as createDataKitContext, s as debounce, r as formatNumber, o as getColumnValue, q as getNextSortValue, p as getSortValue, w as keyToSortEntries, v as sortEntriesToKey, t as throttle, u as useDataKit, l as useDataKitContext, j as usePagination, h as useSelection, i as useSelectionWithTotal } from './index-CzDzNX62.cjs';
1
3
  import { Model } from 'mongoose';
2
- import * as React$1 from 'react';
3
- import React__default, { ReactNode } from 'react';
4
- import * as react_jsx_runtime from 'react/jsx-runtime';
5
-
6
- /**
7
- * next-data-kit - Database Types (Mongo)
8
- *
9
- * MongoDB-specific types for filters and queries.
10
- */
11
- /**
12
- * Sort order for database queries
13
- */
14
- type TSortOrder = 1 | -1 | 'asc' | 'desc' | 'ascending' | 'descending';
15
- /**
16
- * Filter operators for individual fields (Mongo subset)
17
- */
18
- type TMongoFilterOperators<T> = {
19
- $eq?: T;
20
- $ne?: T;
21
- $gt?: T;
22
- $gte?: T;
23
- $lt?: T;
24
- $lte?: T;
25
- $in?: T[];
26
- $nin?: T[];
27
- $exists?: boolean;
28
- $regex?: string | RegExp;
29
- $options?: string;
30
- };
31
- /**
32
- * Mongo root operators.
33
- */
34
- type TMongoRootFilterOperators<T> = {
35
- $and?: TMongoFilterQuery<T>[];
36
- $or?: TMongoFilterQuery<T>[];
37
- $nor?: TMongoFilterQuery<T>[];
38
- };
39
- /**
40
- * Mongo filter query type.
41
- */
42
- type TMongoFilterQuery<T> = {
43
- [P in keyof T]?: T[P] | TMongoFilterOperators<T[P]>;
44
- } & TMongoRootFilterOperators<T>;
45
- /**
46
- * Minimal Mongoose Model interface for the adapter.
47
- */
48
- type TMongoModel<T = unknown> = {
49
- countDocuments(filter?: TMongoFilterQuery<T>): Promise<number>;
50
- find(filter?: TMongoFilterQuery<T>, projection?: unknown, options?: unknown): TMongoQuery<T>;
51
- };
52
- /**
53
- * Mongoose Query interface.
54
- */
55
- type TMongoQuery<T> = {
56
- sort(sort: Record<string, TSortOrder>): TMongoQuery<T>;
57
- limit(limit: number): TMongoQuery<T>;
58
- skip(skip: number): TMongoQuery<T>;
59
- then<TResult1 = T[], TResult2 = never>(onfulfilled?: ((value: T[]) => TResult1 | PromiseLike<TResult1>) | null, onrejected?: ((reason: unknown) => TResult2 | PromiseLike<TResult2>) | null): Promise<TResult1 | TResult2>;
60
- };
61
-
62
- /**
63
- * next-data-kit - React Data Kit Types
64
- *
65
- * Core types for the next-data-kit server action and components.
66
- */
67
-
68
- /**
69
- * Sort options type that references keys from the item type
70
- */
71
- type TSortOptions<T> = {
72
- [K in keyof T]?: TSortOrder;
73
- };
74
- /**
75
- * Sort entry for array-based sorting
76
- */
77
- type TSortEntry = {
78
- path: string;
79
- value: 1 | -1;
80
- };
81
- /**
82
- * Filter configuration item
83
- */
84
- type TFilterConfiguration = {
85
- type: 'REGEX' | 'EXACT';
86
- field?: string;
87
- };
88
- /**
89
- * Filter configuration for automatic filtering
90
- */
91
- type TFilterConfig = {
92
- [key: string]: TFilterConfiguration;
93
- };
94
- /**
95
- * Custom filter configuration
96
- * Allows defining custom filter functions for specific filter keys
97
- */
98
- type TFilterCustomConfig<T = unknown> = {
99
- [id: string]: (data: unknown) => TMongoFilterQuery<T>;
100
- };
101
- /**
102
- * Variant of TFilterCustomConfig that allows customizing the returned filter shape.
103
- * Useful for Mongo (operator-based) vs. other ORMs (where clauses) in the future.
104
- */
105
- type TFilterCustomConfigWithFilter<TDoc = unknown, TFilter = TMongoFilterQuery<TDoc>> = {
106
- [id: string]: (data: unknown) => TFilter;
107
- };
108
- /**
109
- * React Data Kit server action input
110
- */
111
- type TDataKitInput<T = unknown> = {
112
- action?: 'FETCH';
113
- page?: number;
114
- limit?: number;
115
- sort?: TSortOptions<T>;
116
- sorts?: TSortEntry[];
117
- query?: Record<string, string | number | boolean>;
118
- filter?: Record<string, string | number | boolean | null>;
119
- filterConfig?: TFilterConfig;
120
- filterCustom?: TFilterCustomConfig<T>;
121
- };
122
- /**
123
- * React Data Kit server action result
124
- */
125
- type TDataKitResult<R> = {
126
- type: 'ITEMS';
127
- items: R[];
128
- documentTotal: number;
129
- };
130
- /**
131
- * Pagination info for client-side use
132
- */
133
- type TPaginationInfo = {
134
- currentPage: number;
135
- totalPages: number;
136
- totalItems: number;
137
- itemsPerPage: number;
138
- hasNextPage: boolean;
139
- hasPrevPage: boolean;
140
- };
141
- /**
142
- * React Data Kit Adapter Interface
143
- * Defines the contract for a database adapter.
144
- */
145
- type TDataKitAdapter<T> = (params: Readonly<{
146
- filter: Record<string, unknown>;
147
- sorts: TSortEntry[];
148
- limit: number;
149
- page: number;
150
- skip: number;
151
- input: TDataKitInput<T>;
152
- }>) => Promise<{
153
- items: T[];
154
- total: number;
155
- }>;
4
+ import 'react';
5
+ import 'react/jsx-runtime';
156
6
 
157
7
  /**
158
8
  * next-data-kit - Server Action Types
@@ -196,292 +46,6 @@ type TAdapterOptions<TDoc, R> = TBaseOptions<TDoc, R> & {
196
46
  defaultSort?: never;
197
47
  };
198
48
 
199
- /**
200
- * next-data-kit - Hook Types
201
- *
202
- * Types for the next-data-kit hooks and state management.
203
- */
204
-
205
- /**
206
- * React Data Kit controller state
207
- */
208
- type TDataKitState<T = unknown> = {
209
- page: number;
210
- limit: number;
211
- sorts: TSortEntry[];
212
- filter: Record<string, unknown>;
213
- filterConfig?: TFilterConfig;
214
- query?: Record<string, unknown>;
215
- isLoading: boolean;
216
- error: Error | null;
217
- items: T[];
218
- total: number;
219
- };
220
- /**
221
- * React Data Kit controller actions
222
- */
223
- type TDataKitActions<T = unknown, R = unknown> = {
224
- setPage: (page: number) => void;
225
- setLimit: (limit: number) => void;
226
- setSort: (path: string, value: 1 | -1 | null, append?: boolean) => void;
227
- setSorts: (sorts: TSortEntry[]) => void;
228
- setFilter: (key: string, value: unknown) => void;
229
- setFilters: (filters: Record<string, unknown>) => void;
230
- clearFilters: () => void;
231
- setQuery: (key: string, value: unknown) => void;
232
- refresh: () => Promise<void>;
233
- reset: () => void;
234
- getInput: () => TDataKitInput<T>;
235
- setItems: (items: R[]) => void;
236
- setItemAt: (index: number, item: R) => void;
237
- itemUpdate: (props: {
238
- index: number;
239
- data: Partial<R>;
240
- } | {
241
- id: string | number;
242
- data: Partial<R>;
243
- }) => void;
244
- deleteItemAt: (index: number) => void;
245
- itemDelete: (props: {
246
- index: number;
247
- } | {
248
- id: string | number;
249
- }) => void;
250
- itemPush: (item: R, position?: 0 | 1) => void;
251
- deleteBulk: (items: R[]) => void;
252
- };
253
- /**
254
- * Combined next-data-kit controller return type
255
- */
256
- type TUseDataKitReturn<T = unknown, R = unknown> = {
257
- page: number;
258
- limit: number;
259
- sorts: TSortEntry[];
260
- filter: Record<string, unknown>;
261
- filterConfig?: TFilterConfig;
262
- query?: Record<string, unknown>;
263
- items: R[];
264
- total: number;
265
- state: {
266
- isLoading: boolean;
267
- error: Error | null;
268
- hasNextPage: boolean;
269
- };
270
- actions: TDataKitActions<T, R>;
271
- };
272
- /**
273
- * Options for the useDataKit hook
274
- */
275
- type TUseDataKitOptions<T = unknown, R = unknown> = {
276
- initial?: {
277
- page?: number;
278
- limit?: number;
279
- sorts?: TSortEntry[];
280
- filter?: Record<string, unknown>;
281
- query?: Record<string, unknown>;
282
- };
283
- memory?: 'memory' | 'search-params';
284
- filters?: {
285
- id: string;
286
- configuration?: TFilterConfiguration;
287
- }[];
288
- action: (input: TDataKitInput<T>) => Promise<TDataKitResult<R>>;
289
- onSuccess?: (result: TDataKitResult<R>) => void;
290
- onError?: (error: Error) => void;
291
- autoFetch?: boolean;
292
- debounce?: number;
293
- };
294
- /**
295
- * Column definition for next-data-kit (headless)
296
- */
297
- type TDataKitColumn<T = unknown> = {
298
- id: string;
299
- header: string;
300
- accessor: keyof T | ((item: T) => unknown);
301
- sortable?: boolean;
302
- sortPath?: string;
303
- filterable?: boolean;
304
- filterKey?: string;
305
- width?: string | number;
306
- minWidth?: string | number;
307
- maxWidth?: string | number;
308
- align?: 'left' | 'center' | 'right';
309
- cell?: (value: unknown, item: T, index: number) => React.ReactNode;
310
- headerCell?: (column: TDataKitColumn<T>) => React.ReactNode;
311
- hidden?: boolean;
312
- sticky?: 'left' | 'right';
313
- };
314
-
315
- /**
316
- * next-data-kit - Selectable Types
317
- *
318
- * Types for selectable/multi-select functionality in tables.
319
- */
320
- /**
321
- * Selection state for a table
322
- */
323
- type TSelectionState<T = string> = {
324
- selectedIds: Set<T>;
325
- isAllSelected: boolean;
326
- isIndeterminate: boolean;
327
- };
328
- /**
329
- * Selection actions for a table
330
- */
331
- type TSelectionActions<T = string> = {
332
- select: (id: T) => void;
333
- deselect: (id: T) => void;
334
- toggle: (id: T) => void;
335
- selectAll: (ids: T[]) => void;
336
- deselectAll: () => void;
337
- toggleAll: (ids: T[]) => void;
338
- isSelected: (id: T) => boolean;
339
- getSelectedArray: () => T[];
340
- };
341
- /**
342
- * Combined selection hook return type
343
- */
344
- type TUseSelectionReturn<T = string> = TSelectionState<T> & TSelectionActions<T>;
345
- /**
346
- * Selection mode for tables
347
- */
348
- type TSelectionMode = 'single' | 'multiple' | 'none';
349
- /**
350
- * Selectable item type
351
- */
352
- type TSelectable = {
353
- id: string;
354
- selected?: boolean;
355
- disabled?: boolean;
356
- };
357
-
358
- /**
359
- * next-data-kit - Component Types
360
- *
361
- * Types for the React Data Kit component and related UI elements.
362
- */
363
-
364
- /**
365
- * Extract the item type from a TDataKitResult
366
- */
367
- type TExtractDataKitItemFromResult<R> = R extends TDataKitResult<infer I> ? I : R extends {
368
- items: (infer I)[];
369
- } ? I : R extends [true, infer Ok] ? (Ok extends {
370
- items: (infer I)[];
371
- } ? I : never) : never;
372
- /**
373
- * Extract the item type from an action function's return type
374
- */
375
- type TExtractDataKitItemType<T> = T extends (input: TDataKitInput<unknown>) => infer R ? TExtractDataKitItemFromResult<Awaited<R>> : never;
376
- /**
377
- * Column definition for React Data Kit component
378
- */
379
- type TDataKitComponentColumn<TItem, TRowState = unknown> = {
380
- head: React.ReactNode;
381
- body: (props: Readonly<{
382
- item: TItem;
383
- index: number;
384
- state: TRowState;
385
- setState: React.Dispatch<React.SetStateAction<TRowState>>;
386
- setItem: (item: TItem) => void;
387
- deleteItem: () => void;
388
- }>) => React.ReactNode;
389
- sortable?: {
390
- path: string;
391
- default: 1 | -1 | 0;
392
- };
393
- };
394
- /**
395
- * Base filter item properties
396
- */
397
- type TDataKitFilterItemBase = {
398
- id: string;
399
- label: string;
400
- placeholder?: string;
401
- configuration?: TFilterConfiguration;
402
- };
403
- /**
404
- * Text filter item
405
- */
406
- type TDataKitFilterItemText = TDataKitFilterItemBase & {
407
- type: 'TEXT';
408
- defaultValue?: string;
409
- };
410
- /**
411
- * Select filter item - dataset is required
412
- */
413
- type TDataKitFilterItemSelect = TDataKitFilterItemBase & {
414
- type: 'SELECT';
415
- dataset: {
416
- id: string;
417
- name: string;
418
- label: string;
419
- }[];
420
- defaultValue?: string;
421
- };
422
- /**
423
- * Boolean filter item
424
- */
425
- type TDataKitFilterItemBoolean = TDataKitFilterItemBase & {
426
- type: 'BOOLEAN';
427
- defaultValue?: boolean;
428
- };
429
- /**
430
- * Filter item configuration - discriminated union for type safety
431
- */
432
- type TDataKitFilterItem = TDataKitFilterItemText | TDataKitFilterItemSelect | TDataKitFilterItemBoolean;
433
- /**
434
- * Bulk action definition for selectable tables
435
- */
436
- type TDataKitBulkAction<TItem> = {
437
- type: 'SEPARATOR';
438
- } | {
439
- type?: 'MENU';
440
- name: string;
441
- icon?: React.ReactNode;
442
- function: (selectedItems: TItem[]) => Promise<[boolean, {
443
- deselectAll?: boolean;
444
- updatedItems?: TItem[];
445
- } | string]>;
446
- };
447
- /**
448
- * Controller ref for external DataKitTable manipulation
449
- */
450
- type TDataKitController<TItem> = {
451
- itemPush: (item: TItem, position?: 0 | 1) => void;
452
- itemUpdate: (props: {
453
- index: number;
454
- data: Partial<TItem>;
455
- } | {
456
- id: string | number;
457
- data: Partial<TItem>;
458
- }) => void;
459
- itemDelete: (props: {
460
- index: number;
461
- } | {
462
- id: string | number;
463
- }) => void;
464
- refetchData: () => void;
465
- deleteBulk: (items: TItem[]) => void;
466
- getSelectedItems: () => TItem[];
467
- clearSelection: () => void;
468
- };
469
- /**
470
- * Item with ID for selection purposes
471
- */
472
- type TDataKitSelectableItem = {
473
- id: string | number;
474
- };
475
- /**
476
- * Memory persistence mode
477
- */
478
- type TDataKitMemoryMode = 'memory' | 'search-params';
479
- /**
480
- * DataKit Component Ref Type
481
- * Exposes the internal state and actions of the DataKit component.
482
- */
483
- type TDataKitRef<T = unknown, R = unknown> = TUseDataKitReturn<T, R>;
484
-
485
49
  /**
486
50
  * next-data-kit - Server Action
487
51
  *
@@ -549,120 +113,4 @@ declare const createSearchFilter: <T>(fields: (keyof T | string)[]) => ((value:
549
113
  */
550
114
  declare const calculatePagination: (page: number, limit: number, total: number) => TPaginationInfo;
551
115
 
552
- /**
553
- * next-data-kit - useDataKit Hook
554
- *
555
- * React hook for managing next-data-kit state and actions.
556
- */
557
-
558
- declare const useDataKit: <T = unknown, R = unknown>(props: Readonly<TUseDataKitOptions<T, R>>) => TUseDataKitReturn<T, R>;
559
-
560
- /**
561
- * next-data-kit - useSelection Hook
562
- *
563
- * React hook for managing table row selection.
564
- */
565
-
566
- declare const useSelection: <T = string>(initialSelected?: T[]) => TUseSelectionReturn<T>;
567
- declare const useSelectionWithTotal: <T = string>(totalItems: T[], initialSelected?: T[]) => Omit<TUseSelectionReturn<T>, "toggleAll"> & {
568
- isAllSelected: boolean;
569
- isIndeterminate: boolean;
570
- toggleAll: () => void;
571
- };
572
-
573
- /**
574
- * next-data-kit - usePagination Hook
575
- *
576
- * React hook for calculating pagination state.
577
- */
578
-
579
- type TUsePaginationReturn = TPaginationInfo & {
580
- pages: (number | 'ellipsis')[];
581
- firstPage: number;
582
- lastPage: number;
583
- };
584
- declare const usePagination: (props: Readonly<{
585
- page: number;
586
- limit: number;
587
- total: number;
588
- siblingCount?: number;
589
- }>) => TUsePaginationReturn;
590
-
591
- type TDataKitContextValue<T = unknown, R = unknown> = TUseDataKitReturn<T, R>;
592
- declare const createDataKitContext: <T = unknown, R = unknown>() => {
593
- DataKitProvider: (props: Readonly<{
594
- value: TDataKitContextValue<T, R>;
595
- children: ReactNode;
596
- }>) => react_jsx_runtime.JSX.Element;
597
- useDataKitContext: () => TDataKitContextValue<T, R>;
598
- Context: React$1.Context<TDataKitContextValue<T, R> | null>;
599
- };
600
- declare const DefaultDataKitProvider: (props: Readonly<{
601
- value: TDataKitContextValue<unknown, unknown>;
602
- children: ReactNode;
603
- }>) => react_jsx_runtime.JSX.Element;
604
- declare const useDefaultDataKitContext: () => TDataKitContextValue<unknown, unknown>;
605
- declare const DefaultDataKitContext: React$1.Context<TDataKitContextValue<unknown, unknown> | null>;
606
-
607
- declare const DataKit: <TAction extends (input: TDataKitInput<unknown>) => Promise<TDataKitResult<TDataKitSelectableItem>>>(props: Readonly<{
608
- action: TAction;
609
- query?: Record<string, unknown>;
610
- filters?: TDataKitFilterItem[];
611
- limit?: {
612
- default: number;
613
- };
614
- defaultSort?: {
615
- path: string;
616
- value: 1 | -1;
617
- }[];
618
- className?: string;
619
- autoFetch?: boolean;
620
- debounce?: number;
621
- refetchInterval?: number;
622
- memory?: TDataKitMemoryMode;
623
- manual?: boolean;
624
- pagination?: "SIMPLE" | "NUMBER";
625
- children: (dataKit: TUseDataKitReturn<unknown, TExtractDataKitItemType<TAction>>) => React__default.ReactNode;
626
- ref?: React__default.Ref<TDataKitRef<unknown, TExtractDataKitItemType<TAction>>>;
627
- }>) => React__default.ReactElement;
628
-
629
- /**
630
- * next-data-kit - Utility Functions
631
- *
632
- * Helper utilities for client-side operations.
633
- */
634
-
635
- /**
636
- * Get the value from an item using a column accessor
637
- */
638
- declare const getColumnValue: <T>(item: T, column: TDataKitColumn<T>) => unknown;
639
- /**
640
- * Get the sort value for a column
641
- */
642
- declare const getSortValue: (sorts: TSortEntry[], path: string) => 1 | -1 | null;
643
- /**
644
- * Get the next sort value in the cycle: null -> 1 -> -1 -> null
645
- */
646
- declare const getNextSortValue: (current: 1 | -1 | null) => 1 | -1 | null;
647
- /**
648
- * Format a number with commas
649
- */
650
- declare const formatNumber: (num: number) => string;
651
- /**
652
- * Debounce a function
653
- */
654
- declare const debounce: <T extends (...args: unknown[]) => unknown>(fn: T, delay: number) => ((...args: Parameters<T>) => void);
655
- /**
656
- * Throttle a function
657
- */
658
- declare const throttle: <T extends (...args: unknown[]) => unknown>(fn: T, limit: number) => ((...args: Parameters<T>) => void);
659
- /**
660
- * Create a stable object key from sort entries
661
- */
662
- declare const sortEntriesToKey: (sorts: TSortEntry[]) => string;
663
- /**
664
- * Parse a sort key back to sort entries
665
- */
666
- declare const keyToSortEntries: (key: string) => TSortEntry[];
667
-
668
- export { DataKit, DefaultDataKitContext as DataKitContext, DefaultDataKitProvider as DataKitProvider, type TAdapterOptions, type TBaseOptions, type TDataKitActions, type TDataKitAdapter, type TDataKitBulkAction, type TDataKitColumn, type TDataKitComponentColumn, type TDataKitContextValue, type TDataKitController, type TDataKitFilterItem, type TDataKitInput, type TDataKitMemoryMode, type TDataKitRef, type TDataKitResult, type TDataKitSelectableItem, type TDataKitState, type TExtractDataKitItemType, type TExtractDocType, type TFilterConfig, type TFilterCustomConfig, type TFilterCustomConfigWithFilter, type TMongoFilterOperators, type TMongoFilterQuery, type TMongoModel, type TMongoRootFilterOperators, type TMongooseOptions, type TPaginationInfo, type TSelectable, type TSelectionActions, type TSelectionMode, type TSelectionState, type TSortEntry, type TSortOptions, type TSortOrder, type TUseDataKitOptions, type TUseDataKitReturn, type TUsePaginationReturn, type TUseSelectionReturn, adapterMemory, calculatePagination, createDataKitContext, createSearchFilter, dataKitServerAction, debounce, escapeRegex, formatNumber, getColumnValue, getNextSortValue, getSortValue, keyToSortEntries, mongooseAdapter, sortEntriesToKey, throttle, useDataKit, useDefaultDataKitContext as useDataKitContext, usePagination, useSelection, useSelectionWithTotal };
116
+ export { type TAdapterOptions, type TBaseOptions, TDataKitAdapter, TDataKitInput, TDataKitResult, type TExtractDocType, TFilterCustomConfigWithFilter, TMongoFilterQuery, TMongoModel, type TMongooseOptions, TPaginationInfo, TSortOptions, adapterMemory, calculatePagination, createSearchFilter, dataKitServerAction, escapeRegex, mongooseAdapter };