@teamix/pro 1.2.16 → 1.2.20

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 (86) hide show
  1. package/dist/212.js +49 -49
  2. package/dist/pro.css +1 -1
  3. package/dist/pro.js +2147 -686
  4. package/dist/pro.min.css +1 -1
  5. package/dist/pro.min.js +1 -1
  6. package/es/actions/base.d.ts +2 -1
  7. package/es/actions/base.js +1 -1
  8. package/es/actions/danger-pop-confirm.d.ts +5 -0
  9. package/es/actions/danger-pop-confirm.js +10 -0
  10. package/es/actions/dialog.d.ts +1 -1
  11. package/es/actions/dialog.js +34 -36
  12. package/es/actions/index.d.ts +5 -0
  13. package/es/actions/index.js +38 -14
  14. package/es/actions/pop-confirm.d.ts +9 -0
  15. package/es/actions/pop-confirm.js +9 -0
  16. package/es/form/Components/LightFilter/componentMap.d.ts +2 -1
  17. package/es/form/Components/LightFilter/componentMap.js +2 -1
  18. package/es/form/Components/LightFilter/index.d.ts +1 -0
  19. package/es/form/Components/LightFilter/index.js +19 -13
  20. package/es/form/Components/LightFilter/index.scss +14 -4
  21. package/es/form/Filter/AdvancedFilter.d.ts +7 -0
  22. package/es/form/Filter/AdvancedFilter.js +113 -0
  23. package/es/form/Filter/LightFilter.d.ts +7 -0
  24. package/es/form/Filter/LightFilter.js +79 -0
  25. package/es/form/Filter/SimpleFilter.d.ts +7 -0
  26. package/es/form/Filter/SimpleFilter.js +74 -0
  27. package/es/form/Filter/index2.js +288 -235
  28. package/es/form/Filter/index2.scss +3 -0
  29. package/es/form/ProForm/index.js +11 -8
  30. package/es/form/ProForm/index.scss +3 -0
  31. package/es/form/ProForm/useFieldRequest.js +1 -8
  32. package/es/form/SchemaForm/index.js +3 -1
  33. package/es/form/typing.d.ts +11 -2
  34. package/es/index.d.ts +1 -1
  35. package/es/index.js +1 -1
  36. package/es/nocode/configurators/ProTable.js +1 -0
  37. package/es/table/components/Filter/index.js +42 -16
  38. package/es/table/components/Pagination/index.d.ts +3 -0
  39. package/es/table/components/Pagination/index.js +82 -0
  40. package/es/table/components/ToolBar/FilterColumnIcon.js +18 -5
  41. package/es/table/components/ToolBar/index.scss +8 -2
  42. package/es/table/index.js +71 -18
  43. package/es/table/index.scss +7 -1
  44. package/es/table/typing.d.ts +5 -0
  45. package/es/table/utils/columnRender.js +1 -1
  46. package/lib/actions/base.d.ts +2 -1
  47. package/lib/actions/base.js +1 -1
  48. package/lib/actions/danger-pop-confirm.d.ts +5 -0
  49. package/lib/actions/danger-pop-confirm.js +22 -0
  50. package/lib/actions/dialog.d.ts +1 -1
  51. package/lib/actions/dialog.js +35 -36
  52. package/lib/actions/index.d.ts +5 -0
  53. package/lib/actions/index.js +40 -14
  54. package/lib/actions/pop-confirm.d.ts +9 -0
  55. package/lib/actions/pop-confirm.js +23 -0
  56. package/lib/form/Components/LightFilter/componentMap.d.ts +2 -1
  57. package/lib/form/Components/LightFilter/componentMap.js +4 -3
  58. package/lib/form/Components/LightFilter/index.d.ts +1 -0
  59. package/lib/form/Components/LightFilter/index.js +18 -12
  60. package/lib/form/Components/LightFilter/index.scss +14 -4
  61. package/lib/form/Filter/AdvancedFilter.d.ts +7 -0
  62. package/lib/form/Filter/AdvancedFilter.js +133 -0
  63. package/lib/form/Filter/LightFilter.d.ts +7 -0
  64. package/lib/form/Filter/LightFilter.js +99 -0
  65. package/lib/form/Filter/SimpleFilter.d.ts +7 -0
  66. package/lib/form/Filter/SimpleFilter.js +93 -0
  67. package/lib/form/Filter/index2.js +290 -234
  68. package/lib/form/Filter/index2.scss +3 -0
  69. package/lib/form/ProForm/index.js +11 -7
  70. package/lib/form/ProForm/index.scss +3 -0
  71. package/lib/form/ProForm/useFieldRequest.js +1 -9
  72. package/lib/form/SchemaForm/index.js +3 -1
  73. package/lib/form/typing.d.ts +11 -2
  74. package/lib/index.d.ts +1 -1
  75. package/lib/index.js +1 -1
  76. package/lib/nocode/configurators/ProTable.js +1 -0
  77. package/lib/table/components/Filter/index.js +42 -16
  78. package/lib/table/components/Pagination/index.d.ts +3 -0
  79. package/lib/table/components/Pagination/index.js +95 -0
  80. package/lib/table/components/ToolBar/FilterColumnIcon.js +18 -5
  81. package/lib/table/components/ToolBar/index.scss +8 -2
  82. package/lib/table/index.js +69 -17
  83. package/lib/table/index.scss +7 -1
  84. package/lib/table/typing.d.ts +5 -0
  85. package/lib/table/utils/columnRender.js +1 -1
  86. package/package.json +3 -3
