@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.js
CHANGED
|
@@ -1082,7 +1082,7 @@ const computeColumnsDisplay = ({
|
|
|
1082
1082
|
computeColumnsValue.computeDisplay = computeDisplay;
|
|
1083
1083
|
computeColumnsValue.computeColumnsDisplay = computeColumnsDisplay;
|
|
1084
1084
|
|
|
1085
|
-
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","
|
|
1085
|
+
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"};
|
|
1086
1086
|
|
|
1087
1087
|
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"};
|
|
1088
1088
|
|
|
@@ -2094,7 +2094,251 @@ const getColumnEllipsis = column => {
|
|
|
2094
2094
|
return typeof column.ellipsis === 'object' ? column.ellipsis : true;
|
|
2095
2095
|
};
|
|
2096
2096
|
|
|
2097
|
-
const
|
|
2097
|
+
const parsePixelValue = value => {
|
|
2098
|
+
const num = parseFloat(value);
|
|
2099
|
+
return Number.isNaN(num) ? 0 : num;
|
|
2100
|
+
};
|
|
2101
|
+
const isDocumentScrollContainer = container => {
|
|
2102
|
+
return !container || container === document.body || container === document.documentElement || container === document.scrollingElement;
|
|
2103
|
+
};
|
|
2104
|
+
const normalizeScrollTopInsetCSSValue = value => {
|
|
2105
|
+
if (value == null) {
|
|
2106
|
+
return undefined;
|
|
2107
|
+
}
|
|
2108
|
+
if (typeof value === 'number') {
|
|
2109
|
+
return `${value}px`;
|
|
2110
|
+
}
|
|
2111
|
+
return String(value);
|
|
2112
|
+
};
|
|
2113
|
+
const resolveScrollTopInset = (scrollTopInset, stickyOffset) => scrollTopInset ?? stickyOffset;
|
|
2114
|
+
const parseInsetPixels = (inset, element) => {
|
|
2115
|
+
if (inset == null) {
|
|
2116
|
+
return 0;
|
|
2117
|
+
}
|
|
2118
|
+
if (typeof inset === 'number') {
|
|
2119
|
+
return inset;
|
|
2120
|
+
}
|
|
2121
|
+
if (typeof inset === 'string') {
|
|
2122
|
+
const trimmed = inset.trim();
|
|
2123
|
+
if (trimmed.endsWith('px')) {
|
|
2124
|
+
return parsePixelValue(trimmed);
|
|
2125
|
+
}
|
|
2126
|
+
const variableMatch = trimmed.match(/var\(\s*(--[^,\s)]+)/);
|
|
2127
|
+
if (variableMatch) {
|
|
2128
|
+
return readCssVariableLength(element, variableMatch[1], '0px');
|
|
2129
|
+
}
|
|
2130
|
+
}
|
|
2131
|
+
return 0;
|
|
2132
|
+
};
|
|
2133
|
+
const readScrollTopInsetPixels = element => {
|
|
2134
|
+
const fromVar = readCssVariableLength(element, '--scroll-top-inset', '0px') || readCssVariableLength(element, '--sticky-offset', '0px') || readCssVariableLength(element, '--nav-height', '0px');
|
|
2135
|
+
return fromVar;
|
|
2136
|
+
};
|
|
2137
|
+
const getViewportRect = () => {
|
|
2138
|
+
const visualViewport = window.visualViewport;
|
|
2139
|
+
if (visualViewport) {
|
|
2140
|
+
return {
|
|
2141
|
+
top: visualViewport.offsetTop,
|
|
2142
|
+
bottom: visualViewport.offsetTop + visualViewport.height,
|
|
2143
|
+
left: visualViewport.offsetLeft,
|
|
2144
|
+
right: visualViewport.offsetLeft + visualViewport.width,
|
|
2145
|
+
height: visualViewport.height
|
|
2146
|
+
};
|
|
2147
|
+
}
|
|
2148
|
+
return {
|
|
2149
|
+
top: 0,
|
|
2150
|
+
bottom: window.innerHeight,
|
|
2151
|
+
left: 0,
|
|
2152
|
+
right: window.innerWidth,
|
|
2153
|
+
height: window.innerHeight
|
|
2154
|
+
};
|
|
2155
|
+
};
|
|
2156
|
+
const getTableElement = root => {
|
|
2157
|
+
if (!root) {
|
|
2158
|
+
return null;
|
|
2159
|
+
}
|
|
2160
|
+
return root.querySelector('.info-page-table') || root;
|
|
2161
|
+
};
|
|
2162
|
+
const getScrollAnchorElement = (root, {
|
|
2163
|
+
preferToolbar = false
|
|
2164
|
+
} = {}) => {
|
|
2165
|
+
if (!root) {
|
|
2166
|
+
return null;
|
|
2167
|
+
}
|
|
2168
|
+
if (preferToolbar) {
|
|
2169
|
+
return root.querySelector('.table-page-toolbar-section') || root.querySelector('.table-with-toolbar') || getTableElement(root);
|
|
2170
|
+
}
|
|
2171
|
+
return getTableElement(root);
|
|
2172
|
+
};
|
|
2173
|
+
const readCssVariableLength = (element, variableName, fallback = '0px') => {
|
|
2174
|
+
if (typeof document === 'undefined') {
|
|
2175
|
+
return 0;
|
|
2176
|
+
}
|
|
2177
|
+
const host = element || document.documentElement;
|
|
2178
|
+
const probe = document.createElement('div');
|
|
2179
|
+
probe.style.cssText = 'position:absolute;visibility:hidden;pointer-events:none;height:0;width:0;overflow:hidden;';
|
|
2180
|
+
probe.style.marginTop = `var(${variableName}, ${fallback})`;
|
|
2181
|
+
host.appendChild(probe);
|
|
2182
|
+
const value = parsePixelValue(getComputedStyle(probe).marginTop);
|
|
2183
|
+
host.removeChild(probe);
|
|
2184
|
+
return value;
|
|
2185
|
+
};
|
|
2186
|
+
const resolveScrollContainer = (element, getScrollContainer) => {
|
|
2187
|
+
const explicitContainer = typeof getScrollContainer === 'function' ? getScrollContainer() : null;
|
|
2188
|
+
if (explicitContainer) {
|
|
2189
|
+
return explicitContainer;
|
|
2190
|
+
}
|
|
2191
|
+
let parent = element?.parentElement;
|
|
2192
|
+
while (parent) {
|
|
2193
|
+
const {
|
|
2194
|
+
overflowY
|
|
2195
|
+
} = getComputedStyle(parent);
|
|
2196
|
+
if (/(auto|scroll|overlay)/.test(overflowY) && parent.scrollHeight > parent.clientHeight + 1) {
|
|
2197
|
+
return parent;
|
|
2198
|
+
}
|
|
2199
|
+
parent = parent.parentElement;
|
|
2200
|
+
}
|
|
2201
|
+
return document.scrollingElement || document.documentElement;
|
|
2202
|
+
};
|
|
2203
|
+
const scrollToElement = (element, {
|
|
2204
|
+
offsetTop = 0,
|
|
2205
|
+
getScrollContainer
|
|
2206
|
+
} = {}) => {
|
|
2207
|
+
const scrollContainer = resolveScrollContainer(element, getScrollContainer);
|
|
2208
|
+
const targetRect = element.getBoundingClientRect();
|
|
2209
|
+
if (scrollContainer === document.scrollingElement || scrollContainer === document.documentElement || scrollContainer === document.body) {
|
|
2210
|
+
const scrollTop = window.pageYOffset + targetRect.top - offsetTop;
|
|
2211
|
+
window.scrollTo({
|
|
2212
|
+
top: Math.max(0, scrollTop),
|
|
2213
|
+
behavior: 'auto'
|
|
2214
|
+
});
|
|
2215
|
+
return;
|
|
2216
|
+
}
|
|
2217
|
+
const containerRect = scrollContainer.getBoundingClientRect();
|
|
2218
|
+
const nextScrollTop = scrollContainer.scrollTop + targetRect.top - containerRect.top - offsetTop;
|
|
2219
|
+
scrollContainer.scrollTo({
|
|
2220
|
+
top: Math.max(0, nextScrollTop),
|
|
2221
|
+
behavior: 'auto'
|
|
2222
|
+
});
|
|
2223
|
+
};
|
|
2224
|
+
const scrollAnchorIntoView = (root, {
|
|
2225
|
+
getScrollContainer,
|
|
2226
|
+
preferToolbar = false
|
|
2227
|
+
} = {}) => {
|
|
2228
|
+
const target = getScrollAnchorElement(root, {
|
|
2229
|
+
preferToolbar
|
|
2230
|
+
});
|
|
2231
|
+
if (!target) {
|
|
2232
|
+
return;
|
|
2233
|
+
}
|
|
2234
|
+
const offsetTop = readScrollTopInsetPixels(target);
|
|
2235
|
+
requestAnimationFrame(() => {
|
|
2236
|
+
requestAnimationFrame(() => {
|
|
2237
|
+
if (isTopEdgeInViewport(target, offsetTop, getScrollContainer)) {
|
|
2238
|
+
return;
|
|
2239
|
+
}
|
|
2240
|
+
scrollToElement(target, {
|
|
2241
|
+
offsetTop,
|
|
2242
|
+
getScrollContainer
|
|
2243
|
+
});
|
|
2244
|
+
});
|
|
2245
|
+
});
|
|
2246
|
+
};
|
|
2247
|
+
const getTableScrollElement = root => {
|
|
2248
|
+
if (!root) {
|
|
2249
|
+
return null;
|
|
2250
|
+
}
|
|
2251
|
+
return root.querySelector('.ant-table-body') || root.querySelector('.ant-table-content');
|
|
2252
|
+
};
|
|
2253
|
+
const getElementViewportState = element => {
|
|
2254
|
+
if (!element) {
|
|
2255
|
+
return {
|
|
2256
|
+
isBottomInViewport: true,
|
|
2257
|
+
isPartiallyInViewport: false,
|
|
2258
|
+
isTopInViewport: true,
|
|
2259
|
+
rect: null,
|
|
2260
|
+
viewport: getViewportRect()
|
|
2261
|
+
};
|
|
2262
|
+
}
|
|
2263
|
+
const rect = element.getBoundingClientRect();
|
|
2264
|
+
const viewport = getViewportRect();
|
|
2265
|
+
return {
|
|
2266
|
+
isBottomInViewport: rect.bottom > viewport.top && rect.bottom <= viewport.bottom,
|
|
2267
|
+
isPartiallyInViewport: rect.top < viewport.bottom && rect.bottom > viewport.top,
|
|
2268
|
+
isTopInViewport: rect.top >= viewport.top && rect.top < viewport.bottom,
|
|
2269
|
+
rect,
|
|
2270
|
+
viewport
|
|
2271
|
+
};
|
|
2272
|
+
};
|
|
2273
|
+
const isTopEdgeInViewport = (element, scrollMarginTop = 0, getScrollContainer) => {
|
|
2274
|
+
if (!element) {
|
|
2275
|
+
return true;
|
|
2276
|
+
}
|
|
2277
|
+
const rect = element.getBoundingClientRect();
|
|
2278
|
+
const explicitContainer = typeof getScrollContainer === 'function' ? getScrollContainer() : null;
|
|
2279
|
+
if (!isDocumentScrollContainer(explicitContainer)) {
|
|
2280
|
+
const containerRect = explicitContainer.getBoundingClientRect();
|
|
2281
|
+
const viewportTop = containerRect.top + scrollMarginTop;
|
|
2282
|
+
return rect.top >= viewportTop && rect.top < containerRect.bottom;
|
|
2283
|
+
}
|
|
2284
|
+
const {
|
|
2285
|
+
isTopInViewport,
|
|
2286
|
+
viewport
|
|
2287
|
+
} = getElementViewportState(element);
|
|
2288
|
+
if (!rect) {
|
|
2289
|
+
return true;
|
|
2290
|
+
}
|
|
2291
|
+
const viewportTop = viewport.top + scrollMarginTop;
|
|
2292
|
+
return rect.top >= viewportTop && rect.top < viewport.bottom;
|
|
2293
|
+
};
|
|
2294
|
+
const shouldShowFloatingScrollbar = (scrollEl, viewportState, getScrollContainer) => {
|
|
2295
|
+
if (!scrollEl || scrollEl.scrollWidth <= scrollEl.clientWidth + 1) {
|
|
2296
|
+
return false;
|
|
2297
|
+
}
|
|
2298
|
+
const explicitContainer = typeof getScrollContainer === 'function' ? getScrollContainer() : null;
|
|
2299
|
+
if (!isDocumentScrollContainer(explicitContainer)) {
|
|
2300
|
+
const rect = scrollEl.getBoundingClientRect();
|
|
2301
|
+
const containerRect = explicitContainer.getBoundingClientRect();
|
|
2302
|
+
return rect.top < containerRect.bottom && rect.bottom > containerRect.bottom;
|
|
2303
|
+
}
|
|
2304
|
+
const state = viewportState || getElementViewportState(scrollEl);
|
|
2305
|
+
if (!state.isPartiallyInViewport) {
|
|
2306
|
+
return false;
|
|
2307
|
+
}
|
|
2308
|
+
return !state.isBottomInViewport;
|
|
2309
|
+
};
|
|
2310
|
+
const observeViewportIntersection = (element, onChange) => {
|
|
2311
|
+
if (!element) {
|
|
2312
|
+
return () => {};
|
|
2313
|
+
}
|
|
2314
|
+
const notify = entry => {
|
|
2315
|
+
onChange(getElementViewportState(element));
|
|
2316
|
+
};
|
|
2317
|
+
const observer = new IntersectionObserver(([entry]) => {
|
|
2318
|
+
notify();
|
|
2319
|
+
}, {
|
|
2320
|
+
root: null,
|
|
2321
|
+
threshold: [0, 0.01, 0.25, 0.5, 0.75, 1]
|
|
2322
|
+
});
|
|
2323
|
+
observer.observe(element);
|
|
2324
|
+
const handleViewportChange = () => {
|
|
2325
|
+
notify();
|
|
2326
|
+
};
|
|
2327
|
+
window.addEventListener('scroll', handleViewportChange, true);
|
|
2328
|
+
window.addEventListener('resize', handleViewportChange);
|
|
2329
|
+
window.visualViewport?.addEventListener('resize', handleViewportChange);
|
|
2330
|
+
window.visualViewport?.addEventListener('scroll', handleViewportChange);
|
|
2331
|
+
notify();
|
|
2332
|
+
return () => {
|
|
2333
|
+
observer.disconnect();
|
|
2334
|
+
window.removeEventListener('scroll', handleViewportChange, true);
|
|
2335
|
+
window.removeEventListener('resize', handleViewportChange);
|
|
2336
|
+
window.visualViewport?.removeEventListener('resize', handleViewportChange);
|
|
2337
|
+
window.visualViewport?.removeEventListener('scroll', handleViewportChange);
|
|
2338
|
+
};
|
|
2339
|
+
};
|
|
2340
|
+
|
|
2341
|
+
const _excluded$2 = ["className", "dataSource", "columns", "rowKey", "rowSelection", "valueIsEmpty", "emptyIsPlaceholder", "placeholder", "empty", "onRowSelect", "render", "context", "sticky", "scrollTopInset", "stickyOffset", "getStickyContainer", "headerStyle", "pagination", "sortRender", "name", "controllerOpen", "tableServerApis", "scroll", "summary"],
|
|
2098
2342
|
_excluded2$1 = ["getContainer"];
|
|
2099
2343
|
const mapJustifyToAlign = justify => {
|
|
2100
2344
|
if (justify === 'center') {
|
|
@@ -2163,6 +2407,7 @@ const Table = p => {
|
|
|
2163
2407
|
render = props.render,
|
|
2164
2408
|
context = props.context,
|
|
2165
2409
|
sticky = props.sticky,
|
|
2410
|
+
scrollTopInset = props.scrollTopInset,
|
|
2166
2411
|
stickyOffset = props.stickyOffset,
|
|
2167
2412
|
getStickyContainer = props.getStickyContainer,
|
|
2168
2413
|
headerStyle = props.headerStyle,
|
|
@@ -2413,6 +2658,20 @@ const Table = p => {
|
|
|
2413
2658
|
} : {}, scroll);
|
|
2414
2659
|
}, [hasFixedColumn, controllerOpen, totalWidth, tableWidth, scroll]);
|
|
2415
2660
|
const hasScrollY = (scroll == null ? void 0 : scroll.y) != null && (scroll == null ? void 0 : scroll.y) !== false;
|
|
2661
|
+
const isStickyViewport = !!sticky && !hasScrollY;
|
|
2662
|
+
const resolvedScrollTopInset = resolveScrollTopInset(scrollTopInset, stickyOffset);
|
|
2663
|
+
const stickyGetContainer = react.useMemo(() => {
|
|
2664
|
+
if (!getStickyContainer || hasScrollY) {
|
|
2665
|
+
return undefined;
|
|
2666
|
+
}
|
|
2667
|
+
return () => getStickyContainer() || window;
|
|
2668
|
+
}, [getStickyContainer, hasScrollY]);
|
|
2669
|
+
const parsedScrollTopInset = react.useMemo(() => {
|
|
2670
|
+
if (!sticky || hasScrollY) {
|
|
2671
|
+
return 0;
|
|
2672
|
+
}
|
|
2673
|
+
return parseInsetPixels(resolvedScrollTopInset, tableRef.current);
|
|
2674
|
+
}, [sticky, hasScrollY, resolvedScrollTopInset, isLayout, dataSource]);
|
|
2416
2675
|
const antdSticky = react.useMemo(() => {
|
|
2417
2676
|
if (!sticky) {
|
|
2418
2677
|
return undefined;
|
|
@@ -2425,19 +2684,20 @@ const Table = p => {
|
|
|
2425
2684
|
}, scrollSticky);
|
|
2426
2685
|
}
|
|
2427
2686
|
return Object.assign({
|
|
2428
|
-
offsetHeader:
|
|
2429
|
-
}, config,
|
|
2430
|
-
getContainer:
|
|
2687
|
+
offsetHeader: parsedScrollTopInset
|
|
2688
|
+
}, config, stickyGetContainer ? {
|
|
2689
|
+
getContainer: stickyGetContainer
|
|
2431
2690
|
} : null);
|
|
2432
|
-
}, [sticky,
|
|
2691
|
+
}, [sticky, stickyGetContainer, hasScrollY, parsedScrollTopInset]);
|
|
2433
2692
|
const tableWrapperStyle = react.useMemo(() => {
|
|
2434
|
-
|
|
2693
|
+
const cssValue = normalizeScrollTopInsetCSSValue(resolvedScrollTopInset);
|
|
2694
|
+
if (!cssValue) {
|
|
2435
2695
|
return undefined;
|
|
2436
2696
|
}
|
|
2437
2697
|
return {
|
|
2438
|
-
'--
|
|
2698
|
+
'--scroll-top-inset': cssValue
|
|
2439
2699
|
};
|
|
2440
|
-
}, [
|
|
2700
|
+
}, [resolvedScrollTopInset]);
|
|
2441
2701
|
const tableElement = /*#__PURE__*/jsxRuntime.jsx(antd.Table, _extends({}, others, {
|
|
2442
2702
|
showHeader: true,
|
|
2443
2703
|
dataSource: dataSource,
|
|
@@ -2484,14 +2744,14 @@ const Table = p => {
|
|
|
2484
2744
|
}));
|
|
2485
2745
|
const wrappedTable = /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
2486
2746
|
ref: tableRef,
|
|
2487
|
-
className: classnames__default["default"](style$
|
|
2747
|
+
className: classnames__default["default"](style$4['table'], 'info-page-table', className, {
|
|
2488
2748
|
[style$4['is-resize']]: currentMoveColumnIndex !== null,
|
|
2489
2749
|
[style$4['is-computed']]: isLayout,
|
|
2490
2750
|
[style$4['has-group-header']]: hasGroupHeader,
|
|
2491
2751
|
[style$4['has-summary']]: typeof summary === 'function',
|
|
2492
2752
|
[style$4['is-sticky']]: !!sticky,
|
|
2493
2753
|
[style$4['is-sticky-scroll-y']]: !!sticky && hasScrollY,
|
|
2494
|
-
[style$4['is-sticky-viewport']]:
|
|
2754
|
+
[style$4['is-sticky-viewport']]: isStickyViewport
|
|
2495
2755
|
}),
|
|
2496
2756
|
style: tableWrapperStyle,
|
|
2497
2757
|
children: [/*#__PURE__*/jsxRuntime.jsx("div", {
|
|
@@ -2879,134 +3139,47 @@ TableView.useSelectedRow = useSelectedRow;
|
|
|
2879
3139
|
TableView.useSort = useSort;
|
|
2880
3140
|
TableView.sortDataSource = useSort.sortDataSource;
|
|
2881
3141
|
|
|
2882
|
-
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"};
|
|
2883
|
-
|
|
2884
|
-
const parsePixelValue = value => {
|
|
2885
|
-
const num = parseFloat(value);
|
|
2886
|
-
return Number.isNaN(num) ? 0 : num;
|
|
2887
|
-
};
|
|
2888
|
-
const getViewportRect = () => {
|
|
2889
|
-
const visualViewport = window.visualViewport;
|
|
2890
|
-
if (visualViewport) {
|
|
2891
|
-
return {
|
|
2892
|
-
top: visualViewport.offsetTop,
|
|
2893
|
-
bottom: visualViewport.offsetTop + visualViewport.height,
|
|
2894
|
-
left: visualViewport.offsetLeft,
|
|
2895
|
-
right: visualViewport.offsetLeft + visualViewport.width,
|
|
2896
|
-
height: visualViewport.height
|
|
2897
|
-
};
|
|
2898
|
-
}
|
|
2899
|
-
return {
|
|
2900
|
-
top: 0,
|
|
2901
|
-
bottom: window.innerHeight,
|
|
2902
|
-
left: 0,
|
|
2903
|
-
right: window.innerWidth,
|
|
2904
|
-
height: window.innerHeight
|
|
2905
|
-
};
|
|
2906
|
-
};
|
|
2907
|
-
const getTableElement = root => {
|
|
2908
|
-
if (!root) {
|
|
2909
|
-
return null;
|
|
2910
|
-
}
|
|
2911
|
-
return root.querySelector('.info-page-table') || root;
|
|
2912
|
-
};
|
|
2913
|
-
const getTableScrollElement = root => {
|
|
2914
|
-
if (!root) {
|
|
2915
|
-
return null;
|
|
2916
|
-
}
|
|
2917
|
-
return root.querySelector('.ant-table-body') || root.querySelector('.ant-table-content');
|
|
2918
|
-
};
|
|
2919
|
-
const getElementViewportState = element => {
|
|
2920
|
-
if (!element) {
|
|
2921
|
-
return {
|
|
2922
|
-
isBottomInViewport: true,
|
|
2923
|
-
isPartiallyInViewport: false,
|
|
2924
|
-
isTopInViewport: true,
|
|
2925
|
-
rect: null,
|
|
2926
|
-
viewport: getViewportRect()
|
|
2927
|
-
};
|
|
2928
|
-
}
|
|
2929
|
-
const rect = element.getBoundingClientRect();
|
|
2930
|
-
const viewport = getViewportRect();
|
|
2931
|
-
return {
|
|
2932
|
-
isBottomInViewport: rect.bottom > viewport.top && rect.bottom <= viewport.bottom,
|
|
2933
|
-
isPartiallyInViewport: rect.top < viewport.bottom && rect.bottom > viewport.top,
|
|
2934
|
-
isTopInViewport: rect.top >= viewport.top && rect.top < viewport.bottom,
|
|
2935
|
-
rect,
|
|
2936
|
-
viewport
|
|
2937
|
-
};
|
|
2938
|
-
};
|
|
2939
|
-
const isTopEdgeInViewport = (element, scrollMarginTop = 0) => {
|
|
2940
|
-
const {
|
|
2941
|
-
isTopInViewport,
|
|
2942
|
-
rect,
|
|
2943
|
-
viewport
|
|
2944
|
-
} = getElementViewportState(element);
|
|
2945
|
-
if (!rect) {
|
|
2946
|
-
return true;
|
|
2947
|
-
}
|
|
2948
|
-
const viewportTop = viewport.top + scrollMarginTop;
|
|
2949
|
-
return rect.top >= viewportTop && rect.top < viewport.bottom;
|
|
2950
|
-
};
|
|
2951
|
-
const shouldShowFloatingScrollbar = (scrollEl, viewportState) => {
|
|
2952
|
-
if (!scrollEl || scrollEl.scrollWidth <= scrollEl.clientWidth + 1) {
|
|
2953
|
-
return false;
|
|
2954
|
-
}
|
|
2955
|
-
const state = viewportState || getElementViewportState(scrollEl);
|
|
2956
|
-
if (!state.isPartiallyInViewport) {
|
|
2957
|
-
return false;
|
|
2958
|
-
}
|
|
2959
|
-
return !state.isBottomInViewport;
|
|
2960
|
-
};
|
|
2961
|
-
const observeViewportIntersection = (element, onChange) => {
|
|
2962
|
-
if (!element) {
|
|
2963
|
-
return () => {};
|
|
2964
|
-
}
|
|
2965
|
-
const notify = entry => {
|
|
2966
|
-
onChange(getElementViewportState(element));
|
|
2967
|
-
};
|
|
2968
|
-
const observer = new IntersectionObserver(([entry]) => {
|
|
2969
|
-
notify();
|
|
2970
|
-
}, {
|
|
2971
|
-
root: null,
|
|
2972
|
-
threshold: [0, 0.01, 0.25, 0.5, 0.75, 1]
|
|
2973
|
-
});
|
|
2974
|
-
observer.observe(element);
|
|
2975
|
-
const handleViewportChange = () => {
|
|
2976
|
-
notify();
|
|
2977
|
-
};
|
|
2978
|
-
window.addEventListener('scroll', handleViewportChange, true);
|
|
2979
|
-
window.addEventListener('resize', handleViewportChange);
|
|
2980
|
-
window.visualViewport?.addEventListener('resize', handleViewportChange);
|
|
2981
|
-
window.visualViewport?.addEventListener('scroll', handleViewportChange);
|
|
2982
|
-
notify();
|
|
2983
|
-
return () => {
|
|
2984
|
-
observer.disconnect();
|
|
2985
|
-
window.removeEventListener('scroll', handleViewportChange, true);
|
|
2986
|
-
window.removeEventListener('resize', handleViewportChange);
|
|
2987
|
-
window.visualViewport?.removeEventListener('resize', handleViewportChange);
|
|
2988
|
-
window.visualViewport?.removeEventListener('scroll', handleViewportChange);
|
|
2989
|
-
};
|
|
2990
|
-
};
|
|
3142
|
+
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"};
|
|
2991
3143
|
|
|
2992
3144
|
const BAR_HEIGHT = 15;
|
|
2993
3145
|
const THUMB_MARGIN = 2;
|
|
2994
|
-
const computeBarMetrics = (scrollEl, viewportState) => {
|
|
3146
|
+
const computeBarMetrics = (scrollEl, viewportState, getPortalContainer) => {
|
|
2995
3147
|
const rect = scrollEl.getBoundingClientRect();
|
|
2996
|
-
const
|
|
3148
|
+
const portalContainer = typeof getPortalContainer === 'function' ? getPortalContainer() : null;
|
|
3149
|
+
const useEmbeddedPlacement = !isDocumentScrollContainer(portalContainer);
|
|
2997
3150
|
const trackWidth = rect.width;
|
|
2998
3151
|
const thumbWidth = Math.max(trackWidth * scrollEl.clientWidth / scrollEl.scrollWidth - THUMB_MARGIN * 2, 24);
|
|
2999
3152
|
const maxThumbOffset = trackWidth - thumbWidth - THUMB_MARGIN * 2;
|
|
3000
3153
|
const scrollRatio = scrollEl.scrollWidth > scrollEl.clientWidth ? scrollEl.scrollLeft / (scrollEl.scrollWidth - scrollEl.clientWidth) : 0;
|
|
3154
|
+
const visible = shouldShowFloatingScrollbar(scrollEl, viewportState, getPortalContainer);
|
|
3155
|
+
if (useEmbeddedPlacement) {
|
|
3156
|
+
const containerRect = portalContainer.getBoundingClientRect();
|
|
3157
|
+
return {
|
|
3158
|
+
placement: 'embedded',
|
|
3159
|
+
offsetLeft: Math.round(rect.left - containerRect.left),
|
|
3160
|
+
width: Math.round(trackWidth),
|
|
3161
|
+
thumbWidth,
|
|
3162
|
+
thumbLeft: THUMB_MARGIN + maxThumbOffset * scrollRatio,
|
|
3163
|
+
visible
|
|
3164
|
+
};
|
|
3165
|
+
}
|
|
3166
|
+
const viewport = getViewportRect();
|
|
3001
3167
|
return {
|
|
3002
|
-
|
|
3003
|
-
|
|
3168
|
+
placement: 'fixed',
|
|
3169
|
+
left: Math.round(rect.left),
|
|
3170
|
+
width: Math.round(trackWidth),
|
|
3004
3171
|
bottom: window.innerHeight - viewport.bottom,
|
|
3005
3172
|
thumbWidth,
|
|
3006
3173
|
thumbLeft: THUMB_MARGIN + maxThumbOffset * scrollRatio,
|
|
3007
|
-
visible
|
|
3174
|
+
visible
|
|
3008
3175
|
};
|
|
3009
3176
|
};
|
|
3177
|
+
const metricsEqual = (prev, next) => {
|
|
3178
|
+
if (!prev || !next) {
|
|
3179
|
+
return prev === next;
|
|
3180
|
+
}
|
|
3181
|
+
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);
|
|
3182
|
+
};
|
|
3010
3183
|
const FloatingScrollBar = ({
|
|
3011
3184
|
metrics,
|
|
3012
3185
|
onThumbDrag,
|
|
@@ -3041,10 +3214,18 @@ const FloatingScrollBar = ({
|
|
|
3041
3214
|
if (!metrics?.visible) {
|
|
3042
3215
|
return null;
|
|
3043
3216
|
}
|
|
3044
|
-
const
|
|
3217
|
+
const portalContainer = typeof getPortalContainer === 'function' ? getPortalContainer() : null;
|
|
3218
|
+
const useEmbeddedPlacement = metrics.placement === 'embedded';
|
|
3219
|
+
const portalTarget = useEmbeddedPlacement && portalContainer ? portalContainer : document.body;
|
|
3045
3220
|
return /*#__PURE__*/reactDom.createPortal(/*#__PURE__*/jsxRuntime.jsx("div", {
|
|
3046
|
-
className: classnames__default["default"](style$1['floating-scrollbar'], 'table-page-floating-scrollbar'
|
|
3047
|
-
|
|
3221
|
+
className: classnames__default["default"](style$1['floating-scrollbar'], 'table-page-floating-scrollbar', {
|
|
3222
|
+
[style$1['floating-scrollbar-embedded']]: useEmbeddedPlacement
|
|
3223
|
+
}),
|
|
3224
|
+
style: useEmbeddedPlacement ? {
|
|
3225
|
+
marginLeft: metrics.offsetLeft,
|
|
3226
|
+
width: metrics.width,
|
|
3227
|
+
height: BAR_HEIGHT
|
|
3228
|
+
} : {
|
|
3048
3229
|
left: metrics.left,
|
|
3049
3230
|
width: metrics.width,
|
|
3050
3231
|
height: BAR_HEIGHT,
|
|
@@ -3076,6 +3257,7 @@ const HorizontalScroller = /*#__PURE__*/react.forwardRef(({
|
|
|
3076
3257
|
const containerRef = react.useRef(null);
|
|
3077
3258
|
const scrollElRef = react.useRef(null);
|
|
3078
3259
|
const viewportStateRef = react.useRef(null);
|
|
3260
|
+
const metricsRef = react.useRef(null);
|
|
3079
3261
|
const setContainerRef = useRefCallback__default["default"](node => {
|
|
3080
3262
|
containerRef.current = node;
|
|
3081
3263
|
if (typeof forwardedRef === 'function') {
|
|
@@ -3087,10 +3269,16 @@ const HorizontalScroller = /*#__PURE__*/react.forwardRef(({
|
|
|
3087
3269
|
const updateMetrics = useRefCallback__default["default"](() => {
|
|
3088
3270
|
const scrollEl = scrollElRef.current;
|
|
3089
3271
|
if (!scrollEl) {
|
|
3272
|
+
metricsRef.current = null;
|
|
3090
3273
|
setMetrics(null);
|
|
3091
3274
|
return;
|
|
3092
3275
|
}
|
|
3093
|
-
|
|
3276
|
+
const nextMetrics = computeBarMetrics(scrollEl, viewportStateRef.current, getPortalContainer);
|
|
3277
|
+
if (metricsEqual(metricsRef.current, nextMetrics)) {
|
|
3278
|
+
return;
|
|
3279
|
+
}
|
|
3280
|
+
metricsRef.current = nextMetrics;
|
|
3281
|
+
setMetrics(nextMetrics);
|
|
3094
3282
|
});
|
|
3095
3283
|
const handleThumbDrag = useRefCallback__default["default"](deltaX => {
|
|
3096
3284
|
const scrollEl = scrollElRef.current;
|
|
@@ -3111,6 +3299,7 @@ const HorizontalScroller = /*#__PURE__*/react.forwardRef(({
|
|
|
3111
3299
|
if (!enabled) {
|
|
3112
3300
|
scrollElRef.current = null;
|
|
3113
3301
|
viewportStateRef.current = null;
|
|
3302
|
+
metricsRef.current = null;
|
|
3114
3303
|
setMetrics(null);
|
|
3115
3304
|
return undefined;
|
|
3116
3305
|
}
|
|
@@ -3121,6 +3310,8 @@ const HorizontalScroller = /*#__PURE__*/react.forwardRef(({
|
|
|
3121
3310
|
let scrollEl = null;
|
|
3122
3311
|
let unobserveViewport = null;
|
|
3123
3312
|
let contentResizeObserver = null;
|
|
3313
|
+
const portalContainer = typeof getPortalContainer === 'function' ? getPortalContainer() : null;
|
|
3314
|
+
const useEmbeddedPlacement = !isDocumentScrollContainer(portalContainer);
|
|
3124
3315
|
const detachScrollEl = () => {
|
|
3125
3316
|
unobserveViewport?.();
|
|
3126
3317
|
unobserveViewport = null;
|
|
@@ -3141,10 +3332,12 @@ const HorizontalScroller = /*#__PURE__*/react.forwardRef(({
|
|
|
3141
3332
|
detachScrollEl();
|
|
3142
3333
|
scrollEl = nextScrollEl;
|
|
3143
3334
|
scrollElRef.current = scrollEl;
|
|
3144
|
-
|
|
3145
|
-
|
|
3146
|
-
|
|
3147
|
-
|
|
3335
|
+
if (!useEmbeddedPlacement) {
|
|
3336
|
+
unobserveViewport = observeViewportIntersection(scrollEl, state => {
|
|
3337
|
+
viewportStateRef.current = state;
|
|
3338
|
+
updateMetrics();
|
|
3339
|
+
});
|
|
3340
|
+
}
|
|
3148
3341
|
scrollEl.addEventListener('scroll', updateMetrics, {
|
|
3149
3342
|
passive: true
|
|
3150
3343
|
});
|
|
@@ -3161,11 +3354,38 @@ const HorizontalScroller = /*#__PURE__*/react.forwardRef(({
|
|
|
3161
3354
|
const containerResizeObserver = new ResizeObserver(onLayoutChange);
|
|
3162
3355
|
containerResizeObserver.observe(root);
|
|
3163
3356
|
onLayoutChange();
|
|
3357
|
+
const onWindowChange = () => {
|
|
3358
|
+
if (!useEmbeddedPlacement) {
|
|
3359
|
+
updateMetrics();
|
|
3360
|
+
}
|
|
3361
|
+
};
|
|
3362
|
+
if (!useEmbeddedPlacement) {
|
|
3363
|
+
window.addEventListener('scroll', onWindowChange, true);
|
|
3364
|
+
window.addEventListener('resize', onWindowChange);
|
|
3365
|
+
window.visualViewport?.addEventListener('resize', onWindowChange);
|
|
3366
|
+
window.visualViewport?.addEventListener('scroll', onWindowChange);
|
|
3367
|
+
}
|
|
3368
|
+
if (useEmbeddedPlacement && portalContainer) {
|
|
3369
|
+
portalContainer.addEventListener('scroll', updateMetrics, {
|
|
3370
|
+
passive: true
|
|
3371
|
+
});
|
|
3372
|
+
window.addEventListener('resize', updateMetrics);
|
|
3373
|
+
}
|
|
3164
3374
|
return () => {
|
|
3165
3375
|
detachScrollEl();
|
|
3166
3376
|
containerResizeObserver.disconnect();
|
|
3377
|
+
if (!useEmbeddedPlacement) {
|
|
3378
|
+
window.removeEventListener('scroll', onWindowChange, true);
|
|
3379
|
+
window.removeEventListener('resize', onWindowChange);
|
|
3380
|
+
window.visualViewport?.removeEventListener('resize', onWindowChange);
|
|
3381
|
+
window.visualViewport?.removeEventListener('scroll', onWindowChange);
|
|
3382
|
+
}
|
|
3383
|
+
if (useEmbeddedPlacement && portalContainer) {
|
|
3384
|
+
portalContainer.removeEventListener('scroll', updateMetrics);
|
|
3385
|
+
window.removeEventListener('resize', updateMetrics);
|
|
3386
|
+
}
|
|
3167
3387
|
};
|
|
3168
|
-
}, [enabled, updateMetrics]);
|
|
3388
|
+
}, [enabled, updateMetrics, getPortalContainer]);
|
|
3169
3389
|
return /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
3170
3390
|
children: [/*#__PURE__*/jsxRuntime.jsx("div", {
|
|
3171
3391
|
ref: setContainerRef,
|
|
@@ -3256,7 +3476,7 @@ const TableToolbar = ({
|
|
|
3256
3476
|
'table-page-toolbar-section--has-value': hasValueDisplay
|
|
3257
3477
|
}),
|
|
3258
3478
|
children: [/*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
3259
|
-
className: style['table-toolbar'],
|
|
3479
|
+
className: classnames__default["default"](style['table-toolbar'], 'table-page-toolbar'),
|
|
3260
3480
|
children: [showBatch ? /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
3261
3481
|
children: [/*#__PURE__*/jsxRuntime.jsx("div", {
|
|
3262
3482
|
className: style['table-toolbar-batch'],
|
|
@@ -3323,7 +3543,7 @@ const TableToolbar = ({
|
|
|
3323
3543
|
});
|
|
3324
3544
|
};
|
|
3325
3545
|
|
|
3326
|
-
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"],
|
|
3546
|
+
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"],
|
|
3327
3547
|
_excluded2 = ["pagination", "horizontalScroller", "getScrollContainer"];
|
|
3328
3548
|
const readPageSize = key => {
|
|
3329
3549
|
try {
|
|
@@ -3344,27 +3564,6 @@ const writePageSize = (key, size) => {
|
|
|
3344
3564
|
// ignore quota errors
|
|
3345
3565
|
}
|
|
3346
3566
|
};
|
|
3347
|
-
const isTableTopInViewport = target => {
|
|
3348
|
-
const scrollMarginTop = parsePixelValue(getComputedStyle(target).scrollMarginTop);
|
|
3349
|
-
return isTopEdgeInViewport(target, scrollMarginTop);
|
|
3350
|
-
};
|
|
3351
|
-
const scrollTableIntoView = root => {
|
|
3352
|
-
const target = getTableElement(root);
|
|
3353
|
-
if (!target) {
|
|
3354
|
-
return;
|
|
3355
|
-
}
|
|
3356
|
-
requestAnimationFrame(() => {
|
|
3357
|
-
requestAnimationFrame(() => {
|
|
3358
|
-
if (isTableTopInViewport(target)) {
|
|
3359
|
-
return;
|
|
3360
|
-
}
|
|
3361
|
-
target.scrollIntoView({
|
|
3362
|
-
block: 'start',
|
|
3363
|
-
inline: 'nearest'
|
|
3364
|
-
});
|
|
3365
|
-
});
|
|
3366
|
-
});
|
|
3367
|
-
};
|
|
3368
3567
|
const TABLE_COMPONENTS = {
|
|
3369
3568
|
Table,
|
|
3370
3569
|
TableView
|
|
@@ -3424,6 +3623,8 @@ const TablePageInnerContent = withLocale(_ref => {
|
|
|
3424
3623
|
columnRenderProps = _ref$columnRenderProp === void 0 ? {} : _ref$columnRenderProp,
|
|
3425
3624
|
summary = _ref.summary,
|
|
3426
3625
|
sticky = _ref.sticky,
|
|
3626
|
+
scrollTopInset = _ref.scrollTopInset,
|
|
3627
|
+
stickyOffset = _ref.stickyOffset,
|
|
3427
3628
|
_ref$renderType = _ref.renderType,
|
|
3428
3629
|
renderType = _ref$renderType === void 0 ? 'Table' : _ref$renderType,
|
|
3429
3630
|
_ref$horizontalScroll = _ref.horizontalScroller,
|
|
@@ -3471,8 +3672,22 @@ const TablePageInnerContent = withLocale(_ref => {
|
|
|
3471
3672
|
dataFormat,
|
|
3472
3673
|
pagination
|
|
3473
3674
|
}), [data, fetchProps, requestParams, refresh, reload, loadMore, send, dataFormat, pagination]);
|
|
3675
|
+
const hasToolbar = !!(filter != null && (_filter$list = filter.list) != null && _filter$list.length || search && search.name || batchActions && batchActions.length);
|
|
3676
|
+
const resolvedScrollTopInset = resolveScrollTopInset(scrollTopInset, stickyOffset);
|
|
3677
|
+
const scrollTopInsetStyle = react.useMemo(() => {
|
|
3678
|
+
const cssValue = normalizeScrollTopInsetCSSValue(resolvedScrollTopInset);
|
|
3679
|
+
if (!cssValue) {
|
|
3680
|
+
return undefined;
|
|
3681
|
+
}
|
|
3682
|
+
return {
|
|
3683
|
+
'--scroll-top-inset': cssValue
|
|
3684
|
+
};
|
|
3685
|
+
}, [resolvedScrollTopInset]);
|
|
3474
3686
|
const scrollTable = useRefCallback__default["default"](() => {
|
|
3475
|
-
|
|
3687
|
+
scrollAnchorIntoView(tableContentRef.current, {
|
|
3688
|
+
getScrollContainer,
|
|
3689
|
+
preferToolbar: hasToolbar
|
|
3690
|
+
});
|
|
3476
3691
|
});
|
|
3477
3692
|
const handleFilterChange = useRefCallback__default["default"](value => {
|
|
3478
3693
|
if (!isFilterControlled) {
|
|
@@ -3526,7 +3741,7 @@ const TablePageInnerContent = withLocale(_ref => {
|
|
|
3526
3741
|
})]
|
|
3527
3742
|
}),
|
|
3528
3743
|
current: get__default["default"](requestParams, [pagination.paramsType, pagination.currentName], 1),
|
|
3529
|
-
pageSize: Number(get__default["default"](requestParams, [pagination.paramsType, pagination.pageSizeName], pagination.pageSize)) || pagination.pageSize ||
|
|
3744
|
+
pageSize: Number(get__default["default"](requestParams, [pagination.paramsType, pagination.pageSizeName], pagination.pageSize)) || pagination.pageSize || 50,
|
|
3530
3745
|
onChange: handlePaginationChange,
|
|
3531
3746
|
size: pagination.size,
|
|
3532
3747
|
hideOnSinglePage: pagination.hideOnSinglePage,
|
|
@@ -3535,7 +3750,6 @@ const TablePageInnerContent = withLocale(_ref => {
|
|
|
3535
3750
|
pageSizeOptions: pagination.pageSizeOptions
|
|
3536
3751
|
};
|
|
3537
3752
|
}, [pagination, formatData.total, requestParams, formatMessage, handlePaginationChange]);
|
|
3538
|
-
const hasToolbar = !!(filter != null && (_filter$list = filter.list) != null && _filter$list.length || search && search.name || batchActions && batchActions.length);
|
|
3539
3753
|
const batchContext = react.useMemo(() => ({
|
|
3540
3754
|
data,
|
|
3541
3755
|
fetchProps,
|
|
@@ -3557,6 +3771,7 @@ const TablePageInnerContent = withLocale(_ref => {
|
|
|
3557
3771
|
dataSource: formatData.list,
|
|
3558
3772
|
pagination: false,
|
|
3559
3773
|
sticky,
|
|
3774
|
+
scrollTopInset: resolvedScrollTopInset,
|
|
3560
3775
|
getStickyContainer: getScrollContainer,
|
|
3561
3776
|
className: classnames__default["default"](className, {
|
|
3562
3777
|
[style$1['table-in-toolbar']]: hasToolbar
|
|
@@ -3574,6 +3789,7 @@ const TablePageInnerContent = withLocale(_ref => {
|
|
|
3574
3789
|
const tableElement = /*#__PURE__*/jsxRuntime.jsx(TableComponent, _extends({}, tableProps));
|
|
3575
3790
|
return /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
3576
3791
|
className: style$1['table-page'],
|
|
3792
|
+
style: scrollTopInsetStyle,
|
|
3577
3793
|
children: [/*#__PURE__*/jsxRuntime.jsx(HorizontalScroller, {
|
|
3578
3794
|
ref: tableContentRef,
|
|
3579
3795
|
enabled: horizontalScroller && renderType === 'Table',
|
|
@@ -3615,12 +3831,13 @@ const TablePage = /*#__PURE__*/react.forwardRef((_ref2, ref) => {
|
|
|
3615
3831
|
requestType: 'reload',
|
|
3616
3832
|
currentName: 'currentPage',
|
|
3617
3833
|
pageSizeName: 'perPage',
|
|
3618
|
-
pageSize:
|
|
3834
|
+
pageSize: 50
|
|
3619
3835
|
}, pagination);
|
|
3620
3836
|
const pageSizeKey = (props.name || 'common').toUpperCase() + "_TABLE_PAGE_SIZE";
|
|
3837
|
+
const cachePageSize = pagination.cachePageSize !== false;
|
|
3621
3838
|
const _useState2 = react.useState(() => {
|
|
3622
|
-
var
|
|
3623
|
-
return (
|
|
3839
|
+
var _ref3;
|
|
3840
|
+
return (_ref3 = cachePageSize ? readPageSize(pageSizeKey) : null) != null ? _ref3 : pagination.pageSize;
|
|
3624
3841
|
}),
|
|
3625
3842
|
pageSize = _useState2[0],
|
|
3626
3843
|
setPageSize = _useState2[1];
|
|
@@ -3647,7 +3864,9 @@ const TablePage = /*#__PURE__*/react.forwardRef((_ref2, ref) => {
|
|
|
3647
3864
|
pageSize,
|
|
3648
3865
|
onShowSizeChange: (current, size) => {
|
|
3649
3866
|
const nextSize = Number(size);
|
|
3650
|
-
|
|
3867
|
+
if (cachePageSize) {
|
|
3868
|
+
writePageSize(pageSizeKey, nextSize);
|
|
3869
|
+
}
|
|
3651
3870
|
setPageSize(nextSize);
|
|
3652
3871
|
}
|
|
3653
3872
|
}),
|