@teamix/pro 1.2.24 → 1.2.29

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 (129) hide show
  1. package/dist/212.js +129 -129
  2. package/dist/pro.css +1 -1
  3. package/dist/pro.js +18112 -15660
  4. package/dist/pro.min.css +1 -1
  5. package/dist/pro.min.js +1 -1
  6. package/dist/pro.min.js.LICENSE.txt +2 -0
  7. package/es/actions/dialog.js +1 -1
  8. package/es/actions/index.d.ts +12 -9
  9. package/es/actions/index.js +56 -15
  10. package/es/actions/index.scss +12 -1
  11. package/es/form/Filter/AdvancedFilter.js +1 -1
  12. package/es/form/Filter/Layout.d.ts +5 -0
  13. package/es/form/Filter/Layout.js +82 -0
  14. package/es/form/Filter/SimpleFilter.js +30 -6
  15. package/es/form/Filter/index2.d.ts +2 -1
  16. package/es/form/Filter/index2.js +97 -116
  17. package/es/form/Filter/index2.scss +16 -45
  18. package/es/form/Filter/layout.scss +36 -0
  19. package/es/form/Filter/useSpecialProps.d.ts +6 -0
  20. package/es/form/Filter/useSpecialProps.js +37 -0
  21. package/es/form/ProForm/customComponent.d.ts +3 -0
  22. package/es/form/ProForm/customComponent.js +20 -0
  23. package/es/form/ProForm/index.scss +5 -6
  24. package/es/form/ProForm/useFormDisplayValues.js +14 -24
  25. package/es/form/SchemaForm/adapterType.js +1 -0
  26. package/es/form/SchemaForm/index.js +8 -6
  27. package/es/form/SchemaForm/initializeDataSource.d.ts +1 -1
  28. package/es/form/SchemaForm/initializeDataSource.js +2 -2
  29. package/es/form/SchemaForm/initializeRequest.d.ts +1 -1
  30. package/es/form/SchemaForm/initializeRequest.js +2 -2
  31. package/es/form/SchemaForm/initializeRules.d.ts +1 -1
  32. package/es/form/SchemaForm/initializeRules.js +3 -3
  33. package/es/form/fieldTypeMap.js +2 -1
  34. package/es/form/index.d.ts +4 -2
  35. package/es/form/index.js +4 -2
  36. package/es/form/typing.d.ts +16 -1
  37. package/es/form/utils.d.ts +2 -2
  38. package/es/form/utils.js +2 -2
  39. package/es/index.d.ts +5 -2
  40. package/es/index.js +6 -3
  41. package/es/info/index.scss +1 -1
  42. package/es/nocode/pages/renderer.js +1 -1
  43. package/es/step/ProStepItem/components/HozStepItem/index.d.ts +5 -0
  44. package/es/step/ProStepItem/components/HozStepItem/index.js +235 -0
  45. package/es/step/ProStepItem/components/HozStepItem/index.scss +279 -0
  46. package/es/step/ProStepItem/components/VerStepItem/index.d.ts +5 -0
  47. package/es/step/ProStepItem/components/VerStepItem/index.js +295 -0
  48. package/es/step/ProStepItem/components/VerStepItem/index.scss +287 -0
  49. package/es/step/ProStepItem/index.d.ts +4 -0
  50. package/es/step/ProStepItem/index.js +57 -0
  51. package/es/step/index.d.ts +9 -0
  52. package/es/step/index.js +101 -0
  53. package/es/step/typing.d.ts +96 -0
  54. package/es/step/typing.js +1 -0
  55. package/es/table/components/Filter/index.js +2 -17
  56. package/es/table/components/Layout/index.js +63 -167
  57. package/es/table/components/Layout/index.scss +4 -3
  58. package/es/table/components/Pagination/index.js +1 -0
  59. package/es/table/components/ToolBar/FullScreenIcon.js +4 -9
  60. package/es/table/components/ToolBar/Fullscreen.js +21 -11
  61. package/es/table/index.js +89 -103
  62. package/es/table/typing.d.ts +14 -3
  63. package/es/table/utils/columnRender.js +21 -3
  64. package/es/table/utils/index.d.ts +7 -0
  65. package/es/table/utils/index.js +36 -0
  66. package/es/utils/index.d.ts +1 -0
  67. package/es/utils/index.js +1 -0
  68. package/lib/actions/dialog.js +1 -1
  69. package/lib/actions/index.d.ts +12 -9
  70. package/lib/actions/index.js +56 -15
  71. package/lib/actions/index.scss +12 -1
  72. package/lib/form/Filter/AdvancedFilter.js +1 -1
  73. package/lib/form/Filter/Layout.d.ts +5 -0
  74. package/lib/form/Filter/Layout.js +102 -0
  75. package/lib/form/Filter/SimpleFilter.js +29 -4
  76. package/lib/form/Filter/index2.d.ts +2 -1
  77. package/lib/form/Filter/index2.js +101 -114
  78. package/lib/form/Filter/index2.scss +16 -45
  79. package/lib/form/Filter/layout.scss +36 -0
  80. package/lib/form/Filter/useSpecialProps.d.ts +6 -0
  81. package/lib/form/Filter/useSpecialProps.js +46 -0
  82. package/lib/form/ProForm/customComponent.d.ts +3 -0
  83. package/lib/form/ProForm/customComponent.js +28 -0
  84. package/lib/form/ProForm/index.scss +5 -6
  85. package/lib/form/ProForm/useFormDisplayValues.js +17 -24
  86. package/lib/form/SchemaForm/adapterType.js +1 -0
  87. package/lib/form/SchemaForm/index.js +8 -6
  88. package/lib/form/SchemaForm/initializeDataSource.d.ts +1 -1
  89. package/lib/form/SchemaForm/initializeDataSource.js +2 -2
  90. package/lib/form/SchemaForm/initializeRequest.d.ts +1 -1
  91. package/lib/form/SchemaForm/initializeRequest.js +2 -2
  92. package/lib/form/SchemaForm/initializeRules.d.ts +1 -1
  93. package/lib/form/SchemaForm/initializeRules.js +3 -3
  94. package/lib/form/fieldTypeMap.js +2 -1
  95. package/lib/form/index.d.ts +4 -2
  96. package/lib/form/index.js +19 -1
  97. package/lib/form/typing.d.ts +16 -1
  98. package/lib/form/utils.d.ts +2 -2
  99. package/lib/form/utils.js +2 -2
  100. package/lib/index.d.ts +5 -2
  101. package/lib/index.js +35 -3
  102. package/lib/info/index.scss +1 -1
  103. package/lib/nocode/pages/renderer.js +1 -1
  104. package/lib/step/ProStepItem/components/HozStepItem/index.d.ts +5 -0
  105. package/lib/step/ProStepItem/components/HozStepItem/index.js +258 -0
  106. package/lib/step/ProStepItem/components/HozStepItem/index.scss +279 -0
  107. package/lib/step/ProStepItem/components/VerStepItem/index.d.ts +5 -0
  108. package/lib/step/ProStepItem/components/VerStepItem/index.js +315 -0
  109. package/lib/step/ProStepItem/components/VerStepItem/index.scss +287 -0
  110. package/lib/step/ProStepItem/index.d.ts +4 -0
  111. package/lib/step/ProStepItem/index.js +69 -0
  112. package/lib/step/index.d.ts +9 -0
  113. package/lib/step/index.js +124 -0
  114. package/lib/step/typing.d.ts +96 -0
  115. package/lib/step/typing.js +5 -0
  116. package/lib/table/components/Filter/index.js +2 -17
  117. package/lib/table/components/Layout/index.js +61 -167
  118. package/lib/table/components/Layout/index.scss +4 -3
  119. package/lib/table/components/Pagination/index.js +1 -0
  120. package/lib/table/components/ToolBar/FullScreenIcon.js +4 -9
  121. package/lib/table/components/ToolBar/Fullscreen.js +22 -11
  122. package/lib/table/index.js +85 -100
  123. package/lib/table/typing.d.ts +14 -3
  124. package/lib/table/utils/columnRender.js +21 -3
  125. package/lib/table/utils/index.d.ts +7 -0
  126. package/lib/table/utils/index.js +38 -0
  127. package/lib/utils/index.d.ts +1 -0
  128. package/lib/utils/index.js +13 -0
  129. package/package.json +4 -4
