@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.
Files changed (61) hide show
  1. package/dist/pro.css +1 -1
  2. package/dist/pro.js +538 -260
  3. package/dist/pro.min.css +1 -1
  4. package/dist/pro.min.js +1 -1
  5. package/es/actions/dialog.js +3 -1
  6. package/es/actions/index.d.ts +2 -0
  7. package/es/actions/index.js +28 -14
  8. package/es/card/index.d.ts +4 -1
  9. package/es/card/index.js +8 -2
  10. package/es/card/index.scss +4 -0
  11. package/es/form/Components/LightFilter/index.js +1 -2
  12. package/es/form/Filter/index.js +2 -2
  13. package/es/form/Filter/index2.js +124 -128
  14. package/es/form/Filter/index2.scss +1 -1
  15. package/es/form/ProForm/index.js +1 -0
  16. package/es/form/ProForm/useFieldRequest.js +1 -8
  17. package/es/form/SchemaForm/index.js +4 -2
  18. package/es/form/SchemaForm/reactions.js +2 -6
  19. package/es/form/typing.d.ts +6 -0
  20. package/es/index.d.ts +1 -1
  21. package/es/index.js +1 -1
  22. package/es/nocode/configurators/ProTable.js +1 -0
  23. package/es/page-header/index.js +2 -11
  24. package/es/table/components/Filter/index.js +42 -16
  25. package/es/table/components/ToolBar/FilterColumnIcon.js +52 -17
  26. package/es/table/components/ToolBar/index.scss +1 -0
  27. package/es/table/index.js +29 -2
  28. package/es/table/typing.d.ts +9 -2
  29. package/es/table/utils/columnRender.js +27 -6
  30. package/es/table/utils/index.js +7 -1
  31. package/es/utils/message.d.ts +1 -1
  32. package/es/utils/message.js +7 -7
  33. package/lib/actions/dialog.js +3 -1
  34. package/lib/actions/index.d.ts +2 -0
  35. package/lib/actions/index.js +28 -14
  36. package/lib/card/index.d.ts +4 -1
  37. package/lib/card/index.js +9 -2
  38. package/lib/card/index.scss +4 -0
  39. package/lib/form/Components/LightFilter/index.js +1 -2
  40. package/lib/form/Filter/index.js +2 -2
  41. package/lib/form/Filter/index2.js +124 -128
  42. package/lib/form/Filter/index2.scss +1 -1
  43. package/lib/form/ProForm/index.js +1 -0
  44. package/lib/form/ProForm/useFieldRequest.js +1 -9
  45. package/lib/form/SchemaForm/index.js +4 -2
  46. package/lib/form/SchemaForm/reactions.js +1 -5
  47. package/lib/form/typing.d.ts +6 -0
  48. package/lib/index.d.ts +1 -1
  49. package/lib/index.js +1 -1
  50. package/lib/nocode/configurators/ProTable.js +1 -0
  51. package/lib/page-header/index.js +3 -12
  52. package/lib/table/components/Filter/index.js +42 -16
  53. package/lib/table/components/ToolBar/FilterColumnIcon.js +52 -17
  54. package/lib/table/components/ToolBar/index.scss +1 -0
  55. package/lib/table/index.js +29 -2
  56. package/lib/table/typing.d.ts +9 -2
  57. package/lib/table/utils/columnRender.js +27 -6
  58. package/lib/table/utils/index.js +7 -1
  59. package/lib/utils/message.d.ts +1 -1
  60. package/lib/utils/message.js +7 -7
  61. package/package.json +1 -1
@@ -223,7 +223,9 @@ export default /*#__PURE__*/memo(function (_ref) {
223
223
  rules: defaultRules,
224
224
  reactions: defaultReactions,
225
225
  dataSource: defaultDataSource,
226
- data: data
226
+ data: data || {
227
+ placeholder: true
228
+ }
227
229
  })); // 递归子组件
228
230
 
229
231
  var recursiveProperties = (children === null || children === void 0 ? void 0 : children.length) ? {
@@ -242,7 +244,7 @@ export default /*#__PURE__*/memo(function (_ref) {
242
244
  type: 'object',
243
245
  properties: formatSchema(schema)
244
246
  };
245
- }, []); // console.log(proFormSchema);
247
+ }, [schema]); // console.log(proFormSchema);
246
248
 
