@kne/table-page 0.1.23 → 0.1.25
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 +22 -2
- package/dist/index.css +121 -65
- package/dist/index.css.map +1 -1
- package/dist/index.js +446 -461
- package/dist/index.js.map +1 -1
- package/dist/index.modern.js +382 -413
- package/dist/index.modern.js.map +1 -1
- package/dist/locale/en-US.js +1 -2
- package/dist/locale/en-US.js.map +1 -1
- package/dist/locale/en-US.modern.js +1 -2
- package/dist/locale/en-US.modern.js.map +1 -1
- package/dist/locale/zh-CN.js +1 -2
- package/dist/locale/zh-CN.js.map +1 -1
- package/dist/locale/zh-CN.modern.js +1 -2
- package/dist/locale/zh-CN.modern.js.map +1 -1
- package/package.json +5 -4
package/dist/index.js
CHANGED
|
@@ -24,8 +24,9 @@ var cloneDeep = require('lodash/cloneDeep');
|
|
|
24
24
|
var reactIntl = require('@kne/react-intl');
|
|
25
25
|
var filterZhCN = require('@kne/react-filter/dist/locale/zh-CN');
|
|
26
26
|
var filterEnUS = require('@kne/react-filter/dist/locale/en-US');
|
|
27
|
+
var StickyScroller = require('@kne/react-sticky-scroller');
|
|
27
28
|
var useControlValue = require('@kne/use-control-value');
|
|
28
|
-
|
|
29
|
+
require('@kne/react-sticky-scroller/dist/index.css');
|
|
29
30
|
require('@kne/button-group/dist/index.css');
|
|
30
31
|
require('@kne/react-filter/dist/index.css');
|
|
31
32
|
var ButtonGroup = require('@kne/button-group');
|
|
@@ -44,6 +45,7 @@ var groupBy__default = /*#__PURE__*/_interopDefaultLegacy(groupBy);
|
|
|
44
45
|
var cloneDeep__default = /*#__PURE__*/_interopDefaultLegacy(cloneDeep);
|
|
45
46
|
var filterZhCN__default = /*#__PURE__*/_interopDefaultLegacy(filterZhCN);
|
|
46
47
|
var filterEnUS__default = /*#__PURE__*/_interopDefaultLegacy(filterEnUS);
|
|
48
|
+
var StickyScroller__default = /*#__PURE__*/_interopDefaultLegacy(StickyScroller);
|
|
47
49
|
var useControlValue__default = /*#__PURE__*/_interopDefaultLegacy(useControlValue);
|
|
48
50
|
var ButtonGroup__default = /*#__PURE__*/_interopDefaultLegacy(ButtonGroup);
|
|
49
51
|
|
|
@@ -108,8 +110,7 @@ const locale$1 = {
|
|
|
108
110
|
HiddenInfo: '隐藏的信息',
|
|
109
111
|
Search: '搜索',
|
|
110
112
|
BatchOperations: '批量操作',
|
|
111
|
-
BatchOperationsWithCount: '
|
|
112
|
-
BatchOperationsMobileSelected: '已选:{count}条',
|
|
113
|
+
BatchOperationsWithCount: '已选:{count}条',
|
|
113
114
|
Cancel: '取消',
|
|
114
115
|
Confirm: '确定',
|
|
115
116
|
All: '全部',
|
|
@@ -127,8 +128,7 @@ const locale = {
|
|
|
127
128
|
HiddenInfo: 'Hidden Columns',
|
|
128
129
|
Search: 'Search',
|
|
129
130
|
BatchOperations: 'Batch Actions',
|
|
130
|
-
BatchOperationsWithCount: '
|
|
131
|
-
BatchOperationsMobileSelected: 'Selected: {count}',
|
|
131
|
+
BatchOperationsWithCount: 'Selected: {count}',
|
|
132
132
|
Cancel: 'Cancel',
|
|
133
133
|
Confirm: 'Confirm',
|
|
134
134
|
All: 'All',
|
|
@@ -824,9 +824,6 @@ const parsePixelValue = value => {
|
|
|
824
824
|
const num = parseFloat(value);
|
|
825
825
|
return Number.isNaN(num) ? 0 : num;
|
|
826
826
|
};
|
|
827
|
-
const isDocumentScrollContainer = container => {
|
|
828
|
-
return !container || container === document.body || container === document.documentElement || container === document.scrollingElement;
|
|
829
|
-
};
|
|
830
827
|
const normalizeScrollTopInsetCSSValue = value => {
|
|
831
828
|
if (value == null) {
|
|
832
829
|
return undefined;
|
|
@@ -860,25 +857,6 @@ const readScrollTopInsetPixels = element => {
|
|
|
860
857
|
const fromVar = readCssVariableLength(element, '--scroll-top-inset', '0px') || readCssVariableLength(element, '--sticky-offset', '0px') || readCssVariableLength(element, '--nav-height', '0px');
|
|
861
858
|
return fromVar;
|
|
862
859
|
};
|
|
863
|
-
const getViewportRect = () => {
|
|
864
|
-
const visualViewport = window.visualViewport;
|
|
865
|
-
if (visualViewport) {
|
|
866
|
-
return {
|
|
867
|
-
top: visualViewport.offsetTop,
|
|
868
|
-
bottom: visualViewport.offsetTop + visualViewport.height,
|
|
869
|
-
left: visualViewport.offsetLeft,
|
|
870
|
-
right: visualViewport.offsetLeft + visualViewport.width,
|
|
871
|
-
height: visualViewport.height
|
|
872
|
-
};
|
|
873
|
-
}
|
|
874
|
-
return {
|
|
875
|
-
top: 0,
|
|
876
|
-
bottom: window.innerHeight,
|
|
877
|
-
left: 0,
|
|
878
|
-
right: window.innerWidth,
|
|
879
|
-
height: window.innerHeight
|
|
880
|
-
};
|
|
881
|
-
};
|
|
882
860
|
const getTableElement = root => {
|
|
883
861
|
if (!root) {
|
|
884
862
|
return null;
|
|
@@ -970,99 +948,21 @@ const scrollAnchorIntoView = (root, {
|
|
|
970
948
|
});
|
|
971
949
|
});
|
|
972
950
|
};
|
|
973
|
-
const getTableScrollElement = root => {
|
|
974
|
-
if (!root) {
|
|
975
|
-
return null;
|
|
976
|
-
}
|
|
977
|
-
return root.querySelector('.ant-table-body') || root.querySelector('.ant-table-content');
|
|
978
|
-
};
|
|
979
|
-
const getElementViewportState = element => {
|
|
980
|
-
if (!element) {
|
|
981
|
-
return {
|
|
982
|
-
isBottomInViewport: true,
|
|
983
|
-
isPartiallyInViewport: false,
|
|
984
|
-
isTopInViewport: true,
|
|
985
|
-
rect: null,
|
|
986
|
-
viewport: getViewportRect()
|
|
987
|
-
};
|
|
988
|
-
}
|
|
989
|
-
const rect = element.getBoundingClientRect();
|
|
990
|
-
const viewport = getViewportRect();
|
|
991
|
-
return {
|
|
992
|
-
isBottomInViewport: rect.bottom > viewport.top && rect.bottom <= viewport.bottom,
|
|
993
|
-
isPartiallyInViewport: rect.top < viewport.bottom && rect.bottom > viewport.top,
|
|
994
|
-
isTopInViewport: rect.top >= viewport.top && rect.top < viewport.bottom,
|
|
995
|
-
rect,
|
|
996
|
-
viewport
|
|
997
|
-
};
|
|
998
|
-
};
|
|
999
951
|
const isTopEdgeInViewport = (element, scrollMarginTop = 0, getScrollContainer) => {
|
|
1000
952
|
if (!element) {
|
|
1001
953
|
return true;
|
|
1002
954
|
}
|
|
1003
955
|
const rect = element.getBoundingClientRect();
|
|
1004
956
|
const explicitContainer = typeof getScrollContainer === 'function' ? getScrollContainer() : null;
|
|
1005
|
-
if (!isDocumentScrollContainer(explicitContainer)) {
|
|
957
|
+
if (!StickyScroller.isDocumentScrollContainer(explicitContainer)) {
|
|
1006
958
|
const containerRect = explicitContainer.getBoundingClientRect();
|
|
1007
959
|
const viewportTop = containerRect.top + scrollMarginTop;
|
|
1008
960
|
return rect.top >= viewportTop && rect.top < containerRect.bottom;
|
|
1009
961
|
}
|
|
1010
|
-
const
|
|
1011
|
-
isTopInViewport,
|
|
1012
|
-
viewport
|
|
1013
|
-
} = getElementViewportState(element);
|
|
1014
|
-
if (!rect) {
|
|
1015
|
-
return true;
|
|
1016
|
-
}
|
|
962
|
+
const viewport = StickyScroller.getViewportRect();
|
|
1017
963
|
const viewportTop = viewport.top + scrollMarginTop;
|
|
1018
964
|
return rect.top >= viewportTop && rect.top < viewport.bottom;
|
|
1019
965
|
};
|
|
1020
|
-
const shouldShowFloatingScrollbar = (scrollEl, viewportState, getScrollContainer) => {
|
|
1021
|
-
if (!scrollEl || scrollEl.scrollWidth <= scrollEl.clientWidth + 1) {
|
|
1022
|
-
return false;
|
|
1023
|
-
}
|
|
1024
|
-
const explicitContainer = typeof getScrollContainer === 'function' ? getScrollContainer() : null;
|
|
1025
|
-
if (!isDocumentScrollContainer(explicitContainer)) {
|
|
1026
|
-
const rect = scrollEl.getBoundingClientRect();
|
|
1027
|
-
const containerRect = explicitContainer.getBoundingClientRect();
|
|
1028
|
-
return rect.top < containerRect.bottom && rect.bottom > containerRect.bottom;
|
|
1029
|
-
}
|
|
1030
|
-
const state = viewportState || getElementViewportState(scrollEl);
|
|
1031
|
-
if (!state.isPartiallyInViewport) {
|
|
1032
|
-
return false;
|
|
1033
|
-
}
|
|
1034
|
-
return !state.isBottomInViewport;
|
|
1035
|
-
};
|
|
1036
|
-
const observeViewportIntersection = (element, onChange) => {
|
|
1037
|
-
if (!element) {
|
|
1038
|
-
return () => {};
|
|
1039
|
-
}
|
|
1040
|
-
const notify = entry => {
|
|
1041
|
-
onChange(getElementViewportState(element));
|
|
1042
|
-
};
|
|
1043
|
-
const observer = new IntersectionObserver(([entry]) => {
|
|
1044
|
-
notify();
|
|
1045
|
-
}, {
|
|
1046
|
-
root: null,
|
|
1047
|
-
threshold: [0, 0.01, 0.25, 0.5, 0.75, 1]
|
|
1048
|
-
});
|
|
1049
|
-
observer.observe(element);
|
|
1050
|
-
const handleViewportChange = () => {
|
|
1051
|
-
notify();
|
|
1052
|
-
};
|
|
1053
|
-
window.addEventListener('scroll', handleViewportChange, true);
|
|
1054
|
-
window.addEventListener('resize', handleViewportChange);
|
|
1055
|
-
window.visualViewport?.addEventListener('resize', handleViewportChange);
|
|
1056
|
-
window.visualViewport?.addEventListener('scroll', handleViewportChange);
|
|
1057
|
-
notify();
|
|
1058
|
-
return () => {
|
|
1059
|
-
observer.disconnect();
|
|
1060
|
-
window.removeEventListener('scroll', handleViewportChange, true);
|
|
1061
|
-
window.removeEventListener('resize', handleViewportChange);
|
|
1062
|
-
window.visualViewport?.removeEventListener('resize', handleViewportChange);
|
|
1063
|
-
window.visualViewport?.removeEventListener('scroll', handleViewportChange);
|
|
1064
|
-
};
|
|
1065
|
-
};
|
|
1066
966
|
|
|
1067
967
|
/** 叶子去掉空 children,懒加载节点保留 [],避免 antd 把所有节点当成可展开 */
|
|
1068
968
|
const prepareAntdTreeNodes = (nodes, {
|
|
@@ -1250,7 +1150,8 @@ const wrapColContent = node => /*#__PURE__*/jsxRuntime.jsx("span", {
|
|
|
1250
1150
|
const Table = p => {
|
|
1251
1151
|
const tableRef = react.useRef(null);
|
|
1252
1152
|
const tableWidth = useElementWidth(tableRef);
|
|
1253
|
-
|
|
1153
|
+
// controllerOpen 默认 true:需等列宽计算;骨架屏等场景显式 false 时可立即渲染
|
|
1154
|
+
const _useState = react.useState(() => p.controllerOpen !== false),
|
|
1254
1155
|
isLayout = _useState[0],
|
|
1255
1156
|
setIsLayout = _useState[1];
|
|
1256
1157
|
const isMobile = responsiveUtils.useIsMobile();
|
|
@@ -2059,265 +1960,7 @@ Table.useSelectedRow = tableView.useSelectedRow;
|
|
|
2059
1960
|
Table.useSort = tableView.useSort;
|
|
2060
1961
|
Table.sortDataSource = tableView.useSort.sortDataSource;
|
|
2061
1962
|
|
|
2062
|
-
var style$1 = {"table-page":"kne-table-page_ut9rJ","table-page-tabs-outer":"kne-table-page_IowJl","table-content":"kne-table-page_dxN6N","table-with-toolbar":"kne-table-page_sf06r","is-sticky":"kne-table-page_7lYyk","is-
|
|
2063
|
-
|
|
2064
|
-
const BAR_HEIGHT = 15;
|
|
2065
|
-
const THUMB_MARGIN = 2;
|
|
2066
|
-
const computeBarMetrics = (scrollEl, viewportState, getPortalContainer) => {
|
|
2067
|
-
const rect = scrollEl.getBoundingClientRect();
|
|
2068
|
-
const portalContainer = typeof getPortalContainer === 'function' ? getPortalContainer() : null;
|
|
2069
|
-
const useEmbeddedPlacement = !isDocumentScrollContainer(portalContainer);
|
|
2070
|
-
const trackWidth = rect.width;
|
|
2071
|
-
const thumbWidth = Math.max(trackWidth * scrollEl.clientWidth / scrollEl.scrollWidth - THUMB_MARGIN * 2, 24);
|
|
2072
|
-
const maxThumbOffset = trackWidth - thumbWidth - THUMB_MARGIN * 2;
|
|
2073
|
-
const scrollRatio = scrollEl.scrollWidth > scrollEl.clientWidth ? scrollEl.scrollLeft / (scrollEl.scrollWidth - scrollEl.clientWidth) : 0;
|
|
2074
|
-
const visible = shouldShowFloatingScrollbar(scrollEl, viewportState, getPortalContainer);
|
|
2075
|
-
if (useEmbeddedPlacement) {
|
|
2076
|
-
const containerRect = portalContainer.getBoundingClientRect();
|
|
2077
|
-
return {
|
|
2078
|
-
placement: 'embedded',
|
|
2079
|
-
offsetLeft: Math.round(rect.left - containerRect.left),
|
|
2080
|
-
width: Math.round(trackWidth),
|
|
2081
|
-
thumbWidth,
|
|
2082
|
-
thumbLeft: THUMB_MARGIN + maxThumbOffset * scrollRatio,
|
|
2083
|
-
visible
|
|
2084
|
-
};
|
|
2085
|
-
}
|
|
2086
|
-
const viewport = getViewportRect();
|
|
2087
|
-
return {
|
|
2088
|
-
placement: 'fixed',
|
|
2089
|
-
left: Math.round(rect.left),
|
|
2090
|
-
width: Math.round(trackWidth),
|
|
2091
|
-
bottom: window.innerHeight - viewport.bottom,
|
|
2092
|
-
thumbWidth,
|
|
2093
|
-
thumbLeft: THUMB_MARGIN + maxThumbOffset * scrollRatio,
|
|
2094
|
-
visible
|
|
2095
|
-
};
|
|
2096
|
-
};
|
|
2097
|
-
const metricsEqual = (prev, next) => {
|
|
2098
|
-
if (!prev || !next) {
|
|
2099
|
-
return prev === next;
|
|
2100
|
-
}
|
|
2101
|
-
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);
|
|
2102
|
-
};
|
|
2103
|
-
const FloatingScrollBar = ({
|
|
2104
|
-
metrics,
|
|
2105
|
-
onThumbDrag,
|
|
2106
|
-
getPortalContainer
|
|
2107
|
-
}) => {
|
|
2108
|
-
const startRef = react.useRef(0);
|
|
2109
|
-
const [moving, setMoving] = react.useState(false);
|
|
2110
|
-
const movingRef = react.useRef(false);
|
|
2111
|
-
const onThumbDragRef = react.useRef(onThumbDrag);
|
|
2112
|
-
onThumbDragRef.current = onThumbDrag;
|
|
2113
|
-
react.useEffect(() => {
|
|
2114
|
-
movingRef.current = moving;
|
|
2115
|
-
}, [moving]);
|
|
2116
|
-
react.useEffect(() => {
|
|
2117
|
-
const moveHandler = event => {
|
|
2118
|
-
if (!movingRef.current) {
|
|
2119
|
-
return;
|
|
2120
|
-
}
|
|
2121
|
-
onThumbDragRef.current(event.clientX - startRef.current);
|
|
2122
|
-
startRef.current = event.clientX;
|
|
2123
|
-
};
|
|
2124
|
-
const upHandler = () => {
|
|
2125
|
-
setMoving(false);
|
|
2126
|
-
};
|
|
2127
|
-
document.addEventListener('mousemove', moveHandler, true);
|
|
2128
|
-
document.addEventListener('mouseup', upHandler, true);
|
|
2129
|
-
return () => {
|
|
2130
|
-
document.removeEventListener('mousemove', moveHandler, true);
|
|
2131
|
-
document.removeEventListener('mouseup', upHandler, true);
|
|
2132
|
-
};
|
|
2133
|
-
}, []);
|
|
2134
|
-
if (!metrics?.visible) {
|
|
2135
|
-
return null;
|
|
2136
|
-
}
|
|
2137
|
-
const portalContainer = typeof getPortalContainer === 'function' ? getPortalContainer() : null;
|
|
2138
|
-
const useEmbeddedPlacement = metrics.placement === 'embedded';
|
|
2139
|
-
const portalTarget = useEmbeddedPlacement && portalContainer ? portalContainer : document.body;
|
|
2140
|
-
return /*#__PURE__*/reactDom.createPortal(/*#__PURE__*/jsxRuntime.jsx("div", {
|
|
2141
|
-
className: classnames__default["default"](style$1['floating-scrollbar'], 'table-page-floating-scrollbar', {
|
|
2142
|
-
[style$1['floating-scrollbar-embedded']]: useEmbeddedPlacement
|
|
2143
|
-
}),
|
|
2144
|
-
style: useEmbeddedPlacement ? {
|
|
2145
|
-
marginLeft: metrics.offsetLeft,
|
|
2146
|
-
width: metrics.width,
|
|
2147
|
-
height: BAR_HEIGHT
|
|
2148
|
-
} : {
|
|
2149
|
-
left: metrics.left,
|
|
2150
|
-
width: metrics.width,
|
|
2151
|
-
height: BAR_HEIGHT,
|
|
2152
|
-
bottom: metrics.bottom
|
|
2153
|
-
},
|
|
2154
|
-
children: /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
2155
|
-
className: classnames__default["default"](style$1['floating-scrollbar-thumb'], {
|
|
2156
|
-
[style$1['is-moving']]: moving
|
|
2157
|
-
}),
|
|
2158
|
-
style: {
|
|
2159
|
-
width: metrics.thumbWidth,
|
|
2160
|
-
left: metrics.thumbLeft
|
|
2161
|
-
},
|
|
2162
|
-
onMouseDown: event => {
|
|
2163
|
-
event.preventDefault();
|
|
2164
|
-
startRef.current = event.clientX;
|
|
2165
|
-
setMoving(true);
|
|
2166
|
-
}
|
|
2167
|
-
})
|
|
2168
|
-
}), portalTarget);
|
|
2169
|
-
};
|
|
2170
|
-
const HorizontalScroller = /*#__PURE__*/react.forwardRef(({
|
|
2171
|
-
className,
|
|
2172
|
-
enabled = true,
|
|
2173
|
-
getPortalContainer,
|
|
2174
|
-
children
|
|
2175
|
-
}, forwardedRef) => {
|
|
2176
|
-
const [metrics, setMetrics] = react.useState(null);
|
|
2177
|
-
const containerRef = react.useRef(null);
|
|
2178
|
-
const scrollElRef = react.useRef(null);
|
|
2179
|
-
const viewportStateRef = react.useRef(null);
|
|
2180
|
-
const metricsRef = react.useRef(null);
|
|
2181
|
-
const setContainerRef = useRefCallback__default["default"](node => {
|
|
2182
|
-
containerRef.current = node;
|
|
2183
|
-
if (typeof forwardedRef === 'function') {
|
|
2184
|
-
forwardedRef(node);
|
|
2185
|
-
} else if (forwardedRef) {
|
|
2186
|
-
forwardedRef.current = node;
|
|
2187
|
-
}
|
|
2188
|
-
});
|
|
2189
|
-
const updateMetrics = useRefCallback__default["default"](() => {
|
|
2190
|
-
const scrollEl = scrollElRef.current;
|
|
2191
|
-
if (!scrollEl) {
|
|
2192
|
-
metricsRef.current = null;
|
|
2193
|
-
setMetrics(null);
|
|
2194
|
-
return;
|
|
2195
|
-
}
|
|
2196
|
-
const nextMetrics = computeBarMetrics(scrollEl, viewportStateRef.current, getPortalContainer);
|
|
2197
|
-
if (metricsEqual(metricsRef.current, nextMetrics)) {
|
|
2198
|
-
return;
|
|
2199
|
-
}
|
|
2200
|
-
metricsRef.current = nextMetrics;
|
|
2201
|
-
setMetrics(nextMetrics);
|
|
2202
|
-
});
|
|
2203
|
-
const handleThumbDrag = useRefCallback__default["default"](deltaX => {
|
|
2204
|
-
const scrollEl = scrollElRef.current;
|
|
2205
|
-
if (!scrollEl) {
|
|
2206
|
-
return;
|
|
2207
|
-
}
|
|
2208
|
-
const trackWidth = scrollEl.clientWidth;
|
|
2209
|
-
const scrollableWidth = scrollEl.scrollWidth - scrollEl.clientWidth;
|
|
2210
|
-
const thumbWidth = Math.max(trackWidth * scrollEl.clientWidth / scrollEl.scrollWidth - THUMB_MARGIN * 2, 24);
|
|
2211
|
-
const thumbTravel = trackWidth - thumbWidth - THUMB_MARGIN * 2;
|
|
2212
|
-
if (thumbTravel <= 0) {
|
|
2213
|
-
return;
|
|
2214
|
-
}
|
|
2215
|
-
scrollEl.scrollLeft += deltaX / thumbTravel * scrollableWidth;
|
|
2216
|
-
updateMetrics();
|
|
2217
|
-
});
|
|
2218
|
-
react.useEffect(() => {
|
|
2219
|
-
if (!enabled) {
|
|
2220
|
-
scrollElRef.current = null;
|
|
2221
|
-
viewportStateRef.current = null;
|
|
2222
|
-
metricsRef.current = null;
|
|
2223
|
-
setMetrics(null);
|
|
2224
|
-
return undefined;
|
|
2225
|
-
}
|
|
2226
|
-
const root = containerRef.current;
|
|
2227
|
-
if (!root) {
|
|
2228
|
-
return undefined;
|
|
2229
|
-
}
|
|
2230
|
-
let scrollEl = null;
|
|
2231
|
-
let unobserveViewport = null;
|
|
2232
|
-
let contentResizeObserver = null;
|
|
2233
|
-
const portalContainer = typeof getPortalContainer === 'function' ? getPortalContainer() : null;
|
|
2234
|
-
const useEmbeddedPlacement = !isDocumentScrollContainer(portalContainer);
|
|
2235
|
-
const detachScrollEl = () => {
|
|
2236
|
-
unobserveViewport?.();
|
|
2237
|
-
unobserveViewport = null;
|
|
2238
|
-
if (!scrollEl) {
|
|
2239
|
-
return;
|
|
2240
|
-
}
|
|
2241
|
-
scrollEl.removeEventListener('scroll', updateMetrics);
|
|
2242
|
-
contentResizeObserver?.disconnect();
|
|
2243
|
-
contentResizeObserver = null;
|
|
2244
|
-
scrollElRef.current = null;
|
|
2245
|
-
viewportStateRef.current = null;
|
|
2246
|
-
scrollEl = null;
|
|
2247
|
-
};
|
|
2248
|
-
const attachScrollEl = nextScrollEl => {
|
|
2249
|
-
if (!nextScrollEl || nextScrollEl === scrollEl) {
|
|
2250
|
-
return;
|
|
2251
|
-
}
|
|
2252
|
-
detachScrollEl();
|
|
2253
|
-
scrollEl = nextScrollEl;
|
|
2254
|
-
scrollElRef.current = scrollEl;
|
|
2255
|
-
if (!useEmbeddedPlacement) {
|
|
2256
|
-
unobserveViewport = observeViewportIntersection(scrollEl, state => {
|
|
2257
|
-
viewportStateRef.current = state;
|
|
2258
|
-
updateMetrics();
|
|
2259
|
-
});
|
|
2260
|
-
}
|
|
2261
|
-
scrollEl.addEventListener('scroll', updateMetrics, {
|
|
2262
|
-
passive: true
|
|
2263
|
-
});
|
|
2264
|
-
contentResizeObserver = new ResizeObserver(updateMetrics);
|
|
2265
|
-
contentResizeObserver.observe(scrollEl);
|
|
2266
|
-
Array.from(scrollEl.children).forEach(child => {
|
|
2267
|
-
contentResizeObserver.observe(child);
|
|
2268
|
-
});
|
|
2269
|
-
};
|
|
2270
|
-
const onLayoutChange = () => {
|
|
2271
|
-
attachScrollEl(getTableScrollElement(root));
|
|
2272
|
-
updateMetrics();
|
|
2273
|
-
};
|
|
2274
|
-
const containerResizeObserver = new ResizeObserver(onLayoutChange);
|
|
2275
|
-
containerResizeObserver.observe(root);
|
|
2276
|
-
onLayoutChange();
|
|
2277
|
-
const onWindowChange = () => {
|
|
2278
|
-
if (!useEmbeddedPlacement) {
|
|
2279
|
-
updateMetrics();
|
|
2280
|
-
}
|
|
2281
|
-
};
|
|
2282
|
-
if (!useEmbeddedPlacement) {
|
|
2283
|
-
window.addEventListener('scroll', onWindowChange, true);
|
|
2284
|
-
window.addEventListener('resize', onWindowChange);
|
|
2285
|
-
window.visualViewport?.addEventListener('resize', onWindowChange);
|
|
2286
|
-
window.visualViewport?.addEventListener('scroll', onWindowChange);
|
|
2287
|
-
}
|
|
2288
|
-
if (useEmbeddedPlacement && portalContainer) {
|
|
2289
|
-
portalContainer.addEventListener('scroll', updateMetrics, {
|
|
2290
|
-
passive: true
|
|
2291
|
-
});
|
|
2292
|
-
window.addEventListener('resize', updateMetrics);
|
|
2293
|
-
}
|
|
2294
|
-
return () => {
|
|
2295
|
-
detachScrollEl();
|
|
2296
|
-
containerResizeObserver.disconnect();
|
|
2297
|
-
if (!useEmbeddedPlacement) {
|
|
2298
|
-
window.removeEventListener('scroll', onWindowChange, true);
|
|
2299
|
-
window.removeEventListener('resize', onWindowChange);
|
|
2300
|
-
window.visualViewport?.removeEventListener('resize', onWindowChange);
|
|
2301
|
-
window.visualViewport?.removeEventListener('scroll', onWindowChange);
|
|
2302
|
-
}
|
|
2303
|
-
if (useEmbeddedPlacement && portalContainer) {
|
|
2304
|
-
portalContainer.removeEventListener('scroll', updateMetrics);
|
|
2305
|
-
window.removeEventListener('resize', updateMetrics);
|
|
2306
|
-
}
|
|
2307
|
-
};
|
|
2308
|
-
}, [enabled, updateMetrics, getPortalContainer]);
|
|
2309
|
-
return /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
2310
|
-
children: [/*#__PURE__*/jsxRuntime.jsx("div", {
|
|
2311
|
-
ref: setContainerRef,
|
|
2312
|
-
className: className,
|
|
2313
|
-
children: children
|
|
2314
|
-
}), enabled ? /*#__PURE__*/jsxRuntime.jsx(FloatingScrollBar, {
|
|
2315
|
-
metrics: metrics,
|
|
2316
|
-
onThumbDrag: handleThumbDrag,
|
|
2317
|
-
getPortalContainer: getPortalContainer
|
|
2318
|
-
}) : null]
|
|
2319
|
-
});
|
|
2320
|
-
});
|
|
1963
|
+
var style$1 = {"table-page":"kne-table-page_ut9rJ","fetch-stack":"kne-table-page_dpy7d","toolbar-height-reserve":"kne-table-page_daceW","table-page-tabs-outer":"kne-table-page_IowJl","table-content":"kne-table-page_dxN6N","table-with-toolbar":"kne-table-page_sf06r","is-sticky":"kne-table-page_7lYyk","is-loading-shell":"kne-table-page_LY8zA","is-mobile-render":"kne-table-page_D6KGb","has-summary":"kne-table-page_IRdzb","table-cell-skeleton":"kne-table-page_--DrO","table-skeleton-spin":"kne-table-page_cZ1zq","table-in-toolbar":"kne-table-page_sawIT","is-card-mode":"kne-table-page_kH6wM","is-card-render":"kne-table-page_-WbMN","card-mode-toggle":"kne-table-page_ostpI","mobile-load-more":"kne-table-page_UqVnb","pagination":"kne-table-page_DSTEf","total_text":"kne-table-page_pJhKr"};
|
|
2321
1964
|
|
|
2322
1965
|
const hasButtonGroupList = buttonGroup => Array.isArray(buttonGroup?.list) && buttonGroup.list.length > 0;
|
|
2323
1966
|
const normalizeButtonGroupList = (list, defaultSize) => {
|
|
@@ -2377,7 +2020,7 @@ const resolveToolbarButtonGroupProps = (buttonGroup, getPopupContainer) => {
|
|
|
2377
2020
|
});
|
|
2378
2021
|
};
|
|
2379
2022
|
|
|
2380
|
-
var style = {"kne-responsive-boundary":"kne-table-page_u90lj","kne-responsive-scroll":"kne-table-page_bSj1H","table-toolbar-section":"kne-table-page_I21Xn","has-value-display":"kne-table-page_COnMY","table-toolbar":"kne-table-page_x6mv7","table-toolbar-value-display":"kne-table-page_vbwMg","table-toolbar-batch":"kne-table-page_k8-Ku","table-toolbar-batch-btn":"kne-table-page_gZtbT","table-toolbar-batch-clear-btn":"kne-table-page_o6Oml","table-toolbar-actions":"kne-table-page_t3-57","table-toolbar-button-group":"kne-table-page_2sdSC","table-toolbar-search":"kne-table-page_pB5en","table-toolbar-search-
|
|
2023
|
+
var style = {"kne-responsive-boundary":"kne-table-page_u90lj","kne-responsive-scroll":"kne-table-page_bSj1H","table-toolbar-section":"kne-table-page_I21Xn","has-value-display":"kne-table-page_COnMY","table-toolbar":"kne-table-page_x6mv7","table-toolbar-value-display":"kne-table-page_vbwMg","is-mobile":"kne-table-page_n9eAS","table-toolbar-batch":"kne-table-page_k8-Ku","table-toolbar-batch-btn":"kne-table-page_gZtbT","table-toolbar-batch-clear-btn":"kne-table-page_o6Oml","table-toolbar-actions":"kne-table-page_t3-57","table-toolbar-button-group":"kne-table-page_2sdSC","table-toolbar-search":"kne-table-page_pB5en","table-toolbar-search-row":"kne-table-page_zuGJv","table-toolbar-search-input":"kne-table-page_t60hK","table-page-tabs":"kne-table-page_UTy3R","is-mobile-render":"kne-table-page_J-AEV","table-toolbar-mobile-actions":"kne-table-page_I--A1","has-mobile-search":"kne-table-page_14SJt","has-mobile-search-only":"kne-table-page_Y5IR1","has-tabs":"kne-table-page_EImBh","table-toolbar-mobile-filter-row":"kne-table-page_Qo5Zl","table-toolbar-filter":"kne-table-page_Jyfm7","table-toolbar-filter-inner":"kne-table-page_AX3aK","table-toolbar-divider":"kne-table-page_z--2N","table-toolbar-filter-outer":"kne-table-page_PiWGM"};
|
|
2381
2024
|
|
|
2382
2025
|
const TAB_ALL_KEY = '__all__';
|
|
2383
2026
|
const getTabActiveKey = (filterValue, tabName) => {
|
|
@@ -2463,7 +2106,6 @@ const BatchActions = ({
|
|
|
2463
2106
|
const {
|
|
2464
2107
|
formatMessage
|
|
2465
2108
|
} = reactIntl.useIntl();
|
|
2466
|
-
const isMobile = responsiveUtils.useIsMobile();
|
|
2467
2109
|
const getPopupContainer = responsiveUtils.usePopupContainer();
|
|
2468
2110
|
const selectedRowKeys = rowSelection?.selectedRowKeys || [];
|
|
2469
2111
|
const hasSelection = selectedRowKeys.length > 0;
|
|
@@ -2502,11 +2144,7 @@ const BatchActions = ({
|
|
|
2502
2144
|
if (batchMenuItems.length === 0) {
|
|
2503
2145
|
return null;
|
|
2504
2146
|
}
|
|
2505
|
-
const batchButtonLabel = hasSelection ?
|
|
2506
|
-
id: 'BatchOperationsMobileSelected'
|
|
2507
|
-
}, {
|
|
2508
|
-
count: selectedRowKeys.length
|
|
2509
|
-
}) : formatMessage({
|
|
2147
|
+
const batchButtonLabel = hasSelection ? formatMessage({
|
|
2510
2148
|
id: 'BatchOperationsWithCount'
|
|
2511
2149
|
}, {
|
|
2512
2150
|
count: selectedRowKeys.length
|
|
@@ -2529,9 +2167,8 @@ const BatchActions = ({
|
|
|
2529
2167
|
children: [batchButtonLabel, /*#__PURE__*/jsxRuntime.jsx(icons.DownOutlined, {})]
|
|
2530
2168
|
})
|
|
2531
2169
|
}), hasSelection ? /*#__PURE__*/jsxRuntime.jsx(antd.Button, {
|
|
2532
|
-
danger: true,
|
|
2533
2170
|
size: "small",
|
|
2534
|
-
icon: /*#__PURE__*/jsxRuntime.jsx(icons.
|
|
2171
|
+
icon: /*#__PURE__*/jsxRuntime.jsx(icons.MinusSquareOutlined, {}),
|
|
2535
2172
|
title: formatMessage({
|
|
2536
2173
|
id: 'Cancel'
|
|
2537
2174
|
}),
|
|
@@ -2594,11 +2231,18 @@ const TableToolbar = ({
|
|
|
2594
2231
|
...searchRest
|
|
2595
2232
|
} = search || {};
|
|
2596
2233
|
|
|
2597
|
-
// tab 已有选中态展示,已选筛选标签中不再重复显示 tab
|
|
2598
|
-
const displayFilterValue = hasTab ? (filterValue || []).filter(item => item?.name !== tab.name) : filterValue || []
|
|
2234
|
+
// tab 已有选中态展示,已选筛选标签中不再重复显示 tab 的值;多选清空后的 { value: [] } 也不展示
|
|
2235
|
+
const displayFilterValue = (hasTab ? (filterValue || []).filter(item => item?.name !== tab.name) : filterValue || []).filter(item => {
|
|
2236
|
+
const v = item?.value;
|
|
2237
|
+
if (v === null || v === undefined) return false;
|
|
2238
|
+
if (typeof v === 'string' && v.trim() === '') return false;
|
|
2239
|
+
if (Array.isArray(v) && v.length === 0) return false;
|
|
2240
|
+
return true;
|
|
2241
|
+
});
|
|
2599
2242
|
const handleValueDisplayChange = next => {
|
|
2600
2243
|
const tabEntry = hasTab ? (filterValue || []).find(item => item?.name === tab.name) : null;
|
|
2601
|
-
|
|
2244
|
+
const payload = tabEntry ? [...(next || []), tabEntry] : next;
|
|
2245
|
+
onFilterChange(payload);
|
|
2602
2246
|
};
|
|
2603
2247
|
const hasValueDisplay = displayFilterValue.length > 0;
|
|
2604
2248
|
const showMobileSearchRow = isMobile && showSearch;
|
|
@@ -2880,9 +2524,238 @@ const isPaginationSearchParamsEnabled = pagination => {
|
|
|
2880
2524
|
return !!(pagination?.searchParams && typeof pagination.setSearchParams === 'function');
|
|
2881
2525
|
};
|
|
2882
2526
|
|
|
2883
|
-
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", "tab", "tabProps", "batchActions", "buttonGroup", "selectedRows", "rowSelection", "renderMobile", "renderCard", "forceCard", "mobileSortToolbar"],
|
|
2884
|
-
_excluded2 = ["
|
|
2885
|
-
_excluded3 = ["
|
|
2527
|
+
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", "tab", "tabProps", "batchActions", "buttonGroup", "selectedRows", "rowSelection", "renderMobile", "renderCard", "forceCard", "mobileSortToolbar", "filterSeedParams"],
|
|
2528
|
+
_excluded2 = ["loading"],
|
|
2529
|
+
_excluded3 = ["pagination", "horizontalScroller", "getScrollContainer", "filter"],
|
|
2530
|
+
_excluded4 = ["searchParamsValue"];
|
|
2531
|
+
const noop = () => {};
|
|
2532
|
+
const SKELETON_ROW_COUNT = 8;
|
|
2533
|
+
const FALLBACK_SKELETON_COLUMNS = 5;
|
|
2534
|
+
|
|
2535
|
+
/** 是否存在工具栏 / Filter 区域(首屏 loading 需占位保高) */
|
|
2536
|
+
const hasToolbarArea = (_ref, isMobile) => {
|
|
2537
|
+
var _filter$list;
|
|
2538
|
+
let filter = _ref.filter,
|
|
2539
|
+
search = _ref.search,
|
|
2540
|
+
tab = _ref.tab,
|
|
2541
|
+
batchActions = _ref.batchActions,
|
|
2542
|
+
buttonGroup = _ref.buttonGroup,
|
|
2543
|
+
renderCard = _ref.renderCard,
|
|
2544
|
+
forceCard = _ref.forceCard;
|
|
2545
|
+
const hasTab = !!(tab != null && tab.name && Array.isArray(tab.list) && tab.list.length > 0);
|
|
2546
|
+
const hasFilter = !!((filter == null || (_filter$list = filter.list) == null ? void 0 : _filter$list.length) > 0);
|
|
2547
|
+
const hasSearch = !!(search && search.name);
|
|
2548
|
+
const hasBatch = Array.isArray(batchActions) && batchActions.length > 0;
|
|
2549
|
+
const hasBtn = hasButtonGroupList(buttonGroup);
|
|
2550
|
+
const hasCardToggle = !isMobile && resolveRenderCard(renderCard) != null && !forceCard;
|
|
2551
|
+
return hasTab || hasFilter || hasSearch || hasBatch || hasBtn || hasCardToggle;
|
|
2552
|
+
};
|
|
2553
|
+
const flattenLeafColumns = function (columns, output) {
|
|
2554
|
+
if (output === void 0) {
|
|
2555
|
+
output = [];
|
|
2556
|
+
}
|
|
2557
|
+
(columns || []).forEach(column => {
|
|
2558
|
+
if (Array.isArray(column == null ? void 0 : column.children) && column.children.length > 0) {
|
|
2559
|
+
flattenLeafColumns(column.children, output);
|
|
2560
|
+
return;
|
|
2561
|
+
}
|
|
2562
|
+
output.push(column);
|
|
2563
|
+
});
|
|
2564
|
+
return output;
|
|
2565
|
+
};
|
|
2566
|
+
|
|
2567
|
+
/** 首包无 data 时尽量解析列配置;失败则用占位列 */
|
|
2568
|
+
const resolveLoadingColumns = (columns, getColumns) => {
|
|
2569
|
+
try {
|
|
2570
|
+
const raw = typeof getColumns === 'function' ? getColumns(null) : typeof columns === 'function' ? columns(null) : columns;
|
|
2571
|
+
if (!Array.isArray(raw) || raw.length === 0) {
|
|
2572
|
+
return null;
|
|
2573
|
+
}
|
|
2574
|
+
return flattenLeafColumns(tableView.resolveColumns(raw));
|
|
2575
|
+
} catch (e) {
|
|
2576
|
+
return null;
|
|
2577
|
+
}
|
|
2578
|
+
};
|
|
2579
|
+
const CellSkeleton = () => /*#__PURE__*/jsxRuntime.jsx(antd.Skeleton.Button, {
|
|
2580
|
+
active: true,
|
|
2581
|
+
size: "small",
|
|
2582
|
+
className: style$1['table-cell-skeleton'],
|
|
2583
|
+
style: {
|
|
2584
|
+
width: '70%'
|
|
2585
|
+
}
|
|
2586
|
+
});
|
|
2587
|
+
|
|
2588
|
+
/**
|
|
2589
|
+
* 产出 Table / TableView 共用列:
|
|
2590
|
+
* - 用 render 画骨架(不用 placeholder)
|
|
2591
|
+
* - valueIsEmpty 恒 false,避免 TableView removeEmpty 把空列滤掉导致格子空白
|
|
2592
|
+
*/
|
|
2593
|
+
const buildSkeletonTableColumns = leafColumns => {
|
|
2594
|
+
const source = leafColumns && leafColumns.length > 0 ? leafColumns : Array.from({
|
|
2595
|
+
length: FALLBACK_SKELETON_COLUMNS
|
|
2596
|
+
}, (_, index) => ({
|
|
2597
|
+
name: "__skeleton_col_" + index,
|
|
2598
|
+
title: ' '
|
|
2599
|
+
}));
|
|
2600
|
+
return source.map((column, index) => {
|
|
2601
|
+
var _column$title;
|
|
2602
|
+
return {
|
|
2603
|
+
name: column.name || column.key || "__skeleton_col_" + index,
|
|
2604
|
+
title: typeof column.title === 'function' ? ' ' : (_column$title = column.title) != null ? _column$title : ' ',
|
|
2605
|
+
width: column.width,
|
|
2606
|
+
min: column.min,
|
|
2607
|
+
max: column.max,
|
|
2608
|
+
fixed: column.fixed,
|
|
2609
|
+
justify: column.justify,
|
|
2610
|
+
align: column.align,
|
|
2611
|
+
span: column.span,
|
|
2612
|
+
valueIsEmpty: () => false,
|
|
2613
|
+
getValueOf: () => '__skeleton__',
|
|
2614
|
+
render: () => /*#__PURE__*/jsxRuntime.jsx(CellSkeleton, {})
|
|
2615
|
+
};
|
|
2616
|
+
});
|
|
2617
|
+
};
|
|
2618
|
+
const buildSkeletonDataSource = function (rowCount) {
|
|
2619
|
+
if (rowCount === void 0) {
|
|
2620
|
+
rowCount = SKELETON_ROW_COUNT;
|
|
2621
|
+
}
|
|
2622
|
+
return Array.from({
|
|
2623
|
+
length: rowCount
|
|
2624
|
+
}, (_, index) => ({
|
|
2625
|
+
id: "__skeleton_row_" + index
|
|
2626
|
+
}));
|
|
2627
|
+
};
|
|
2628
|
+
|
|
2629
|
+
/**
|
|
2630
|
+
* withFetch 首包 loading:Toolbar/Filter 占位保高 + Table/TableView 骨架屏 + loading,
|
|
2631
|
+
* 复用正式表格样式,避免全局绝对定位 Spin 把高度塌成 0。
|
|
2632
|
+
*/
|
|
2633
|
+
const TablePageLoadingShell = withLocale(_ref2 => {
|
|
2634
|
+
var _filter$list2;
|
|
2635
|
+
let filter = _ref2.filter,
|
|
2636
|
+
search = _ref2.search,
|
|
2637
|
+
tab = _ref2.tab,
|
|
2638
|
+
tabProps = _ref2.tabProps,
|
|
2639
|
+
batchActions = _ref2.batchActions,
|
|
2640
|
+
buttonGroup = _ref2.buttonGroup,
|
|
2641
|
+
rowSelection = _ref2.rowSelection,
|
|
2642
|
+
selectedRows = _ref2.selectedRows,
|
|
2643
|
+
_ref2$renderMobile = _ref2.renderMobile,
|
|
2644
|
+
renderMobile = _ref2$renderMobile === void 0 ? true : _ref2$renderMobile,
|
|
2645
|
+
renderCard = _ref2.renderCard,
|
|
2646
|
+
_ref2$forceCard = _ref2.forceCard,
|
|
2647
|
+
forceCard = _ref2$forceCard === void 0 ? false : _ref2$forceCard,
|
|
2648
|
+
columns = _ref2.columns,
|
|
2649
|
+
getColumns = _ref2.getColumns,
|
|
2650
|
+
_ref2$pagination = _ref2.pagination,
|
|
2651
|
+
pagination = _ref2$pagination === void 0 ? {} : _ref2$pagination,
|
|
2652
|
+
className = _ref2.className,
|
|
2653
|
+
size = _ref2.size,
|
|
2654
|
+
_ref2$renderType = _ref2.renderType,
|
|
2655
|
+
renderType = _ref2$renderType === void 0 ? 'Table' : _ref2$renderType;
|
|
2656
|
+
const isMobile = responsiveUtils.useIsMobile();
|
|
2657
|
+
const isMobileRenderActive = tableView.isRenderMobileActive(renderMobile, isMobile);
|
|
2658
|
+
const showButtonGroup = hasButtonGroupList(buttonGroup);
|
|
2659
|
+
const resolvedRenderCard = resolveRenderCard(renderCard);
|
|
2660
|
+
const showCardModeToggle = resolvedRenderCard != null && !isMobile && !forceCard;
|
|
2661
|
+
const hasTab = !!(tab != null && tab.name && Array.isArray(tab.list) && tab.list.length > 0);
|
|
2662
|
+
const hasInnerToolbar = !!(filter != null && (_filter$list2 = filter.list) != null && _filter$list2.length || search && search.name || batchActions && batchActions.length || showButtonGroup || showCardModeToggle);
|
|
2663
|
+
const showOuterTab = hasTab && !isMobile;
|
|
2664
|
+
const showInnerTab = hasTab && isMobile;
|
|
2665
|
+
const wrapWithToolbar = hasInnerToolbar || showInnerTab;
|
|
2666
|
+
const filterValue = resolveInitialFilterValue(filter);
|
|
2667
|
+
const SkeletonTableComponent = TABLE_COMPONENTS[renderType] || Table;
|
|
2668
|
+
const useAntdTable = SkeletonTableComponent === Table;
|
|
2669
|
+
const skeletonRowCount = Math.min(Math.max(Number(pagination.pageSize) || SKELETON_ROW_COUNT, 3), SKELETON_ROW_COUNT);
|
|
2670
|
+
const skeletonColumns = react.useMemo(() => buildSkeletonTableColumns(resolveLoadingColumns(columns, getColumns)), [columns, getColumns]);
|
|
2671
|
+
const skeletonDataSource = react.useMemo(() => buildSkeletonDataSource(skeletonRowCount), [skeletonRowCount]);
|
|
2672
|
+
// 与正式表一致保留选择列占位(含表头全选/隐藏 checkbox 宽度);禁用交互
|
|
2673
|
+
const skeletonRowSelection = react.useMemo(() => {
|
|
2674
|
+
if (!rowSelection) {
|
|
2675
|
+
return undefined;
|
|
2676
|
+
}
|
|
2677
|
+
return {
|
|
2678
|
+
type: rowSelection.type === 'radio' ? 'radio' : 'checkbox',
|
|
2679
|
+
allowSelectedAll: rowSelection.allowSelectedAll,
|
|
2680
|
+
selectedRowKeys: [],
|
|
2681
|
+
onChange: noop,
|
|
2682
|
+
getCheckboxProps: () => ({
|
|
2683
|
+
disabled: true
|
|
2684
|
+
})
|
|
2685
|
+
};
|
|
2686
|
+
}, [rowSelection]);
|
|
2687
|
+
const cardModeToggleNode = showCardModeToggle ? /*#__PURE__*/jsxRuntime.jsx(antd.Segmented, {
|
|
2688
|
+
className: style$1['card-mode-toggle'],
|
|
2689
|
+
size: "small",
|
|
2690
|
+
value: "table",
|
|
2691
|
+
options: [{
|
|
2692
|
+
value: 'table',
|
|
2693
|
+
icon: /*#__PURE__*/jsxRuntime.jsx(icons.TableOutlined, {})
|
|
2694
|
+
}, {
|
|
2695
|
+
value: 'card',
|
|
2696
|
+
icon: /*#__PURE__*/jsxRuntime.jsx(icons.AppstoreOutlined, {})
|
|
2697
|
+
}]
|
|
2698
|
+
}) : null;
|
|
2699
|
+
|
|
2700
|
+
// renderType=TableView 时骨架也用 TableView;桌面端 Table 可透传 loading,其余外层 Spin
|
|
2701
|
+
const showOuterSpin = isMobileRenderActive || !useAntdTable;
|
|
2702
|
+
const tableSkeleton = /*#__PURE__*/jsxRuntime.jsx(SkeletonTableComponent, _extends({
|
|
2703
|
+
className: classnames__default["default"]({
|
|
2704
|
+
[style$1['table-in-toolbar']]: wrapWithToolbar
|
|
2705
|
+
}, className),
|
|
2706
|
+
columns: skeletonColumns,
|
|
2707
|
+
dataSource: skeletonDataSource,
|
|
2708
|
+
rowSelection: skeletonRowSelection
|
|
2709
|
+
}, useAntdTable ? {
|
|
2710
|
+
loading: !showOuterSpin,
|
|
2711
|
+
controllerOpen: false,
|
|
2712
|
+
pagination: false
|
|
2713
|
+
} : null, {
|
|
2714
|
+
rowKey: "id",
|
|
2715
|
+
size: size,
|
|
2716
|
+
renderMobile: renderMobile,
|
|
2717
|
+
empty: null
|
|
2718
|
+
}), "skeleton-" + renderType);
|
|
2719
|
+
const skeletonNode = showOuterSpin ? /*#__PURE__*/jsxRuntime.jsx(antd.Spin, {
|
|
2720
|
+
spinning: true,
|
|
2721
|
+
className: style$1['table-skeleton-spin'],
|
|
2722
|
+
children: tableSkeleton
|
|
2723
|
+
}) : tableSkeleton;
|
|
2724
|
+
const toolbarNode = wrapWithToolbar ? /*#__PURE__*/jsxRuntime.jsx(TableToolbar, {
|
|
2725
|
+
filterValue: filterValue,
|
|
2726
|
+
onFilterChange: noop,
|
|
2727
|
+
filter: filter,
|
|
2728
|
+
search: search,
|
|
2729
|
+
tab: tab,
|
|
2730
|
+
tabProps: tabProps,
|
|
2731
|
+
renderTab: showInnerTab,
|
|
2732
|
+
batchActions: batchActions,
|
|
2733
|
+
buttonGroup: buttonGroup,
|
|
2734
|
+
rowSelection: rowSelection,
|
|
2735
|
+
selectedRows: selectedRows,
|
|
2736
|
+
isMobileRender: isMobileRenderActive,
|
|
2737
|
+
cardModeToggle: cardModeToggleNode
|
|
2738
|
+
}) : null;
|
|
2739
|
+
return /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
2740
|
+
className: style$1['table-page'],
|
|
2741
|
+
children: /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
2742
|
+
className: style$1['table-content'],
|
|
2743
|
+
children: [showOuterTab ? /*#__PURE__*/jsxRuntime.jsx(TablePageTabs, {
|
|
2744
|
+
filterValue: filterValue,
|
|
2745
|
+
onFilterChange: noop,
|
|
2746
|
+
tab: tab,
|
|
2747
|
+
tabProps: tabProps,
|
|
2748
|
+
className: style$1['table-page-tabs-outer'],
|
|
2749
|
+
isMobileRender: isMobileRenderActive
|
|
2750
|
+
}) : null, wrapWithToolbar ? /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
2751
|
+
className: classnames__default["default"](style$1['table-with-toolbar'], style$1['is-loading-shell'], {
|
|
2752
|
+
[style$1['is-mobile-render']]: isMobileRenderActive
|
|
2753
|
+
}),
|
|
2754
|
+
children: [toolbarNode, skeletonNode]
|
|
2755
|
+
}) : skeletonNode]
|
|
2756
|
+
})
|
|
2757
|
+
});
|
|
2758
|
+
});
|
|
2886
2759
|
const defaultMergeList = (data, newData) => {
|
|
2887
2760
|
return Object.assign({}, newData, {
|
|
2888
2761
|
pageData: [...((data == null ? void 0 : data.pageData) || []), ...((newData == null ? void 0 : newData.pageData) || [])]
|
|
@@ -2960,7 +2833,13 @@ const collectFilterFieldNames = (filter, search, tab) => {
|
|
|
2960
2833
|
}
|
|
2961
2834
|
if (Array.isArray(filter == null ? void 0 : filter.list)) {
|
|
2962
2835
|
filter.list.forEach(row => {
|
|
2836
|
+
// 兼容扁平 list:[{ type, props }];以及分组 list:[[item, item]]
|
|
2963
2837
|
if (!Array.isArray(row)) {
|
|
2838
|
+
var _row$props;
|
|
2839
|
+
const name = row == null || (_row$props = row.props) == null ? void 0 : _row$props.name;
|
|
2840
|
+
if (name) {
|
|
2841
|
+
names.add(name);
|
|
2842
|
+
}
|
|
2964
2843
|
return;
|
|
2965
2844
|
}
|
|
2966
2845
|
row.forEach(item => {
|
|
@@ -2981,55 +2860,85 @@ const omitFilterParams = (params, filterFieldNames) => {
|
|
|
2981
2860
|
});
|
|
2982
2861
|
return next;
|
|
2983
2862
|
};
|
|
2984
|
-
const
|
|
2985
|
-
|
|
2986
|
-
|
|
2987
|
-
|
|
2988
|
-
|
|
2989
|
-
|
|
2990
|
-
|
|
2991
|
-
|
|
2992
|
-
|
|
2993
|
-
|
|
2994
|
-
|
|
2995
|
-
|
|
2863
|
+
const isPlainObject = value => !!value && typeof value === 'object' && !Array.isArray(value);
|
|
2864
|
+
|
|
2865
|
+
// lodash.merge 不会删掉「新对象里没有的嵌套 key」,且 [] 合并不了旧数组;清空一律写 null
|
|
2866
|
+
const withNestedClears = (prevParams, nextParams) => {
|
|
2867
|
+
const result = Object.assign({}, nextParams);
|
|
2868
|
+
Object.keys(prevParams || {}).forEach(key => {
|
|
2869
|
+
const prevVal = prevParams[key];
|
|
2870
|
+
const nextVal = nextParams[key];
|
|
2871
|
+
if (!isPlainObject(prevVal)) {
|
|
2872
|
+
return;
|
|
2873
|
+
}
|
|
2874
|
+
if (isPlainObject(nextVal)) {
|
|
2875
|
+
const nested = {};
|
|
2876
|
+
Object.keys(prevVal).forEach(nestedKey => {
|
|
2877
|
+
if (!(nestedKey in nextVal)) {
|
|
2878
|
+
nested[nestedKey] = null;
|
|
2879
|
+
}
|
|
2880
|
+
});
|
|
2881
|
+
result[key] = Object.assign({}, nested, nextVal);
|
|
2882
|
+
return;
|
|
2883
|
+
}
|
|
2884
|
+
if (nextVal === undefined) {
|
|
2885
|
+
// 整个嵌套对象被拿掉时,直接 null 覆盖(比逐字段 { ids: null } 更干净)
|
|
2886
|
+
result[key] = null;
|
|
2887
|
+
}
|
|
2888
|
+
});
|
|
2889
|
+
return result;
|
|
2890
|
+
};
|
|
2891
|
+
const TablePageInnerContent = withLocale(_ref3 => {
|
|
2892
|
+
var _filter$list3;
|
|
2893
|
+
let data = _ref3.data,
|
|
2894
|
+
refresh = _ref3.refresh,
|
|
2895
|
+
reload = _ref3.reload,
|
|
2896
|
+
requestParams = _ref3.requestParams,
|
|
2897
|
+
fetchProps = _ref3.fetchProps,
|
|
2898
|
+
isComplete = _ref3.isComplete,
|
|
2899
|
+
loadMore = _ref3.loadMore,
|
|
2900
|
+
send = _ref3.send,
|
|
2901
|
+
_ref3$dataFormat = _ref3.dataFormat,
|
|
2902
|
+
dataFormat = _ref3$dataFormat === void 0 ? data => {
|
|
2996
2903
|
return {
|
|
2997
2904
|
list: data.pageData,
|
|
2998
2905
|
total: data.totalCount,
|
|
2999
2906
|
data
|
|
3000
2907
|
};
|
|
3001
|
-
} :
|
|
3002
|
-
className =
|
|
3003
|
-
columns =
|
|
3004
|
-
getColumns =
|
|
3005
|
-
|
|
3006
|
-
pagination =
|
|
3007
|
-
|
|
3008
|
-
columnRenderProps =
|
|
3009
|
-
summary =
|
|
3010
|
-
sticky =
|
|
3011
|
-
scrollTopInset =
|
|
3012
|
-
stickyOffset =
|
|
3013
|
-
|
|
3014
|
-
renderType =
|
|
3015
|
-
|
|
3016
|
-
horizontalScroller =
|
|
3017
|
-
getScrollContainer =
|
|
3018
|
-
filter =
|
|
3019
|
-
search =
|
|
3020
|
-
tab =
|
|
3021
|
-
tabProps =
|
|
3022
|
-
batchActions =
|
|
3023
|
-
buttonGroup =
|
|
3024
|
-
selectedRows =
|
|
3025
|
-
rowSelection =
|
|
3026
|
-
|
|
3027
|
-
renderMobile =
|
|
3028
|
-
renderCard =
|
|
3029
|
-
|
|
3030
|
-
forceCard =
|
|
3031
|
-
mobileSortToolbar =
|
|
3032
|
-
|
|
2908
|
+
} : _ref3$dataFormat,
|
|
2909
|
+
className = _ref3.className,
|
|
2910
|
+
columns = _ref3.columns,
|
|
2911
|
+
getColumns = _ref3.getColumns,
|
|
2912
|
+
_ref3$pagination = _ref3.pagination,
|
|
2913
|
+
pagination = _ref3$pagination === void 0 ? {} : _ref3$pagination,
|
|
2914
|
+
_ref3$columnRenderPro = _ref3.columnRenderProps,
|
|
2915
|
+
columnRenderProps = _ref3$columnRenderPro === void 0 ? {} : _ref3$columnRenderPro,
|
|
2916
|
+
summary = _ref3.summary,
|
|
2917
|
+
sticky = _ref3.sticky,
|
|
2918
|
+
scrollTopInset = _ref3.scrollTopInset,
|
|
2919
|
+
stickyOffset = _ref3.stickyOffset,
|
|
2920
|
+
_ref3$renderType = _ref3.renderType,
|
|
2921
|
+
renderType = _ref3$renderType === void 0 ? 'Table' : _ref3$renderType,
|
|
2922
|
+
_ref3$horizontalScrol = _ref3.horizontalScroller,
|
|
2923
|
+
horizontalScroller = _ref3$horizontalScrol === void 0 ? true : _ref3$horizontalScrol,
|
|
2924
|
+
getScrollContainer = _ref3.getScrollContainer,
|
|
2925
|
+
filter = _ref3.filter,
|
|
2926
|
+
search = _ref3.search,
|
|
2927
|
+
tab = _ref3.tab,
|
|
2928
|
+
tabProps = _ref3.tabProps,
|
|
2929
|
+
batchActions = _ref3.batchActions,
|
|
2930
|
+
buttonGroup = _ref3.buttonGroup,
|
|
2931
|
+
selectedRows = _ref3.selectedRows,
|
|
2932
|
+
rowSelection = _ref3.rowSelection,
|
|
2933
|
+
_ref3$renderMobile = _ref3.renderMobile,
|
|
2934
|
+
renderMobile = _ref3$renderMobile === void 0 ? true : _ref3$renderMobile,
|
|
2935
|
+
renderCard = _ref3.renderCard,
|
|
2936
|
+
_ref3$forceCard = _ref3.forceCard,
|
|
2937
|
+
forceCard = _ref3$forceCard === void 0 ? false : _ref3$forceCard,
|
|
2938
|
+
mobileSortToolbar = _ref3.mobileSortToolbar,
|
|
2939
|
+
_ref3$filterSeedParam = _ref3.filterSeedParams,
|
|
2940
|
+
filterSeedParams = _ref3$filterSeedParam === void 0 ? {} : _ref3$filterSeedParam,
|
|
2941
|
+
props = _objectWithoutPropertiesLoose(_ref3, _excluded);
|
|
3033
2942
|
const _useIntl = reactIntl.useIntl(),
|
|
3034
2943
|
formatMessage = _useIntl.formatMessage;
|
|
3035
2944
|
const isMobile = responsiveUtils.useIsMobile();
|
|
@@ -3062,7 +2971,63 @@ const TablePageInnerContent = withLocale(_ref => {
|
|
|
3062
2971
|
if (extra === void 0) {
|
|
3063
2972
|
extra = {};
|
|
3064
2973
|
}
|
|
3065
|
-
|
|
2974
|
+
const prevFilterParams = Object.assign({}, getFilterParams(filterValue) || {});
|
|
2975
|
+
let filterParams = Object.assign({}, getFilterParams(value) || {});
|
|
2976
|
+
Object.keys(filterParams).forEach(key => {
|
|
2977
|
+
const v = filterParams[key];
|
|
2978
|
+
if (v === undefined || v === '') {
|
|
2979
|
+
delete filterParams[key];
|
|
2980
|
+
} else if (Array.isArray(v) && v.length === 0) {
|
|
2981
|
+
// lodash.merge 用 [] 合并不掉旧数组,改成 null 才能覆盖
|
|
2982
|
+
filterParams[key] = null;
|
|
2983
|
+
}
|
|
2984
|
+
});
|
|
2985
|
+
// mapFilterValue 常返回 { filter: {...} }:嵌套里被删掉的字段写成 null,否则 lodash.merge 会残留
|
|
2986
|
+
filterParams = withNestedClears(prevFilterParams, filterParams);
|
|
2987
|
+
filterParams = withNestedClears(isPlainObject(get__default["default"](requestParams, [pagination.paramsType, 'filter'])) ? {
|
|
2988
|
+
filter: get__default["default"](requestParams, [pagination.paramsType, 'filter'])
|
|
2989
|
+
} : {}, filterParams);
|
|
2990
|
+
const currentParams = get__default["default"](requestParams, pagination.paramsType) || {};
|
|
2991
|
+
const seedParams = filterSeedParams || {};
|
|
2992
|
+
|
|
2993
|
+
// 待清理 key:配置字段 + 旧筛选 + 首包种子(props.data 里的 filterDefaultParams)
|
|
2994
|
+
// react-fetch 用 lodash.merge:省略字段不会覆盖;[] 也合并不掉旧数组,必须显式传 null
|
|
2995
|
+
const keysToClear = new Set([...filterFieldNames, ...Object.keys(prevFilterParams), ...Object.keys(seedParams)]);
|
|
2996
|
+
Object.keys(filterParams).forEach(key => keysToClear.delete(key));
|
|
2997
|
+
keysToClear.delete(pagination.currentName);
|
|
2998
|
+
keysToClear.delete(pagination.pageSizeName);
|
|
2999
|
+
const cleared = {};
|
|
3000
|
+
keysToClear.forEach(name => {
|
|
3001
|
+
cleared[name] = null;
|
|
3002
|
+
});
|
|
3003
|
+
|
|
3004
|
+
// 旧写法把筛选抬升到 props.params.filter,而 mapFilterValue 仍是扁平字段时:必须清掉嵌套 filter 里的同名字段
|
|
3005
|
+
if (isPlainObject(currentParams.filter) && !isPlainObject(filterParams.filter) && filterParams.filter !== null) {
|
|
3006
|
+
const nested = {};
|
|
3007
|
+
const active = new Set(Object.keys(filterParams));
|
|
3008
|
+
new Set([...Object.keys(currentParams.filter), ...filterFieldNames]).forEach(name => {
|
|
3009
|
+
if (name === pagination.currentName || name === pagination.pageSizeName) {
|
|
3010
|
+
return;
|
|
3011
|
+
}
|
|
3012
|
+
if (!active.has(name)) {
|
|
3013
|
+
nested[name] = null;
|
|
3014
|
+
}
|
|
3015
|
+
});
|
|
3016
|
+
Object.keys(filterParams).forEach(name => {
|
|
3017
|
+
if (filterFieldNames.has(name) || name in currentParams.filter) {
|
|
3018
|
+
nested[name] = filterParams[name];
|
|
3019
|
+
delete filterParams[name];
|
|
3020
|
+
}
|
|
3021
|
+
});
|
|
3022
|
+
filterParams.filter = nested;
|
|
3023
|
+
}
|
|
3024
|
+
const merged = Object.assign({}, omitFilterParams(currentParams, keysToClear), extra, cleared, filterParams);
|
|
3025
|
+
Object.keys(merged).forEach(key => {
|
|
3026
|
+
if (merged[key] === undefined) {
|
|
3027
|
+
delete merged[key];
|
|
3028
|
+
}
|
|
3029
|
+
});
|
|
3030
|
+
return merged;
|
|
3066
3031
|
});
|
|
3067
3032
|
const formatData = react.useMemo(() => {
|
|
3068
3033
|
return handlerDataFormat(data);
|
|
@@ -3080,7 +3045,7 @@ const TablePageInnerContent = withLocale(_ref => {
|
|
|
3080
3045
|
pagination
|
|
3081
3046
|
}), [data, fetchProps, requestParams, refresh, reload, loadMore, send, dataFormat, pagination]);
|
|
3082
3047
|
const hasTab = !!(tab != null && tab.name && Array.isArray(tab.list) && tab.list.length > 0);
|
|
3083
|
-
const hasInnerToolbar = !!(filter != null && (_filter$
|
|
3048
|
+
const hasInnerToolbar = !!(filter != null && (_filter$list3 = filter.list) != null && _filter$list3.length || search && search.name || batchActions && batchActions.length || showButtonGroup || showCardModeToggle);
|
|
3084
3049
|
const showOuterTab = hasTab && !isMobile;
|
|
3085
3050
|
const showInnerTab = hasTab && isMobile;
|
|
3086
3051
|
const wrapWithToolbar = hasInnerToolbar || showInnerTab;
|
|
@@ -3116,13 +3081,14 @@ const TablePageInnerContent = withLocale(_ref => {
|
|
|
3116
3081
|
});
|
|
3117
3082
|
});
|
|
3118
3083
|
const handleFilterChange = useRefCallback__default["default"](value => {
|
|
3084
|
+
const nextParams = buildRequestParamsWithFilter(value, {
|
|
3085
|
+
[pagination.currentName]: 1
|
|
3086
|
+
});
|
|
3119
3087
|
setFilterValue(value);
|
|
3120
3088
|
const currentSize = Number(get__default["default"](requestParams, [pagination.paramsType, pagination.pageSizeName], pagination.pageSize)) || pagination.pageSize || 20;
|
|
3121
3089
|
syncPaginationToUrl(1, currentSize);
|
|
3122
3090
|
reload({
|
|
3123
|
-
[pagination.paramsType]:
|
|
3124
|
-
[pagination.currentName]: 1
|
|
3125
|
-
})
|
|
3091
|
+
[pagination.paramsType]: nextParams
|
|
3126
3092
|
});
|
|
3127
3093
|
});
|
|
3128
3094
|
react.useEffect(() => {
|
|
@@ -3299,7 +3265,7 @@ const TablePageInnerContent = withLocale(_ref => {
|
|
|
3299
3265
|
setCardMode(next);
|
|
3300
3266
|
}
|
|
3301
3267
|
}) : null;
|
|
3302
|
-
const tableMain = /*#__PURE__*/jsxRuntime.jsxs(
|
|
3268
|
+
const tableMain = /*#__PURE__*/jsxRuntime.jsxs(StickyScroller__default["default"], {
|
|
3303
3269
|
ref: tableContentRef,
|
|
3304
3270
|
enabled: horizontalScroller && renderType === 'Table' && !isCardModeActive,
|
|
3305
3271
|
getPortalContainer: getScrollContainer,
|
|
@@ -3359,14 +3325,37 @@ const TablePageInnerContent = withLocale(_ref => {
|
|
|
3359
3325
|
})
|
|
3360
3326
|
});
|
|
3361
3327
|
});
|
|
3362
|
-
const
|
|
3363
|
-
|
|
3364
|
-
|
|
3365
|
-
|
|
3366
|
-
|
|
3367
|
-
|
|
3368
|
-
|
|
3369
|
-
|
|
3328
|
+
const TablePageFetched = reactFetch.withFetch(TablePageInnerContent);
|
|
3329
|
+
|
|
3330
|
+
// 首包 / refresh loading:Toolbar 占位 + cell 骨架屏 + Spin;外层 grid 再垫一层,盖住首帧 null
|
|
3331
|
+
const TablePageInner = /*#__PURE__*/react.forwardRef((props, ref) => {
|
|
3332
|
+
const isMobile = responsiveUtils.useIsMobile();
|
|
3333
|
+
const loadingProp = props.loading,
|
|
3334
|
+
rest = _objectWithoutPropertiesLoose(props, _excluded2);
|
|
3335
|
+
const reserveToolbar = hasToolbarArea(props, isMobile);
|
|
3336
|
+
const loading = loadingProp !== undefined ? loadingProp : /*#__PURE__*/jsxRuntime.jsx(TablePageLoadingShell, _extends({}, props));
|
|
3337
|
+
const fetched = /*#__PURE__*/jsxRuntime.jsx(TablePageFetched, _extends({}, rest, {
|
|
3338
|
+
loading: loading,
|
|
3339
|
+
ref: ref
|
|
3340
|
+
}));
|
|
3341
|
+
if (!reserveToolbar) {
|
|
3342
|
+
return fetched;
|
|
3343
|
+
}
|
|
3344
|
+
return /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
3345
|
+
className: style$1['fetch-stack'],
|
|
3346
|
+
children: [/*#__PURE__*/jsxRuntime.jsx("div", {
|
|
3347
|
+
className: style$1['toolbar-height-reserve'],
|
|
3348
|
+
"aria-hidden": true
|
|
3349
|
+
}), fetched]
|
|
3350
|
+
});
|
|
3351
|
+
});
|
|
3352
|
+
const TablePage = /*#__PURE__*/react.forwardRef((_ref4, ref) => {
|
|
3353
|
+
let pagination = _ref4.pagination,
|
|
3354
|
+
_ref4$horizontalScrol = _ref4.horizontalScroller,
|
|
3355
|
+
horizontalScroller = _ref4$horizontalScrol === void 0 ? true : _ref4$horizontalScrol,
|
|
3356
|
+
getScrollContainer = _ref4.getScrollContainer,
|
|
3357
|
+
filterProp = _ref4.filter,
|
|
3358
|
+
props = _objectWithoutPropertiesLoose(_ref4, _excluded3);
|
|
3370
3359
|
pagination = Object.assign({}, {
|
|
3371
3360
|
showSizeChanger: true,
|
|
3372
3361
|
showQuickJumper: true,
|
|
@@ -3387,8 +3376,8 @@ const TablePage = /*#__PURE__*/react.forwardRef((_ref2, ref) => {
|
|
|
3387
3376
|
}) : {}),
|
|
3388
3377
|
urlPagination = _useState2[0];
|
|
3389
3378
|
const _useState3 = react.useState(() => {
|
|
3390
|
-
var
|
|
3391
|
-
return (
|
|
3379
|
+
var _ref5, _urlPagination$pageSi;
|
|
3380
|
+
return (_ref5 = (_urlPagination$pageSi = urlPagination.pageSize) != null ? _urlPagination$pageSi : cachePageSize ? readPageSize(pageSizeKey) : null) != null ? _ref5 : pagination.pageSize;
|
|
3392
3381
|
}),
|
|
3393
3382
|
pageSize = _useState3[0],
|
|
3394
3383
|
setPageSize = _useState3[1];
|
|
@@ -3408,7 +3397,7 @@ const TablePage = /*#__PURE__*/react.forwardRef((_ref2, ref) => {
|
|
|
3408
3397
|
if (!filterProp) {
|
|
3409
3398
|
return filterProp;
|
|
3410
3399
|
}
|
|
3411
|
-
const rest = _objectWithoutPropertiesLoose(filterProp,
|
|
3400
|
+
const rest = _objectWithoutPropertiesLoose(filterProp, _excluded4);
|
|
3412
3401
|
if ('value' in filterProp) {
|
|
3413
3402
|
return rest;
|
|
3414
3403
|
}
|
|
@@ -3417,24 +3406,19 @@ const TablePage = /*#__PURE__*/react.forwardRef((_ref2, ref) => {
|
|
|
3417
3406
|
});
|
|
3418
3407
|
}, [filterProp, fromUrl]);
|
|
3419
3408
|
const params = props[pagination.paramsType];
|
|
3420
|
-
|
|
3421
|
-
|
|
3422
|
-
|
|
3423
|
-
|
|
3424
|
-
|
|
3425
|
-
|
|
3426
|
-
|
|
3427
|
-
|
|
3428
|
-
|
|
3429
|
-
|
|
3430
|
-
|
|
3431
|
-
|
|
3432
|
-
|
|
3433
|
-
if (!initialValue.length && !((_ref5 = filter || filterProp) != null && _ref5.mapFilterValue)) {
|
|
3434
|
-
return {};
|
|
3435
|
-
}
|
|
3436
|
-
return mapFilterValue(initialValue);
|
|
3437
|
-
}, [filter, filterProp, fromUrl]);
|
|
3409
|
+
// 仅作首包种子;后续筛选走 handleFilterChange → reload,避免受控 value 变化改 requestToken 触发 refresh 卸载表格
|
|
3410
|
+
const _useState6 = react.useState(() => {
|
|
3411
|
+
if (!filterProp) {
|
|
3412
|
+
return {};
|
|
3413
|
+
}
|
|
3414
|
+
const mapFn = filterProp.mapFilterValue || reactFilter.getFilterValue;
|
|
3415
|
+
const initialValue = 'value' in filterProp ? mergeFilterByName(filterProp.value || [], fromUrl) : mergeFilterByName(filterProp.defaultValue || [], fromUrl);
|
|
3416
|
+
if (!initialValue.length && !filterProp.mapFilterValue) {
|
|
3417
|
+
return {};
|
|
3418
|
+
}
|
|
3419
|
+
return mapFn(initialValue) || {};
|
|
3420
|
+
}),
|
|
3421
|
+
filterDefaultParams = _useState6[0];
|
|
3438
3422
|
const urlStrippedRef = react.useRef(false);
|
|
3439
3423
|
react.useEffect(() => {
|
|
3440
3424
|
var _filterProp$searchPar, _filterProp$searchPar2;
|
|
@@ -3465,6 +3449,7 @@ const TablePage = /*#__PURE__*/react.forwardRef((_ref2, ref) => {
|
|
|
3465
3449
|
}, [params, pagination.pageSizeName, pagination.paramsType, pagination.currentName, pageSize, filterDefaultParams, paginationUrlEnabled, initialCurrent]);
|
|
3466
3450
|
return /*#__PURE__*/jsxRuntime.jsx(TablePageInner, _extends({}, props, fetchParams, {
|
|
3467
3451
|
filter: filter,
|
|
3452
|
+
filterSeedParams: filterDefaultParams,
|
|
3468
3453
|
horizontalScroller: horizontalScroller,
|
|
3469
3454
|
getScrollContainer: getScrollContainer,
|
|
3470
3455
|
pagination: Object.assign({}, pagination, {
|