@teamix/pro 1.5.39 → 1.5.41
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/pro.js +46 -45
- package/dist/pro.min.js +1 -1
- package/es/index.d.ts +1 -1
- package/es/index.js +1 -1
- package/es/sidebar/components/tree/index.js +8 -2
- package/es/sidebar/components/tree-node/index.js +1 -1
- package/es/table/components/Cell/index.js +1 -13
- package/es/table/components/Layout/index.js +1 -1
- package/es/table/components/ToolBar/FilterColumnIcon.js +6 -2
- package/es/table/components/ToolBar/index.js +2 -1
- package/es/table/index.js +24 -23
- package/lib/index.d.ts +1 -1
- package/lib/index.js +1 -1
- package/lib/sidebar/components/tree/index.js +8 -2
- package/lib/sidebar/components/tree-node/index.js +1 -1
- package/lib/table/components/Cell/index.js +1 -13
- package/lib/table/components/Layout/index.js +1 -1
- package/lib/table/components/ToolBar/FilterColumnIcon.js +6 -2
- package/lib/table/components/ToolBar/index.js +2 -1
- package/lib/table/index.js +23 -22
- package/package.json +1 -1
package/es/index.d.ts
CHANGED
@@ -30,5 +30,5 @@ export * from './sidebar';
|
|
30
30
|
export * from './utils';
|
31
31
|
export * from './timeline';
|
32
32
|
export * from './image';
|
33
|
-
declare const version = "1.5.
|
33
|
+
declare const version = "1.5.41";
|
34
34
|
export { version, ProAction, ProCard, ProField, ProForm, ProInfo, ProPageContainer, ProPageHeader, ProSkeleton, ProTable, ProSidebar, ProTimeline, TeamixIcon, ProImage, hooks, nocode, templates, utils, };
|
package/es/index.js
CHANGED
@@ -247,7 +247,7 @@ var ProSidebarTree = function ProSidebarTree(props) {
|
|
247
247
|
if (extra === null || extra === void 0 ? void 0 : (_extra$event = extra.event) === null || _extra$event === void 0 ? void 0 : (_extra$event$target = _extra$event.target) === null || _extra$event$target === void 0 ? void 0 : (_extra$event$target$c = _extra$event$target.closest) === null || _extra$event$target$c === void 0 ? void 0 : _extra$event$target$c.call(_extra$event$target, '.teamix-pro-sidebar-delete-overlay')) {
|
248
248
|
return;
|
249
249
|
}
|
250
|
-
if (!
|
250
|
+
if (!selectedKeysProp) {
|
251
251
|
setSelectedKeys(value);
|
252
252
|
}
|
253
253
|
onSelect === null || onSelect === void 0 ? void 0 : onSelect(value, extra);
|
@@ -264,6 +264,12 @@ var ProSidebarTree = function ProSidebarTree(props) {
|
|
264
264
|
setExpandedKeys(key);
|
265
265
|
setAutoExpandParent(false);
|
266
266
|
};
|
267
|
+
var renderTreeNodeGroup = function renderTreeNodeGroup() {
|
268
|
+
if (onBeforeRenderNodeEvent) {
|
269
|
+
return renderTreeNodeDependenceValue(dataSource, onBeforeRenderNodeEvent, checkedKeys, selectedKeys);
|
270
|
+
}
|
271
|
+
return renderTreeNode(dataSource);
|
272
|
+
};
|
267
273
|
return /*#__PURE__*/React.createElement("div", {
|
268
274
|
className: cls({
|
269
275
|
'': true,
|
@@ -283,6 +289,6 @@ var ProSidebarTree = function ProSidebarTree(props) {
|
|
283
289
|
className: "".concat(cls({
|
284
290
|
checkable: others.checkable
|
285
291
|
}), " ").concat(className)
|
286
|
-
}, others),
|
292
|
+
}, others), renderTreeNodeGroup()));
|
287
293
|
};
|
288
294
|
export default ProSidebarTree;
|
@@ -170,7 +170,7 @@ export function renderTreeNode(data) {
|
|
170
170
|
return /*#__PURE__*/React.createElement(Tree.Node, _objectSpread({
|
171
171
|
key: item.value,
|
172
172
|
label: /*#__PURE__*/React.createElement(ProSideBarTreeNode, _objectSpread({}, labelProps))
|
173
|
-
}, nodeProps), item.children && item.children.length > 0 && renderTreeNode(item.children));
|
173
|
+
}, nodeProps), (item === null || item === void 0 ? void 0 : item.children) && item.children.length > 0 && renderTreeNode(item.children));
|
174
174
|
});
|
175
175
|
}
|
176
176
|
// 渲染树节点 依赖 value
|
@@ -197,7 +197,7 @@ var equalColumns = function equalColumns(prevProps, nextProps) {
|
|
197
197
|
return false;
|
198
198
|
}
|
199
199
|
// 操作列的时候强制刷新 || 当 value 值拿不到的时候
|
200
|
-
if (preValue === false
|
200
|
+
if (preValue === false || nextValue === false || preValue === undefined || nextValue === undefined) {
|
201
201
|
return false;
|
202
202
|
}
|
203
203
|
// 如果不是 string 类型,全部刷新
|
@@ -207,18 +207,6 @@ var equalColumns = function equalColumns(prevProps, nextProps) {
|
|
207
207
|
if (preValue === nextValue) {
|
208
208
|
return true;
|
209
209
|
}
|
210
|
-
// 针对 value 是数组类型的判断 value 是否和原来相等,相等则不渲染
|
211
|
-
if (Array.isArray(nextValue) && Array.isArray(preValue)) {
|
212
|
-
var nextValueStr = nextValue.map(function (item) {
|
213
|
-
return item.TagValue;
|
214
|
-
});
|
215
|
-
var preValueStr = preValue.map(function (item) {
|
216
|
-
return item.TagValue;
|
217
|
-
});
|
218
|
-
if (nextValueStr.toString() === preValueStr.toString()) {
|
219
|
-
return true;
|
220
|
-
}
|
221
|
-
}
|
222
210
|
return false;
|
223
211
|
};
|
224
212
|
export default /*#__PURE__*/React.memo(Cell, equalColumns);
|
@@ -130,7 +130,7 @@ var Layout = function Layout(props) {
|
|
130
130
|
}
|
131
131
|
}, [
|
132
132
|
//todo: 重复render 问题都在这里
|
133
|
-
dataFilter, mainAction, dataFilterFormRef, afterDataFilter, rowSelection]);
|
133
|
+
dataFilter, mainAction, dataFilterFormRef, afterDataFilter, rowSelection, actionRef]);
|
134
134
|
// 区域组合渲染
|
135
135
|
var renderLayout = function renderLayout() {
|
136
136
|
if (header && mainAction) {
|
@@ -108,7 +108,7 @@ var FilterColumnIcon = function FilterColumnIcon(props) {
|
|
108
108
|
});
|
109
109
|
useEffect(function () {
|
110
110
|
var _actionRef$current2;
|
111
|
-
setNewColumns(processColumns(
|
111
|
+
setNewColumns(processColumns(newColumns, (_actionRef$current2 = actionRef.current) === null || _actionRef$current2 === void 0 ? void 0 : _actionRef$current2.filterColumns));
|
112
112
|
}, [columns, (_actionRef$current3 = actionRef.current) === null || _actionRef$current3 === void 0 ? void 0 : _actionRef$current3.filterColumns]);
|
113
113
|
// 全选
|
114
114
|
var onChangeAllColumns = function onChangeAllColumns(check) {
|
@@ -124,7 +124,11 @@ var FilterColumnIcon = function FilterColumnIcon(props) {
|
|
124
124
|
// 重置
|
125
125
|
var restColumns = function restColumns(e) {
|
126
126
|
e.stopPropagation();
|
127
|
-
var keyNewColumns = processColumns(columns)
|
127
|
+
var keyNewColumns = processColumns(columns).map(function (item) {
|
128
|
+
return _objectSpread(_objectSpread({}, item), {}, {
|
129
|
+
columnFilters: (item === null || item === void 0 ? void 0 : item.columnFilters) === undefined ? true : item === null || item === void 0 ? void 0 : item.columnFilters
|
130
|
+
});
|
131
|
+
});
|
128
132
|
notifyTableRender(keyNewColumns);
|
129
133
|
};
|
130
134
|
// 修改
|
@@ -51,6 +51,7 @@ var ToolBar = function ToolBar(props) {
|
|
51
51
|
var toolBar = props.toolBar,
|
52
52
|
fullScreenState = props.fullScreenState,
|
53
53
|
switchCardView = props.switchCardView,
|
54
|
+
actionRef = props.actionRef,
|
54
55
|
_props$toolBarAutoWid = props.toolBarAutoWidth,
|
55
56
|
toolBarAutoWidth = _props$toolBarAutoWid === void 0 ? true : _props$toolBarAutoWid;
|
56
57
|
var toolBarRef = useRef(null);
|
@@ -125,7 +126,7 @@ var ToolBar = function ToolBar(props) {
|
|
125
126
|
}
|
126
127
|
}
|
127
128
|
return result;
|
128
|
-
}, [toolBar]);
|
129
|
+
}, [toolBar, actionRef.current]);
|
129
130
|
var renderFlatShape = useMemo(function () {
|
130
131
|
return /*#__PURE__*/React.createElement("div", {
|
131
132
|
className: cls('content')
|
package/es/table/index.js
CHANGED
@@ -16,7 +16,7 @@ function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Sy
|
|
16
16
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
17
17
|
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
18
18
|
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
19
|
-
import React, { useState, useEffect, useRef, useMemo
|
19
|
+
import React, { useState, useEffect, useRef, useMemo } from 'react';
|
20
20
|
import { Table, Checkbox } from '@alicloudfe/components';
|
21
21
|
import Pagination from './components/Pagination';
|
22
22
|
import TableContent from './components/TableContent';
|
@@ -545,7 +545,7 @@ var ProTable = function ProTable(props) {
|
|
545
545
|
}
|
546
546
|
});
|
547
547
|
// 绑定 Actions
|
548
|
-
|
548
|
+
useActionType(actionRef, {
|
549
549
|
fullScreen: function fullScreen() {
|
550
550
|
var _actionRef$current2, _actionRef$current2$s;
|
551
551
|
var state = !fullscreenState;
|
@@ -585,7 +585,8 @@ var ProTable = function ProTable(props) {
|
|
585
585
|
_request(_objectSpread(_objectSpread({}, params), {}, _defineProperty({}, targetPageKey, 1)), undefined, undefined, true);
|
586
586
|
setShowSkeleton(true);
|
587
587
|
} else {
|
588
|
-
|
588
|
+
var _objectSpread3;
|
589
|
+
_request(_objectSpread(_objectSpread({}, params), {}, (_objectSpread3 = {}, _defineProperty(_objectSpread3, targetPageKey, currentPage), _defineProperty(_objectSpread3, targetPageSizeKey, pageSize), _objectSpread3)));
|
589
590
|
}
|
590
591
|
},
|
591
592
|
request: function request(params) {
|
@@ -814,8 +815,8 @@ var ProTable = function ProTable(props) {
|
|
814
815
|
}
|
815
816
|
});
|
816
817
|
// 请求函数
|
817
|
-
var _request =
|
818
|
-
var _dataFilterFormRef$cu2, _actionRef$current$ge, _actionRef$current6, _actionRef$current6$g,
|
818
|
+
var _request = function _request(params, noLoading, filterParams, isReset) {
|
819
|
+
var _dataFilterFormRef$cu2, _actionRef$current$ge, _actionRef$current6, _actionRef$current6$g, _objectSpread4;
|
819
820
|
// 首次渲染表格,获取 urlState 上的 表头 filter 数据
|
820
821
|
if (bindUrl && (bindUrlProps === null || bindUrlProps === void 0 ? void 0 : bindUrlProps.headerFilters) !== false && dataRef.current.flag) {
|
821
822
|
getUrlStateFilter(urlState !== null && urlState !== void 0 ? urlState : {}, actionRef);
|
@@ -836,7 +837,7 @@ var ProTable = function ProTable(props) {
|
|
836
837
|
var columnsFilterParams = (_actionRef$current$ge = (_actionRef$current6 = actionRef.current) === null || _actionRef$current6 === void 0 ? void 0 : (_actionRef$current6$g = _actionRef$current6.getFilterRules) === null || _actionRef$current6$g === void 0 ? void 0 : _actionRef$current6$g.call(_actionRef$current6)) !== null && _actionRef$current$ge !== void 0 ? _actionRef$current$ge : {};
|
837
838
|
// 格式化后的请求参数
|
838
839
|
var requestData = {};
|
839
|
-
var preParams = _objectSpread(_objectSpread({}, !showPagination ? _objectSpread(_objectSpread(_objectSpread(_objectSpread({}, dataFilterParams), propsParams), sortParams), columnsFilterParams) : _objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread({}, dataFilterParams), propsParams), sortParams), columnsFilterParams), {}, (
|
840
|
+
var preParams = _objectSpread(_objectSpread({}, !showPagination ? _objectSpread(_objectSpread(_objectSpread(_objectSpread({}, dataFilterParams), propsParams), sortParams), columnsFilterParams) : _objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread({}, dataFilterParams), propsParams), sortParams), columnsFilterParams), {}, (_objectSpread4 = {}, _defineProperty(_objectSpread4, targetPageKey, currentPage), _defineProperty(_objectSpread4, targetPageSizeKey, pageSize), _objectSpread4))), params);
|
840
841
|
if (typeof formatParams === 'string') {
|
841
842
|
requestData = getTargetValue(formatParams, {
|
842
843
|
params: preParams
|
@@ -929,12 +930,12 @@ var ProTable = function ProTable(props) {
|
|
929
930
|
getData.run(requestData);
|
930
931
|
}
|
931
932
|
}
|
932
|
-
}
|
933
|
-
var onSort =
|
933
|
+
};
|
934
|
+
var onSort = function onSort(dataIndex, order) {
|
934
935
|
var nextSort = _defineProperty({}, dataIndex, order);
|
935
936
|
setSort(nextSort);
|
936
937
|
_request(targetFormatSort(nextSort));
|
937
|
-
}
|
938
|
+
};
|
938
939
|
// 处理 dataFilter 中的 onFilter、onReset
|
939
940
|
var dataFilter = useMemo(function () {
|
940
941
|
return _objectSpread(_objectSpread({
|
@@ -949,7 +950,7 @@ var ProTable = function ProTable(props) {
|
|
949
950
|
return true;
|
950
951
|
} : undefined,
|
951
952
|
onFilter: function onFilter(values) {
|
952
|
-
var _actionRef$
|
953
|
+
var _actionRef$current7, _actionRef$current7$c, _request8;
|
953
954
|
// 全屏状态,判断全屏表单onFilter是否禁用
|
954
955
|
if (fullscreenState && !filterEnableRef.current.fullscreen) {
|
955
956
|
filterEnableRef.current.fullscreen = true;
|
@@ -968,7 +969,7 @@ var ProTable = function ProTable(props) {
|
|
968
969
|
}
|
969
970
|
}
|
970
971
|
// 搜索变化时,暂时先清空选择
|
971
|
-
(_actionRef$
|
972
|
+
(_actionRef$current7 = actionRef.current) === null || _actionRef$current7 === void 0 ? void 0 : (_actionRef$current7$c = _actionRef$current7.clearRowSelection) === null || _actionRef$current7$c === void 0 ? void 0 : _actionRef$current7$c.call(_actionRef$current7);
|
972
973
|
setCurrentPage(1);
|
973
974
|
_request((_request8 = {}, _defineProperty(_request8, targetPageKey, 1), _defineProperty(_request8, targetPageSizeKey, pageSize), _request8), false, values);
|
974
975
|
},
|
@@ -1007,9 +1008,9 @@ var ProTable = function ProTable(props) {
|
|
1007
1008
|
mainAction: mainAction,
|
1008
1009
|
extra: extra,
|
1009
1010
|
toolBar: toolBar,
|
1010
|
-
actionRef: {
|
1011
|
+
actionRef: _objectSpread(_objectSpread({}, actionRef), {}, {
|
1011
1012
|
current: actionRef.current
|
1012
|
-
},
|
1013
|
+
}),
|
1013
1014
|
columns: propsColumns,
|
1014
1015
|
dataFilter: dataFilter,
|
1015
1016
|
afterDataFilter: afterDataFilter,
|
@@ -1091,28 +1092,28 @@ var ProTable = function ProTable(props) {
|
|
1091
1092
|
})));
|
1092
1093
|
} else return footerAction;
|
1093
1094
|
};
|
1094
|
-
var onChangePagination =
|
1095
|
-
var
|
1095
|
+
var onChangePagination = function onChangePagination(currentPage) {
|
1096
|
+
var _objectSpread5;
|
1096
1097
|
var params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
1097
1098
|
// 翻页默认清空选择
|
1098
1099
|
if (!reserveSelectedRecords) {
|
1099
|
-
var _actionRef$
|
1100
|
-
(_actionRef$
|
1100
|
+
var _actionRef$current8, _actionRef$current8$c;
|
1101
|
+
(_actionRef$current8 = actionRef.current) === null || _actionRef$current8 === void 0 ? void 0 : (_actionRef$current8$c = _actionRef$current8.clearRowSelection) === null || _actionRef$current8$c === void 0 ? void 0 : _actionRef$current8$c.call(_actionRef$current8);
|
1101
1102
|
}
|
1102
1103
|
setCurrentPage(currentPage);
|
1103
|
-
_request(_objectSpread((
|
1104
|
-
}
|
1105
|
-
var onChangePaginationSize =
|
1104
|
+
_request(_objectSpread((_objectSpread5 = {}, _defineProperty(_objectSpread5, targetPageKey, currentPage), _defineProperty(_objectSpread5, "pageSize", pageSize), _objectSpread5), params));
|
1105
|
+
};
|
1106
|
+
var onChangePaginationSize = function onChangePaginationSize(currentPageSize) {
|
1106
1107
|
var _request10;
|
1107
1108
|
// 翻页默认清空选择
|
1108
1109
|
if (!reserveSelectedRecords) {
|
1109
|
-
var _actionRef$
|
1110
|
-
(_actionRef$
|
1110
|
+
var _actionRef$current9, _actionRef$current9$c;
|
1111
|
+
(_actionRef$current9 = actionRef.current) === null || _actionRef$current9 === void 0 ? void 0 : (_actionRef$current9$c = _actionRef$current9.clearRowSelection) === null || _actionRef$current9$c === void 0 ? void 0 : _actionRef$current9$c.call(_actionRef$current9);
|
1111
1112
|
}
|
1112
1113
|
setPageSize(currentPageSize);
|
1113
1114
|
setCurrentPage(1);
|
1114
1115
|
_request((_request10 = {}, _defineProperty(_request10, targetPageSizeKey, currentPageSize), _defineProperty(_request10, targetPageKey, 1), _request10));
|
1115
|
-
}
|
1116
|
+
};
|
1116
1117
|
var renderFooter = function renderFooter() {
|
1117
1118
|
function renderRowSelection() {
|
1118
1119
|
if (rowSelection) {
|
package/lib/index.d.ts
CHANGED
@@ -30,5 +30,5 @@ export * from './sidebar';
|
|
30
30
|
export * from './utils';
|
31
31
|
export * from './timeline';
|
32
32
|
export * from './image';
|
33
|
-
declare const version = "1.5.
|
33
|
+
declare const version = "1.5.41";
|
34
34
|
export { version, ProAction, ProCard, ProField, ProForm, ProInfo, ProPageContainer, ProPageHeader, ProSkeleton, ProTable, ProSidebar, ProTimeline, TeamixIcon, ProImage, hooks, nocode, templates, utils, };
|
package/lib/index.js
CHANGED
@@ -299,7 +299,7 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
|
|
299
299
|
if (!((_window = window) === null || _window === void 0 ? void 0 : _window.TEAMIXPRO_WITHOUT_ICON)) {
|
300
300
|
_icon.default.setConfig(_utils.default.getTeamixIconConfig());
|
301
301
|
}
|
302
|
-
var version = '1.5.
|
302
|
+
var version = '1.5.41';
|
303
303
|
// By TeamixTest
|
304
304
|
exports.version = version;
|
305
305
|
window.postMessage({
|
@@ -256,7 +256,7 @@ var ProSidebarTree = function ProSidebarTree(props) {
|
|
256
256
|
if (extra === null || extra === void 0 ? void 0 : (_extra$event = extra.event) === null || _extra$event === void 0 ? void 0 : (_extra$event$target = _extra$event.target) === null || _extra$event$target === void 0 ? void 0 : (_extra$event$target$c = _extra$event$target.closest) === null || _extra$event$target$c === void 0 ? void 0 : _extra$event$target$c.call(_extra$event$target, '.teamix-pro-sidebar-delete-overlay')) {
|
257
257
|
return;
|
258
258
|
}
|
259
|
-
if (!
|
259
|
+
if (!selectedKeysProp) {
|
260
260
|
setSelectedKeys(value);
|
261
261
|
}
|
262
262
|
onSelect === null || onSelect === void 0 ? void 0 : onSelect(value, extra);
|
@@ -273,6 +273,12 @@ var ProSidebarTree = function ProSidebarTree(props) {
|
|
273
273
|
setExpandedKeys(key);
|
274
274
|
setAutoExpandParent(false);
|
275
275
|
};
|
276
|
+
var renderTreeNodeGroup = function renderTreeNodeGroup() {
|
277
|
+
if (onBeforeRenderNodeEvent) {
|
278
|
+
return (0, _treeNode.renderTreeNodeDependenceValue)(dataSource, onBeforeRenderNodeEvent, checkedKeys, selectedKeys);
|
279
|
+
}
|
280
|
+
return (0, _treeNode.renderTreeNode)(dataSource);
|
281
|
+
};
|
276
282
|
return /*#__PURE__*/_react.default.createElement("div", {
|
277
283
|
className: cls({
|
278
284
|
'': true,
|
@@ -292,7 +298,7 @@ var ProSidebarTree = function ProSidebarTree(props) {
|
|
292
298
|
className: "".concat(cls({
|
293
299
|
checkable: others.checkable
|
294
300
|
}), " ").concat(className)
|
295
|
-
}, others),
|
301
|
+
}, others), renderTreeNodeGroup()));
|
296
302
|
};
|
297
303
|
var _default = ProSidebarTree;
|
298
304
|
exports.default = _default;
|
@@ -181,7 +181,7 @@ function renderTreeNode(data) {
|
|
181
181
|
return /*#__PURE__*/_react.default.createElement(_components.Tree.Node, _objectSpread({
|
182
182
|
key: item.value,
|
183
183
|
label: /*#__PURE__*/_react.default.createElement(ProSideBarTreeNode, _objectSpread({}, labelProps))
|
184
|
-
}, nodeProps), item.children && item.children.length > 0 && renderTreeNode(item.children));
|
184
|
+
}, nodeProps), (item === null || item === void 0 ? void 0 : item.children) && item.children.length > 0 && renderTreeNode(item.children));
|
185
185
|
});
|
186
186
|
}
|
187
187
|
// 渲染树节点 依赖 value
|
@@ -201,7 +201,7 @@ var equalColumns = function equalColumns(prevProps, nextProps) {
|
|
201
201
|
return false;
|
202
202
|
}
|
203
203
|
// 操作列的时候强制刷新 || 当 value 值拿不到的时候
|
204
|
-
if (preValue === false
|
204
|
+
if (preValue === false || nextValue === false || preValue === undefined || nextValue === undefined) {
|
205
205
|
return false;
|
206
206
|
}
|
207
207
|
// 如果不是 string 类型,全部刷新
|
@@ -211,18 +211,6 @@ var equalColumns = function equalColumns(prevProps, nextProps) {
|
|
211
211
|
if (preValue === nextValue) {
|
212
212
|
return true;
|
213
213
|
}
|
214
|
-
// 针对 value 是数组类型的判断 value 是否和原来相等,相等则不渲染
|
215
|
-
if (Array.isArray(nextValue) && Array.isArray(preValue)) {
|
216
|
-
var nextValueStr = nextValue.map(function (item) {
|
217
|
-
return item.TagValue;
|
218
|
-
});
|
219
|
-
var preValueStr = preValue.map(function (item) {
|
220
|
-
return item.TagValue;
|
221
|
-
});
|
222
|
-
if (nextValueStr.toString() === preValueStr.toString()) {
|
223
|
-
return true;
|
224
|
-
}
|
225
|
-
}
|
226
214
|
return false;
|
227
215
|
};
|
228
216
|
var _default = /*#__PURE__*/_react.default.memo(Cell, equalColumns);
|
@@ -139,7 +139,7 @@ var Layout = function Layout(props) {
|
|
139
139
|
}
|
140
140
|
}, [
|
141
141
|
//todo: 重复render 问题都在这里
|
142
|
-
dataFilter, mainAction, dataFilterFormRef, afterDataFilter, rowSelection]);
|
142
|
+
dataFilter, mainAction, dataFilterFormRef, afterDataFilter, rowSelection, actionRef]);
|
143
143
|
// 区域组合渲染
|
144
144
|
var renderLayout = function renderLayout() {
|
145
145
|
if (header && mainAction) {
|
@@ -115,7 +115,7 @@ var FilterColumnIcon = function FilterColumnIcon(props) {
|
|
115
115
|
});
|
116
116
|
(0, _react.useEffect)(function () {
|
117
117
|
var _actionRef$current2;
|
118
|
-
setNewColumns(processColumns(
|
118
|
+
setNewColumns(processColumns(newColumns, (_actionRef$current2 = actionRef.current) === null || _actionRef$current2 === void 0 ? void 0 : _actionRef$current2.filterColumns));
|
119
119
|
}, [columns, (_actionRef$current3 = actionRef.current) === null || _actionRef$current3 === void 0 ? void 0 : _actionRef$current3.filterColumns]);
|
120
120
|
// 全选
|
121
121
|
var onChangeAllColumns = function onChangeAllColumns(check) {
|
@@ -131,7 +131,11 @@ var FilterColumnIcon = function FilterColumnIcon(props) {
|
|
131
131
|
// 重置
|
132
132
|
var restColumns = function restColumns(e) {
|
133
133
|
e.stopPropagation();
|
134
|
-
var keyNewColumns = processColumns(columns)
|
134
|
+
var keyNewColumns = processColumns(columns).map(function (item) {
|
135
|
+
return _objectSpread(_objectSpread({}, item), {}, {
|
136
|
+
columnFilters: (item === null || item === void 0 ? void 0 : item.columnFilters) === undefined ? true : item === null || item === void 0 ? void 0 : item.columnFilters
|
137
|
+
});
|
138
|
+
});
|
135
139
|
notifyTableRender(keyNewColumns);
|
136
140
|
};
|
137
141
|
// 修改
|
@@ -61,6 +61,7 @@ var ToolBar = function ToolBar(props) {
|
|
61
61
|
var toolBar = props.toolBar,
|
62
62
|
fullScreenState = props.fullScreenState,
|
63
63
|
switchCardView = props.switchCardView,
|
64
|
+
actionRef = props.actionRef,
|
64
65
|
_props$toolBarAutoWid = props.toolBarAutoWidth,
|
65
66
|
toolBarAutoWidth = _props$toolBarAutoWid === void 0 ? true : _props$toolBarAutoWid;
|
66
67
|
var toolBarRef = (0, _react.useRef)(null);
|
@@ -135,7 +136,7 @@ var ToolBar = function ToolBar(props) {
|
|
135
136
|
}
|
136
137
|
}
|
137
138
|
return result;
|
138
|
-
}, [toolBar]);
|
139
|
+
}, [toolBar, actionRef.current]);
|
139
140
|
var renderFlatShape = (0, _react.useMemo)(function () {
|
140
141
|
return /*#__PURE__*/_react.default.createElement("div", {
|
141
142
|
className: cls('content')
|
package/lib/table/index.js
CHANGED
@@ -566,7 +566,7 @@ var ProTable = function ProTable(props) {
|
|
566
566
|
}
|
567
567
|
});
|
568
568
|
// 绑定 Actions
|
569
|
-
|
569
|
+
(0, _utils2.useActionType)(actionRef, {
|
570
570
|
fullScreen: function fullScreen() {
|
571
571
|
var _actionRef$current2, _actionRef$current2$s;
|
572
572
|
var state = !fullscreenState;
|
@@ -606,7 +606,8 @@ var ProTable = function ProTable(props) {
|
|
606
606
|
_request(_objectSpread(_objectSpread({}, params), {}, _defineProperty({}, targetPageKey, 1)), undefined, undefined, true);
|
607
607
|
setShowSkeleton(true);
|
608
608
|
} else {
|
609
|
-
|
609
|
+
var _objectSpread3;
|
610
|
+
_request(_objectSpread(_objectSpread({}, params), {}, (_objectSpread3 = {}, _defineProperty(_objectSpread3, targetPageKey, currentPage), _defineProperty(_objectSpread3, targetPageSizeKey, pageSize), _objectSpread3)));
|
610
611
|
}
|
611
612
|
},
|
612
613
|
request: function request(params) {
|
@@ -835,8 +836,8 @@ var ProTable = function ProTable(props) {
|
|
835
836
|
}
|
836
837
|
});
|
837
838
|
// 请求函数
|
838
|
-
var _request =
|
839
|
-
var _dataFilterFormRef$cu2, _actionRef$current$ge, _actionRef$current6, _actionRef$current6$g,
|
839
|
+
var _request = function _request(params, noLoading, filterParams, isReset) {
|
840
|
+
var _dataFilterFormRef$cu2, _actionRef$current$ge, _actionRef$current6, _actionRef$current6$g, _objectSpread4;
|
840
841
|
// 首次渲染表格,获取 urlState 上的 表头 filter 数据
|
841
842
|
if (bindUrl && (bindUrlProps === null || bindUrlProps === void 0 ? void 0 : bindUrlProps.headerFilters) !== false && dataRef.current.flag) {
|
842
843
|
(0, _util.getUrlStateFilter)(urlState !== null && urlState !== void 0 ? urlState : {}, actionRef);
|
@@ -857,7 +858,7 @@ var ProTable = function ProTable(props) {
|
|
857
858
|
var columnsFilterParams = (_actionRef$current$ge = (_actionRef$current6 = actionRef.current) === null || _actionRef$current6 === void 0 ? void 0 : (_actionRef$current6$g = _actionRef$current6.getFilterRules) === null || _actionRef$current6$g === void 0 ? void 0 : _actionRef$current6$g.call(_actionRef$current6)) !== null && _actionRef$current$ge !== void 0 ? _actionRef$current$ge : {};
|
858
859
|
// 格式化后的请求参数
|
859
860
|
var requestData = {};
|
860
|
-
var preParams = _objectSpread(_objectSpread({}, !showPagination ? _objectSpread(_objectSpread(_objectSpread(_objectSpread({}, dataFilterParams), propsParams), sortParams), columnsFilterParams) : _objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread({}, dataFilterParams), propsParams), sortParams), columnsFilterParams), {}, (
|
861
|
+
var preParams = _objectSpread(_objectSpread({}, !showPagination ? _objectSpread(_objectSpread(_objectSpread(_objectSpread({}, dataFilterParams), propsParams), sortParams), columnsFilterParams) : _objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread({}, dataFilterParams), propsParams), sortParams), columnsFilterParams), {}, (_objectSpread4 = {}, _defineProperty(_objectSpread4, targetPageKey, currentPage), _defineProperty(_objectSpread4, targetPageSizeKey, pageSize), _objectSpread4))), params);
|
861
862
|
if (typeof formatParams === 'string') {
|
862
863
|
requestData = (0, _utils.getTargetValue)(formatParams, {
|
863
864
|
params: preParams
|
@@ -950,12 +951,12 @@ var ProTable = function ProTable(props) {
|
|
950
951
|
getData.run(requestData);
|
951
952
|
}
|
952
953
|
}
|
953
|
-
}
|
954
|
-
var onSort =
|
954
|
+
};
|
955
|
+
var onSort = function onSort(dataIndex, order) {
|
955
956
|
var nextSort = _defineProperty({}, dataIndex, order);
|
956
957
|
setSort(nextSort);
|
957
958
|
_request(targetFormatSort(nextSort));
|
958
|
-
}
|
959
|
+
};
|
959
960
|
// 处理 dataFilter 中的 onFilter、onReset
|
960
961
|
var dataFilter = (0, _react.useMemo)(function () {
|
961
962
|
return _objectSpread(_objectSpread({
|
@@ -970,7 +971,7 @@ var ProTable = function ProTable(props) {
|
|
970
971
|
return true;
|
971
972
|
} : undefined,
|
972
973
|
onFilter: function onFilter(values) {
|
973
|
-
var _actionRef$
|
974
|
+
var _actionRef$current7, _actionRef$current7$c, _request8;
|
974
975
|
// 全屏状态,判断全屏表单onFilter是否禁用
|
975
976
|
if (fullscreenState && !filterEnableRef.current.fullscreen) {
|
976
977
|
filterEnableRef.current.fullscreen = true;
|
@@ -989,7 +990,7 @@ var ProTable = function ProTable(props) {
|
|
989
990
|
}
|
990
991
|
}
|
991
992
|
// 搜索变化时,暂时先清空选择
|
992
|
-
(_actionRef$
|
993
|
+
(_actionRef$current7 = actionRef.current) === null || _actionRef$current7 === void 0 ? void 0 : (_actionRef$current7$c = _actionRef$current7.clearRowSelection) === null || _actionRef$current7$c === void 0 ? void 0 : _actionRef$current7$c.call(_actionRef$current7);
|
993
994
|
setCurrentPage(1);
|
994
995
|
_request((_request8 = {}, _defineProperty(_request8, targetPageKey, 1), _defineProperty(_request8, targetPageSizeKey, pageSize), _request8), false, values);
|
995
996
|
},
|
@@ -1028,9 +1029,9 @@ var ProTable = function ProTable(props) {
|
|
1028
1029
|
mainAction: mainAction,
|
1029
1030
|
extra: extra,
|
1030
1031
|
toolBar: toolBar,
|
1031
|
-
actionRef: {
|
1032
|
+
actionRef: _objectSpread(_objectSpread({}, actionRef), {}, {
|
1032
1033
|
current: actionRef.current
|
1033
|
-
},
|
1034
|
+
}),
|
1034
1035
|
columns: propsColumns,
|
1035
1036
|
dataFilter: dataFilter,
|
1036
1037
|
afterDataFilter: afterDataFilter,
|
@@ -1112,28 +1113,28 @@ var ProTable = function ProTable(props) {
|
|
1112
1113
|
})));
|
1113
1114
|
} else return footerAction;
|
1114
1115
|
};
|
1115
|
-
var onChangePagination =
|
1116
|
-
var
|
1116
|
+
var onChangePagination = function onChangePagination(currentPage) {
|
1117
|
+
var _objectSpread5;
|
1117
1118
|
var params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
1118
1119
|
// 翻页默认清空选择
|
1119
1120
|
if (!reserveSelectedRecords) {
|
1120
|
-
var _actionRef$
|
1121
|
-
(_actionRef$
|
1121
|
+
var _actionRef$current8, _actionRef$current8$c;
|
1122
|
+
(_actionRef$current8 = actionRef.current) === null || _actionRef$current8 === void 0 ? void 0 : (_actionRef$current8$c = _actionRef$current8.clearRowSelection) === null || _actionRef$current8$c === void 0 ? void 0 : _actionRef$current8$c.call(_actionRef$current8);
|
1122
1123
|
}
|
1123
1124
|
setCurrentPage(currentPage);
|
1124
|
-
_request(_objectSpread((
|
1125
|
-
}
|
1126
|
-
var onChangePaginationSize =
|
1125
|
+
_request(_objectSpread((_objectSpread5 = {}, _defineProperty(_objectSpread5, targetPageKey, currentPage), _defineProperty(_objectSpread5, "pageSize", pageSize), _objectSpread5), params));
|
1126
|
+
};
|
1127
|
+
var onChangePaginationSize = function onChangePaginationSize(currentPageSize) {
|
1127
1128
|
var _request10;
|
1128
1129
|
// 翻页默认清空选择
|
1129
1130
|
if (!reserveSelectedRecords) {
|
1130
|
-
var _actionRef$
|
1131
|
-
(_actionRef$
|
1131
|
+
var _actionRef$current9, _actionRef$current9$c;
|
1132
|
+
(_actionRef$current9 = actionRef.current) === null || _actionRef$current9 === void 0 ? void 0 : (_actionRef$current9$c = _actionRef$current9.clearRowSelection) === null || _actionRef$current9$c === void 0 ? void 0 : _actionRef$current9$c.call(_actionRef$current9);
|
1132
1133
|
}
|
1133
1134
|
setPageSize(currentPageSize);
|
1134
1135
|
setCurrentPage(1);
|
1135
1136
|
_request((_request10 = {}, _defineProperty(_request10, targetPageSizeKey, currentPageSize), _defineProperty(_request10, targetPageKey, 1), _request10));
|
1136
|
-
}
|
1137
|
+
};
|
1137
1138
|
var renderFooter = function renderFooter() {
|
1138
1139
|
function renderRowSelection() {
|
1139
1140
|
if (rowSelection) {
|