package/es/table/index.js CHANGED
@@ -1,4 +1,4 @@
1
- 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"];
1
+ 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"];
2
2
 
3
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
4
 
@@ -32,28 +32,29 @@ function _objectWithoutProperties(source, excluded) { if (source == null) return
32
32
 
33
33
  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; }
34
34
 
35
- import React, { useState, useEffect, useRef, useMemo } from 'react';
35
+ import React, { useState, useEffect, useRef } from 'react';
36
36
  import { Table, Checkbox } from '@alicloudfe/components';
37
37
  import Pagination from './components/Pagination';
38
38
  import genProColumnToColumn from './utils/genProColumnToColumn';
39
- import { baseClass, useRequest, request as utilResquest, getDeepValue, getMessage, pickProps } from '@teamix/utils';
39
+ import { baseClass, useRequest, request as utilResquest, getDeepValue, getMessage, pickProps, getCookie } from '@teamix/utils';
40
40
  import { ProSkeletonRaw as Skeleton } from '../skeleton';
41
41
  import './index.scss';
42
42
  import Layout from './components/Layout';
43
- import { emit, initActionRef, useActionType } from './utils';
43
+ import { emit, initActionRef, processDefaultFilter, useActionType } from './utils';
44
44
  import getTableProps from './utils/getTableProps';
