@raystack/apsara 0.20.3 → 0.20.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.cjs +13 -6
- package/dist/index.cjs.map +1 -1
- package/dist/index.css +18 -0
- package/dist/index.js +13 -6
- package/dist/index.js.map +1 -1
- package/dist/table/datatable.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/index.css
CHANGED
|
@@ -53,6 +53,24 @@
|
|
|
53
53
|
--fs-500: 0.938rem;
|
|
54
54
|
--fs-600: 1rem;
|
|
55
55
|
|
|
56
|
+
--space-1: 2px;
|
|
57
|
+
--space-2: 4px;
|
|
58
|
+
--space-3: 8px;
|
|
59
|
+
--space-4: 12px;
|
|
60
|
+
--space-5: 16px;
|
|
61
|
+
--space-6: 20px;
|
|
62
|
+
--space-7: 24px;
|
|
63
|
+
--space-8: 28px;
|
|
64
|
+
--space-9: 32px;
|
|
65
|
+
--space-10: 40px;
|
|
66
|
+
--space-11: 48px;
|
|
67
|
+
--space-12: 56px;
|
|
68
|
+
--space-13: 64px;
|
|
69
|
+
--space-14: 72px;
|
|
70
|
+
--space-15: 80px;
|
|
71
|
+
--space-16: 96px;
|
|
72
|
+
--space-17: 120px;
|
|
73
|
+
|
|
56
74
|
--pd-2: 2px;
|
|
57
75
|
--pd-4: 4px;
|
|
58
76
|
--pd-6: 6px;
|
package/dist/index.js
CHANGED
|
@@ -32229,7 +32229,7 @@ function DataTableRoot({ columns, data, emptyState, children, parentStyle, isLoa
|
|
|
32229
32229
|
}, { threshold: 0.1 });
|
|
32230
32230
|
observerRef.current = observer;
|
|
32231
32231
|
return () => observer.disconnect();
|
|
32232
|
-
}, [onLoadMore]);
|
|
32232
|
+
}, [onLoadMore, isLoading]);
|
|
32233
32233
|
useEffect(() => {
|
|
32234
32234
|
const observer = observerRef.current;
|
|
32235
32235
|
const lastRow = lastRowRef.current;
|
|
@@ -32244,19 +32244,26 @@ function DataTableRoot({ columns, data, emptyState, children, parentStyle, isLoa
|
|
|
32244
32244
|
};
|
|
32245
32245
|
}, [isLoading]);
|
|
32246
32246
|
const getLoader = (loaderRow, columns) => ([...new Array(loaderRow)].map((_, rowIndex) => (jsxRuntimeExports.jsx(Table.Row, { children: columns.map((_, colIndex) => (jsxRuntimeExports.jsx(Table.Cell, { children: jsxRuntimeExports.jsx(Skeleton, { containerClassName: styles$4.flex1, highlightColor: "var(--background-base)", baseColor: "var(--background-base-hover)" }) }, `col_${colIndex}`))) }, `row_${rowIndex}`))));
|
|
32247
|
+
const tableData = onLoadMore ? data : (isLoading
|
|
32248
|
+
? [...new Array(loaderRow)].map((_, i) => ({ id: i }))
|
|
32249
|
+
: data);
|
|
32247
32250
|
const { filteredColumns, addFilterColumn, removeFilterColumn, resetColumns } = useTableColumn();
|
|
32248
32251
|
const columnWithCustomFilter = useMemo(() => columns.map((col) => {
|
|
32249
32252
|
const colId = col.id || col?.accessorKey;
|
|
32250
32253
|
const filterFn = colId && tableCustomFilter.hasOwnProperty(colId)
|
|
32251
32254
|
? tableCustomFilter[colId]
|
|
32252
32255
|
: undefined;
|
|
32253
|
-
const
|
|
32256
|
+
const cell = onLoadMore
|
|
32257
|
+
? col.cell
|
|
32258
|
+
: (isLoading
|
|
32259
|
+
? () => (jsxRuntimeExports.jsx(Skeleton, { containerClassName: styles$4.flex1, highlightColor: "var(--background-base)", baseColor: "var(--background-base-hover)" }))
|
|
32260
|
+
: col.cell);
|
|
32254
32261
|
return {
|
|
32255
32262
|
...col,
|
|
32256
32263
|
cell,
|
|
32257
32264
|
filterFn,
|
|
32258
32265
|
};
|
|
32259
|
-
}), [isLoading, columns, tableCustomFilter]);
|
|
32266
|
+
}), [isLoading, columns, tableCustomFilter, onLoadMore]);
|
|
32260
32267
|
useEffect(() => {
|
|
32261
32268
|
if (onStateChange) {
|
|
32262
32269
|
onStateChange(tableState);
|
|
@@ -32266,7 +32273,7 @@ function DataTableRoot({ columns, data, emptyState, children, parentStyle, isLoa
|
|
|
32266
32273
|
setTableCustomFilter((old) => ({ ...old, [id]: filterFn }));
|
|
32267
32274
|
};
|
|
32268
32275
|
const table = useReactTable({
|
|
32269
|
-
data,
|
|
32276
|
+
data: tableData,
|
|
32270
32277
|
columns: columnWithCustomFilter,
|
|
32271
32278
|
globalFilterFn: "auto",
|
|
32272
32279
|
enableRowSelection: true,
|
|
@@ -32316,12 +32323,12 @@ function DataTableRoot({ columns, data, emptyState, children, parentStyle, isLoa
|
|
|
32316
32323
|
}) }, headerGroup.id)))
|
|
32317
32324
|
: null }), jsxRuntimeExports.jsxs(Table.Body, { children: [table.getRowModel().rows?.length ? (table.getRowModel().rows.map((row, rowIndex) => (jsxRuntimeExports.jsx(Table.Row, { "data-state": row.getIsSelected() && "selected", onClick: () => onRowClick?.(row.original), className: isLoading
|
|
32318
32325
|
? ""
|
|
32319
|
-
: `${styles$4.tRow} ${onRowClick ? styles$4.tRowClick : ""}`, ref: rowIndex === table.getRowModel().rows.length - 1
|
|
32326
|
+
: `${styles$4.tRow} ${onRowClick ? styles$4.tRowClick : ""}`, ref: onLoadMore && rowIndex === table.getRowModel().rows.length - 1
|
|
32320
32327
|
? lastRowRef
|
|
32321
32328
|
: null, children: row.getVisibleCells().map((cell, index) => (jsxRuntimeExports.jsx(Table.Cell, { style: {
|
|
32322
32329
|
...(cell.column.columnDef?.meta?.style ?? {}),
|
|
32323
32330
|
}, children: flexRender(cell.column.columnDef.cell, cell.getContext()) }, `${cell.id}_${index}`))) }, row.id)))) : (!isLoading ?
|
|
32324
|
-
jsxRuntimeExports.jsx(Table.Row, { children: jsxRuntimeExports.jsx(Table.Cell, { colSpan: columns.length, children: emptyState || "No results." }) }) : jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, {})), isLoading && getLoader(loaderRow, columns)] })] }), detail] })] }), footer] }) }));
|
|
32331
|
+
jsxRuntimeExports.jsx(Table.Row, { children: jsxRuntimeExports.jsx(Table.Cell, { colSpan: columns.length, children: emptyState || "No results." }) }) : jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, {})), isLoading && onLoadMore && getLoader(loaderRow, columns)] })] }), detail] })] }), footer] }) }));
|
|
32325
32332
|
}
|
|
32326
32333
|
const DataTable = Object.assign(DataTableRoot, {
|
|
32327
32334
|
Toolbar: DataTableToolbar,
|