@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.js
CHANGED
|
@@ -31737,10 +31737,14 @@ function DataTableFilterOptions({ children, ...props }) {
|
|
|
31737
31737
|
const { table, filteredColumns, addFilterColumn } = useTable();
|
|
31738
31738
|
const availableColumns = table
|
|
31739
31739
|
.getAllColumns()
|
|
31740
|
-
.filter((column) => typeof column.accessorFn !== "undefined" &&
|
|
31740
|
+
.filter((column) => typeof column.accessorFn !== "undefined" &&
|
|
31741
|
+
column.getCanHide() &&
|
|
31742
|
+
column.getCanFilter())
|
|
31741
31743
|
.filter((column) => !filteredColumns.includes(column.id));
|
|
31742
31744
|
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) => {
|
|
31743
|
-
|
|
31745
|
+
const columnHeader = column?.columnDef?.header;
|
|
31746
|
+
const columnName = (typeof columnHeader === "string" && columnHeader) || column.id;
|
|
31747
|
+
return (jsxRuntimeExports$1.jsx(DropdownMenu.Item, { onSelect: () => addFilterColumn(column.id), children: columnName }, column.id));
|
|
31744
31748
|
})] })) : null] }));
|
|
31745
31749
|
}
|
|
31746
31750
|
|
|
@@ -32011,7 +32015,9 @@ function DataTableFilterChips(props) {
|
|
|
32011
32015
|
const { filteredColumns, table, updateColumnCustomFilter } = useTable();
|
|
32012
32016
|
const tableColumns = table
|
|
32013
32017
|
.getAllColumns()
|
|
32014
|
-
.filter((column) => typeof column.accessorFn !== "undefined" &&
|
|
32018
|
+
.filter((column) => typeof column.accessorFn !== "undefined" &&
|
|
32019
|
+
column.getCanHide() &&
|
|
32020
|
+
column.getCanFilter());
|
|
32015
32021
|
if (!filteredColumns.length)
|
|
32016
32022
|
return null;
|
|
32017
32023
|
return (jsxRuntimeExports$1.jsxs(Flex, { gap: "small", align: "center", className: styles$4.chipWrapper, ...props, children: [filteredColumns.map((filter, index) => {
|
|
@@ -32201,7 +32207,7 @@ function Skeleton({ count = 1, wrapper: Wrapper, className: customClassName, con
|
|
|
32201
32207
|
: elements));
|
|
32202
32208
|
}
|
|
32203
32209
|
|
|
32204
|
-
function DataTableRoot({ columns, data, emptyState, children, parentStyle, isLoading = false, ShouldShowHeader = true, ...props }) {
|
|
32210
|
+
function DataTableRoot({ columns, data, emptyState, children, parentStyle, isLoading = false, ShouldShowHeader = true, loaderRow = 5, ...props }) {
|
|
32205
32211
|
const [tableCustomFilter, setTableCustomFilter] = React__default.useState({});
|
|
32206
32212
|
const convertedChildren = Children.toArray(children);
|
|
32207
32213
|
const header = convertedChildren.find((child) => child.type === DataTableToolbar) || null;
|
|
@@ -32210,6 +32216,9 @@ function DataTableRoot({ columns, data, emptyState, children, parentStyle, isLoa
|
|
|
32210
32216
|
null;
|
|
32211
32217
|
const [sorting, setSorting] = React__default.useState([]);
|
|
32212
32218
|
const [columnFilters, setColumnFilters] = React__default.useState([]);
|
|
32219
|
+
const tableData = isLoading
|
|
32220
|
+
? [...new Array(loaderRow)].map((_, i) => ({ id: i }))
|
|
32221
|
+
: data;
|
|
32213
32222
|
const [columnVisibility, setColumnVisibility] = React__default.useState({});
|
|
32214
32223
|
const [rowSelection, setRowSelection] = React__default.useState({});
|
|
32215
32224
|
const [globalFilter, setGlobalFilter] = React__default.useState("");
|
|
@@ -32229,7 +32238,7 @@ function DataTableRoot({ columns, data, emptyState, children, parentStyle, isLoa
|
|
|
32229
32238
|
setTableCustomFilter((old) => ({ ...old, [id]: filterFn }));
|
|
32230
32239
|
};
|
|
32231
32240
|
const table = useReactTable({
|
|
32232
|
-
data,
|
|
32241
|
+
data: tableData,
|
|
32233
32242
|
columns: columnWithCustomFilter,
|
|
32234
32243
|
globalFilterFn: "auto",
|
|
32235
32244
|
enableRowSelection: true,
|