@teamix/pro 1.2.19 → 1.2.23

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 (103) hide show
  1. package/dist/212.js +49 -49
  2. package/dist/pro.css +1 -1
  3. package/dist/pro.js +3400 -880
  4. package/dist/pro.min.css +1 -1
  5. package/dist/pro.min.js +1 -1
  6. package/es/actions/dialog.js +10 -24
  7. package/es/actions/index.d.ts +10 -0
  8. package/es/actions/index.js +11 -16
  9. package/es/form/Components/LightFilter/componentMap.js +2 -1
  10. package/es/form/Components/LightFilter/index.js +16 -4
  11. package/es/form/Components/LightFilter/index.scss +1 -1
  12. package/es/form/Components/SelectTable/index.d.ts +24 -0
  13. package/es/form/Components/SelectTable/index.js +135 -0
  14. package/es/form/Components/SelectTable/index.scss +28 -0
  15. package/es/form/Components/SelectTable/table.d.ts +6 -0
  16. package/es/form/Components/SelectTable/table.js +64 -0
  17. package/es/form/Filter/AdvancedFilter.d.ts +7 -0
  18. package/es/form/Filter/AdvancedFilter.js +114 -0
  19. package/es/form/Filter/LightFilter.d.ts +7 -0
  20. package/es/form/Filter/LightFilter.js +79 -0
  21. package/es/form/Filter/SimpleFilter.d.ts +7 -0
  22. package/es/form/Filter/SimpleFilter.js +74 -0
  23. package/es/form/Filter/index2.js +203 -257
  24. package/es/form/ProForm/index.js +12 -9
  25. package/es/form/ProForm/index.scss +40 -6
  26. package/es/form/ProForm/useFormDisplayValues.js +4 -2
  27. package/es/form/SchemaForm/index.js +16 -10
  28. package/es/form/SchemaForm/initializeDataSource.d.ts +2 -2
  29. package/es/form/SchemaForm/initializeDataSource.js +4 -9
  30. package/es/form/SchemaForm/initializeRequest.d.ts +2 -2
  31. package/es/form/SchemaForm/initializeRequest.js +4 -10
  32. package/es/form/SchemaForm/initializeRules.d.ts +7 -1
  33. package/es/form/SchemaForm/initializeRules.js +9 -13
  34. package/es/form/SchemaForm/reactions.d.ts +5 -5
  35. package/es/form/SchemaForm/reactions.js +27 -29
  36. package/es/form/global.scss +1 -0
  37. package/es/form/typing.d.ts +7 -3
  38. package/es/form/utils.d.ts +8 -7
  39. package/es/form/utils.js +5 -4
  40. package/es/index.d.ts +1 -1
  41. package/es/index.js +1 -1
  42. package/es/table/components/Filter/index.js +1 -0
  43. package/es/table/components/Layout/index.js +22 -12
  44. package/es/table/components/Pagination/index.d.ts +7 -0
  45. package/es/table/components/Pagination/index.js +245 -0
  46. package/es/table/components/Pagination/index.scss +50 -0
  47. package/es/table/components/ToolBar/FilterColumnIcon.js +41 -7
  48. package/es/table/components/ToolBar/index.scss +17 -6
  49. package/es/table/index.js +96 -37
  50. package/es/table/index.scss +7 -1
  51. package/es/table/typing.d.ts +9 -2
  52. package/es/table/utils/columnRender.js +2 -1
  53. package/es/table/utils/index.d.ts +7 -0
  54. package/es/table/utils/index.js +38 -4
  55. package/lib/actions/dialog.js +9 -23
  56. package/lib/actions/index.d.ts +10 -0
  57. package/lib/actions/index.js +11 -16
  58. package/lib/form/Components/LightFilter/componentMap.js +2 -1
  59. package/lib/form/Components/LightFilter/index.js +15 -4
  60. package/lib/form/Components/LightFilter/index.scss +1 -1
  61. package/lib/form/Components/SelectTable/index.d.ts +24 -0
  62. package/lib/form/Components/SelectTable/index.js +157 -0
  63. package/lib/form/Components/SelectTable/index.scss +28 -0
  64. package/lib/form/Components/SelectTable/table.d.ts +6 -0
  65. package/lib/form/Components/SelectTable/table.js +76 -0
  66. package/lib/form/Filter/AdvancedFilter.d.ts +7 -0
  67. package/lib/form/Filter/AdvancedFilter.js +134 -0
  68. package/lib/form/Filter/LightFilter.d.ts +7 -0
  69. package/lib/form/Filter/LightFilter.js +99 -0
  70. package/lib/form/Filter/SimpleFilter.d.ts +7 -0
  71. package/lib/form/Filter/SimpleFilter.js +93 -0
  72. package/lib/form/Filter/index2.js +207 -258
  73. package/lib/form/ProForm/index.js +11 -9
  74. package/lib/form/ProForm/index.scss +40 -6
  75. package/lib/form/ProForm/useFormDisplayValues.js +3 -1
  76. package/lib/form/SchemaForm/index.js +16 -9
  77. package/lib/form/SchemaForm/initializeDataSource.d.ts +2 -2
  78. package/lib/form/SchemaForm/initializeDataSource.js +4 -11
  79. package/lib/form/SchemaForm/initializeRequest.d.ts +2 -2
  80. package/lib/form/SchemaForm/initializeRequest.js +4 -11
  81. package/lib/form/SchemaForm/initializeRules.d.ts +7 -1
  82. package/lib/form/SchemaForm/initializeRules.js +9 -16
  83. package/lib/form/SchemaForm/reactions.d.ts +5 -5
  84. package/lib/form/SchemaForm/reactions.js +29 -31
  85. package/lib/form/global.scss +1 -0
  86. package/lib/form/typing.d.ts +7 -3
  87. package/lib/form/utils.d.ts +8 -7
  88. package/lib/form/utils.js +6 -5
  89. package/lib/index.d.ts +1 -1
  90. package/lib/index.js +1 -1
  91. package/lib/table/components/Layout/index.js +21 -11
  92. package/lib/table/components/Pagination/index.d.ts +7 -0
  93. package/lib/table/components/Pagination/index.js +265 -0
  94. package/lib/table/components/Pagination/index.scss +50 -0
  95. package/lib/table/components/ToolBar/FilterColumnIcon.js +40 -6
  96. package/lib/table/components/ToolBar/index.scss +17 -6
  97. package/lib/table/index.js +96 -36
  98. package/lib/table/index.scss +7 -1
  99. package/lib/table/typing.d.ts +9 -2
  100. package/lib/table/utils/columnRender.js +2 -1
  101. package/lib/table/utils/index.d.ts +7 -0
  102. package/lib/table/utils/index.js +46 -4
  103. package/package.json +2 -2
