@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.js
CHANGED
|
@@ -4362,7 +4362,7 @@ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
|
4362
4362
|
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
4363
4363
|
PERFORMANCE OF THIS SOFTWARE.
|
|
4364
4364
|
***************************************************************************** */
|
|
4365
|
-
/* global Reflect, Promise
|
|
4365
|
+
/* global Reflect, Promise */
|
|
4366
4366
|
|
|
4367
4367
|
|
|
4368
4368
|
var __assign = function() {
|
|
@@ -4396,12 +4396,7 @@ function __spreadArray(to, from, pack) {
|
|
|
4396
4396
|
}
|
|
4397
4397
|
}
|
|
4398
4398
|
return to.concat(ar || Array.prototype.slice.call(from));
|
|
4399
|
-
}
|
|
4400
|
-
|
|
4401
|
-
typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
|
|
4402
|
-
var e = new Error(message);
|
|
4403
|
-
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
4404
|
-
};
|
|
4399
|
+
}
|
|
4405
4400
|
|
|
4406
4401
|
var zeroRightClassName = 'right-scroll-bar-position';
|
|
4407
4402
|
var fullWidthClassName = 'width-before-scroll-bar';
|
|
@@ -32128,6 +32123,31 @@ function DataTableRoot({ columns, data, emptyState, children, parentStyle, isLoa
|
|
|
32128
32123
|
null;
|
|
32129
32124
|
const [tableState, setTableState] = useState({});
|
|
32130
32125
|
const observerRef = useRef(null);
|
|
32126
|
+
const lastRowRef = useRef(null);
|
|
32127
|
+
useEffect(() => {
|
|
32128
|
+
if (!onLoadMore)
|
|
32129
|
+
return;
|
|
32130
|
+
const observer = new IntersectionObserver((entries) => {
|
|
32131
|
+
if (entries[0].isIntersecting && !isLoading) {
|
|
32132
|
+
onLoadMore();
|
|
32133
|
+
}
|
|
32134
|
+
}, { threshold: 0.1 });
|
|
32135
|
+
observerRef.current = observer;
|
|
32136
|
+
return () => observer.disconnect();
|
|
32137
|
+
}, [onLoadMore]);
|
|
32138
|
+
useEffect(() => {
|
|
32139
|
+
const observer = observerRef.current;
|
|
32140
|
+
const lastRow = lastRowRef.current;
|
|
32141
|
+
if (observer && lastRow) {
|
|
32142
|
+
observer.disconnect();
|
|
32143
|
+
observer.observe(lastRow);
|
|
32144
|
+
}
|
|
32145
|
+
return () => {
|
|
32146
|
+
if (observer && lastRow) {
|
|
32147
|
+
observer.unobserve(lastRow);
|
|
32148
|
+
}
|
|
32149
|
+
};
|
|
32150
|
+
}, [isLoading]);
|
|
32131
32151
|
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}`))));
|
|
32132
32152
|
const { filteredColumns, addFilterColumn, removeFilterColumn, resetColumns } = useTableColumn();
|
|
32133
32153
|
const columnWithCustomFilter = useMemo(() => columns.map((col) => {
|
|
@@ -32167,25 +32187,6 @@ function DataTableRoot({ columns, data, emptyState, children, parentStyle, isLoa
|
|
|
32167
32187
|
initialState,
|
|
32168
32188
|
state: tableState,
|
|
32169
32189
|
});
|
|
32170
|
-
const lastRowRef = useCallback((node) => {
|
|
32171
|
-
if (isLoading)
|
|
32172
|
-
return;
|
|
32173
|
-
if (observerRef.current)
|
|
32174
|
-
observerRef.current.disconnect();
|
|
32175
|
-
observerRef.current = new IntersectionObserver((entries) => {
|
|
32176
|
-
if (entries[0].isIntersecting && onLoadMore) {
|
|
32177
|
-
onLoadMore();
|
|
32178
|
-
}
|
|
32179
|
-
});
|
|
32180
|
-
if (node)
|
|
32181
|
-
observerRef.current.observe(node);
|
|
32182
|
-
}, [isLoading, onLoadMore]);
|
|
32183
|
-
useEffect(() => {
|
|
32184
|
-
return () => {
|
|
32185
|
-
if (observerRef.current)
|
|
32186
|
-
observerRef.current.disconnect();
|
|
32187
|
-
};
|
|
32188
|
-
}, []);
|
|
32189
32190
|
const tableStyle = {
|
|
32190
32191
|
...(table.getRowModel().rows?.length
|
|
32191
32192
|
? { width: "100%" }
|
|
@@ -32224,7 +32225,8 @@ function DataTableRoot({ columns, data, emptyState, children, parentStyle, isLoa
|
|
|
32224
32225
|
? lastRowRef
|
|
32225
32226
|
: null, children: row.getVisibleCells().map((cell, index) => (jsxRuntimeExports.jsx(Table.Cell, { style: {
|
|
32226
32227
|
...(cell.column.columnDef?.meta?.style ?? {}),
|
|
32227
|
-
}, children: flexRender(cell.column.columnDef.cell, cell.getContext()) }, `${cell.id}_${index}`))) }, row.id)))) : (
|
|
32228
|
+
}, children: flexRender(cell.column.columnDef.cell, cell.getContext()) }, `${cell.id}_${index}`))) }, row.id)))) : (!isLoading ?
|
|
32229
|
+
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] }) }));
|
|
32228
32230
|
}
|
|
32229
32231
|
const DataTable = Object.assign(DataTableRoot, {
|
|
32230
32232
|
Toolbar: DataTableToolbar,
|