@teamix/pro 1.2.30 → 1.2.34
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.css +1 -1
- package/dist/pro.js +16740 -17360
- package/dist/pro.min.css +1 -1
- package/dist/pro.min.js +1 -1
- package/es/actions/dialog-form.js +58 -9
- package/es/common.scss +22 -0
- package/es/form/Filter/SimpleFilter.js +10 -3
- package/es/form/Filter/index.d.ts +5 -9
- package/es/form/Filter/index.js +427 -154
- package/es/form/Filter/index.scss +33 -11
- package/es/form/Filter/index2.d.ts +9 -5
- package/es/form/Filter/index2.js +154 -370
- package/es/form/Filter/index2.scss +11 -33
- package/es/form/ProForm/index.js +4 -4
- package/es/form/ProForm/index.scss +5 -0
- package/es/form/SchemaForm/index.js +4 -4
- package/es/form/SchemaForm/initializeRequest.d.ts +1 -1
- package/es/form/SchemaForm/initializeRequest.js +41 -5
- package/es/form/SchemaForm/reactions.d.ts +2 -2
- package/es/form/SchemaForm/reactions.js +13 -6
- package/es/form/index.d.ts +3 -3
- package/es/form/index.js +3 -3
- package/es/form/typing.d.ts +8 -2
- package/es/index.d.ts +1 -1
- package/es/index.js +1 -1
- package/es/info/components/InfoValueItem/index.js +38 -12
- package/es/info/components/InfoValueItem/index.scss +1 -0
- package/es/info/components/ProInfoItem/index.js +6 -3
- package/es/info/components/ProInfoItem/index.scss +9 -0
- package/es/info/components/baseInfo/index.js +4 -2
- package/es/info/components/headerInfo/index.js +2 -1
- package/es/info/components/tableInfo/index.js +2 -1
- package/es/info/index.scss +2 -0
- package/es/info/typing.d.ts +3 -0
- package/es/table/components/Filter/index.js +6 -6
- package/es/table/components/Layout/index.js +29 -23
- package/es/table/components/Layout/index.scss +7 -0
- package/es/table/components/ToolBar/Fullscreen.js +39 -15
- package/es/table/components/ToolBar/index.scss +1 -0
- package/es/table/index.js +122 -54
- package/es/table/typing.d.ts +3 -2
- package/es/table/utils/columnRender.js +2 -2
- package/es/table/utils/index.d.ts +2 -1
- package/es/table/utils/index.js +62 -113
- package/lib/actions/dialog-form.js +57 -10
- package/lib/common.scss +22 -0
- package/lib/form/Filter/SimpleFilter.js +8 -1
- package/lib/form/Filter/index.d.ts +5 -9
- package/lib/form/Filter/index.js +440 -154
- package/lib/form/Filter/index.scss +33 -11
- package/lib/form/Filter/index2.d.ts +9 -5
- package/lib/form/Filter/index2.js +154 -383
- package/lib/form/Filter/index2.scss +11 -33
- package/lib/form/ProForm/index.js +4 -4
- package/lib/form/ProForm/index.scss +5 -0
- package/lib/form/SchemaForm/index.js +4 -4
- package/lib/form/SchemaForm/initializeRequest.d.ts +1 -1
- package/lib/form/SchemaForm/initializeRequest.js +41 -5
- package/lib/form/SchemaForm/reactions.d.ts +2 -2
- package/lib/form/SchemaForm/reactions.js +13 -6
- package/lib/form/index.d.ts +3 -3
- package/lib/form/index.js +8 -8
- package/lib/form/typing.d.ts +8 -2
- package/lib/index.d.ts +1 -1
- package/lib/index.js +1 -1
- package/lib/info/components/InfoValueItem/index.js +38 -12
- package/lib/info/components/InfoValueItem/index.scss +1 -0
- package/lib/info/components/ProInfoItem/index.js +6 -3
- package/lib/info/components/ProInfoItem/index.scss +9 -0
- package/lib/info/components/baseInfo/index.js +4 -2
- package/lib/info/components/headerInfo/index.js +2 -1
- package/lib/info/components/tableInfo/index.js +2 -1
- package/lib/info/index.scss +2 -0
- package/lib/info/typing.d.ts +3 -0
- package/lib/table/components/Filter/index.js +6 -6
- package/lib/table/components/Layout/index.js +29 -23
- package/lib/table/components/Layout/index.scss +7 -0
- package/lib/table/components/ToolBar/Fullscreen.js +37 -14
- package/lib/table/components/ToolBar/index.scss +1 -0
- package/lib/table/index.js +121 -53
- package/lib/table/typing.d.ts +3 -2
- package/lib/table/utils/columnRender.js +2 -2
- package/lib/table/utils/index.d.ts +2 -1
- package/lib/table/utils/index.js +63 -112
- package/package.json +1 -1
- package/dist/212.js +0 -155705
- package/dist/fonts/codicon.ttf +0 -0
- package/es/form/Components/SelectTable/index.d.ts +0 -24
- package/es/form/Components/SelectTable/index.js +0 -135
- package/es/form/Components/SelectTable/index.scss +0 -28
- package/es/form/Components/SelectTable/table.d.ts +0 -6
- package/es/form/Components/SelectTable/table.js +0 -64
- package/lib/form/Components/SelectTable/index.d.ts +0 -24
- package/lib/form/Components/SelectTable/index.js +0 -157
- package/lib/form/Components/SelectTable/index.scss +0 -28
- package/lib/form/Components/SelectTable/table.d.ts +0 -6
- package/lib/form/Components/SelectTable/table.js +0 -76
@@ -70,10 +70,10 @@ var Filter = function Filter(props) {
|
|
70
70
|
setVisible = _useState4[1];
|
71
71
|
|
72
72
|
(0, _react.useEffect)(function () {
|
73
|
-
var _actionRef$current$ge, _actionRef$current, _actionRef$current$ge2, _actionRef$current$ge3, _actionRef$current$ge4;
|
73
|
+
var _actionRef$current$ge, _actionRef$current, _actionRef$current$ge2, _actionRef$current$ge3, _actionRef$current$ge4, _actionRef$current$ge5;
|
74
74
|
|
75
75
|
// 从全局状态中读取上次存储的条件
|
76
|
-
var rules = (_actionRef$current$ge = (_actionRef$current = actionRef.current) === null || _actionRef$current === void 0 ? void 0 : (_actionRef$current$ge2 = _actionRef$current.getState) === null || _actionRef$current$ge2 === void 0 ? void 0 : (_actionRef$current$ge3 = _actionRef$current$ge2.call(_actionRef$current)
|
76
|
+
var rules = (_actionRef$current$ge = (_actionRef$current = actionRef.current) === null || _actionRef$current === void 0 ? void 0 : (_actionRef$current$ge2 = _actionRef$current.getState) === null || _actionRef$current$ge2 === void 0 ? void 0 : (_actionRef$current$ge3 = _actionRef$current$ge2.call(_actionRef$current)) === null || _actionRef$current$ge3 === void 0 ? void 0 : (_actionRef$current$ge4 = _actionRef$current$ge3.filterRules) === null || _actionRef$current$ge4 === void 0 ? void 0 : (_actionRef$current$ge5 = _actionRef$current$ge4[column.dataIndex]) === null || _actionRef$current$ge5 === void 0 ? void 0 : _actionRef$current$ge5.rules) !== null && _actionRef$current$ge !== void 0 ? _actionRef$current$ge : [];
|
77
77
|
setSelected(rules);
|
78
78
|
}, []); // 获取过滤项
|
79
79
|
|
@@ -191,7 +191,7 @@ var Filter = function Filter(props) {
|
|
191
191
|
btn: true
|
192
192
|
}),
|
193
193
|
onClick: function onClick() {
|
194
|
-
var _actionRef$current2, _actionRef$current2$f, _actionRef$current$
|
194
|
+
var _actionRef$current2, _actionRef$current2$f, _actionRef$current$ge6, _actionRef$current3, _actionRef$current3$g, _actionRef$current3$g2, _actionRef$current4, _actionRef$current4$s;
|
195
195
|
|
196
196
|
(_actionRef$current2 = actionRef.current) === null || _actionRef$current2 === void 0 ? void 0 : (_actionRef$current2$f = _actionRef$current2.filterDataSource) === null || _actionRef$current2$f === void 0 ? void 0 : _actionRef$current2$f.call(_actionRef$current2, column.dataIndex); // 先获取此列的param
|
197
197
|
|
@@ -206,7 +206,7 @@ var Filter = function Filter(props) {
|
|
206
206
|
} // 需要带上其他所有的信息
|
207
207
|
|
208
208
|
|
209
|
-
var rules = (_actionRef$current$
|
209
|
+
var rules = (_actionRef$current$ge6 = (_actionRef$current3 = actionRef.current) === null || _actionRef$current3 === void 0 ? void 0 : (_actionRef$current3$g = _actionRef$current3.getState) === null || _actionRef$current3$g === void 0 ? void 0 : (_actionRef$current3$g2 = _actionRef$current3$g.call(_actionRef$current3)) === null || _actionRef$current3$g2 === void 0 ? void 0 : _actionRef$current3$g2.filterRules) !== null && _actionRef$current$ge6 !== void 0 ? _actionRef$current$ge6 : {}; // 再设置所有的列筛选状态
|
210
210
|
|
211
211
|
(_actionRef$current4 = actionRef.current) === null || _actionRef$current4 === void 0 ? void 0 : (_actionRef$current4$s = _actionRef$current4.setFilterRules) === null || _actionRef$current4$s === void 0 ? void 0 : _actionRef$current4$s.call(_actionRef$current4, _objectSpread(_objectSpread({}, rules), {}, _defineProperty({}, column.dataIndex, {
|
212
212
|
rules: selected,
|
@@ -239,10 +239,10 @@ var Filter = function Filter(props) {
|
|
239
239
|
btn: true
|
240
240
|
}),
|
241
241
|
onClick: function onClick() {
|
242
|
-
var _actionRef$current$
|
242
|
+
var _actionRef$current$ge7, _actionRef$current9, _actionRef$current9$g, _actionRef$current9$g2, _actionRef$current10, _actionRef$current10$, _actionRef$current11, _actionRef$current11$;
|
243
243
|
|
244
244
|
setSelected([]);
|
245
|
-
var rules = (_actionRef$current$
|
245
|
+
var rules = (_actionRef$current$ge7 = (_actionRef$current9 = actionRef.current) === null || _actionRef$current9 === void 0 ? void 0 : (_actionRef$current9$g = _actionRef$current9.getState) === null || _actionRef$current9$g === void 0 ? void 0 : (_actionRef$current9$g2 = _actionRef$current9$g.call(_actionRef$current9)) === null || _actionRef$current9$g2 === void 0 ? void 0 : _actionRef$current9$g2.filterRules) !== null && _actionRef$current$ge7 !== void 0 ? _actionRef$current$ge7 : {};
|
246
246
|
(_actionRef$current10 = actionRef.current) === null || _actionRef$current10 === void 0 ? void 0 : (_actionRef$current10$ = _actionRef$current10.setFilterRules) === null || _actionRef$current10$ === void 0 ? void 0 : _actionRef$current10$.call(_actionRef$current10, _objectSpread(_objectSpread({}, rules), {}, _defineProperty({}, column.dataIndex, {
|
247
247
|
rules: [],
|
248
248
|
params: ''
|
@@ -76,6 +76,19 @@ var Layout = function Layout(props) {
|
|
76
76
|
context: _objectSpread(_objectSpread({}, defaultContext), mainAction.context)
|
77
77
|
})));
|
78
78
|
} else return mainAction;
|
79
|
+
}; // 渲染 addonAfter
|
80
|
+
|
81
|
+
|
82
|
+
var renderAddonAfter = function renderAddonAfter() {
|
83
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
84
|
+
className: cls('addon-after-wrapper')
|
85
|
+
}, extra && !header && /*#__PURE__*/_react.default.createElement(_QuickAction.default, {
|
86
|
+
actionRef: actionRef,
|
87
|
+
quickAction: extra,
|
88
|
+
rowSelection: rowSelection
|
89
|
+
}), /*#__PURE__*/_react.default.createElement(_ToolBar.default, _objectSpread({
|
90
|
+
actionRef: actionRef
|
91
|
+
}, otherProps)));
|
79
92
|
}; // 渲染新版 QueryFilter
|
80
93
|
|
81
94
|
|
@@ -103,13 +116,7 @@ var Layout = function Layout(props) {
|
|
103
116
|
},
|
104
117
|
panelContent: dataFilter.content,
|
105
118
|
addonBefore: renderMainAction(),
|
106
|
-
addonAfter:
|
107
|
-
actionRef: actionRef,
|
108
|
-
quickAction: extra,
|
109
|
-
rowSelection: rowSelection
|
110
|
-
}), /*#__PURE__*/_react.default.createElement(_ToolBar.default, _objectSpread({
|
111
|
-
actionRef: actionRef
|
112
|
-
}, otherProps)))
|
119
|
+
addonAfter: renderAddonAfter()
|
113
120
|
}, dataFilter));
|
114
121
|
} else if ((dataFilter === null || dataFilter === void 0 ? void 0 : (_dataFilter$schema2 = dataFilter.schema) === null || _dataFilter$schema2 === void 0 ? void 0 : _dataFilter$schema2.length) >= 0) {
|
115
122
|
return /*#__PURE__*/_react.default.createElement(_form.QueryFilter, _objectSpread({
|
@@ -128,27 +135,18 @@ var Layout = function Layout(props) {
|
|
128
135
|
(dataFilter === null || dataFilter === void 0 ? void 0 : dataFilter.onExpand) && (dataFilter === null || dataFilter === void 0 ? void 0 : dataFilter.onExpand(expand));
|
129
136
|
},
|
130
137
|
addonBefore: renderMainAction(),
|
131
|
-
addonAfter:
|
132
|
-
actionRef: actionRef,
|
133
|
-
quickAction: extra,
|
134
|
-
rowSelection: rowSelection
|
135
|
-
}), /*#__PURE__*/_react.default.createElement(_ToolBar.default, _objectSpread({
|
136
|
-
actionRef: actionRef
|
137
|
-
}, otherProps)))
|
138
|
+
addonAfter: renderAddonAfter()
|
138
139
|
}, dataFilter));
|
139
140
|
}
|
140
141
|
} else if (mainAction) {
|
141
142
|
// 没传 dataFilter 但是传了 mainAction
|
142
143
|
return /*#__PURE__*/_react.default.createElement(_form.QueryFilterLayout, {
|
143
|
-
className: "mb8",
|
144
144
|
addonBefore: renderMainAction(),
|
145
|
-
addonAfter:
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
actionRef: actionRef
|
151
|
-
}, otherProps)))
|
145
|
+
addonAfter: renderAddonAfter()
|
146
|
+
});
|
147
|
+
} else {
|
148
|
+
return /*#__PURE__*/_react.default.createElement(_form.QueryFilterLayout, {
|
149
|
+
addonAfter: renderAddonAfter()
|
152
150
|
});
|
153
151
|
}
|
154
152
|
}; // 区域组合渲染
|
@@ -168,11 +166,19 @@ var Layout = function Layout(props) {
|
|
168
166
|
rowSelection: rowSelection
|
169
167
|
}))), renderQueryFilter());
|
170
168
|
} else if (header && !mainAction) {
|
169
|
+
var _dataFilter$schema3, _dataFilter$schema4;
|
170
|
+
|
171
171
|
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("div", {
|
172
172
|
className: cls('wrapper')
|
173
173
|
}, /*#__PURE__*/_react.default.createElement("div", {
|
174
174
|
className: cls('left')
|
175
|
-
}, header && /*#__PURE__*/_react.default.createElement(_utils.Header, _objectSpread({}, header)),
|
175
|
+
}, header && /*#__PURE__*/_react.default.createElement(_utils.Header, _objectSpread({}, header)), (dataFilter === null || dataFilter === void 0 ? void 0 : (_dataFilter$schema3 = dataFilter.schema) === null || _dataFilter$schema3 === void 0 ? void 0 : _dataFilter$schema3.length) && renderQueryFilter()), /*#__PURE__*/_react.default.createElement("div", {
|
176
|
+
className: cls('right')
|
177
|
+
}, extra && /*#__PURE__*/_react.default.createElement(_QuickAction.default, {
|
178
|
+
actionRef: actionRef,
|
179
|
+
quickAction: extra,
|
180
|
+
rowSelection: rowSelection
|
181
|
+
}), !(dataFilter === null || dataFilter === void 0 ? void 0 : (_dataFilter$schema4 = dataFilter.schema) === null || _dataFilter$schema4 === void 0 ? void 0 : _dataFilter$schema4.length) && renderQueryFilter())));
|
176
182
|
} else if (!header && mainAction) {
|
177
183
|
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, renderQueryFilter());
|
178
184
|
} else if (!header && !mainAction) {
|
@@ -25,35 +25,58 @@ var FullScreen = function FullScreen(props) {
|
|
25
25
|
actionRef = props.actionRef;
|
26
26
|
var _actionRef$current = actionRef.current,
|
27
27
|
normalDataFilterForm = _actionRef$current.normalDataFilterForm,
|
28
|
-
fullscreenDataFilterForm = _actionRef$current.fullscreenDataFilterForm
|
28
|
+
fullscreenDataFilterForm = _actionRef$current.fullscreenDataFilterForm,
|
29
|
+
filterEnableRef = _actionRef$current.filterEnableRef;
|
29
30
|
|
30
|
-
function closeByESC(e) {
|
31
|
+
var closeByESC = function closeByESC(e) {
|
31
32
|
if (visible && e.code === 'Escape') {
|
32
|
-
var _actionRef$current2, _actionRef$current2$
|
33
|
+
var _actionRef$current2, _actionRef$current2$f;
|
33
34
|
|
34
|
-
actionRef === null || actionRef === void 0 ? void 0 : (_actionRef$current2 = actionRef.current) === null || _actionRef$current2 === void 0 ? void 0 : (_actionRef$current2$
|
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);
|
35
|
+
actionRef === null || actionRef === void 0 ? void 0 : (_actionRef$current2 = actionRef.current) === null || _actionRef$current2 === void 0 ? void 0 : (_actionRef$current2$f = _actionRef$current2.fullScreen) === null || _actionRef$current2$f === void 0 ? void 0 : _actionRef$current2$f.call(_actionRef$current2);
|
36
36
|
}
|
37
|
-
} // 监听esc按钮
|
37
|
+
}; // 监听esc按钮
|
38
38
|
|
39
39
|
|
40
40
|
(0, _react.useEffect)(function () {
|
41
|
-
var _actionRef$current4, _actionRef$current4$s;
|
42
|
-
|
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);
|
44
41
|
window.addEventListener('keydown', closeByESC);
|
45
42
|
return function () {
|
46
43
|
window.removeEventListener('keydown', closeByESC);
|
47
44
|
};
|
48
|
-
}, [visible]);
|
45
|
+
}, [visible, actionRef]);
|
49
46
|
|
50
47
|
var afterClose = function afterClose() {
|
51
|
-
|
48
|
+
// 判断全屏前后筛选表单值是否有改变
|
49
|
+
var n = JSON.stringify((0, _utils.getValidValues)(normalDataFilterForm.values));
|
50
|
+
var f = JSON.stringify((0, _utils.getValidValues)(fullscreenDataFilterForm.values));
|
51
|
+
|
52
|
+
if (n === f) {
|
53
|
+
// 关闭全屏后,表单值未变化,开启普通表单onFilter
|
54
|
+
filterEnableRef.current.normal = true;
|
55
|
+
} else {
|
56
|
+
// 关闭全屏后,表单值有变化,修改表单值
|
57
|
+
normalDataFilterForm === null || normalDataFilterForm === void 0 ? void 0 : normalDataFilterForm.setValues(fullscreenDataFilterForm.values);
|
58
|
+
} // 关闭全屏后,关闭全屏表单onFilter
|
59
|
+
|
60
|
+
|
61
|
+
filterEnableRef.current.fullscreen = false;
|
52
62
|
}; // 全屏开启之后
|
53
63
|
|
54
64
|
|
55
65
|
var afterOpen = function afterOpen() {
|
56
|
-
|
66
|
+
// 判断全屏前后筛选表单值是否有改变
|
67
|
+
var n = JSON.stringify((0, _utils.getValidValues)(normalDataFilterForm.values));
|
68
|
+
var f = JSON.stringify((0, _utils.getValidValues)(fullscreenDataFilterForm.values));
|
69
|
+
|
70
|
+
if (n === f) {
|
71
|
+
// 全屏后,表单值未变化,开启全屏表单onFilter
|
72
|
+
filterEnableRef.current.fullscreen = true;
|
73
|
+
} else {
|
74
|
+
// 全屏后,表单值变化,修改表单值
|
75
|
+
fullscreenDataFilterForm === null || fullscreenDataFilterForm === void 0 ? void 0 : fullscreenDataFilterForm.setValues(normalDataFilterForm.values);
|
76
|
+
} // 全屏后,关闭普通表单onFilter
|
77
|
+
|
78
|
+
|
79
|
+
filterEnableRef.current.normal = false; // 消息提示
|
57
80
|
|
58
81
|
_components.Message.show({
|
59
82
|
type: 'notice',
|
@@ -84,9 +107,9 @@ var FullScreen = function FullScreen(props) {
|
|
84
107
|
zIndex: 999
|
85
108
|
},
|
86
109
|
onRequestClose: function onRequestClose() {
|
87
|
-
var _actionRef$
|
110
|
+
var _actionRef$current3, _actionRef$current3$f;
|
88
111
|
|
89
|
-
actionRef === null || actionRef === void 0 ? void 0 : (_actionRef$
|
112
|
+
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);
|
90
113
|
}
|
91
114
|
}, /*#__PURE__*/_react.default.createElement("div", {
|
92
115
|
className: "teamix-pro-table-full-screen"
|
package/lib/table/index.js
CHANGED
@@ -165,7 +165,7 @@ var globalFormatSort = function globalFormatSort(sort) {
|
|
165
165
|
};
|
166
166
|
|
167
167
|
var ProTable = function ProTable(props) {
|
168
|
-
var _rowSelection$selecte
|
168
|
+
var _rowSelection$selecte;
|
169
169
|
|
170
170
|
var header = props.header,
|
171
171
|
className = props.className,
|
@@ -281,7 +281,24 @@ var ProTable = function ProTable(props) {
|
|
281
281
|
var _useState19 = (0, _react.useState)(true),
|
282
282
|
_useState20 = _slicedToArray(_useState19, 2),
|
283
283
|
showLoading = _useState20[0],
|
284
|
-
setShowLoading = _useState20[1]; //
|
284
|
+
setShowLoading = _useState20[1]; // 存储能够被 on 监听到的 ProTable 状态
|
285
|
+
// 因为只做存储用。不需要更新视图以及需要同步更改。所以不使用 setState 更新
|
286
|
+
|
287
|
+
|
288
|
+
var _useState21 = (0, _react.useState)({
|
289
|
+
fullScreenState: false,
|
290
|
+
filterRules: {},
|
291
|
+
filterColumns: []
|
292
|
+
}),
|
293
|
+
_useState22 = _slicedToArray(_useState21, 1),
|
294
|
+
actionRefState = _useState22[0]; // 存储 on 监听事件
|
295
|
+
|
296
|
+
|
297
|
+
var _useState23 = (0, _react.useState)({
|
298
|
+
fullScreenState: {}
|
299
|
+
}),
|
300
|
+
_useState24 = _slicedToArray(_useState23, 1),
|
301
|
+
actionRefCallback = _useState24[0]; // 存储定时器 id
|
285
302
|
|
286
303
|
|
287
304
|
var autoRefreshTimerRef = (0, _react.useRef)(); // 获取header高度,用作全屏吸底吸底高度计算
|
@@ -305,18 +322,23 @@ var ProTable = function ProTable(props) {
|
|
305
322
|
}; // header 区域高度。用作全屏计算吸顶吸底高度。默认不做计算
|
306
323
|
|
307
324
|
|
308
|
-
var
|
309
|
-
|
310
|
-
headerHeight =
|
311
|
-
setHeaderHeight =
|
325
|
+
var _useState25 = (0, _react.useState)(0),
|
326
|
+
_useState26 = _slicedToArray(_useState25, 2),
|
327
|
+
headerHeight = _useState26[0],
|
328
|
+
setHeaderHeight = _useState26[1]; // 全屏显示 className
|
312
329
|
|
313
330
|
|
314
|
-
var
|
315
|
-
|
316
|
-
fullscreenState =
|
317
|
-
setFullscreenState =
|
331
|
+
var _useState27 = (0, _react.useState)(false),
|
332
|
+
_useState28 = _slicedToArray(_useState27, 2),
|
333
|
+
fullscreenState = _useState28[0],
|
334
|
+
setFullscreenState = _useState28[1]; // 切换全屏搜索开关
|
318
335
|
|
319
336
|
|
337
|
+
var filterEnableRef = (0, _react.useRef)({
|
338
|
+
fullscreen: false,
|
339
|
+
normal: true
|
340
|
+
}); // 非全屏状态下的
|
341
|
+
|
320
342
|
var normalDataFilterFormRef = (0, _react.useRef)();
|
321
343
|
var fullscreenDataFilterFormRef = (0, _react.useRef)();
|
322
344
|
var normalDataFilterForm = normalDataFilterFormRef.current;
|
@@ -325,10 +347,10 @@ var ProTable = function ProTable(props) {
|
|
325
347
|
var dataFilterFormRef = !fullscreenState ? normalDataFilterFormRef : fullscreenDataFilterFormRef;
|
326
348
|
var dataFilterForm = dataFilterFormRef.current; // 整个内容区是否超过一屏。用于表格在非全屏模式下的吸底
|
327
349
|
|
328
|
-
var
|
329
|
-
|
330
|
-
footerSuctionState =
|
331
|
-
setFooterSuctionState =
|
350
|
+
var _useState29 = (0, _react.useState)(false),
|
351
|
+
_useState30 = _slicedToArray(_useState29, 2),
|
352
|
+
footerSuctionState = _useState30[0],
|
353
|
+
setFooterSuctionState = _useState30[1]; // TODO 获取内容区是否超出一屏(暂时仅支持全家桶)
|
332
354
|
|
333
355
|
|
334
356
|
var getFooterSuctionState = function getFooterSuctionState() {
|
@@ -451,25 +473,63 @@ var ProTable = function ProTable(props) {
|
|
451
473
|
if (propsDataSource) {
|
452
474
|
setData(propsDataSource);
|
453
475
|
}
|
454
|
-
}, [propsDataSource]); //
|
476
|
+
}, [propsDataSource]); // 初始化 ActionRef。
|
477
|
+
|
478
|
+
(0, _utils2.initActionRef)(actionRef, {
|
479
|
+
getState: function getState() {
|
480
|
+
return actionRefState;
|
481
|
+
},
|
482
|
+
getCallback: function getCallback() {
|
483
|
+
return actionRefCallback;
|
484
|
+
},
|
485
|
+
setState: function setState(key, value) {
|
486
|
+
actionRefState[key] = value;
|
487
|
+
(0, _utils2.actionRefUseStateOn)(actionRefCallback, key, value);
|
488
|
+
},
|
489
|
+
on: function on(fun, state, name) {
|
490
|
+
if (!actionRefCallback[state]) {
|
491
|
+
actionRefCallback[state] = {};
|
492
|
+
}
|
493
|
+
|
494
|
+
actionRefCallback[state][name] = fun;
|
495
|
+
},
|
496
|
+
off: function off(name) {
|
497
|
+
actionRefCallback = Object.fromEntries(Object.entries(actionRefCallback).map(function (_ref) {
|
498
|
+
var _ref2 = _slicedToArray(_ref, 2),
|
499
|
+
k = _ref2[0],
|
500
|
+
v = _ref2[1];
|
501
|
+
|
502
|
+
var filterV = Object.fromEntries(Object.entries(v).filter(function (_ref3) {
|
503
|
+
var _ref4 = _slicedToArray(_ref3, 1),
|
504
|
+
k = _ref4[0];
|
505
|
+
|
506
|
+
return k !== name;
|
507
|
+
}));
|
508
|
+
return [k, filterV];
|
509
|
+
}));
|
510
|
+
}
|
511
|
+
}); // 绑定 Actions
|
455
512
|
|
456
513
|
(0, _utils2.useActionType)(actionRef, {
|
457
514
|
fullScreen: function fullScreen() {
|
515
|
+
var _actionRef$current2, _actionRef$current2$s;
|
516
|
+
|
458
517
|
var state = !fullscreenState; // 全屏时需要重新计算header高度
|
459
518
|
|
460
519
|
getHeaderHeight().then(function (height) {
|
461
520
|
setHeaderHeight(height);
|
462
521
|
});
|
463
522
|
setFullscreenState(state);
|
523
|
+
actionRef === null || actionRef === void 0 ? void 0 : (_actionRef$current2 = actionRef.current) === null || _actionRef$current2 === void 0 ? void 0 : (_actionRef$current2$s = _actionRef$current2.setState) === null || _actionRef$current2$s === void 0 ? void 0 : _actionRef$current2$s.call(_actionRef$current2, 'fullScreenState', state);
|
464
524
|
return state;
|
465
525
|
},
|
466
526
|
setColumn: function setColumn(newColumns) {
|
467
|
-
var _actionRef$
|
527
|
+
var _actionRef$current3, _actionRef$current3$s;
|
468
528
|
|
469
529
|
var update = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
470
530
|
var columns = processColumns(newColumns, propsColumns);
|
471
531
|
setFilteredColumns(columns);
|
472
|
-
(_actionRef$
|
532
|
+
(_actionRef$current3 = actionRef.current) === null || _actionRef$current3 === void 0 ? void 0 : (_actionRef$current3$s = _actionRef$current3.setState) === null || _actionRef$current3$s === void 0 ? void 0 : _actionRef$current3$s.call(_actionRef$current3, 'filterColumns', columns);
|
473
533
|
|
474
534
|
if (update) {
|
475
535
|
(0, _utils2.emit)('refreshFilterState', newColumns);
|
@@ -494,12 +554,12 @@ var ProTable = function ProTable(props) {
|
|
494
554
|
_request(params);
|
495
555
|
},
|
496
556
|
reset: function reset() {
|
497
|
-
var _actionRef$
|
557
|
+
var _actionRef$current4, _actionRef$current4$s;
|
498
558
|
|
499
559
|
(propsDataFilter === null || propsDataFilter === void 0 ? void 0 : propsDataFilter.onReset) && (propsDataFilter === null || propsDataFilter === void 0 ? void 0 : propsDataFilter.onReset()); // 清空列过滤参数
|
500
560
|
|
501
|
-
(_actionRef$
|
502
|
-
|
561
|
+
(_actionRef$current4 = actionRef.current) === null || _actionRef$current4 === void 0 ? void 0 : (_actionRef$current4$s = _actionRef$current4.setFilterRules) === null || _actionRef$current4$s === void 0 ? void 0 : _actionRef$current4$s.call(_actionRef$current4, {});
|
562
|
+
dataFilterForm === null || dataFilterForm === void 0 ? void 0 : dataFilterForm.reset();
|
503
563
|
setCurrentPage(1);
|
504
564
|
|
505
565
|
_request(_defineProperty({}, targetPageKey, 1));
|
@@ -524,6 +584,7 @@ var ProTable = function ProTable(props) {
|
|
524
584
|
dataFilterForm: dataFilterForm,
|
525
585
|
normalDataFilterForm: normalDataFilterForm,
|
526
586
|
fullscreenDataFilterForm: fullscreenDataFilterForm,
|
587
|
+
filterEnableRef: filterEnableRef,
|
527
588
|
resetTableMaxBodyHeight: function resetTableMaxBodyHeight() {
|
528
589
|
getHeaderHeight().then(function (height) {
|
529
590
|
setHeaderHeight(height);
|
@@ -612,8 +673,8 @@ var ProTable = function ProTable(props) {
|
|
612
673
|
}
|
613
674
|
}); // 请求函数
|
614
675
|
|
615
|
-
function _request(params, noLoading) {
|
616
|
-
var
|
676
|
+
function _request(params, noLoading, filterParams) {
|
677
|
+
var _actionRef$current$ge, _actionRef$current5, _actionRef$current5$g, _objectSpread2;
|
617
678
|
|
618
679
|
// 如果没有传 url 且没有 customRequest,直接返回
|
619
680
|
if (!url && !customRequest) {
|
@@ -626,9 +687,9 @@ var ProTable = function ProTable(props) {
|
|
626
687
|
|
627
688
|
var sortParams = targetFormatSort(sort); // 筛选区请求参数
|
628
689
|
|
629
|
-
var dataFilterParams =
|
690
|
+
var dataFilterParams = filterParams !== null && filterParams !== void 0 ? filterParams : dataFilterForm === null || dataFilterForm === void 0 ? void 0 : dataFilterForm.values; // 列过滤请求参数
|
630
691
|
|
631
|
-
var columnsFilterParams = (_actionRef$current$ge = (_actionRef$
|
692
|
+
var columnsFilterParams = (_actionRef$current$ge = (_actionRef$current5 = actionRef.current) === null || _actionRef$current5 === void 0 ? void 0 : (_actionRef$current5$g = _actionRef$current5.getFilterRules) === null || _actionRef$current5$g === void 0 ? void 0 : _actionRef$current5$g.call(_actionRef$current5)) !== null && _actionRef$current$ge !== void 0 ? _actionRef$current$ge : {}; // 格式化后的请求参数
|
632
693
|
|
633
694
|
var requestData = formatParams(_objectSpread(_objectSpread({}, !showPagination ? _objectSpread(_objectSpread(_objectSpread(_objectSpread({}, dataFilterParams), propsParams), sortParams), columnsFilterParams) : _objectSpread(_objectSpread(_objectSpread(_objectSpread((_objectSpread2 = {}, _defineProperty(_objectSpread2, targetPageKey, currentPage), _defineProperty(_objectSpread2, targetPageSizeKey, pageSize), _objectSpread2), dataFilterParams), propsParams), sortParams), columnsFilterParams)), params));
|
634
695
|
|
@@ -677,33 +738,24 @@ var ProTable = function ProTable(props) {
|
|
677
738
|
}
|
678
739
|
|
679
740
|
(0, _react.useEffect)(function () {
|
680
|
-
|
681
|
-
(0, _utils2.initActionRef)();
|
682
|
-
dataFilterForm = dataFilterFormRef.current; // 监听 浏览器变化 更吸底状态
|
741
|
+
var _propsDataFilter$sche, _propsDataFilter$sche2;
|
683
742
|
|
743
|
+
// 监听 浏览器变化 更吸底状态
|
684
744
|
if (footerSuction) {
|
685
745
|
getFooterSuctionState();
|
686
746
|
|
687
747
|
window.onresize = function () {
|
688
748
|
getFooterSuctionState();
|
689
749
|
};
|
690
|
-
}
|
750
|
+
} // 如果不传 dataFilter,则在这里初始化请求
|
691
751
|
|
692
|
-
if (propsDataFilter) {
|
693
|
-
var _dataFilterForm3;
|
694
752
|
|
695
|
-
|
696
|
-
// 在请求发送之前 处理漏斗默认数据
|
697
|
-
(0, _utils2.processDefaultFilter)(propsColumns, actionRef, defaultFilterParams);
|
753
|
+
var hasDataFilter = (propsDataFilter === null || propsDataFilter === void 0 ? void 0 : (_propsDataFilter$sche = propsDataFilter.schema) === null || _propsDataFilter$sche === void 0 ? void 0 : _propsDataFilter$sche.length) && (propsDataFilter === null || propsDataFilter === void 0 ? void 0 : (_propsDataFilter$sche2 = propsDataFilter.schema) === null || _propsDataFilter$sche2 === void 0 ? void 0 : _propsDataFilter$sche2.length) > 0;
|
698
754
|
|
699
|
-
|
700
|
-
|
701
|
-
} else {
|
702
|
-
if (requestWhenMount) {
|
703
|
-
(0, _utils2.processDefaultFilter)(propsColumns, actionRef, defaultFilterParams);
|
755
|
+
if (requestWhenMount && !hasDataFilter) {
|
756
|
+
(0, _utils2.processDefaultFilter)(propsColumns, actionRef, defaultFilterParams);
|
704
757
|
|
705
|
-
|
706
|
-
}
|
758
|
+
_request();
|
707
759
|
}
|
708
760
|
|
709
761
|
return function () {
|
@@ -717,7 +769,7 @@ var ProTable = function ProTable(props) {
|
|
717
769
|
|
718
770
|
actionRef.current = undefined;
|
719
771
|
};
|
720
|
-
}, [
|
772
|
+
}, []);
|
721
773
|
|
722
774
|
function onSort(dataIndex, order) {
|
723
775
|
var nextSort = _defineProperty({}, dataIndex, order);
|
@@ -731,24 +783,40 @@ var ProTable = function ProTable(props) {
|
|
731
783
|
var dataFilter = _objectSpread(_objectSpread({
|
732
784
|
mode: 'inline'
|
733
785
|
}, propsDataFilter), {}, {
|
786
|
+
onInit: function onInit(values) {
|
787
|
+
// 表单初始化请求处理
|
788
|
+
(propsDataFilter === null || propsDataFilter === void 0 ? void 0 : propsDataFilter.onInit) && (propsDataFilter === null || propsDataFilter === void 0 ? void 0 : propsDataFilter.onInit(values));
|
789
|
+
!fullscreenState && _request({}, false, values);
|
790
|
+
return true;
|
791
|
+
},
|
734
792
|
onFilter: function onFilter(values) {
|
735
|
-
var _actionRef$
|
793
|
+
var _actionRef$current6, _actionRef$current6$c;
|
794
|
+
|
795
|
+
// 全屏状态,判断全屏表单onFilter是否禁用
|
796
|
+
if (fullscreenState && !filterEnableRef.current.fullscreen) {
|
797
|
+
filterEnableRef.current.fullscreen = true;
|
798
|
+
return;
|
799
|
+
} // 非全屏状态,判断普通表单onFiler是否禁用
|
800
|
+
|
801
|
+
|
802
|
+
if (!fullscreenState && !filterEnableRef.current.normal) {
|
803
|
+
filterEnableRef.current.normal = true;
|
804
|
+
return;
|
805
|
+
}
|
736
806
|
|
737
807
|
(propsDataFilter === null || propsDataFilter === void 0 ? void 0 : propsDataFilter.onFilter) && (propsDataFilter === null || propsDataFilter === void 0 ? void 0 : propsDataFilter.onFilter(values)); // 搜索变化时,暂时先清空选择
|
738
808
|
|
739
|
-
(_actionRef$
|
809
|
+
(_actionRef$current6 = actionRef.current) === null || _actionRef$current6 === void 0 ? void 0 : (_actionRef$current6$c = _actionRef$current6.clearRowSelection) === null || _actionRef$current6$c === void 0 ? void 0 : _actionRef$current6$c.call(_actionRef$current6);
|
740
810
|
setCurrentPage(1);
|
741
811
|
|
742
|
-
_request(_defineProperty({}, targetPageKey, 1));
|
812
|
+
_request(_defineProperty({}, targetPageKey, 1), false, values);
|
743
813
|
},
|
744
|
-
onReset: function onReset() {
|
745
|
-
var _dataFilterForm5;
|
746
|
-
|
814
|
+
onReset: function onReset(values) {
|
747
815
|
(propsDataFilter === null || propsDataFilter === void 0 ? void 0 : propsDataFilter.onReset) && (propsDataFilter === null || propsDataFilter === void 0 ? void 0 : propsDataFilter.onReset());
|
748
|
-
|
816
|
+
dataFilterForm === null || dataFilterForm === void 0 ? void 0 : dataFilterForm.reset();
|
749
817
|
setCurrentPage(1);
|
750
818
|
|
751
|
-
_request(_defineProperty({}, targetPageKey, 1));
|
819
|
+
_request(_defineProperty({}, targetPageKey, 1), false, values);
|
752
820
|
}
|
753
821
|
});
|
754
822
|
|
@@ -832,21 +900,21 @@ var ProTable = function ProTable(props) {
|
|
832
900
|
|
833
901
|
var renderFooter = function renderFooter() {
|
834
902
|
function onChangePagination(currentPage) {
|
835
|
-
var _actionRef$
|
903
|
+
var _actionRef$current7, _actionRef$current7$c;
|
836
904
|
|
837
905
|
var params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
838
906
|
// 翻页暂时先清空选择
|
839
|
-
(_actionRef$
|
907
|
+
(_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);
|
840
908
|
setCurrentPage(currentPage);
|
841
909
|
|
842
910
|
_request(_objectSpread(_defineProperty({}, targetPageKey, currentPage), params));
|
843
911
|
}
|
844
912
|
|
845
913
|
function onChangePaginationSize(currentPageSize) {
|
846
|
-
var _actionRef$
|
914
|
+
var _actionRef$current8, _actionRef$current8$c, _request5;
|
847
915
|
|
848
916
|
// 翻页暂时先清空选择
|
849
|
-
(_actionRef$
|
917
|
+
(_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);
|
850
918
|
setPageSize(currentPageSize);
|
851
919
|
setCurrentPage(1);
|
852
920
|
|
package/lib/table/typing.d.ts
CHANGED
@@ -192,6 +192,7 @@ export declare type ProTableActionType = {
|
|
192
192
|
dataFilterForm?: FormType;
|
193
193
|
normalDataFilterForm?: FormType;
|
194
194
|
fullscreenDataFilterForm?: FormType;
|
195
|
+
filterEnableRef?: any;
|
195
196
|
/** 表格当前的数据 */
|
196
197
|
data?: any[];
|
197
198
|
} & ProTableActionTypeMutations;
|
@@ -201,8 +202,6 @@ export declare type ProTableActionTypeMutations = {
|
|
201
202
|
getState?: () => ProTableActionTypeState;
|
202
203
|
/** 设置state 状态 */
|
203
204
|
setState?: (key: string, value: any) => void;
|
204
|
-
/** 初始化 state 状态 */
|
205
|
-
initState?: () => void;
|
206
205
|
/** 设置全屏状态 */
|
207
206
|
setFullScreenState?: (state: boolean) => void;
|
208
207
|
/** 绑定state监听事件 */
|
@@ -217,6 +216,8 @@ export declare type ProTableActionTypeMutations = {
|
|
217
216
|
resetTableMaxBodyHeight?: () => void;
|
218
217
|
/** 列筛选规则 */
|
219
218
|
filterColumns?: any[];
|
219
|
+
/** 获取所有 on 监听事件 */
|
220
|
+
getCallback?: () => any;
|
220
221
|
};
|
221
222
|
/** action Mutations 定义 */
|
222
223
|
export declare type ProTableActionTypeState = {
|
@@ -157,7 +157,7 @@ var renderCell = function renderCell(value, item, index, record, actionRef) {
|
|
157
157
|
|
158
158
|
if (valueType === 'selectGroup') {
|
159
159
|
newRender = _objectSpread(_objectSpread({
|
160
|
-
maxShowNumber:
|
160
|
+
maxShowNumber: 'auto',
|
161
161
|
foldText: 'more',
|
162
162
|
editOnClick: function editOnClick() {},
|
163
163
|
edit: true
|
@@ -239,7 +239,7 @@ var processRenderFunction = function processRenderFunction() {
|
|
239
239
|
var index = arguments.length > 2 ? arguments[2] : undefined;
|
240
240
|
var record = arguments.length > 3 ? arguments[3] : undefined;
|
241
241
|
// 当 ProField render 类型为 function 时。需要表格预先处理以塞入 record
|
242
|
-
var external = ['linkOnClick', 'link', 'value', 'renderEdit', 'descriptionRenderEdit', 'editPopConfirmProps', 'descriptionEditPopConfirmProps', 'editOnClick', 'descriptionEditOnClick'];
|
242
|
+
var external = ['linkOnClick', 'link', 'value', 'renderEdit', 'descriptionRenderEdit', 'editPopConfirmProps', 'descriptionEditPopConfirmProps', 'editOnClick', 'descriptionEditOnClick', 'extra', 'prefixExtra'];
|
243
243
|
return Object.fromEntries(Object.entries(render).map(function (_ref3) {
|
244
244
|
var _ref4 = _slicedToArray(_ref3, 2),
|
245
245
|
k = _ref4[0],
|
@@ -1,13 +1,14 @@
|
|
1
1
|
/// <reference types="react" />
|
2
2
|
import { ProTableActionType } from '../typing';
|
3
3
|
import { ProTableProps, ProTableColumnProps } from '..';
|
4
|
-
export declare function
|
4
|
+
export declare function actionRefUseStateOn(callback: any, state: string, ...args: any): void;
|
5
5
|
/** table 组件内监听 不对外暴露 */
|
6
6
|
export declare function on(fun: any, key: string): void;
|
7
7
|
/** table 组件内销毁监听 不对外暴露 */
|
8
8
|
export declare function off(key: string): void;
|
9
9
|
/** table 组件内触发事件 不对外暴露 */
|
10
10
|
export declare function emit(key: string, ...args: any): void;
|
11
|
+
export declare function initActionRef(ref: React.MutableRefObject<ProTableActionType | undefined>, action: ProTableActionType): void;
|
11
12
|
export declare function useActionType<T>(ref: React.MutableRefObject<ProTableActionType | undefined>, action: ProTableActionType): void;
|
12
13
|
export declare function cloneDeep<T>(obj: T): T;
|
13
14
|
/**
|