@teamix/pro 1.2.18 → 1.2.22

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 (113) hide show
  1. package/dist/212.js +49 -49
  2. package/dist/pro.css +1 -1
  3. package/dist/pro.js +3581 -990
  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 +42 -55
  12. package/es/actions/index.d.ts +13 -0
  13. package/es/actions/index.js +21 -16
  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 +4 -2
  18. package/es/form/Components/LightFilter/index.d.ts +1 -0
  19. package/es/form/Components/LightFilter/index.js +34 -16
  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 +114 -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 -7
  30. package/es/form/ProForm/index.scss +40 -6
  31. package/es/form/ProForm/useFormDisplayValues.js +4 -2
  32. package/es/form/SchemaForm/index.js +16 -10
  33. package/es/form/SchemaForm/initializeDataSource.d.ts +2 -2
  34. package/es/form/SchemaForm/initializeDataSource.js +4 -9
  35. package/es/form/SchemaForm/initializeRequest.d.ts +2 -2
  36. package/es/form/SchemaForm/initializeRequest.js +4 -10
  37. package/es/form/SchemaForm/initializeRules.d.ts +7 -1
  38. package/es/form/SchemaForm/initializeRules.js +9 -13
  39. package/es/form/SchemaForm/reactions.d.ts +5 -5
  40. package/es/form/SchemaForm/reactions.js +27 -29
  41. package/es/form/global.scss +1 -0
  42. package/es/form/typing.d.ts +11 -2
  43. package/es/form/utils.d.ts +8 -7
  44. package/es/form/utils.js +5 -4
  45. package/es/index.d.ts +1 -1
  46. package/es/index.js +1 -1
  47. package/es/table/components/Filter/index.js +1 -0
  48. package/es/table/components/Layout/index.js +21 -12
  49. package/es/table/components/Pagination/index.d.ts +4 -0
  50. package/es/table/components/Pagination/index.js +154 -0
  51. package/es/table/components/Pagination/index.scss +22 -0
  52. package/es/table/components/ToolBar/FilterColumnIcon.js +42 -8
  53. package/es/table/components/ToolBar/index.scss +17 -6
  54. package/es/table/index.js +118 -34
  55. package/es/table/index.scss +7 -1
  56. package/es/table/typing.d.ts +6 -2
  57. package/es/table/utils/columnRender.js +2 -1
  58. package/es/table/utils/index.d.ts +7 -0
  59. package/es/table/utils/index.js +38 -4
  60. package/lib/actions/base.d.ts +2 -1
  61. package/lib/actions/base.js +1 -1
  62. package/lib/actions/danger-pop-confirm.d.ts +5 -0
  63. package/lib/actions/danger-pop-confirm.js +22 -0
  64. package/lib/actions/dialog.d.ts +1 -1
  65. package/lib/actions/dialog.js +42 -54
  66. package/lib/actions/index.d.ts +13 -0
  67. package/lib/actions/index.js +23 -16
  68. package/lib/actions/pop-confirm.d.ts +9 -0
  69. package/lib/actions/pop-confirm.js +23 -0
  70. package/lib/form/Components/LightFilter/componentMap.d.ts +2 -1
  71. package/lib/form/Components/LightFilter/componentMap.js +6 -4
  72. package/lib/form/Components/LightFilter/index.d.ts +1 -0
  73. package/lib/form/Components/LightFilter/index.js +31 -14
  74. package/lib/form/Components/LightFilter/index.scss +14 -4
  75. package/lib/form/Filter/AdvancedFilter.d.ts +7 -0
  76. package/lib/form/Filter/AdvancedFilter.js +134 -0
  77. package/lib/form/Filter/LightFilter.d.ts +7 -0
  78. package/lib/form/Filter/LightFilter.js +99 -0
  79. package/lib/form/Filter/SimpleFilter.d.ts +7 -0
  80. package/lib/form/Filter/SimpleFilter.js +93 -0
  81. package/lib/form/Filter/index2.js +291 -234
  82. package/lib/form/Filter/index2.scss +3 -0
  83. package/lib/form/ProForm/index.js +10 -6
  84. package/lib/form/ProForm/index.scss +40 -6
  85. package/lib/form/ProForm/useFormDisplayValues.js +3 -1
  86. package/lib/form/SchemaForm/index.js +16 -9
  87. package/lib/form/SchemaForm/initializeDataSource.d.ts +2 -2
  88. package/lib/form/SchemaForm/initializeDataSource.js +4 -11
  89. package/lib/form/SchemaForm/initializeRequest.d.ts +2 -2
  90. package/lib/form/SchemaForm/initializeRequest.js +4 -11
  91. package/lib/form/SchemaForm/initializeRules.d.ts +7 -1
  92. package/lib/form/SchemaForm/initializeRules.js +9 -16
  93. package/lib/form/SchemaForm/reactions.d.ts +5 -5
  94. package/lib/form/SchemaForm/reactions.js +29 -31
  95. package/lib/form/global.scss +1 -0
  96. package/lib/form/typing.d.ts +11 -2
  97. package/lib/form/utils.d.ts +8 -7
  98. package/lib/form/utils.js +6 -5
  99. package/lib/index.d.ts +1 -1
  100. package/lib/index.js +1 -1
  101. package/lib/table/components/Layout/index.js +20 -11
  102. package/lib/table/components/Pagination/index.d.ts +4 -0
  103. package/lib/table/components/Pagination/index.js +174 -0
  104. package/lib/table/components/Pagination/index.scss +22 -0
  105. package/lib/table/components/ToolBar/FilterColumnIcon.js +41 -7
  106. package/lib/table/components/ToolBar/index.scss +17 -6
  107. package/lib/table/index.js +115 -32
  108. package/lib/table/index.scss +7 -1
  109. package/lib/table/typing.d.ts +6 -2
  110. package/lib/table/utils/columnRender.js +2 -1
  111. package/lib/table/utils/index.d.ts +7 -0
  112. package/lib/table/utils/index.js +46 -4
  113. package/package.json +3 -3
