@teamix/pro 1.2.21 → 1.2.26

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 (105) hide show
  1. package/dist/pro.css +1 -1
  2. package/dist/pro.js +4849 -2339
  3. package/dist/pro.min.css +1 -1
  4. package/dist/pro.min.js +1 -1
  5. package/es/actions/dialog.js +14 -24
  6. package/es/actions/index.d.ts +22 -8
  7. package/es/actions/index.js +69 -29
  8. package/es/actions/index.scss +12 -1
  9. package/es/form/Components/SelectTable/index.d.ts +24 -0
  10. package/es/form/Components/SelectTable/index.js +135 -0
  11. package/es/form/Components/SelectTable/index.scss +28 -0
  12. package/es/form/Components/SelectTable/table.d.ts +6 -0
  13. package/es/form/Components/SelectTable/table.js +64 -0
  14. package/es/form/Filter/AdvancedFilter.js +1 -0
  15. package/es/form/ProForm/index.scss +37 -6
  16. package/es/form/SchemaForm/index.js +8 -6
  17. package/es/form/SchemaForm/initializeDataSource.d.ts +1 -1
  18. package/es/form/SchemaForm/initializeDataSource.js +2 -2
  19. package/es/form/SchemaForm/initializeRequest.d.ts +1 -1
  20. package/es/form/SchemaForm/initializeRequest.js +2 -2
  21. package/es/form/SchemaForm/initializeRules.d.ts +1 -1
  22. package/es/form/SchemaForm/initializeRules.js +3 -3
  23. package/es/form/global.scss +1 -0
  24. package/es/form/utils.d.ts +2 -2
  25. package/es/form/utils.js +2 -2
  26. package/es/index.d.ts +5 -2
  27. package/es/index.js +6 -3
  28. package/es/step/ProStepItem/components/HozStepItem/index.d.ts +5 -0
  29. package/es/step/ProStepItem/components/HozStepItem/index.js +235 -0
  30. package/es/step/ProStepItem/components/HozStepItem/index.scss +279 -0
  31. package/es/step/ProStepItem/components/VerStepItem/index.d.ts +5 -0
  32. package/es/step/ProStepItem/components/VerStepItem/index.js +295 -0
  33. package/es/step/ProStepItem/components/VerStepItem/index.scss +287 -0
  34. package/es/step/ProStepItem/index.d.ts +4 -0
  35. package/es/step/ProStepItem/index.js +57 -0
  36. package/es/step/index.d.ts +9 -0
  37. package/es/step/index.js +101 -0
  38. package/es/step/typing.d.ts +96 -0
  39. package/es/step/typing.js +1 -0
  40. package/es/table/components/Filter/index.js +2 -17
  41. package/es/table/components/Layout/index.js +22 -12
  42. package/es/table/components/Pagination/index.d.ts +5 -1
  43. package/es/table/components/Pagination/index.js +179 -17
  44. package/es/table/components/Pagination/index.scss +55 -0
  45. package/es/table/components/ToolBar/FilterColumnIcon.js +24 -3
  46. package/es/table/components/ToolBar/index.scss +9 -4
  47. package/es/table/index.js +84 -27
  48. package/es/table/index.scss +5 -5
  49. package/es/table/typing.d.ts +11 -2
  50. package/es/table/utils/columnRender.js +2 -1
  51. package/es/table/utils/index.d.ts +14 -0
  52. package/es/table/utils/index.js +74 -4
  53. package/es/utils/index.d.ts +1 -0
  54. package/es/utils/index.js +1 -0
  55. package/lib/actions/dialog.js +13 -23
  56. package/lib/actions/index.d.ts +22 -8
  57. package/lib/actions/index.js +69 -29
  58. package/lib/actions/index.scss +12 -1
  59. package/lib/form/Components/SelectTable/index.d.ts +24 -0
  60. package/lib/form/Components/SelectTable/index.js +157 -0
  61. package/lib/form/Components/SelectTable/index.scss +28 -0
  62. package/lib/form/Components/SelectTable/table.d.ts +6 -0
  63. package/lib/form/Components/SelectTable/table.js +76 -0
  64. package/lib/form/Filter/AdvancedFilter.js +1 -0
  65. package/lib/form/ProForm/index.scss +37 -6
  66. package/lib/form/SchemaForm/index.js +8 -6
  67. package/lib/form/SchemaForm/initializeDataSource.d.ts +1 -1
  68. package/lib/form/SchemaForm/initializeDataSource.js +2 -2
  69. package/lib/form/SchemaForm/initializeRequest.d.ts +1 -1
  70. package/lib/form/SchemaForm/initializeRequest.js +2 -2
  71. package/lib/form/SchemaForm/initializeRules.d.ts +1 -1
  72. package/lib/form/SchemaForm/initializeRules.js +3 -3
  73. package/lib/form/global.scss +1 -0
  74. package/lib/form/utils.d.ts +2 -2
  75. package/lib/form/utils.js +2 -2
  76. package/lib/index.d.ts +5 -2
  77. package/lib/index.js +35 -3
  78. package/lib/step/ProStepItem/components/HozStepItem/index.d.ts +5 -0
  79. package/lib/step/ProStepItem/components/HozStepItem/index.js +258 -0
  80. package/lib/step/ProStepItem/components/HozStepItem/index.scss +279 -0
  81. package/lib/step/ProStepItem/components/VerStepItem/index.d.ts +5 -0
  82. package/lib/step/ProStepItem/components/VerStepItem/index.js +315 -0
  83. package/lib/step/ProStepItem/components/VerStepItem/index.scss +287 -0
  84. package/lib/step/ProStepItem/index.d.ts +4 -0
  85. package/lib/step/ProStepItem/index.js +69 -0
  86. package/lib/step/index.d.ts +9 -0
  87. package/lib/step/index.js +124 -0
  88. package/lib/step/typing.d.ts +96 -0
  89. package/lib/step/typing.js +5 -0
  90. package/lib/table/components/Filter/index.js +2 -17
  91. package/lib/table/components/Layout/index.js +21 -11
  92. package/lib/table/components/Pagination/index.d.ts +5 -1
  93. package/lib/table/components/Pagination/index.js +186 -17
  94. package/lib/table/components/Pagination/index.scss +55 -0
  95. package/lib/table/components/ToolBar/FilterColumnIcon.js +23 -2
  96. package/lib/table/components/ToolBar/index.scss +9 -4
  97. package/lib/table/index.js +84 -25
  98. package/lib/table/index.scss +5 -5
  99. package/lib/table/typing.d.ts +11 -2
  100. package/lib/table/utils/columnRender.js +2 -1
  101. package/lib/table/utils/index.d.ts +14 -0
  102. package/lib/table/utils/index.js +84 -4
  103. package/lib/utils/index.d.ts +1 -0
  104. package/lib/utils/index.js +13 -0
  105. package/package.json +1 -1
