@teamix/pro 1.2.23 → 1.2.28
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/212.js +129 -129
- package/dist/pro.css +1 -1
- package/dist/pro.js +18109 -15665
- package/dist/pro.min.css +1 -1
- package/dist/pro.min.js +1 -1
- package/dist/pro.min.js.LICENSE.txt +2 -0
- package/es/actions/dialog.js +4 -3
- package/es/actions/index.d.ts +12 -9
- package/es/actions/index.js +56 -15
- package/es/actions/index.scss +12 -1
- package/es/form/Filter/AdvancedFilter.js +1 -1
- package/es/form/Filter/Layout.d.ts +5 -0
- package/es/form/Filter/Layout.js +82 -0
- package/es/form/Filter/SimpleFilter.js +30 -6
- package/es/form/Filter/index2.d.ts +2 -1
- package/es/form/Filter/index2.js +97 -116
- package/es/form/Filter/index2.scss +16 -45
- package/es/form/Filter/layout.scss +36 -0
- package/es/form/Filter/useSpecialProps.d.ts +6 -0
- package/es/form/Filter/useSpecialProps.js +37 -0
- package/es/form/ProForm/customComponent.d.ts +3 -0
- package/es/form/ProForm/customComponent.js +20 -0
- package/es/form/ProForm/index.scss +5 -6
- package/es/form/ProForm/useFormDisplayValues.js +14 -24
- package/es/form/SchemaForm/adapterType.js +1 -0
- package/es/form/SchemaForm/index.js +8 -6
- package/es/form/SchemaForm/initializeDataSource.d.ts +1 -1
- package/es/form/SchemaForm/initializeDataSource.js +2 -2
- package/es/form/SchemaForm/initializeRequest.d.ts +1 -1
- package/es/form/SchemaForm/initializeRequest.js +2 -2
- package/es/form/SchemaForm/initializeRules.d.ts +1 -1
- package/es/form/SchemaForm/initializeRules.js +3 -3
- package/es/form/fieldTypeMap.js +2 -1
- package/es/form/index.d.ts +4 -2
- package/es/form/index.js +4 -2
- package/es/form/typing.d.ts +25 -1
- package/es/form/utils.d.ts +2 -2
- package/es/form/utils.js +2 -2
- package/es/index.d.ts +5 -2
- package/es/index.js +6 -3
- package/es/info/index.scss +1 -1
- package/es/nocode/pages/renderer.js +1 -1
- package/es/step/ProStepItem/components/HozStepItem/index.d.ts +5 -0
- package/es/step/ProStepItem/components/HozStepItem/index.js +235 -0
- package/es/step/ProStepItem/components/HozStepItem/index.scss +279 -0
- package/es/step/ProStepItem/components/VerStepItem/index.d.ts +5 -0
- package/es/step/ProStepItem/components/VerStepItem/index.js +295 -0
- package/es/step/ProStepItem/components/VerStepItem/index.scss +287 -0
- package/es/step/ProStepItem/index.d.ts +4 -0
- package/es/step/ProStepItem/index.js +57 -0
- package/es/step/index.d.ts +9 -0
- package/es/step/index.js +101 -0
- package/es/step/typing.d.ts +96 -0
- package/es/step/typing.js +1 -0
- package/es/table/components/Filter/index.js +2 -17
- package/es/table/components/Layout/index.js +63 -167
- package/es/table/components/Layout/index.scss +4 -3
- package/es/table/components/Pagination/index.js +2 -2
- package/es/table/components/Pagination/index.scss +5 -0
- package/es/table/components/ToolBar/FullScreenIcon.js +4 -9
- package/es/table/components/ToolBar/Fullscreen.js +21 -11
- package/es/table/index.js +82 -104
- package/es/table/index.scss +5 -5
- package/es/table/typing.d.ts +16 -10
- package/es/table/utils/columnRender.js +21 -3
- package/es/table/utils/index.d.ts +7 -0
- package/es/table/utils/index.js +36 -0
- package/es/utils/index.d.ts +1 -0
- package/es/utils/index.js +1 -0
- package/lib/actions/dialog.js +4 -3
- package/lib/actions/index.d.ts +12 -9
- package/lib/actions/index.js +56 -15
- package/lib/actions/index.scss +12 -1
- package/lib/form/Filter/AdvancedFilter.js +1 -1
- package/lib/form/Filter/Layout.d.ts +5 -0
- package/lib/form/Filter/Layout.js +102 -0
- package/lib/form/Filter/SimpleFilter.js +29 -4
- package/lib/form/Filter/index2.d.ts +2 -1
- package/lib/form/Filter/index2.js +101 -114
- package/lib/form/Filter/index2.scss +16 -45
- package/lib/form/Filter/layout.scss +36 -0
- package/lib/form/Filter/useSpecialProps.d.ts +6 -0
- package/lib/form/Filter/useSpecialProps.js +46 -0
- package/lib/form/ProForm/customComponent.d.ts +3 -0
- package/lib/form/ProForm/customComponent.js +28 -0
- package/lib/form/ProForm/index.scss +5 -6
- package/lib/form/ProForm/useFormDisplayValues.js +17 -24
- package/lib/form/SchemaForm/adapterType.js +1 -0
- package/lib/form/SchemaForm/index.js +8 -6
- package/lib/form/SchemaForm/initializeDataSource.d.ts +1 -1
- package/lib/form/SchemaForm/initializeDataSource.js +2 -2
- package/lib/form/SchemaForm/initializeRequest.d.ts +1 -1
- package/lib/form/SchemaForm/initializeRequest.js +2 -2
- package/lib/form/SchemaForm/initializeRules.d.ts +1 -1
- package/lib/form/SchemaForm/initializeRules.js +3 -3
- package/lib/form/fieldTypeMap.js +2 -1
- package/lib/form/index.d.ts +4 -2
- package/lib/form/index.js +19 -1
- package/lib/form/typing.d.ts +25 -1
- package/lib/form/utils.d.ts +2 -2
- package/lib/form/utils.js +2 -2
- package/lib/index.d.ts +5 -2
- package/lib/index.js +35 -3
- package/lib/info/index.scss +1 -1
- package/lib/nocode/pages/renderer.js +1 -1
- package/lib/step/ProStepItem/components/HozStepItem/index.d.ts +5 -0
- package/lib/step/ProStepItem/components/HozStepItem/index.js +258 -0
- package/lib/step/ProStepItem/components/HozStepItem/index.scss +279 -0
- package/lib/step/ProStepItem/components/VerStepItem/index.d.ts +5 -0
- package/lib/step/ProStepItem/components/VerStepItem/index.js +315 -0
- package/lib/step/ProStepItem/components/VerStepItem/index.scss +287 -0
- package/lib/step/ProStepItem/index.d.ts +4 -0
- package/lib/step/ProStepItem/index.js +69 -0
- package/lib/step/index.d.ts +9 -0
- package/lib/step/index.js +124 -0
- package/lib/step/typing.d.ts +96 -0
- package/lib/step/typing.js +5 -0
- package/lib/table/components/Filter/index.js +2 -17
- package/lib/table/components/Layout/index.js +61 -167
- package/lib/table/components/Layout/index.scss +4 -3
- package/lib/table/components/Pagination/index.js +2 -2
- package/lib/table/components/Pagination/index.scss +5 -0
- package/lib/table/components/ToolBar/FullScreenIcon.js +4 -9
- package/lib/table/components/ToolBar/Fullscreen.js +22 -11
- package/lib/table/index.js +78 -101
- package/lib/table/index.scss +5 -5
- package/lib/table/typing.d.ts +16 -10
- package/lib/table/utils/columnRender.js +21 -3
- package/lib/table/utils/index.d.ts +7 -0
- package/lib/table/utils/index.js +38 -0
- package/lib/utils/index.d.ts +1 -0
- package/lib/utils/index.js +13 -0
- package/package.json +4 -4
@@ -23,28 +23,38 @@ var FullScreen = function FullScreen(props) {
|
|
23
23
|
var children = props.children,
|
24
24
|
visible = props.visible,
|
25
25
|
actionRef = props.actionRef;
|
26
|
+
var _actionRef$current = actionRef.current,
|
27
|
+
normalDataFilterForm = _actionRef$current.normalDataFilterForm,
|
28
|
+
fullscreenDataFilterForm = _actionRef$current.fullscreenDataFilterForm;
|
26
29
|
|
27
30
|
function closeByESC(e) {
|
28
31
|
if (visible && e.code === 'Escape') {
|
29
|
-
var _actionRef$
|
32
|
+
var _actionRef$current2, _actionRef$current2$s, _actionRef$current3, _actionRef$current3$f;
|
30
33
|
|
31
|
-
actionRef === null || actionRef === void 0 ? void 0 : (_actionRef$
|
32
|
-
actionRef === null || actionRef === void 0 ? void 0 : (_actionRef$
|
34
|
+
actionRef === null || actionRef === void 0 ? void 0 : (_actionRef$current2 = actionRef.current) === null || _actionRef$current2 === void 0 ? void 0 : (_actionRef$current2$s = _actionRef$current2.setFullScreenState) === null || _actionRef$current2$s === void 0 ? void 0 : _actionRef$current2$s.call(_actionRef$current2, false);
|
35
|
+
actionRef === null || actionRef === void 0 ? void 0 : (_actionRef$current3 = actionRef.current) === null || _actionRef$current3 === void 0 ? void 0 : (_actionRef$current3$f = _actionRef$current3.fullScreen) === null || _actionRef$current3$f === void 0 ? void 0 : _actionRef$current3$f.call(_actionRef$current3);
|
33
36
|
}
|
34
37
|
} // 监听esc按钮
|
35
38
|
|
36
39
|
|
37
40
|
(0, _react.useEffect)(function () {
|
38
|
-
var _actionRef$
|
41
|
+
var _actionRef$current4, _actionRef$current4$s;
|
39
42
|
|
40
|
-
actionRef === null || actionRef === void 0 ? void 0 : (_actionRef$
|
43
|
+
actionRef === null || actionRef === void 0 ? void 0 : (_actionRef$current4 = actionRef.current) === null || _actionRef$current4 === void 0 ? void 0 : (_actionRef$current4$s = _actionRef$current4.setFullScreenState) === null || _actionRef$current4$s === void 0 ? void 0 : _actionRef$current4$s.call(_actionRef$current4, visible);
|
41
44
|
window.addEventListener('keydown', closeByESC);
|
42
45
|
return function () {
|
43
46
|
window.removeEventListener('keydown', closeByESC);
|
44
47
|
};
|
45
|
-
}, [visible]);
|
48
|
+
}, [visible]);
|
49
|
+
|
50
|
+
var afterClose = function afterClose() {
|
51
|
+
normalDataFilterForm === null || normalDataFilterForm === void 0 ? void 0 : normalDataFilterForm.setValues(fullscreenDataFilterForm.values);
|
52
|
+
}; // 全屏开启之后
|
53
|
+
|
46
54
|
|
47
55
|
var afterOpen = function afterOpen() {
|
56
|
+
fullscreenDataFilterForm.setValues(normalDataFilterForm.values);
|
57
|
+
|
48
58
|
_components.Message.show({
|
49
59
|
type: 'notice',
|
50
60
|
content: /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("span", null, (0, _utils.getMessage)('press')), /*#__PURE__*/_react.default.createElement("span", {
|
@@ -56,13 +66,15 @@ var FullScreen = function FullScreen(props) {
|
|
56
66
|
});
|
57
67
|
};
|
58
68
|
|
59
|
-
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, children, /*#__PURE__*/_react.default.createElement(_components.Overlay, {
|
69
|
+
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, children(false), /*#__PURE__*/_react.default.createElement(_components.Overlay, {
|
60
70
|
canCloseByOutSideClick: false,
|
61
71
|
align: "cc cc",
|
62
72
|
cache: true,
|
63
73
|
v2: false,
|
64
74
|
disableScroll: true,
|
65
75
|
shouldUpdatePosition: true,
|
76
|
+
afterClose: afterClose,
|
77
|
+
afterOpen: afterOpen,
|
66
78
|
animation: {
|
67
79
|
in: 'fadeIn',
|
68
80
|
out: 'fadeOut'
|
@@ -71,15 +83,14 @@ var FullScreen = function FullScreen(props) {
|
|
71
83
|
wrapperStyle: {
|
72
84
|
zIndex: 999
|
73
85
|
},
|
74
|
-
afterOpen: afterOpen,
|
75
86
|
onRequestClose: function onRequestClose() {
|
76
|
-
var _actionRef$
|
87
|
+
var _actionRef$current5, _actionRef$current5$f;
|
77
88
|
|
78
|
-
actionRef === null || actionRef === void 0 ? void 0 : (_actionRef$
|
89
|
+
actionRef === null || actionRef === void 0 ? void 0 : (_actionRef$current5 = actionRef.current) === null || _actionRef$current5 === void 0 ? void 0 : (_actionRef$current5$f = _actionRef$current5.fullScreen) === null || _actionRef$current5$f === void 0 ? void 0 : _actionRef$current5$f.call(_actionRef$current5);
|
79
90
|
}
|
80
91
|
}, /*#__PURE__*/_react.default.createElement("div", {
|
81
92
|
className: "teamix-pro-table-full-screen"
|
82
|
-
}, children)));
|
93
|
+
}, children(true))));
|
83
94
|
};
|
84
95
|
|
85
96
|
var _default = FullScreen;
|
package/lib/table/index.js
CHANGED
@@ -38,8 +38,6 @@ var _form = require("../form");
|
|
38
38
|
|
39
39
|
var _actions = require("../actions");
|
40
40
|
|
41
|
-
var _lodash = _interopRequireDefault(require("lodash.debounce"));
|
42
|
-
|
43
41
|
var _classnames = _interopRequireDefault(require("classnames"));
|
44
42
|
|
45
43
|
var _pageContainer = _interopRequireDefault(require("../page-container"));
|
@@ -57,7 +55,7 @@ Object.keys(_typing).forEach(function (key) {
|
|
57
55
|
}
|
58
56
|
});
|
59
57
|
});
|
60
|
-
var _excluded = ["header", "className", "tableClassName", "mainAction", "extra", "dataFilter", "toolBar", "columns", "useRowSelection", "rowSelection", "onChangeRowSelection", "getRowSelection", "primaryKey", "footerAction", "footer", "url", "pageKey", "pageSizeKey", "method", "params", "formatSort", "formatParams", "formatResult", "requestWhenMount", "showPagination", "pageSizeList", "responsivePaginationType", "showSkeleton", "skeletonSize", "actionRef", "dataSource", "filterDebounce", "footerSuction", "autoRefresh", "customRequest", "filterColumnType"];
|
58
|
+
var _excluded = ["header", "className", "tableClassName", "mainAction", "extra", "dataFilter", "toolBar", "columns", "useRowSelection", "rowSelection", "onChangeRowSelection", "getRowSelection", "primaryKey", "footerAction", "footer", "url", "pageKey", "pageSizeKey", "method", "params", "formatSort", "formatParams", "formatResult", "requestWhenMount", "showPagination", "pageSizeList", "responsivePaginationType", "showSkeleton", "skeletonSize", "actionRef", "dataSource", "filterDebounce", "footerSuction", "autoRefresh", "customRequest", "filterColumnType", "defaultFilterParams"];
|
61
59
|
|
62
60
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
63
61
|
|
@@ -98,7 +96,9 @@ function _objectWithoutProperties(source, excluded) { if (source == null) return
|
|
98
96
|
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; }
|
99
97
|
|
100
98
|
var cls = (0, _utils.baseClass)('teamix-pro-table');
|
101
|
-
var toJS = _form.formilyReactive.toJS;
|
99
|
+
var toJS = _form.formilyReactive.toJS; // 判断是否是 root 组织
|
100
|
+
|
101
|
+
var isRoot = (0, _utils.getCookie)('organizationId') === '1';
|
102
102
|
/**
|
103
103
|
* 处理原生传入的 columns 以便于 选择列 方便处理
|
104
104
|
* @param columns 原生传入的 columns
|
@@ -106,14 +106,24 @@ var toJS = _form.formilyReactive.toJS;
|
|
106
106
|
*/
|
107
107
|
|
108
108
|
var processColumns = function processColumns(columns, initialColumns) {
|
109
|
+
var _filterColumns;
|
110
|
+
|
109
111
|
var filterColumns = columns.filter(function (item) {
|
110
112
|
return item.columnFilters !== false;
|
111
|
-
});
|
113
|
+
});
|
114
|
+
|
115
|
+
if (isRoot) {
|
116
|
+
// root 组织下不显示标签管理
|
117
|
+
filterColumns = filterColumns.filter(function (item) {
|
118
|
+
return item.valueType !== 'selectGroup';
|
119
|
+
});
|
120
|
+
} // 处理只剩一列批量选择的情况下宽度错乱问题
|
121
|
+
|
112
122
|
|
113
|
-
if (filterColumns === null ||
|
114
|
-
var _initialColumns$;
|
123
|
+
if ((_filterColumns = filterColumns) === null || _filterColumns === void 0 ? void 0 : _filterColumns.length) {
|
124
|
+
var _filterColumns2, _initialColumns$;
|
115
125
|
|
116
|
-
if ((filterColumns === null ||
|
126
|
+
if (((_filterColumns2 = filterColumns) === null || _filterColumns2 === void 0 ? void 0 : _filterColumns2.length) === 1) {
|
117
127
|
var _filterColumns$, _filterColumns$2;
|
118
128
|
|
119
129
|
if ((_filterColumns$ = filterColumns[0]) === null || _filterColumns$ === void 0 ? void 0 : _filterColumns$.width) {
|
@@ -155,7 +165,7 @@ var globalFormatSort = function globalFormatSort(sort) {
|
|
155
165
|
};
|
156
166
|
|
157
167
|
var ProTable = function ProTable(props) {
|
158
|
-
var _rowSelection$selecte;
|
168
|
+
var _rowSelection$selecte, _dataFilterForm4;
|
159
169
|
|
160
170
|
var header = props.header,
|
161
171
|
className = props.className,
|
@@ -209,6 +219,7 @@ var ProTable = function ProTable(props) {
|
|
209
219
|
customRequest = props.customRequest,
|
210
220
|
_props$filterColumnTy = props.filterColumnType,
|
211
221
|
filterColumnType = _props$filterColumnTy === void 0 ? 'auto' : _props$filterColumnTy,
|
222
|
+
defaultFilterParams = props.defaultFilterParams,
|
212
223
|
otherProps = _objectWithoutProperties(props, _excluded);
|
213
224
|
|
214
225
|
var targetPageKey = pageKey || globalPageKey;
|
@@ -252,10 +263,8 @@ var ProTable = function ProTable(props) {
|
|
252
263
|
var _useState13 = (0, _react.useState)(true),
|
253
264
|
_useState14 = _slicedToArray(_useState13, 2),
|
254
265
|
customTableLoading = _useState14[0],
|
255
|
-
setCustomTableLoading = _useState14[1];
|
256
|
-
|
266
|
+
setCustomTableLoading = _useState14[1];
|
257
267
|
|
258
|
-
var searchValueRef = (0, _react.useRef)('');
|
259
268
|
var tableRef = (0, _react.useRef)(null);
|
260
269
|
var actionRef = (0, _react.useRef)(); // 传给 table 的过滤后的 columns
|
261
270
|
|
@@ -305,20 +314,23 @@ var ProTable = function ProTable(props) {
|
|
305
314
|
var _useState23 = (0, _react.useState)(false),
|
306
315
|
_useState24 = _slicedToArray(_useState23, 2),
|
307
316
|
fullscreenState = _useState24[0],
|
308
|
-
setFullscreenState = _useState24[1]; //
|
317
|
+
setFullscreenState = _useState24[1]; // 非全屏状态下的
|
318
|
+
|
319
|
+
|
320
|
+
var normalDataFilterFormRef = (0, _react.useRef)();
|
321
|
+
var fullscreenDataFilterFormRef = (0, _react.useRef)();
|
322
|
+
var normalDataFilterForm = normalDataFilterFormRef.current;
|
323
|
+
var fullscreenDataFilterForm = fullscreenDataFilterFormRef.current; // 传给 QueryFilter 的 formRef
|
309
324
|
|
325
|
+
var dataFilterFormRef = !fullscreenState ? normalDataFilterFormRef : fullscreenDataFilterFormRef;
|
326
|
+
var dataFilterForm = dataFilterFormRef.current; // 整个内容区是否超过一屏。用于表格在非全屏模式下的吸底
|
310
327
|
|
311
328
|
var _useState25 = (0, _react.useState)(false),
|
312
329
|
_useState26 = _slicedToArray(_useState25, 2),
|
313
330
|
footerSuctionState = _useState26[0],
|
314
|
-
setFooterSuctionState = _useState26[1];
|
315
|
-
/** 筛选区域 form */
|
331
|
+
setFooterSuctionState = _useState26[1]; // TODO 获取内容区是否超出一屏(暂时仅支持全家桶)
|
316
332
|
|
317
333
|
|
318
|
-
var dataFilterForm = (0, _react.useMemo)(function () {
|
319
|
-
return (0, _form.createForm)();
|
320
|
-
}, []); // TODO 获取内容区是否超出一屏(暂时仅支持全家桶)
|
321
|
-
|
322
334
|
var getFooterSuctionState = function getFooterSuctionState() {
|
323
335
|
var containerDom = document.querySelector('.teamix-pro-page-container-scroll-container');
|
324
336
|
|
@@ -470,26 +482,24 @@ var ProTable = function ProTable(props) {
|
|
470
482
|
return _request(params);
|
471
483
|
},
|
472
484
|
request: function request(params) {
|
473
|
-
|
474
|
-
|
475
|
-
|
476
|
-
|
477
|
-
}
|
478
|
-
|
479
|
-
if (params === null || params === void 0 ? void 0 : params[targetPageSizeKey]) {
|
480
|
-
setPageSize(params[targetPageSizeKey]);
|
481
|
-
}
|
485
|
+
// 如果请求中还有翻页相关信息,需要自动设置到指定页
|
486
|
+
if (params === null || params === void 0 ? void 0 : params[targetPageKey]) {
|
487
|
+
setCurrentPage(params[targetPageKey]);
|
488
|
+
}
|
482
489
|
|
483
|
-
|
490
|
+
if (params === null || params === void 0 ? void 0 : params[targetPageSizeKey]) {
|
491
|
+
setPageSize(params[targetPageSizeKey]);
|
484
492
|
}
|
493
|
+
|
494
|
+
_request(params);
|
485
495
|
},
|
486
496
|
reset: function reset() {
|
487
|
-
var _actionRef$current3, _actionRef$current3$s;
|
497
|
+
var _actionRef$current3, _actionRef$current3$s, _dataFilterForm;
|
488
498
|
|
489
499
|
(propsDataFilter === null || propsDataFilter === void 0 ? void 0 : propsDataFilter.onReset) && (propsDataFilter === null || propsDataFilter === void 0 ? void 0 : propsDataFilter.onReset()); // 清空列过滤参数
|
490
500
|
|
491
501
|
(_actionRef$current3 = actionRef.current) === null || _actionRef$current3 === void 0 ? void 0 : (_actionRef$current3$s = _actionRef$current3.setFilterRules) === null || _actionRef$current3$s === void 0 ? void 0 : _actionRef$current3$s.call(_actionRef$current3, {});
|
492
|
-
dataFilterForm.reset();
|
502
|
+
(_dataFilterForm = dataFilterForm) === null || _dataFilterForm === void 0 ? void 0 : _dataFilterForm.reset();
|
493
503
|
setCurrentPage(1);
|
494
504
|
|
495
505
|
_request(_defineProperty({}, targetPageKey, 1));
|
@@ -512,6 +522,8 @@ var ProTable = function ProTable(props) {
|
|
512
522
|
},
|
513
523
|
data: data,
|
514
524
|
dataFilterForm: dataFilterForm,
|
525
|
+
normalDataFilterForm: normalDataFilterForm,
|
526
|
+
fullscreenDataFilterForm: fullscreenDataFilterForm,
|
515
527
|
resetTableMaxBodyHeight: function resetTableMaxBodyHeight() {
|
516
528
|
getHeaderHeight().then(function (height) {
|
517
529
|
setHeaderHeight(height);
|
@@ -601,7 +613,7 @@ var ProTable = function ProTable(props) {
|
|
601
613
|
}); // 请求函数
|
602
614
|
|
603
615
|
function _request(params, noLoading) {
|
604
|
-
var _actionRef$current$ge, _actionRef$current4, _actionRef$current4$g, _objectSpread2;
|
616
|
+
var _dataFilterForm2, _actionRef$current$ge, _actionRef$current4, _actionRef$current4$g, _objectSpread2;
|
605
617
|
|
606
618
|
// 如果没有传 url 且没有 customRequest,直接返回
|
607
619
|
if (!url && !customRequest) {
|
@@ -614,7 +626,7 @@ var ProTable = function ProTable(props) {
|
|
614
626
|
|
615
627
|
var sortParams = targetFormatSort(sort); // 筛选区请求参数
|
616
628
|
|
617
|
-
var dataFilterParams = toJS(dataFilterForm.values); // 列过滤请求参数
|
629
|
+
var dataFilterParams = toJS((_dataFilterForm2 = dataFilterForm) === null || _dataFilterForm2 === void 0 ? void 0 : _dataFilterForm2.values); // 列过滤请求参数
|
618
630
|
|
619
631
|
var columnsFilterParams = (_actionRef$current$ge = (_actionRef$current4 = actionRef.current) === null || _actionRef$current4 === void 0 ? void 0 : (_actionRef$current4$g = _actionRef$current4.getFilterRules) === null || _actionRef$current4$g === void 0 ? void 0 : _actionRef$current4$g.call(_actionRef$current4)) !== null && _actionRef$current$ge !== void 0 ? _actionRef$current$ge : {}; // 格式化后的请求参数
|
620
632
|
|
@@ -665,8 +677,11 @@ var ProTable = function ProTable(props) {
|
|
665
677
|
}
|
666
678
|
|
667
679
|
(0, _react.useEffect)(function () {
|
680
|
+
var _dataFilterForm3;
|
681
|
+
|
668
682
|
// 初始化 actionRef state、callback 此时 actionRef 已初始化完成
|
669
|
-
(0, _utils2.initActionRef)();
|
683
|
+
(0, _utils2.initActionRef)();
|
684
|
+
dataFilterForm = dataFilterFormRef.current; // 监听 浏览器变化 更吸底状态
|
670
685
|
|
671
686
|
if (footerSuction) {
|
672
687
|
getFooterSuctionState();
|
@@ -676,16 +691,11 @@ var ProTable = function ProTable(props) {
|
|
676
691
|
};
|
677
692
|
}
|
678
693
|
|
679
|
-
if (requestWhenMount) {
|
680
|
-
|
681
|
-
|
682
|
-
|
683
|
-
var searchName = getSearchName();
|
694
|
+
if (requestWhenMount && ((_dataFilterForm3 = dataFilterForm) === null || _dataFilterForm3 === void 0 ? void 0 : _dataFilterForm3.id)) {
|
695
|
+
// 在请求发送之前 处理漏斗默认数据
|
696
|
+
(0, _utils2.processDefaultFilter)(propsColumns, actionRef, defaultFilterParams);
|
684
697
|
|
685
|
-
|
686
|
-
// 如果有初始值,需要赋值
|
687
|
-
var initialValues = toJS(dataFilterForm.initialValues);
|
688
|
-
searchValueRef.current = initialValues[searchName][1];
|
698
|
+
_request();
|
689
699
|
}
|
690
700
|
|
691
701
|
return function () {
|
@@ -699,7 +709,7 @@ var ProTable = function ProTable(props) {
|
|
699
709
|
|
700
710
|
actionRef.current = undefined;
|
701
711
|
};
|
702
|
-
}, []);
|
712
|
+
}, [(_dataFilterForm4 = dataFilterForm) === null || _dataFilterForm4 === void 0 ? void 0 : _dataFilterForm4.id]);
|
703
713
|
|
704
714
|
function onSort(dataIndex, order) {
|
705
715
|
var nextSort = _defineProperty({}, dataIndex, order);
|
@@ -707,62 +717,27 @@ var ProTable = function ProTable(props) {
|
|
707
717
|
setSort(nextSort);
|
708
718
|
|
709
719
|
_request(targetFormatSort(nextSort));
|
710
|
-
} //
|
711
|
-
|
712
|
-
|
713
|
-
var getSearchName = function getSearchName() {
|
714
|
-
var _dataFilter$schema;
|
715
|
-
|
716
|
-
if ((dataFilter === null || dataFilter === void 0 ? void 0 : dataFilter.schema) && ((_dataFilter$schema = dataFilter.schema) === null || _dataFilter$schema === void 0 ? void 0 : _dataFilter$schema.length) > 0) {
|
717
|
-
var searchSchema = dataFilter.schema.find(function (item) {
|
718
|
-
return item.component === 'Search';
|
719
|
-
});
|
720
|
-
|
721
|
-
if (searchSchema) {
|
722
|
-
var searchName = searchSchema.name;
|
723
|
-
return searchName;
|
724
|
-
}
|
725
|
-
}
|
726
|
-
}; // 处理 dataFilter 中的 onFilter、onReset
|
720
|
+
} // 处理 dataFilter 中的 onFilter、onReset
|
727
721
|
|
728
722
|
|
729
723
|
var dataFilter = _objectSpread(_objectSpread({
|
730
724
|
mode: 'inline'
|
731
725
|
}, propsDataFilter), {}, {
|
732
|
-
onFilter:
|
733
|
-
|
734
|
-
|
735
|
-
if (dataFilterForm.validate()) {
|
736
|
-
var _actionRef$current5, _actionRef$current5$c;
|
737
|
-
|
738
|
-
/**
|
739
|
-
* 针对 inline 模式下的 Search 组件做特殊处理
|
740
|
-
* 当切换条件且输入内容为空的时候,类似[a, ''] => [b, ''] 不触发请求
|
741
|
-
*/
|
742
|
-
if (dataFilter.mode === 'inline') {
|
743
|
-
var searchName = getSearchName();
|
726
|
+
onFilter: function onFilter(values) {
|
727
|
+
var _actionRef$current5, _actionRef$current5$c;
|
744
728
|
|
745
|
-
|
746
|
-
var searchValue = values[searchName][1];
|
729
|
+
(propsDataFilter === null || propsDataFilter === void 0 ? void 0 : propsDataFilter.onFilter) && (propsDataFilter === null || propsDataFilter === void 0 ? void 0 : propsDataFilter.onFilter(values)); // 搜索变化时,暂时先清空选择
|
747
730
|
|
748
|
-
|
749
|
-
|
750
|
-
}
|
751
|
-
|
752
|
-
searchValueRef.current = searchValue;
|
753
|
-
}
|
754
|
-
} // 搜索变化时,暂时先清空选择
|
755
|
-
|
756
|
-
|
757
|
-
(_actionRef$current5 = actionRef.current) === null || _actionRef$current5 === void 0 ? void 0 : (_actionRef$current5$c = _actionRef$current5.clearRowSelection) === null || _actionRef$current5$c === void 0 ? void 0 : _actionRef$current5$c.call(_actionRef$current5);
|
758
|
-
setCurrentPage(1);
|
731
|
+
(_actionRef$current5 = actionRef.current) === null || _actionRef$current5 === void 0 ? void 0 : (_actionRef$current5$c = _actionRef$current5.clearRowSelection) === null || _actionRef$current5$c === void 0 ? void 0 : _actionRef$current5$c.call(_actionRef$current5);
|
732
|
+
setCurrentPage(1);
|
759
733
|
|
760
|
-
|
761
|
-
|
762
|
-
}, filterDebounce),
|
734
|
+
_request(_defineProperty({}, targetPageKey, 1));
|
735
|
+
},
|
763
736
|
onReset: function onReset() {
|
737
|
+
var _dataFilterForm5;
|
738
|
+
|
764
739
|
(propsDataFilter === null || propsDataFilter === void 0 ? void 0 : propsDataFilter.onReset) && (propsDataFilter === null || propsDataFilter === void 0 ? void 0 : propsDataFilter.onReset());
|
765
|
-
dataFilterForm.reset();
|
740
|
+
(_dataFilterForm5 = dataFilterForm) === null || _dataFilterForm5 === void 0 ? void 0 : _dataFilterForm5.reset();
|
766
741
|
setCurrentPage(1);
|
767
742
|
|
768
743
|
_request(_defineProperty({}, targetPageKey, 1));
|
@@ -777,7 +752,7 @@ var ProTable = function ProTable(props) {
|
|
777
752
|
}
|
778
753
|
};
|
779
754
|
|
780
|
-
var renderTable = function renderTable() {
|
755
|
+
var renderTable = function renderTable(isFullScreen) {
|
781
756
|
if (propsColumns) {
|
782
757
|
return /*#__PURE__*/_react.default.createElement("div", {
|
783
758
|
className: (0, _classnames.default)('teamix-pro-table-container', className)
|
@@ -789,7 +764,7 @@ var ProTable = function ProTable(props) {
|
|
789
764
|
actionRef: actionRef,
|
790
765
|
columns: propsColumns,
|
791
766
|
dataFilter: dataFilter,
|
792
|
-
|
767
|
+
dataFilterFormRef: isFullScreen ? fullscreenDataFilterFormRef : normalDataFilterFormRef,
|
793
768
|
rowSelection: rowSelection,
|
794
769
|
filterColumnType: filterColumnType
|
795
770
|
}), /*#__PURE__*/_react.default.createElement(_components.Table.StickyLock, _objectSpread({
|
@@ -831,7 +806,7 @@ var ProTable = function ProTable(props) {
|
|
831
806
|
|
832
807
|
var targetActions = footerAction.actions.map(function (action) {
|
833
808
|
return _objectSpread(_objectSpread({}, action), {}, {
|
834
|
-
disabled: action.disabled || selectedCount === 0
|
809
|
+
disabled: (action === null || action === void 0 ? void 0 : action.disabled) || selectedCount === 0
|
835
810
|
});
|
836
811
|
});
|
837
812
|
|
@@ -934,14 +909,16 @@ var ProTable = function ProTable(props) {
|
|
934
909
|
return /*#__PURE__*/_react.default.createElement(_Fullscreen.default, {
|
935
910
|
visible: fullscreenState,
|
936
911
|
actionRef: actionRef
|
937
|
-
},
|
938
|
-
|
939
|
-
|
940
|
-
|
941
|
-
|
942
|
-
|
943
|
-
|
944
|
-
|
912
|
+
}, function (isFullScreen) {
|
913
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
914
|
+
className: cls({
|
915
|
+
'': true,
|
916
|
+
fullscreen: fullscreenState // 'footer-suction': footerSuctionState && footerSuction,
|
917
|
+
|
918
|
+
}),
|
919
|
+
ref: tableRef
|
920
|
+
}, renderTable(isFullScreen), footerSuctionState && footerSuction && !fullscreenState && /*#__PURE__*/_react.default.createElement(_pageContainer.default.FixedFooter, null, renderFooter()), !(footerSuctionState && footerSuction) && !fullscreenState && renderFooter(), fullscreenState && renderFooter());
|
921
|
+
});
|
945
922
|
};
|
946
923
|
|
947
924
|
var _default = ProTable;
|
package/lib/table/index.scss
CHANGED
@@ -40,11 +40,6 @@ $fullscreenPadding: 24px;
|
|
40
40
|
justify-content: flex-end;
|
41
41
|
width: 100%;
|
42
42
|
}
|
43
|
-
.teamix-pro-pagination-wrapper {
|
44
|
-
display: flex;
|
45
|
-
justify-content: flex-end;
|
46
|
-
width: 100%;
|
47
|
-
}
|
48
43
|
&-footer-action {
|
49
44
|
margin-left: 16px;
|
50
45
|
}
|
@@ -114,4 +109,9 @@ $fullscreenPadding: 24px;
|
|
114
109
|
|
115
110
|
.next-table-empty {
|
116
111
|
--table-empty-padding: 48px;
|
112
|
+
}
|
113
|
+
|
114
|
+
// 后面在基础组件里面覆盖
|
115
|
+
.next-table.next-table td .next-table-cell-wrapper {
|
116
|
+
text-overflow: unset;
|
117
117
|
}
|
package/lib/table/typing.d.ts
CHANGED
@@ -3,7 +3,7 @@
|
|
3
3
|
*/
|
4
4
|
import { ColumnProps, TableProps } from '@alicloudfe/components/types/table';
|
5
5
|
import { ProFieldType, ProFieldRenderProps, ProFieldDataSourceItem } from '../field';
|
6
|
-
import {
|
6
|
+
import { QueryFilterProps } from '../form';
|
7
7
|
import { ProActionGroupProps, ProActionButtonProps } from '../actions';
|
8
8
|
import { PaginationProps } from '@alicloudfe/components/types/pagination';
|
9
9
|
import { HeaderProps as ProTableHeaderProps } from '@teamix/utils';
|
@@ -56,6 +56,8 @@ export declare type ProTableColumnProps = {
|
|
56
56
|
dataIndex?: string | string[];
|
57
57
|
/** 指定 valueType 为日期时间格式时,可以格式化日期时间 */
|
58
58
|
format?: string;
|
59
|
+
/** ProField 其他配置项 */
|
60
|
+
props?: any;
|
59
61
|
} & Omit<ColumnProps, 'filters' | 'dataIndex' | 'filtersMode'>;
|
60
62
|
export declare type ProColumnProps = ProTableColumnProps;
|
61
63
|
export declare type ProTableProps = {
|
@@ -105,7 +107,10 @@ export declare type ProTableProps = {
|
|
105
107
|
footerAction?: ProActionGroupProps | React.ReactNode;
|
106
108
|
/** 表格底部(右层)配置 */
|
107
109
|
footer?: React.ReactNode;
|
108
|
-
/**
|
110
|
+
/**
|
111
|
+
* @deprecated 已废弃 建议用 dataFilter 中的 filterDebounce 代替
|
112
|
+
* 筛选区自动搜索的防抖时间(毫秒)
|
113
|
+
*/
|
109
114
|
filterDebounce?: number;
|
110
115
|
/** ProTable action 的引用,便于手动触发一些方法 */
|
111
116
|
actionRef?: React.MutableRefObject<ProTableActionType | undefined>;
|
@@ -125,6 +130,10 @@ export declare type ProTableProps = {
|
|
125
130
|
data: any[];
|
126
131
|
total?: number;
|
127
132
|
}>;
|
133
|
+
/** 默认漏斗过滤条件 */
|
134
|
+
defaultFilterParams?: {
|
135
|
+
[key: string]: any[] | any;
|
136
|
+
};
|
128
137
|
} & Omit<TableProps, 'columns'> & ProTableTopAreaProps;
|
129
138
|
export declare type rowSelectionType = {
|
130
139
|
getProps?: (record: any, index: number) => any;
|
@@ -181,6 +190,8 @@ export declare type ProTableActionType = {
|
|
181
190
|
resetPage?: () => void;
|
182
191
|
/** 获取数据过滤区表单实例 */
|
183
192
|
dataFilterForm?: FormType;
|
193
|
+
normalDataFilterForm?: FormType;
|
194
|
+
fullscreenDataFilterForm?: FormType;
|
184
195
|
/** 表格当前的数据 */
|
185
196
|
data?: any[];
|
186
197
|
} & ProTableActionTypeMutations;
|
@@ -215,17 +226,12 @@ export declare type ProTableActionTypeState = {
|
|
215
226
|
[key: string]: any;
|
216
227
|
};
|
217
228
|
export declare type ProTableDataFilterProps = {
|
218
|
-
/** 展示形式 */
|
219
|
-
mode?: 'inline' | 'panel';
|
220
|
-
/** mode='panel' 时是否默认展开 */
|
221
|
-
expand?: boolean;
|
222
|
-
/** 搜索时是否传入值为undefined的参数,默认不传 */
|
223
229
|
searchUndefined?: boolean;
|
224
230
|
/** 搜索时是否传入值为空字符串的参数,默认不传 */
|
225
231
|
searchEmptyString?: boolean;
|
226
232
|
/** 自定义内容 */
|
227
233
|
content?: React.ReactNode;
|
228
|
-
} &
|
234
|
+
} & QueryFilterProps;
|
229
235
|
export declare type dataFilterProps = ProTableDataFilterProps;
|
230
236
|
export declare type ProTableTopAreaProps = {
|
231
237
|
/** 标题区 */
|
@@ -238,8 +244,8 @@ export declare type ProTableTopAreaProps = {
|
|
238
244
|
extra?: ProActionButtonProps | React.ReactNode | React.ReactNode[];
|
239
245
|
/** 数据过滤区 */
|
240
246
|
dataFilter?: ProTableDataFilterProps;
|
241
|
-
/**
|
242
|
-
|
247
|
+
/** 传给 QueryFilter 的 formRef */
|
248
|
+
dataFilterFormRef?: any;
|
243
249
|
/** 排序、筛选列展示状态 */
|
244
250
|
filterColumnType?: 'dialog' | 'dropdown' | 'auto';
|
245
251
|
};
|
@@ -145,7 +145,8 @@ var renderCell = function renderCell(value, item, index, record, actionRef) {
|
|
145
145
|
}
|
146
146
|
|
147
147
|
var newRender = null;
|
148
|
-
var newDataSource = null;
|
148
|
+
var newDataSource = null;
|
149
|
+
var props = item.props; // 如果 render 直接传函数
|
149
150
|
|
150
151
|
if (typeof render === 'function') {
|
151
152
|
newRender = function newRender() {
|
@@ -153,6 +154,23 @@ var renderCell = function renderCell(value, item, index, record, actionRef) {
|
|
153
154
|
};
|
154
155
|
} else {
|
155
156
|
newRender = processBuriedPoint(processRenderFunction(render, value, index, record), record, value, index);
|
157
|
+
|
158
|
+
if (valueType === 'selectGroup') {
|
159
|
+
newRender = _objectSpread(_objectSpread({
|
160
|
+
maxShowNumber: 1,
|
161
|
+
foldText: 'more',
|
162
|
+
editOnClick: function editOnClick() {},
|
163
|
+
edit: true
|
164
|
+
}, newRender), {}, {
|
165
|
+
ellipsis: false
|
166
|
+
});
|
167
|
+
props = _objectSpread({
|
168
|
+
valueAlias: {
|
169
|
+
value: 'TagValue',
|
170
|
+
key: 'TagKey'
|
171
|
+
}
|
172
|
+
}, props);
|
173
|
+
}
|
156
174
|
} // 渲染操作组
|
157
175
|
|
158
176
|
|
@@ -195,13 +213,13 @@ var renderCell = function renderCell(value, item, index, record, actionRef) {
|
|
195
213
|
} // 渲染 ProField
|
196
214
|
|
197
215
|
|
198
|
-
return /*#__PURE__*/_react.default.createElement(_field.default, {
|
216
|
+
return /*#__PURE__*/_react.default.createElement(_field.default, _objectSpread({
|
199
217
|
type: valueType || 'text',
|
200
218
|
value: value,
|
201
219
|
render: newRender,
|
202
220
|
dataSource: newDataSource,
|
203
221
|
format: format
|
204
|
-
});
|
222
|
+
}, props));
|
205
223
|
};
|
206
224
|
/**
|
207
225
|
* 处理 render 配置项是函数的情况
|
@@ -1,5 +1,6 @@
|
|
1
1
|
/// <reference types="react" />
|
2
2
|
import { ProTableActionType } from '../typing';
|
3
|
+
import { ProTableProps, ProTableColumnProps } from '..';
|
3
4
|
export declare function initActionRef(): void;
|
4
5
|
/** table 组件内监听 不对外暴露 */
|
5
6
|
export declare function on(fun: any, key: string): void;
|
@@ -9,3 +10,9 @@ export declare function off(key: string): void;
|
|
9
10
|
export declare function emit(key: string, ...args: any): void;
|
10
11
|
export declare function useActionType<T>(ref: React.MutableRefObject<ProTableActionType | undefined>, action: ProTableActionType): void;
|
11
12
|
export declare function cloneDeep<T>(obj: T): T;
|
13
|
+
/**
|
14
|
+
* 处理默认过滤参数
|
15
|
+
* @param columns
|
16
|
+
* @param ref
|
17
|
+
*/
|
18
|
+
export declare function processDefaultFilter(columns: ProTableColumnProps[], ref: React.MutableRefObject<ProTableActionType | undefined>, defaultFilterParams: ProTableProps['defaultFilterParams']): void;
|
package/lib/table/utils/index.js
CHANGED
@@ -8,6 +8,7 @@ exports.emit = emit;
|
|
8
8
|
exports.initActionRef = initActionRef;
|
9
9
|
exports.off = off;
|
10
10
|
exports.on = on;
|
11
|
+
exports.processDefaultFilter = processDefaultFilter;
|
11
12
|
exports.useActionType = useActionType;
|
12
13
|
|
13
14
|
var _lodash = _interopRequireDefault(require("lodash.clonedeep"));
|
@@ -193,4 +194,41 @@ function useActionType(ref, action) {
|
|
193
194
|
|
194
195
|
function cloneDeep(obj) {
|
195
196
|
return (0, _lodash.default)(obj);
|
197
|
+
}
|
198
|
+
/**
|
199
|
+
* 处理默认过滤参数
|
200
|
+
* @param columns
|
201
|
+
* @param ref
|
202
|
+
*/
|
203
|
+
|
204
|
+
|
205
|
+
function processDefaultFilter(columns, ref, defaultFilterParams) {
|
206
|
+
columns.forEach(function (column) {
|
207
|
+
var _column$dataIndex$toS, _column$dataIndex;
|
208
|
+
|
209
|
+
var defaultRules = defaultFilterParams === null || defaultFilterParams === void 0 ? void 0 : defaultFilterParams[(_column$dataIndex$toS = column === null || column === void 0 ? void 0 : (_column$dataIndex = column.dataIndex) === null || _column$dataIndex === void 0 ? void 0 : _column$dataIndex.toString()) !== null && _column$dataIndex$toS !== void 0 ? _column$dataIndex$toS : ''];
|
210
|
+
|
211
|
+
if (defaultRules) {
|
212
|
+
var _ref$current$getState, _ref$current, _ref$current$getState2, _ref$current$getState3, _ref$current2, _ref$current2$setFilt;
|
213
|
+
|
214
|
+
var params = '';
|
215
|
+
var rules = [];
|
216
|
+
|
217
|
+
if (Array.isArray(defaultRules)) {
|
218
|
+
params = defaultRules.join(',');
|
219
|
+
rules = defaultRules;
|
220
|
+
} else {
|
221
|
+
params = defaultRules;
|
222
|
+
rules = [defaultRules];
|
223
|
+
} // 需要带上其他所有的信息
|
224
|
+
|
225
|
+
|
226
|
+
var otherRules = (_ref$current$getState = (_ref$current = ref.current) === null || _ref$current === void 0 ? void 0 : (_ref$current$getState2 = _ref$current.getState) === null || _ref$current$getState2 === void 0 ? void 0 : (_ref$current$getState3 = _ref$current$getState2.call(_ref$current)) === null || _ref$current$getState3 === void 0 ? void 0 : _ref$current$getState3.filterRules) !== null && _ref$current$getState !== void 0 ? _ref$current$getState : {}; // 再设置所有的列筛选状态
|
227
|
+
|
228
|
+
(_ref$current2 = ref.current) === null || _ref$current2 === void 0 ? void 0 : (_ref$current2$setFilt = _ref$current2.setFilterRules) === null || _ref$current2$setFilt === void 0 ? void 0 : _ref$current2$setFilt.call(_ref$current2, _objectSpread(_objectSpread({}, otherRules), {}, _defineProperty({}, column.dataIndex, {
|
229
|
+
rules: rules,
|
230
|
+
params: params
|
231
|
+
})));
|
232
|
+
}
|
233
|
+
});
|
196
234
|
}
|
package/lib/utils/index.d.ts
CHANGED