@@ -0,0 +1,174 @@
1
+ "use strict";
2
+
3
+ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
4
+
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports.default = void 0;
9
+
10
+ var _react = _interopRequireWildcard(require("react"));
11
+
12
+ var _components = require("@alicloudfe/components");
13
+
14
+ var _utils = require("@teamix/utils");
15
+
16
+ var _hooks = require("@teamix/hooks");
17
+
18
+ require("./index.scss");
19
+
20
+ var _excluded = ["className", "onChange", "total", "totalRender", "pageSize", "current", "pageSizeList", "pageSizeSelector", "type", "onPageSizeChange"];
21
+
22
+ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
23
+
24
+ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
25
+
26
+ 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; }
27
+
28
+ 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; }
29
+
30
+ 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; }
31
+
32
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
33
+
34
+ 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."); }
35
+
36
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
37
+
38
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
39
+
40
+ function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
41
+
42
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
43
+
44
+ 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; }
45
+
46
+ 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; }
47
+
48
+ var cls = (0, _utils.baseClass)('teamix-pro-pagination');
49
+
50
+ var _default = function _default(props) {
51
+ var className = props.className,
52
+ onChange = props.onChange,
53
+ total = props.total,
54
+ totalRender = props.totalRender,
55
+ pageSize = props.pageSize,
56
+ current = props.current,
57
+ pageSizeList = props.pageSizeList,
58
+ pageSizeSelector = props.pageSizeSelector,
59
+ type = props.type,
60
+ onPageSizeChange = props.onPageSizeChange,
61
+ otherProps = _objectWithoutProperties(props, _excluded);
62
+
63
+ var _useResponsiveProps = (0, _hooks.useResponsiveProps)([480, 590, 700], ['mini', 'small', 'simple', 'normal']),
64
+ responsiveProps = _useResponsiveProps.responsiveProps,
65
+ paginationWrapperRef = _useResponsiveProps.ref;
66
+
67
+ var _useState = (0, _react.useState)(false),
68
+ _useState2 = _slicedToArray(_useState, 2),
69
+ visible = _useState2[0],
70
+ setVisible = _useState2[1];
71
+
72
+ var commonPaginationProps = {
73
+ className: className,
74
+ onChange: onChange,
75
+ total: total,
76
+ pageSize: pageSize,
77
+ shape: 'arrow-only',
78
+ pageSizeList: pageSizeList,
79
+ pageSizeSelector: pageSizeSelector,
80
+ pageSizePosition: 'end',
81
+ onPageSizeChange: onPageSizeChange
82
+ };
83
+
84
+ var customTotalRender = function customTotalRender(total) {
85
+ return /*#__PURE__*/_react.default.createElement(_components.Balloon, {
86
+ visible: visible,
87
+ closable: false,
88
+ onVisibleChange: function onVisibleChange(visible) {
89
+ return setVisible(visible);
90
+ },
91
+ align: "t",
92
+ // triggerType="click"
93
+ trigger: /*#__PURE__*/_react.default.createElement(_components.Button, {
94
+ text: true,
95
+ onMouseEnter: function onMouseEnter() {
96
+ return setVisible(true);
97
+ }
98
+ }, (0, _utils.getMessage)('total', {
99
+ total: total
100
+ }))
101
+ }, /*#__PURE__*/_react.default.createElement("div", {
102
+ className: cls('custom-total-content')
103
+ }, /*#__PURE__*/_react.default.createElement("div", {
104
+ className: "title"
105
+ }, (0, _utils.getMessage)('pageSize')), /*#__PURE__*/_react.default.createElement(_components.Select, {
106
+ className: cls('custom-page-size-selector'),
107
+ dataSource: pageSizeList,
108
+ defaultValue: pageSize,
109
+ followTrigger: true,
110
+ menuProps: {
111
+ hasSelectedIcon: false
112
+ },
113
+ onChange: function onChange(value) {
114
+ setVisible(false);
115
+ onPageSizeChange === null || onPageSizeChange === void 0 ? void 0 : onPageSizeChange(value);
116
+ }
117
+ })));
118
+ };
119
+
120
+ var renderPagination = function renderPagination() {
121
+ switch (responsiveProps) {
122
+ case 'normal':
123
+ return /*#__PURE__*/_react.default.createElement(_components.Pagination, _objectSpread(_objectSpread({}, commonPaginationProps), {}, {
124
+ totalRender: function totalRender(total) {
125
+ return (0, _utils.getMessage)('total', {
126
+ total: total
127
+ });
128
+ }
129
+ }, otherProps));
130
+
131
+ case 'simple':
132
+ return /*#__PURE__*/_react.default.createElement(_components.Pagination, _objectSpread(_objectSpread({}, commonPaginationProps), {}, {
133
+ pageShowCount: 3,
134
+ totalRender: function totalRender(total) {
135
+ return (0, _utils.getMessage)('total', {
136
+ total: total
137
+ });
138
+ }
139
+ }, otherProps));
140
+
141
+ case 'small':
142
+ return /*#__PURE__*/_react.default.createElement(_components.Pagination, _objectSpread(_objectSpread({}, commonPaginationProps), {}, {
143
+ pageShowCount: 3,
144
+ pageSizeSelector: false,
145
+ totalRender: function totalRender(total) {
146
+ return customTotalRender(total);
147
+ }
148
+ }, otherProps));
149
+
150
+ case 'mini':
151
+ return /*#__PURE__*/_react.default.createElement(_components.Pagination, _objectSpread(_objectSpread({}, commonPaginationProps), {}, {
152
+ pageSizeSelector: false,
153
+ totalRender: function totalRender(total) {
154
+ return customTotalRender(total);
155
+ },
156
+ type: "simple"
157
+ }, otherProps));
158
+
159
+ default:
160
+ return /*#__PURE__*/_react.default.createElement(_components.Pagination, _objectSpread(_objectSpread({}, commonPaginationProps), otherProps));
161
+ }
162
+ };
163
+
164
+ return (
165
+ /*#__PURE__*/
166
+ // 用于获取翻页器响应式 ref
167
+ _react.default.createElement("div", {
168
+ ref: paginationWrapperRef,
169
+ className: cls('wrapper')
170
+ }, renderPagination())
171
+ );
172
+ };
173
+
174
+ exports.default = _default;
@@ -0,0 +1,22 @@
1
+ $prefix: 'teamix-pro-pagination';
2
+
3
+ .#{$prefix} {
4
+ &-custom-total {
5
+ &-content {
6
+ display: flex;
7
+ align-items: center;
8
+ .next-menu {
9
+ min-width: 56px !important;
10
+ .next-menu-item.next-select-menu-item {
11
+ padding: 0 8px !important;
12
+ }
13
+ }
14
+ }
15
+ }
16
+ &-custom-page-size-selector.next-select-trigger {
17
+ min-width: 56px;
18
+ .next-select-inner {
19
+ min-width: 56px;
20
+ }
21
+ }
22
+ }
@@ -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),
@@ -101,6 +102,26 @@ var FilterColumnIcon = function FilterColumnIcon(props) {
101
102
  dropdownVisible = _useState10[0],
102
103
  setDropdownVisible = _useState10[1];
103
104
 
105
+ (0, _react.useEffect)(function () {
106
+ _utils2.on === null || _utils2.on === void 0 ? void 0 : (0, _utils2.on)(function (stateFilterColumns) {
107
+ if (stateFilterColumns && stateFilterColumns.length > 0) {
108
+ var showDataIndex = stateFilterColumns.map(function (item) {
109
+ return item.dataIndex;
110
+ });
111
+ var stateColumns = (0, _utils2.cloneDeep)(processColumns(columns)).map(function (item) {
112
+ if (!showDataIndex.includes(item.dataIndex)) {
113
+ item.columnFilters = false;
114
+ }
115
+
116
+ return item;
117
+ });
118
+ setNewColumns(stateColumns);
119
+ }
120
+ }, 'refreshFilterState');
121
+ return function () {
122
+ (0, _utils2.off)('refreshFilterState');
123
+ };
124
+ });
104
125
  (0, _react.useEffect)(function () {
105
126
  setNewColumns(processColumns(columns));
106
127
  }, [columns]); // 全选
@@ -212,7 +233,7 @@ var FilterColumnIcon = function FilterColumnIcon(props) {
212
233
 
213
234
  calculateSelectAllState(columns);
214
235
  setNewColumns(columns);
215
- (_actionRef$current = actionRef.current) === null || _actionRef$current === void 0 ? void 0 : (_actionRef$current$se = _actionRef$current.setColumn) === null || _actionRef$current$se === void 0 ? void 0 : _actionRef$current$se.call(_actionRef$current, columns);
236
+ (_actionRef$current = actionRef.current) === null || _actionRef$current === void 0 ? void 0 : (_actionRef$current$se = _actionRef$current.setColumn) === null || _actionRef$current$se === void 0 ? void 0 : _actionRef$current$se.call(_actionRef$current, columns, false);
216
237
  }; // 计算全选状态
217
238
 
218
239
 
@@ -258,7 +279,9 @@ var FilterColumnIcon = function FilterColumnIcon(props) {
258
279
  align: "tr br"
259
280
  }, /*#__PURE__*/_react.default.createElement("div", {
260
281
  className: cls()
261
- }, /*#__PURE__*/_react.default.createElement(_components.Menu, null, /*#__PURE__*/_react.default.createElement(CheckboxItem, {
282
+ }, /*#__PURE__*/_react.default.createElement(_components.Menu, {
283
+ className: cls('all-select')
284
+ }, /*#__PURE__*/_react.default.createElement(CheckboxItem, {
262
285
  indeterminate: indeterminate,
263
286
  checked: allVisible,
264
287
  onChange: onChangeAllColumns
@@ -271,7 +294,9 @@ var FilterColumnIcon = function FilterColumnIcon(props) {
271
294
  type: "primary"
272
295
  }, (0, _utils.getMessage)('reset'))), /*#__PURE__*/_react.default.createElement(_components.Menu.Divider, {
273
296
  key: "divider"
274
- }), newColumns.map(function (_ref9, index) {
297
+ })), /*#__PURE__*/_react.default.createElement(_components.Menu, {
298
+ className: cls('checkbox-group')
299
+ }, newColumns.map(function (_ref9, index) {
275
300
  var _newColumns$find;
276
301
 
277
302
  var dataIndex = _ref9.dataIndex,
@@ -329,7 +354,8 @@ var FilterColumnIcon = function FilterColumnIcon(props) {
329
354
  onOk: onChangeColumnsForDialog,
330
355
  onCancel: dialogOnClose,
331
356
  onClose: dialogOnClose,
332
- width: 480
357
+ width: 480,
358
+ className: cls('dialog')
333
359
  }, /*#__PURE__*/_react.default.createElement(Row, {
334
360
  gutter: 20,
335
361
  wrap: true,
@@ -361,12 +387,20 @@ var FilterColumnIcon = function FilterColumnIcon(props) {
361
387
  },
362
388
  disabled: columnFiltersDisabled
363
389
  }, /*#__PURE__*/_react.default.createElement(_utils.Ellipsis, {
364
- tooltip: false
390
+ tooltip: title
365
391
  }, title)));
366
392
  }))));
367
393
  };