@@ -102,6 +102,26 @@ var FilterColumnIcon = function FilterColumnIcon(props) {
102
102
  dropdownVisible = _useState10[0],
103
103
  setDropdownVisible = _useState10[1];
104
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
+ });
105
125
  (0, _react.useEffect)(function () {
106
126
  setNewColumns(processColumns(columns));
107
127
  }, [columns]); // 全选
@@ -213,7 +233,7 @@ var FilterColumnIcon = function FilterColumnIcon(props) {
213
233
 
214
234
  calculateSelectAllState(columns);
215
235
  setNewColumns(columns);
216
- (_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);
217
237
  }; // 计算全选状态
218
238
 
219
239
 
@@ -334,7 +354,8 @@ var FilterColumnIcon = function FilterColumnIcon(props) {
334
354
  onOk: onChangeColumnsForDialog,
335
355
  onCancel: dialogOnClose,
336
356
  onClose: dialogOnClose,
337
- width: 480
357
+ width: 480,
358
+ className: cls('dialog')
338
359
  }, /*#__PURE__*/_react.default.createElement(Row, {
339
360
  gutter: 20,
340
361
  wrap: true,
@@ -20,6 +20,12 @@
20
20
  min-width: 180px;
21
21
  box-shadow: var(--popup-local-shadow, 0px 6px 24px 0px rgba(0, 0, 0, 0.1));
22
22
  background: var(--menu-background);
23
+
24
+ &-dialog {
25
+ .next-checkbox-label {
26
+ line-height: var(--checkbox-size,16px);
27
+ }
28
+ }
23
29
  &-reset {
24
30
  position: absolute;
25
31
  right: 16px;
@@ -38,7 +44,6 @@
38
44
  visibility: visible;
39
45
  cursor: pointer;
40
46
  }
41
-
42
47
  }
43
48
  }
