@pulog/component 0.0.0-stage → 0.1.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/README.md +815 -2
- package/dist/SelectionSummary-N6MMSND2.js +3 -0
- package/dist/SelectionSummary-N6MMSND2.js.map +1 -0
- package/dist/chunk-3JJG43AS.js +213 -0
- package/dist/chunk-3JJG43AS.js.map +1 -0
- package/dist/index.d.ts +550 -0
- package/dist/index.js +3844 -0
- package/dist/index.js.map +1 -0
- package/package.json +43 -4
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,550 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
|
|
4
|
+
type FilterOperator = 'equals' | 'contains' | 'startsWith' | 'endsWith' | 'greaterThan' | 'lessThan' | 'between' | 'in' | 'dateRange';
|
|
5
|
+
type FilterType = 'search' | 'date' | 'dateRange' | 'select' | 'multiSelect' | 'checkbox' | 'range' | 'dateTree';
|
|
6
|
+
interface FilterValue {
|
|
7
|
+
field: string;
|
|
8
|
+
operator: FilterOperator;
|
|
9
|
+
value: any;
|
|
10
|
+
type: FilterType;
|
|
11
|
+
}
|
|
12
|
+
interface FilterOption {
|
|
13
|
+
label: string;
|
|
14
|
+
value: string | number;
|
|
15
|
+
}
|
|
16
|
+
interface ColumnFilter {
|
|
17
|
+
id: string;
|
|
18
|
+
label: string;
|
|
19
|
+
type: FilterType;
|
|
20
|
+
operator?: FilterOperator;
|
|
21
|
+
options?: FilterOption[];
|
|
22
|
+
onSearch?: (query: string) => Promise<FilterOption[]>;
|
|
23
|
+
minSearchLength?: number;
|
|
24
|
+
autoApply?: boolean;
|
|
25
|
+
/** Memisahkan input pencarian dengan koma menjadi array saat lebih dari satu nilai. */
|
|
26
|
+
allowCommaSeparated?: boolean;
|
|
27
|
+
minValue?: number;
|
|
28
|
+
maxValue?: number;
|
|
29
|
+
minDate?: string;
|
|
30
|
+
maxDate?: string;
|
|
31
|
+
placeholder?: string;
|
|
32
|
+
searchPlaceholder?: string;
|
|
33
|
+
}
|
|
34
|
+
type SortOrder = 'asc' | 'desc' | null;
|
|
35
|
+
interface SortState {
|
|
36
|
+
column: string | null;
|
|
37
|
+
order: SortOrder;
|
|
38
|
+
}
|
|
39
|
+
interface PaginationMeta {
|
|
40
|
+
pageIndex: number;
|
|
41
|
+
pageSize: number;
|
|
42
|
+
pageCount: number;
|
|
43
|
+
totalData: number;
|
|
44
|
+
}
|
|
45
|
+
interface DataTableResponse<T> {
|
|
46
|
+
status: number;
|
|
47
|
+
success: boolean;
|
|
48
|
+
message: string;
|
|
49
|
+
data: T[];
|
|
50
|
+
meta: {
|
|
51
|
+
pagination: PaginationMeta;
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
interface RowSelectionState {
|
|
55
|
+
[key: string]: boolean;
|
|
56
|
+
}
|
|
57
|
+
interface ColumnVisibilityState {
|
|
58
|
+
[key: string]: boolean;
|
|
59
|
+
}
|
|
60
|
+
type ColumnPinPosition = 'left' | 'right' | false;
|
|
61
|
+
interface ColumnPinningState {
|
|
62
|
+
[key: string]: ColumnPinPosition;
|
|
63
|
+
}
|
|
64
|
+
interface ExpandedRowState {
|
|
65
|
+
[key: string]: boolean;
|
|
66
|
+
}
|
|
67
|
+
interface DataTableState$1<T> {
|
|
68
|
+
data: T[];
|
|
69
|
+
isLoading: boolean;
|
|
70
|
+
error: string | null;
|
|
71
|
+
filters: FilterValue[];
|
|
72
|
+
search?: {
|
|
73
|
+
query: string;
|
|
74
|
+
fields: string[];
|
|
75
|
+
};
|
|
76
|
+
sort: SortState;
|
|
77
|
+
pagination: PaginationMeta;
|
|
78
|
+
rowSelection: RowSelectionState;
|
|
79
|
+
columnVisibility: ColumnVisibilityState;
|
|
80
|
+
expandedRows: ExpandedRowState;
|
|
81
|
+
paginationMode: 'traditional' | 'infinite';
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
interface DataTableColumn<T> {
|
|
85
|
+
id: string;
|
|
86
|
+
header: string | React.ReactNode;
|
|
87
|
+
accessor?: keyof T | ((row: T) => React.ReactNode);
|
|
88
|
+
cell?: (row: T) => React.ReactNode;
|
|
89
|
+
sortable?: boolean;
|
|
90
|
+
filterable?: boolean;
|
|
91
|
+
filterConfig?: ColumnFilter | ColumnFilter[];
|
|
92
|
+
width?: string | number;
|
|
93
|
+
className?: string | ((row: T) => string);
|
|
94
|
+
headerClassName?: string;
|
|
95
|
+
/** Default pin state — the user can still change this at runtime via the header's pin menu unless `pinnable` is false. */
|
|
96
|
+
sticky?: boolean | 'left' | 'right';
|
|
97
|
+
copyable?: boolean;
|
|
98
|
+
copyValue?: (row: any) => string;
|
|
99
|
+
/** Opt out of drag-to-resize for this column when the table has `enableColumnResizing`. */
|
|
100
|
+
resizable?: boolean;
|
|
101
|
+
/** Opt out of the pin/unpin header menu for this column when the table has `enableColumnPinning`. */
|
|
102
|
+
pinnable?: boolean;
|
|
103
|
+
}
|
|
104
|
+
interface DataTableState {
|
|
105
|
+
pageIndex: number;
|
|
106
|
+
pageSize: number;
|
|
107
|
+
sort: SortState;
|
|
108
|
+
filters: FilterValue[];
|
|
109
|
+
search?: {
|
|
110
|
+
query: string;
|
|
111
|
+
fields: string[];
|
|
112
|
+
};
|
|
113
|
+
}
|
|
114
|
+
interface DataTableProps<T> {
|
|
115
|
+
columns: DataTableColumn<T>[];
|
|
116
|
+
data: T[];
|
|
117
|
+
isLoading?: boolean;
|
|
118
|
+
error?: string | null;
|
|
119
|
+
rowKey: keyof T;
|
|
120
|
+
onRowClick?: (row: T) => void;
|
|
121
|
+
showSelection?: boolean;
|
|
122
|
+
showExpand?: boolean;
|
|
123
|
+
stickySelection?: boolean;
|
|
124
|
+
stickyExpand?: boolean;
|
|
125
|
+
showRowNumber?: boolean;
|
|
126
|
+
stickyRowNumber?: boolean;
|
|
127
|
+
expandContent?: (row: T) => React.ReactNode;
|
|
128
|
+
onExpandLoad?: (row: T) => Promise<any>;
|
|
129
|
+
expandLoadContent?: (row: T, data: any, state: {
|
|
130
|
+
isLoading: boolean;
|
|
131
|
+
error: string | null;
|
|
132
|
+
}) => React.ReactNode;
|
|
133
|
+
paginationMode?: 'traditional' | 'infinite';
|
|
134
|
+
showFilters?: boolean;
|
|
135
|
+
showSearch?: boolean;
|
|
136
|
+
searchFields?: string[];
|
|
137
|
+
searchPlaceholder?: string;
|
|
138
|
+
/** Cap, not a fixed size — the table shrinks to fit its rows and only scrolls once row content would exceed this. */
|
|
139
|
+
tableHeight?: string | number;
|
|
140
|
+
infiniteScrollHeight?: string | number;
|
|
141
|
+
/** Initial rows-per-page — also the only place this is configured (seeds internal state on mount). */
|
|
142
|
+
pageSize?: number;
|
|
143
|
+
pageSizeOptions?: number[];
|
|
144
|
+
placeholder?: string;
|
|
145
|
+
manualPagination?: boolean;
|
|
146
|
+
manualSorting?: boolean;
|
|
147
|
+
manualFiltering?: boolean;
|
|
148
|
+
totalCount?: number;
|
|
149
|
+
onStateChange?: (state: DataTableState) => void;
|
|
150
|
+
emptyStateMessage?: string;
|
|
151
|
+
labelSelection?: string;
|
|
152
|
+
toolbarLeft?: React.ReactNode;
|
|
153
|
+
toolbarRight?: React.ReactNode;
|
|
154
|
+
renderSelectionCell?: (row: T, rowId: string, defaultCheckbox: React.ReactNode) => React.ReactNode;
|
|
155
|
+
rowClassName?: string;
|
|
156
|
+
selectableTotalCount?: number;
|
|
157
|
+
onSelectAllAttempt?: (count: number, confirm: () => void) => void;
|
|
158
|
+
selectionMode?: 'checkbox' | 'radio';
|
|
159
|
+
showColumnVisibility?: boolean;
|
|
160
|
+
enableColumnResizing?: boolean;
|
|
161
|
+
defaultColumnVisibility?: ColumnVisibilityState;
|
|
162
|
+
enableColumnPinning?: boolean;
|
|
163
|
+
defaultColumnPinning?: ColumnPinningState;
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
/**
|
|
167
|
+
* Self-contained data table: owns its filter/pagination/selection/sort/
|
|
168
|
+
* column-visibility state internally, so callers never render a separate
|
|
169
|
+
* provider. `pageSize`, `selectionMode` and `defaultColumnVisibility` seed
|
|
170
|
+
* that internal state on mount and are the single source of truth for it —
|
|
171
|
+
* there is no separate provider-level prop to keep in sync.
|
|
172
|
+
*
|
|
173
|
+
* Escape hatch: if a sibling component (e.g. a custom toolbar button above
|
|
174
|
+
* the table) needs to read the same selection/filter state via
|
|
175
|
+
* `useSelection()` / `useFilters()` etc., wrap both in an explicit
|
|
176
|
+
* `<DataTableProvider>` yourself — `<DataTable>` detects that ambient
|
|
177
|
+
* provider and reuses it instead of creating a disconnected nested one.
|
|
178
|
+
*/
|
|
179
|
+
declare function DataTable<T extends Record<string, any>>(props: DataTableProps<T>): react_jsx_runtime.JSX.Element;
|
|
180
|
+
|
|
181
|
+
/**
|
|
182
|
+
* Internal to `<DataTable>` — it renders this itself, seeded from its own
|
|
183
|
+
* props, so page code should never need to render `DataTableProvider`
|
|
184
|
+
* directly. Kept as a separate component only because `DataTable`'s
|
|
185
|
+
* generic type parameter needs a plain (non-generic) child to wrap.
|
|
186
|
+
*/
|
|
187
|
+
interface DataTableProviderProps {
|
|
188
|
+
children: React.ReactNode;
|
|
189
|
+
defaultColumnVisibility?: ColumnVisibilityState;
|
|
190
|
+
defaultColumnPinning?: ColumnPinningState;
|
|
191
|
+
selectionMode?: 'checkbox' | 'radio';
|
|
192
|
+
defaultPageSize?: number;
|
|
193
|
+
}
|
|
194
|
+
declare function DataTableProvider({ children, defaultColumnVisibility, defaultColumnPinning, selectionMode, defaultPageSize, }: DataTableProviderProps): react_jsx_runtime.JSX.Element;
|
|
195
|
+
|
|
196
|
+
interface FilterContextType {
|
|
197
|
+
filters: FilterValue[];
|
|
198
|
+
addFilter: (filter: FilterValue) => void;
|
|
199
|
+
updateFilter: (fieldId: string, newFilter: Partial<FilterValue>) => void;
|
|
200
|
+
removeFilter: (fieldId: string, value?: any) => void;
|
|
201
|
+
clearFilters: () => void;
|
|
202
|
+
clearFieldFilters: (fields: string[]) => void;
|
|
203
|
+
hasActiveFilters: boolean;
|
|
204
|
+
getFieldFilters: (field: string) => FilterValue[];
|
|
205
|
+
}
|
|
206
|
+
declare function FilterProvider({ children }: {
|
|
207
|
+
children: React.ReactNode;
|
|
208
|
+
}): react_jsx_runtime.JSX.Element;
|
|
209
|
+
declare function useFilters(): FilterContextType;
|
|
210
|
+
|
|
211
|
+
interface PaginationContextType {
|
|
212
|
+
pageIndex: number;
|
|
213
|
+
pageSize: number;
|
|
214
|
+
pageCount: number;
|
|
215
|
+
totalData: number;
|
|
216
|
+
paginationMode: 'traditional' | 'infinite';
|
|
217
|
+
goToPage: (pageIndex: number) => void;
|
|
218
|
+
nextPage: () => void;
|
|
219
|
+
previousPage: () => void;
|
|
220
|
+
setPageSize: (size: number) => void;
|
|
221
|
+
updatePaginationMeta: (meta: PaginationMeta) => void;
|
|
222
|
+
updatePaginationCount: (meta: Omit<PaginationMeta, 'pageSize'>) => void;
|
|
223
|
+
setPaginationMode: (mode: 'traditional' | 'infinite') => void;
|
|
224
|
+
canGoNext: boolean;
|
|
225
|
+
canGoPrevious: boolean;
|
|
226
|
+
}
|
|
227
|
+
declare function PaginationProvider({ children, defaultPageSize, }: {
|
|
228
|
+
children: React.ReactNode;
|
|
229
|
+
defaultPageSize?: number;
|
|
230
|
+
}): react_jsx_runtime.JSX.Element;
|
|
231
|
+
declare function usePagination(): PaginationContextType;
|
|
232
|
+
|
|
233
|
+
interface SelectionContextType {
|
|
234
|
+
rowSelection: RowSelectionState;
|
|
235
|
+
expandedRows: ExpandedRowState;
|
|
236
|
+
isSelectAll: boolean;
|
|
237
|
+
toggleRow: (rowId: string, currentPageRowIds?: string[]) => void;
|
|
238
|
+
toggleAll: (rowIds: string[], selected: boolean, total?: number) => void;
|
|
239
|
+
selectRows: (rowIds: string[]) => void;
|
|
240
|
+
deselectRows: (rowIds: string[]) => void;
|
|
241
|
+
clearSelection: () => void;
|
|
242
|
+
isRowSelected: (rowId: string) => boolean;
|
|
243
|
+
selectedCount: number;
|
|
244
|
+
toggleExpanded: (rowId: string) => void;
|
|
245
|
+
isRowExpanded: (rowId: string) => boolean;
|
|
246
|
+
expandedCount: number;
|
|
247
|
+
getSelectedRowIds: () => string[];
|
|
248
|
+
clearSelectAll: () => void;
|
|
249
|
+
selectionMode: 'checkbox' | 'radio';
|
|
250
|
+
}
|
|
251
|
+
declare function SelectionProvider({ children, selectionMode: propSelectionMode, }: {
|
|
252
|
+
children: React.ReactNode;
|
|
253
|
+
selectionMode?: 'checkbox' | 'radio';
|
|
254
|
+
}): react_jsx_runtime.JSX.Element;
|
|
255
|
+
declare function useSelection(): SelectionContextType;
|
|
256
|
+
|
|
257
|
+
interface SortContextType {
|
|
258
|
+
sort: SortState;
|
|
259
|
+
setSort: (column: string | null, order?: SortOrder) => void;
|
|
260
|
+
toggleSort: (column: string) => void;
|
|
261
|
+
clearSort: () => void;
|
|
262
|
+
isSorted: (column: string) => boolean;
|
|
263
|
+
getSortOrder: (column: string) => SortOrder;
|
|
264
|
+
}
|
|
265
|
+
declare function SortProvider({ children }: {
|
|
266
|
+
children: React.ReactNode;
|
|
267
|
+
}): react_jsx_runtime.JSX.Element;
|
|
268
|
+
declare function useSort(): SortContextType;
|
|
269
|
+
|
|
270
|
+
interface ColumnVisibilityContextType {
|
|
271
|
+
visibility: ColumnVisibilityState;
|
|
272
|
+
toggleColumn: (columnId: string) => void;
|
|
273
|
+
showColumn: (columnId: string) => void;
|
|
274
|
+
hideColumn: (columnId: string) => void;
|
|
275
|
+
isColumnVisible: (columnId: string) => boolean;
|
|
276
|
+
showAllColumns: () => void;
|
|
277
|
+
hideAllColumns: () => void;
|
|
278
|
+
setVisibility: (visibility: ColumnVisibilityState) => void;
|
|
279
|
+
}
|
|
280
|
+
declare function ColumnVisibilityProvider({ children, defaultVisibility, }: {
|
|
281
|
+
children: React.ReactNode;
|
|
282
|
+
defaultVisibility?: ColumnVisibilityState;
|
|
283
|
+
}): react_jsx_runtime.JSX.Element;
|
|
284
|
+
declare function useColumnVisibility(): ColumnVisibilityContextType;
|
|
285
|
+
|
|
286
|
+
interface ColumnPinningContextType {
|
|
287
|
+
pinning: ColumnPinningState;
|
|
288
|
+
pinColumn: (columnId: string, side: 'left' | 'right') => void;
|
|
289
|
+
unpinColumn: (columnId: string) => void;
|
|
290
|
+
getColumnPin: (columnId: string) => ColumnPinPosition | undefined;
|
|
291
|
+
setPinning: (pinning: ColumnPinningState) => void;
|
|
292
|
+
}
|
|
293
|
+
declare function ColumnPinningProvider({ children, defaultPinning, }: {
|
|
294
|
+
children: React.ReactNode;
|
|
295
|
+
defaultPinning?: ColumnPinningState;
|
|
296
|
+
}): react_jsx_runtime.JSX.Element;
|
|
297
|
+
declare function useColumnPinning(): ColumnPinningContextType;
|
|
298
|
+
|
|
299
|
+
interface SearchFilterProps {
|
|
300
|
+
field: string;
|
|
301
|
+
label: string;
|
|
302
|
+
placeholder?: string;
|
|
303
|
+
minSearchLength?: number;
|
|
304
|
+
autoApply?: boolean;
|
|
305
|
+
allowCommaSeparated?: boolean;
|
|
306
|
+
onClose?: () => void;
|
|
307
|
+
}
|
|
308
|
+
declare function SearchFilter({ field, label, placeholder, minSearchLength, autoApply, allowCommaSeparated, onClose, }: SearchFilterProps): react_jsx_runtime.JSX.Element;
|
|
309
|
+
|
|
310
|
+
interface DateFilterProps {
|
|
311
|
+
field: string;
|
|
312
|
+
label: string;
|
|
313
|
+
onClose?: () => void;
|
|
314
|
+
minDate?: string;
|
|
315
|
+
maxDate?: string;
|
|
316
|
+
}
|
|
317
|
+
declare function DateFilter({ field, onClose, minDate, maxDate, }: DateFilterProps): react_jsx_runtime.JSX.Element;
|
|
318
|
+
|
|
319
|
+
interface DateRangeFilterProps {
|
|
320
|
+
field: string;
|
|
321
|
+
label: string;
|
|
322
|
+
onClose?: () => void;
|
|
323
|
+
showReset?: boolean;
|
|
324
|
+
minDate?: string;
|
|
325
|
+
maxDate?: string;
|
|
326
|
+
}
|
|
327
|
+
declare function DateRangeFilter({ field, onClose, showReset, minDate, maxDate, }: DateRangeFilterProps): react_jsx_runtime.JSX.Element;
|
|
328
|
+
|
|
329
|
+
interface SelectFilterProps {
|
|
330
|
+
field: string;
|
|
331
|
+
label: string;
|
|
332
|
+
options: FilterOption[];
|
|
333
|
+
placeholder?: string;
|
|
334
|
+
onClose?: () => void;
|
|
335
|
+
}
|
|
336
|
+
declare function SelectFilter({ field, options, placeholder, onClose, }: SelectFilterProps): react_jsx_runtime.JSX.Element;
|
|
337
|
+
|
|
338
|
+
interface MultiSelectFilterProps {
|
|
339
|
+
field: string;
|
|
340
|
+
label: string;
|
|
341
|
+
options: FilterOption[];
|
|
342
|
+
placeholder?: string;
|
|
343
|
+
searchPlaceholder?: string;
|
|
344
|
+
minSearchLength?: number;
|
|
345
|
+
onClose?: () => void;
|
|
346
|
+
onSearch?: (query: string) => Promise<FilterOption[]>;
|
|
347
|
+
/** Teks pencarian terakhir (dipulihkan oleh parent yang tidak ikut unmount saat popover ditutup) */
|
|
348
|
+
initialSearch?: string;
|
|
349
|
+
/** Dipanggil setiap kali teks pencarian berubah, supaya parent bisa mempertahankannya antar buka/tutup popover */
|
|
350
|
+
onSearchChange?: (value: string) => void;
|
|
351
|
+
}
|
|
352
|
+
declare function MultiSelectFilter({ field, options, placeholder, searchPlaceholder, minSearchLength, onClose, onSearch, initialSearch, onSearchChange, }: MultiSelectFilterProps): react_jsx_runtime.JSX.Element;
|
|
353
|
+
|
|
354
|
+
interface CheckboxFilterProps {
|
|
355
|
+
field: string;
|
|
356
|
+
label: string;
|
|
357
|
+
}
|
|
358
|
+
declare function CheckboxFilter({ field, label }: CheckboxFilterProps): react_jsx_runtime.JSX.Element;
|
|
359
|
+
|
|
360
|
+
interface RangeFilterProps {
|
|
361
|
+
field: string;
|
|
362
|
+
label: string;
|
|
363
|
+
min?: number;
|
|
364
|
+
max?: number;
|
|
365
|
+
step?: number;
|
|
366
|
+
}
|
|
367
|
+
declare function RangeFilter({ field, label, min, max, step, }: RangeFilterProps): react_jsx_runtime.JSX.Element;
|
|
368
|
+
|
|
369
|
+
interface FilterPanelProps {
|
|
370
|
+
columns: ColumnFilter[];
|
|
371
|
+
onClose?: () => void;
|
|
372
|
+
}
|
|
373
|
+
declare function FilterPanel({ columns, onClose }: FilterPanelProps): react_jsx_runtime.JSX.Element;
|
|
374
|
+
|
|
375
|
+
interface TraditionalPaginationProps {
|
|
376
|
+
pageSizeOptions?: number[];
|
|
377
|
+
}
|
|
378
|
+
declare function TraditionalPagination({ pageSizeOptions, }: TraditionalPaginationProps): react_jsx_runtime.JSX.Element;
|
|
379
|
+
|
|
380
|
+
interface InfiniteScrollPaginationProps {
|
|
381
|
+
isLoading?: boolean;
|
|
382
|
+
onLoadMore?: () => void;
|
|
383
|
+
}
|
|
384
|
+
declare function InfiniteScrollPagination({ isLoading, onLoadMore, }: InfiniteScrollPaginationProps): react_jsx_runtime.JSX.Element;
|
|
385
|
+
|
|
386
|
+
interface RowCheckboxProps {
|
|
387
|
+
rowId: string;
|
|
388
|
+
currentPageRowIds?: string[];
|
|
389
|
+
}
|
|
390
|
+
declare function RowCheckbox({ rowId, currentPageRowIds }: RowCheckboxProps): react_jsx_runtime.JSX.Element;
|
|
391
|
+
|
|
392
|
+
interface SelectAllCheckboxProps {
|
|
393
|
+
rowIds: string[];
|
|
394
|
+
totalCount?: number;
|
|
395
|
+
onSelectAllAttempt?: (count: number, confirm: () => void) => void;
|
|
396
|
+
}
|
|
397
|
+
declare function SelectAllCheckbox({ rowIds, totalCount, onSelectAllAttempt }: SelectAllCheckboxProps): react_jsx_runtime.JSX.Element;
|
|
398
|
+
|
|
399
|
+
interface ExpandableRowProps {
|
|
400
|
+
rowId: string;
|
|
401
|
+
}
|
|
402
|
+
declare function ExpandableRow({ rowId }: ExpandableRowProps): react_jsx_runtime.JSX.Element;
|
|
403
|
+
|
|
404
|
+
interface SelectionSummaryProps {
|
|
405
|
+
onAction?: (selectedIds: string[]) => void;
|
|
406
|
+
actionLabel?: string;
|
|
407
|
+
}
|
|
408
|
+
declare function SelectionSummary({ onAction, actionLabel, }: SelectionSummaryProps): react_jsx_runtime.JSX.Element;
|
|
409
|
+
|
|
410
|
+
interface ColumnPinMenuProps {
|
|
411
|
+
pin: ColumnPinPosition;
|
|
412
|
+
onPin: (side: 'left' | 'right') => void;
|
|
413
|
+
onUnpin: () => void;
|
|
414
|
+
}
|
|
415
|
+
declare function ColumnPinMenu({ pin, onPin, onUnpin }: ColumnPinMenuProps): react_jsx_runtime.JSX.Element;
|
|
416
|
+
|
|
417
|
+
interface ColumnVisibilityPanelProps {
|
|
418
|
+
columns: DataTableColumn<any>[];
|
|
419
|
+
}
|
|
420
|
+
declare function ColumnVisibilityPanel({ columns }: ColumnVisibilityPanelProps): react_jsx_runtime.JSX.Element;
|
|
421
|
+
|
|
422
|
+
interface ColumnHeaderFilterProps {
|
|
423
|
+
filterConfig: ColumnFilter | ColumnFilter[];
|
|
424
|
+
}
|
|
425
|
+
declare function ColumnHeaderFilter({ filterConfig, }: ColumnHeaderFilterProps): react_jsx_runtime.JSX.Element;
|
|
426
|
+
|
|
427
|
+
interface DateTreeFilterProps {
|
|
428
|
+
field: string;
|
|
429
|
+
label: string;
|
|
430
|
+
options: FilterOption[];
|
|
431
|
+
onClose?: () => void;
|
|
432
|
+
}
|
|
433
|
+
declare function DateTreeFilter({ field, options, onClose }: DateTreeFilterProps): react_jsx_runtime.JSX.Element;
|
|
434
|
+
|
|
435
|
+
interface QueryParams {
|
|
436
|
+
pageIndex: number;
|
|
437
|
+
pageSize: number;
|
|
438
|
+
sortBy?: string;
|
|
439
|
+
sortOrder?: 'asc' | 'desc';
|
|
440
|
+
search?: string;
|
|
441
|
+
searchFields?: string[];
|
|
442
|
+
[key: string]: any;
|
|
443
|
+
}
|
|
444
|
+
interface SearchQuery {
|
|
445
|
+
query: string;
|
|
446
|
+
fields: string[];
|
|
447
|
+
}
|
|
448
|
+
/**
|
|
449
|
+
* Build query parameters untuk API request
|
|
450
|
+
*/
|
|
451
|
+
declare function buildQueryParams(pageIndex: number, pageSize: number, filters: FilterValue[], sort: SortState, additionalParams?: Record<string, any>, search?: SearchQuery): QueryParams;
|
|
452
|
+
/**
|
|
453
|
+
* Convert query params to URL search params
|
|
454
|
+
*/
|
|
455
|
+
declare function paramsToURLSearchParams(params: QueryParams): URLSearchParams;
|
|
456
|
+
/**
|
|
457
|
+
* Build URL dengan query parameters
|
|
458
|
+
*/
|
|
459
|
+
declare function buildURL(baseURL: string, params: QueryParams): string;
|
|
460
|
+
|
|
461
|
+
declare function parseDateValue(value: unknown): Date | null;
|
|
462
|
+
declare function formatDateKey(value: unknown): string | null;
|
|
463
|
+
/**
|
|
464
|
+
* Validate if a filter value is valid
|
|
465
|
+
*/
|
|
466
|
+
declare function isValidFilterValue(filter: FilterValue): boolean;
|
|
467
|
+
/**
|
|
468
|
+
* Apply filters to data (client-side filtering)
|
|
469
|
+
*/
|
|
470
|
+
declare function applyFilters<T extends Record<string, any>>(data: T[], filters: FilterValue[]): T[];
|
|
471
|
+
/**
|
|
472
|
+
* Group filters by field for display purposes
|
|
473
|
+
*/
|
|
474
|
+
declare function groupFiltersByField(filters: FilterValue[]): Record<string, FilterValue[]>;
|
|
475
|
+
/**
|
|
476
|
+
* Remove filter by field and optionally by specific value
|
|
477
|
+
*/
|
|
478
|
+
declare function removeFilter(filters: FilterValue[], fieldToRemove: string, valueToRemove?: any): FilterValue[];
|
|
479
|
+
/**
|
|
480
|
+
* Clear all filters for specific field
|
|
481
|
+
*/
|
|
482
|
+
declare function clearFieldFilters(filters: FilterValue[], fieldsToClear: string[]): FilterValue[];
|
|
483
|
+
/**
|
|
484
|
+
* Check if any filters are active
|
|
485
|
+
*/
|
|
486
|
+
declare function hasActiveFilters(filters: FilterValue[]): boolean;
|
|
487
|
+
|
|
488
|
+
/** i18next namespace used by every `useTranslation` call in this package. */
|
|
489
|
+
declare const DATATABLE_NS = "datatable";
|
|
490
|
+
/** Default English strings for the `datatable` namespace. */
|
|
491
|
+
declare const datatableEn: {
|
|
492
|
+
copy: string;
|
|
493
|
+
copied: string;
|
|
494
|
+
copyFailed: string;
|
|
495
|
+
copyTooltip: string;
|
|
496
|
+
search: string;
|
|
497
|
+
loadFailed: string;
|
|
498
|
+
pagination: {
|
|
499
|
+
previous: string;
|
|
500
|
+
next: string;
|
|
501
|
+
page: string;
|
|
502
|
+
of: string;
|
|
503
|
+
showing: string;
|
|
504
|
+
to: string;
|
|
505
|
+
from: string;
|
|
506
|
+
results: string;
|
|
507
|
+
rows: string;
|
|
508
|
+
rowsPerPage: string;
|
|
509
|
+
};
|
|
510
|
+
filters: {
|
|
511
|
+
dateTree: {
|
|
512
|
+
inputPlaceholder: string;
|
|
513
|
+
dataNotFound: string;
|
|
514
|
+
notFound: string;
|
|
515
|
+
};
|
|
516
|
+
multiSelect: {
|
|
517
|
+
selectAll: string;
|
|
518
|
+
unselectAll: string;
|
|
519
|
+
searchPlaceholder: string;
|
|
520
|
+
result: string;
|
|
521
|
+
showing: string;
|
|
522
|
+
dataNotFound: string;
|
|
523
|
+
selected: string;
|
|
524
|
+
};
|
|
525
|
+
select: {
|
|
526
|
+
selectAll: string;
|
|
527
|
+
unselectAll: string;
|
|
528
|
+
searchPlaceholder: string;
|
|
529
|
+
dataNotFound: string;
|
|
530
|
+
};
|
|
531
|
+
};
|
|
532
|
+
columnPin: {
|
|
533
|
+
pinLeft: string;
|
|
534
|
+
pinRight: string;
|
|
535
|
+
unpin: string;
|
|
536
|
+
pinned: string;
|
|
537
|
+
pinning: string;
|
|
538
|
+
unpinning: string;
|
|
539
|
+
};
|
|
540
|
+
column: string;
|
|
541
|
+
showColumns: string;
|
|
542
|
+
of: string;
|
|
543
|
+
column_plural: string;
|
|
544
|
+
totalSelected: string;
|
|
545
|
+
clearSelections: string;
|
|
546
|
+
selectDateRange: string;
|
|
547
|
+
};
|
|
548
|
+
|
|
549
|
+
export { CheckboxFilter, ColumnHeaderFilter, ColumnPinMenu, ColumnPinningProvider, ColumnVisibilityPanel, ColumnVisibilityProvider, DATATABLE_NS, DataTable, DataTableProvider, DateFilter, DateRangeFilter, DateTreeFilter, ExpandableRow, FilterPanel, FilterProvider, InfiniteScrollPagination, MultiSelectFilter, PaginationProvider, RangeFilter, RowCheckbox, SearchFilter, SelectAllCheckbox, SelectFilter, SelectionProvider, SelectionSummary, SortProvider, TraditionalPagination, applyFilters, buildQueryParams, buildURL, clearFieldFilters, datatableEn, formatDateKey, groupFiltersByField, hasActiveFilters, isValidFilterValue, paramsToURLSearchParams, parseDateValue, removeFilter, useColumnPinning, useColumnVisibility, useFilters, usePagination, useSelection, useSort };
|
|
550
|
+
export type { ColumnFilter, ColumnVisibilityState, DataTableColumn, DataTableProps, DataTableState$1 as DataTableQueryState, DataTableResponse, DataTableState, ExpandedRowState, FilterOperator, FilterOption, FilterType, FilterValue, PaginationMeta, RowSelectionState, SortOrder, SortState };
|