@facter/ds-core 1.7.3 → 1.7.5
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.d.mts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +38 -7
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +38 -7
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1120,6 +1120,7 @@ function useDataTableInternal({
|
|
|
1120
1120
|
pageIndex: 0,
|
|
1121
1121
|
pageSize: 10
|
|
1122
1122
|
});
|
|
1123
|
+
console.log("[useDataTableInternal] pagination state", pagination);
|
|
1123
1124
|
const table = useReactTable({
|
|
1124
1125
|
data,
|
|
1125
1126
|
columns,
|
|
@@ -1168,7 +1169,9 @@ function useDataTableInternal({
|
|
|
1168
1169
|
table,
|
|
1169
1170
|
meta,
|
|
1170
1171
|
density,
|
|
1171
|
-
setDensity
|
|
1172
|
+
setDensity,
|
|
1173
|
+
pageIndex: pagination.pageIndex,
|
|
1174
|
+
pageSize: pagination.pageSize
|
|
1172
1175
|
};
|
|
1173
1176
|
}
|
|
1174
1177
|
var DataTableInstanceContext = React49.createContext(null);
|
|
@@ -1177,12 +1180,16 @@ var DataTableMetaContext = React49.createContext(null);
|
|
|
1177
1180
|
DataTableMetaContext.displayName = "DataTableMetaContext";
|
|
1178
1181
|
var DataTableDensityContext = React49.createContext(null);
|
|
1179
1182
|
DataTableDensityContext.displayName = "DataTableDensityContext";
|
|
1183
|
+
var DataTablePaginationContext = React49.createContext(null);
|
|
1184
|
+
DataTablePaginationContext.displayName = "DataTablePaginationContext";
|
|
1180
1185
|
function DataTableProvider({
|
|
1181
1186
|
children,
|
|
1182
1187
|
table,
|
|
1183
1188
|
meta,
|
|
1184
1189
|
density,
|
|
1185
|
-
setDensity
|
|
1190
|
+
setDensity,
|
|
1191
|
+
pageIndex,
|
|
1192
|
+
pageSize
|
|
1186
1193
|
}) {
|
|
1187
1194
|
const metaValue = React49.useMemo(
|
|
1188
1195
|
() => meta,
|
|
@@ -1192,8 +1199,15 @@ function DataTableProvider({
|
|
|
1192
1199
|
() => ({ density, setDensity }),
|
|
1193
1200
|
[density, setDensity]
|
|
1194
1201
|
);
|
|
1202
|
+
const paginationValue = React49.useMemo(
|
|
1203
|
+
() => {
|
|
1204
|
+
console.log("[DataTableProvider] creating paginationValue", { pageIndex, pageSize });
|
|
1205
|
+
return { pageIndex, pageSize };
|
|
1206
|
+
},
|
|
1207
|
+
[pageIndex, pageSize]
|
|
1208
|
+
);
|
|
1195
1209
|
const tableValue = table;
|
|
1196
|
-
return /* @__PURE__ */ jsx(DataTableInstanceContext.Provider, { value: tableValue, children: /* @__PURE__ */ jsx(DataTableMetaContext.Provider, { value: metaValue, children: /* @__PURE__ */ jsx(DataTableDensityContext.Provider, { value: densityValue, children }) }) });
|
|
1210
|
+
return /* @__PURE__ */ jsx(DataTableInstanceContext.Provider, { value: tableValue, children: /* @__PURE__ */ jsx(DataTableMetaContext.Provider, { value: metaValue, children: /* @__PURE__ */ jsx(DataTableDensityContext.Provider, { value: densityValue, children: /* @__PURE__ */ jsx(DataTablePaginationContext.Provider, { value: paginationValue, children }) }) }) });
|
|
1197
1211
|
}
|
|
1198
1212
|
function useDataTable() {
|
|
1199
1213
|
const context = React49.useContext(DataTableInstanceContext);
|
|
@@ -1236,9 +1250,18 @@ function useDataTableDensity() {
|
|
|
1236
1250
|
}
|
|
1237
1251
|
return context;
|
|
1238
1252
|
}
|
|
1253
|
+
function useDataTablePaginationContext() {
|
|
1254
|
+
const context = React49.useContext(DataTablePaginationContext);
|
|
1255
|
+
if (!context) {
|
|
1256
|
+
throw new Error(
|
|
1257
|
+
"useDataTablePagination must be used within <DataTable>. Make sure your component is wrapped with DataTable."
|
|
1258
|
+
);
|
|
1259
|
+
}
|
|
1260
|
+
return context;
|
|
1261
|
+
}
|
|
1239
1262
|
function useDataTablePagination() {
|
|
1240
1263
|
const table = useDataTable();
|
|
1241
|
-
const { pageIndex, pageSize } =
|
|
1264
|
+
const { pageIndex, pageSize } = useDataTablePaginationContext();
|
|
1242
1265
|
return React49.useMemo(() => {
|
|
1243
1266
|
const pageCount = table.getPageCount();
|
|
1244
1267
|
return {
|
|
@@ -1293,7 +1316,7 @@ function DataTableRoot({
|
|
|
1293
1316
|
pageCount,
|
|
1294
1317
|
className
|
|
1295
1318
|
}) {
|
|
1296
|
-
const { table, meta, density, setDensity } = useDataTableInternal({
|
|
1319
|
+
const { table, meta, density, setDensity, pageIndex, pageSize } = useDataTableInternal({
|
|
1297
1320
|
data,
|
|
1298
1321
|
columns,
|
|
1299
1322
|
getRowId,
|
|
@@ -1307,6 +1330,8 @@ function DataTableRoot({
|
|
|
1307
1330
|
meta,
|
|
1308
1331
|
density,
|
|
1309
1332
|
setDensity,
|
|
1333
|
+
pageIndex,
|
|
1334
|
+
pageSize,
|
|
1310
1335
|
children: /* @__PURE__ */ jsx(
|
|
1311
1336
|
"div",
|
|
1312
1337
|
{
|
|
@@ -1595,6 +1620,7 @@ var DataTablePagination = React49.memo(function DataTablePagination2({
|
|
|
1595
1620
|
}) {
|
|
1596
1621
|
useDataTable();
|
|
1597
1622
|
const { selectedRowCount, totalRows } = useDataTableMeta();
|
|
1623
|
+
const paginationHook = useDataTablePagination();
|
|
1598
1624
|
const {
|
|
1599
1625
|
pageIndex,
|
|
1600
1626
|
pageSize,
|
|
@@ -1607,7 +1633,8 @@ var DataTablePagination = React49.memo(function DataTablePagination2({
|
|
|
1607
1633
|
nextPage,
|
|
1608
1634
|
firstPage,
|
|
1609
1635
|
lastPage
|
|
1610
|
-
} =
|
|
1636
|
+
} = paginationHook;
|
|
1637
|
+
console.log("[DataTablePagination] render", { mode, pageIndex, pageSize, externalPageCount, internalPageCount });
|
|
1611
1638
|
const pageCount = mode === "server" && externalPageCount !== void 0 ? externalPageCount : internalPageCount;
|
|
1612
1639
|
const canGoPrevious = pageIndex > 0;
|
|
1613
1640
|
const canGoNext = pageIndex < pageCount - 1;
|
|
@@ -1685,7 +1712,11 @@ var DataTablePagination = React49.memo(function DataTablePagination2({
|
|
|
1685
1712
|
variant: "outline",
|
|
1686
1713
|
size: "icon-sm",
|
|
1687
1714
|
className: "h-8 w-8 p-0",
|
|
1688
|
-
onClick:
|
|
1715
|
+
onClick: () => {
|
|
1716
|
+
console.log("[DataTablePagination] nextPage clicked, current pageIndex:", pageIndex);
|
|
1717
|
+
nextPage();
|
|
1718
|
+
console.log("[DataTablePagination] nextPage called");
|
|
1719
|
+
},
|
|
1689
1720
|
disabled: !canGoNext,
|
|
1690
1721
|
"aria-label": "Pr\xF3xima p\xE1gina",
|
|
1691
1722
|
children: /* @__PURE__ */ jsx(ChevronRight, { className: "h-4 w-4" })
|