@@ -29,6 +29,8 @@ var _useInitialRequest = _interopRequireDefault(require("./useInitialRequest"));
29
29
 
30
30
  var _validate = _interopRequireDefault(require("../locales/validate"));
31
31
 
32
+ var _lodash = _interopRequireDefault(require("lodash.debounce"));
33
+
32
34
  require("./index.scss");
33
35
 
34
36
  var _excluded = ["form", "initialValues", "initialRequest", "schema", "scope", "context", "components", "children", "layout", "labelAlign", "wrapperAlign", "labelCol", "wrapperCol", "breakpoints", "onChange", "onSubmit", "onSubmitFailed", "className"];
@@ -105,13 +107,11 @@ var ProForm = /*#__PURE__*/(0, _react.memo)(function (_ref) {
105
107
  }, [breakpoints, layout, labelAlign, wrapperAlign, labelCol, wrapperCol]); // 添加onChange
106
108
 
107
109
  (0, _react.useEffect)(function () {
108
- form.removeEffects('onChange');
109
- form.addEffects('onChange', function () {
110
- (0, _core.onFormValuesChange)(function (form) {
111
- if (onChange) {
112
- onChange((0, _reactive.toJS)(form.values));
113
- }
114
- });
110
+ form.removeEffects('onFieldValueChange');
111
+ form.addEffects('onFieldValueChange', function () {
112
+ (0, _core.onFieldValueChange)('*', (0, _lodash.default)(function (field, form) {
113
+ onChange && onChange((0, _reactive.toJS)(form.values), (0, _reactive.toJS)(field.value), field.props.name);
114
+ }, 300));
115
115
  });
116
116
  }, [form, onChange]); // 配置表单默认值
117
117
 
@@ -121,6 +121,10 @@ var ProForm = /*#__PURE__*/(0, _react.memo)(function (_ref) {
121
121
  } else if (initialRequest) {
122
122
  (0, _useInitialRequest.default)(initialRequest).then(function (values) {
123
123
  form.setInitialValues(values);
124
+ }).finally(function () {
125
+ initialRequest.onComplete && initialRequest.onComplete(undefined, undefined, {
126
+ form: form
127
+ });
124
128
  });
125
129
  }
126
130
  }, []); // 配置国际化
@@ -180,6 +180,9 @@
180
180
  border: 0;
181
181
  }
