@raystack/apsara 0.14.1 → 0.14.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.cjs +14 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +14 -5
- package/dist/index.js.map +1 -1
- package/dist/table/DataTableFilterChips.d.ts.map +1 -1
- package/dist/table/DataTableFilterOptions.d.ts.map +1 -1
- package/dist/table/datatable.d.ts +2 -1
- package/dist/table/datatable.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -31757,10 +31757,14 @@ function DataTableFilterOptions({ children, ...props }) {
|
|
|
31757
31757
|
const { table, filteredColumns, addFilterColumn } = useTable();
|
|
31758
31758
|
const availableColumns = table
|
|
31759
31759
|
.getAllColumns()
|
|
31760
|
-
.filter((column) => typeof column.accessorFn !== "undefined" &&
|
|
31760
|
+
.filter((column) => typeof column.accessorFn !== "undefined" &&
|
|
31761
|
+
column.getCanHide() &&
|
|
31762
|
+
column.getCanFilter())
|
|
31761
31763
|
.filter((column) => !filteredColumns.includes(column.id));
|
|
31762
31764
|
return (jsxRuntimeExports$1.jsxs(DropdownMenu, { children: [jsxRuntimeExports$1.jsx(DropdownMenu.Trigger, { asChild: true, children: jsxRuntimeExports$1.jsx(Button$1, { variant: "ghost", ...props, children: children || (jsxRuntimeExports$1.jsxs(Flex, { gap: "small", align: "center", justify: "center", children: [jsxRuntimeExports$1.jsx(PlusIcon, { width: 12, height: "12" }), " Filter"] })) }) }), availableColumns.length ? (jsxRuntimeExports$1.jsxs(DropdownMenu.Content, { align: "end", className: "w-[150px]", children: [jsxRuntimeExports$1.jsx(DropdownMenu.Label, { children: "Filter column" }), jsxRuntimeExports$1.jsx(DropdownMenu.Separator, {}), availableColumns.map((column) => {
|
|
31763
|
-
|
|
31765
|
+
const columnHeader = column?.columnDef?.header;
|
|
31766
|
+
const columnName = (typeof columnHeader === "string" && columnHeader) || column.id;
|
|
31767
|
+
return (jsxRuntimeExports$1.jsx(DropdownMenu.Item, { onSelect: () => addFilterColumn(column.id), children: columnName }, column.id));
|
|
31764
31768
|
})] })) : null] }));
|
|
31765
31769
|
}
|
|
31766
31770
|
|
|
@@ -32031,7 +32035,9 @@ function DataTableFilterChips(props) {
|
|
|
32031
32035
|
const { filteredColumns, table, updateColumnCustomFilter } = useTable();
|
|
32032
32036
|
const tableColumns = table
|
|
32033
32037
|
.getAllColumns()
|
|
32034
|
-
.filter((column) => typeof column.accessorFn !== "undefined" &&
|
|
32038
|
+
.filter((column) => typeof column.accessorFn !== "undefined" &&
|
|
32039
|
+
column.getCanHide() &&
|
|
32040
|
+
column.getCanFilter());
|
|
32035
32041
|
if (!filteredColumns.length)
|
|
32036
32042
|
return null;
|
|
32037
32043
|
return (jsxRuntimeExports$1.jsxs(Flex, { gap: "small", align: "center", className: styles$4.chipWrapper, ...props, children: [filteredColumns.map((filter, index) => {
|
|
@@ -32221,7 +32227,7 @@ function Skeleton({ count = 1, wrapper: Wrapper, className: customClassName, con
|
|
|
32221
32227
|
: elements));
|
|
32222
32228
|
}
|
|
32223
32229
|
|
|
32224
|
-
function DataTableRoot({ columns, data, emptyState, children, parentStyle, isLoading = false, ShouldShowHeader = true, ...props }) {
|
|
32230
|
+
function DataTableRoot({ columns, data, emptyState, children, parentStyle, isLoading = false, ShouldShowHeader = true, loaderRow = 5, ...props }) {
|
|
32225
32231
|
const [tableCustomFilter, setTableCustomFilter] = React.useState({});
|
|
32226
32232
|
const convertedChildren = React.Children.toArray(children);
|
|
32227
32233
|
const header = convertedChildren.find((child) => child.type === DataTableToolbar) || null;
|
|
@@ -32230,6 +32236,9 @@ function DataTableRoot({ columns, data, emptyState, children, parentStyle, isLoa
|
|
|
32230
32236
|
null;
|
|
32231
32237
|
const [sorting, setSorting] = React.useState([]);
|
|
32232
32238
|
const [columnFilters, setColumnFilters] = React.useState([]);
|
|
32239
|
+
const tableData = isLoading
|
|
32240
|
+
? [...new Array(loaderRow)].map((_, i) => ({ id: i }))
|
|
32241
|
+
: data;
|
|
32233
32242
|
const [columnVisibility, setColumnVisibility] = React.useState({});
|
|
32234
32243
|
const [rowSelection, setRowSelection] = React.useState({});
|
|
32235
32244
|
const [globalFilter, setGlobalFilter] = React.useState("");
|
|
@@ -32249,7 +32258,7 @@ function DataTableRoot({ columns, data, emptyState, children, parentStyle, isLoa
|
|
|
32249
32258
|
setTableCustomFilter((old) => ({ ...old, [id]: filterFn }));
|
|
32250
32259
|
};
|
|
32251
32260
|
const table = useReactTable({
|
|
32252
|
-
data,
|
|
32261
|
+
data: tableData,
|
|
32253
32262
|
columns: columnWithCustomFilter,
|
|
32254
32263
|
globalFilterFn: "auto",
|
|
32255
32264
|
enableRowSelection: true,
|