@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.d.mts
CHANGED
|
@@ -619,6 +619,7 @@ declare function useDataTableDensity(): DensityContextValue;
|
|
|
619
619
|
/**
|
|
620
620
|
* Hook para paginação
|
|
621
621
|
* Retorna informações de paginação memoizadas
|
|
622
|
+
* Re-renderiza quando pageIndex ou pageSize muda (via contexto)
|
|
622
623
|
*/
|
|
623
624
|
declare function useDataTablePagination(): {
|
|
624
625
|
pageIndex: number;
|
package/dist/index.d.ts
CHANGED
|
@@ -619,6 +619,7 @@ declare function useDataTableDensity(): DensityContextValue;
|
|
|
619
619
|
/**
|
|
620
620
|
* Hook para paginação
|
|
621
621
|
* Retorna informações de paginação memoizadas
|
|
622
|
+
* Re-renderiza quando pageIndex ou pageSize muda (via contexto)
|
|
622
623
|
*/
|
|
623
624
|
declare function useDataTablePagination(): {
|
|
624
625
|
pageIndex: number;
|
package/dist/index.js
CHANGED
|
@@ -1151,6 +1151,7 @@ function useDataTableInternal({
|
|
|
1151
1151
|
pageIndex: 0,
|
|
1152
1152
|
pageSize: 10
|
|
1153
1153
|
});
|
|
1154
|
+
console.log("[useDataTableInternal] pagination state", pagination);
|
|
1154
1155
|
const table = reactTable.useReactTable({
|
|
1155
1156
|
data,
|
|
1156
1157
|
columns,
|
|
@@ -1199,7 +1200,9 @@ function useDataTableInternal({
|
|
|
1199
1200
|
table,
|
|
1200
1201
|
meta,
|
|
1201
1202
|
density,
|
|
1202
|
-
setDensity
|
|
1203
|
+
setDensity,
|
|
1204
|
+
pageIndex: pagination.pageIndex,
|
|
1205
|
+
pageSize: pagination.pageSize
|
|
1203
1206
|
};
|
|
1204
1207
|
}
|
|
1205
1208
|
var DataTableInstanceContext = React49__namespace.createContext(null);
|
|
@@ -1208,12 +1211,16 @@ var DataTableMetaContext = React49__namespace.createContext(null);
|
|
|
1208
1211
|
DataTableMetaContext.displayName = "DataTableMetaContext";
|
|
1209
1212
|
var DataTableDensityContext = React49__namespace.createContext(null);
|
|
1210
1213
|
DataTableDensityContext.displayName = "DataTableDensityContext";
|
|
1214
|
+
var DataTablePaginationContext = React49__namespace.createContext(null);
|
|
1215
|
+
DataTablePaginationContext.displayName = "DataTablePaginationContext";
|
|
1211
1216
|
function DataTableProvider({
|
|
1212
1217
|
children,
|
|
1213
1218
|
table,
|
|
1214
1219
|
meta,
|
|
1215
1220
|
density,
|
|
1216
|
-
setDensity
|
|
1221
|
+
setDensity,
|
|
1222
|
+
pageIndex,
|
|
1223
|
+
pageSize
|
|
1217
1224
|
}) {
|
|
1218
1225
|
const metaValue = React49__namespace.useMemo(
|
|
1219
1226
|
() => meta,
|
|
@@ -1223,8 +1230,15 @@ function DataTableProvider({
|
|
|
1223
1230
|
() => ({ density, setDensity }),
|
|
1224
1231
|
[density, setDensity]
|
|
1225
1232
|
);
|
|
1233
|
+
const paginationValue = React49__namespace.useMemo(
|
|
1234
|
+
() => {
|
|
1235
|
+
console.log("[DataTableProvider] creating paginationValue", { pageIndex, pageSize });
|
|
1236
|
+
return { pageIndex, pageSize };
|
|
1237
|
+
},
|
|
1238
|
+
[pageIndex, pageSize]
|
|
1239
|
+
);
|
|
1226
1240
|
const tableValue = table;
|
|
1227
|
-
return /* @__PURE__ */ jsxRuntime.jsx(DataTableInstanceContext.Provider, { value: tableValue, children: /* @__PURE__ */ jsxRuntime.jsx(DataTableMetaContext.Provider, { value: metaValue, children: /* @__PURE__ */ jsxRuntime.jsx(DataTableDensityContext.Provider, { value: densityValue, children }) }) });
|
|
1241
|
+
return /* @__PURE__ */ jsxRuntime.jsx(DataTableInstanceContext.Provider, { value: tableValue, children: /* @__PURE__ */ jsxRuntime.jsx(DataTableMetaContext.Provider, { value: metaValue, children: /* @__PURE__ */ jsxRuntime.jsx(DataTableDensityContext.Provider, { value: densityValue, children: /* @__PURE__ */ jsxRuntime.jsx(DataTablePaginationContext.Provider, { value: paginationValue, children }) }) }) });
|
|
1228
1242
|
}
|
|
1229
1243
|
function useDataTable() {
|
|
1230
1244
|
const context = React49__namespace.useContext(DataTableInstanceContext);
|
|
@@ -1267,9 +1281,18 @@ function useDataTableDensity() {
|
|
|
1267
1281
|
}
|
|
1268
1282
|
return context;
|
|
1269
1283
|
}
|
|
1284
|
+
function useDataTablePaginationContext() {
|
|
1285
|
+
const context = React49__namespace.useContext(DataTablePaginationContext);
|
|
1286
|
+
if (!context) {
|
|
1287
|
+
throw new Error(
|
|
1288
|
+
"useDataTablePagination must be used within <DataTable>. Make sure your component is wrapped with DataTable."
|
|
1289
|
+
);
|
|
1290
|
+
}
|
|
1291
|
+
return context;
|
|
1292
|
+
}
|
|
1270
1293
|
function useDataTablePagination() {
|
|
1271
1294
|
const table = useDataTable();
|
|
1272
|
-
const { pageIndex, pageSize } =
|
|
1295
|
+
const { pageIndex, pageSize } = useDataTablePaginationContext();
|
|
1273
1296
|
return React49__namespace.useMemo(() => {
|
|
1274
1297
|
const pageCount = table.getPageCount();
|
|
1275
1298
|
return {
|
|
@@ -1324,7 +1347,7 @@ function DataTableRoot({
|
|
|
1324
1347
|
pageCount,
|
|
1325
1348
|
className
|
|
1326
1349
|
}) {
|
|
1327
|
-
const { table, meta, density, setDensity } = useDataTableInternal({
|
|
1350
|
+
const { table, meta, density, setDensity, pageIndex, pageSize } = useDataTableInternal({
|
|
1328
1351
|
data,
|
|
1329
1352
|
columns,
|
|
1330
1353
|
getRowId,
|
|
@@ -1338,6 +1361,8 @@ function DataTableRoot({
|
|
|
1338
1361
|
meta,
|
|
1339
1362
|
density,
|
|
1340
1363
|
setDensity,
|
|
1364
|
+
pageIndex,
|
|
1365
|
+
pageSize,
|
|
1341
1366
|
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1342
1367
|
"div",
|
|
1343
1368
|
{
|
|
@@ -1626,6 +1651,7 @@ var DataTablePagination = React49__namespace.memo(function DataTablePagination2(
|
|
|
1626
1651
|
}) {
|
|
1627
1652
|
useDataTable();
|
|
1628
1653
|
const { selectedRowCount, totalRows } = useDataTableMeta();
|
|
1654
|
+
const paginationHook = useDataTablePagination();
|
|
1629
1655
|
const {
|
|
1630
1656
|
pageIndex,
|
|
1631
1657
|
pageSize,
|
|
@@ -1638,7 +1664,8 @@ var DataTablePagination = React49__namespace.memo(function DataTablePagination2(
|
|
|
1638
1664
|
nextPage,
|
|
1639
1665
|
firstPage,
|
|
1640
1666
|
lastPage
|
|
1641
|
-
} =
|
|
1667
|
+
} = paginationHook;
|
|
1668
|
+
console.log("[DataTablePagination] render", { mode, pageIndex, pageSize, externalPageCount, internalPageCount });
|
|
1642
1669
|
const pageCount = mode === "server" && externalPageCount !== void 0 ? externalPageCount : internalPageCount;
|
|
1643
1670
|
const canGoPrevious = pageIndex > 0;
|
|
1644
1671
|
const canGoNext = pageIndex < pageCount - 1;
|
|
@@ -1716,7 +1743,11 @@ var DataTablePagination = React49__namespace.memo(function DataTablePagination2(
|
|
|
1716
1743
|
variant: "outline",
|
|
1717
1744
|
size: "icon-sm",
|
|
1718
1745
|
className: "h-8 w-8 p-0",
|
|
1719
|
-
onClick:
|
|
1746
|
+
onClick: () => {
|
|
1747
|
+
console.log("[DataTablePagination] nextPage clicked, current pageIndex:", pageIndex);
|
|
1748
|
+
nextPage();
|
|
1749
|
+
console.log("[DataTablePagination] nextPage called");
|
|
1750
|
+
},
|
|
1720
1751
|
disabled: !canGoNext,
|
|
1721
1752
|
"aria-label": "Pr\xF3xima p\xE1gina",
|
|
1722
1753
|
children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronRight, { className: "h-4 w-4" })
|