182
182
  }
183
+ .#{$css-prefix}input-control:last-child {
184
+ padding-right: 0;
185
+ }
183
186
  }
184
187
 
185
188
  // 数组类组件添加按钮
@@ -7,8 +7,6 @@ exports.default = void 0;
7
7
 
8
8
  var _react = require("@formily/react");
9
9
 
10
- var _utils = require("@teamix/utils");
11
-
12
10
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
13
11
 
14
12
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
@@ -19,13 +17,7 @@ var _default = function _default() {
19
17
  var field = (0, _react.useField)();
20
18
 
21
19
  var refresh = function refresh() {
22
- if (!(0, _utils.isPlainObj)(field.data)) {
23
- field.data = {
24
- refresh: {}
25
- };
26
- } else {
27
- field.data.refresh = _objectSpread({}, field.data.refresh);
28
- }
20
+ field.data.refresh = _objectSpread({}, field.data.refresh);
29
21
  };
30
22
 
31
23
  return {
@@ -266,7 +266,9 @@ var _default = /*#__PURE__*/(0, _react.memo)(function (_ref) {
266
266
  rules: defaultRules,
267
267
  reactions: defaultReactions,
268
268
  dataSource: defaultDataSource,
269
- data: data
269
+ data: data || {
270
+ placeholder: true
271
+ }
270
272
  })); // 递归子组件
271
273
 
272
274
  var recursiveProperties = (children === null || children === void 0 ? void 0 : children.length) ? {
@@ -58,12 +58,18 @@ export interface ProFormProps extends IFormLayoutProps {
58
58
  };
59
59
  children?: React.ReactNode;
60
60
  initialValues?: AnyObject;
61
- initialRequest?: CommonRequestConfig;
61
+ initialRequest?: ProFormRequestConfig;
62
62
  previewTextPlaceholder?: ReactNode;
63
- onChange?: (values: any, displayValues?: any) => any;
63
+ onChange?: (values: any, fieldValue?: any, fieldName?: string) => any;
64
64
  onSubmit?: ((values: any) => any) | CommonRequestConfig;
65
65
  onSubmitFailed?: (feedbacks: IFormFeedback[]) => void;
66
66
  }
67
+ export interface FilterProps extends ProFormProps {
68
+ form: FormType;
69
+ defaultFilterValue?: string;
70
+ onReset?: (payload?: any) => void;
71
+ onResetClick?: () => void;
72
+ }
67
73
  export interface QueryFilterProps extends ProFormProps {
68
74
  /**
69
75
  * @deprecated triggerType已弃用
@@ -73,6 +79,9 @@ export interface QueryFilterProps extends ProFormProps {
73
79
  expand?: boolean;
74
80
  addonBefore?: ReactNode;
75
81
  addonAfter?: ReactNode;
82
+ defaultFilterValue?: string;
83
+ formRef?: React.MutableRefObject<any>;
84
+ onInit?: (values: any) => boolean;
76
85
  onFilter?: (values: any) => void;
77
86
  onReset?: (payload?: any) => void;
78
87
  }
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.15";
24
+ declare const version = "1.2.19";
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.15';
256
+ var version = '1.2.19';
257
257
  exports.version = version;
@@ -26,6 +26,7 @@ var initialValues = {
26
26
  },
27
27
  mainAction: {
28
28
  actions: [{
29
+ key: 'action',
29
30
  children: '操作按钮'
30
31
  }]
31
32
  }
@@ -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: "filter-line",
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$current5, _actionRef$current5$s, _actionRef$current6, _actionRef$current6$r, _actionRef$current7, _actionRef$current7$r, _actionRef$current8, _actionRef$current8$c;
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
- if (pageInfo && (pageInfo === null || pageInfo === void 0 ? void 0 : pageInfo.targetPageKey)) {
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
- (_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)));
237
- (_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); // 清空表格选择
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); // setVisible(!visible);
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
  };
@@ -0,0 +1,3 @@
1
+ import { PaginationProps } from '@alicloudfe/components/types/pagination';
2
+ declare const _default: (props: PaginationProps) => JSX.Element;
3
+ export default _default;
@@ -0,0 +1,95 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+
8
+ var _react = _interopRequireDefault(require("react"));
9
+
10
+ var _components = require("@alicloudfe/components");
11
+
12
+ var _hooks = require("@teamix/hooks");
13
+
14
+ var _excluded = ["className", "onChange", "total", "totalRender", "pageSize", "current", "pageSizeList", "pageSizeSelector", "type", "onPageSizeChange"];
15
+
16
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
17
+
18
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
19
+
20
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
21
+
22
+ 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; }
23
+
24
+ function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
25
+
26
+ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
27
+
28
+ var _default = function _default(props) {
29
+ var className = props.className,
30
+ onChange = props.onChange,
31
+ total = props.total,
32
+ totalRender = props.totalRender,
33
+ pageSize = props.pageSize,
34
+ current = props.current,
35
+ pageSizeList = props.pageSizeList,
36
+ pageSizeSelector = props.pageSizeSelector,
37
+ type = props.type,
38
+ onPageSizeChange = props.onPageSizeChange,
39
+ otherProps = _objectWithoutProperties(props, _excluded);
40
+
41
+ var _useResponsiveProps = (0, _hooks.useResponsiveProps)([480, 580, 680], ['mini', 'small', 'simple', 'normal']),
42
+ responsiveProps = _useResponsiveProps.responsiveProps,
43
+ paginationWrapperRef = _useResponsiveProps.ref;
44
+
45
+ var commonPaginationProps = {
46
+ className: className,
47
+ onChange: onChange,
48
+ total: total,
49
+ pageSize: pageSize,
50
+ current: current,
51
+ shape: 'arrow-only',
52
+ pageSizeList: pageSizeList,
53
+ pageSizeSelector: pageSizeSelector,
54
+ pageSizePosition: 'end',
55
+ onPageSizeChange: onPageSizeChange
56
+ };
57
+
58
+ var renderPagination = function renderPagination() {
59
+ switch (responsiveProps) {
60
+ case 'normal':
61
+ return /*#__PURE__*/_react.default.createElement(_components.Pagination, _objectSpread(_objectSpread({}, commonPaginationProps), otherProps));
62
+
63
+ case 'simple':
64
+ return /*#__PURE__*/_react.default.createElement(_components.Pagination, _objectSpread(_objectSpread({}, commonPaginationProps), {}, {
65
+ pageShowCount: 3
66
+ }, otherProps));
67
+
68
+ case 'small':
69
+ return /*#__PURE__*/_react.default.createElement(_components.Pagination, _objectSpread(_objectSpread({}, commonPaginationProps), {}, {
70
+ pageSizeSelector: false,
71
+ type: "simple"
72
+ }, otherProps));
73
+
74
+ case 'mini':
75
+ return /*#__PURE__*/_react.default.createElement(_components.Pagination, _objectSpread(_objectSpread({}, commonPaginationProps), {}, {
76
+ pageSizeSelector: false,
77
+ type: "mini"
78
+ }, otherProps));
79
+
80
+ default:
81
+ return /*#__PURE__*/_react.default.createElement(_components.Pagination, _objectSpread(_objectSpread({}, commonPaginationProps), otherProps));
82
+ }
83
+ };
84
+
85
+ return (
86
+ /*#__PURE__*/
87
+ // 用于获取翻页器响应式 ref
88
+ _react.default.createElement("div", {
89
+ ref: paginationWrapperRef,
90
+ className: "pagination-wrapper"
91
+ }, renderPagination())
92
+ );
93
+ };
94
+
95
+ exports.default = _default;
@@ -71,7 +71,8 @@ var processColumns = function processColumns(columns) {
71
71
  var FilterColumnIcon = function FilterColumnIcon(props) {
72
72
  var _props$columns = props.columns,
73
73
  columns = _props$columns === void 0 ? [] : _props$columns,
74
- actionRef = props.actionRef;
74
+ actionRef = props.actionRef,
75
+ filterColumnType = props.filterColumnType;
75
76
 
76
77
  var _useState = (0, _react.useState)(true),
77
78
  _useState2 = _slicedToArray(_useState, 2),
@@ -258,7 +259,9 @@ var FilterColumnIcon = function FilterColumnIcon(props) {
258
259
  align: "tr br"
259
260
  }, /*#__PURE__*/_react.default.createElement("div", {
260
261
  className: cls()
261
- }, /*#__PURE__*/_react.default.createElement(_components.Menu, null, /*#__PURE__*/_react.default.createElement(CheckboxItem, {
262
+ }, /*#__PURE__*/_react.default.createElement(_components.Menu, {
263
+ className: cls('all-select')
264
+ }, /*#__PURE__*/_react.default.createElement(CheckboxItem, {
262
265
  indeterminate: indeterminate,
263
266
  checked: allVisible,
264
267
  onChange: onChangeAllColumns
@@ -271,7 +274,9 @@ var FilterColumnIcon = function FilterColumnIcon(props) {
271
274
  type: "primary"
272
275
  }, (0, _utils.getMessage)('reset'))), /*#__PURE__*/_react.default.createElement(_components.Menu.Divider, {
273
276
  key: "divider"
274
- }), newColumns.map(function (_ref9, index) {
277
+ })), /*#__PURE__*/_react.default.createElement(_components.Menu, {
278
+ className: cls('checkbox-group')
279
+ }, newColumns.map(function (_ref9, index) {
275
280
  var _newColumns$find;
276
281
 
277
282
  var dataIndex = _ref9.dataIndex,
@@ -361,12 +366,20 @@ var FilterColumnIcon = function FilterColumnIcon(props) {
361
366
  },
362
367
  disabled: columnFiltersDisabled
363
368
  }, /*#__PURE__*/_react.default.createElement(_utils.Ellipsis, {
364
- tooltip: false
369
+ tooltip: title
365
370
  }, title)));
366
371
  }))));