45
45
  import getTableSortIcons from './utils/getTableSortIcons';
46
46
  import useTableSelection from './utils/useTableSelection';
47
47
  import FullScreen from './components/ToolBar/Fullscreen';
48
48
  import EmptyContent from './components/EmptyContent';
49
- import { createForm, formilyReactive } from '../form';
49
+ import { formilyReactive } from '../form';
50
50
  import { ProActionGroup } from '../actions';
51
- import debounce from 'lodash.debounce';
52
51
  import classNames from 'classnames';
53
52
  import ProPageContainer from '../page-container';
54
53
  export * from './typing';
55
54
  var cls = baseClass('teamix-pro-table');
56
- var toJS = formilyReactive.toJS;
55
+ var toJS = formilyReactive.toJS; // 判断是否是 root 组织
56
+
57
+ var isRoot = getCookie('organizationId') === '1';
57
58
  /**
58
59
  * 处理原生传入的 columns 以便于 选择列 方便处理
59
60
  * @param columns 原生传入的 columns
@@ -61,14 +62,24 @@ var toJS = formilyReactive.toJS;
61
62
  */
62
63
 
63
64
  var processColumns = function processColumns(columns, initialColumns) {
65
+ var _filterColumns;
66
+
64
67
  var filterColumns = columns.filter(function (item) {
65
68
  return item.columnFilters !== false;
66
- }); // 处理只剩一列批量选择的情况下宽度错乱问题
69
+ });
70
+
71
+ if (isRoot) {
72
+ // root 组织下不显示标签管理
73
+ filterColumns = filterColumns.filter(function (item) {
74
+ return item.valueType !== 'selectGroup';
75
+ });
76
+ } // 处理只剩一列批量选择的情况下宽度错乱问题
67
77
 
