@teamix/pro 1.2.20 → 1.2.24

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 (90) hide show
  1. package/dist/pro.css +1 -1
  2. package/dist/pro.js +2138 -568
  3. package/dist/pro.min.css +1 -1
  4. package/dist/pro.min.js +1 -1
  5. package/es/actions/dialog.js +13 -23
  6. package/es/actions/index.d.ts +10 -0
  7. package/es/actions/index.js +11 -16
  8. package/es/form/Components/LightFilter/componentMap.js +2 -1
  9. package/es/form/Components/LightFilter/index.js +15 -3
  10. package/es/form/Components/SelectTable/index.d.ts +24 -0
  11. package/es/form/Components/SelectTable/index.js +135 -0
  12. package/es/form/Components/SelectTable/index.scss +28 -0
  13. package/es/form/Components/SelectTable/table.d.ts +6 -0
  14. package/es/form/Components/SelectTable/table.js +64 -0
  15. package/es/form/Filter/AdvancedFilter.js +1 -0
  16. package/es/form/Filter/index2.js +8 -8
  17. package/es/form/ProForm/index.js +5 -4
  18. package/es/form/ProForm/index.scss +37 -6
  19. package/es/form/ProForm/useFormDisplayValues.js +4 -2
  20. package/es/form/SchemaForm/index.js +16 -10
  21. package/es/form/SchemaForm/initializeDataSource.d.ts +2 -2
  22. package/es/form/SchemaForm/initializeDataSource.js +4 -9
  23. package/es/form/SchemaForm/initializeRequest.d.ts +2 -2
  24. package/es/form/SchemaForm/initializeRequest.js +4 -10
  25. package/es/form/SchemaForm/initializeRules.d.ts +7 -1
  26. package/es/form/SchemaForm/initializeRules.js +9 -13
  27. package/es/form/SchemaForm/reactions.d.ts +5 -5
  28. package/es/form/SchemaForm/reactions.js +27 -29
  29. package/es/form/global.scss +1 -0
  30. package/es/form/typing.d.ts +10 -1
  31. package/es/form/utils.d.ts +8 -7
  32. package/es/form/utils.js +5 -4
  33. package/es/index.d.ts +1 -1
  34. package/es/index.js +1 -1
  35. package/es/table/components/Filter/index.js +1 -0
  36. package/es/table/components/Layout/index.js +22 -12
  37. package/es/table/components/Pagination/index.d.ts +5 -1
  38. package/es/table/components/Pagination/index.js +179 -17
  39. package/es/table/components/Pagination/index.scss +55 -0
  40. package/es/table/components/ToolBar/FilterColumnIcon.js +24 -3
  41. package/es/table/components/ToolBar/index.scss +9 -4
  42. package/es/table/index.js +79 -26
  43. package/es/table/index.scss +5 -5
  44. package/es/table/typing.d.ts +9 -9
  45. package/es/table/utils/columnRender.js +2 -1
  46. package/es/table/utils/index.d.ts +7 -0
  47. package/es/table/utils/index.js +38 -4
  48. package/lib/actions/dialog.js +12 -22
  49. package/lib/actions/index.d.ts +10 -0
  50. package/lib/actions/index.js +11 -16
  51. package/lib/form/Components/LightFilter/componentMap.js +2 -1
  52. package/lib/form/Components/LightFilter/index.js +14 -3
  53. package/lib/form/Components/SelectTable/index.d.ts +24 -0
  54. package/lib/form/Components/SelectTable/index.js +157 -0
  55. package/lib/form/Components/SelectTable/index.scss +28 -0
  56. package/lib/form/Components/SelectTable/table.d.ts +6 -0
  57. package/lib/form/Components/SelectTable/table.js +76 -0
  58. package/lib/form/Filter/AdvancedFilter.js +1 -0
  59. package/lib/form/Filter/index2.js +9 -8
  60. package/lib/form/ProForm/index.js +5 -5
  61. package/lib/form/ProForm/index.scss +37 -6
  62. package/lib/form/ProForm/useFormDisplayValues.js +3 -1
  63. package/lib/form/SchemaForm/index.js +16 -9
  64. package/lib/form/SchemaForm/initializeDataSource.d.ts +2 -2
  65. package/lib/form/SchemaForm/initializeDataSource.js +4 -11
  66. package/lib/form/SchemaForm/initializeRequest.d.ts +2 -2
  67. package/lib/form/SchemaForm/initializeRequest.js +4 -11
  68. package/lib/form/SchemaForm/initializeRules.d.ts +7 -1
  69. package/lib/form/SchemaForm/initializeRules.js +9 -16
  70. package/lib/form/SchemaForm/reactions.d.ts +5 -5
  71. package/lib/form/SchemaForm/reactions.js +29 -31
  72. package/lib/form/global.scss +1 -0
  73. package/lib/form/typing.d.ts +10 -1
  74. package/lib/form/utils.d.ts +8 -7
  75. package/lib/form/utils.js +6 -5
  76. package/lib/index.d.ts +1 -1
  77. package/lib/index.js +1 -1
  78. package/lib/table/components/Layout/index.js +21 -11
  79. package/lib/table/components/Pagination/index.d.ts +5 -1
  80. package/lib/table/components/Pagination/index.js +186 -17
  81. package/lib/table/components/Pagination/index.scss +55 -0
  82. package/lib/table/components/ToolBar/FilterColumnIcon.js +23 -2
  83. package/lib/table/components/ToolBar/index.scss +9 -4
  84. package/lib/table/index.js +79 -24
  85. package/lib/table/index.scss +5 -5
  86. package/lib/table/typing.d.ts +9 -9
  87. package/lib/table/utils/columnRender.js +2 -1
  88. package/lib/table/utils/index.d.ts +7 -0
  89. package/lib/table/utils/index.js +46 -4
  90. package/package.json +1 -1
