@raystack/apsara 0.19.0 → 0.19.1
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 +29 -27
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +29 -27
- package/dist/index.js.map +1 -1
- package/dist/table/datatable.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -4382,7 +4382,7 @@ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
|
4382
4382
|
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
4383
4383
|
PERFORMANCE OF THIS SOFTWARE.
|
|
4384
4384
|
***************************************************************************** */
|
|
4385
|
-
/* global Reflect, Promise
|
|
4385
|
+
/* global Reflect, Promise */
|
|
4386
4386
|
|
|
4387
4387
|
|
|
4388
4388
|
var __assign = function() {
|
|
@@ -4416,12 +4416,7 @@ function __spreadArray(to, from, pack) {
|
|
|
4416
4416
|
}
|
|
4417
4417
|
}
|
|
4418
4418
|
return to.concat(ar || Array.prototype.slice.call(from));
|
|
4419
|
-
}
|
|
4420
|
-
|
|
4421
|
-
typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
|
|
4422
|
-
var e = new Error(message);
|
|
4423
|
-
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
4424
|
-
};
|
|
4419
|
+
}
|
|
4425
4420
|
|
|
4426
4421
|
var zeroRightClassName = 'right-scroll-bar-position';
|
|
4427
4422
|
var fullWidthClassName = 'width-before-scroll-bar';
|
|
@@ -32148,6 +32143,31 @@ function DataTableRoot({ columns, data, emptyState, children, parentStyle, isLoa
|
|
|
32148
32143
|
null;
|
|
32149
32144
|
const [tableState, setTableState] = React.useState({});
|
|
32150
32145
|
const observerRef = React.useRef(null);
|
|
32146
|
+
const lastRowRef = React.useRef(null);
|
|
32147
|
+
React.useEffect(() => {
|
|
32148
|
+
if (!onLoadMore)
|
|
32149
|
+
return;
|
|
32150
|
+
const observer = new IntersectionObserver((entries) => {
|
|
32151
|
+
if (entries[0].isIntersecting && !isLoading) {
|
|
32152
|
+
onLoadMore();
|
|
32153
|
+
}
|
|
32154
|
+
}, { threshold: 0.1 });
|
|
32155
|
+
observerRef.current = observer;
|
|
32156
|
+
return () => observer.disconnect();
|
|
32157
|
+
}, [onLoadMore]);
|
|
32158
|
+
React.useEffect(() => {
|
|
32159
|
+
const observer = observerRef.current;
|
|
32160
|
+
const lastRow = lastRowRef.current;
|
|
32161
|
+
if (observer && lastRow) {
|
|
32162
|
+
observer.disconnect();
|
|
32163
|
+
observer.observe(lastRow);
|
|
32164
|
+
}
|
|
32165
|
+
return () => {
|
|
32166
|
+
if (observer && lastRow) {
|
|
32167
|
+
observer.unobserve(lastRow);
|
|
32168
|
+
}
|
|
32169
|
+
};
|
|
32170
|
+
}, [isLoading]);
|
|
32151
32171
|
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}`))));
|
|
32152
32172
|
const { filteredColumns, addFilterColumn, removeFilterColumn, resetColumns } = useTableColumn();
|
|
32153
32173
|
const columnWithCustomFilter = React.useMemo(() => columns.map((col) => {
|
|
@@ -32187,25 +32207,6 @@ function DataTableRoot({ columns, data, emptyState, children, parentStyle, isLoa
|
|
|
32187
32207
|
initialState,
|
|
32188
32208
|
state: tableState,
|
|
32189
32209
|
});
|
|
32190
|
-
const lastRowRef = React.useCallback((node) => {
|
|
32191
|
-
if (isLoading)
|
|
32192
|
-
return;
|
|
32193
|
-
if (observerRef.current)
|
|
32194
|
-
observerRef.current.disconnect();
|
|
32195
|
-
observerRef.current = new IntersectionObserver((entries) => {
|
|
32196
|
-
if (entries[0].isIntersecting && onLoadMore) {
|
|
32197
|
-
onLoadMore();
|
|
32198
|
-
}
|
|
32199
|
-
});
|
|
32200
|
-
if (node)
|
|
32201
|
-
observerRef.current.observe(node);
|
|
32202
|
-
}, [isLoading, onLoadMore]);
|
|
32203
|
-
React.useEffect(() => {
|
|
32204
|
-
return () => {
|
|
32205
|
-
if (observerRef.current)
|
|
32206
|
-
observerRef.current.disconnect();
|
|
32207
|
-
};
|
|
32208
|
-
}, []);
|
|
32209
32210
|
const tableStyle = {
|
|
32210
32211
|
...(table.getRowModel().rows?.length
|
|
32211
32212
|
? { width: "100%" }
|
|
@@ -32244,7 +32245,8 @@ function DataTableRoot({ columns, data, emptyState, children, parentStyle, isLoa
|
|
|
32244
32245
|
? lastRowRef
|
|
32245
32246
|
: null, children: row.getVisibleCells().map((cell, index) => (jsxRuntimeExports.jsx(Table.Cell, { style: {
|
|
32246
32247
|
...(cell.column.columnDef?.meta?.style ?? {}),
|
|
32247
|
-
}, children: flexRender(cell.column.columnDef.cell, cell.getContext()) }, `${cell.id}_${index}`))) }, row.id)))) : (
|
|
32248
|
+
}, children: flexRender(cell.column.columnDef.cell, cell.getContext()) }, `${cell.id}_${index}`))) }, row.id)))) : (!isLoading ?
|
|
32249
|
+
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] }) }));
|
|
32248
32250
|
}
|
|
32249
32251
|
const DataTable = Object.assign(DataTableRoot, {
|
|
32250
32252
|
Toolbar: DataTableToolbar,
|