@teamix/pro 1.2.14 → 1.2.18
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 +538 -260
- package/dist/pro.min.css +1 -1
- package/dist/pro.min.js +1 -1
- package/es/actions/dialog.js +3 -1
- package/es/actions/index.d.ts +2 -0
- package/es/actions/index.js +28 -14
- package/es/card/index.d.ts +4 -1
- package/es/card/index.js +8 -2
- package/es/card/index.scss +4 -0
- package/es/form/Components/LightFilter/index.js +1 -2
- package/es/form/Filter/index.js +2 -2
- package/es/form/Filter/index2.js +124 -128
- package/es/form/Filter/index2.scss +1 -1
- package/es/form/ProForm/index.js +1 -0
- package/es/form/ProForm/useFieldRequest.js +1 -8
- package/es/form/SchemaForm/index.js +4 -2
- package/es/form/SchemaForm/reactions.js +2 -6
- package/es/form/typing.d.ts +6 -0
- package/es/index.d.ts +1 -1
- package/es/index.js +1 -1
- package/es/nocode/configurators/ProTable.js +1 -0
- package/es/page-header/index.js +2 -11
- package/es/table/components/Filter/index.js +42 -16
- package/es/table/components/ToolBar/FilterColumnIcon.js +52 -17
- package/es/table/components/ToolBar/index.scss +1 -0
- package/es/table/index.js +29 -2
- package/es/table/typing.d.ts +9 -2
- package/es/table/utils/columnRender.js +27 -6
- package/es/table/utils/index.js +7 -1
- package/es/utils/message.d.ts +1 -1
- package/es/utils/message.js +7 -7
- package/lib/actions/dialog.js +3 -1
- package/lib/actions/index.d.ts +2 -0
- package/lib/actions/index.js +28 -14
- package/lib/card/index.d.ts +4 -1
- package/lib/card/index.js +9 -2
- package/lib/card/index.scss +4 -0
- package/lib/form/Components/LightFilter/index.js +1 -2
- package/lib/form/Filter/index.js +2 -2
- package/lib/form/Filter/index2.js +124 -128
- package/lib/form/Filter/index2.scss +1 -1
- package/lib/form/ProForm/index.js +1 -0
- package/lib/form/ProForm/useFieldRequest.js +1 -9
- package/lib/form/SchemaForm/index.js +4 -2
- package/lib/form/SchemaForm/reactions.js +1 -5
- package/lib/form/typing.d.ts +6 -0
- package/lib/index.d.ts +1 -1
- package/lib/index.js +1 -1
- package/lib/nocode/configurators/ProTable.js +1 -0
- package/lib/page-header/index.js +3 -12
- package/lib/table/components/Filter/index.js +42 -16
- package/lib/table/components/ToolBar/FilterColumnIcon.js +52 -17
- package/lib/table/components/ToolBar/index.scss +1 -0
- package/lib/table/index.js +29 -2
- package/lib/table/typing.d.ts +9 -2
- package/lib/table/utils/columnRender.js +27 -6
- package/lib/table/utils/index.js +7 -1
- package/lib/utils/message.d.ts +1 -1
- package/lib/utils/message.js +7 -7
- package/package.json +1 -1
package/lib/form/typing.d.ts
CHANGED
@@ -65,6 +65,12 @@ export interface ProFormProps extends IFormLayoutProps {
|
|
65
65
|
onSubmitFailed?: (feedbacks: IFormFeedback[]) => void;
|
66
66
|
}
|
67
67
|
export interface QueryFilterProps extends ProFormProps {
|
68
|
+
/**
|
69
|
+
* @deprecated triggerType已弃用
|
70
|
+
*/
|
71
|
+
triggerType?: 'keydown' | 'change' | 'submit';
|
72
|
+
mode?: 'inline' | 'panel';
|
73
|
+
expand?: boolean;
|
68
74
|
addonBefore?: ReactNode;
|
69
75
|
addonAfter?: ReactNode;
|
70
76
|
onFilter?: (values: any) => void;
|
package/lib/index.d.ts
CHANGED
@@ -21,5 +21,5 @@ export * from './page-container';
|
|
21
21
|
export * from './page-header';
|
22
22
|
export * from './skeleton';
|
23
23
|
export * from './table';
|
24
|
-
declare const version = "1.2.
|
24
|
+
declare const version = "1.2.17";
|
25
25
|
export { version, ProAction, ProCard, ProField, ProForm, ProInfo, ProPageContainer, ProPageHeader, ProSkeleton, ProTable, hooks, nocode, templates, utils, };
|
package/lib/index.js
CHANGED
@@ -253,5 +253,5 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
|
|
253
253
|
_icon.default.setConfig(_utils.default.getTeamixIconConfig());
|
254
254
|
|
255
255
|
// export * from './sidebar';
|
256
|
-
var version = '1.2.
|
256
|
+
var version = '1.2.17';
|
257
257
|
exports.version = version;
|
package/lib/page-header/index.js
CHANGED
@@ -82,21 +82,12 @@ var renderActionGroup = function renderActionGroup(group, defaultProps) {
|
|
82
82
|
return group;
|
83
83
|
};
|
84
84
|
|
85
|
-
var isPresetColor = function isPresetColor(color) {
|
86
|
-
if (!color) {
|
87
|
-
return false;
|
88
|
-
}
|
89
|
-
|
90
|
-
var PRESET_COLOR_REG = /blue|green|orange|red|yellow/;
|
91
|
-
return PRESET_COLOR_REG.test(color);
|
92
|
-
};
|
93
|
-
|
94
85
|
var getColorAndStyle = function getColorAndStyle(color, backgroundColor, backgroundType) {
|
95
86
|
var _classnames;
|
96
87
|
|
97
|
-
var isColorPresetColor = isPresetColor(color);
|
98
|
-
var isBgColorPresetColor = isPresetColor(backgroundColor);
|
99
|
-
var className = (0, _classnames2.default)((_classnames = {}, _defineProperty(_classnames, "".concat(
|
88
|
+
var isColorPresetColor = (0, _utils.isPresetColor)(color);
|
89
|
+
var isBgColorPresetColor = (0, _utils.isPresetColor)(backgroundColor);
|
90
|
+
var className = (0, _classnames2.default)((_classnames = {}, _defineProperty(_classnames, "".concat((0, _utils.getColorClassName)(color)), isColorPresetColor), _defineProperty(_classnames, "".concat((0, _utils.getBackgroundColorClassName)(backgroundColor)), isBgColorPresetColor), _defineProperty(_classnames, "".concat(cls("bg-type-".concat(backgroundType))), !!backgroundType), _classnames));
|
100
91
|
var styleColor = isColorPresetColor ? undefined : color;
|
101
92
|
var styleBgColor = isBgColorPresetColor ? undefined : backgroundColor;
|
102
93
|
var style = {
|
@@ -160,7 +160,7 @@ var Filter = function Filter(props) {
|
|
160
160
|
return /*#__PURE__*/_react.default.createElement(_components.Dropdown, {
|
161
161
|
trigger: /*#__PURE__*/_react.default.createElement(_icon.default, {
|
162
162
|
size: "small",
|
163
|
-
type:
|
163
|
+
type: selected.length > 0 && visible === false ? 'filter-fill' : 'filter-line',
|
164
164
|
className: cls({
|
165
165
|
icon: true,
|
166
166
|
'icon-selected': selected.length > 0
|
@@ -169,6 +169,8 @@ var Filter = function Filter(props) {
|
|
169
169
|
setVisible(!visible);
|
170
170
|
}
|
171
171
|
}),
|
172
|
+
//@ts-ignore
|
173
|
+
v2: true,
|
172
174
|
triggerType: ['click'],
|
173
175
|
align: "tl bl",
|
174
176
|
visible: visible,
|
@@ -191,7 +193,7 @@ var Filter = function Filter(props) {
|
|
191
193
|
btn: true
|
192
194
|
}),
|
193
195
|
onClick: function onClick() {
|
194
|
-
var _actionRef$current2, _actionRef$current2$f, _actionRef$current$ge5, _actionRef$current3, _actionRef$current3$g, _actionRef$current3$g2, _actionRef$current4, _actionRef$
|
196
|
+
var _actionRef$current2, _actionRef$current2$f, _actionRef$current$ge5, _actionRef$current3, _actionRef$current3$g, _actionRef$current3$g2, _actionRef$current4, _actionRef$current4$s;
|
195
197
|
|
196
198
|
(_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
199
|
|
@@ -219,24 +221,30 @@ var Filter = function Filter(props) {
|
|
219
221
|
return null;
|
220
222
|
})), [[column.dataIndex, param]]).filter(function (item) {
|
221
223
|
return item && (item === null || item === void 0 ? void 0 : item[1]);
|
222
|
-
}));
|
223
|
-
var targetPageKey = 'currentPage';
|
224
|
-
var pageInfo = (_actionRef$current4 = actionRef.current) === null || _actionRef$current4 === void 0 ? void 0 : _actionRef$current4.pageInfo;
|
224
|
+
})); // 再设置所有的列筛选状态
|
225
225
|
|
226
|
-
|
227
|
-
targetPageKey = pageInfo === null || pageInfo === void 0 ? void 0 : pageInfo.targetPageKey;
|
228
|
-
} // 再设置所有的列筛选状态
|
229
|
-
|
230
|
-
|
231
|
-
(_actionRef$current5 = actionRef.current) === null || _actionRef$current5 === void 0 ? void 0 : (_actionRef$current5$s = _actionRef$current5.setFilterRules) === null || _actionRef$current5$s === void 0 ? void 0 : _actionRef$current5$s.call(_actionRef$current5, _objectSpread(_objectSpread({}, rules), {}, _defineProperty({}, column.dataIndex, {
|
226
|
+
(_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, {
|
232
227
|
rules: selected,
|
233
228
|
params: param
|
234
|
-
})));
|
229
|
+
})));
|
230
|
+
|
231
|
+
if (selected.length > 0) {
|
232
|
+
var _actionRef$current5, _actionRef$current6, _actionRef$current6$r, _actionRef$current7, _actionRef$current7$r, _actionRef$current8, _actionRef$current8$c;
|
233
|
+
|
234
|
+
var targetPageKey = 'currentPage';
|
235
|
+
var pageInfo = (_actionRef$current5 = actionRef.current) === null || _actionRef$current5 === void 0 ? void 0 : _actionRef$current5.pageInfo;
|
236
|
+
|
237
|
+
if (pageInfo && (pageInfo === null || pageInfo === void 0 ? void 0 : pageInfo.targetPageKey)) {
|
238
|
+
targetPageKey = pageInfo === null || pageInfo === void 0 ? void 0 : pageInfo.targetPageKey;
|
239
|
+
} // 发送请求
|
240
|
+
|
241
|
+
|
242
|
+
(_actionRef$current6 = actionRef.current) === null || _actionRef$current6 === void 0 ? void 0 : (_actionRef$current6$r = _actionRef$current6.request) === null || _actionRef$current6$r === void 0 ? void 0 : _actionRef$current6$r.call(_actionRef$current6, _objectSpread(_objectSpread({}, params), {}, _defineProperty({}, targetPageKey, 1)));
|
243
|
+
(_actionRef$current7 = actionRef.current) === null || _actionRef$current7 === void 0 ? void 0 : (_actionRef$current7$r = _actionRef$current7.resetPage) === null || _actionRef$current7$r === void 0 ? void 0 : _actionRef$current7$r.call(_actionRef$current7); // 清空表格选择
|
235
244
|
|
236
|
-
|
237
|
-
|
245
|
+
(_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);
|
246
|
+
}
|
238
247
|
|
239
|
-
(_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);
|
240
248
|
setVisible(false);
|
241
249
|
}
|
242
250
|
}, (0, _utils.getMessage)('ok')), /*#__PURE__*/_react.default.createElement(_components.Button, {
|
@@ -254,7 +262,25 @@ var Filter = function Filter(props) {
|
|
254
262
|
rules: [],
|
255
263
|
params: ''
|
256
264
|
})));
|
257
|
-
(_actionRef$current11 = actionRef.current) === null || _actionRef$current11 === void 0 ? void 0 : (_actionRef$current11$ = _actionRef$current11.filterDataSource) === null || _actionRef$current11$ === void 0 ? void 0 : _actionRef$current11$.call(_actionRef$current11, column.dataIndex);
|
265
|
+
(_actionRef$current11 = actionRef.current) === null || _actionRef$current11 === void 0 ? void 0 : (_actionRef$current11$ = _actionRef$current11.filterDataSource) === null || _actionRef$current11$ === void 0 ? void 0 : _actionRef$current11$.call(_actionRef$current11, column.dataIndex);
|
266
|
+
|
267
|
+
if (selected.length > 0) {
|
268
|
+
var _actionRef$current12, _actionRef$current13, _actionRef$current13$, _actionRef$current14, _actionRef$current14$, _actionRef$current15, _actionRef$current15$;
|
269
|
+
|
270
|
+
var targetPageKey = 'currentPage';
|
271
|
+
var pageInfo = (_actionRef$current12 = actionRef.current) === null || _actionRef$current12 === void 0 ? void 0 : _actionRef$current12.pageInfo;
|
272
|
+
|
273
|
+
if (pageInfo && (pageInfo === null || pageInfo === void 0 ? void 0 : pageInfo.targetPageKey)) {
|
274
|
+
targetPageKey = pageInfo === null || pageInfo === void 0 ? void 0 : pageInfo.targetPageKey;
|
275
|
+
} // 发送请求
|
276
|
+
|
277
|
+
|
278
|
+
(_actionRef$current13 = actionRef.current) === null || _actionRef$current13 === void 0 ? void 0 : (_actionRef$current13$ = _actionRef$current13.request) === null || _actionRef$current13$ === void 0 ? void 0 : _actionRef$current13$.call(_actionRef$current13, _defineProperty({}, targetPageKey, 1));
|
279
|
+
(_actionRef$current14 = actionRef.current) === null || _actionRef$current14 === void 0 ? void 0 : (_actionRef$current14$ = _actionRef$current14.resetPage) === null || _actionRef$current14$ === void 0 ? void 0 : _actionRef$current14$.call(_actionRef$current14); // 清空表格选择
|
280
|
+
|
281
|
+
(_actionRef$current15 = actionRef.current) === null || _actionRef$current15 === void 0 ? void 0 : (_actionRef$current15$ = _actionRef$current15.clearRowSelection) === null || _actionRef$current15$ === void 0 ? void 0 : _actionRef$current15$.call(_actionRef$current15);
|
282
|
+
} // setVisible(!visible);
|
283
|
+
|
258
284
|
}
|
259
285
|
}, (0, _utils.getMessage)('reset'))))));
|
260
286
|
};
|
@@ -25,6 +25,14 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
|
|
25
25
|
|
26
26
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
27
27
|
|
28
|
+
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
29
|
+
|
30
|
+
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
31
|
+
|
32
|
+
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
33
|
+
|
34
|
+
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
35
|
+
|
28
36
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
29
37
|
|
30
38
|
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
@@ -138,10 +146,23 @@ var FilterColumnIcon = function FilterColumnIcon(props) {
|
|
138
146
|
|
139
147
|
|
140
148
|
var moveUp = function moveUp(e, dataIndex) {
|
149
|
+
var _newColumns$filter, _newColumns$filter2;
|
150
|
+
|
141
151
|
e.stopPropagation();
|
142
|
-
var keyNewColumns = (0, _utils2.cloneDeep)(newColumns)
|
143
|
-
|
144
|
-
|
152
|
+
var keyNewColumns = (0, _utils2.cloneDeep)(newColumns).filter(function (_ref) {
|
153
|
+
var lock = _ref.lock;
|
154
|
+
return !lock;
|
155
|
+
});
|
156
|
+
var headLock = (0, _utils2.cloneDeep)((_newColumns$filter = newColumns.filter(function (_ref2) {
|
157
|
+
var lock = _ref2.lock;
|
158
|
+
return lock === true || lock === 'left';
|
159
|
+
})) !== null && _newColumns$filter !== void 0 ? _newColumns$filter : []);
|
160
|
+
var tailLock = (0, _utils2.cloneDeep)((_newColumns$filter2 = newColumns.filter(function (_ref3) {
|
161
|
+
var lock = _ref3.lock;
|
162
|
+
return lock === 'right';
|
163
|
+
})) !== null && _newColumns$filter2 !== void 0 ? _newColumns$filter2 : []);
|
164
|
+
var index = keyNewColumns.findIndex(function (_ref4) {
|
165
|
+
var index = _ref4.dataIndex;
|
145
166
|
return index === dataIndex;
|
146
167
|
});
|
147
168
|
|
@@ -151,15 +172,28 @@ var FilterColumnIcon = function FilterColumnIcon(props) {
|
|
151
172
|
keyNewColumns.push(keyNewColumns.shift());
|
152
173
|
}
|
153
174
|
|
154
|
-
notifyTableRender(keyNewColumns);
|
175
|
+
notifyTableRender([].concat(_toConsumableArray(headLock), _toConsumableArray(keyNewColumns), _toConsumableArray(tailLock)));
|
155
176
|
}; // 向下
|
156
177
|
|
157
178
|
|
158
179
|
var moveDown = function moveDown(e, dataIndex) {
|
180
|
+
var _newColumns$filter3, _newColumns$filter4;
|
181
|
+
|
159
182
|
e.stopPropagation();
|
160
|
-
var keyNewColumns = (0, _utils2.cloneDeep)(newColumns)
|
161
|
-
|
162
|
-
|
183
|
+
var keyNewColumns = (0, _utils2.cloneDeep)(newColumns).filter(function (_ref5) {
|
184
|
+
var lock = _ref5.lock;
|
185
|
+
return !lock;
|
186
|
+
});
|
187
|
+
var headLock = (0, _utils2.cloneDeep)((_newColumns$filter3 = newColumns.filter(function (_ref6) {
|
188
|
+
var lock = _ref6.lock;
|
189
|
+
return lock === true || lock === 'left';
|
190
|
+
})) !== null && _newColumns$filter3 !== void 0 ? _newColumns$filter3 : []);
|
191
|
+
var tailLock = (0, _utils2.cloneDeep)((_newColumns$filter4 = newColumns.filter(function (_ref7) {
|
192
|
+
var lock = _ref7.lock;
|
193
|
+
return lock === 'right';
|
194
|
+
})) !== null && _newColumns$filter4 !== void 0 ? _newColumns$filter4 : []);
|
195
|
+
var index = keyNewColumns.findIndex(function (_ref8) {
|
196
|
+
var index = _ref8.dataIndex;
|
163
197
|
return index === dataIndex;
|
164
198
|
});
|
165
199
|
|
@@ -169,7 +203,7 @@ var FilterColumnIcon = function FilterColumnIcon(props) {
|
|
169
203
|
keyNewColumns.unshift(keyNewColumns.splice(index, 1)[0]);
|
170
204
|
}
|
171
205
|
|
172
|
-
notifyTableRender(keyNewColumns);
|
206
|
+
notifyTableRender([].concat(_toConsumableArray(headLock), _toConsumableArray(keyNewColumns), _toConsumableArray(tailLock)));
|
173
207
|
}; // 通知表格渲染
|
174
208
|
|
175
209
|
|
@@ -237,23 +271,24 @@ var FilterColumnIcon = function FilterColumnIcon(props) {
|
|
237
271
|
type: "primary"
|
238
272
|
}, (0, _utils.getMessage)('reset'))), /*#__PURE__*/_react.default.createElement(_components.Menu.Divider, {
|
239
273
|
key: "divider"
|
240
|
-
}), newColumns.map(function (
|
274
|
+
}), newColumns.map(function (_ref9, index) {
|
241
275
|
var _newColumns$find;
|
242
276
|
|
243
|
-
var dataIndex =
|
244
|
-
title =
|
245
|
-
columnFiltersDisabled =
|
277
|
+
var dataIndex = _ref9.dataIndex,
|
278
|
+
title = _ref9.title,
|
279
|
+
columnFiltersDisabled = _ref9.columnFiltersDisabled,
|
280
|
+
lock = _ref9.lock;
|
246
281
|
return /*#__PURE__*/_react.default.createElement(CheckboxItem, {
|
247
282
|
key: index,
|
248
|
-
checked: (_newColumns$find = newColumns.find(function (
|
249
|
-
var key =
|
283
|
+
checked: (_newColumns$find = newColumns.find(function (_ref10) {
|
284
|
+
var key = _ref10.dataIndex;
|
250
285
|
return key === dataIndex;
|
251
286
|
})) === null || _newColumns$find === void 0 ? void 0 : _newColumns$find.columnFilters,
|
252
287
|
onChange: function onChange(check) {
|
253
288
|
return onChangeColumns(check, dataIndex);
|
254
289
|
},
|
255
290
|
disabled: columnFiltersDisabled
|
256
|
-
}, title, /*#__PURE__*/_react.default.createElement("div", {
|
291
|
+
}, title, !lock && /*#__PURE__*/_react.default.createElement("div", {
|
257
292
|
className: cls({
|
258
293
|
sort: true
|
259
294
|
})
|
@@ -310,8 +345,8 @@ var FilterColumnIcon = function FilterColumnIcon(props) {
|
|
310
345
|
key: index,
|
311
346
|
className: cls('col')
|
312
347
|
}, /*#__PURE__*/_react.default.createElement(_components.Checkbox, {
|
313
|
-
checked: (_newColumns$find2 = newColumns.find(function (
|
314
|
-
var key =
|
348
|
+
checked: (_newColumns$find2 = newColumns.find(function (_ref11) {
|
349
|
+
var key = _ref11.dataIndex;
|
315
350
|
return key === dataIndex;
|
316
351
|
})) === null || _newColumns$find2 === void 0 ? void 0 : _newColumns$find2.columnFilters,
|
317
352
|
onChange: function onChange(check) {
|
package/lib/table/index.js
CHANGED
@@ -425,6 +425,15 @@ var ProTable = function ProTable(props) {
|
|
425
425
|
},
|
426
426
|
request: function request(params) {
|
427
427
|
if (dataFilterForm.validate()) {
|
428
|
+
// 如果请求中还有翻页相关信息,需要自动设置到指定页
|
429
|
+
if (params === null || params === void 0 ? void 0 : params[targetPageKey]) {
|
430
|
+
setCurrentPage(params[targetPageKey]);
|
431
|
+
}
|
432
|
+
|
433
|
+
if (params === null || params === void 0 ? void 0 : params[targetPageSizeKey]) {
|
434
|
+
setPageSize(params[targetPageSizeKey]);
|
435
|
+
}
|
436
|
+
|
428
437
|
_request(params);
|
429
438
|
}
|
430
439
|
},
|
@@ -442,6 +451,7 @@ var ProTable = function ProTable(props) {
|
|
442
451
|
resetPage: function resetPage() {
|
443
452
|
setCurrentPage(1);
|
444
453
|
},
|
454
|
+
rowSelection: rowSelection,
|
445
455
|
clearRowSelection: function clearRowSelection() {
|
446
456
|
rowSelectionHook.setSelectedRowKeys([]);
|
447
457
|
rowSelectionHook.setSelectedRecords([]);
|
@@ -454,6 +464,7 @@ var ProTable = function ProTable(props) {
|
|
454
464
|
targetPageSizeKey: targetPageSizeKey,
|
455
465
|
pageSize: pageSize
|
456
466
|
},
|
467
|
+
data: data,
|
457
468
|
dataFilterForm: dataFilterForm,
|
458
469
|
resetTableMaxBodyHeight: function resetTableMaxBodyHeight() {
|
459
470
|
getHeaderHeight().then(function (height) {
|
@@ -608,7 +619,11 @@ var ProTable = function ProTable(props) {
|
|
608
619
|
}
|
609
620
|
|
610
621
|
(0, _react.useEffect)(function () {
|
611
|
-
|
622
|
+
var _actionRef$current5, _actionRef$current5$i;
|
623
|
+
|
624
|
+
// 初始化 state 状态
|
625
|
+
actionRef === null || actionRef === void 0 ? void 0 : (_actionRef$current5 = actionRef.current) === null || _actionRef$current5 === void 0 ? void 0 : (_actionRef$current5$i = _actionRef$current5.initState) === null || _actionRef$current5$i === void 0 ? void 0 : _actionRef$current5$i.call(_actionRef$current5); // 监听 浏览器变化 更吸底状态
|
626
|
+
|
612
627
|
if (footerSuction) {
|
613
628
|
getFooterSuctionState();
|
614
629
|
|
@@ -629,6 +644,8 @@ var ProTable = function ProTable(props) {
|
|
629
644
|
if (window.onresize) {
|
630
645
|
window.onresize = null;
|
631
646
|
}
|
647
|
+
|
648
|
+
actionRef.current = undefined;
|
632
649
|
};
|
633
650
|
}, []);
|
634
651
|
|
@@ -646,6 +663,10 @@ var ProTable = function ProTable(props) {
|
|
646
663
|
(propsDataFilter === null || propsDataFilter === void 0 ? void 0 : propsDataFilter.onFilter) && (propsDataFilter === null || propsDataFilter === void 0 ? void 0 : propsDataFilter.onFilter(_objectSpread({}, toJS(dataFilterForm.values))));
|
647
664
|
|
648
665
|
if (dataFilterForm.validate()) {
|
666
|
+
var _actionRef$current6, _actionRef$current6$c;
|
667
|
+
|
668
|
+
// 搜索变化时,暂时先清空选择
|
669
|
+
(_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);
|
649
670
|
setCurrentPage(1); // const { mode, schema } = propsDataFilter as ProTableDataFilterProps;
|
650
671
|
// TODO: 针对 inline 模式下的 search 组件做一下处理,如果空值切换下拉的时候不触发请求
|
651
672
|
// if (mode === 'inline') {
|
@@ -742,15 +763,21 @@ var ProTable = function ProTable(props) {
|
|
742
763
|
|
743
764
|
var renderFooter = function renderFooter() {
|
744
765
|
function onChangePagination(currentPage) {
|
766
|
+
var _actionRef$current7, _actionRef$current7$c;
|
767
|
+
|
745
768
|
var params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
769
|
+
// 翻页暂时先清空选择
|
770
|
+
(_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);
|
746
771
|
setCurrentPage(currentPage);
|
747
772
|
|
748
773
|
_request(_objectSpread(_defineProperty({}, targetPageKey, currentPage), params));
|
749
774
|
}
|
750
775
|
|
751
776
|
function onChangePaginationSize(currentPageSize) {
|
752
|
-
var _request5;
|
777
|
+
var _actionRef$current8, _actionRef$current8$c, _request5;
|
753
778
|
|
779
|
+
// 翻页暂时先清空选择
|
780
|
+
(_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);
|
754
781
|
setPageSize(currentPageSize);
|
755
782
|
setCurrentPage(1);
|
756
783
|
|
package/lib/table/typing.d.ts
CHANGED
@@ -129,6 +129,7 @@ export declare type rowSelectionType = {
|
|
129
129
|
onSelect?: (selected: boolean, record: any, records: Array<any>) => void;
|
130
130
|
onSelectAll?: (selected: boolean, records: Array<any>) => void;
|
131
131
|
selectedRowKeys?: Array<any>;
|
132
|
+
selectedRecords?: any[];
|
132
133
|
mode?: 'single' | 'multiple';
|
133
134
|
titleProps?: () => any;
|
134
135
|
columnProps?: () => any;
|
@@ -154,6 +155,8 @@ export declare type ProTableActionType = {
|
|
154
155
|
request?: (params?: any) => void;
|
155
156
|
/** 重置表格 */
|
156
157
|
reset?: () => void;
|
158
|
+
/** 表格选择相关属性 */
|
159
|
+
rowSelection?: innerRowSelectionType | rowSelectionType;
|
157
160
|
/** 清空表格选择 */
|
158
161
|
clearRowSelection?: () => void;
|
159
162
|
/** 过滤 DataSource */
|
@@ -175,13 +178,17 @@ export declare type ProTableActionType = {
|
|
175
178
|
resetPage?: () => void;
|
176
179
|
/** 获取数据过滤区表单实例 */
|
177
180
|
dataFilterForm?: FormType;
|
181
|
+
/** 表格当前的数据 */
|
182
|
+
data?: any[];
|
178
183
|
} & ProTableActionTypeMutations;
|
179
184
|
/** action State 定义 */
|
180
185
|
export declare type ProTableActionTypeMutations = {
|
181
|
-
/** 获取state状态 */
|
186
|
+
/** 获取state 状态 */
|
182
187
|
getState?: () => ProTableActionTypeState;
|
183
|
-
/** 设置state状态 */
|
188
|
+
/** 设置state 状态 */
|
184
189
|
setState?: (key: string, value: any) => void;
|
190
|
+
/** 初始化 state 状态 */
|
191
|
+
initState?: () => void;
|
185
192
|
/** 设置全屏状态 */
|
186
193
|
setFullScreenState?: (state: boolean) => void;
|
187
194
|
/** 绑定state监听事件 */
|
@@ -50,10 +50,10 @@ var renderColumnsTitle = function renderColumnsTitle(item, actionRef) {
|
|
50
50
|
var filterMode = item.filterMode,
|
51
51
|
filters = item.filters,
|
52
52
|
dataIndex = item.dataIndex,
|
53
|
-
dataSource = item.dataSource;
|
53
|
+
dataSource = item.dataSource; // 为列过滤添加状态标题
|
54
54
|
|
55
|
-
var
|
56
|
-
if (filterMode !== 'multiple') {
|
55
|
+
var getItemLabel = function getItemLabel() {
|
56
|
+
if (filters && filterMode !== 'multiple') {
|
57
57
|
var _actionRef$current$ge, _actionRef$current, _actionRef$current$ge2;
|
58
58
|
|
59
59
|
var selectedItem = (_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$ge2.call(_actionRef$current).filterRules) !== null && _actionRef$current$ge !== void 0 ? _actionRef$current$ge : {};
|
@@ -76,16 +76,37 @@ var renderColumnsTitle = function renderColumnsTitle(item, actionRef) {
|
|
76
76
|
|
77
77
|
return item.value === ((_selectedItem$dataInd2 = selectedItem[dataIndex]) === null || _selectedItem$dataInd2 === void 0 ? void 0 : _selectedItem$dataInd2.params);
|
78
78
|
})) === null || _targetFilters$find === void 0 ? void 0 : _targetFilters$find.label;
|
79
|
-
|
79
|
+
var value = "".concat(item.title, " (").concat(label, ")");
|
80
|
+
return /*#__PURE__*/_react.default.createElement(_field.default, {
|
81
|
+
style: {
|
82
|
+
display: 'inline-flex'
|
83
|
+
},
|
84
|
+
value: value,
|
85
|
+
type: "text",
|
86
|
+
render: {
|
87
|
+
ellipsis: true,
|
88
|
+
color: 'var(--table-th-color,#848484)'
|
89
|
+
}
|
90
|
+
});
|
80
91
|
}
|
81
92
|
}
|
82
93
|
}
|
83
94
|
|
84
|
-
return
|
95
|
+
return /*#__PURE__*/_react.default.createElement(_field.default, {
|
96
|
+
style: {
|
97
|
+
display: 'inline-flex'
|
98
|
+
},
|
99
|
+
value: item.title,
|
100
|
+
type: "text",
|
101
|
+
render: {
|
102
|
+
ellipsis: true,
|
103
|
+
color: 'var(--table-th-color,#848484)'
|
104
|
+
}
|
105
|
+
});
|
85
106
|
};
|
86
107
|
|
87
108
|
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_utils.LabelIconTip, {
|
88
|
-
label:
|
109
|
+
label: item.title,
|
89
110
|
tooltip: item.tooltip,
|
90
111
|
icon: item.tooltipIcon
|
91
112
|
}), item.filters && /*#__PURE__*/_react.default.createElement(_Filter.default, {
|
package/lib/table/utils/index.js
CHANGED
@@ -33,7 +33,10 @@ var state = {
|
|
33
33
|
fullScreenState: false,
|
34
34
|
filterRules: {},
|
35
35
|
filterColumns: []
|
36
|
-
};
|
36
|
+
};
|
37
|
+
|
38
|
+
var _initState = (0, _lodash.default)(state); // 组件内全局监听事件
|
39
|
+
|
37
40
|
|
38
41
|
var callback = {
|
39
42
|
fullScreenState: {}
|
@@ -51,6 +54,9 @@ var mutations = {
|
|
51
54
|
mutations[key] = value;
|
52
55
|
}
|
53
56
|
},
|
57
|
+
initState: function initState() {
|
58
|
+
state = (0, _lodash.default)(_initState);
|
59
|
+
},
|
54
60
|
filterColumns: state.filterColumns,
|
55
61
|
setFullScreenState: function setFullScreenState(fullScreenState) {
|
56
62
|
state.fullScreenState = fullScreenState;
|
package/lib/utils/message.d.ts
CHANGED
@@ -1,3 +1,3 @@
|
|
1
1
|
import { MessageProps } from '@alicloudfe/components/types/message';
|
2
2
|
export declare type ProMessageProps = MessageProps | string;
|
3
|
-
export declare const renderProMessage: (message
|
3
|
+
export declare const renderProMessage: (message?: ProMessageProps | undefined, defaultProps?: MessageProps | undefined) => JSX.Element | null;
|
package/lib/utils/message.js
CHANGED
@@ -17,16 +17,16 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
|
|
17
17
|
|
18
18
|
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
19
19
|
|
20
|
-
var renderProMessage = function renderProMessage(message) {
|
20
|
+
var renderProMessage = function renderProMessage(message, defaultProps) {
|
21
|
+
if (!message) {
|
22
|
+
return null;
|
23
|
+
}
|
24
|
+
|
21
25
|
if (typeof message === 'string') {
|
22
|
-
return /*#__PURE__*/_react.default.createElement(_components.Message, {
|
23
|
-
type: "notice"
|
24
|
-
}, message);
|
26
|
+
return /*#__PURE__*/_react.default.createElement(_components.Message, _objectSpread({}, defaultProps), message);
|
25
27
|
}
|
26
28
|
|
27
|
-
return /*#__PURE__*/_react.default.createElement(_components.Message, _objectSpread({
|
28
|
-
type: "notice"
|
29
|
-
}, message));
|
29
|
+
return /*#__PURE__*/_react.default.createElement(_components.Message, _objectSpread(_objectSpread({}, defaultProps), message));
|
30
30
|
};
|
31
31
|
|
32
32
|
exports.renderProMessage = renderProMessage;
|