247
249
  return /*#__PURE__*/React.createElement(SchemaField, {
248
250
  schema: proFormSchema,
@@ -4,7 +4,7 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
4
4
 
5
5
  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; }
6
6
 
7
- import { isFn, isPlainObj, doCommonRequest } from '@teamix/utils'; // 配置请求
7
+ import { isFn, isPlainObj, doCommonRequest, getValueByValue } from '@teamix/utils'; // 配置请求
8
8
 
9
9
  var $request = function $request(requestConfig) {
10
10
  return function (field, context) {
@@ -54,11 +54,7 @@ var $dataSource = function $dataSource(services, onComplete, context) {
54
54
  readOnly: true
55
55
  });
56
56
  return services(field, context).then(function (res) {
57
- var _res$map;
58
-
59
- var isValueInDataSource = res === null || res === void 0 ? void 0 : (_res$map = res.map(function (v) {
60
- return v.value;
61
- })) === null || _res$map === void 0 ? void 0 : _res$map.includes(field.value);
57
+ var isValueInDataSource = getValueByValue(res, field.value);
62
58
  var clearValue = isValueInDataSource ? {} : {
63
59
  value: undefined
64
60
  };
@@ -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/es/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.13";
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/es/index.js CHANGED
@@ -27,7 +27,7 @@ export * from './page-header';
27
27
  export * from './skeleton';
28
28
  export * from './table'; // export * from './sidebar';
29
29
 
30
- var version = '1.2.13';
30
+ var version = '1.2.17';
31
31
  export { version, ProAction, ProCard, ProField, ProForm, ProInfo, // ProLayout,
32
32
  ProPageContainer, ProPageHeader, ProSkeleton, ProTable, // ProSidebar,
33
33
  hooks, nocode, templates, utils };
@@ -18,6 +18,7 @@ var initialValues = {
18
18
  },
19
19
  mainAction: {
20
20
  actions: [{
21
+ key: 'action',
21
22
  children: '操作按钮'
22
23
  }]
23
24
  }
@@ -17,7 +17,7 @@ import { useHistory } from 'react-router-dom';
17
17
  import classnames from 'classnames';
18
18
  import TeamixIcon from '@teamix/icon';
19
19
  import { Breadcrumb } from '@alicloudfe/components';
20
- import { baseClass, goToLink, renderTags } from '@teamix/utils';
20
+ import { baseClass, goToLink, renderTags, isPresetColor, getColorClassName, getBackgroundColorClassName } from '@teamix/utils';
21
21
  import { ProActionGroup } from '../actions';
22
22
  import { ProSkeletonRaw } from '../skeleton';
23
23
  import ProInfo from '../info';
@@ -63,21 +63,12 @@ var renderActionGroup = function renderActionGroup(group, defaultProps) {
63
63
  return group;
64
64
  };
65
65
 
66
- var isPresetColor = function isPresetColor(color) {
67
- if (!color) {
68
- return false;
69
- }
70
-
71
- var PRESET_COLOR_REG = /blue|green|orange|red|yellow/;
72
- return PRESET_COLOR_REG.test(color);
73
- };
74
-
75
66
  var getColorAndStyle = function getColorAndStyle(color, backgroundColor, backgroundType) {
76
67
  var _classnames;
77
68
 
78
69
  var isColorPresetColor = isPresetColor(color);
79
70
  var isBgColorPresetColor = isPresetColor(backgroundColor);
80
- var className = classnames((_classnames = {}, _defineProperty(_classnames, "".concat(cls("color-".concat(color))), isColorPresetColor), _defineProperty(_classnames, "".concat(cls("bg-color-".concat(backgroundColor))), isBgColorPresetColor), _defineProperty(_classnames, "".concat(cls("bg-type-".concat(backgroundType))), !!backgroundType), _classnames));
71
+ var className = classnames((_classnames = {}, _defineProperty(_classnames, "".concat(getColorClassName(color)), isColorPresetColor), _defineProperty(_classnames, "".concat(getBackgroundColorClassName(backgroundColor)), isBgColorPresetColor), _defineProperty(_classnames, "".concat(cls("bg-type-".concat(backgroundType))), !!backgroundType), _classnames));
81
72
  var styleColor = isColorPresetColor ? undefined : color;
82
73
  var styleBgColor = isBgColorPresetColor ? undefined : backgroundColor;
83
74
  var style = {
@@ -140,7 +140,7 @@ var Filter = function Filter(props) {
140
140
  return /*#__PURE__*/React.createElement(Dropdown, {
141
141
  trigger: /*#__PURE__*/React.createElement(TeamixIcon, {
142
142
  size: "small",
143
- type: "filter-line",
143
+ type: selected.length > 0 && visible === false ? 'filter-fill' : 'filter-line',
144
144
  className: cls({
145
145
  icon: true,
146
146
  'icon-selected': selected.length > 0
@@ -149,6 +149,8 @@ var Filter = function Filter(props) {
149
149
  setVisible(!visible);
150
150
  }
151
151
  }),
152
+ //@ts-ignore
153
+ v2: true,
152
154
  triggerType: ['click'],
153
155
  align: "tl bl",
154
156
  visible: visible,
@@ -171,7 +173,7 @@ var Filter = function Filter(props) {
171
173
  btn: true
172
174
  }),
173
175
  onClick: function onClick() {
174
- var _actionRef$current2, _actionRef$current2$f, _actionRef$current$ge5, _actionRef$current3, _actionRef$current3$g, _actionRef$current3$g2, _actionRef$current4, _actionRef$current5, _actionRef$current5$s, _actionRef$current6, _actionRef$current6$r, _actionRef$current7, _actionRef$current7$r, _actionRef$current8, _actionRef$current8$c;
176
+ var _actionRef$current2, _actionRef$current2$f, _actionRef$current$ge5, _actionRef$current3, _actionRef$current3$g, _actionRef$current3$g2, _actionRef$current4, _actionRef$current4$s;
175
177
 
176
178
  (_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
177
179
 
@@ -199,24 +201,30 @@ var Filter = function Filter(props) {
199
201
  return null;
200
202
  })), [[column.dataIndex, param]]).filter(function (item) {
201
203
  return item && (item === null || item === void 0 ? void 0 : item[1]);
202
- }));
203
- var targetPageKey = 'currentPage';
204
- var pageInfo = (_actionRef$current4 = actionRef.current) === null || _actionRef$current4 === void 0 ? void 0 : _actionRef$current4.pageInfo;
204
+ })); // 再设置所有的列筛选状态
205
205
 
206
- if (pageInfo && (pageInfo === null || pageInfo === void 0 ? void 0 : pageInfo.targetPageKey)) {
207
- targetPageKey = pageInfo === null || pageInfo === void 0 ? void 0 : pageInfo.targetPageKey;
208
- } // 再设置所有的列筛选状态
209
-
210
-
211
- (_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, {
206
+ (_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
207
  rules: selected,
213
208
  params: param
214
- }))); // 发送请求
209
+ })));
210
+
211
+ if (selected.length > 0) {
212
+ var _actionRef$current5, _actionRef$current6, _actionRef$current6$r, _actionRef$current7, _actionRef$current7$r, _actionRef$current8, _actionRef$current8$c;
213
+
214
+ var targetPageKey = 'currentPage';
215
+ var pageInfo = (_actionRef$current5 = actionRef.current) === null || _actionRef$current5 === void 0 ? void 0 : _actionRef$current5.pageInfo;
216
+
217
+ if (pageInfo && (pageInfo === null || pageInfo === void 0 ? void 0 : pageInfo.targetPageKey)) {
218
+ targetPageKey = pageInfo === null || pageInfo === void 0 ? void 0 : pageInfo.targetPageKey;
219
+ } // 发送请求
220
+
221
+
222
+ (_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)));
223
+ (_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); // 清空表格选择
215
224
 