@@ -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"];
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"];
59
61
 
60
62
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
61
63
 
@@ -108,25 +110,29 @@ var processColumns = function processColumns(columns, initialColumns) {
108
110
  return item.columnFilters !== false;
109
111
  }); // 处理只剩一列批量选择的情况下宽度错乱问题
110
112
 
111
- if ((filterColumns === null || filterColumns === void 0 ? void 0 : filterColumns.length) && (filterColumns === null || filterColumns === void 0 ? void 0 : filterColumns.length) === 1) {
112
- var _filterColumns$, _filterColumns$2;
113
+ if (filterColumns === null || filterColumns === void 0 ? void 0 : filterColumns.length) {
114
+ var _initialColumns$;
113
115
 
114
- if ((_filterColumns$ = filterColumns[0]) === null || _filterColumns$ === void 0 ? void 0 : _filterColumns$.width) {
115
- delete filterColumns[0].width;
116
- }
116
+ if ((filterColumns === null || filterColumns === void 0 ? void 0 : filterColumns.length) === 1) {
117
+ var _filterColumns$, _filterColumns$2;
117
118
 
118
- if ((_filterColumns$2 = filterColumns[0]) === null || _filterColumns$2 === void 0 ? void 0 : _filterColumns$2.lock) {
119
- filterColumns[0].lock = false;
120
- }
121
- } else {
122
- var _initialColumns$, _initialColumns$2;
119
+ if ((_filterColumns$ = filterColumns[0]) === null || _filterColumns$ === void 0 ? void 0 : _filterColumns$.width) {
120
+ delete filterColumns[0].width;
121
+ }
123
122
 
124
- if ((_initialColumns$ = initialColumns[0]) === null || _initialColumns$ === void 0 ? void 0 : _initialColumns$.width) {
125
- filterColumns[0].width = initialColumns[0].width;
126
- }
123
+ if ((_filterColumns$2 = filterColumns[0]) === null || _filterColumns$2 === void 0 ? void 0 : _filterColumns$2.lock) {
124
+ filterColumns[0].lock = false;
125
+ }
126
+ } else if (((_initialColumns$ = initialColumns[0]) === null || _initialColumns$ === void 0 ? void 0 : _initialColumns$.columnFilters) !== false) {
127
+ var _initialColumns$2, _initialColumns$3;
128
+
129
+ if ((_initialColumns$2 = initialColumns[0]) === null || _initialColumns$2 === void 0 ? void 0 : _initialColumns$2.width) {
130
+ filterColumns[0].width = initialColumns[0].width;
131
+ }
127
132
 
128
- if ((_initialColumns$2 = initialColumns[0]) === null || _initialColumns$2 === void 0 ? void 0 : _initialColumns$2.lock) {
129
- filterColumns[0].lock = initialColumns[0].lock;
133
+ if ((_initialColumns$3 = initialColumns[0]) === null || _initialColumns$3 === void 0 ? void 0 : _initialColumns$3.lock) {
134
+ filterColumns[0].lock = initialColumns[0].lock;
135
+ }
130
136
  }
131
137
  }
132
138
 
@@ -185,6 +191,7 @@ var ProTable = function ProTable(props) {
185
191
  showPagination = _props$showPagination === void 0 ? true : _props$showPagination,
186
192
  _props$pageSizeList = props.pageSizeList,
187
193
  pageSizeList = _props$pageSizeList === void 0 ? [5, 10, 20, 50, 100] : _props$pageSizeList,
194
+ responsivePaginationType = props.responsivePaginationType,
188
195
  _props$showSkeleton = props.showSkeleton,
189
196
  propsShowSkeleton = _props$showSkeleton === void 0 ? true : _props$showSkeleton,
190
197
  _props$skeletonSize = props.skeletonSize,
@@ -200,6 +207,8 @@ var ProTable = function ProTable(props) {
200
207
  return false;
201
208
  } : _props$autoRefresh,
202
209
  customRequest = props.customRequest,
210
+ _props$filterColumnTy = props.filterColumnType,
211
+ filterColumnType = _props$filterColumnTy === void 0 ? 'auto' : _props$filterColumnTy,
203
212
  otherProps = _objectWithoutProperties(props, _excluded);
204
213
 
205
214
  var targetPageKey = pageKey || globalPageKey;
@@ -243,8 +252,10 @@ var ProTable = function ProTable(props) {
243
252
  var _useState13 = (0, _react.useState)(true),
244
253
  _useState14 = _slicedToArray(_useState13, 2),
245
254
  customTableLoading = _useState14[0],
246
- setCustomTableLoading = _useState14[1];
255
+ setCustomTableLoading = _useState14[1]; // 用于存放 Search 组件之前值的 ref
247
256
 
257
+
258
+ var searchValueRef = (0, _react.useRef)('');
248
259
  var tableRef = (0, _react.useRef)(null);
249
260
  var actionRef = (0, _react.useRef)(); // 传给 table 的过滤后的 columns
250
261
 
@@ -443,9 +454,14 @@ var ProTable = function ProTable(props) {
443
454
  setColumn: function setColumn(newColumns) {
444
455
  var _actionRef$current2, _actionRef$current2$s;
445
456
 
457
+ var update = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
446
458
  var columns = processColumns(newColumns, propsColumns);
447
459
  setFilteredColumns(columns);
448
460
  (_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);
461
+
462
+ if (update) {
463
+ (0, _utils2.emit)('refreshFilterState', newColumns);
464
+ }
449
465
  },
450
466
  setSize: function setSize(mode) {
451
467
  _setSize(mode);
@@ -649,10 +665,8 @@ var ProTable = function ProTable(props) {
649
665
  }
650
666
 
651
667
  (0, _react.useEffect)(function () {
652
- var _actionRef$current5, _actionRef$current5$i;
653
-
654
- // 初始化 state 状态
655
- 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); // 监听 浏览器变化 更吸底状态
668
+ // 初始化 actionRef state、callback 此时 actionRef 已初始化完成
669
+ (0, _utils2.initActionRef)(); // 监听 浏览器变化 更吸底状态
656
670
 
657
671
  if (footerSuction) {
658
672
  getFooterSuctionState();
@@ -666,6 +680,14 @@ var ProTable = function ProTable(props) {
666
680
  _request();
667
681
  }
668
682
 
683
+ var searchName = getSearchName();
684
+
685
+ if (searchName) {
686
+ // 如果有初始值,需要赋值
687
+ var initialValues = toJS(dataFilterForm.initialValues);
688
+ searchValueRef.current = initialValues[searchName][1];
689
+ }
690
+
669
691
  return function () {
670
692
  if (autoRefreshTimerRef.current) {
671
693
  clearTimeout(autoRefreshTimerRef.current);
@@ -685,18 +707,54 @@ var ProTable = function ProTable(props) {
685
707
  setSort(nextSort);
686
708
 
687
709
  _request(targetFormatSort(nextSort));
688
- } // 处理 dataFilter 中的 onFilter、onReset
710
+ } // 找到 Search 组件对应的 name
689
711
 
690
712
 
691
- var dataFilter = _objectSpread(_objectSpread({}, propsDataFilter), {}, {
692
- onFilter: (0, _lodash.default)(function () {
693
- (propsDataFilter === null || propsDataFilter === void 0 ? void 0 : propsDataFilter.onFilter) && (propsDataFilter === null || propsDataFilter === void 0 ? void 0 : propsDataFilter.onFilter(_objectSpread({}, toJS(dataFilterForm.values))));
713
+ var getSearchName = function getSearchName() {
714
+ var _dataFilter$schema;
715
+
716
+ 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) {
717
+ var searchSchema = dataFilter.schema.find(function (item) {
718
+ return item.component === 'Search';
719
+ });
720
+
721
+ if (searchSchema) {
722
+ var searchName = searchSchema.name;
723
+ return searchName;
724
+ }
725
+ }
726
+ }; // 处理 dataFilter 中的 onFilter、onReset
727
+
728
+
729
+ var dataFilter = _objectSpread(_objectSpread({
730
+ mode: 'inline'
731
+ }, propsDataFilter), {}, {
732
+ onFilter: (0, _lodash.default)(function (values) {
733
+ (propsDataFilter === null || propsDataFilter === void 0 ? void 0 : propsDataFilter.onFilter) && (propsDataFilter === null || propsDataFilter === void 0 ? void 0 : propsDataFilter.onFilter(values));
694
734
 
695
735
  if (dataFilterForm.validate()) {
696
- var _actionRef$current6, _actionRef$current6$c;
736
+ var _actionRef$current5, _actionRef$current5$c;
737
+
738
+ /**
739
+ * 针对 inline 模式下的 Search 组件做特殊处理
740
+ * 当切换条件且输入内容为空的时候,类似[a, ''] => [b, ''] 不触发请求
741
+ */
742
+ if (dataFilter.mode === 'inline') {
743
+ var searchName = getSearchName();
744
+
745
+ if (searchName) {
746
+ var searchValue = values[searchName][1];
697
747
 
698
- // 搜索变化时,暂时先清空选择
699
- (_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);
748
+ if (searchValue === (searchValueRef === null || searchValueRef === void 0 ? void 0 : searchValueRef.current)) {
749
+ return;
750
+ }
751
+
752
+ searchValueRef.current = searchValue;
753
+ }
754
+ } // 搜索变化时,暂时先清空选择
755
+
756
+
757
+ (_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);
700
758
  setCurrentPage(1);
701
759
 
702
760
  _request(_defineProperty({}, targetPageKey, 1));
@@ -732,7 +790,8 @@ var ProTable = function ProTable(props) {
732
790
  columns: propsColumns,
733
791
  dataFilter: dataFilter,
734
792
  dataFilterForm: dataFilterForm,
735
- rowSelection: rowSelection
793
+ rowSelection: rowSelection,
794
+ filterColumnType: filterColumnType
736
795
  }), /*#__PURE__*/_react.default.createElement(_components.Table.StickyLock, _objectSpread({
737
796
  hasBorder: false,
738
797
  dataSource: showSkeleton ? skeletonDataSource : data || props.dataSource,
@@ -790,21 +849,21 @@ var ProTable = function ProTable(props) {
790
849
 
791
850
  var renderFooter = function renderFooter() {
792
851
  function onChangePagination(currentPage) {
793
- var _actionRef$current7, _actionRef$current7$c;
852
+ var _actionRef$current6, _actionRef$current6$c;
794
853
 
795
854
  var params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
796
855
  // 翻页暂时先清空选择
797
- (_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);
856
+ (_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);
798
857
  setCurrentPage(currentPage);
799
858
 
800
859
  _request(_objectSpread(_defineProperty({}, targetPageKey, currentPage), params));
801
860
  }
802
861
 
803
862
  function onChangePaginationSize(currentPageSize) {
804
- var _actionRef$current8, _actionRef$current8$c, _request5;
863
+ var _actionRef$current7, _actionRef$current7$c, _request5;
805
864
 
806
865
  // 翻页暂时先清空选择
807
- (_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);
866
+ (_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);
808
867
  setPageSize(currentPageSize);
809
868
  setCurrentPage(1);
810
869
 
@@ -838,12 +897,15 @@ var ProTable = function ProTable(props) {
838
897
  })
839
898
  }, renderRowSelection(), /*#__PURE__*/_react.default.createElement("div", {
840
899
  className: cls('footer-right-wrapper')
841
- }, showSkeleton ? /*#__PURE__*/_react.default.createElement(_skeleton.ProSkeletonRaw.Footer.Pagination, null) : /*#__PURE__*/_react.default.createElement(_components.Pagination, _objectSpread({
900
+ }, showSkeleton ? /*#__PURE__*/_react.default.createElement(_skeleton.ProSkeletonRaw.Footer.Pagination, null) : /*#__PURE__*/_react.default.createElement(_Pagination.default, _objectSpread({
842
901
  className: cls('pagination'),
843
902
  onChange: function onChange(number) {
844
903
  return onChangePagination(number);
845
904
  },
846
905
  total: total,
906
+ responsivePaginationType: responsivePaginationType,
907
+ // shape="arrow-only"
908
+ // pageSizePosition="end"
847
909
  totalRender: function totalRender(total) {
848
910
  return (0, _utils.getMessage)('total', {
849
911
  total: total
@@ -851,10 +913,8 @@ var ProTable = function ProTable(props) {
851
913
  },
852
914
  pageSize: pageSize,
853
915
  current: currentPage,
854
- shape: "arrow-only",
855
916
  pageSizeList: pageSizeList,
856
917
  pageSizeSelector: total > (props.pageSize || 10) * 2 ? 'dropdown' : false,
857
- pageSizePosition: "end",
858
918
  type: total / pageSize <= 2 ? 'simple' : 'normal',
859
919
  onPageSizeChange: function onPageSizeChange(number) {
860
920
  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;
@@ -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 变化时的回调 */
@@ -146,7 +149,7 @@ export declare type ProTableActionType = {
146
149
  /** 全屏展示 */
147
150
  fullScreen?: () => boolean;
148
151
  /** 设置显示列 */
149
- setColumn?: (newColumns: ProColumnProps[]) => void;
152
+ setColumn?: (newColumns: ProColumnProps[], update?: boolean) => void;
150
153
  /** 设置表格大小 */
151
154
  setSize?: (mode: 'small' | 'medium') => void;
152
155
  /** 刷新表格 */
@@ -220,6 +223,8 @@ export declare type ProTableDataFilterProps = {
220
223
  searchUndefined?: boolean;
221
224
  /** 搜索时是否传入值为空字符串的参数,默认不传 */
222
225
  searchEmptyString?: boolean;
226
+ /** 自定义内容 */
227
+ content?: React.ReactNode;
223
228
  } & IFilterProps;
224
229
  export declare type dataFilterProps = ProTableDataFilterProps;
225
230
  export declare type ProTableTopAreaProps = {
@@ -235,6 +240,8 @@ export declare type ProTableTopAreaProps = {
235
240
  dataFilter?: ProTableDataFilterProps;
236
241
  /** 数据过滤区 form 表单模型 */
237
242
  dataFilterForm?: FormType;
243
+ /** 排序、筛选列展示状态 */
244
+ filterColumnType?: 'dialog' | 'dropdown' | 'auto';
238
245
  };
239
246
  /** 单个工具栏 */
240
247
  export declare type ProTableToolBarItem = React.ReactNode | 'refresh' | 'density' | 'filterColumn' | 'fullscreen';
@@ -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,11 @@
1
1
  /// <reference types="react" />
2
2
  import { ProTableActionType } from '../typing';
3
+ export declare function initActionRef(): void;
4
+ /** table 组件内监听 不对外暴露 */
5
+ export declare function on(fun: any, key: string): void;
6
+ /** table 组件内销毁监听 不对外暴露 */
7
+ export declare function off(key: string): void;
8
+ /** table 组件内触发事件 不对外暴露 */
9
+ export declare function emit(key: string, ...args: any): void;
3
10
  export declare function useActionType<T>(ref: React.MutableRefObject<ProTableActionType | undefined>, action: ProTableActionType): void;
4
11
  export declare function cloneDeep<T>(obj: T): T;
@@ -4,6 +4,10 @@ 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;
7
11
  exports.useActionType = useActionType;
8
12
 
9
13
  var _lodash = _interopRequireDefault(require("lodash.clonedeep"));
@@ -28,19 +32,23 @@ function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Sy
28
32
 
29
33
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
30
34
 
31
- // 组件内全局状态
35
+ // 组件内全局状态 每次初始化 ActionRef 会重新深拷贝对象
32
36
  var state = {
33
37
  fullScreenState: false,
34
38
  filterRules: {},
35
39
  filterColumns: []
36
40
  };
37
41
 
38
- var _initState = (0, _lodash.default)(state); // 组件内全局监听事件
42
+ var _initState = (0, _lodash.default)(state); // state监听事件 每次初始化 ActionRef 会重新深拷贝对象
39
43
 
40
44
 
41
45
  var callback = {
42
46
  fullScreenState: {}
43
- }; // 组件内对全局状态的更改
47
+ };
48
+ var initCallback = (0, _lodash.default)(callback); // 所有 ProTable 组件公用一套组件内事件转发机制
49
+
50
+ var tableCallback = {}; // 组件内监听事件
51
+ // 组件内对全局状态的更改
44
52
 
45
53
  var mutations = {
46
54
  getState: function getState() {
@@ -140,7 +148,41 @@ var useOn = function useOn(state) {
140
148
  }
141
149
  });
142
150
  }
143
- };
151
+ }; // 初始化 actionRef
152
+
153
+
154
+ function initActionRef() {
155
+ state = (0, _lodash.default)(_initState);
156
+ callback = (0, _lodash.default)(initCallback);
157
+ }
158
+ /** table 组件内监听 不对外暴露 */
159
+
160
+
161
+ function on(fun, key) {
162
+ tableCallback[key] = fun;
163
+ }
164
+ /** table 组件内销毁监听 不对外暴露 */
165
+
166
+
167
+ function off(key) {
168
+ if (tableCallback[key]) {
169
+ delete tableCallback[key];
170
+ }
171
+ }
172
+ /** table 组件内触发事件 不对外暴露 */
173
+
174
+
175
+ function emit(key) {
176
+ var fun = tableCallback[key];
177
+
178
+ if (fun) {
179
+ for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
180
+ args[_key2 - 1] = arguments[_key2];
181
+ }
182
+
183
+ fun.apply(void 0, args);
184
+ }
185
+ }
144
186
 
145
187
  function useActionType(ref, action) {
146
188
  // 合并自定义事件
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@teamix/pro",
3
- "version": "1.2.19",
3
+ "version": "1.2.23",
4
4
  "description": "TeamixPro大包",
5
5
  "repository": "http://gitlab.alibaba-inc.com/teamix/pro",
6
6
  "author": "Velociraptor(迅猛龙)",
@@ -24,7 +24,7 @@
24
24
  "dependencies": {
25
25
  "@formily/core": "2.0.5",
26
26
  "@formily/react": "2.0.5",
27
- "@teamix/formily": "2.0.5-1",
27
+ "@teamix/formily": "2.0.5-2",
28
28
  "@teamix/hooks": "^0.1.0",
29
29
  "@teamix/pop-confirm": "^1.2.4",
30
30
  "@teamix/pro-field": "^1.0.0",