@@ -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"];
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,
@@ -247,8 +252,10 @@ var ProTable = function ProTable(props) {
247
252
  var _useState13 = (0, _react.useState)(true),
248
253
  _useState14 = _slicedToArray(_useState13, 2),
249
254
  customTableLoading = _useState14[0],
250
- setCustomTableLoading = _useState14[1];
255
+ setCustomTableLoading = _useState14[1]; // 用于存放 Search 组件之前值的 ref
256
+
251
257
 
258
+ var searchValueRef = (0, _react.useRef)('');
252
259
  var tableRef = (0, _react.useRef)(null);
253
260
  var actionRef = (0, _react.useRef)(); // 传给 table 的过滤后的 columns
254
261
 
@@ -447,9 +454,14 @@ var ProTable = function ProTable(props) {
447
454
  setColumn: function setColumn(newColumns) {
448
455
  var _actionRef$current2, _actionRef$current2$s;
449
456
 
457
+ var update = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
450
458
  var columns = processColumns(newColumns, propsColumns);
451
459
  setFilteredColumns(columns);
452
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
+ }
453
465
  },
454
466
  setSize: function setSize(mode) {
455
467
  _setSize(mode);
@@ -653,10 +665,8 @@ var ProTable = function ProTable(props) {
653
665
  }
654
666
 
655
667
  (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); // 监听 浏览器变化 更吸底状态
668
+ // 初始化 actionRef state、callback 此时 actionRef 已初始化完成
669
+ (0, _utils2.initActionRef)(); // 监听 浏览器变化 更吸底状态
660
670
 
661
671
  if (footerSuction) {
662
672
  getFooterSuctionState();
@@ -670,6 +680,14 @@ var ProTable = function ProTable(props) {
670
680
  _request();
671
681
  }
672
682
 
683
+ var searchName = getSearchName();
684
+
685
+ if (searchName) {
686
+ // 如果有初始值,需要赋值
687
+ var initialValues = toJS(dataFilterForm.initialValues);
688
+ searchValueRef.current = initialValues[searchName][1];
689
+ }
690
+
673
691
  return function () {
674
692
  if (autoRefreshTimerRef.current) {
675
693
  clearTimeout(autoRefreshTimerRef.current);
@@ -689,18 +707,54 @@ var ProTable = function ProTable(props) {
689
707
  setSort(nextSort);
690
708
 
691
709
  _request(targetFormatSort(nextSort));
692
- } // 处理 dataFilter 中的 onFilter、onReset
710
+ } // 找到 Search 组件对应的 name
693
711
 
694
712
 
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))));
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));
698
734
 