44
49
  .next-menu-item-text {
@@ -94,7 +99,7 @@
94
99
  background-color: var(--balloon-tooltip-color-bg, #292929);
95
100
  border-color: var(--balloon-tooltip-color-border, transparent);
96
101
  box-shadow: var(--balloon-tooltip-shadow, none);
97
- color: var(--balloon-tooltip-color, #FFFFFF);
102
+ color: var(--balloon-tooltip-color, #ffffff);
98
103
  display: flex;
99
104
  align-items: center;
100
105
  height: 36px;
@@ -105,7 +110,7 @@
105
110
  display: none;
106
111
  }
107
112
  .next-message-content {
108
- color: var(--balloon-tooltip-color, #FFFFFF);
113
+ color: var(--balloon-tooltip-color, #ffffff);
109
114
  padding: 0;
110
115
  }
111
116
  .teamix-pro-table-full-screen-message-esc {
@@ -114,7 +119,7 @@
114
119
  padding: 0 2px;
115
120
  position: relative;
116
121
  // box-shadow: inset 0 0 1px 1px var(--color-fill1-1);
117
- border: 1px solid var(--balloon-tooltip-color, #FFFFFF);
122
+ border: 1px solid var(--balloon-tooltip-color, #ffffff);
118
123
  display: inline-block;
119
124
  line-height: 1;
120
125
  &-title {
@@ -10,6 +10,8 @@ var _react = _interopRequireWildcard(require("react"));
10
10
 
11
11
  var _components = require("@alicloudfe/components");
12
12
 
13
+ var _Pagination = _interopRequireDefault(require("./components/Pagination"));
14
+
13
15
  var _genProColumnToColumn = _interopRequireDefault(require("./utils/genProColumnToColumn"));
14
16
 
15
17
  var _utils = require("@teamix/utils");
@@ -55,7 +57,7 @@ Object.keys(_typing).forEach(function (key) {
55
57
  }
56
58
  });
57
59
  });
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"];
60
+ 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", "responsivePaginationType", "showSkeleton", "skeletonSize", "actionRef", "dataSource", "filterDebounce", "footerSuction", "autoRefresh", "customRequest", "filterColumnType", "defaultFilterParams"];
59
61
 
60
62
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
61
63
 
@@ -109,6 +111,8 @@ var processColumns = function processColumns(columns, initialColumns) {
109
111
  }); // 处理只剩一列批量选择的情况下宽度错乱问题
110
112
 
111
113
  if (filterColumns === null || filterColumns === void 0 ? void 0 : filterColumns.length) {
114
+ var _initialColumns$;
115
+
112
116
  if ((filterColumns === null || filterColumns === void 0 ? void 0 : filterColumns.length) === 1) {
113
117
  var _filterColumns$, _filterColumns$2;
114
118
 
@@ -119,14 +123,14 @@ var processColumns = function processColumns(columns, initialColumns) {
119
123
  if ((_filterColumns$2 = filterColumns[0]) === null || _filterColumns$2 === void 0 ? void 0 : _filterColumns$2.lock) {
120
124
  filterColumns[0].lock = false;
121
125
  }
122
- } else {
123
- var _initialColumns$, _initialColumns$2;
126
+ } else if (((_initialColumns$ = initialColumns[0]) === null || _initialColumns$ === void 0 ? void 0 : _initialColumns$.columnFilters) !== false) {
127
+ var _initialColumns$2, _initialColumns$3;
124
128
 
125
- if ((_initialColumns$ = initialColumns[0]) === null || _initialColumns$ === void 0 ? void 0 : _initialColumns$.width) {
129
+ if ((_initialColumns$2 = initialColumns[0]) === null || _initialColumns$2 === void 0 ? void 0 : _initialColumns$2.width) {
126
130
  filterColumns[0].width = initialColumns[0].width;
127
131
  }
128
132
 
129
- if ((_initialColumns$2 = initialColumns[0]) === null || _initialColumns$2 === void 0 ? void 0 : _initialColumns$2.lock) {
133
+ if ((_initialColumns$3 = initialColumns[0]) === null || _initialColumns$3 === void 0 ? void 0 : _initialColumns$3.lock) {
130
134
  filterColumns[0].lock = initialColumns[0].lock;
131
135
  }
132
136
  }
@@ -187,6 +191,7 @@ var ProTable = function ProTable(props) {
187
191
  showPagination = _props$showPagination === void 0 ? true : _props$showPagination,
188
192
  _props$pageSizeList = props.pageSizeList,
189
193
  pageSizeList = _props$pageSizeList === void 0 ? [5, 10, 20, 50, 100] : _props$pageSizeList,
194
+ responsivePaginationType = props.responsivePaginationType,
190
195
  _props$showSkeleton = props.showSkeleton,
191
196
  propsShowSkeleton = _props$showSkeleton === void 0 ? true : _props$showSkeleton,
192
197
  _props$skeletonSize = props.skeletonSize,
@@ -204,6 +209,7 @@ var ProTable = function ProTable(props) {
204
209
  customRequest = props.customRequest,
205
210
  _props$filterColumnTy = props.filterColumnType,
206
211
  filterColumnType = _props$filterColumnTy === void 0 ? 'auto' : _props$filterColumnTy,
212
+ defaultFilterParams = props.defaultFilterParams,
207
213
  otherProps = _objectWithoutProperties(props, _excluded);
208
214
 
209
215
  var targetPageKey = pageKey || globalPageKey;
@@ -247,8 +253,10 @@ var ProTable = function ProTable(props) {
247
253
  var _useState13 = (0, _react.useState)(true),
248
254
  _useState14 = _slicedToArray(_useState13, 2),
249
255
  customTableLoading = _useState14[0],
250
- setCustomTableLoading = _useState14[1];
256
+ setCustomTableLoading = _useState14[1]; // 用于存放 Search 组件之前值的 ref
257
+
251
258
 
259
+ var searchValueRef = (0, _react.useRef)('');
252
260
  var tableRef = (0, _react.useRef)(null);
253
261
  var actionRef = (0, _react.useRef)(); // 传给 table 的过滤后的 columns
254
262
 
@@ -447,9 +455,14 @@ var ProTable = function ProTable(props) {
447
455
  setColumn: function setColumn(newColumns) {
448
456
  var _actionRef$current2, _actionRef$current2$s;
449
457
 
458
+ var update = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
450
459
  var columns = processColumns(newColumns, propsColumns);
451
460
  setFilteredColumns(columns);
452
461
  (_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);
462
+
463
+ if (update) {
464
+ (0, _utils2.emit)('refreshFilterState', newColumns);
465
+ }
453
466
  },
454
467
  setSize: function setSize(mode) {
455
468
  _setSize(mode);
@@ -653,10 +666,8 @@ var ProTable = function ProTable(props) {
653
666
  }
654
667
 
655
668
  (0, _react.useEffect)(function () {
656
- var _actionRef$current5, _actionRef$current5$i;
657
-
658
- // 初始化 state 状态
659
- 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); // 监听 浏览器变化 更吸底状态
669
+ // 初始化 actionRef state、callback 此时 actionRef 已初始化完成
670
+ (0, _utils2.initActionRef)(); // 监听 浏览器变化 更吸底状态
660
671
 
661
672
  if (footerSuction) {
662
673
  getFooterSuctionState();
@@ -667,9 +678,20 @@ var ProTable = function ProTable(props) {
667
678
  }
668
679
 
669
680
  if (requestWhenMount) {
681
+ // 在请求发送之前 处理漏斗默认数据
682
+ (0, _utils2.processDefaultFilter)(propsColumns, actionRef, defaultFilterParams);
683
+
670
684
  _request();
671
685
  }
672
686
 
687
+ var searchName = getSearchName();
688
+
689
+ if (searchName) {
690
+ // 如果有初始值,需要赋值
691
+ var initialValues = toJS(dataFilterForm.initialValues);
692
+ searchValueRef.current = initialValues[searchName][1];
693
+ }
694
+
673
695
  return function () {
674
696
  if (autoRefreshTimerRef.current) {
675
697
  clearTimeout(autoRefreshTimerRef.current);
@@ -689,18 +711,54 @@ var ProTable = function ProTable(props) {
689
711
  setSort(nextSort);
690
712
 
691
713
  _request(targetFormatSort(nextSort));
692
- } // 处理 dataFilter 中的 onFilter、onReset
714
+ } // 找到 Search 组件对应的 name
715
+
716
+
717
+ var getSearchName = function getSearchName() {
718
+ var _dataFilter$schema;
693
719
 
720
+ 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) {
721
+ var searchSchema = dataFilter.schema.find(function (item) {
722
+ return item.component === 'Search';
723
+ });
724
+
725
+ if (searchSchema) {
726
+ var searchName = searchSchema.name;
727
+ return searchName;
728
+ }
729
+ }
730
+ }; // 处理 dataFilter 中的 onFilter、onReset
694
731
 
695
- var dataFilter = _objectSpread(_objectSpread({}, propsDataFilter), {}, {
696
- onFilter: (0, _lodash.default)(function () {
697
- (propsDataFilter === null || propsDataFilter === void 0 ? void 0 : propsDataFilter.onFilter) && (propsDataFilter === null || propsDataFilter === void 0 ? void 0 : propsDataFilter.onFilter(_objectSpread({}, toJS(dataFilterForm.values))));
732
+
733
+ var dataFilter = _objectSpread(_objectSpread({
734
+ mode: 'inline'
735
+ }, propsDataFilter), {}, {
736
+ onFilter: (0, _lodash.default)(function (values) {
737
+ (propsDataFilter === null || propsDataFilter === void 0 ? void 0 : propsDataFilter.onFilter) && (propsDataFilter === null || propsDataFilter === void 0 ? void 0 : propsDataFilter.onFilter(values));
698
738
 
699
739
  if (dataFilterForm.validate()) {
700
- var _actionRef$current6, _actionRef$current6$c;
740
+ var _actionRef$current5, _actionRef$current5$c;
741
+
742
+ /**
743
+ * 针对 inline 模式下的 Search 组件做特殊处理
744
+ * 当切换条件且输入内容为空的时候,类似[a, ''] => [b, ''] 不触发请求
745
+ */
746
+ if (dataFilter.mode === 'inline') {
747
+ var searchName = getSearchName();
748
+
749
+ if (searchName) {
750
+ var searchValue = values[searchName][1];
701
751
 
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);
752
+ if (searchValue === (searchValueRef === null || searchValueRef === void 0 ? void 0 : searchValueRef.current)) {
753
+ return;
754
+ }
755
+
756
+ searchValueRef.current = searchValue;
757
+ }
758
+ } // 搜索变化时,暂时先清空选择
759
+
760
+
761
+ (_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);
704
762
  setCurrentPage(1);
705
763
 
706
764
  _request(_defineProperty({}, targetPageKey, 1));
@@ -777,7 +835,7 @@ var ProTable = function ProTable(props) {
777
835
 
778
836
  var targetActions = footerAction.actions.map(function (action) {
779
837
  return _objectSpread(_objectSpread({}, action), {}, {
780
- disabled: action.disabled || selectedCount === 0
838
+ disabled: (action === null || action === void 0 ? void 0 : action.disabled) || selectedCount === 0
781
839
  });
782
840
  });
783
841
 
@@ -795,21 +853,21 @@ var ProTable = function ProTable(props) {
795
853
 
796
854
  var renderFooter = function renderFooter() {
797
855
  function onChangePagination(currentPage) {
798
- var _actionRef$current7, _actionRef$current7$c;
856
+ var _actionRef$current6, _actionRef$current6$c;
799
857
 
800
858
  var params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
801
859
  // 翻页暂时先清空选择
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);
860
+ (_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);
803
861
  setCurrentPage(currentPage);
804
862
 
805
863
  _request(_objectSpread(_defineProperty({}, targetPageKey, currentPage), params));
806
864
  }
807
865
 
808
866
  function onChangePaginationSize(currentPageSize) {
809
- var _actionRef$current8, _actionRef$current8$c, _request5;
867
+ var _actionRef$current7, _actionRef$current7$c, _request5;
810
868
 
811
869
  // 翻页暂时先清空选择
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);
870
+ (_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);
813
871
  setPageSize(currentPageSize);
814
872
  setCurrentPage(1);
815
873
 
@@ -843,14 +901,15 @@ var ProTable = function ProTable(props) {
843
901
  })
844
902
  }, renderRowSelection(), /*#__PURE__*/_react.default.createElement("div", {
845
903
  className: cls('footer-right-wrapper')
846
- }, showSkeleton ? /*#__PURE__*/_react.default.createElement(_skeleton.ProSkeletonRaw.Footer.Pagination, null) : /*#__PURE__*/_react.default.createElement(_components.Pagination, _objectSpread({
904
+ }, showSkeleton ? /*#__PURE__*/_react.default.createElement(_skeleton.ProSkeletonRaw.Footer.Pagination, null) : /*#__PURE__*/_react.default.createElement(_Pagination.default, _objectSpread({
847
905
  className: cls('pagination'),
848
906
  onChange: function onChange(number) {
849
907
  return onChangePagination(number);
850
908
  },
851
909
  total: total,
852
- shape: "arrow-only",
853
- pageSizePosition: "end",
910
+ responsivePaginationType: responsivePaginationType,
911
+ // shape="arrow-only"
912
+ // pageSizePosition="end"
854
913
  totalRender: function totalRender(total) {
855
914
  return (0, _utils.getMessage)('total', {
856
915
  total: total
@@ -40,11 +40,6 @@ $fullscreenPadding: 24px;
40
40
  justify-content: flex-end;
41
41
  width: 100%;
42
42
  }
43
- .pagination-wrapper {
44
- display: flex;
45
- justify-content: flex-end;
46
- width: 100%;
47
- }
48
43
  &-footer-action {
49
44
  margin-left: 16px;
50
45
  }
@@ -114,4 +109,9 @@ $fullscreenPadding: 24px;
114
109
 
115
110
  .next-table-empty {
116
111
  --table-empty-padding: 48px;
112
+ }
113
+
114
+ // 后面在基础组件里面覆盖
115
+ .next-table.next-table td .next-table-cell-wrapper {
116
+ text-overflow: unset;
117
117
  }
@@ -12,7 +12,7 @@ import React from 'react';
12
12
  import type { Form as FormType } from '@formily/core';
13
13
  declare type IFieldRenderProps = keyof ProFieldRenderProps;
14
14
  /** 列record函数 */
15
- declare type ProTableCellFunProp = (value: any, index: number, record: any) => any;
15
+ declare type ProTableCellFunProp = (value: any, index: number, record: any, ...others: any) => any;
16
16
  declare type ITableCellRender = {
17
17
  [key in IFieldRenderProps]?: ProFieldRenderProps[key] | ProTableCellFunProp;
18
18
  } | ((...other: any) => React.ReactNode);
@@ -22,6 +22,7 @@ declare type TDataService = {
22
22
  /** 表格数据 */
23
23
  data?: any;
24
24
  };
25
+ export declare type responsivePaginationType = 'mini' | 'small' | 'simple' | 'normal';
25
26
  export declare type ProTableColumnProps = {
26
27
  /**
27
28
  * 会在 title 之后展示一个 icon,hover 之后提示一些信息
@@ -92,6 +93,8 @@ export declare type ProTableProps = {
92
93
  paginationProps?: PaginationProps;
93
94
  /** 是否显示翻页器 */
94
95
  showPagination?: boolean;
96
+ /** 手动指定响应式翻页器的 type */
97
+ responsivePaginationType?: responsivePaginationType;
95
98
  /** 是否使用内置的 rowSelection */
96
99
  useRowSelection?: boolean;
97
100
  /** 内置 rowSelection 变化时的回调 */
@@ -122,6 +125,10 @@ export declare type ProTableProps = {
122
125
  data: any[];
123
126
  total?: number;
124
127
  }>;
128
+ /** 默认漏斗过滤条件 */
129
+ defaultFilterParams?: {
130
+ [key: string]: any[] | any;
131
+ };
125
132
  } & Omit<TableProps, 'columns'> & ProTableTopAreaProps;
126
133
  export declare type rowSelectionType = {
127
134
  getProps?: (record: any, index: number) => any;
@@ -146,7 +153,7 @@ export declare type ProTableActionType = {
146
153
  /** 全屏展示 */
147
154
  fullScreen?: () => boolean;
148
155
  /** 设置显示列 */
149
- setColumn?: (newColumns: ProColumnProps[]) => void;
156
+ setColumn?: (newColumns: ProColumnProps[], update?: boolean) => void;
150
157
  /** 设置表格大小 */
151
158
  setSize?: (mode: 'small' | 'medium') => void;
152
159
  /** 刷新表格 */
@@ -220,6 +227,8 @@ export declare type ProTableDataFilterProps = {
220
227
  searchUndefined?: boolean;
221
228
  /** 搜索时是否传入值为空字符串的参数,默认不传 */
222
229
  searchEmptyString?: boolean;
230
+ /** 自定义内容 */
231
+ content?: React.ReactNode;
223
232
  } & IFilterProps;
224
233
  export declare type dataFilterProps = ProTableDataFilterProps;
225
234
  export declare type ProTableTopAreaProps = {
@@ -220,7 +220,8 @@ var processRenderFunction = function processRenderFunction() {
220
220
  var value = arguments.length > 1 ? arguments[1] : undefined;
221
221
  var index = arguments.length > 2 ? arguments[2] : undefined;
222
222
  var record = arguments.length > 3 ? arguments[3] : undefined;
223
- var external = ['linkOnClick', 'link', 'value'];
223
+ // ProField render 类型为 function 时。需要表格预先处理以塞入 record
224
+ var external = ['linkOnClick', 'link', 'value', 'renderEdit', 'descriptionRenderEdit', 'editPopConfirmProps', 'descriptionEditPopConfirmProps', 'editOnClick', 'descriptionEditOnClick'];
224
225
  return Object.fromEntries(Object.entries(render).map(function (_ref3) {
225
226
  var _ref4 = _slicedToArray(_ref3, 2),
226
227
  k = _ref4[0],
@@ -1,4 +1,18 @@
1
1
  /// <reference types="react" />
2
2
  import { ProTableActionType } from '../typing';
3
+ import { ProTableProps, ProTableColumnProps } from '..';
4
+ export declare function initActionRef(): void;
5
+ /** table 组件内监听 不对外暴露 */
6
+ export declare function on(fun: any, key: string): void;
7
+ /** table 组件内销毁监听 不对外暴露 */
8
+ export declare function off(key: string): void;
9
+ /** table 组件内触发事件 不对外暴露 */
10
+ export declare function emit(key: string, ...args: any): void;
3
11
  export declare function useActionType<T>(ref: React.MutableRefObject<ProTableActionType | undefined>, action: ProTableActionType): void;
4
12
  export declare function cloneDeep<T>(obj: T): T;
13
+ /**
14
+ * 处理默认过滤参数
15
+ * @param columns
16
+ * @param ref
17
+ */
18
+ export declare function processDefaultFilter(columns: ProTableColumnProps[], ref: React.MutableRefObject<ProTableActionType | undefined>, defaultFilterParams: ProTableProps['defaultFilterParams']): void;
@@ -4,6 +4,11 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.cloneDeep = cloneDeep;
7
+ exports.emit = emit;
8
+ exports.initActionRef = initActionRef;
9
+ exports.off = off;
10
+ exports.on = on;
11
+ exports.processDefaultFilter = processDefaultFilter;
7
12
  exports.useActionType = useActionType;
8
13
 
9
14
  var _lodash = _interopRequireDefault(require("lodash.clonedeep"));
@@ -28,19 +33,23 @@ function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Sy
28
33
 
29
34
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
30
35
 
31
- // 组件内全局状态
36
+ // 组件内全局状态 每次初始化 ActionRef 会重新深拷贝对象
32
37
  var state = {
33
38
  fullScreenState: false,
34
39
  filterRules: {},
35
40
  filterColumns: []
36
41
  };
37
42
 
38
- var _initState = (0, _lodash.default)(state); // 组件内全局监听事件
43
+ var _initState = (0, _lodash.default)(state); // state监听事件 每次初始化 ActionRef 会重新深拷贝对象
39
44
 
40
45
 
41
46
  var callback = {
42
47
  fullScreenState: {}
43
- }; // 组件内对全局状态的更改
48
+ };
49
+ var initCallback = (0, _lodash.default)(callback); // 所有 ProTable 组件公用一套组件内事件转发机制
50
+
51
+ var tableCallback = {}; // 组件内监听事件
52
+ // 组件内对全局状态的更改
44
53
 
45
54
  var mutations = {
46
55
  getState: function getState() {
@@ -140,7 +149,41 @@ var useOn = function useOn(state) {
140
149
  }
141
150
  });
142
151
  }
143
- };
152
+ }; // 初始化 actionRef
153
+
154
+
155
+ function initActionRef() {
156
+ state = (0, _lodash.default)(_initState);
157
+ callback = (0, _lodash.default)(initCallback);
158
+ }
159
+ /** table 组件内监听 不对外暴露 */
160
+
161
+
162
+ function on(fun, key) {
163
+ tableCallback[key] = fun;
164
+ }
165
+ /** table 组件内销毁监听 不对外暴露 */
166
+
167
+
168
+ function off(key) {
169
+ if (tableCallback[key]) {
170
+ delete tableCallback[key];
171
+ }
172
+ }
173
+ /** table 组件内触发事件 不对外暴露 */
174
+
175
+
176
+ function emit(key) {
177
+ var fun = tableCallback[key];
178
+
179
+ if (fun) {
180
+ for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
181
+ args[_key2 - 1] = arguments[_key2];
182
+ }
183
+
184
+ fun.apply(void 0, args);
185
+ }
186
+ }
144
187
 
145
188
  function useActionType(ref, action) {
146
189
  // 合并自定义事件
@@ -151,4 +194,41 @@ function useActionType(ref, action) {
151
194
 
152
195
  function cloneDeep(obj) {
153
196
  return (0, _lodash.default)(obj);
197
+ }
198
+ /**
199
+ * 处理默认过滤参数
200
+ * @param columns
201
+ * @param ref
202
+ */
203
+
204
+
205
+ function processDefaultFilter(columns, ref, defaultFilterParams) {
206
+ columns.forEach(function (column) {
207
+ var _column$dataIndex$toS, _column$dataIndex;
208
+
209
+ var defaultRules = defaultFilterParams === null || defaultFilterParams === void 0 ? void 0 : defaultFilterParams[(_column$dataIndex$toS = column === null || column === void 0 ? void 0 : (_column$dataIndex = column.dataIndex) === null || _column$dataIndex === void 0 ? void 0 : _column$dataIndex.toString()) !== null && _column$dataIndex$toS !== void 0 ? _column$dataIndex$toS : ''];
210
+
211
+ if (defaultRules) {
212
+ var _ref$current$getState, _ref$current, _ref$current$getState2, _ref$current$getState3, _ref$current2, _ref$current2$setFilt;
213
+
214
+ var params = '';
215
+ var rules = [];
216
+
217
+ if (Array.isArray(defaultRules)) {
218
+ params = defaultRules.join(',');
219
+ rules = defaultRules;
220
+ } else {
221
+ params = defaultRules;
222
+ rules = [defaultRules];
223
+ } // 需要带上其他所有的信息
224
+
225
+
226
+ var otherRules = (_ref$current$getState = (_ref$current = ref.current) === null || _ref$current === void 0 ? void 0 : (_ref$current$getState2 = _ref$current.getState) === null || _ref$current$getState2 === void 0 ? void 0 : (_ref$current$getState3 = _ref$current$getState2.call(_ref$current)) === null || _ref$current$getState3 === void 0 ? void 0 : _ref$current$getState3.filterRules) !== null && _ref$current$getState !== void 0 ? _ref$current$getState : {}; // 再设置所有的列筛选状态
227
+
228
+ (_ref$current2 = ref.current) === null || _ref$current2 === void 0 ? void 0 : (_ref$current2$setFilt = _ref$current2.setFilterRules) === null || _ref$current2$setFilt === void 0 ? void 0 : _ref$current2$setFilt.call(_ref$current2, _objectSpread(_objectSpread({}, otherRules), {}, _defineProperty({}, column.dataIndex, {
229
+ rules: rules,
230
+ params: params
231
+ })));
232
+ }
233
+ });
154
234
  }
@@ -1,2 +1,3 @@
1
1
  import * as utils from '@teamix/utils';
2
+ export * from '@teamix/utils';
2
3
  export default utils;
@@ -5,10 +5,23 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
5
5
  Object.defineProperty(exports, "__esModule", {
6
6
  value: true
7
7
  });
8
+ var _exportNames = {};
8
9
  exports.default = void 0;
9
10
 
10
11
  var utils = _interopRequireWildcard(require("@teamix/utils"));
11
12
 
13
+ Object.keys(utils).forEach(function (key) {
14
+ if (key === "default" || key === "__esModule") return;
15
+ if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
16
+ if (key in exports && exports[key] === utils[key]) return;
17
+ Object.defineProperty(exports, key, {
18
+ enumerable: true,
19
+ get: function get() {
20
+ return utils[key];
21
+ }
22
+ });
23
+ });
24
+
12
25
  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); }
13
26
 
14
27
  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; }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@teamix/pro",
3
- "version": "1.2.21",
3
+ "version": "1.2.26",
4
4
  "description": "TeamixPro大包",
5
5
  "repository": "http://gitlab.alibaba-inc.com/teamix/pro",
6
6
  "author": "Velociraptor(迅猛龙)",