216
- (_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)));
217
- (_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); // 清空表格选择
225
+ (_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);
226
+ }
218
227
 
219
- (_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);
220
228
  setVisible(false);
221
229
  }
222
230
  }, getMessage('ok')), /*#__PURE__*/React.createElement(Button, {
@@ -234,7 +242,25 @@ var Filter = function Filter(props) {
234
242
  rules: [],
235
243
  params: ''
236
244
  })));
237
- (_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); // setVisible(!visible);
245
+ (_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);
246
+
247
+ if (selected.length > 0) {
248
+ var _actionRef$current12, _actionRef$current13, _actionRef$current13$, _actionRef$current14, _actionRef$current14$, _actionRef$current15, _actionRef$current15$;
249
+
250
+ var targetPageKey = 'currentPage';
251
+ var pageInfo = (_actionRef$current12 = actionRef.current) === null || _actionRef$current12 === void 0 ? void 0 : _actionRef$current12.pageInfo;
252
+
253
+ if (pageInfo && (pageInfo === null || pageInfo === void 0 ? void 0 : pageInfo.targetPageKey)) {
254
+ targetPageKey = pageInfo === null || pageInfo === void 0 ? void 0 : pageInfo.targetPageKey;
255
+ } // 发送请求
256
+
257
+
258
+ (_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));
259
+ (_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); // 清空表格选择
260
+
261
+ (_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);
262
+ } // setVisible(!visible);
263
+
238
264
  }