367
372
  };
368
373
 
369
- if (newColumns.length > 10) {
374
+ if (filterColumnType === 'dialog') {
375
+ return renderDialog();
376
+ }
377
+
378
+ if (filterColumnType === 'dropdown') {
379
+ return renderDropdown();
380
+ }
381
+
382
+ if (newColumns.length >= 20) {
370
383
  return renderDialog();
371
384
  }
372
385
 
@@ -18,8 +18,6 @@
18
18
  // FilterColumn
19
19
  .teamix-pro-table-toolbar-filter-column {
20
20
  min-width: 180px;
21
- max-height: 350px;
22
- overflow: auto;
23
21
  box-shadow: var(--popup-local-shadow, 0px 6px 24px 0px rgba(0, 0, 0, 0.1));
24
22
  background: var(--menu-background);
25
23
  &-reset {
@@ -76,6 +74,14 @@
76
74
  align-items: center;
77
75
  }
78
76
  }
77
+ .teamix-pro-table-toolbar-filter-column-all-select.teamix-pro-table-toolbar-filter-column-all-select {
78
+ padding-bottom: 0;
79
+ }
80
+ .teamix-pro-table-toolbar-filter-column-checkbox-group.teamix-pro-table-toolbar-filter-column-checkbox-group {
81
+ padding-top: 0;
82
+ max-height: 310px;
83
+ overflow: auto;
84
+ }
79
85
 
80
86
  // fullscreen
81
87
  .teamix-pro-table-full-screen {
@@ -55,7 +55,7 @@ Object.keys(_typing).forEach(function (key) {
55
55
  }
56
56
  });
57
57
  });
