@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.css
CHANGED
package/dist/index.js
CHANGED
|
@@ -31705,14 +31705,14 @@ function DataTableClearFilter({ children, ...props }) {
|
|
|
31705
31705
|
}
|
|
31706
31706
|
|
|
31707
31707
|
function DataTableFilterOptions({ children, ...props }) {
|
|
31708
|
-
const { table, filteredColumns, addFilterColumn } = useTable();
|
|
31708
|
+
const { table, filteredColumns, addFilterColumn, isLoading } = useTable();
|
|
31709
31709
|
const availableColumns = table
|
|
31710
31710
|
.getAllColumns()
|
|
31711
31711
|
.filter((column) => typeof column.accessorFn !== "undefined" &&
|
|
31712
31712
|
column.getCanHide() &&
|
|
31713
31713
|
column.getCanFilter())
|
|
31714
31714
|
.filter((column) => !filteredColumns.includes(column.id));
|
|
31715
|
-
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) => {
|
|
31715
|
+
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) => {
|
|
31716
31716
|
const columnHeader = column?.columnDef?.header;
|
|
31717
31717
|
const columnName = (typeof columnHeader === "string" && columnHeader) || column.id;
|
|
31718
31718
|
return (jsxRuntimeExports$1.jsx(DropdownMenu.Item, { onSelect: () => addFilterColumn(column.id), children: columnName }, column.id));
|
|
@@ -32177,7 +32177,7 @@ function Skeleton({ count = 1, wrapper: Wrapper, className: customClassName, con
|
|
|
32177
32177
|
: elements));
|
|
32178
32178
|
}
|
|
32179
32179
|
|
|
32180
|
-
function DataTableRoot({ columns, data, emptyState, children, parentStyle, isLoading = false, ShouldShowHeader = true, initialState, loaderRow = 5, onRowClick, ...props }) {
|
|
32180
|
+
function DataTableRoot({ columns, data, emptyState, children, parentStyle, isLoading = false, ShouldShowHeader = true, initialState, loaderRow = 5, onRowClick, onStateChange = () => { }, ...props }) {
|
|
32181
32181
|
const [tableCustomFilter, setTableCustomFilter] = useState({});
|
|
32182
32182
|
const convertedChildren = Children.toArray(children);
|
|
32183
32183
|
const header = convertedChildren.find((child) => child.type === DataTableToolbar) || null;
|
|
@@ -32200,6 +32200,11 @@ function DataTableRoot({ columns, data, emptyState, children, parentStyle, isLoa
|
|
|
32200
32200
|
: col.cell;
|
|
32201
32201
|
return col;
|
|
32202
32202
|
});
|
|
32203
|
+
useEffect(() => {
|
|
32204
|
+
if (onStateChange) {
|
|
32205
|
+
onStateChange(tableState);
|
|
32206
|
+
}
|
|
32207
|
+
}, [tableState]);
|
|
32203
32208
|
const updateColumnCustomFilter = (id, filterFn) => {
|
|
32204
32209
|
setTableCustomFilter((old) => ({ ...old, [id]: filterFn }));
|
|
32205
32210
|
};
|
|
@@ -32237,6 +32242,7 @@ function DataTableRoot({ columns, data, emptyState, children, parentStyle, isLoa
|
|
|
32237
32242
|
onChange: () => ({}),
|
|
32238
32243
|
tableCustomFilter,
|
|
32239
32244
|
updateColumnCustomFilter,
|
|
32245
|
+
isLoading,
|
|
32240
32246
|
}, 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
|
|
32241
32247
|
? table.getHeaderGroups().map((headerGroup) => (jsxRuntimeExports$1.jsx(Table.Row, { children: headerGroup.headers.map((header, index) => {
|
|
32242
32248
|
return (jsxRuntimeExports$1.jsx(Table.Head, { style: {
|