@kreativa/ui 0.1.2 → 0.1.4
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.mts +5 -1
- package/dist/index.d.ts +5 -1
- package/dist/index.js +7 -3
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +13 -9
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -230,6 +230,10 @@ interface DataTableProps<T> {
|
|
|
230
230
|
initialSortDirection?: 'asc' | 'desc';
|
|
231
231
|
/** Called when filtered data changes (for external use, e.g., showing count) */
|
|
232
232
|
onFilteredDataChange?: (filteredData: T[]) => void;
|
|
233
|
+
/** Enable manual column resizing (default: false) */
|
|
234
|
+
resizable?: boolean;
|
|
235
|
+
/** Use fixed table layout for consistent column widths */
|
|
236
|
+
fixedLayout?: boolean;
|
|
233
237
|
}
|
|
234
238
|
/**
|
|
235
239
|
* DataTable component - an enhanced Table with built-in filtering and sorting.
|
|
@@ -266,7 +270,7 @@ interface DataTableProps<T> {
|
|
|
266
270
|
* <DataTable data={users} columns={columns} getRowKey={(u) => u.id} />
|
|
267
271
|
* ```
|
|
268
272
|
*/
|
|
269
|
-
declare function DataTable<T>({ data, columns, getRowKey, onRowClick, loading, emptyMessage, className, showFilters, initialSortKey, initialSortDirection, onFilteredDataChange, }: DataTableProps<T>): react_jsx_runtime.JSX.Element;
|
|
273
|
+
declare function DataTable<T>({ data, columns, getRowKey, onRowClick, loading, emptyMessage, className, showFilters, initialSortKey, initialSortDirection, onFilteredDataChange, resizable, fixedLayout, }: DataTableProps<T>): react_jsx_runtime.JSX.Element;
|
|
270
274
|
/**
|
|
271
275
|
* Create filter options from data array.
|
|
272
276
|
* Extracts unique values and creates option objects.
|
package/dist/index.d.ts
CHANGED
|
@@ -230,6 +230,10 @@ interface DataTableProps<T> {
|
|
|
230
230
|
initialSortDirection?: 'asc' | 'desc';
|
|
231
231
|
/** Called when filtered data changes (for external use, e.g., showing count) */
|
|
232
232
|
onFilteredDataChange?: (filteredData: T[]) => void;
|
|
233
|
+
/** Enable manual column resizing (default: false) */
|
|
234
|
+
resizable?: boolean;
|
|
235
|
+
/** Use fixed table layout for consistent column widths */
|
|
236
|
+
fixedLayout?: boolean;
|
|
233
237
|
}
|
|
234
238
|
/**
|
|
235
239
|
* DataTable component - an enhanced Table with built-in filtering and sorting.
|
|
@@ -266,7 +270,7 @@ interface DataTableProps<T> {
|
|
|
266
270
|
* <DataTable data={users} columns={columns} getRowKey={(u) => u.id} />
|
|
267
271
|
* ```
|
|
268
272
|
*/
|
|
269
|
-
declare function DataTable<T>({ data, columns, getRowKey, onRowClick, loading, emptyMessage, className, showFilters, initialSortKey, initialSortDirection, onFilteredDataChange, }: DataTableProps<T>): react_jsx_runtime.JSX.Element;
|
|
273
|
+
declare function DataTable<T>({ data, columns, getRowKey, onRowClick, loading, emptyMessage, className, showFilters, initialSortKey, initialSortDirection, onFilteredDataChange, resizable, fixedLayout, }: DataTableProps<T>): react_jsx_runtime.JSX.Element;
|
|
270
274
|
/**
|
|
271
275
|
* Create filter options from data array.
|
|
272
276
|
* Extracts unique values and creates option objects.
|
package/dist/index.js
CHANGED
|
@@ -761,7 +761,9 @@ function DataTable({
|
|
|
761
761
|
showFilters = true,
|
|
762
762
|
initialSortKey,
|
|
763
763
|
initialSortDirection = "asc",
|
|
764
|
-
onFilteredDataChange
|
|
764
|
+
onFilteredDataChange,
|
|
765
|
+
resizable = false,
|
|
766
|
+
fixedLayout = false
|
|
765
767
|
}) {
|
|
766
768
|
const [filters, setFilters] = (0, import_react7.useState)({});
|
|
767
769
|
const [sortKey, setSortKey] = (0, import_react7.useState)(initialSortKey || null);
|
|
@@ -834,7 +836,7 @@ function DataTable({
|
|
|
834
836
|
});
|
|
835
837
|
return sortDirection === "desc" ? sorted.reverse() : sorted;
|
|
836
838
|
}, [filteredData, sortKey, sortDirection, columns]);
|
|
837
|
-
(0, import_react7.
|
|
839
|
+
(0, import_react7.useEffect)(() => {
|
|
838
840
|
onFilteredDataChange?.(sortedData);
|
|
839
841
|
}, [sortedData, onFilteredDataChange]);
|
|
840
842
|
const handleSort = (0, import_react7.useCallback)((columnKey) => {
|
|
@@ -909,7 +911,9 @@ function DataTable({
|
|
|
909
911
|
getRowKey,
|
|
910
912
|
onRowClick,
|
|
911
913
|
loading,
|
|
912
|
-
emptyMessage
|
|
914
|
+
emptyMessage,
|
|
915
|
+
resizable,
|
|
916
|
+
fixedLayout
|
|
913
917
|
}
|
|
914
918
|
)
|
|
915
919
|
] });
|