239
265
  }, getMessage('reset'))))));
240
266
  };
@@ -1,3 +1,11 @@
1
+ function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
2
+
3
+ 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."); }
4
+
5
+ function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
6
+
7
+ function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
8
+
1
9
  function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
2
10
 
3
11
  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."); }
@@ -121,10 +129,23 @@ var FilterColumnIcon = function FilterColumnIcon(props) {
121
129
 
122
130
 
123
131
  var moveUp = function moveUp(e, dataIndex) {
132
+ var _newColumns$filter, _newColumns$filter2;
133
+
124
134
  e.stopPropagation();
125
- var keyNewColumns = cloneDeep(newColumns);
126
- var index = keyNewColumns.findIndex(function (_ref) {
127
- var index = _ref.dataIndex;
135
+ var keyNewColumns = cloneDeep(newColumns).filter(function (_ref) {
136
+ var lock = _ref.lock;
137
+ return !lock;
138
+ });
139
+ var headLock = cloneDeep((_newColumns$filter = newColumns.filter(function (_ref2) {
140
+ var lock = _ref2.lock;
141
+ return lock === true || lock === 'left';
142
+ })) !== null && _newColumns$filter !== void 0 ? _newColumns$filter : []);
143
+ var tailLock = cloneDeep((_newColumns$filter2 = newColumns.filter(function (_ref3) {
144
+ var lock = _ref3.lock;
145
+ return lock === 'right';
146
+ })) !== null && _newColumns$filter2 !== void 0 ? _newColumns$filter2 : []);
147
+ var index = keyNewColumns.findIndex(function (_ref4) {
148
+ var index = _ref4.dataIndex;
128
149
  return index === dataIndex;
129
150
  });
130
151
 
@@ -134,15 +155,28 @@ var FilterColumnIcon = function FilterColumnIcon(props) {
134
155
  keyNewColumns.push(keyNewColumns.shift());
135
156
  }
136
157
 
137
- notifyTableRender(keyNewColumns);
158
+ notifyTableRender([].concat(_toConsumableArray(headLock), _toConsumableArray(keyNewColumns), _toConsumableArray(tailLock)));
138
159
  }; // 向下
139
160
 
140
161
 
141
162
  var moveDown = function moveDown(e, dataIndex) {
163
+ var _newColumns$filter3, _newColumns$filter4;
164
+
142
165
  e.stopPropagation();
143
- var keyNewColumns = cloneDeep(newColumns);
144
- var index = keyNewColumns.findIndex(function (_ref2) {
145
- var index = _ref2.dataIndex;
166
+ var keyNewColumns = cloneDeep(newColumns).filter(function (_ref5) {
167
+ var lock = _ref5.lock;
168
+ return !lock;
169
+ });
170
+ var headLock = cloneDeep((_newColumns$filter3 = newColumns.filter(function (_ref6) {
171
+ var lock = _ref6.lock;
172
+ return lock === true || lock === 'left';
173
+ })) !== null && _newColumns$filter3 !== void 0 ? _newColumns$filter3 : []);
174
+ var tailLock = cloneDeep((_newColumns$filter4 = newColumns.filter(function (_ref7) {
175
+ var lock = _ref7.lock;
176
+ return lock === 'right';
177
+ })) !== null && _newColumns$filter4 !== void 0 ? _newColumns$filter4 : []);
178
+ var index = keyNewColumns.findIndex(function (_ref8) {
179
+ var index = _ref8.dataIndex;
146
180
  return index === dataIndex;
147
181
  });
148
182
 
@@ -152,7 +186,7 @@ var FilterColumnIcon = function FilterColumnIcon(props) {
152
186
  keyNewColumns.unshift(keyNewColumns.splice(index, 1)[0]);
153
187
  }
154
188
 
155
- notifyTableRender(keyNewColumns);
189
+ notifyTableRender([].concat(_toConsumableArray(headLock), _toConsumableArray(keyNewColumns), _toConsumableArray(tailLock)));
156
190
  }; // 通知表格渲染
157
191
 
158
192
 
@@ -220,23 +254,24 @@ var FilterColumnIcon = function FilterColumnIcon(props) {
220
254
  type: "primary"
221
255
  }, getMessage('reset'))), /*#__PURE__*/React.createElement(Menu.Divider, {
222
256
  key: "divider"
223
- }), newColumns.map(function (_ref3, index) {
257
+ }), newColumns.map(function (_ref9, index) {
224
258
  var _newColumns$find;
225
259
 
226
- var dataIndex = _ref3.dataIndex,
227
- title = _ref3.title,
228
- columnFiltersDisabled = _ref3.columnFiltersDisabled;
260
+ var dataIndex = _ref9.dataIndex,
261
+ title = _ref9.title,
262
+ columnFiltersDisabled = _ref9.columnFiltersDisabled,
263
+ lock = _ref9.lock;
229
264
  return /*#__PURE__*/React.createElement(CheckboxItem, {
230
265
  key: index,
231
- checked: (_newColumns$find = newColumns.find(function (_ref4) {
232
- var key = _ref4.dataIndex;
266
+ checked: (_newColumns$find = newColumns.find(function (_ref10) {
267
+ var key = _ref10.dataIndex;
233
268
  return key === dataIndex;
234
269
  })) === null || _newColumns$find === void 0 ? void 0 : _newColumns$find.columnFilters,
235
270
  onChange: function onChange(check) {
236
271
  return onChangeColumns(check, dataIndex);
237
272
  },
238
273
  disabled: columnFiltersDisabled
239
- }, title, /*#__PURE__*/React.createElement("div", {
274
+ }, title, !lock && /*#__PURE__*/React.createElement("div", {
240
275
  className: cls({
241
276
  sort: true
242
277
  })
@@ -293,8 +328,8 @@ var FilterColumnIcon = function FilterColumnIcon(props) {
293
328
  key: index,
294
329
  className: cls('col')
295
330
  }, /*#__PURE__*/React.createElement(Checkbox, {
296
- checked: (_newColumns$find2 = newColumns.find(function (_ref5) {
297
- var key = _ref5.dataIndex;
331
+ checked: (_newColumns$find2 = newColumns.find(function (_ref11) {
332
+ var key = _ref11.dataIndex;
298
333
  return key === dataIndex;
299
334
  })) === null || _newColumns$find2 === void 0 ? void 0 : _newColumns$find2.columnFilters,
300
335
  onChange: function onChange(check) {
@@ -40,6 +40,7 @@
40
40
  visibility: visible;
41
41
  cursor: pointer;
42
42
  }
43
+
43
44
  }
44
45
  }
45
46
  .next-menu-item-text {
package/es/table/index.js CHANGED
@@ -381,6 +381,15 @@ var ProTable = function ProTable(props) {
381
381
  },
382
382
  request: function request(params) {
383
383
  if (dataFilterForm.validate()) {
384
+ // 如果请求中还有翻页相关信息,需要自动设置到指定页
385
+ if (params === null || params === void 0 ? void 0 : params[targetPageKey]) {
386
+ setCurrentPage(params[targetPageKey]);
387
+ }
388
+
389
+ if (params === null || params === void 0 ? void 0 : params[targetPageSizeKey]) {
390
+ setPageSize(params[targetPageSizeKey]);
391
+ }
392
+
384
393
  _request(params);
385
394
  }
386
395
  },
@@ -398,6 +407,7 @@ var ProTable = function ProTable(props) {
398
407
  resetPage: function resetPage() {
399
408
  setCurrentPage(1);
400
409
  },
410
+ rowSelection: rowSelection,
401
411
  clearRowSelection: function clearRowSelection() {
402
412
  rowSelectionHook.setSelectedRowKeys([]);
403
413
  rowSelectionHook.setSelectedRecords([]);
@@ -410,6 +420,7 @@ var ProTable = function ProTable(props) {
410
420
  targetPageSizeKey: targetPageSizeKey,
411
421
  pageSize: pageSize
412
422
  },
423
+ data: data,
413
424
  dataFilterForm: dataFilterForm,
414
425
  resetTableMaxBodyHeight: function resetTableMaxBodyHeight() {
415
426
  getHeaderHeight().then(function (height) {
@@ -564,7 +575,11 @@ var ProTable = function ProTable(props) {
564
575
  }
565
576
 
566
577
  useEffect(function () {
567
- // 监听 浏览器变化 更吸底状态
578
+ var _actionRef$current5, _actionRef$current5$i;
579
+
580
+ // 初始化 state 状态
581
+ 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); // 监听 浏览器变化 更吸底状态
582
+
568
583
  if (footerSuction) {
569
584
  getFooterSuctionState();
570
585
 
@@ -585,6 +600,8 @@ var ProTable = function ProTable(props) {
585
600
  if (window.onresize) {
586
601
  window.onresize = null;
587
602
  }
603
+
604
+ actionRef.current = undefined;
588
605
  };
589
606
  }, []);
590
607
 
@@ -602,6 +619,10 @@ var ProTable = function ProTable(props) {
602
619
  (propsDataFilter === null || propsDataFilter === void 0 ? void 0 : propsDataFilter.onFilter) && (propsDataFilter === null || propsDataFilter === void 0 ? void 0 : propsDataFilter.onFilter(_objectSpread({}, toJS(dataFilterForm.values))));
603
620
 
604
621
  if (dataFilterForm.validate()) {
622
+ var _actionRef$current6, _actionRef$current6$c;
623
+
624
+ // 搜索变化时,暂时先清空选择
625
+ (_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);
605
626
  setCurrentPage(1); // const { mode, schema } = propsDataFilter as ProTableDataFilterProps;
606
627
  // TODO: 针对 inline 模式下的 search 组件做一下处理,如果空值切换下拉的时候不触发请求
607
628
  // if (mode === 'inline') {
@@ -698,15 +719,21 @@ var ProTable = function ProTable(props) {
698
719
 
699
720
  var renderFooter = function renderFooter() {
700
721
  function onChangePagination(currentPage) {
722
+ var _actionRef$current7, _actionRef$current7$c;
723
+
701
724
  var params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
725
+ // 翻页暂时先清空选择
726
+ (_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);
702
727
  setCurrentPage(currentPage);
703
728
 
704
729
  _request(_objectSpread(_defineProperty({}, targetPageKey, currentPage), params));
705
730
  }
706
731
 
707
732
  function onChangePaginationSize(currentPageSize) {
708
- var _request5;
733
+ var _actionRef$current8, _actionRef$current8$c, _request5;
709
734
 
735
+ // 翻页暂时先清空选择
736
+ (_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);
710
737
  setPageSize(currentPageSize);
711
738
  setCurrentPage(1);
712
739
 
@@ -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监听事件 */
@@ -40,10 +40,10 @@ export var renderColumnsTitle = function renderColumnsTitle(item, actionRef) {
40
40
  var filterMode = item.filterMode,
41
41
  filters = item.filters,
42
42
  dataIndex = item.dataIndex,
43
- dataSource = item.dataSource;
43
+ dataSource = item.dataSource; // 为列过滤添加状态标题
44
44
 
45
- var getItemLable = function getItemLable() {
46
- if (filterMode !== 'multiple') {
45
+ var getItemLabel = function getItemLabel() {
46
+ if (filters && filterMode !== 'multiple') {
47
47
  var _actionRef$current$ge, _actionRef$current, _actionRef$current$ge2;
48
48
 
49
49
  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 : {};
@@ -66,16 +66,37 @@ export var renderColumnsTitle = function renderColumnsTitle(item, actionRef) {
66
66
 
67
67
  return item.value === ((_selectedItem$dataInd2 = selectedItem[dataIndex]) === null || _selectedItem$dataInd2 === void 0 ? void 0 : _selectedItem$dataInd2.params);
68
68
  })) === null || _targetFilters$find === void 0 ? void 0 : _targetFilters$find.label;
69
- return "".concat(item.title, " (").concat(label, ")");
69
+ var value = "".concat(item.title, " (").concat(label, ")");
70
+ return /*#__PURE__*/React.createElement(ProField, {
71
+ style: {
72
+ display: 'inline-flex'
73
+ },
74
+ value: value,
75
+ type: "text",
76
+ render: {
77
+ ellipsis: true,
78
+ color: 'var(--table-th-color,#848484)'
79
+ }
80
+ });
70
81
  }
71
82
  }
72
83
  }
73
84
 
74
- return item.title;
85
+ return /*#__PURE__*/React.createElement(ProField, {
86
+ style: {
87
+ display: 'inline-flex'
88
+ },
89
+ value: item.title,
90
+ type: "text",
91
+ render: {
92
+ ellipsis: true,
93
+ color: 'var(--table-th-color,#848484)'
94
+ }
95
+ });
75
96
  };
76
97
 
77
98
  return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(LabelIconTip, {
78
- label: getItemLable(),
99
+ label: item.title,
79
100
  tooltip: item.tooltip,
80
101
  icon: item.tooltipIcon
81
102
  }), item.filters && /*#__PURE__*/React.createElement(Filter, {
@@ -22,7 +22,10 @@ var state = {
22
22
  fullScreenState: false,
23
23
  filterRules: {},
24
24
  filterColumns: []
25
- }; // 组件内全局监听事件
25
+ };
26
+
27
+ var _initState = cloneDeepLodash(state); // 组件内全局监听事件
28
+
26
29
 
27
30
  var callback = {
28
31
  fullScreenState: {}
@@ -40,6 +43,9 @@ var mutations = {
40
43
  mutations[key] = value;
41
44
  }
42
45
  },
46
+ initState: function initState() {
47
+ state = cloneDeepLodash(_initState);
48
+ },
43
49
  filterColumns: state.filterColumns,
44
50
  setFullScreenState: function setFullScreenState(fullScreenState) {
45
51
  state.fullScreenState = fullScreenState;
@@ -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: ProMessageProps) => JSX.Element;
3
+ export declare const renderProMessage: (message?: ProMessageProps | undefined, defaultProps?: MessageProps | undefined) => JSX.Element | null;
@@ -6,14 +6,14 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.definePrope
6
6
 
7
7
  import React from 'react';
8
8
  import { Message } from '@alicloudfe/components';
9
- export var renderProMessage = function renderProMessage(message) {
9
+ export var renderProMessage = function renderProMessage(message, defaultProps) {
10
+ if (!message) {
11
+ return null;
12
+ }
13
+
10
14
  if (typeof message === 'string') {
11
- return /*#__PURE__*/React.createElement(Message, {
12
- type: "notice"
13
- }, message);
15
+ return /*#__PURE__*/React.createElement(Message, _objectSpread({}, defaultProps), message);
14
16
  }
15
17
 
16
- return /*#__PURE__*/React.createElement(Message, _objectSpread({
17
- type: "notice"
18
- }, message));
18
+ return /*#__PURE__*/React.createElement(Message, _objectSpread(_objectSpread({}, defaultProps), message));
19
19
  };
@@ -251,7 +251,9 @@ function useDialogAction(action, actionContext) {
251
251
  className: "teamix-pro-dialog-before-content"
252
252
  }, addContextForReactNode(beforeContent, dialogContext)), message && /*#__PURE__*/_react.default.createElement("div", {
253
253
  className: "teamix-pro-dialog-message"
254
- }, (0, _message.renderProMessage)(message)), dialogContent, afterContent && /*#__PURE__*/_react.default.createElement("div", {
254
+ }, (0, _message.renderProMessage)(message, {
255
+ type: 'notice'
256
+ })), dialogContent, afterContent && /*#__PURE__*/_react.default.createElement("div", {
255
257
  className: "teamix-pro-dialog-after-content"
256
258
  }, addContextForReactNode(afterContent, dialogContext)), footerDescription && /*#__PURE__*/_react.default.createElement("div", {
257
259
  className: (0, _classnames.default)('teamix-pro-dialog-footer-description', getFooterAlignClass(isDrawer, footerAlign))
@@ -24,6 +24,7 @@ export declare type ProActionConfig = ({
24
24
  export declare function registerActionHandler(id: string, extendActionId: string, defaultConfig: any): void;
25
25
  export declare function useAction(config?: ProActionConfig, context?: any): any;
26
26
  export interface ProActionButtonProps extends ButtonProps {
27
+ key?: string | number;
27
28
  config?: ProActionConfig;
28
29
  visible?: any;
29
30
  disabled?: any;
@@ -33,6 +34,7 @@ export interface ProActionButtonProps extends ButtonProps {
33
34
  }
34
35
  export declare const ProActionButton: (props: ProActionButtonProps) => JSX.Element;
35
36
  export interface ProActionMenuButtonProps extends MenuButtonProps {
37
+ key?: string | number;
36
38
  actions: ProActionProps[];
37
39
  visible?: any;
38
40
  icon?: string;