@powerportalspro/react-fluent 6.0.0 → 6.1.0
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 +80 -19
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +5 -1
- package/dist/index.d.ts +5 -1
- package/dist/index.js +80 -19
- package/dist/index.js.map +1 -1
- package/package.json +4 -4
package/dist/index.cjs
CHANGED
|
@@ -8319,6 +8319,36 @@ function MainGridVirtualizeFooter({
|
|
|
8319
8319
|
] });
|
|
8320
8320
|
}
|
|
8321
8321
|
|
|
8322
|
+
// src/grids/virtualize-paging.ts
|
|
8323
|
+
function hasMoreRowsToLoad(state) {
|
|
8324
|
+
if (state.moreRecords === false) return false;
|
|
8325
|
+
if (state.moreRecords === true) return true;
|
|
8326
|
+
if (state.lastPageEmpty) return false;
|
|
8327
|
+
if (state.totalCount === void 0) return true;
|
|
8328
|
+
return state.accumulatedCount < state.totalCount;
|
|
8329
|
+
}
|
|
8330
|
+
var VirtualizePagingCookies = class {
|
|
8331
|
+
key;
|
|
8332
|
+
byPage = /* @__PURE__ */ new Map();
|
|
8333
|
+
/** Store the cookie the response for `page` came back with (no-op for a null / empty cookie). */
|
|
8334
|
+
record(key, page, cookie) {
|
|
8335
|
+
if (this.key !== key) {
|
|
8336
|
+
this.key = key;
|
|
8337
|
+
this.byPage = /* @__PURE__ */ new Map();
|
|
8338
|
+
}
|
|
8339
|
+
if (cookie) this.byPage.set(page, cookie);
|
|
8340
|
+
}
|
|
8341
|
+
/**
|
|
8342
|
+
* The cookie to send when requesting `page` under `key`: the one page
|
|
8343
|
+
* `page - 1` returned, or `undefined` when it isn't known (page 1, a
|
|
8344
|
+
* non-sequential jump, or a key the store has no cookies for).
|
|
8345
|
+
*/
|
|
8346
|
+
cookieFor(key, page) {
|
|
8347
|
+
if (this.key !== key || page <= 1) return void 0;
|
|
8348
|
+
return this.byPage.get(page - 1);
|
|
8349
|
+
}
|
|
8350
|
+
};
|
|
8351
|
+
|
|
8322
8352
|
// src/grids/persisted-grid-state.ts
|
|
8323
8353
|
function readPersistedGridStateFromUrl(queryParameterName) {
|
|
8324
8354
|
if (!queryParameterName) return null;
|
|
@@ -8850,8 +8880,22 @@ function MainGridImpl({
|
|
|
8850
8880
|
`[MainGrid] Declared <GridColumn> children override the column projection of the supplied fetchXml (columns: ${columnsKey.split(",").join(", ")}). Drop the children \u2014 or remove the conflicting <attribute> elements from the fetchXml \u2014 to silence this message.`
|
|
8851
8881
|
);
|
|
8852
8882
|
}, [columnsKey, useInlineFetchXml]);
|
|
8883
|
+
const accumulatorResetKey = react.useMemo(
|
|
8884
|
+
() => [
|
|
8885
|
+
resolvedViewId ?? "",
|
|
8886
|
+
useInlineFetchXml ? inlineFetchXml ?? "" : "",
|
|
8887
|
+
debouncedSearchText,
|
|
8888
|
+
sort.map((s) => `${s.columnName}:${s.descending ? "d" : "a"}`).join("|"),
|
|
8889
|
+
filtersKey,
|
|
8890
|
+
pageSize,
|
|
8891
|
+
tableName ?? ""
|
|
8892
|
+
].join("|"),
|
|
8893
|
+
[resolvedViewId, useInlineFetchXml, inlineFetchXml, debouncedSearchText, sort, filtersKey, pageSize, tableName]
|
|
8894
|
+
);
|
|
8895
|
+
const [virtualizeCookies] = react.useState(() => new VirtualizePagingCookies());
|
|
8853
8896
|
const searchRequest = react.useMemo(() => {
|
|
8854
8897
|
const trimmed = debouncedSearchText.trim();
|
|
8898
|
+
const pagingCookie = isVirtualize ? virtualizeCookies.cookieFor(accumulatorResetKey, page) : void 0;
|
|
8855
8899
|
return {
|
|
8856
8900
|
...useInlineFetchXml && inlineFetchXml ? { fetchXml: inlineFetchXml } : resolvedViewId !== void 0 && { viewId: resolvedViewId },
|
|
8857
8901
|
...trimmed && { searchText: trimmed },
|
|
@@ -8871,7 +8915,8 @@ function MainGridImpl({
|
|
|
8871
8915
|
},
|
|
8872
8916
|
...columnsOverride && { columns: [...columnsOverride] },
|
|
8873
8917
|
pageNumber: page,
|
|
8874
|
-
pageSize
|
|
8918
|
+
pageSize,
|
|
8919
|
+
...pagingCookie && { pagingCookie }
|
|
8875
8920
|
};
|
|
8876
8921
|
}, [
|
|
8877
8922
|
resolvedViewId,
|
|
@@ -8882,7 +8927,9 @@ function MainGridImpl({
|
|
|
8882
8927
|
page,
|
|
8883
8928
|
pageSize,
|
|
8884
8929
|
filtersKey,
|
|
8885
|
-
columnsKey
|
|
8930
|
+
columnsKey,
|
|
8931
|
+
isVirtualize,
|
|
8932
|
+
accumulatorResetKey
|
|
8886
8933
|
]);
|
|
8887
8934
|
const transformPending = !!transformViewAsync || isCustomActiveView;
|
|
8888
8935
|
const recordsResult = react$1.useGridData(searchRequest, {
|
|
@@ -9179,18 +9226,6 @@ function MainGridImpl({
|
|
|
9179
9226
|
]);
|
|
9180
9227
|
const pageRecords = dataSource ? dataSource.rows : recordsResult.data?.tableRecords ?? EMPTY_RECORDS;
|
|
9181
9228
|
const [accumulatedRows, setAccumulatedRows] = react.useState(null);
|
|
9182
|
-
const accumulatorResetKey = react.useMemo(
|
|
9183
|
-
() => [
|
|
9184
|
-
resolvedViewId ?? "",
|
|
9185
|
-
useInlineFetchXml ? inlineFetchXml ?? "" : "",
|
|
9186
|
-
debouncedSearchText,
|
|
9187
|
-
sort.map((s) => `${s.columnName}:${s.descending ? "d" : "a"}`).join("|"),
|
|
9188
|
-
filtersKey,
|
|
9189
|
-
pageSize,
|
|
9190
|
-
tableName ?? ""
|
|
9191
|
-
].join("|"),
|
|
9192
|
-
[resolvedViewId, useInlineFetchXml, inlineFetchXml, debouncedSearchText, sort, filtersKey, pageSize, tableName]
|
|
9193
|
-
);
|
|
9194
9229
|
const resetVirtualizedView = react.useCallback(() => {
|
|
9195
9230
|
setAccumulatedRows([]);
|
|
9196
9231
|
setPage(1);
|
|
@@ -9216,6 +9251,12 @@ function MainGridImpl({
|
|
|
9216
9251
|
return [...base, ...additions];
|
|
9217
9252
|
});
|
|
9218
9253
|
}, [isVirtualize, recordsResult.status, pageRecords]);
|
|
9254
|
+
react.useEffect(() => {
|
|
9255
|
+
if (!isVirtualize) return;
|
|
9256
|
+
const landed = recordsResult.data;
|
|
9257
|
+
if (!landed) return;
|
|
9258
|
+
virtualizeCookies.record(accumulatorResetKey, page, landed.pagingInfo?.pagingCookie);
|
|
9259
|
+
}, [isVirtualize, recordsResult.data]);
|
|
9219
9260
|
const data = isVirtualize ? accumulatedRows ?? EMPTY_RECORDS : pageRecords;
|
|
9220
9261
|
const [pendingRowUpdates, setPendingRowUpdates] = react.useState(() => /* @__PURE__ */ new Map());
|
|
9221
9262
|
const [pendingRowCreates, setPendingRowCreates] = react.useState(() => []);
|
|
@@ -9696,7 +9737,15 @@ function MainGridImpl({
|
|
|
9696
9737
|
if (raw == null) return void 0;
|
|
9697
9738
|
return typeof raw === "number" ? raw : Number(raw);
|
|
9698
9739
|
})();
|
|
9699
|
-
const
|
|
9740
|
+
const hasMoreRowsToLoad2 = isVirtualize && hasMoreRowsToLoad({
|
|
9741
|
+
accumulatedCount: accumulatedRows?.length ?? 0,
|
|
9742
|
+
totalCount,
|
|
9743
|
+
moreRecords: dataSource ? dataSource.moreRecords : recordsResult.data?.pagingInfo?.moreRecords,
|
|
9744
|
+
// "A page has landed and it carried no rows." In standalone mode
|
|
9745
|
+
// `data` is only ever defined for a landed response (errors wipe it);
|
|
9746
|
+
// the datasource has no data handle, so idle-after-success stands in.
|
|
9747
|
+
lastPageEmpty: dataSource ? dataSource.status === react$1.QueryStatus.Success && !dataSource.isFetching && dataSource.rows.length === 0 : recordsResult.data !== void 0 && pageRecords.length === 0
|
|
9748
|
+
});
|
|
9700
9749
|
react.useEffect(() => {
|
|
9701
9750
|
if (!isVirtualize) return;
|
|
9702
9751
|
const sentinel = loadMoreSentinelRef.current;
|
|
@@ -9707,7 +9756,7 @@ function MainGridImpl({
|
|
|
9707
9756
|
const entry = entries[0];
|
|
9708
9757
|
if (!entry?.isIntersecting) return;
|
|
9709
9758
|
if (recordsResult.isFetching) return;
|
|
9710
|
-
if (!
|
|
9759
|
+
if (!hasMoreRowsToLoad2) return;
|
|
9711
9760
|
setPage(page + 1);
|
|
9712
9761
|
},
|
|
9713
9762
|
{
|
|
@@ -9720,7 +9769,7 @@ function MainGridImpl({
|
|
|
9720
9769
|
);
|
|
9721
9770
|
observer.observe(sentinel);
|
|
9722
9771
|
return () => observer.disconnect();
|
|
9723
|
-
}, [isVirtualize,
|
|
9772
|
+
}, [isVirtualize, hasMoreRowsToLoad2, recordsResult.isFetching, page, setPage]);
|
|
9724
9773
|
const handlePageChange = (nextPage) => {
|
|
9725
9774
|
if (nextPage === page) return;
|
|
9726
9775
|
setPage(nextPage);
|
|
@@ -10340,7 +10389,7 @@ function MainGridImpl({
|
|
|
10340
10389
|
}
|
|
10341
10390
|
),
|
|
10342
10391
|
displayedData.length === 0 && /* @__PURE__ */ jsxRuntime.jsx("div", { className: styles.emptyStateRow, children: t("app.components.grid.empty-content") }),
|
|
10343
|
-
isVirtualize &&
|
|
10392
|
+
isVirtualize && hasMoreRowsToLoad2 && // No spinner here: the full-body `refetchScrim` overlay below is the
|
|
10344
10393
|
// single load indicator. Rendering a `size="tiny"` spinner in the
|
|
10345
10394
|
// sentinel as well meant a deps-change refetch (refresh / sort /
|
|
10346
10395
|
// search / view switch) — which resets the accumulator to empty and
|
|
@@ -14460,6 +14509,18 @@ var useStyles12 = reactComponents.makeStyles({
|
|
|
14460
14509
|
},
|
|
14461
14510
|
// Scroll viewport for the merged grid so a tall result set scrolls inside the dialog.
|
|
14462
14511
|
dialogGrid: { maxHeight: "60vh", overflowY: "auto", overflowX: "auto" },
|
|
14512
|
+
// Merged-snapshot cells. Keys and sources are long single tokens (dotted keys,
|
|
14513
|
+
// backslash-only absolute paths) with no natural break opportunity, so without
|
|
14514
|
+
// this the text paints straight over the neighbouring column. `overflow-wrap:
|
|
14515
|
+
// anywhere` (not just `break-word`) is what makes the flex cell honour its
|
|
14516
|
+
// column width — it counts the soft breaks toward min-content — so the token
|
|
14517
|
+
// wraps inside the column instead of stretching it. Same recipe as
|
|
14518
|
+
// `sourceCell` in the per-source loads table above.
|
|
14519
|
+
mergedCell: {
|
|
14520
|
+
whiteSpace: "normal",
|
|
14521
|
+
overflowWrap: "anywhere",
|
|
14522
|
+
wordBreak: "break-word"
|
|
14523
|
+
},
|
|
14463
14524
|
filterInput: { minWidth: "260px" },
|
|
14464
14525
|
pager: { display: "flex", alignItems: "center", gap: reactComponents.tokens.spacingHorizontalS },
|
|
14465
14526
|
grow: { flex: 1 },
|
|
@@ -14941,7 +15002,7 @@ function MergedSourcesDialog({
|
|
|
14941
15002
|
size: "small",
|
|
14942
15003
|
children: [
|
|
14943
15004
|
/* @__PURE__ */ jsxRuntime.jsx(reactComponents.DataGridHeader, { children: /* @__PURE__ */ jsxRuntime.jsx(reactComponents.DataGridRow, { children: ({ renderHeaderCell }) => /* @__PURE__ */ jsxRuntime.jsx(reactComponents.DataGridHeaderCell, { children: renderHeaderCell() }) }) }),
|
|
14944
|
-
/* @__PURE__ */ jsxRuntime.jsx(reactComponents.DataGridBody, { children: ({ item, rowId }) => /* @__PURE__ */ jsxRuntime.jsx(reactComponents.DataGridRow, { children: ({ renderCell }) => /* @__PURE__ */ jsxRuntime.jsx(reactComponents.DataGridCell, { children: renderCell(item) }) }, rowId) })
|
|
15005
|
+
/* @__PURE__ */ jsxRuntime.jsx(reactComponents.DataGridBody, { children: ({ item, rowId }) => /* @__PURE__ */ jsxRuntime.jsx(reactComponents.DataGridRow, { children: ({ renderCell }) => /* @__PURE__ */ jsxRuntime.jsx(reactComponents.DataGridCell, { className: styles.mergedCell, children: renderCell(item) }) }, rowId) })
|
|
14945
15006
|
]
|
|
14946
15007
|
}
|
|
14947
15008
|
) })
|