@kne/table-page 0.1.3 → 0.1.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/README.md +276 -19
- package/dist/index.css +68 -6
- package/dist/index.css.map +1 -1
- package/dist/index.js +383 -164
- package/dist/index.js.map +1 -1
- package/dist/index.modern.js +387 -166
- package/dist/index.modern.js.map +1 -1
- package/package.json +1 -1
package/dist/index.modern.js
CHANGED
|
@@ -1081,7 +1081,7 @@ const computeColumnsDisplay = ({
|
|
|
1081
1081
|
computeColumnsValue.computeDisplay = computeDisplay;
|
|
1082
1082
|
computeColumnsValue.computeColumnsDisplay = computeColumnsDisplay;
|
|
1083
1083
|
|
|
1084
|
-
var style$5 = {"table":"kne-table-page_lZgIW","tableView":"kne-table-page_fUw6j","grid":"kne-table-page_JlDmf","header-cell":"kne-table-page_P-ebv","col-content":"kne-table-page_HT5Rr","body-row":"kne-table-page_Z6mVv","
|
|
1084
|
+
var style$5 = {"table":"kne-table-page_lZgIW","header":"kne-table-page_d1qN5","col":"kne-table-page_KNy4z","tableView":"kne-table-page_fUw6j","grid":"kne-table-page_JlDmf","header-cell":"kne-table-page_P-ebv","col-content":"kne-table-page_HT5Rr","body-row":"kne-table-page_Z6mVv","body-cell":"kne-table-page_BSOzz","body":"kne-table-page_9qon1","is-selected-all":"kne-table-page_f2i1e","is-selected":"kne-table-page_n3V6m","is-disabled":"kne-table-page_AfmkR","col-width-based":"kne-table-page_ZvnDi","col-width-fill":"kne-table-page_cV7PE","single-checked":"kne-table-page_9UAoL","col-fixed":"kne-table-page_aB-1c","empty":"kne-table-page_SRI8Q"};
|
|
1085
1085
|
|
|
1086
1086
|
var style$4 = {"table":"kne-table-page_awa1L","is-selected-all":"kne-table-page_692q3","is-selected":"kne-table-page_IWgjl","is-disabled":"kne-table-page_YUG4k","has-summary":"kne-table-page_Cb-du","has-group-header":"kne-table-page_7qTC5","is-sticky":"kne-table-page_jGzIR","is-sticky-scroll-y":"kne-table-page_P6lxG","is-sticky-viewport":"kne-table-page_Kr-p6","table-cell":"kne-table-page_HPmr3","selection-col":"kne-table-page_D7YhS","radio-col":"kne-table-page_df9z3","is-computed":"kne-table-page_ZA1Je","is-resize":"kne-table-page_CA0uL","column-resize-guide":"kne-table-page_JARA2"};
|
|
1087
1087
|
|
|
@@ -2034,7 +2034,253 @@ const getColumnEllipsis = column => {
|
|
|
2034
2034
|
return typeof column.ellipsis === 'object' ? column.ellipsis : true;
|
|
2035
2035
|
};
|
|
2036
2036
|
|
|
2037
|
-
const
|
|
2037
|
+
const parsePixelValue = value => {
|
|
2038
|
+
const num = parseFloat(value);
|
|
2039
|
+
return Number.isNaN(num) ? 0 : num;
|
|
2040
|
+
};
|
|
2041
|
+
const isDocumentScrollContainer = container => {
|
|
2042
|
+
return !container || container === document.body || container === document.documentElement || container === document.scrollingElement;
|
|
2043
|
+
};
|
|
2044
|
+
const normalizeScrollTopInsetCSSValue = value => {
|
|
2045
|
+
if (value == null) {
|
|
2046
|
+
return undefined;
|
|
2047
|
+
}
|
|
2048
|
+
if (typeof value === 'number') {
|
|
2049
|
+
return `${value}px`;
|
|
2050
|
+
}
|
|
2051
|
+
return String(value);
|
|
2052
|
+
};
|
|
2053
|
+
const resolveScrollTopInset = (scrollTopInset, stickyOffset) => scrollTopInset != null ? scrollTopInset : stickyOffset;
|
|
2054
|
+
const parseInsetPixels = (inset, element) => {
|
|
2055
|
+
if (inset == null) {
|
|
2056
|
+
return 0;
|
|
2057
|
+
}
|
|
2058
|
+
if (typeof inset === 'number') {
|
|
2059
|
+
return inset;
|
|
2060
|
+
}
|
|
2061
|
+
if (typeof inset === 'string') {
|
|
2062
|
+
const trimmed = inset.trim();
|
|
2063
|
+
if (trimmed.endsWith('px')) {
|
|
2064
|
+
return parsePixelValue(trimmed);
|
|
2065
|
+
}
|
|
2066
|
+
const variableMatch = trimmed.match(/var\(\s*(--[^,\s)]+)/);
|
|
2067
|
+
if (variableMatch) {
|
|
2068
|
+
return readCssVariableLength(element, variableMatch[1], '0px');
|
|
2069
|
+
}
|
|
2070
|
+
}
|
|
2071
|
+
return 0;
|
|
2072
|
+
};
|
|
2073
|
+
const readScrollTopInsetPixels = element => {
|
|
2074
|
+
const fromVar = readCssVariableLength(element, '--scroll-top-inset', '0px') || readCssVariableLength(element, '--sticky-offset', '0px') || readCssVariableLength(element, '--nav-height', '0px');
|
|
2075
|
+
return fromVar;
|
|
2076
|
+
};
|
|
2077
|
+
const getViewportRect = () => {
|
|
2078
|
+
const visualViewport = window.visualViewport;
|
|
2079
|
+
if (visualViewport) {
|
|
2080
|
+
return {
|
|
2081
|
+
top: visualViewport.offsetTop,
|
|
2082
|
+
bottom: visualViewport.offsetTop + visualViewport.height,
|
|
2083
|
+
left: visualViewport.offsetLeft,
|
|
2084
|
+
right: visualViewport.offsetLeft + visualViewport.width,
|
|
2085
|
+
height: visualViewport.height
|
|
2086
|
+
};
|
|
2087
|
+
}
|
|
2088
|
+
return {
|
|
2089
|
+
top: 0,
|
|
2090
|
+
bottom: window.innerHeight,
|
|
2091
|
+
left: 0,
|
|
2092
|
+
right: window.innerWidth,
|
|
2093
|
+
height: window.innerHeight
|
|
2094
|
+
};
|
|
2095
|
+
};
|
|
2096
|
+
const getTableElement = root => {
|
|
2097
|
+
if (!root) {
|
|
2098
|
+
return null;
|
|
2099
|
+
}
|
|
2100
|
+
return root.querySelector('.info-page-table') || root;
|
|
2101
|
+
};
|
|
2102
|
+
const getScrollAnchorElement = (root, {
|
|
2103
|
+
preferToolbar: _preferToolbar = false
|
|
2104
|
+
} = {}) => {
|
|
2105
|
+
if (!root) {
|
|
2106
|
+
return null;
|
|
2107
|
+
}
|
|
2108
|
+
if (_preferToolbar) {
|
|
2109
|
+
return root.querySelector('.table-page-toolbar-section') || root.querySelector('.table-with-toolbar') || getTableElement(root);
|
|
2110
|
+
}
|
|
2111
|
+
return getTableElement(root);
|
|
2112
|
+
};
|
|
2113
|
+
const readCssVariableLength = (element, variableName, fallback = '0px') => {
|
|
2114
|
+
if (typeof document === 'undefined') {
|
|
2115
|
+
return 0;
|
|
2116
|
+
}
|
|
2117
|
+
const host = element || document.documentElement;
|
|
2118
|
+
const probe = document.createElement('div');
|
|
2119
|
+
probe.style.cssText = 'position:absolute;visibility:hidden;pointer-events:none;height:0;width:0;overflow:hidden;';
|
|
2120
|
+
probe.style.marginTop = `var(${variableName}, ${fallback})`;
|
|
2121
|
+
host.appendChild(probe);
|
|
2122
|
+
const value = parsePixelValue(getComputedStyle(probe).marginTop);
|
|
2123
|
+
host.removeChild(probe);
|
|
2124
|
+
return value;
|
|
2125
|
+
};
|
|
2126
|
+
const resolveScrollContainer = (element, getScrollContainer) => {
|
|
2127
|
+
const explicitContainer = typeof getScrollContainer === 'function' ? getScrollContainer() : null;
|
|
2128
|
+
if (explicitContainer) {
|
|
2129
|
+
return explicitContainer;
|
|
2130
|
+
}
|
|
2131
|
+
let parent = element == null ? void 0 : element.parentElement;
|
|
2132
|
+
while (parent) {
|
|
2133
|
+
const {
|
|
2134
|
+
overflowY
|
|
2135
|
+
} = getComputedStyle(parent);
|
|
2136
|
+
if (/(auto|scroll|overlay)/.test(overflowY) && parent.scrollHeight > parent.clientHeight + 1) {
|
|
2137
|
+
return parent;
|
|
2138
|
+
}
|
|
2139
|
+
parent = parent.parentElement;
|
|
2140
|
+
}
|
|
2141
|
+
return document.scrollingElement || document.documentElement;
|
|
2142
|
+
};
|
|
2143
|
+
const scrollToElement = (element, {
|
|
2144
|
+
offsetTop: _offsetTop = 0,
|
|
2145
|
+
getScrollContainer
|
|
2146
|
+
} = {}) => {
|
|
2147
|
+
const scrollContainer = resolveScrollContainer(element, getScrollContainer);
|
|
2148
|
+
const targetRect = element.getBoundingClientRect();
|
|
2149
|
+
if (scrollContainer === document.scrollingElement || scrollContainer === document.documentElement || scrollContainer === document.body) {
|
|
2150
|
+
const scrollTop = window.pageYOffset + targetRect.top - _offsetTop;
|
|
2151
|
+
window.scrollTo({
|
|
2152
|
+
top: Math.max(0, scrollTop),
|
|
2153
|
+
behavior: 'auto'
|
|
2154
|
+
});
|
|
2155
|
+
return;
|
|
2156
|
+
}
|
|
2157
|
+
const containerRect = scrollContainer.getBoundingClientRect();
|
|
2158
|
+
const nextScrollTop = scrollContainer.scrollTop + targetRect.top - containerRect.top - _offsetTop;
|
|
2159
|
+
scrollContainer.scrollTo({
|
|
2160
|
+
top: Math.max(0, nextScrollTop),
|
|
2161
|
+
behavior: 'auto'
|
|
2162
|
+
});
|
|
2163
|
+
};
|
|
2164
|
+
const scrollAnchorIntoView = (root, {
|
|
2165
|
+
getScrollContainer,
|
|
2166
|
+
preferToolbar: _preferToolbar2 = false
|
|
2167
|
+
} = {}) => {
|
|
2168
|
+
const target = getScrollAnchorElement(root, {
|
|
2169
|
+
preferToolbar: _preferToolbar2
|
|
2170
|
+
});
|
|
2171
|
+
if (!target) {
|
|
2172
|
+
return;
|
|
2173
|
+
}
|
|
2174
|
+
const offsetTop = readScrollTopInsetPixels(target);
|
|
2175
|
+
requestAnimationFrame(() => {
|
|
2176
|
+
requestAnimationFrame(() => {
|
|
2177
|
+
if (isTopEdgeInViewport(target, offsetTop, getScrollContainer)) {
|
|
2178
|
+
return;
|
|
2179
|
+
}
|
|
2180
|
+
scrollToElement(target, {
|
|
2181
|
+
offsetTop,
|
|
2182
|
+
getScrollContainer
|
|
2183
|
+
});
|
|
2184
|
+
});
|
|
2185
|
+
});
|
|
2186
|
+
};
|
|
2187
|
+
const getTableScrollElement = root => {
|
|
2188
|
+
if (!root) {
|
|
2189
|
+
return null;
|
|
2190
|
+
}
|
|
2191
|
+
return root.querySelector('.ant-table-body') || root.querySelector('.ant-table-content');
|
|
2192
|
+
};
|
|
2193
|
+
const getElementViewportState = element => {
|
|
2194
|
+
if (!element) {
|
|
2195
|
+
return {
|
|
2196
|
+
isBottomInViewport: true,
|
|
2197
|
+
isPartiallyInViewport: false,
|
|
2198
|
+
isTopInViewport: true,
|
|
2199
|
+
rect: null,
|
|
2200
|
+
viewport: getViewportRect()
|
|
2201
|
+
};
|
|
2202
|
+
}
|
|
2203
|
+
const rect = element.getBoundingClientRect();
|
|
2204
|
+
const viewport = getViewportRect();
|
|
2205
|
+
return {
|
|
2206
|
+
isBottomInViewport: rect.bottom > viewport.top && rect.bottom <= viewport.bottom,
|
|
2207
|
+
isPartiallyInViewport: rect.top < viewport.bottom && rect.bottom > viewport.top,
|
|
2208
|
+
isTopInViewport: rect.top >= viewport.top && rect.top < viewport.bottom,
|
|
2209
|
+
rect,
|
|
2210
|
+
viewport
|
|
2211
|
+
};
|
|
2212
|
+
};
|
|
2213
|
+
const isTopEdgeInViewport = (element, scrollMarginTop = 0, getScrollContainer) => {
|
|
2214
|
+
if (!element) {
|
|
2215
|
+
return true;
|
|
2216
|
+
}
|
|
2217
|
+
const rect = element.getBoundingClientRect();
|
|
2218
|
+
const explicitContainer = typeof getScrollContainer === 'function' ? getScrollContainer() : null;
|
|
2219
|
+
if (!isDocumentScrollContainer(explicitContainer)) {
|
|
2220
|
+
const containerRect = explicitContainer.getBoundingClientRect();
|
|
2221
|
+
const _viewportTop = containerRect.top + scrollMarginTop;
|
|
2222
|
+
return rect.top >= _viewportTop && rect.top < containerRect.bottom;
|
|
2223
|
+
}
|
|
2224
|
+
const {
|
|
2225
|
+
isTopInViewport,
|
|
2226
|
+
viewport
|
|
2227
|
+
} = getElementViewportState(element);
|
|
2228
|
+
if (!rect) {
|
|
2229
|
+
return true;
|
|
2230
|
+
}
|
|
2231
|
+
const viewportTop = viewport.top + scrollMarginTop;
|
|
2232
|
+
return rect.top >= viewportTop && rect.top < viewport.bottom;
|
|
2233
|
+
};
|
|
2234
|
+
const shouldShowFloatingScrollbar = (scrollEl, viewportState, getScrollContainer) => {
|
|
2235
|
+
if (!scrollEl || scrollEl.scrollWidth <= scrollEl.clientWidth + 1) {
|
|
2236
|
+
return false;
|
|
2237
|
+
}
|
|
2238
|
+
const explicitContainer = typeof getScrollContainer === 'function' ? getScrollContainer() : null;
|
|
2239
|
+
if (!isDocumentScrollContainer(explicitContainer)) {
|
|
2240
|
+
const rect = scrollEl.getBoundingClientRect();
|
|
2241
|
+
const containerRect = explicitContainer.getBoundingClientRect();
|
|
2242
|
+
return rect.top < containerRect.bottom && rect.bottom > containerRect.bottom;
|
|
2243
|
+
}
|
|
2244
|
+
const state = viewportState || getElementViewportState(scrollEl);
|
|
2245
|
+
if (!state.isPartiallyInViewport) {
|
|
2246
|
+
return false;
|
|
2247
|
+
}
|
|
2248
|
+
return !state.isBottomInViewport;
|
|
2249
|
+
};
|
|
2250
|
+
const observeViewportIntersection = (element, onChange) => {
|
|
2251
|
+
var _window$visualViewpor, _window$visualViewpor2;
|
|
2252
|
+
if (!element) {
|
|
2253
|
+
return () => {};
|
|
2254
|
+
}
|
|
2255
|
+
const notify = entry => {
|
|
2256
|
+
onChange(getElementViewportState(element));
|
|
2257
|
+
};
|
|
2258
|
+
const observer = new IntersectionObserver(([entry]) => {
|
|
2259
|
+
notify();
|
|
2260
|
+
}, {
|
|
2261
|
+
root: null,
|
|
2262
|
+
threshold: [0, 0.01, 0.25, 0.5, 0.75, 1]
|
|
2263
|
+
});
|
|
2264
|
+
observer.observe(element);
|
|
2265
|
+
const handleViewportChange = () => {
|
|
2266
|
+
notify();
|
|
2267
|
+
};
|
|
2268
|
+
window.addEventListener('scroll', handleViewportChange, true);
|
|
2269
|
+
window.addEventListener('resize', handleViewportChange);
|
|
2270
|
+
(_window$visualViewpor = window.visualViewport) == null || _window$visualViewpor.addEventListener('resize', handleViewportChange);
|
|
2271
|
+
(_window$visualViewpor2 = window.visualViewport) == null || _window$visualViewpor2.addEventListener('scroll', handleViewportChange);
|
|
2272
|
+
notify();
|
|
2273
|
+
return () => {
|
|
2274
|
+
var _window$visualViewpor3, _window$visualViewpor4;
|
|
2275
|
+
observer.disconnect();
|
|
2276
|
+
window.removeEventListener('scroll', handleViewportChange, true);
|
|
2277
|
+
window.removeEventListener('resize', handleViewportChange);
|
|
2278
|
+
(_window$visualViewpor3 = window.visualViewport) == null || _window$visualViewpor3.removeEventListener('resize', handleViewportChange);
|
|
2279
|
+
(_window$visualViewpor4 = window.visualViewport) == null || _window$visualViewpor4.removeEventListener('scroll', handleViewportChange);
|
|
2280
|
+
};
|
|
2281
|
+
};
|
|
2282
|
+
|
|
2283
|
+
const _excluded$3 = ["className", "dataSource", "columns", "rowKey", "rowSelection", "valueIsEmpty", "emptyIsPlaceholder", "placeholder", "empty", "onRowSelect", "render", "context", "sticky", "scrollTopInset", "stickyOffset", "getStickyContainer", "headerStyle", "pagination", "sortRender", "name", "controllerOpen", "tableServerApis", "scroll", "summary"],
|
|
2038
2284
|
_excluded2$2 = ["getContainer"];
|
|
2039
2285
|
const mapJustifyToAlign = justify => {
|
|
2040
2286
|
if (justify === 'center') {
|
|
@@ -2100,6 +2346,7 @@ const Table = p => {
|
|
|
2100
2346
|
render,
|
|
2101
2347
|
context,
|
|
2102
2348
|
sticky,
|
|
2349
|
+
scrollTopInset,
|
|
2103
2350
|
stickyOffset,
|
|
2104
2351
|
getStickyContainer,
|
|
2105
2352
|
headerStyle,
|
|
@@ -2352,6 +2599,20 @@ const Table = p => {
|
|
|
2352
2599
|
} : {}, scroll);
|
|
2353
2600
|
}, [hasFixedColumn, controllerOpen, totalWidth, tableWidth, scroll]);
|
|
2354
2601
|
const hasScrollY = (scroll == null ? void 0 : scroll.y) != null && (scroll == null ? void 0 : scroll.y) !== false;
|
|
2602
|
+
const isStickyViewport = !!sticky && !hasScrollY;
|
|
2603
|
+
const resolvedScrollTopInset = resolveScrollTopInset(scrollTopInset, stickyOffset);
|
|
2604
|
+
const stickyGetContainer = useMemo(() => {
|
|
2605
|
+
if (!getStickyContainer || hasScrollY) {
|
|
2606
|
+
return undefined;
|
|
2607
|
+
}
|
|
2608
|
+
return () => getStickyContainer() || window;
|
|
2609
|
+
}, [getStickyContainer, hasScrollY]);
|
|
2610
|
+
const parsedScrollTopInset = useMemo(() => {
|
|
2611
|
+
if (!sticky || hasScrollY) {
|
|
2612
|
+
return 0;
|
|
2613
|
+
}
|
|
2614
|
+
return parseInsetPixels(resolvedScrollTopInset, tableRef.current);
|
|
2615
|
+
}, [sticky, hasScrollY, resolvedScrollTopInset, isLayout, dataSource]);
|
|
2355
2616
|
const antdSticky = useMemo(() => {
|
|
2356
2617
|
if (!sticky) {
|
|
2357
2618
|
return undefined;
|
|
@@ -2364,19 +2625,20 @@ const Table = p => {
|
|
|
2364
2625
|
}, scrollSticky);
|
|
2365
2626
|
}
|
|
2366
2627
|
return Object.assign({
|
|
2367
|
-
offsetHeader:
|
|
2368
|
-
}, config,
|
|
2369
|
-
getContainer:
|
|
2628
|
+
offsetHeader: parsedScrollTopInset
|
|
2629
|
+
}, config, stickyGetContainer ? {
|
|
2630
|
+
getContainer: stickyGetContainer
|
|
2370
2631
|
} : null);
|
|
2371
|
-
}, [sticky,
|
|
2632
|
+
}, [sticky, stickyGetContainer, hasScrollY, parsedScrollTopInset]);
|
|
2372
2633
|
const tableWrapperStyle = useMemo(() => {
|
|
2373
|
-
|
|
2634
|
+
const cssValue = normalizeScrollTopInsetCSSValue(resolvedScrollTopInset);
|
|
2635
|
+
if (!cssValue) {
|
|
2374
2636
|
return undefined;
|
|
2375
2637
|
}
|
|
2376
2638
|
return {
|
|
2377
|
-
'--
|
|
2639
|
+
'--scroll-top-inset': cssValue
|
|
2378
2640
|
};
|
|
2379
|
-
}, [
|
|
2641
|
+
}, [resolvedScrollTopInset]);
|
|
2380
2642
|
const tableElement = /*#__PURE__*/jsx(Table$1, _extends({}, others, {
|
|
2381
2643
|
showHeader: true,
|
|
2382
2644
|
dataSource: dataSource,
|
|
@@ -2421,14 +2683,14 @@ const Table = p => {
|
|
|
2421
2683
|
}));
|
|
2422
2684
|
const wrappedTable = /*#__PURE__*/jsxs("div", {
|
|
2423
2685
|
ref: tableRef,
|
|
2424
|
-
className: classnames(style$
|
|
2686
|
+
className: classnames(style$4['table'], 'info-page-table', className, {
|
|
2425
2687
|
[style$4['is-resize']]: currentMoveColumnIndex !== null,
|
|
2426
2688
|
[style$4['is-computed']]: isLayout,
|
|
2427
2689
|
[style$4['has-group-header']]: hasGroupHeader,
|
|
2428
2690
|
[style$4['has-summary']]: typeof summary === 'function',
|
|
2429
2691
|
[style$4['is-sticky']]: !!sticky,
|
|
2430
2692
|
[style$4['is-sticky-scroll-y']]: !!sticky && hasScrollY,
|
|
2431
|
-
[style$4['is-sticky-viewport']]:
|
|
2693
|
+
[style$4['is-sticky-viewport']]: isStickyViewport
|
|
2432
2694
|
}),
|
|
2433
2695
|
style: tableWrapperStyle,
|
|
2434
2696
|
children: [/*#__PURE__*/jsx("div", {
|
|
@@ -2818,136 +3080,47 @@ TableView.useSelectedRow = useSelectedRow;
|
|
|
2818
3080
|
TableView.useSort = useSort;
|
|
2819
3081
|
TableView.sortDataSource = useSort.sortDataSource;
|
|
2820
3082
|
|
|
2821
|
-
var style$1 = {"table-page":"kne-table-page_ut9rJ","table-content":"kne-table-page_dxN6N","table-with-toolbar":"kne-table-page_sf06r","table-in-toolbar":"kne-table-page_sawIT","pagination":"kne-table-page_DSTEf","total_text":"kne-table-page_pJhKr","floating-scrollbar":"kne-table-page_iu8E1","floating-scrollbar-thumb":"kne-table-page_RjZsu","is-moving":"kne-table-page_y-4Ou"};
|
|
2822
|
-
|
|
2823
|
-
const parsePixelValue = value => {
|
|
2824
|
-
const num = parseFloat(value);
|
|
2825
|
-
return Number.isNaN(num) ? 0 : num;
|
|
2826
|
-
};
|
|
2827
|
-
const getViewportRect = () => {
|
|
2828
|
-
const visualViewport = window.visualViewport;
|
|
2829
|
-
if (visualViewport) {
|
|
2830
|
-
return {
|
|
2831
|
-
top: visualViewport.offsetTop,
|
|
2832
|
-
bottom: visualViewport.offsetTop + visualViewport.height,
|
|
2833
|
-
left: visualViewport.offsetLeft,
|
|
2834
|
-
right: visualViewport.offsetLeft + visualViewport.width,
|
|
2835
|
-
height: visualViewport.height
|
|
2836
|
-
};
|
|
2837
|
-
}
|
|
2838
|
-
return {
|
|
2839
|
-
top: 0,
|
|
2840
|
-
bottom: window.innerHeight,
|
|
2841
|
-
left: 0,
|
|
2842
|
-
right: window.innerWidth,
|
|
2843
|
-
height: window.innerHeight
|
|
2844
|
-
};
|
|
2845
|
-
};
|
|
2846
|
-
const getTableElement = root => {
|
|
2847
|
-
if (!root) {
|
|
2848
|
-
return null;
|
|
2849
|
-
}
|
|
2850
|
-
return root.querySelector('.info-page-table') || root;
|
|
2851
|
-
};
|
|
2852
|
-
const getTableScrollElement = root => {
|
|
2853
|
-
if (!root) {
|
|
2854
|
-
return null;
|
|
2855
|
-
}
|
|
2856
|
-
return root.querySelector('.ant-table-body') || root.querySelector('.ant-table-content');
|
|
2857
|
-
};
|
|
2858
|
-
const getElementViewportState = element => {
|
|
2859
|
-
if (!element) {
|
|
2860
|
-
return {
|
|
2861
|
-
isBottomInViewport: true,
|
|
2862
|
-
isPartiallyInViewport: false,
|
|
2863
|
-
isTopInViewport: true,
|
|
2864
|
-
rect: null,
|
|
2865
|
-
viewport: getViewportRect()
|
|
2866
|
-
};
|
|
2867
|
-
}
|
|
2868
|
-
const rect = element.getBoundingClientRect();
|
|
2869
|
-
const viewport = getViewportRect();
|
|
2870
|
-
return {
|
|
2871
|
-
isBottomInViewport: rect.bottom > viewport.top && rect.bottom <= viewport.bottom,
|
|
2872
|
-
isPartiallyInViewport: rect.top < viewport.bottom && rect.bottom > viewport.top,
|
|
2873
|
-
isTopInViewport: rect.top >= viewport.top && rect.top < viewport.bottom,
|
|
2874
|
-
rect,
|
|
2875
|
-
viewport
|
|
2876
|
-
};
|
|
2877
|
-
};
|
|
2878
|
-
const isTopEdgeInViewport = (element, scrollMarginTop = 0) => {
|
|
2879
|
-
const {
|
|
2880
|
-
isTopInViewport,
|
|
2881
|
-
rect,
|
|
2882
|
-
viewport
|
|
2883
|
-
} = getElementViewportState(element);
|
|
2884
|
-
if (!rect) {
|
|
2885
|
-
return true;
|
|
2886
|
-
}
|
|
2887
|
-
const viewportTop = viewport.top + scrollMarginTop;
|
|
2888
|
-
return rect.top >= viewportTop && rect.top < viewport.bottom;
|
|
2889
|
-
};
|
|
2890
|
-
const shouldShowFloatingScrollbar = (scrollEl, viewportState) => {
|
|
2891
|
-
if (!scrollEl || scrollEl.scrollWidth <= scrollEl.clientWidth + 1) {
|
|
2892
|
-
return false;
|
|
2893
|
-
}
|
|
2894
|
-
const state = viewportState || getElementViewportState(scrollEl);
|
|
2895
|
-
if (!state.isPartiallyInViewport) {
|
|
2896
|
-
return false;
|
|
2897
|
-
}
|
|
2898
|
-
return !state.isBottomInViewport;
|
|
2899
|
-
};
|
|
2900
|
-
const observeViewportIntersection = (element, onChange) => {
|
|
2901
|
-
var _window$visualViewpor, _window$visualViewpor2;
|
|
2902
|
-
if (!element) {
|
|
2903
|
-
return () => {};
|
|
2904
|
-
}
|
|
2905
|
-
const notify = entry => {
|
|
2906
|
-
onChange(getElementViewportState(element));
|
|
2907
|
-
};
|
|
2908
|
-
const observer = new IntersectionObserver(([entry]) => {
|
|
2909
|
-
notify();
|
|
2910
|
-
}, {
|
|
2911
|
-
root: null,
|
|
2912
|
-
threshold: [0, 0.01, 0.25, 0.5, 0.75, 1]
|
|
2913
|
-
});
|
|
2914
|
-
observer.observe(element);
|
|
2915
|
-
const handleViewportChange = () => {
|
|
2916
|
-
notify();
|
|
2917
|
-
};
|
|
2918
|
-
window.addEventListener('scroll', handleViewportChange, true);
|
|
2919
|
-
window.addEventListener('resize', handleViewportChange);
|
|
2920
|
-
(_window$visualViewpor = window.visualViewport) == null || _window$visualViewpor.addEventListener('resize', handleViewportChange);
|
|
2921
|
-
(_window$visualViewpor2 = window.visualViewport) == null || _window$visualViewpor2.addEventListener('scroll', handleViewportChange);
|
|
2922
|
-
notify();
|
|
2923
|
-
return () => {
|
|
2924
|
-
var _window$visualViewpor3, _window$visualViewpor4;
|
|
2925
|
-
observer.disconnect();
|
|
2926
|
-
window.removeEventListener('scroll', handleViewportChange, true);
|
|
2927
|
-
window.removeEventListener('resize', handleViewportChange);
|
|
2928
|
-
(_window$visualViewpor3 = window.visualViewport) == null || _window$visualViewpor3.removeEventListener('resize', handleViewportChange);
|
|
2929
|
-
(_window$visualViewpor4 = window.visualViewport) == null || _window$visualViewpor4.removeEventListener('scroll', handleViewportChange);
|
|
2930
|
-
};
|
|
2931
|
-
};
|
|
3083
|
+
var style$1 = {"table-page":"kne-table-page_ut9rJ","table-content":"kne-table-page_dxN6N","table-with-toolbar":"kne-table-page_sf06r","has-summary":"kne-table-page_IRdzb","table-in-toolbar":"kne-table-page_sawIT","pagination":"kne-table-page_DSTEf","total_text":"kne-table-page_pJhKr","floating-scrollbar":"kne-table-page_iu8E1","floating-scrollbar-embedded":"kne-table-page_PIv-C","floating-scrollbar-thumb":"kne-table-page_RjZsu","is-moving":"kne-table-page_y-4Ou"};
|
|
2932
3084
|
|
|
2933
3085
|
const BAR_HEIGHT = 15;
|
|
2934
3086
|
const THUMB_MARGIN = 2;
|
|
2935
|
-
const computeBarMetrics = (scrollEl, viewportState) => {
|
|
3087
|
+
const computeBarMetrics = (scrollEl, viewportState, getPortalContainer) => {
|
|
2936
3088
|
const rect = scrollEl.getBoundingClientRect();
|
|
2937
|
-
const
|
|
3089
|
+
const portalContainer = typeof getPortalContainer === 'function' ? getPortalContainer() : null;
|
|
3090
|
+
const useEmbeddedPlacement = !isDocumentScrollContainer(portalContainer);
|
|
2938
3091
|
const trackWidth = rect.width;
|
|
2939
3092
|
const thumbWidth = Math.max(trackWidth * scrollEl.clientWidth / scrollEl.scrollWidth - THUMB_MARGIN * 2, 24);
|
|
2940
3093
|
const maxThumbOffset = trackWidth - thumbWidth - THUMB_MARGIN * 2;
|
|
2941
3094
|
const scrollRatio = scrollEl.scrollWidth > scrollEl.clientWidth ? scrollEl.scrollLeft / (scrollEl.scrollWidth - scrollEl.clientWidth) : 0;
|
|
3095
|
+
const visible = shouldShowFloatingScrollbar(scrollEl, viewportState, getPortalContainer);
|
|
3096
|
+
if (useEmbeddedPlacement) {
|
|
3097
|
+
const containerRect = portalContainer.getBoundingClientRect();
|
|
3098
|
+
return {
|
|
3099
|
+
placement: 'embedded',
|
|
3100
|
+
offsetLeft: Math.round(rect.left - containerRect.left),
|
|
3101
|
+
width: Math.round(trackWidth),
|
|
3102
|
+
thumbWidth,
|
|
3103
|
+
thumbLeft: THUMB_MARGIN + maxThumbOffset * scrollRatio,
|
|
3104
|
+
visible
|
|
3105
|
+
};
|
|
3106
|
+
}
|
|
3107
|
+
const viewport = getViewportRect();
|
|
2942
3108
|
return {
|
|
2943
|
-
|
|
2944
|
-
|
|
3109
|
+
placement: 'fixed',
|
|
3110
|
+
left: Math.round(rect.left),
|
|
3111
|
+
width: Math.round(trackWidth),
|
|
2945
3112
|
bottom: window.innerHeight - viewport.bottom,
|
|
2946
3113
|
thumbWidth,
|
|
2947
3114
|
thumbLeft: THUMB_MARGIN + maxThumbOffset * scrollRatio,
|
|
2948
|
-
visible
|
|
3115
|
+
visible
|
|
2949
3116
|
};
|
|
2950
3117
|
};
|
|
3118
|
+
const metricsEqual = (prev, next) => {
|
|
3119
|
+
if (!prev || !next) {
|
|
3120
|
+
return prev === next;
|
|
3121
|
+
}
|
|
3122
|
+
return prev.placement === next.placement && prev.visible === next.visible && prev.width === next.width && prev.thumbWidth === next.thumbWidth && prev.thumbLeft === next.thumbLeft && (prev.placement === 'embedded' ? prev.offsetLeft === next.offsetLeft : prev.left === next.left && prev.bottom === next.bottom);
|
|
3123
|
+
};
|
|
2951
3124
|
const FloatingScrollBar = ({
|
|
2952
3125
|
metrics,
|
|
2953
3126
|
onThumbDrag,
|
|
@@ -2982,10 +3155,18 @@ const FloatingScrollBar = ({
|
|
|
2982
3155
|
if (!(metrics != null && metrics.visible)) {
|
|
2983
3156
|
return null;
|
|
2984
3157
|
}
|
|
2985
|
-
const
|
|
3158
|
+
const portalContainer = typeof getPortalContainer === 'function' ? getPortalContainer() : null;
|
|
3159
|
+
const useEmbeddedPlacement = metrics.placement === 'embedded';
|
|
3160
|
+
const portalTarget = useEmbeddedPlacement && portalContainer ? portalContainer : document.body;
|
|
2986
3161
|
return /*#__PURE__*/createPortal(/*#__PURE__*/jsx("div", {
|
|
2987
|
-
className: classnames(style$1['floating-scrollbar'], 'table-page-floating-scrollbar'
|
|
2988
|
-
|
|
3162
|
+
className: classnames(style$1['floating-scrollbar'], 'table-page-floating-scrollbar', {
|
|
3163
|
+
[style$1['floating-scrollbar-embedded']]: useEmbeddedPlacement
|
|
3164
|
+
}),
|
|
3165
|
+
style: useEmbeddedPlacement ? {
|
|
3166
|
+
marginLeft: metrics.offsetLeft,
|
|
3167
|
+
width: metrics.width,
|
|
3168
|
+
height: BAR_HEIGHT
|
|
3169
|
+
} : {
|
|
2989
3170
|
left: metrics.left,
|
|
2990
3171
|
width: metrics.width,
|
|
2991
3172
|
height: BAR_HEIGHT,
|
|
@@ -3017,6 +3198,7 @@ const HorizontalScroller = /*#__PURE__*/forwardRef(({
|
|
|
3017
3198
|
const containerRef = useRef(null);
|
|
3018
3199
|
const scrollElRef = useRef(null);
|
|
3019
3200
|
const viewportStateRef = useRef(null);
|
|
3201
|
+
const metricsRef = useRef(null);
|
|
3020
3202
|
const setContainerRef = useRefCallback(node => {
|
|
3021
3203
|
containerRef.current = node;
|
|
3022
3204
|
if (typeof forwardedRef === 'function') {
|
|
@@ -3028,10 +3210,16 @@ const HorizontalScroller = /*#__PURE__*/forwardRef(({
|
|
|
3028
3210
|
const updateMetrics = useRefCallback(() => {
|
|
3029
3211
|
const scrollEl = scrollElRef.current;
|
|
3030
3212
|
if (!scrollEl) {
|
|
3213
|
+
metricsRef.current = null;
|
|
3031
3214
|
setMetrics(null);
|
|
3032
3215
|
return;
|
|
3033
3216
|
}
|
|
3034
|
-
|
|
3217
|
+
const nextMetrics = computeBarMetrics(scrollEl, viewportStateRef.current, getPortalContainer);
|
|
3218
|
+
if (metricsEqual(metricsRef.current, nextMetrics)) {
|
|
3219
|
+
return;
|
|
3220
|
+
}
|
|
3221
|
+
metricsRef.current = nextMetrics;
|
|
3222
|
+
setMetrics(nextMetrics);
|
|
3035
3223
|
});
|
|
3036
3224
|
const handleThumbDrag = useRefCallback(deltaX => {
|
|
3037
3225
|
const scrollEl = scrollElRef.current;
|
|
@@ -3052,6 +3240,7 @@ const HorizontalScroller = /*#__PURE__*/forwardRef(({
|
|
|
3052
3240
|
if (!_enabled) {
|
|
3053
3241
|
scrollElRef.current = null;
|
|
3054
3242
|
viewportStateRef.current = null;
|
|
3243
|
+
metricsRef.current = null;
|
|
3055
3244
|
setMetrics(null);
|
|
3056
3245
|
return undefined;
|
|
3057
3246
|
}
|
|
@@ -3062,6 +3251,8 @@ const HorizontalScroller = /*#__PURE__*/forwardRef(({
|
|
|
3062
3251
|
let scrollEl = null;
|
|
3063
3252
|
let unobserveViewport = null;
|
|
3064
3253
|
let contentResizeObserver = null;
|
|
3254
|
+
const portalContainer = typeof getPortalContainer === 'function' ? getPortalContainer() : null;
|
|
3255
|
+
const useEmbeddedPlacement = !isDocumentScrollContainer(portalContainer);
|
|
3065
3256
|
const detachScrollEl = () => {
|
|
3066
3257
|
var _contentResizeObserve;
|
|
3067
3258
|
unobserveViewport == null || unobserveViewport();
|
|
@@ -3083,10 +3274,12 @@ const HorizontalScroller = /*#__PURE__*/forwardRef(({
|
|
|
3083
3274
|
detachScrollEl();
|
|
3084
3275
|
scrollEl = nextScrollEl;
|
|
3085
3276
|
scrollElRef.current = scrollEl;
|
|
3086
|
-
|
|
3087
|
-
|
|
3088
|
-
|
|
3089
|
-
|
|
3277
|
+
if (!useEmbeddedPlacement) {
|
|
3278
|
+
unobserveViewport = observeViewportIntersection(scrollEl, state => {
|
|
3279
|
+
viewportStateRef.current = state;
|
|
3280
|
+
updateMetrics();
|
|
3281
|
+
});
|
|
3282
|
+
}
|
|
3090
3283
|
scrollEl.addEventListener('scroll', updateMetrics, {
|
|
3091
3284
|
passive: true
|
|
3092
3285
|
});
|
|
@@ -3103,11 +3296,40 @@ const HorizontalScroller = /*#__PURE__*/forwardRef(({
|
|
|
3103
3296
|
const containerResizeObserver = new ResizeObserver(onLayoutChange);
|
|
3104
3297
|
containerResizeObserver.observe(root);
|
|
3105
3298
|
onLayoutChange();
|
|
3299
|
+
const onWindowChange = () => {
|
|
3300
|
+
if (!useEmbeddedPlacement) {
|
|
3301
|
+
updateMetrics();
|
|
3302
|
+
}
|
|
3303
|
+
};
|
|
3304
|
+
if (!useEmbeddedPlacement) {
|
|
3305
|
+
var _window$visualViewpor, _window$visualViewpor2;
|
|
3306
|
+
window.addEventListener('scroll', onWindowChange, true);
|
|
3307
|
+
window.addEventListener('resize', onWindowChange);
|
|
3308
|
+
(_window$visualViewpor = window.visualViewport) == null || _window$visualViewpor.addEventListener('resize', onWindowChange);
|
|
3309
|
+
(_window$visualViewpor2 = window.visualViewport) == null || _window$visualViewpor2.addEventListener('scroll', onWindowChange);
|
|
3310
|
+
}
|
|
3311
|
+
if (useEmbeddedPlacement && portalContainer) {
|
|
3312
|
+
portalContainer.addEventListener('scroll', updateMetrics, {
|
|
3313
|
+
passive: true
|
|
3314
|
+
});
|
|
3315
|
+
window.addEventListener('resize', updateMetrics);
|
|
3316
|
+
}
|
|
3106
3317
|
return () => {
|
|
3107
3318
|
detachScrollEl();
|
|
3108
3319
|
containerResizeObserver.disconnect();
|
|
3320
|
+
if (!useEmbeddedPlacement) {
|
|
3321
|
+
var _window$visualViewpor3, _window$visualViewpor4;
|
|
3322
|
+
window.removeEventListener('scroll', onWindowChange, true);
|
|
3323
|
+
window.removeEventListener('resize', onWindowChange);
|
|
3324
|
+
(_window$visualViewpor3 = window.visualViewport) == null || _window$visualViewpor3.removeEventListener('resize', onWindowChange);
|
|
3325
|
+
(_window$visualViewpor4 = window.visualViewport) == null || _window$visualViewpor4.removeEventListener('scroll', onWindowChange);
|
|
3326
|
+
}
|
|
3327
|
+
if (useEmbeddedPlacement && portalContainer) {
|
|
3328
|
+
portalContainer.removeEventListener('scroll', updateMetrics);
|
|
3329
|
+
window.removeEventListener('resize', updateMetrics);
|
|
3330
|
+
}
|
|
3109
3331
|
};
|
|
3110
|
-
}, [_enabled, updateMetrics]);
|
|
3332
|
+
}, [_enabled, updateMetrics, getPortalContainer]);
|
|
3111
3333
|
return /*#__PURE__*/jsxs(Fragment, {
|
|
3112
3334
|
children: [/*#__PURE__*/jsx("div", {
|
|
3113
3335
|
ref: setContainerRef,
|
|
@@ -3202,7 +3424,7 @@ const TableToolbar = ({
|
|
|
3202
3424
|
'table-page-toolbar-section--has-value': hasValueDisplay
|
|
3203
3425
|
}),
|
|
3204
3426
|
children: [/*#__PURE__*/jsxs("div", {
|
|
3205
|
-
className: style['table-toolbar'],
|
|
3427
|
+
className: classnames(style['table-toolbar'], 'table-page-toolbar'),
|
|
3206
3428
|
children: [showBatch ? /*#__PURE__*/jsxs(Fragment, {
|
|
3207
3429
|
children: [/*#__PURE__*/jsx("div", {
|
|
3208
3430
|
className: style['table-toolbar-batch'],
|
|
@@ -3267,7 +3489,7 @@ const TableToolbar = ({
|
|
|
3267
3489
|
});
|
|
3268
3490
|
};
|
|
3269
3491
|
|
|
3270
|
-
const _excluded = ["data", "refresh", "reload", "requestParams", "fetchProps", "isComplete", "loadMore", "send", "dataFormat", "className", "columns", "getColumns", "pagination", "columnRenderProps", "summary", "sticky", "renderType", "horizontalScroller", "getScrollContainer", "filter", "search", "batchActions", "selectedRows", "rowSelection"],
|
|
3492
|
+
const _excluded = ["data", "refresh", "reload", "requestParams", "fetchProps", "isComplete", "loadMore", "send", "dataFormat", "className", "columns", "getColumns", "pagination", "columnRenderProps", "summary", "sticky", "scrollTopInset", "stickyOffset", "renderType", "horizontalScroller", "getScrollContainer", "filter", "search", "batchActions", "selectedRows", "rowSelection"],
|
|
3271
3493
|
_excluded2 = ["pagination", "horizontalScroller", "getScrollContainer"];
|
|
3272
3494
|
const readPageSize = key => {
|
|
3273
3495
|
try {
|
|
@@ -3288,27 +3510,6 @@ const writePageSize = (key, size) => {
|
|
|
3288
3510
|
// ignore quota errors
|
|
3289
3511
|
}
|
|
3290
3512
|
};
|
|
3291
|
-
const isTableTopInViewport = target => {
|
|
3292
|
-
const scrollMarginTop = parsePixelValue(getComputedStyle(target).scrollMarginTop);
|
|
3293
|
-
return isTopEdgeInViewport(target, scrollMarginTop);
|
|
3294
|
-
};
|
|
3295
|
-
const scrollTableIntoView = root => {
|
|
3296
|
-
const target = getTableElement(root);
|
|
3297
|
-
if (!target) {
|
|
3298
|
-
return;
|
|
3299
|
-
}
|
|
3300
|
-
requestAnimationFrame(() => {
|
|
3301
|
-
requestAnimationFrame(() => {
|
|
3302
|
-
if (isTableTopInViewport(target)) {
|
|
3303
|
-
return;
|
|
3304
|
-
}
|
|
3305
|
-
target.scrollIntoView({
|
|
3306
|
-
block: 'start',
|
|
3307
|
-
inline: 'nearest'
|
|
3308
|
-
});
|
|
3309
|
-
});
|
|
3310
|
-
});
|
|
3311
|
-
};
|
|
3312
3513
|
const TABLE_COMPONENTS = {
|
|
3313
3514
|
Table,
|
|
3314
3515
|
TableView
|
|
@@ -3366,6 +3567,8 @@ const TablePageInnerContent = withLocale(_ref => {
|
|
|
3366
3567
|
columnRenderProps = {},
|
|
3367
3568
|
summary,
|
|
3368
3569
|
sticky,
|
|
3570
|
+
scrollTopInset,
|
|
3571
|
+
stickyOffset,
|
|
3369
3572
|
renderType = 'Table',
|
|
3370
3573
|
horizontalScroller = true,
|
|
3371
3574
|
getScrollContainer,
|
|
@@ -3408,8 +3611,22 @@ const TablePageInnerContent = withLocale(_ref => {
|
|
|
3408
3611
|
dataFormat,
|
|
3409
3612
|
pagination
|
|
3410
3613
|
}), [data, fetchProps, requestParams, refresh, reload, loadMore, send, dataFormat, pagination]);
|
|
3614
|
+
const hasToolbar = !!(filter != null && (_filter$list = filter.list) != null && _filter$list.length || search && search.name || batchActions && batchActions.length);
|
|
3615
|
+
const resolvedScrollTopInset = resolveScrollTopInset(scrollTopInset, stickyOffset);
|
|
3616
|
+
const scrollTopInsetStyle = useMemo(() => {
|
|
3617
|
+
const cssValue = normalizeScrollTopInsetCSSValue(resolvedScrollTopInset);
|
|
3618
|
+
if (!cssValue) {
|
|
3619
|
+
return undefined;
|
|
3620
|
+
}
|
|
3621
|
+
return {
|
|
3622
|
+
'--scroll-top-inset': cssValue
|
|
3623
|
+
};
|
|
3624
|
+
}, [resolvedScrollTopInset]);
|
|
3411
3625
|
const scrollTable = useRefCallback(() => {
|
|
3412
|
-
|
|
3626
|
+
scrollAnchorIntoView(tableContentRef.current, {
|
|
3627
|
+
getScrollContainer,
|
|
3628
|
+
preferToolbar: hasToolbar
|
|
3629
|
+
});
|
|
3413
3630
|
});
|
|
3414
3631
|
const handleFilterChange = useRefCallback(value => {
|
|
3415
3632
|
if (!isFilterControlled) {
|
|
@@ -3463,7 +3680,7 @@ const TablePageInnerContent = withLocale(_ref => {
|
|
|
3463
3680
|
})]
|
|
3464
3681
|
}),
|
|
3465
3682
|
current: get(requestParams, [pagination.paramsType, pagination.currentName], 1),
|
|
3466
|
-
pageSize: Number(get(requestParams, [pagination.paramsType, pagination.pageSizeName], pagination.pageSize)) || pagination.pageSize ||
|
|
3683
|
+
pageSize: Number(get(requestParams, [pagination.paramsType, pagination.pageSizeName], pagination.pageSize)) || pagination.pageSize || 50,
|
|
3467
3684
|
onChange: handlePaginationChange,
|
|
3468
3685
|
size: pagination.size,
|
|
3469
3686
|
hideOnSinglePage: pagination.hideOnSinglePage,
|
|
@@ -3472,7 +3689,6 @@ const TablePageInnerContent = withLocale(_ref => {
|
|
|
3472
3689
|
pageSizeOptions: pagination.pageSizeOptions
|
|
3473
3690
|
};
|
|
3474
3691
|
}, [pagination, formatData.total, requestParams, formatMessage, handlePaginationChange]);
|
|
3475
|
-
const hasToolbar = !!(filter != null && (_filter$list = filter.list) != null && _filter$list.length || search && search.name || batchActions && batchActions.length);
|
|
3476
3692
|
const batchContext = useMemo(() => ({
|
|
3477
3693
|
data,
|
|
3478
3694
|
fetchProps,
|
|
@@ -3494,6 +3710,7 @@ const TablePageInnerContent = withLocale(_ref => {
|
|
|
3494
3710
|
dataSource: formatData.list,
|
|
3495
3711
|
pagination: false,
|
|
3496
3712
|
sticky,
|
|
3713
|
+
scrollTopInset: resolvedScrollTopInset,
|
|
3497
3714
|
getStickyContainer: getScrollContainer,
|
|
3498
3715
|
className: classnames(className, {
|
|
3499
3716
|
[style$1['table-in-toolbar']]: hasToolbar
|
|
@@ -3511,6 +3728,7 @@ const TablePageInnerContent = withLocale(_ref => {
|
|
|
3511
3728
|
const tableElement = /*#__PURE__*/jsx(TableComponent, _extends({}, tableProps));
|
|
3512
3729
|
return /*#__PURE__*/jsxs("div", {
|
|
3513
3730
|
className: style$1['table-page'],
|
|
3731
|
+
style: scrollTopInsetStyle,
|
|
3514
3732
|
children: [/*#__PURE__*/jsx(HorizontalScroller, {
|
|
3515
3733
|
ref: tableContentRef,
|
|
3516
3734
|
enabled: horizontalScroller && renderType === 'Table',
|
|
@@ -3553,12 +3771,13 @@ const TablePage = /*#__PURE__*/forwardRef((_ref2, ref) => {
|
|
|
3553
3771
|
requestType: 'reload',
|
|
3554
3772
|
currentName: 'currentPage',
|
|
3555
3773
|
pageSizeName: 'perPage',
|
|
3556
|
-
pageSize:
|
|
3774
|
+
pageSize: 50
|
|
3557
3775
|
}, pagination);
|
|
3558
3776
|
const pageSizeKey = `${(props.name || 'common').toUpperCase()}_TABLE_PAGE_SIZE`;
|
|
3777
|
+
const cachePageSize = pagination.cachePageSize !== false;
|
|
3559
3778
|
const [pageSize, setPageSize] = useState(() => {
|
|
3560
|
-
var
|
|
3561
|
-
return (
|
|
3779
|
+
var _ref3;
|
|
3780
|
+
return (_ref3 = cachePageSize ? readPageSize(pageSizeKey) : null) != null ? _ref3 : pagination.pageSize;
|
|
3562
3781
|
});
|
|
3563
3782
|
const params = props[pagination.paramsType];
|
|
3564
3783
|
const filterDefaultParams = useMemo(() => {
|
|
@@ -3583,7 +3802,9 @@ const TablePage = /*#__PURE__*/forwardRef((_ref2, ref) => {
|
|
|
3583
3802
|
pageSize,
|
|
3584
3803
|
onShowSizeChange: (current, size) => {
|
|
3585
3804
|
const nextSize = Number(size);
|
|
3586
|
-
|
|
3805
|
+
if (cachePageSize) {
|
|
3806
|
+
writePageSize(pageSizeKey, nextSize);
|
|
3807
|
+
}
|
|
3587
3808
|
setPageSize(nextSize);
|
|
3588
3809
|
}
|
|
3589
3810
|
}),
|