58
- var _excluded = ["header", "className", "tableClassName", "mainAction", "extra", "dataFilter", "toolBar", "columns", "useRowSelection", "rowSelection", "onChangeRowSelection", "getRowSelection", "primaryKey", "footerAction", "footer", "url", "pageKey", "pageSizeKey", "method", "params", "formatSort", "formatParams", "formatResult", "requestWhenMount", "showPagination", "pageSizeList", "showSkeleton", "skeletonSize", "actionRef", "dataSource", "filterDebounce", "footerSuction", "autoRefresh", "customRequest"];
58
+ var _excluded = ["header", "className", "tableClassName", "mainAction", "extra", "dataFilter", "toolBar", "columns", "useRowSelection", "rowSelection", "onChangeRowSelection", "getRowSelection", "primaryKey", "footerAction", "footer", "url", "pageKey", "pageSizeKey", "method", "params", "formatSort", "formatParams", "formatResult", "requestWhenMount", "showPagination", "pageSizeList", "showSkeleton", "skeletonSize", "actionRef", "dataSource", "filterDebounce", "footerSuction", "autoRefresh", "customRequest", "filterColumnType"];
59
59
 
60
60
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
61
61
 
@@ -103,10 +103,36 @@ var toJS = _form.formilyReactive.toJS;
103
103
  * @returns