68
- if (filterColumns === null || filterColumns === void 0 ? void 0 : filterColumns.length) {
69
- var _initialColumns$;
70
78
 
71
- if ((filterColumns === null || filterColumns === void 0 ? void 0 : filterColumns.length) === 1) {
79
+ if ((_filterColumns = filterColumns) === null || _filterColumns === void 0 ? void 0 : _filterColumns.length) {
80
+ var _filterColumns2, _initialColumns$;
81
+
82
+ if (((_filterColumns2 = filterColumns) === null || _filterColumns2 === void 0 ? void 0 : _filterColumns2.length) === 1) {
72
83
  var _filterColumns$, _filterColumns$2;
73
84
 
74
85
  if ((_filterColumns$ = filterColumns[0]) === null || _filterColumns$ === void 0 ? void 0 : _filterColumns$.width) {
@@ -110,7 +121,7 @@ var globalFormatSort = function globalFormatSort(sort) {
110
121
  };
111
122
 
112
123
  var ProTable = function ProTable(props) {
113
- var _rowSelection$selecte;
124
+ var _rowSelection$selecte, _dataFilterForm4;
114
125
 
115
126
  var header = props.header,
116
127
  className = props.className,
@@ -164,6 +175,7 @@ var ProTable = function ProTable(props) {
164
175
  customRequest = props.customRequest,
165
176
  _props$filterColumnTy = props.filterColumnType,
166
177
  filterColumnType = _props$filterColumnTy === void 0 ? 'auto' : _props$filterColumnTy,
178
+ defaultFilterParams = props.defaultFilterParams,
167
179
  otherProps = _objectWithoutProperties(props, _excluded);
168
180
 
169
181
  var targetPageKey = pageKey || globalPageKey;
@@ -207,10 +219,8 @@ var ProTable = function ProTable(props) {
207
219
  var _useState13 = useState(true),
208
220
  _useState14 = _slicedToArray(_useState13, 2),
209
221
  customTableLoading = _useState14[0],
210
- setCustomTableLoading = _useState14[1]; // 用于存放 Search 组件之前值的 ref
211
-
222
+ setCustomTableLoading = _useState14[1];
212
223
 
213
- var searchValueRef = useRef('');
214
224
  var tableRef = useRef(null);
215
225
  var actionRef = useRef(); // 传给 table 的过滤后的 columns
216
226
 
@@ -260,19 +270,22 @@ var ProTable = function ProTable(props) {
260
270
  var _useState23 = useState(false),
261
271
  _useState24 = _slicedToArray(_useState23, 2),
262
272
  fullscreenState = _useState24[0],
263
- setFullscreenState = _useState24[1]; // 整个内容区是否超过一屏。用于表格在非全屏模式下的吸底
273
+ setFullscreenState = _useState24[1]; // 非全屏状态下的
274
+
264
275
 
276
+ var normalDataFilterFormRef = useRef();
277
+ var fullscreenDataFilterFormRef = useRef();
278
+ var normalDataFilterForm = normalDataFilterFormRef.current;
279
+ var fullscreenDataFilterForm = fullscreenDataFilterFormRef.current; // 传给 QueryFilter 的 formRef
280
+
281
+ var dataFilterFormRef = !fullscreenState ? normalDataFilterFormRef : fullscreenDataFilterFormRef;
282
+ var dataFilterForm = dataFilterFormRef.current; // 整个内容区是否超过一屏。用于表格在非全屏模式下的吸底
265
283
 
266
284
  var _useState25 = useState(false),
267
285
  _useState26 = _slicedToArray(_useState25, 2),
268
286
  footerSuctionState = _useState26[0],
269
- setFooterSuctionState = _useState26[1];
270
- /** 筛选区域 form */
271
-
287
+ setFooterSuctionState = _useState26[1]; // TODO 获取内容区是否超出一屏(暂时仅支持全家桶)
272
288
 
273
- var dataFilterForm = useMemo(function () {
274
- return createForm();
275
- }, []); // TODO 获取内容区是否超出一屏(暂时仅支持全家桶)
276
289
 
277
290
  var getFooterSuctionState = function getFooterSuctionState() {
278
291
  var containerDom = document.querySelector('.teamix-pro-page-container-scroll-container');
@@ -425,26 +438,24 @@ var ProTable = function ProTable(props) {
425
438
  return _request(params);
426
439
  },
427
440
  request: function request(params) {
428
- if (dataFilterForm.validate()) {
429
- // 如果请求中还有翻页相关信息,需要自动设置到指定页
430
- if (params === null || params === void 0 ? void 0 : params[targetPageKey]) {
431
- setCurrentPage(params[targetPageKey]);
432
- }
433
-
434
- if (params === null || params === void 0 ? void 0 : params[targetPageSizeKey]) {
435
- setPageSize(params[targetPageSizeKey]);
436
- }
441
+ // 如果请求中还有翻页相关信息,需要自动设置到指定页
442
+ if (params === null || params === void 0 ? void 0 : params[targetPageKey]) {
443
+ setCurrentPage(params[targetPageKey]);
444
+ }
437
445
 
438
- _request(params);
446
+ if (params === null || params === void 0 ? void 0 : params[targetPageSizeKey]) {
447
+ setPageSize(params[targetPageSizeKey]);
439
448
  }
449
+
450
+ _request(params);
440
451
  },
441
452
  reset: function reset() {
442
- var _actionRef$current3, _actionRef$current3$s;
453
+ var _actionRef$current3, _actionRef$current3$s, _dataFilterForm;
443
454
 
444
455
  (propsDataFilter === null || propsDataFilter === void 0 ? void 0 : propsDataFilter.onReset) && (propsDataFilter === null || propsDataFilter === void 0 ? void 0 : propsDataFilter.onReset()); // 清空列过滤参数
445
456
 
446
457
  (_actionRef$current3 = actionRef.current) === null || _actionRef$current3 === void 0 ? void 0 : (_actionRef$current3$s = _actionRef$current3.setFilterRules) === null || _actionRef$current3$s === void 0 ? void 0 : _actionRef$current3$s.call(_actionRef$current3, {});
447
- dataFilterForm.reset();
458
+ (_dataFilterForm = dataFilterForm) === null || _dataFilterForm === void 0 ? void 0 : _dataFilterForm.reset();
448
459
  setCurrentPage(1);
449
460
 
450
461
  _request(_defineProperty({}, targetPageKey, 1));
@@ -467,6 +478,8 @@ var ProTable = function ProTable(props) {
467
478
  },
468
479
  data: data,
469
480
  dataFilterForm: dataFilterForm,
481
+ normalDataFilterForm: normalDataFilterForm,
482
+ fullscreenDataFilterForm: fullscreenDataFilterForm,
470
483
  resetTableMaxBodyHeight: function resetTableMaxBodyHeight() {
471
484
  getHeaderHeight().then(function (height) {
472
485
  setHeaderHeight(height);
@@ -556,7 +569,7 @@ var ProTable = function ProTable(props) {
556
569
  }); // 请求函数
557
570
 
558
571
  function _request(params, noLoading) {
559
- var _actionRef$current$ge, _actionRef$current4, _actionRef$current4$g, _objectSpread2;
572
+ var _dataFilterForm2, _actionRef$current$ge, _actionRef$current4, _actionRef$current4$g, _objectSpread2;
560
573
 
561
574
  // 如果没有传 url 且没有 customRequest,直接返回
562
575
  if (!url && !customRequest) {
@@ -569,7 +582,7 @@ var ProTable = function ProTable(props) {
569
582
 
570
583
  var sortParams = targetFormatSort(sort); // 筛选区请求参数
571
584
 
572
- var dataFilterParams = toJS(dataFilterForm.values); // 列过滤请求参数
585
+ var dataFilterParams = toJS((_dataFilterForm2 = dataFilterForm) === null || _dataFilterForm2 === void 0 ? void 0 : _dataFilterForm2.values); // 列过滤请求参数
573
586
 
574
587
  var columnsFilterParams = (_actionRef$current$ge = (_actionRef$current4 = actionRef.current) === null || _actionRef$current4 === void 0 ? void 0 : (_actionRef$current4$g = _actionRef$current4.getFilterRules) === null || _actionRef$current4$g === void 0 ? void 0 : _actionRef$current4$g.call(_actionRef$current4)) !== null && _actionRef$current$ge !== void 0 ? _actionRef$current$ge : {}; // 格式化后的请求参数
575
588
 
@@ -621,7 +634,8 @@ var ProTable = function ProTable(props) {
621
634
 
622
635
  useEffect(function () {
623
636
  // 初始化 actionRef state、callback 此时 actionRef 已初始化完成
624
- initActionRef(); // 监听 浏览器变化 更吸底状态
637
+ initActionRef();
638
+ dataFilterForm = dataFilterFormRef.current; // 监听 浏览器变化 更吸底状态
625
639
 
626
640
  if (footerSuction) {
627
641
  getFooterSuctionState();
@@ -631,16 +645,21 @@ var ProTable = function ProTable(props) {
631
645
  };
632
646
  }
633
647
 
634
- if (requestWhenMount) {
635
- _request();
636
- }
648
+ if (propsDataFilter) {
649
+ var _dataFilterForm3;
637
650
 
638
- var searchName = getSearchName();
651
+ if (requestWhenMount && ((_dataFilterForm3 = dataFilterForm) === null || _dataFilterForm3 === void 0 ? void 0 : _dataFilterForm3.id)) {
652
+ // 在请求发送之前 处理漏斗默认数据
653
+ processDefaultFilter(propsColumns, actionRef, defaultFilterParams);
639
654
 
640
- if (searchName) {
641
- // 如果有初始值,需要赋值
642
- var initialValues = toJS(dataFilterForm.initialValues);
643
- searchValueRef.current = initialValues[searchName][1];
655
+ _request();
656
+ }
657
+ } else {
658
+ if (requestWhenMount) {
659
+ processDefaultFilter(propsColumns, actionRef, defaultFilterParams);
660
+
661
+ _request();
662
+ }
644
663
  }
645
664
 
646
665
  return function () {
@@ -654,7 +673,7 @@ var ProTable = function ProTable(props) {
654
673
 
655
674
  actionRef.current = undefined;
656
675
  };
657
- }, []);
676
+ }, [(_dataFilterForm4 = dataFilterForm) === null || _dataFilterForm4 === void 0 ? void 0 : _dataFilterForm4.id]);
658
677
 
659
678
  function onSort(dataIndex, order) {
660
679
  var nextSort = _defineProperty({}, dataIndex, order);
@@ -662,62 +681,27 @@ var ProTable = function ProTable(props) {
662
681
  setSort(nextSort);
663
682
 
664
683
  _request(targetFormatSort(nextSort));
665
- } // 找到 Search 组件对应的 name
666
-
667
-
668
- var getSearchName = function getSearchName() {
669
- var _dataFilter$schema;
670
-
671
- 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) {
672
- var searchSchema = dataFilter.schema.find(function (item) {
673
- return item.component === 'Search';
674
- });
675
-
676
- if (searchSchema) {
677
- var searchName = searchSchema.name;
678
- return searchName;
679
- }
680
- }
681
- }; // 处理 dataFilter 中的 onFilter、onReset
684
+ } // 处理 dataFilter 中的 onFilter、onReset
682
685
 
683
686
 
684
687
  var dataFilter = _objectSpread(_objectSpread({
685
688
  mode: 'inline'
686
689
  }, propsDataFilter), {}, {
687
- onFilter: debounce(function (values) {
688
- (propsDataFilter === null || propsDataFilter === void 0 ? void 0 : propsDataFilter.onFilter) && (propsDataFilter === null || propsDataFilter === void 0 ? void 0 : propsDataFilter.onFilter(values));
689
-
690
- if (dataFilterForm.validate()) {
691
- var _actionRef$current5, _actionRef$current5$c;
692
-
693
- /**
694
- * 针对 inline 模式下的 Search 组件做特殊处理
695
- * 当切换条件且输入内容为空的时候,类似[a, ''] => [b, ''] 不触发请求
696
- */
697
- if (dataFilter.mode === 'inline') {
698
- var searchName = getSearchName();
699
-
700
- if (searchName) {
701
- var searchValue = values[searchName][1];
690
+ onFilter: function onFilter(values) {
691
+ var _actionRef$current5, _actionRef$current5$c;
702
692
 
703
- if (searchValue === (searchValueRef === null || searchValueRef === void 0 ? void 0 : searchValueRef.current)) {
704
- return;
705
- }
693
+ (propsDataFilter === null || propsDataFilter === void 0 ? void 0 : propsDataFilter.onFilter) && (propsDataFilter === null || propsDataFilter === void 0 ? void 0 : propsDataFilter.onFilter(values)); // 搜索变化时,暂时先清空选择
706
694
 
707
- searchValueRef.current = searchValue;
708
- }
709
- } // 搜索变化时,暂时先清空选择
710
-
711
-
712
- (_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);
713
- setCurrentPage(1);
695
+ (_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);
696
+ setCurrentPage(1);
714
697
 
715
- _request(_defineProperty({}, targetPageKey, 1));
716
- }
717
- }, filterDebounce),
698
+ _request(_defineProperty({}, targetPageKey, 1));
699
+ },
718
700
  onReset: function onReset() {
701
+ var _dataFilterForm5;
702
+
719
703
  (propsDataFilter === null || propsDataFilter === void 0 ? void 0 : propsDataFilter.onReset) && (propsDataFilter === null || propsDataFilter === void 0 ? void 0 : propsDataFilter.onReset());
720
- dataFilterForm.reset();
704
+ (_dataFilterForm5 = dataFilterForm) === null || _dataFilterForm5 === void 0 ? void 0 : _dataFilterForm5.reset();
721
705
  setCurrentPage(1);
722
706
 
723
707
  _request(_defineProperty({}, targetPageKey, 1));
@@ -732,7 +716,7 @@ var ProTable = function ProTable(props) {
732
716
  }
733
717
  };
734
718
 
735
- var renderTable = function renderTable() {
719
+ var renderTable = function renderTable(isFullScreen) {
736
720
  if (propsColumns) {
737
721
  return /*#__PURE__*/React.createElement("div", {
738
722
  className: classNames('teamix-pro-table-container', className)
@@ -744,7 +728,7 @@ var ProTable = function ProTable(props) {
744
728
  actionRef: actionRef,
745
729
  columns: propsColumns,
746
730
  dataFilter: dataFilter,
747
- dataFilterForm: dataFilterForm,
731
+ dataFilterFormRef: isFullScreen ? fullscreenDataFilterFormRef : normalDataFilterFormRef,
748
732
  rowSelection: rowSelection,
749
733
  filterColumnType: filterColumnType
750
734
  }), /*#__PURE__*/React.createElement(Table.StickyLock, _objectSpread({
@@ -786,7 +770,7 @@ var ProTable = function ProTable(props) {
786
770
 
787
771
  var targetActions = footerAction.actions.map(function (action) {
788
772
  return _objectSpread(_objectSpread({}, action), {}, {
789
- disabled: action.disabled || selectedCount === 0
773
+ disabled: (action === null || action === void 0 ? void 0 : action.disabled) || selectedCount === 0
790
774
  });
791
775
  });
792
776
 
@@ -889,14 +873,16 @@ var ProTable = function ProTable(props) {
889
873
  return /*#__PURE__*/React.createElement(FullScreen, {
890
874
  visible: fullscreenState,
891
875
  actionRef: actionRef
892
- }, /*#__PURE__*/React.createElement("div", {
893
- className: cls({
894
- '': true,
895
- fullscreen: fullscreenState // 'footer-suction': footerSuctionState && footerSuction,
896
-
897
- }),
898
- ref: tableRef
899
- }, renderTable(), footerSuctionState && footerSuction && !fullscreenState && /*#__PURE__*/React.createElement(ProPageContainer.FixedFooter, null, renderFooter()), !(footerSuctionState && footerSuction) && !fullscreenState && renderFooter(), fullscreenState && renderFooter()));
876
+ }, function (isFullScreen) {
877
+ return /*#__PURE__*/React.createElement("div", {
878
+ className: cls({
879
+ '': true,
880
+ fullscreen: fullscreenState // 'footer-suction': footerSuctionState && footerSuction,
881
+
882
+ }),
883
+ ref: tableRef
884
+ }, renderTable(isFullScreen), footerSuctionState && footerSuction && !fullscreenState && /*#__PURE__*/React.createElement(ProPageContainer.FixedFooter, null, renderFooter()), !(footerSuctionState && footerSuction) && !fullscreenState && renderFooter(), fullscreenState && renderFooter());
885
+ });
900
886
  };
901
887
 
902
888
  export default ProTable;
@@ -56,6 +56,8 @@ export declare type ProTableColumnProps = {
56
56
  dataIndex?: string | string[];
57
57
  /** 指定 valueType 为日期时间格式时,可以格式化日期时间 */
58
58
  format?: string;
59
+ /** ProField 其他配置项 */
60
+ props?: any;
59
61
  } & Omit<ColumnProps, 'filters' | 'dataIndex' | 'filtersMode'>;
60
62
  export declare type ProColumnProps = ProTableColumnProps;
61
63
  export declare type ProTableProps = {
@@ -105,7 +107,10 @@ export declare type ProTableProps = {
105
107
  footerAction?: ProActionGroupProps | React.ReactNode;
106
108
  /** 表格底部(右层)配置 */
107
109
  footer?: React.ReactNode;
108
- /** 筛选区自动搜索的防抖时间(毫秒) */
110
+ /**
111
+ * @deprecated 已废弃 建议用 dataFilter 中的 filterDebounce 代替
112
+ * 筛选区自动搜索的防抖时间(毫秒)
113
+ */
109
114
  filterDebounce?: number;
110
115
  /** ProTable action 的引用,便于手动触发一些方法 */
111
116
  actionRef?: React.MutableRefObject<ProTableActionType | undefined>;
@@ -125,6 +130,10 @@ export declare type ProTableProps = {
125
130
  data: any[];
126
131
  total?: number;
127
132
  }>;
133
+ /** 默认漏斗过滤条件 */
134
+ defaultFilterParams?: {
135
+ [key: string]: any[] | any;
136
+ };
128
137
  } & Omit<TableProps, 'columns'> & ProTableTopAreaProps;
129
138
  export declare type rowSelectionType = {
130
139
  getProps?: (record: any, index: number) => any;
@@ -181,6 +190,8 @@ export declare type ProTableActionType = {
181
190
  resetPage?: () => void;
182
191
  /** 获取数据过滤区表单实例 */
183
192
  dataFilterForm?: FormType;
193
+ normalDataFilterForm?: FormType;
194
+ fullscreenDataFilterForm?: FormType;
184
195
  /** 表格当前的数据 */
185
196
  data?: any[];
186
197
  } & ProTableActionTypeMutations;
@@ -233,8 +244,8 @@ export declare type ProTableTopAreaProps = {
233
244
  extra?: ProActionButtonProps | React.ReactNode | React.ReactNode[];
234
245
  /** 数据过滤区 */
235
246
  dataFilter?: ProTableDataFilterProps;
236
- /** 数据过滤区 form 表单模型 */
237
- dataFilterForm?: FormType;
247
+ /** 传给 QueryFilter formRef */
248
+ dataFilterFormRef?: any;
238
249
  /** 排序、筛选列展示状态 */
239
250
  filterColumnType?: 'dialog' | 'dropdown' | 'auto';
240
251
  };
@@ -132,7 +132,8 @@ export var renderCell = function renderCell(value, item, index, record, actionRe
132
132
  }
133
133
 
134
134
  var newRender = null;
135
- var newDataSource = null; // 如果 render 直接传函数
135
+ var newDataSource = null;
136
+ var props = item.props; // 如果 render 直接传函数
136
137
 
137
138
  if (typeof render === 'function') {
138
139
  newRender = function newRender() {
@@ -140,6 +141,23 @@ export var renderCell = function renderCell(value, item, index, record, actionRe
140
141
  };
141
142
  } else {
142
143
  newRender = processBuriedPoint(processRenderFunction(render, value, index, record), record, value, index);
144
+
145
+ if (valueType === 'selectGroup') {
146
+ newRender = _objectSpread(_objectSpread({
147
+ maxShowNumber: 1,
148
+ foldText: 'more',
149
+ editOnClick: function editOnClick() {},
150
+ edit: true
151
+ }, newRender), {}, {
152
+ ellipsis: false
153
+ });
154
+ props = _objectSpread({
155
+ valueAlias: {
156
+ value: 'TagValue',
157
+ key: 'TagKey'
158
+ }
159
+ }, props);
160
+ }
143
161
  } // 渲染操作组
144
162
 
145
163
 
@@ -182,13 +200,13 @@ export var renderCell = function renderCell(value, item, index, record, actionRe
182
200
  } // 渲染 ProField
183
201
 
184
202
 
185
- return /*#__PURE__*/React.createElement(ProField, {
203
+ return /*#__PURE__*/React.createElement(ProField, _objectSpread({
186
204
  type: valueType || 'text',
187
205
  value: value,
188
206
  render: newRender,
189
207
  dataSource: newDataSource,
190
208
  format: format
191
- });
209
+ }, props));
192
210
  };
193
211
  /**
194
212
  * 处理 render 配置项是函数的情况
@@ -1,5 +1,6 @@
1
1
  /// <reference types="react" />
2
2
  import { ProTableActionType } from '../typing';
3
+ import { ProTableProps, ProTableColumnProps } from '..';
3
4
  export declare function initActionRef(): void;
4
5
  /** table 组件内监听 不对外暴露 */
5
6
  export declare function on(fun: any, key: string): void;
@@ -9,3 +10,9 @@ export declare function off(key: string): void;
9
10
  export declare function emit(key: string, ...args: any): void;
10
11
  export declare function useActionType<T>(ref: React.MutableRefObject<ProTableActionType | undefined>, action: ProTableActionType): void;
11
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;
@@ -173,4 +173,40 @@ export function useActionType(ref, action) {
173
173
  }
174
174
  export function cloneDeep(obj) {
175
175
  return cloneDeepLodash(obj);
176
+ }
177
+ /**
178
+ * 处理默认过滤参数
179
+ * @param columns
180
+ * @param ref
181
+ */
182
+
183
+ export function processDefaultFilter(columns, ref, defaultFilterParams) {
184
+ columns.forEach(function (column) {
185
+ var _column$dataIndex$toS, _column$dataIndex;
186
+
187
+ 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 : ''];
188
+
189
+ if (defaultRules) {
190
+ var _ref$current$getState, _ref$current, _ref$current$getState2, _ref$current$getState3, _ref$current2, _ref$current2$setFilt;
191
+
192
+ var params = '';
193
+ var rules = [];
194
+
195
+ if (Array.isArray(defaultRules)) {
196
+ params = defaultRules.join(',');
197
+ rules = defaultRules;
198
+ } else {
199
+ params = defaultRules;
200
+ rules = [defaultRules];
201
+ } // 需要带上其他所有的信息
202
+
203
+
204
+ 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 : {}; // 再设置所有的列筛选状态
205
+
206
+ (_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, {
207
+ rules: rules,
208
+ params: params
209
+ })));
210
+ }
211
+ });
176
212
  }
@@ -1,2 +1,3 @@
1
1
  import * as utils from '@teamix/utils';
2
+ export * from '@teamix/utils';
2
3
  export default utils;
package/es/utils/index.js CHANGED
@@ -1,2 +1,3 @@
1
1
  import * as utils from '@teamix/utils';
2
+ export * from '@teamix/utils';
2
3
  export default utils;
@@ -255,7 +255,7 @@ function useDialogAction(action, actionContext) {
255
255
  })), _objectSpread2), containerProps), containerOtherProps);
256
256
 
257
257
  var ret = container.show(quickShowProps);
258
- store.hide = ret.hide;
258
+ store.hide = ret ? ret.hide || ret.close : function () {};
259
259
  };
260
260
 
261
261
  return _objectSpread({}, (0, _base.eventHandler)(action, actionContext, onActionStart));
@@ -26,25 +26,28 @@ export declare type ProActionConfig = ({
26
26
  } & LinkAction);
27
27
  export declare function registerActionHandler(id: string, extendActionId: string, defaultConfig: any): void;
28
28
  export declare function useAction(config?: ProActionConfig, context?: any): any;
29
- export interface ProActionButtonProps extends ButtonProps {
30
- key?: string | number;
29
+ export interface ProActionButtonProps extends ProActionCommonProps, ButtonProps {
31
30
  config?: ProActionConfig;
32
- visible?: any;
33
31
  disabled?: any;
34
32
  icon?: string;
35
- context?: any;
36
33
  onClick?: (event: React.MouseEvent<Element, MouseEvent>, context?: any) => void;
37
34
  }
38
35
  export declare const ProActionButton: (props: ProActionButtonProps) => JSX.Element;
39
- export interface ProActionMenuButtonProps extends MenuButtonProps {
36
+ export interface ProActionCommonProps {
40
37
  key?: string | number;
41
- actions: ProActionProps[];
42
38
  visible?: any;
43
- icon?: string;
44
39
  context?: any;
45
40
  }
41
+ export interface ProActionMenuButtonProps extends ProActionCommonProps, Omit<MenuButtonProps, 'visible'> {
42
+ actions: ProActionProps[];
43
+ icon?: string;
44
+ noArrow?: boolean;
45
+ }
46
46
  export declare const ProActionMenuButton: (props: ProActionMenuButtonProps) => JSX.Element;
47
- export declare type ProActionProps = ProActionButtonProps | ProActionMenuButtonProps;
47
+ export interface ProActionDividerProps extends ProActionCommonProps {
48
+ type: 'divider';
49
+ }
50
+ export declare type ProActionProps = ProActionButtonProps | ProActionMenuButtonProps | ProActionDividerProps;
48
51
  export declare type ProActionGroupProps = {
49
52
  /** 操作组类型:按钮、文字按钮 */
50
53
  type?: 'button' | 'text';
@@ -59,7 +62,7 @@ export declare type ProActionGroupProps = {
59
62
  */
60
63
  moreText?: string;
61
64
  /** 更多按钮的配置,只有在actions数量超过max时才有效 */
62
- more?: string | ProActionButtonProps;
65
+ more?: string | Omit<ProActionMenuButtonProps, 'actions'>;
63
66
  /** 是否有分割线,只有type="text"时生效,默认有分割线 */
64
67
  divider?: boolean;
65
68
  } & React.HTMLAttributes<HTMLElement>;