368
394
 
369
- if (newColumns.length > 10) {
395
+ if (filterColumnType === 'dialog') {
396
+ return renderDialog();
397
+ }
398
+
399
+ if (filterColumnType === 'dropdown') {
400
+ return renderDropdown();
401
+ }
402
+
403
+ if (newColumns.length >= 20) {
370
404
  return renderDialog();
371
405
  }
372
406
 
@@ -18,10 +18,14 @@
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);
23
+
24
+ &-dialog {
25
+ .next-checkbox-label {
26
+ line-height: var(--checkbox-size,16px);
27
+ }
28
+ }
25
29
  &-reset {
26
30
  position: absolute;
27
31
  right: 16px;
@@ -40,7 +44,6 @@
40
44
  visibility: visible;
41
45
  cursor: pointer;
42
46
  }
43
-
44
47
  }
45
48
  }
46
49
  .next-menu-item-text {
@@ -76,6 +79,14 @@
76
79
  align-items: center;
77
80
  }
78
81
  }
82
+ .teamix-pro-table-toolbar-filter-column-all-select.teamix-pro-table-toolbar-filter-column-all-select {
83
+ padding-bottom: 0;
84
+ }
85
+ .teamix-pro-table-toolbar-filter-column-checkbox-group.teamix-pro-table-toolbar-filter-column-checkbox-group {
86
+ padding-top: 0;
87
+ max-height: 310px;
88
+ overflow: auto;
89
+ }
79
90
 