104
104
  */
105
105
 
106
- var processColumns = function processColumns(columns) {
107
- return columns.filter(function (item) {
106
+ var processColumns = function processColumns(columns, initialColumns) {
107
+ var filterColumns = columns.filter(function (item) {
108
108
  return item.columnFilters !== false;
109
- });
109
+ }); // 处理只剩一列批量选择的情况下宽度错乱问题
110
+
111
+ if (filterColumns === null || filterColumns === void 0 ? void 0 : filterColumns.length) {
112
+ if ((filterColumns === null || filterColumns === void 0 ? void 0 : filterColumns.length) === 1) {
113
+ var _filterColumns$, _filterColumns$2;
114
+
115
+ if ((_filterColumns$ = filterColumns[0]) === null || _filterColumns$ === void 0 ? void 0 : _filterColumns$.width) {
116
+ delete filterColumns[0].width;
117
+ }
118
+
119
+ if ((_filterColumns$2 = filterColumns[0]) === null || _filterColumns$2 === void 0 ? void 0 : _filterColumns$2.lock) {
120
+ filterColumns[0].lock = false;
121
+ }
122
+ } else {
123
+ var _initialColumns$, _initialColumns$2;
124
+
125
+ if ((_initialColumns$ = initialColumns[0]) === null || _initialColumns$ === void 0 ? void 0 : _initialColumns$.width) {
126
+ filterColumns[0].width = initialColumns[0].width;
127
+ }
128
+
129
+ if ((_initialColumns$2 = initialColumns[0]) === null || _initialColumns$2 === void 0 ? void 0 : _initialColumns$2.lock) {
130
+ filterColumns[0].lock = initialColumns[0].lock;
131
+ }
132
+ }
133
+ }
134
+
135
+ return filterColumns;
110
136
  };
111
137
  /** 默认请求翻页参数 */
112
138
 
@@ -176,6 +202,8 @@ var ProTable = function ProTable(props) {
176
202
  return false;
177
203
  } : _props$autoRefresh,
178
204
  customRequest = props.customRequest,
205
+ _props$filterColumnTy = props.filterColumnType,
206
+ filterColumnType = _props$filterColumnTy === void 0 ? 'auto' : _props$filterColumnTy,
179
207
  otherProps = _objectWithoutProperties(props, _excluded);
180
208
 
181
209
  var targetPageKey = pageKey || globalPageKey;
@@ -207,7 +235,7 @@ var ProTable = function ProTable(props) {
207
235
  sort = _useState10[0],
208
236
  setSort = _useState10[1];
209
237
 
210
- var _useState11 = (0, _react.useState)(requestWhenMount && propsShowSkeleton),
238
+ var _useState11 = (0, _react.useState)(!propsDataSource && requestWhenMount && propsShowSkeleton),
211
239
  _useState12 = _slicedToArray(_useState11, 2),
212
240
  showSkeleton = _useState12[0],
213
241
  setShowSkeleton = _useState12[1]; // 首次加载,渲染骨架屏
@@ -224,7 +252,7 @@ var ProTable = function ProTable(props) {
224
252
  var tableRef = (0, _react.useRef)(null);
225
253
  var actionRef = (0, _react.useRef)(); // 传给 table 的过滤后的 columns
226
254
 
227
- var _useState15 = (0, _react.useState)(processColumns(propsColumns !== null && propsColumns !== void 0 ? propsColumns : [])),
255
+ var _useState15 = (0, _react.useState)(processColumns(propsColumns !== null && propsColumns !== void 0 ? propsColumns : [], propsColumns)),
228
256
  _useState16 = _slicedToArray(_useState15, 2),
229
257
  filteredColumns = _useState16[0],
230
258
  setFilteredColumns = _useState16[1];
@@ -395,10 +423,16 @@ var ProTable = function ProTable(props) {
395
423
  (0, _react.useEffect)(function () {
396
424
  var _actionRef$current, _actionRef$current$se;
397
425
 
398
- var columns = processColumns(propsColumns !== null && propsColumns !== void 0 ? propsColumns : []);
426
+ var columns = processColumns(propsColumns !== null && propsColumns !== void 0 ? propsColumns : [], propsColumns);
399
427
  setFilteredColumns(columns);
400
428
  (_actionRef$current = actionRef.current) === null || _actionRef$current === void 0 ? void 0 : (_actionRef$current$se = _actionRef$current.setState) === null || _actionRef$current$se === void 0 ? void 0 : _actionRef$current$se.call(_actionRef$current, 'filterColumns', columns);
401
- }, [propsColumns]); // 绑定 Actions
429
+ }, [propsColumns]); // dataSource 受控
430
+
431
+ (0, _react.useEffect)(function () {
432
+ if (propsDataSource) {
433
+ setData(propsDataSource);
434
+ }
435
+ }, [propsDataSource]); // 绑定 Actions
402
436
 
403
437
  (0, _utils2.useActionType)(actionRef, {
404
438
  fullScreen: function fullScreen() {
@@ -413,7 +447,7 @@ var ProTable = function ProTable(props) {
413
447
  setColumn: function setColumn(newColumns) {
414
448
  var _actionRef$current2, _actionRef$current2$s;
415
449
 
416
- var columns = processColumns(newColumns);
450
+ var columns = processColumns(newColumns, propsColumns);
417
451
  setFilteredColumns(columns);
418
452
  (_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, 'filterColumns', columns);
419
453
  },
@@ -425,6 +459,15 @@ var ProTable = function ProTable(props) {
425
459
  },
426
460
  request: function request(params) {
427
461
  if (dataFilterForm.validate()) {
462
+ // 如果请求中还有翻页相关信息,需要自动设置到指定页
463
+ if (params === null || params === void 0 ? void 0 : params[targetPageKey]) {
464
+ setCurrentPage(params[targetPageKey]);
465
+ }
466
+
467
+ if (params === null || params === void 0 ? void 0 : params[targetPageSizeKey]) {
468
+ setPageSize(params[targetPageSizeKey]);
469
+ }
470
+
428
471
  _request(params);
429
472
  }
430
473
  },
@@ -455,6 +498,7 @@ var ProTable = function ProTable(props) {
455
498
  targetPageSizeKey: targetPageSizeKey,
456
499
  pageSize: pageSize
457
500
  },
501
+ data: data,
458
502
  dataFilterForm: dataFilterForm,
459
503
  resetTableMaxBodyHeight: function resetTableMaxBodyHeight() {
460
504
  getHeaderHeight().then(function (height) {
@@ -653,10 +697,11 @@ var ProTable = function ProTable(props) {
653
697
  (propsDataFilter === null || propsDataFilter === void 0 ? void 0 : propsDataFilter.onFilter) && (propsDataFilter === null || propsDataFilter === void 0 ? void 0 : propsDataFilter.onFilter(_objectSpread({}, toJS(dataFilterForm.values))));
654
698
 
655
699
  if (dataFilterForm.validate()) {
656
- setCurrentPage(1); // const { mode, schema } = propsDataFilter as ProTableDataFilterProps;
657
- // TODO: 针对 inline 模式下的 search 组件做一下处理,如果空值切换下拉的时候不触发请求
658
- // if (mode === 'inline') {
659
- // }
700
+ var _actionRef$current6, _actionRef$current6$c;
701
+
702
+ // 搜索变化时,暂时先清空选择
703
+ (_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);
704
+ setCurrentPage(1);
660
705
 
661
706
  _request(_defineProperty({}, targetPageKey, 1));
662
707
  }
@@ -691,7 +736,8 @@ var ProTable = function ProTable(props) {
691
736
  columns: propsColumns,
692
737
  dataFilter: dataFilter,
693
738
  dataFilterForm: dataFilterForm,
694
- rowSelection: rowSelection
739
+ rowSelection: rowSelection,
740
+ filterColumnType: filterColumnType
695
741
  }), /*#__PURE__*/_react.default.createElement(_components.Table.StickyLock, _objectSpread({
696
742
  hasBorder: false,
697
743
  dataSource: showSkeleton ? skeletonDataSource : data || props.dataSource,
@@ -749,15 +795,21 @@ var ProTable = function ProTable(props) {
749
795
 
750
796
  var renderFooter = function renderFooter() {
751
797
  function onChangePagination(currentPage) {
798
+ var _actionRef$current7, _actionRef$current7$c;
799
+
752
800
  var params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
801
+ // 翻页暂时先清空选择
802
+ (_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);
753
803
  setCurrentPage(currentPage);
754
804
 
755
805
  _request(_objectSpread(_defineProperty({}, targetPageKey, currentPage), params));
756
806
  }
757
807
 
758
808
  function onChangePaginationSize(currentPageSize) {
759
- var _request5;
809
+ var _actionRef$current8, _actionRef$current8$c, _request5;
760
810
 
811
+ // 翻页暂时先清空选择
812
+ (_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);
761
813
  setPageSize(currentPageSize);
762
814
  setCurrentPage(1);
763
815
 
@@ -797,6 +849,8 @@ var ProTable = function ProTable(props) {
797
849
  return onChangePagination(number);
798
850
  },
799
851
  total: total,
852
+ shape: "arrow-only",
853
+ pageSizePosition: "end",
800
854
  totalRender: function totalRender(total) {
801
855
  return (0, _utils.getMessage)('total', {
802
856
  total: total
@@ -804,10 +858,8 @@ var ProTable = function ProTable(props) {
804
858
  },
805
859
  pageSize: pageSize,
806
860
  current: currentPage,
807
- shape: "arrow-only",
808
861
  pageSizeList: pageSizeList,
809
862
  pageSizeSelector: total > (props.pageSize || 10) * 2 ? 'dropdown' : false,
810
- pageSizePosition: "end",
811
863
  type: total / pageSize <= 2 ? 'simple' : 'normal',
812
864
  onPageSizeChange: function onPageSizeChange(number) {
813
865
  return onChangePaginationSize(number);
@@ -32,12 +32,18 @@ $fullscreenPadding: 24px;
32
32
  }
33
33
  &-footer-left-wrapper {
34
34
  display: flex;
35
- flex: 1;
35
+ flex-shrink: 0;
36
36
  align-items: center;
37
37
  }
38
38
  &-footer-right-wrapper {
39
39
  display: flex;
40
40
  justify-content: flex-end;
41
+ width: 100%;
42
+ }
43
+ .pagination-wrapper {
44
+ display: flex;
45
+ justify-content: flex-end;
46
+ width: 100%;
41
47
  }
42
48
  &-footer-action {
43
49
  margin-left: 16px;