@raystack/apsara 0.16.1 → 0.16.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 +9 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.css +1 -1
- package/dist/index.js +9 -3
- package/dist/index.js.map +1 -1
- package/dist/table/TableContext.d.ts +1 -0
- package/dist/table/TableContext.d.ts.map +1 -1
- package/dist/table/datatable.d.ts +3 -2
- package/dist/table/datatable.d.ts.map +1 -1
- package/dist/table/hooks/useTable.d.ts +1 -0
- package/dist/table/hooks/useTable.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -31725,14 +31725,14 @@ function DataTableClearFilter({ children, ...props }) {
|
|
|
31725
31725
|
}
|
|
31726
31726
|
|
|
31727
31727
|
function DataTableFilterOptions({ children, ...props }) {
|
|
31728
|
-
const { table, filteredColumns, addFilterColumn } = useTable();
|
|
31728
|
+
const { table, filteredColumns, addFilterColumn, isLoading } = useTable();
|
|
31729
31729
|
const availableColumns = table
|
|
31730
31730
|
.getAllColumns()
|
|
31731
31731
|
.filter((column) => typeof column.accessorFn !== "undefined" &&
|
|
31732
31732
|
column.getCanHide() &&
|
|
31733
31733
|
column.getCanFilter())
|
|
31734
31734
|
.filter((column) => !filteredColumns.includes(column.id));
|
|
31735
|
-
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) => {
|
|
31735
|
+
return (jsxRuntimeExports$1.jsxs(DropdownMenu, { children: [jsxRuntimeExports$1.jsx(DropdownMenu.Trigger, { asChild: true, disabled: isLoading, 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) => {
|
|
31736
31736
|
const columnHeader = column?.columnDef?.header;
|
|
31737
31737
|
const columnName = (typeof columnHeader === "string" && columnHeader) || column.id;
|
|
31738
31738
|
return (jsxRuntimeExports$1.jsx(DropdownMenu.Item, { onSelect: () => addFilterColumn(column.id), children: columnName }, column.id));
|
|
@@ -32197,7 +32197,7 @@ function Skeleton({ count = 1, wrapper: Wrapper, className: customClassName, con
|
|
|
32197
32197
|
: elements));
|
|
32198
32198
|
}
|
|
32199
32199
|
|
|
32200
|
-
function DataTableRoot({ columns, data, emptyState, children, parentStyle, isLoading = false, ShouldShowHeader = true, initialState, loaderRow = 5, onRowClick, ...props }) {
|
|
32200
|
+
function DataTableRoot({ columns, data, emptyState, children, parentStyle, isLoading = false, ShouldShowHeader = true, initialState, loaderRow = 5, onRowClick, onStateChange = () => { }, ...props }) {
|
|
32201
32201
|
const [tableCustomFilter, setTableCustomFilter] = React.useState({});
|
|
32202
32202
|
const convertedChildren = React.Children.toArray(children);
|
|
32203
32203
|
const header = convertedChildren.find((child) => child.type === DataTableToolbar) || null;
|
|
@@ -32220,6 +32220,11 @@ function DataTableRoot({ columns, data, emptyState, children, parentStyle, isLoa
|
|
|
32220
32220
|
: col.cell;
|
|
32221
32221
|
return col;
|
|
32222
32222
|
});
|
|
32223
|
+
React.useEffect(() => {
|
|
32224
|
+
if (onStateChange) {
|
|
32225
|
+
onStateChange(tableState);
|
|
32226
|
+
}
|
|
32227
|
+
}, [tableState]);
|
|
32223
32228
|
const updateColumnCustomFilter = (id, filterFn) => {
|
|
32224
32229
|
setTableCustomFilter((old) => ({ ...old, [id]: filterFn }));
|
|
32225
32230
|
};
|
|
@@ -32257,6 +32262,7 @@ function DataTableRoot({ columns, data, emptyState, children, parentStyle, isLoa
|
|
|
32257
32262
|
onChange: () => ({}),
|
|
32258
32263
|
tableCustomFilter,
|
|
32259
32264
|
updateColumnCustomFilter,
|
|
32265
|
+
isLoading,
|
|
32260
32266
|
}, children: [jsxRuntimeExports$1.jsxs(Flex, { direction: "column", className: styles$4.datatable, children: [header, jsxRuntimeExports$1.jsxs(Flex, { className: styles$4.tableContainer, style: parentStyle, children: [jsxRuntimeExports$1.jsxs(Table, { ...props, style: tableStyle, children: [jsxRuntimeExports$1.jsx(Table.Header, { children: ShouldShowHeader
|
|
32261
32267
|
? table.getHeaderGroups().map((headerGroup) => (jsxRuntimeExports$1.jsx(Table.Row, { children: headerGroup.headers.map((header, index) => {
|
|
32262
32268
|
return (jsxRuntimeExports$1.jsx(Table.Head, { style: {
|