80
91
  // fullscreen
81
92
  .teamix-pro-table-full-screen {
@@ -88,7 +99,7 @@
88
99
  background-color: var(--balloon-tooltip-color-bg, #292929);
89
100
  border-color: var(--balloon-tooltip-color-border, transparent);
90
101
  box-shadow: var(--balloon-tooltip-shadow, none);
91
- color: var(--balloon-tooltip-color, #FFFFFF);
102
+ color: var(--balloon-tooltip-color, #ffffff);
92
103
  display: flex;
93
104
  align-items: center;
94
105
  height: 36px;
@@ -99,7 +110,7 @@
99
110
  display: none;
100
111
  }
101
112
  .next-message-content {
102
- color: var(--balloon-tooltip-color, #FFFFFF);
113
+ color: var(--balloon-tooltip-color, #ffffff);
103
114
  padding: 0;
104
115
  }
105
116
  .teamix-pro-table-full-screen-message-esc {
@@ -108,7 +119,7 @@
108
119
  padding: 0 2px;
109
120
  position: relative;
110
121
  // box-shadow: inset 0 0 1px 1px var(--color-fill1-1);
111
- border: 1px solid var(--balloon-tooltip-color, #FFFFFF);
122
+ border: 1px solid var(--balloon-tooltip-color, #ffffff);
112
123
  display: inline-block;
113
124
  line-height: 1;
114
125
  &-title {
@@ -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,38 @@ 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
+ var _initialColumns$;
113
+
114
+ if ((filterColumns === null || filterColumns === void 0 ? void 0 : filterColumns.length) === 1) {
115
+ var _filterColumns$, _filterColumns$2;
116
+
117
+ if ((_filterColumns$ = filterColumns[0]) === null || _filterColumns$ === void 0 ? void 0 : _filterColumns$.width) {
118
+ delete filterColumns[0].width;
119
+ }
120
+
121
+ if ((_filterColumns$2 = filterColumns[0]) === null || _filterColumns$2 === void 0 ? void 0 : _filterColumns$2.lock) {
122
+ filterColumns[0].lock = false;
123
+ }
124
+ } else if (((_initialColumns$ = initialColumns[0]) === null || _initialColumns$ === void 0 ? void 0 : _initialColumns$.columnFilters) !== false) {
125
+ var _initialColumns$2, _initialColumns$3;
126
+
127
+ if ((_initialColumns$2 = initialColumns[0]) === null || _initialColumns$2 === void 0 ? void 0 : _initialColumns$2.width) {
128
+ filterColumns[0].width = initialColumns[0].width;
129
+ }
130
+
131
+ if ((_initialColumns$3 = initialColumns[0]) === null || _initialColumns$3 === void 0 ? void 0 : _initialColumns$3.lock) {
132
+ filterColumns[0].lock = initialColumns[0].lock;
133
+ }
134
+ }
135
+ }
136
+
137
+ return filterColumns;
110
138
  };
111
139
  /** 默认请求翻页参数 */
112
140
 
@@ -176,6 +204,8 @@ var ProTable = function ProTable(props) {
176
204
  return false;
177
205
  } : _props$autoRefresh,
178
206
  customRequest = props.customRequest,
207
+ _props$filterColumnTy = props.filterColumnType,
208
+ filterColumnType = _props$filterColumnTy === void 0 ? 'auto' : _props$filterColumnTy,
179
209
  otherProps = _objectWithoutProperties(props, _excluded);
180
210
 
181
211
  var targetPageKey = pageKey || globalPageKey;
@@ -207,7 +237,7 @@ var ProTable = function ProTable(props) {
207
237
  sort = _useState10[0],
208
238
  setSort = _useState10[1];
209
239
 
210
- var _useState11 = (0, _react.useState)(requestWhenMount && propsShowSkeleton),
240
+ var _useState11 = (0, _react.useState)(!propsDataSource && requestWhenMount && propsShowSkeleton),
211
241
  _useState12 = _slicedToArray(_useState11, 2),
212
242
  showSkeleton = _useState12[0],
213
243
  setShowSkeleton = _useState12[1]; // 首次加载,渲染骨架屏
@@ -219,12 +249,14 @@ var ProTable = function ProTable(props) {
219
249
  var _useState13 = (0, _react.useState)(true),
220
250
  _useState14 = _slicedToArray(_useState13, 2),
221
251
  customTableLoading = _useState14[0],
222
- setCustomTableLoading = _useState14[1];
252
+ setCustomTableLoading = _useState14[1]; // 用于存放 Search 组件之前值的 ref
253
+
223
254
 
255
+ var searchValueRef = (0, _react.useRef)('');
224
256
  var tableRef = (0, _react.useRef)(null);
225
257
  var actionRef = (0, _react.useRef)(); // 传给 table 的过滤后的 columns
226
258
 
227
- var _useState15 = (0, _react.useState)(processColumns(propsColumns !== null && propsColumns !== void 0 ? propsColumns : [])),
259
+ var _useState15 = (0, _react.useState)(processColumns(propsColumns !== null && propsColumns !== void 0 ? propsColumns : [], propsColumns)),
228
260
  _useState16 = _slicedToArray(_useState15, 2),
229
261
  filteredColumns = _useState16[0],
230
262
  setFilteredColumns = _useState16[1];
@@ -395,10 +427,16 @@ var ProTable = function ProTable(props) {
395
427
  (0, _react.useEffect)(function () {
396
428
  var _actionRef$current, _actionRef$current$se;
397
429
 
398
- var columns = processColumns(propsColumns !== null && propsColumns !== void 0 ? propsColumns : []);
430
+ var columns = processColumns(propsColumns !== null && propsColumns !== void 0 ? propsColumns : [], propsColumns);
399
431
  setFilteredColumns(columns);
400
432
  (_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
433
+ }, [propsColumns]); // dataSource 受控
434
+
435
+ (0, _react.useEffect)(function () {
436
+ if (propsDataSource) {
437
+ setData(propsDataSource);
438
+ }
439
+ }, [propsDataSource]); // 绑定 Actions
402
440
 
403
441
  (0, _utils2.useActionType)(actionRef, {
404
442
  fullScreen: function fullScreen() {
@@ -413,9 +451,14 @@ var ProTable = function ProTable(props) {
413
451
  setColumn: function setColumn(newColumns) {
414
452
  var _actionRef$current2, _actionRef$current2$s;
415
453
 
416
- var columns = processColumns(newColumns);
454
+ var update = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
455
+ var columns = processColumns(newColumns, propsColumns);
417
456
  setFilteredColumns(columns);
418
457
  (_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);
458
+
459
+ if (update) {
460
+ (0, _utils2.emit)('refreshFilterState', newColumns);
461
+ }
419
462
  },
420
463
  setSize: function setSize(mode) {
421
464
  _setSize(mode);
@@ -619,10 +662,8 @@ var ProTable = function ProTable(props) {
619
662
  }
620
663
 
621
664
  (0, _react.useEffect)(function () {
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); // 监听 浏览器变化 更吸底状态
665
+ // 初始化 actionRef state、callback 此时 actionRef 已初始化完成
666
+ (0, _utils2.initActionRef)(); // 监听 浏览器变化 更吸底状态
626
667
 
627
668
  if (footerSuction) {
628
669
  getFooterSuctionState();
@@ -636,6 +677,14 @@ var ProTable = function ProTable(props) {
636
677
  _request();
637
678
  }
638
679
 
680
+ var searchName = getSearchName();
681
+
682
+ if (searchName) {
683
+ // 如果有初始值,需要赋值
684
+ var initialValues = toJS(dataFilterForm.initialValues);
685
+ searchValueRef.current = initialValues[searchName][1];
686
+ }
687
+
639
688
  return function () {
640
689
  if (autoRefreshTimerRef.current) {
641
690
  clearTimeout(autoRefreshTimerRef.current);
@@ -655,22 +704,55 @@ var ProTable = function ProTable(props) {
655
704
  setSort(nextSort);
656
705
 
657
706
  _request(targetFormatSort(nextSort));
658
- } // 处理 dataFilter 中的 onFilter、onReset
707
+ } // 找到 Search 组件对应的 name
708
+
709
+
710
+ var getSearchName = function getSearchName() {
711
+ var _dataFilter$schema;
659
712
 
713
+ if ((dataFilter === null || dataFilter === void 0 ? void 0 : dataFilter.schema) && ((_dataFilter$schema = dataFilter.schema) === null || _dataFilter$schema === void 0 ? void 0 : _dataFilter$schema.length) > 0) {
714
+ var searchSchema = dataFilter.schema.find(function (item) {
715
+ return item.component === 'Search';
716
+ });
660
717
 
661
- var dataFilter = _objectSpread(_objectSpread({}, propsDataFilter), {}, {
662
- onFilter: (0, _lodash.default)(function () {
663
- (propsDataFilter === null || propsDataFilter === void 0 ? void 0 : propsDataFilter.onFilter) && (propsDataFilter === null || propsDataFilter === void 0 ? void 0 : propsDataFilter.onFilter(_objectSpread({}, toJS(dataFilterForm.values))));
718
+ if (searchSchema) {
719
+ var searchName = searchSchema.name;
720
+ return searchName;
721
+ }
722
+ }
723
+ }; // 处理 dataFilter 中的 onFilter、onReset
724
+
725
+
726
+ var dataFilter = _objectSpread(_objectSpread({
727
+ mode: 'inline'
728
+ }, propsDataFilter), {}, {
729
+ onFilter: (0, _lodash.default)(function (values) {
730
+ (propsDataFilter === null || propsDataFilter === void 0 ? void 0 : propsDataFilter.onFilter) && (propsDataFilter === null || propsDataFilter === void 0 ? void 0 : propsDataFilter.onFilter(values));
664
731
 
665
732
  if (dataFilterForm.validate()) {
666
- var _actionRef$current6, _actionRef$current6$c;
733
+ var _actionRef$current5, _actionRef$current5$c;
734
+
735
+ /**
736
+ * 针对 inline 模式下的 Search 组件做特殊处理
737
+ * 当切换条件且输入内容为空的时候,类似[a, ''] => [b, ''] 不触发请求
738
+ */
739
+ if (dataFilter.mode === 'inline') {
740
+ var searchName = getSearchName();
741
+
742
+ if (searchName) {
743
+ var searchValue = values[searchName][1];
744
+
745
+ if (searchValue === (searchValueRef === null || searchValueRef === void 0 ? void 0 : searchValueRef.current)) {
746
+ return;
747
+ }
667
748
 
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);
670
- setCurrentPage(1); // const { mode, schema } = propsDataFilter as ProTableDataFilterProps;
671
- // TODO: 针对 inline 模式下的 search 组件做一下处理,如果空值切换下拉的时候不触发请求
672
- // if (mode === 'inline') {
673
- // }
749
+ searchValueRef.current = searchValue;
750
+ }
751
+ } // 搜索变化时,暂时先清空选择
752
+
753
+
754
+ (_actionRef$current5 = actionRef.current) === null || _actionRef$current5 === void 0 ? void 0 : (_actionRef$current5$c = _actionRef$current5.clearRowSelection) === null || _actionRef$current5$c === void 0 ? void 0 : _actionRef$current5$c.call(_actionRef$current5);
755
+ setCurrentPage(1);
674
756
 
675
757
  _request(_defineProperty({}, targetPageKey, 1));
676
758
  }
@@ -705,7 +787,8 @@ var ProTable = function ProTable(props) {
705
787
  columns: propsColumns,
706
788
  dataFilter: dataFilter,
707
789
  dataFilterForm: dataFilterForm,
708
- rowSelection: rowSelection
790
+ rowSelection: rowSelection,
791
+ filterColumnType: filterColumnType
709
792
  }), /*#__PURE__*/_react.default.createElement(_components.Table.StickyLock, _objectSpread({
710
793
  hasBorder: false,
711
794
  dataSource: showSkeleton ? skeletonDataSource : data || props.dataSource,
@@ -763,21 +846,21 @@ var ProTable = function ProTable(props) {
763
846
 
764
847
  var renderFooter = function renderFooter() {
765
848
  function onChangePagination(currentPage) {
766
- var _actionRef$current7, _actionRef$current7$c;
849
+ var _actionRef$current6, _actionRef$current6$c;
767
850
 
768
851
  var params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
769
852
  // 翻页暂时先清空选择
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);
853
+ (_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);
771
854
  setCurrentPage(currentPage);
772
855
 
773
856
  _request(_objectSpread(_defineProperty({}, targetPageKey, currentPage), params));
774
857
  }
775
858
 
776
859
  function onChangePaginationSize(currentPageSize) {
777
- var _actionRef$current8, _actionRef$current8$c, _request5;
860
+ var _actionRef$current7, _actionRef$current7$c, _request5;
778
861
 
779
862
  // 翻页暂时先清空选择
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);
863
+ (_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);
781
864
  setPageSize(currentPageSize);
782
865
  setCurrentPage(1);
783
866
 
@@ -817,6 +900,8 @@ var ProTable = function ProTable(props) {
817
900
  return onChangePagination(number);
818
901
  },
819
902
  total: total,
903
+ shape: "arrow-only",
904
+ pageSizePosition: "end",
820
905
  totalRender: function totalRender(total) {
821
906
  return (0, _utils.getMessage)('total', {
822
907
  total: total
@@ -824,10 +909,8 @@ var ProTable = function ProTable(props) {
824
909
  },
825
910
  pageSize: pageSize,
826
911
  current: currentPage,
827
- shape: "arrow-only",
828
912
  pageSizeList: pageSizeList,
829
913
  pageSizeSelector: total > (props.pageSize || 10) * 2 ? 'dropdown' : false,
830
- pageSizePosition: "end",
831
914
  type: total / pageSize <= 2 ? 'simple' : 'normal',
832
915
  onPageSizeChange: function onPageSizeChange(number) {
833
916
  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
+ .teamix-pro-pagination-wrapper {
44
+ display: flex;
45
+ justify-content: flex-end;
46
+ width: 100%;
41
47
  }
42
48
  &-footer-action {
43
49
  margin-left: 16px;