699
735
  if (dataFilterForm.validate()) {
700
- 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];
701
747
 
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);
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);
704
758
  setCurrentPage(1);
705
759
 
706
760
  _request(_defineProperty({}, targetPageKey, 1));
@@ -795,21 +849,21 @@ var ProTable = function ProTable(props) {
795
849
 
796
850
  var renderFooter = function renderFooter() {
797
851
  function onChangePagination(currentPage) {
798
- var _actionRef$current7, _actionRef$current7$c;
852
+ var _actionRef$current6, _actionRef$current6$c;
799
853
 
800
854
  var params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
801
855
  // 翻页暂时先清空选择
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);
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);
803
857
  setCurrentPage(currentPage);
804
858
 
805
859
  _request(_objectSpread(_defineProperty({}, targetPageKey, currentPage), params));
806
860
  }
807
861
 
808
862
  function onChangePaginationSize(currentPageSize) {
809
- var _actionRef$current8, _actionRef$current8$c, _request5;
863
+ var _actionRef$current7, _actionRef$current7$c, _request5;
810
864
 
811
865
  // 翻页暂时先清空选择
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);
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);
813
867
  setPageSize(currentPageSize);
814
868
  setCurrentPage(1);
815
869
 
@@ -843,14 +897,15 @@ var ProTable = function ProTable(props) {
843
897
  })
844
898
  }, renderRowSelection(), /*#__PURE__*/_react.default.createElement("div", {
845
899
  className: cls('footer-right-wrapper')
846
- }, 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({
847
901
  className: cls('pagination'),
848
902
  onChange: function onChange(number) {
849
903
  return onChangePagination(number);
850
904
  },
851
905
  total: total,
852
- shape: "arrow-only",
853
- pageSizePosition: "end",
906
+ responsivePaginationType: responsivePaginationType,
907
+ // shape="arrow-only"
908
+ // pageSizePosition="end"
854
909
  totalRender: function totalRender(total) {
855
910
  return (0, _utils.getMessage)('total', {
856
911
  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
  }
@@ -3,7 +3,7 @@
3
3
  */
4
4
  import { ColumnProps, TableProps } from '@alicloudfe/components/types/table';
5
5
  import { ProFieldType, ProFieldRenderProps, ProFieldDataSourceItem } from '../field';
6
- import { IFilterProps } from '../form';
6
+ import { QueryFilterProps } from '../form';
7
7
  import { ProActionGroupProps, ProActionButtonProps } from '../actions';
8
8
  import { PaginationProps } from '@alicloudfe/components/types/pagination';
9
9
  import { HeaderProps as ProTableHeaderProps } from '@teamix/utils';
@@ -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
  /** 刷新表格 */
@@ -212,15 +215,12 @@ export declare type ProTableActionTypeState = {
212
215
  [key: string]: any;
213
216
  };
214
217
  export declare type ProTableDataFilterProps = {
215
- /** 展示形式 */
216
- mode?: 'inline' | 'panel';
217
- /** mode='panel' 时是否默认展开 */
218
- expand?: boolean;
219
- /** 搜索时是否传入值为undefined的参数,默认不传 */
220
218
  searchUndefined?: boolean;
221
219
  /** 搜索时是否传入值为空字符串的参数,默认不传 */
222
220
  searchEmptyString?: boolean;
223
- } & IFilterProps;
221
+ /** 自定义内容 */
222
+ content?: React.ReactNode;
223
+ } & QueryFilterProps;
224
224
  export declare type dataFilterProps = ProTableDataFilterProps;
225
225
  export declare type ProTableTopAreaProps = {
226
226
  /** 标题区 */
@@ -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.20",
3
+ "version": "1.2.24",
4
4
  "description": "TeamixPro大包",
5
5
  "repository": "http://gitlab.alibaba-inc.com/teamix/pro",
6
6
  "author": "Velociraptor(迅猛龙)",