erp-pos-ecommerce-shared 0.1.3 → 0.1.5
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/components.d.ts +97 -20
- package/dist/components.js +313 -203
- package/dist/components.js.map +1 -1
- package/dist/{datatable.interface-DFSQWdXd.d.ts → datatable.interface-DbB5oxj-.d.ts} +21 -1
- package/dist/hooks.d.ts +16 -2
- package/dist/hooks.js +43 -1
- package/dist/hooks.js.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.js +357 -205
- package/dist/index.js.map +1 -1
- package/dist/interfaces.d.ts +1 -1
- package/dist/interfaces.js.map +1 -1
- package/package.json +1 -1
- package/dist/components.css +0 -11
- package/dist/components.css.map +0 -1
- package/dist/index.css +0 -11
- package/dist/index.css.map +0 -1
package/dist/components.d.ts
CHANGED
|
@@ -5,8 +5,8 @@ import { UseMutationResult, UseQueryOptions } from '@tanstack/react-query';
|
|
|
5
5
|
import { s as TblProductsImage, o as ITableFilterConfig, g as IFilterSelectOption } from './filters.interface-Cx-AXMPz.js';
|
|
6
6
|
import * as z from 'zod';
|
|
7
7
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
8
|
-
import { ColumnDef,
|
|
9
|
-
import { D as DataTableConfig, S as ServerTableState } from './datatable.interface-
|
|
8
|
+
import { ColumnDef, useReactTable, Row } from '@tanstack/react-table';
|
|
9
|
+
import { D as DataTableConfig, S as ServerTableState, T as TableHeaderStyle } from './datatable.interface-DbB5oxj-.js';
|
|
10
10
|
import { T as TableQueryParams } from './types-CiX8AkJA.js';
|
|
11
11
|
|
|
12
12
|
interface CreateEditFormProps<T> {
|
|
@@ -142,8 +142,8 @@ interface DataTableProps$1<TData> {
|
|
|
142
142
|
enableRowCheck?: boolean;
|
|
143
143
|
/** Called when row selection changes */
|
|
144
144
|
onSelectionChange?: (selectedRows: TData[]) => void;
|
|
145
|
-
/** Header
|
|
146
|
-
headerBgColor?: string;
|
|
145
|
+
/** Header style: color string (legacy) or { bgColor, textColor, fontWeight?, fontSize?, padding? } */
|
|
146
|
+
headerBgColor?: string | TableHeaderStyle;
|
|
147
147
|
/** Column actions to display per row */
|
|
148
148
|
columnActions?: (row: TData) => React.ReactNode;
|
|
149
149
|
/** List menu actions to display per row */
|
|
@@ -152,8 +152,18 @@ interface DataTableProps$1<TData> {
|
|
|
152
152
|
onClick: () => void;
|
|
153
153
|
Icon?: React.ElementType;
|
|
154
154
|
}[];
|
|
155
|
+
/** Called when a row is clicked */
|
|
156
|
+
onRowClick?: (row: TData) => void;
|
|
157
|
+
/** Called when a row is hovered */
|
|
158
|
+
onRowHover?: (row: TData) => void;
|
|
159
|
+
/** Empty state to display when no data is available */
|
|
160
|
+
emptyState?: React.ReactNode;
|
|
161
|
+
/** Table instance */
|
|
162
|
+
table?: ReturnType<typeof useReactTable<TData>>;
|
|
163
|
+
/** Custom Header component */
|
|
164
|
+
CustomHeader?: React.ReactNode;
|
|
155
165
|
}
|
|
156
|
-
declare const DataTable: <TData>({ data, columns, config, filters, totalRowCount, onStateChange, loading, enableRowCheck: canCheck, onSelectionChange, headerBgColor, columnActions, listMenuActions, }: DataTableProps$1<TData>) => react_jsx_runtime.JSX.Element;
|
|
166
|
+
declare const DataTable: <TData>({ data, columns, config, filters, totalRowCount, onStateChange, loading, enableRowCheck: canCheck, onSelectionChange, headerBgColor, columnActions, listMenuActions, onRowClick, onRowHover, emptyState, table: ExternalTable, CustomHeader, }: DataTableProps$1<TData>) => react_jsx_runtime.JSX.Element;
|
|
157
167
|
|
|
158
168
|
interface EmptyStateProps {
|
|
159
169
|
title?: string;
|
|
@@ -240,26 +250,32 @@ interface DataTableProps<TData> {
|
|
|
240
250
|
onClick: () => void;
|
|
241
251
|
Icon?: React$1.ElementType;
|
|
242
252
|
}[];
|
|
243
|
-
/** Header
|
|
244
|
-
headerBgColor?: string;
|
|
253
|
+
/** Header style: color string (legacy) or { bgColor, textColor, fontWeight?, fontSize?, padding? } */
|
|
254
|
+
headerBgColor?: string | TableHeaderStyle;
|
|
255
|
+
/** Whether the table is loading (shows skeleton rows instead of data) */
|
|
256
|
+
loading?: boolean;
|
|
257
|
+
/** Number of skeleton rows to show when loading */
|
|
258
|
+
skeletonRowCount?: number;
|
|
259
|
+
/** Called when a row is clicked */
|
|
260
|
+
onRowClick?: (row: TData) => void;
|
|
261
|
+
/** Called when a row is hovered */
|
|
262
|
+
onRowHover?: (row: TData) => void;
|
|
263
|
+
/** Empty state to display when no data is available */
|
|
264
|
+
emptyState?: React$1.ReactNode;
|
|
245
265
|
}
|
|
246
|
-
declare const SimpleDataTable: <TData>({ table, withBorder, borderRadius, SortIcon, SortIconAsc, SortIconDesc,
|
|
266
|
+
declare const SimpleDataTable: <TData>({ table, withBorder, borderRadius, SortIcon, SortIconAsc, SortIconDesc, canCheck, columnActions, listMenuActions, headerBgColor, loading, skeletonRowCount, onRowClick, onRowHover, emptyState, }: DataTableProps<TData>) => react_jsx_runtime.JSX.Element;
|
|
247
267
|
|
|
248
268
|
interface TableSkeletonProps {
|
|
249
269
|
/** Number of skeleton rows to show */
|
|
250
|
-
|
|
251
|
-
/** Number of columns (excluding checkbox
|
|
252
|
-
|
|
253
|
-
/** Whether to show
|
|
270
|
+
rowCount: number;
|
|
271
|
+
/** Number of data columns (excluding checkbox and actions) */
|
|
272
|
+
columnCount: number;
|
|
273
|
+
/** Whether to show the checkbox column */
|
|
254
274
|
canCheck?: boolean;
|
|
255
|
-
/** Whether to show the
|
|
256
|
-
|
|
257
|
-
/** Border radius */
|
|
258
|
-
borderRadius?: "xs" | "sm" | "md" | "lg" | "xl" | number;
|
|
259
|
-
/** Height of each skeleton row */
|
|
260
|
-
rowHeight?: number;
|
|
275
|
+
/** Whether to show the actions column */
|
|
276
|
+
hasActionsColumn?: boolean;
|
|
261
277
|
}
|
|
262
|
-
declare const TableSkeleton: ({
|
|
278
|
+
declare const TableSkeleton: ({ rowCount, columnCount, canCheck, hasActionsColumn, }: TableSkeletonProps) => react_jsx_runtime.JSX.Element;
|
|
263
279
|
|
|
264
280
|
/** Shape that the query must return for TablePage to work correctly. */
|
|
265
281
|
interface PaginatedResponse<TRow> {
|
|
@@ -272,10 +288,71 @@ interface TablePageProps<TRow> {
|
|
|
272
288
|
* the query options. Called every time the table state changes.
|
|
273
289
|
*/
|
|
274
290
|
getQueryOptions: (params: TableQueryParams) => UseQueryOptions<PaginatedResponse<TRow>>;
|
|
291
|
+
/**
|
|
292
|
+
* Title of the table
|
|
293
|
+
*/
|
|
275
294
|
title: string;
|
|
295
|
+
/**
|
|
296
|
+
* Columns of the table
|
|
297
|
+
*/
|
|
276
298
|
columns: ColumnDef<TRow>[];
|
|
299
|
+
/**
|
|
300
|
+
* Filters of the table
|
|
301
|
+
*/
|
|
277
302
|
filters?: ITableFilterConfig[];
|
|
303
|
+
/**
|
|
304
|
+
* Whether the table is loading externally
|
|
305
|
+
*/
|
|
306
|
+
isLoadingExternal?: boolean;
|
|
307
|
+
/**
|
|
308
|
+
* Called when a row is clicked
|
|
309
|
+
*/
|
|
310
|
+
onRowClick?: (row: TRow) => void;
|
|
311
|
+
/**
|
|
312
|
+
* Called when a row is hovered
|
|
313
|
+
*/
|
|
314
|
+
onRowHover?: (row: TRow) => void;
|
|
315
|
+
/**
|
|
316
|
+
* Empty state of the table
|
|
317
|
+
*/
|
|
318
|
+
emptyState?: React.ReactNode;
|
|
319
|
+
/**
|
|
320
|
+
* Table instance
|
|
321
|
+
*/
|
|
322
|
+
table?: ReturnType<typeof useReactTable<TRow>>;
|
|
323
|
+
/**
|
|
324
|
+
* Whether to enable row selection
|
|
325
|
+
*/
|
|
326
|
+
enableRowSelection?: boolean;
|
|
327
|
+
/**
|
|
328
|
+
* Header style: color string (legacy) or { bgColor, textColor, fontWeight?, fontSize?, padding? }
|
|
329
|
+
*/
|
|
330
|
+
headerBgColor?: TableHeaderStyle;
|
|
331
|
+
/**
|
|
332
|
+
* Column actions to display per row
|
|
333
|
+
*/
|
|
334
|
+
columnActions?: (row: TRow) => React.ReactNode;
|
|
335
|
+
/**
|
|
336
|
+
* List menu actions to display per row
|
|
337
|
+
*/
|
|
338
|
+
listMenuActions?: (row: TRow) => {
|
|
339
|
+
label: string;
|
|
340
|
+
onClick: () => void;
|
|
341
|
+
Icon?: React.ElementType;
|
|
342
|
+
}[];
|
|
343
|
+
/**
|
|
344
|
+
* Called when row selection changes
|
|
345
|
+
*/
|
|
346
|
+
onSelectionChange?: (selectedRows: TRow[]) => void;
|
|
347
|
+
/**
|
|
348
|
+
* Configuration for the table
|
|
349
|
+
*/
|
|
350
|
+
config?: Partial<DataTableConfig>;
|
|
351
|
+
/**
|
|
352
|
+
* Custom Header component
|
|
353
|
+
*/
|
|
354
|
+
CustomHeader?: React.ReactNode;
|
|
278
355
|
}
|
|
279
|
-
declare const TablePage: <TRow>({ getQueryOptions, title, columns, filters, }: TablePageProps<TRow>) => react_jsx_runtime.JSX.Element;
|
|
356
|
+
declare const TablePage: <TRow>({ getQueryOptions, title, columns, filters, isLoadingExternal, onRowClick, onRowHover, emptyState, table, enableRowSelection, headerBgColor, columnActions, listMenuActions, onSelectionChange, config, CustomHeader, }: TablePageProps<TRow>) => react_jsx_runtime.JSX.Element;
|
|
280
357
|
|
|
281
358
|
export { BottomPagination, CreateEditForm, DataTable, EmptyState, FilterDate, type FilterDateProps, FilterSelect, type FilterSelectProps, FormGenerator, type FormInstance, type FormValues, ImageForm, type PaginatedResponse, SearchInput, SimpleDataTable, TablePage, TableSkeleton, configureImageFormIcons, dateGteFilterFn, fieldGenerator, generateFormSchema };
|