@facter/ds-core 1.7.3 → 1.7.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.d.mts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +26 -5
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +26 -5
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1168,7 +1168,9 @@ function useDataTableInternal({
|
|
|
1168
1168
|
table,
|
|
1169
1169
|
meta,
|
|
1170
1170
|
density,
|
|
1171
|
-
setDensity
|
|
1171
|
+
setDensity,
|
|
1172
|
+
pageIndex: pagination.pageIndex,
|
|
1173
|
+
pageSize: pagination.pageSize
|
|
1172
1174
|
};
|
|
1173
1175
|
}
|
|
1174
1176
|
var DataTableInstanceContext = React49.createContext(null);
|
|
@@ -1177,12 +1179,16 @@ var DataTableMetaContext = React49.createContext(null);
|
|
|
1177
1179
|
DataTableMetaContext.displayName = "DataTableMetaContext";
|
|
1178
1180
|
var DataTableDensityContext = React49.createContext(null);
|
|
1179
1181
|
DataTableDensityContext.displayName = "DataTableDensityContext";
|
|
1182
|
+
var DataTablePaginationContext = React49.createContext(null);
|
|
1183
|
+
DataTablePaginationContext.displayName = "DataTablePaginationContext";
|
|
1180
1184
|
function DataTableProvider({
|
|
1181
1185
|
children,
|
|
1182
1186
|
table,
|
|
1183
1187
|
meta,
|
|
1184
1188
|
density,
|
|
1185
|
-
setDensity
|
|
1189
|
+
setDensity,
|
|
1190
|
+
pageIndex,
|
|
1191
|
+
pageSize
|
|
1186
1192
|
}) {
|
|
1187
1193
|
const metaValue = React49.useMemo(
|
|
1188
1194
|
() => meta,
|
|
@@ -1192,8 +1198,12 @@ function DataTableProvider({
|
|
|
1192
1198
|
() => ({ density, setDensity }),
|
|
1193
1199
|
[density, setDensity]
|
|
1194
1200
|
);
|
|
1201
|
+
const paginationValue = React49.useMemo(
|
|
1202
|
+
() => ({ pageIndex, pageSize }),
|
|
1203
|
+
[pageIndex, pageSize]
|
|
1204
|
+
);
|
|
1195
1205
|
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 }) }) });
|
|
1206
|
+
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
1207
|
}
|
|
1198
1208
|
function useDataTable() {
|
|
1199
1209
|
const context = React49.useContext(DataTableInstanceContext);
|
|
@@ -1236,9 +1246,18 @@ function useDataTableDensity() {
|
|
|
1236
1246
|
}
|
|
1237
1247
|
return context;
|
|
1238
1248
|
}
|
|
1249
|
+
function useDataTablePaginationContext() {
|
|
1250
|
+
const context = React49.useContext(DataTablePaginationContext);
|
|
1251
|
+
if (!context) {
|
|
1252
|
+
throw new Error(
|
|
1253
|
+
"useDataTablePagination must be used within <DataTable>. Make sure your component is wrapped with DataTable."
|
|
1254
|
+
);
|
|
1255
|
+
}
|
|
1256
|
+
return context;
|
|
1257
|
+
}
|
|
1239
1258
|
function useDataTablePagination() {
|
|
1240
1259
|
const table = useDataTable();
|
|
1241
|
-
const { pageIndex, pageSize } =
|
|
1260
|
+
const { pageIndex, pageSize } = useDataTablePaginationContext();
|
|
1242
1261
|
return React49.useMemo(() => {
|
|
1243
1262
|
const pageCount = table.getPageCount();
|
|
1244
1263
|
return {
|
|
@@ -1293,7 +1312,7 @@ function DataTableRoot({
|
|
|
1293
1312
|
pageCount,
|
|
1294
1313
|
className
|
|
1295
1314
|
}) {
|
|
1296
|
-
const { table, meta, density, setDensity } = useDataTableInternal({
|
|
1315
|
+
const { table, meta, density, setDensity, pageIndex, pageSize } = useDataTableInternal({
|
|
1297
1316
|
data,
|
|
1298
1317
|
columns,
|
|
1299
1318
|
getRowId,
|
|
@@ -1307,6 +1326,8 @@ function DataTableRoot({
|
|
|
1307
1326
|
meta,
|
|
1308
1327
|
density,
|
|
1309
1328
|
setDensity,
|
|
1329
|
+
pageIndex,
|
|
1330
|
+
pageSize,
|
|
1310
1331
|
children: /* @__PURE__ */ jsx(
|
|
1311
1332
|
"div",
|
|
1312
1333
|
{
|