@teamix/pro 1.2.31 → 1.2.35

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 (89) hide show
  1. package/dist/pro.css +1 -1
  2. package/dist/pro.js +16186 -16728
  3. package/dist/pro.min.css +1 -1
  4. package/dist/pro.min.js +1 -1
  5. package/es/actions/dialog-form.js +58 -9
  6. package/es/common.scss +22 -0
  7. package/es/form/Filter/index.d.ts +5 -9
  8. package/es/form/Filter/index.js +489 -152
  9. package/es/form/Filter/index.scss +33 -11
  10. package/es/form/Filter/index2.d.ts +9 -5
  11. package/es/form/Filter/index2.js +154 -370
  12. package/es/form/Filter/index2.scss +11 -33
  13. package/es/form/Filter/useSpecialProps.d.ts +1 -1
  14. package/es/form/Filter/useSpecialProps.js +9 -9
  15. package/es/form/ProForm/index.js +4 -4
  16. package/es/form/ProForm/index.scss +5 -0
  17. package/es/form/SchemaForm/index.js +5 -5
  18. package/es/form/SchemaForm/initializeDataSource.d.ts +1 -1
  19. package/es/form/SchemaForm/initializeDataSource.js +2 -2
  20. package/es/form/SchemaForm/initializeRequest.d.ts +1 -1
  21. package/es/form/SchemaForm/initializeRequest.js +41 -5
  22. package/es/form/SchemaForm/reactions.d.ts +3 -3
  23. package/es/form/SchemaForm/reactions.js +39 -19
  24. package/es/form/index.d.ts +3 -3
  25. package/es/form/index.js +3 -3
  26. package/es/form/typing.d.ts +7 -1
  27. package/es/index.d.ts +1 -1
  28. package/es/index.js +1 -1
  29. package/es/info/components/InfoValueItem/index.js +38 -12
  30. package/es/info/components/InfoValueItem/index.scss +1 -0
  31. package/es/info/components/ProInfoItem/index.js +6 -3
  32. package/es/info/components/ProInfoItem/index.scss +9 -0
  33. package/es/info/components/baseInfo/index.js +2 -1
  34. package/es/info/components/headerInfo/index.js +2 -1
  35. package/es/info/components/tableInfo/index.js +2 -1
  36. package/es/info/index.scss +2 -0
  37. package/es/info/typing.d.ts +3 -0
  38. package/es/page-header/index.js +3 -3
  39. package/es/table/components/Layout/index.js +29 -23
  40. package/es/table/components/Layout/index.scss +7 -0
  41. package/es/table/components/ToolBar/Fullscreen.js +39 -15
  42. package/es/table/components/ToolBar/index.scss +1 -0
  43. package/es/table/index.js +63 -40
  44. package/es/table/typing.d.ts +3 -0
  45. package/es/table/utils/columnRender.js +1 -1
  46. package/lib/actions/dialog-form.js +57 -10
  47. package/lib/common.scss +22 -0
  48. package/lib/form/Filter/index.d.ts +5 -9
  49. package/lib/form/Filter/index.js +504 -154
  50. package/lib/form/Filter/index.scss +33 -11
  51. package/lib/form/Filter/index2.d.ts +9 -5
  52. package/lib/form/Filter/index2.js +154 -383
  53. package/lib/form/Filter/index2.scss +11 -33
  54. package/lib/form/Filter/useSpecialProps.d.ts +1 -1
  55. package/lib/form/Filter/useSpecialProps.js +8 -8
  56. package/lib/form/ProForm/index.js +4 -4
  57. package/lib/form/ProForm/index.scss +5 -0
  58. package/lib/form/SchemaForm/index.js +5 -5
  59. package/lib/form/SchemaForm/initializeDataSource.d.ts +1 -1
  60. package/lib/form/SchemaForm/initializeDataSource.js +2 -2
  61. package/lib/form/SchemaForm/initializeRequest.d.ts +1 -1
  62. package/lib/form/SchemaForm/initializeRequest.js +41 -5
  63. package/lib/form/SchemaForm/reactions.d.ts +3 -3
  64. package/lib/form/SchemaForm/reactions.js +39 -19
  65. package/lib/form/index.d.ts +3 -3
  66. package/lib/form/index.js +8 -8
  67. package/lib/form/typing.d.ts +7 -1
  68. package/lib/index.d.ts +1 -1
  69. package/lib/index.js +1 -1
  70. package/lib/info/components/InfoValueItem/index.js +38 -12
  71. package/lib/info/components/InfoValueItem/index.scss +1 -0
  72. package/lib/info/components/ProInfoItem/index.js +6 -3
  73. package/lib/info/components/ProInfoItem/index.scss +9 -0
  74. package/lib/info/components/baseInfo/index.js +2 -1
  75. package/lib/info/components/headerInfo/index.js +2 -1
  76. package/lib/info/components/tableInfo/index.js +2 -1
  77. package/lib/info/index.scss +2 -0
  78. package/lib/info/typing.d.ts +3 -0
  79. package/lib/page-header/index.js +2 -2
  80. package/lib/table/components/Layout/index.js +29 -23
  81. package/lib/table/components/Layout/index.scss +7 -0
  82. package/lib/table/components/ToolBar/Fullscreen.js +37 -14
  83. package/lib/table/components/ToolBar/index.scss +1 -0
  84. package/lib/table/index.js +63 -40
  85. package/lib/table/typing.d.ts +3 -0
  86. package/lib/table/utils/columnRender.js +1 -1
  87. package/package.json +1 -1
  88. package/dist/212.js +0 -155705
  89. package/dist/fonts/codicon.ttf +0 -0
@@ -17,7 +17,7 @@ import { useHistory } from 'react-router-dom';
17
17
  import classnames from 'classnames';
18
18
  import TeamixIcon from '@teamix/icon';
19
19
  import { Breadcrumb } from '@alicloudfe/components';
20
- import { baseClass, goToLink, renderTags, isPresetColor, getColorClassName, getBackgroundColorClassName } from '@teamix/utils';
20
+ import { baseClass, goToLink, renderTags, isPresetColor, getColor, getColorClassName, getBackgroundColorClassName } from '@teamix/utils';
21
21
  import { ProActionGroup } from '../actions';
22
22
  import { ProSkeletonRaw } from '../skeleton';
23
23
  import ProInfo from '../info';
@@ -69,8 +69,8 @@ var getColorAndStyle = function getColorAndStyle(color, backgroundColor, backgro
69
69
  var isColorPresetColor = isPresetColor(color);
70
70
  var isBgColorPresetColor = isPresetColor(backgroundColor);
71
71
  var className = classnames((_classnames = {}, _defineProperty(_classnames, "".concat(getColorClassName(color)), isColorPresetColor), _defineProperty(_classnames, "".concat(getBackgroundColorClassName(backgroundColor)), isBgColorPresetColor), _defineProperty(_classnames, "".concat(cls("bg-type-".concat(backgroundType))), !!backgroundType), _classnames));
72
- var styleColor = isColorPresetColor ? undefined : color;
73
- var styleBgColor = isBgColorPresetColor ? undefined : backgroundColor;
72
+ var styleColor = isColorPresetColor ? getColor(color) : color;
73
+ var styleBgColor = isBgColorPresetColor ? getColor(color) : backgroundColor;
74
74
  var style = {
75
75
  color: styleColor,
76
76
  backgroundColor: styleBgColor
@@ -56,6 +56,19 @@ var Layout = function Layout(props) {
56
56
  context: _objectSpread(_objectSpread({}, defaultContext), mainAction.context)
57
57
  })));
58
58
  } else return mainAction;
59
+ }; // 渲染 addonAfter
60
+
61
+
62
+ var renderAddonAfter = function renderAddonAfter() {
63
+ return /*#__PURE__*/React.createElement("div", {
64
+ className: cls('addon-after-wrapper')
65
+ }, extra && !header && /*#__PURE__*/React.createElement(QuickAction, {
66
+ actionRef: actionRef,
67
+ quickAction: extra,
68
+ rowSelection: rowSelection
69
+ }), /*#__PURE__*/React.createElement(ToolBar, _objectSpread({
70
+ actionRef: actionRef
71
+ }, otherProps)));
59
72
  }; // 渲染新版 QueryFilter
60
73
 
61
74
 
@@ -83,13 +96,7 @@ var Layout = function Layout(props) {
83
96
  },
84
97
  panelContent: dataFilter.content,
85
98
  addonBefore: renderMainAction(),
86
- addonAfter: /*#__PURE__*/React.createElement(React.Fragment, null, extra && !header && /*#__PURE__*/React.createElement(QuickAction, {
87
- actionRef: actionRef,
88
- quickAction: extra,
89
- rowSelection: rowSelection
90
- }), /*#__PURE__*/React.createElement(ToolBar, _objectSpread({
91
- actionRef: actionRef
92
- }, otherProps)))
99
+ addonAfter: renderAddonAfter()
93
100
  }, dataFilter));
94
101
  } else if ((dataFilter === null || dataFilter === void 0 ? void 0 : (_dataFilter$schema2 = dataFilter.schema) === null || _dataFilter$schema2 === void 0 ? void 0 : _dataFilter$schema2.length) >= 0) {
95
102
  return /*#__PURE__*/React.createElement(QueryFilter, _objectSpread({
@@ -108,27 +115,18 @@ var Layout = function Layout(props) {
108
115
  (dataFilter === null || dataFilter === void 0 ? void 0 : dataFilter.onExpand) && (dataFilter === null || dataFilter === void 0 ? void 0 : dataFilter.onExpand(expand));
109
116
  },
110
117
  addonBefore: renderMainAction(),
111
- addonAfter: /*#__PURE__*/React.createElement(React.Fragment, null, extra && !header && /*#__PURE__*/React.createElement(QuickAction, {
112
- actionRef: actionRef,
113
- quickAction: extra,
114
- rowSelection: rowSelection
115
- }), /*#__PURE__*/React.createElement(ToolBar, _objectSpread({
116
- actionRef: actionRef
117
- }, otherProps)))
118
+ addonAfter: renderAddonAfter()
118
119
  }, dataFilter));
119
120
  }
120
121
  } else if (mainAction) {
121
122
  // 没传 dataFilter 但是传了 mainAction
122
123
  return /*#__PURE__*/React.createElement(QueryFilterLayout, {
123
- className: "mb8",
124
124
  addonBefore: renderMainAction(),
125
- addonAfter: /*#__PURE__*/React.createElement(React.Fragment, null, extra && !header && /*#__PURE__*/React.createElement(QuickAction, {
126
- actionRef: actionRef,
127
- quickAction: extra,
128
- rowSelection: rowSelection
129
- }), /*#__PURE__*/React.createElement(ToolBar, _objectSpread({
130
- actionRef: actionRef
131
- }, otherProps)))
125
+ addonAfter: renderAddonAfter()
126
+ });
127
+ } else {
128
+ return /*#__PURE__*/React.createElement(QueryFilterLayout, {
129
+ addonAfter: renderAddonAfter()
132
130
  });
133
131
  }
134
132
  }; // 区域组合渲染
@@ -148,11 +146,19 @@ var Layout = function Layout(props) {
148
146
  rowSelection: rowSelection
149
147
  }))), renderQueryFilter());
150
148
  } else if (header && !mainAction) {
149
+ var _dataFilter$schema3, _dataFilter$schema4;
150
+
151
151
  return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
152
152
  className: cls('wrapper')
153
153
  }, /*#__PURE__*/React.createElement("div", {
154
154
  className: cls('left')
155
- }, header && /*#__PURE__*/React.createElement(Header, _objectSpread({}, header)), renderQueryFilter())));
155
+ }, header && /*#__PURE__*/React.createElement(Header, _objectSpread({}, header)), (dataFilter === null || dataFilter === void 0 ? void 0 : (_dataFilter$schema3 = dataFilter.schema) === null || _dataFilter$schema3 === void 0 ? void 0 : _dataFilter$schema3.length) && renderQueryFilter()), /*#__PURE__*/React.createElement("div", {
156
+ className: cls('right')
157
+ }, extra && /*#__PURE__*/React.createElement(QuickAction, {
158
+ actionRef: actionRef,
159
+ quickAction: extra,
160
+ rowSelection: rowSelection
161
+ }), !(dataFilter === null || dataFilter === void 0 ? void 0 : (_dataFilter$schema4 = dataFilter.schema) === null || _dataFilter$schema4 === void 0 ? void 0 : _dataFilter$schema4.length) && renderQueryFilter())));
156
162
  } else if (!header && mainAction) {
157
163
  return /*#__PURE__*/React.createElement(React.Fragment, null, renderQueryFilter());
158
164
  } else if (!header && !mainAction) {
@@ -37,4 +37,11 @@ $prefix: 'teamix-pro-table-layout';
37
37
  padding: 16px;
38
38
  background: var(--panel-filter-bg, var(--color-fill1-2));
39
39
  }
40
+ &-main-action {
41
+ margin-bottom: 8px;
42
+ }
43
+ &-addon-after-wrapper {
44
+ display: flex;
45
+ align-items: center;
46
+ }
40
47
  }
@@ -1,7 +1,7 @@
1
1
  import React, { useEffect } from 'react';
2
2
  import { Message, Overlay } from '@alicloudfe/components';
3
3
  import './index.scss';
4
- import { getMessage } from '@teamix/utils';
4
+ import { getMessage, getValidValues } from '@teamix/utils';
5
5
 
6
6
  var FullScreen = function FullScreen(props) {
7
7
  var children = props.children,
@@ -9,35 +9,59 @@ var FullScreen = function FullScreen(props) {
9
9
  actionRef = props.actionRef;
10
10
  var _actionRef$current = actionRef.current,
11
11
  normalDataFilterForm = _actionRef$current.normalDataFilterForm,
12
- fullscreenDataFilterForm = _actionRef$current.fullscreenDataFilterForm;
12
+ fullscreenDataFilterForm = _actionRef$current.fullscreenDataFilterForm,
13
+ filterEnableRef = _actionRef$current.filterEnableRef;
13
14
 
14
- function closeByESC(e) {
15
+ var closeByESC = function closeByESC(e) {
15
16
  if (visible && e.code === 'Escape') {
16
- var _actionRef$current2, _actionRef$current2$s, _actionRef$current3, _actionRef$current3$f;
17
+ var _actionRef$current2, _actionRef$current2$f;
17
18
 
18
- actionRef === null || actionRef === void 0 ? void 0 : (_actionRef$current2 = actionRef.current) === null || _actionRef$current2 === void 0 ? void 0 : (_actionRef$current2$s = _actionRef$current2.setFullScreenState) === null || _actionRef$current2$s === void 0 ? void 0 : _actionRef$current2$s.call(_actionRef$current2, false);
19
- actionRef === null || actionRef === void 0 ? void 0 : (_actionRef$current3 = actionRef.current) === null || _actionRef$current3 === void 0 ? void 0 : (_actionRef$current3$f = _actionRef$current3.fullScreen) === null || _actionRef$current3$f === void 0 ? void 0 : _actionRef$current3$f.call(_actionRef$current3);
19
+ actionRef === null || actionRef === void 0 ? void 0 : (_actionRef$current2 = actionRef.current) === null || _actionRef$current2 === void 0 ? void 0 : (_actionRef$current2$f = _actionRef$current2.fullScreen) === null || _actionRef$current2$f === void 0 ? void 0 : _actionRef$current2$f.call(_actionRef$current2);
20
20
  }
21
- } // 监听esc按钮
21
+ }; // 监听esc按钮
22
22
 
23
23
 
24
24
  useEffect(function () {
25
- var _actionRef$current4, _actionRef$current4$s;
26
-
27
- actionRef === null || actionRef === void 0 ? void 0 : (_actionRef$current4 = actionRef.current) === null || _actionRef$current4 === void 0 ? void 0 : (_actionRef$current4$s = _actionRef$current4.setFullScreenState) === null || _actionRef$current4$s === void 0 ? void 0 : _actionRef$current4$s.call(_actionRef$current4, visible);
28
25
  window.addEventListener('keydown', closeByESC);
29
26
  return function () {
30
27
  window.removeEventListener('keydown', closeByESC);
31
28
  };
32
- }, [visible]);
29
+ }, [visible, actionRef]);
33
30
 
34
31
  var afterClose = function afterClose() {
35
- normalDataFilterForm === null || normalDataFilterForm === void 0 ? void 0 : normalDataFilterForm.setValues(fullscreenDataFilterForm.values);
32
+ // 判断全屏前后筛选表单值是否有改变
33
+ var n = JSON.stringify(getValidValues(normalDataFilterForm.values));
34
+ var f = JSON.stringify(getValidValues(fullscreenDataFilterForm.values));
35
+
36
+ if (n === f) {
37
+ // 关闭全屏后,表单值未变化,开启普通表单onFilter
38
+ filterEnableRef.current.normal = true;
39
+ } else {
40
+ // 关闭全屏后,表单值有变化,修改表单值
41
+ normalDataFilterForm === null || normalDataFilterForm === void 0 ? void 0 : normalDataFilterForm.setValues(fullscreenDataFilterForm.values);
42
+ } // 关闭全屏后,关闭全屏表单onFilter
43
+
44
+
45
+ filterEnableRef.current.fullscreen = false;
36
46
  }; // 全屏开启之后
37
47
 
38
48
 
39
49
  var afterOpen = function afterOpen() {
40
- fullscreenDataFilterForm.setValues(normalDataFilterForm.values);
50
+ // 判断全屏前后筛选表单值是否有改变
51
+ var n = JSON.stringify(getValidValues(normalDataFilterForm.values));
52
+ var f = JSON.stringify(getValidValues(fullscreenDataFilterForm.values));
53
+
54
+ if (n === f) {
55
+ // 全屏后,表单值未变化,开启全屏表单onFilter
56
+ filterEnableRef.current.fullscreen = true;
57
+ } else {
58
+ // 全屏后,表单值变化,修改表单值
59
+ fullscreenDataFilterForm === null || fullscreenDataFilterForm === void 0 ? void 0 : fullscreenDataFilterForm.setValues(normalDataFilterForm.values);
60
+ } // 全屏后,关闭普通表单onFilter
61
+
62
+
63
+ filterEnableRef.current.normal = false; // 消息提示
64
+
41
65
  Message.show({
42
66
  type: 'notice',
43
67
  content: /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("span", null, getMessage('press')), /*#__PURE__*/React.createElement("span", {
@@ -67,9 +91,9 @@ var FullScreen = function FullScreen(props) {
67
91
  zIndex: 999
68
92
  },
69
93
  onRequestClose: function onRequestClose() {
70
- var _actionRef$current5, _actionRef$current5$f;
94
+ var _actionRef$current3, _actionRef$current3$f;
71
95
 
72
- actionRef === null || actionRef === void 0 ? void 0 : (_actionRef$current5 = actionRef.current) === null || _actionRef$current5 === void 0 ? void 0 : (_actionRef$current5$f = _actionRef$current5.fullScreen) === null || _actionRef$current5$f === void 0 ? void 0 : _actionRef$current5$f.call(_actionRef$current5);
96
+ actionRef === null || actionRef === void 0 ? void 0 : (_actionRef$current3 = actionRef.current) === null || _actionRef$current3 === void 0 ? void 0 : (_actionRef$current3$f = _actionRef$current3.fullScreen) === null || _actionRef$current3$f === void 0 ? void 0 : _actionRef$current3$f.call(_actionRef$current3);
73
97
  }
74
98
  }, /*#__PURE__*/React.createElement("div", {
75
99
  className: "teamix-pro-table-full-screen"
@@ -1,6 +1,7 @@
1
1
  .teamix-pro-table-toolbar {
2
2
  width: 100%;
3
3
  text-align: right;
4
+ margin-bottom: 8px;
4
5
  }
5
6
  .teamix-pro-table-toolbar-custom {
6
7
  display: inline-block;
package/es/table/index.js CHANGED
@@ -121,7 +121,7 @@ var globalFormatSort = function globalFormatSort(sort) {
121
121
  };
122
122
 
123
123
  var ProTable = function ProTable(props) {
124
- var _rowSelection$selecte, _dataFilterForm4;
124
+ var _rowSelection$selecte;
125
125
 
126
126
  var header = props.header,
127
127
  className = props.className,
@@ -287,16 +287,21 @@ var ProTable = function ProTable(props) {
287
287
  var _useState27 = useState(false),
288
288
  _useState28 = _slicedToArray(_useState27, 2),
289
289
  fullscreenState = _useState28[0],
290
- setFullscreenState = _useState28[1]; // 非全屏状态下的
290
+ setFullscreenState = _useState28[1]; // 切换全屏搜索开关
291
291
 
292
292
 
293
+ var filterEnableRef = useRef({
294
+ fullscreen: false,
295
+ normal: true
296
+ }); // 非全屏状态下的
297
+
293
298
  var normalDataFilterFormRef = useRef();
294
299
  var fullscreenDataFilterFormRef = useRef();
295
300
  var normalDataFilterForm = normalDataFilterFormRef.current;
296
301
  var fullscreenDataFilterForm = fullscreenDataFilterFormRef.current; // 传给 QueryFilter 的 formRef
297
302
 
298
- var dataFilterFormRef = !fullscreenState ? normalDataFilterFormRef : fullscreenDataFilterFormRef;
299
- var dataFilterForm = dataFilterFormRef.current; // 整个内容区是否超过一屏。用于表格在非全屏模式下的吸底
303
+ var dataFilterFormRef = !fullscreenState ? normalDataFilterFormRef : fullscreenDataFilterFormRef; // let dataFilterForm = dataFilterFormRef.current;
304
+ // 整个内容区是否超过一屏。用于表格在非全屏模式下的吸底
300
305
 
301
306
  var _useState29 = useState(false),
302
307
  _useState30 = _slicedToArray(_useState29, 2),
@@ -463,21 +468,24 @@ var ProTable = function ProTable(props) {
463
468
 
464
469
  useActionType(actionRef, {
465
470
  fullScreen: function fullScreen() {
471
+ var _actionRef$current2, _actionRef$current2$s;
472
+
466
473
  var state = !fullscreenState; // 全屏时需要重新计算header高度
467
474
 
468
475
  getHeaderHeight().then(function (height) {
469
476
  setHeaderHeight(height);
470
477
  });
471
478
  setFullscreenState(state);
479
+ actionRef === null || actionRef === void 0 ? void 0 : (_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, 'fullScreenState', state);
472
480
  return state;
473
481
  },
474
482
  setColumn: function setColumn(newColumns) {
475
- var _actionRef$current2, _actionRef$current2$s;
483
+ var _actionRef$current3, _actionRef$current3$s;
476
484
 
477
485
  var update = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
478
486
  var columns = processColumns(newColumns, propsColumns);
479
487
  setFilteredColumns(columns);
480
- (_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);
488
+ (_actionRef$current3 = actionRef.current) === null || _actionRef$current3 === void 0 ? void 0 : (_actionRef$current3$s = _actionRef$current3.setState) === null || _actionRef$current3$s === void 0 ? void 0 : _actionRef$current3$s.call(_actionRef$current3, 'filterColumns', columns);
481
489
 
482
490
  if (update) {
483
491
  emit('refreshFilterState', newColumns);
@@ -502,12 +510,12 @@ var ProTable = function ProTable(props) {
502
510
  _request(params);
503
511
  },
504
512
  reset: function reset() {
505
- var _actionRef$current3, _actionRef$current3$s, _dataFilterForm;
513
+ var _actionRef$current4, _actionRef$current4$s, _dataFilterFormRef$cu;
506
514
 
507
515
  (propsDataFilter === null || propsDataFilter === void 0 ? void 0 : propsDataFilter.onReset) && (propsDataFilter === null || propsDataFilter === void 0 ? void 0 : propsDataFilter.onReset()); // 清空列过滤参数
508
516
 
509
- (_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, {});
510
- (_dataFilterForm = dataFilterForm) === null || _dataFilterForm === void 0 ? void 0 : _dataFilterForm.reset();
517
+ (_actionRef$current4 = actionRef.current) === null || _actionRef$current4 === void 0 ? void 0 : (_actionRef$current4$s = _actionRef$current4.setFilterRules) === null || _actionRef$current4$s === void 0 ? void 0 : _actionRef$current4$s.call(_actionRef$current4, {});
518
+ (_dataFilterFormRef$cu = dataFilterFormRef.current) === null || _dataFilterFormRef$cu === void 0 ? void 0 : _dataFilterFormRef$cu.reset();
511
519
  setCurrentPage(1);
512
520
 
513
521
  _request(_defineProperty({}, targetPageKey, 1));
@@ -529,9 +537,11 @@ var ProTable = function ProTable(props) {
529
537
  pageSize: pageSize
530
538
  },
531
539
  data: data,
532
- dataFilterForm: dataFilterForm,
540
+ dataFilterForm: dataFilterFormRef.current,
541
+ dataFilterFormRef: dataFilterFormRef,
533
542
  normalDataFilterForm: normalDataFilterForm,
534
543
  fullscreenDataFilterForm: fullscreenDataFilterForm,
544
+ filterEnableRef: filterEnableRef,
535
545
  resetTableMaxBodyHeight: function resetTableMaxBodyHeight() {
536
546
  getHeaderHeight().then(function (height) {
537
547
  setHeaderHeight(height);
@@ -620,8 +630,8 @@ var ProTable = function ProTable(props) {
620
630
  }
621
631
  }); // 请求函数
622
632
 
623
- function _request(params, noLoading) {
624
- var _dataFilterForm2, _actionRef$current$ge, _actionRef$current4, _actionRef$current4$g, _objectSpread2;
633
+ function _request(params, noLoading, filterParams) {
634
+ var _dataFilterFormRef$cu2, _actionRef$current$ge, _actionRef$current5, _actionRef$current5$g, _objectSpread2;
625
635
 
626
636
  // 如果没有传 url 且没有 customRequest,直接返回
627
637
  if (!url && !customRequest) {
@@ -634,9 +644,9 @@ var ProTable = function ProTable(props) {
634
644
 
635
645
  var sortParams = targetFormatSort(sort); // 筛选区请求参数
636
646
 
637
- var dataFilterParams = toJS((_dataFilterForm2 = dataFilterForm) === null || _dataFilterForm2 === void 0 ? void 0 : _dataFilterForm2.values); // 列过滤请求参数
647
+ var dataFilterParams = filterParams !== null && filterParams !== void 0 ? filterParams : (_dataFilterFormRef$cu2 = dataFilterFormRef.current) === null || _dataFilterFormRef$cu2 === void 0 ? void 0 : _dataFilterFormRef$cu2.values; // 列过滤请求参数
638
648
 
639
- 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 : {}; // 格式化后的请求参数
649
+ var columnsFilterParams = (_actionRef$current$ge = (_actionRef$current5 = actionRef.current) === null || _actionRef$current5 === void 0 ? void 0 : (_actionRef$current5$g = _actionRef$current5.getFilterRules) === null || _actionRef$current5$g === void 0 ? void 0 : _actionRef$current5$g.call(_actionRef$current5)) !== null && _actionRef$current$ge !== void 0 ? _actionRef$current$ge : {}; // 格式化后的请求参数
640
650
 
641
651
  var requestData = formatParams(_objectSpread(_objectSpread({}, !showPagination ? _objectSpread(_objectSpread(_objectSpread(_objectSpread({}, dataFilterParams), propsParams), sortParams), columnsFilterParams) : _objectSpread(_objectSpread(_objectSpread(_objectSpread((_objectSpread2 = {}, _defineProperty(_objectSpread2, targetPageKey, currentPage), _defineProperty(_objectSpread2, targetPageSizeKey, pageSize), _objectSpread2), dataFilterParams), propsParams), sortParams), columnsFilterParams)), params));
642
652
 
@@ -685,31 +695,24 @@ var ProTable = function ProTable(props) {
685
695
  }
686
696
 
687
697
  useEffect(function () {
688
- dataFilterForm = dataFilterFormRef.current; // 监听 浏览器变化 更吸底状态
698
+ var _propsDataFilter$sche, _propsDataFilter$sche2;
689
699
 
700
+ // 监听 浏览器变化 更吸底状态
690
701
  if (footerSuction) {
691
702
  getFooterSuctionState();
692
703
 
693
704
  window.onresize = function () {
694
705
  getFooterSuctionState();
695
706
  };
696
- }
707
+ } // 如果不传 dataFilter,则在这里初始化请求
697
708
 
698
- if (propsDataFilter) {
699
- var _dataFilterForm3;
700
709
 
701
- if (requestWhenMount && ((_dataFilterForm3 = dataFilterForm) === null || _dataFilterForm3 === void 0 ? void 0 : _dataFilterForm3.id)) {
702
- // 在请求发送之前 处理漏斗默认数据
703
- processDefaultFilter(propsColumns, actionRef, defaultFilterParams);
710
+ var hasDataFilter = (propsDataFilter === null || propsDataFilter === void 0 ? void 0 : (_propsDataFilter$sche = propsDataFilter.schema) === null || _propsDataFilter$sche === void 0 ? void 0 : _propsDataFilter$sche.length) && (propsDataFilter === null || propsDataFilter === void 0 ? void 0 : (_propsDataFilter$sche2 = propsDataFilter.schema) === null || _propsDataFilter$sche2 === void 0 ? void 0 : _propsDataFilter$sche2.length) > 0;
704
711
 
705
- _request();
706
- }
707
- } else {
708
- if (requestWhenMount) {
709
- processDefaultFilter(propsColumns, actionRef, defaultFilterParams);
712
+ if (requestWhenMount && !hasDataFilter) {
713
+ processDefaultFilter(propsColumns, actionRef, defaultFilterParams);
710
714
 
711
- _request();
712
- }
715
+ _request();
713
716
  }
714
717
 
715
718
  return function () {
@@ -723,7 +726,7 @@ var ProTable = function ProTable(props) {
723
726
 
724
727
  actionRef.current = undefined;
725
728
  };
726
- }, [(_dataFilterForm4 = dataFilterForm) === null || _dataFilterForm4 === void 0 ? void 0 : _dataFilterForm4.id]);
729
+ }, []);
727
730
 
728
731
  function onSort(dataIndex, order) {
729
732
  var nextSort = _defineProperty({}, dataIndex, order);
@@ -737,24 +740,44 @@ var ProTable = function ProTable(props) {
737
740
  var dataFilter = _objectSpread(_objectSpread({
738
741
  mode: 'inline'
739
742
  }, propsDataFilter), {}, {
743
+ onInit: function onInit(values) {
744
+ // 表单初始化请求处理
745
+ console.log('onInit');
746
+ (propsDataFilter === null || propsDataFilter === void 0 ? void 0 : propsDataFilter.onInit) && (propsDataFilter === null || propsDataFilter === void 0 ? void 0 : propsDataFilter.onInit(values));
747
+ !fullscreenState && _request({}, false, values);
748
+ return true;
749
+ },
740
750
  onFilter: function onFilter(values) {
741
- var _actionRef$current5, _actionRef$current5$c;
751
+ var _actionRef$current6, _actionRef$current6$c;
752
+
753
+ console.log('onFilter'); // 全屏状态,判断全屏表单onFilter是否禁用
754
+
755
+ if (fullscreenState && !filterEnableRef.current.fullscreen) {
756
+ filterEnableRef.current.fullscreen = true;
757
+ return;
758
+ } // 非全屏状态,判断普通表单onFiler是否禁用
759
+
760
+
761
+ if (!fullscreenState && !filterEnableRef.current.normal) {
762
+ filterEnableRef.current.normal = true;
763
+ return;
764
+ }
742
765
 
743
766
  (propsDataFilter === null || propsDataFilter === void 0 ? void 0 : propsDataFilter.onFilter) && (propsDataFilter === null || propsDataFilter === void 0 ? void 0 : propsDataFilter.onFilter(values)); // 搜索变化时,暂时先清空选择
744
767
 
745
- (_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);
768
+ (_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);
746
769
  setCurrentPage(1);
747
770
 
748
- _request(_defineProperty({}, targetPageKey, 1));
771
+ _request(_defineProperty({}, targetPageKey, 1), false, values);
749
772
  },
750
- onReset: function onReset() {
751
- var _dataFilterForm5;
773
+ onReset: function onReset(values) {
774
+ var _dataFilterFormRef$cu3;
752
775
 
753
776
  (propsDataFilter === null || propsDataFilter === void 0 ? void 0 : propsDataFilter.onReset) && (propsDataFilter === null || propsDataFilter === void 0 ? void 0 : propsDataFilter.onReset());
754
- (_dataFilterForm5 = dataFilterForm) === null || _dataFilterForm5 === void 0 ? void 0 : _dataFilterForm5.reset();
777
+ (_dataFilterFormRef$cu3 = dataFilterFormRef.current) === null || _dataFilterFormRef$cu3 === void 0 ? void 0 : _dataFilterFormRef$cu3.reset();
755
778
  setCurrentPage(1);
756
779
 
757
- _request(_defineProperty({}, targetPageKey, 1));
780
+ _request(_defineProperty({}, targetPageKey, 1), false, values);
758
781
  }
759
782
  });
760
783
 
@@ -838,21 +861,21 @@ var ProTable = function ProTable(props) {
838
861
 
839
862
  var renderFooter = function renderFooter() {
840
863
  function onChangePagination(currentPage) {
841
- var _actionRef$current6, _actionRef$current6$c;
864
+ var _actionRef$current7, _actionRef$current7$c;
842
865
 
843
866
  var params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
844
867
  // 翻页暂时先清空选择
845
- (_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);
868
+ (_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);
846
869
  setCurrentPage(currentPage);
847
870
 
848
871
  _request(_objectSpread(_defineProperty({}, targetPageKey, currentPage), params));
849
872
  }
850
873
 
851
874
  function onChangePaginationSize(currentPageSize) {
852
- var _actionRef$current7, _actionRef$current7$c, _request5;
875
+ var _actionRef$current8, _actionRef$current8$c, _request5;
853
876
 
854
877
  // 翻页暂时先清空选择
855
- (_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);
878
+ (_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);
856
879
  setPageSize(currentPageSize);
857
880
  setCurrentPage(1);
858
881
 
@@ -190,8 +190,11 @@ export declare type ProTableActionType = {
190
190
  resetPage?: () => void;
191
191
  /** 获取数据过滤区表单实例 */
192
192
  dataFilterForm?: FormType;
193
+ /** 用于在 mount 的时候获取到表单 ref */
194
+ dataFilterFormRef?: React.MutableRefObject<FormType>;
193
195
  normalDataFilterForm?: FormType;
194
196
  fullscreenDataFilterForm?: FormType;
197
+ filterEnableRef?: any;
195
198
  /** 表格当前的数据 */
196
199
  data?: any[];
197
200
  } & ProTableActionTypeMutations;
@@ -223,7 +223,7 @@ var processRenderFunction = function processRenderFunction() {
223
223
  var index = arguments.length > 2 ? arguments[2] : undefined;
224
224
  var record = arguments.length > 3 ? arguments[3] : undefined;
225
225
  // 当 ProField render 类型为 function 时。需要表格预先处理以塞入 record
226
- var external = ['linkOnClick', 'link', 'value', 'renderEdit', 'descriptionRenderEdit', 'editPopConfirmProps', 'descriptionEditPopConfirmProps', 'editOnClick', 'descriptionEditOnClick'];
226
+ var external = ['linkOnClick', 'link', 'value', 'renderEdit', 'descriptionRenderEdit', 'editPopConfirmProps', 'descriptionEditPopConfirmProps', 'editOnClick', 'descriptionEditOnClick', 'extra', 'prefixExtra'];
227
227
  return Object.fromEntries(Object.entries(render).map(function (_ref3) {
228
228
  var _ref4 = _slicedToArray(_ref3, 2),
229
229
  k = _ref4[0],
@@ -1,7 +1,5 @@
1
1
  "use strict";
2
2
 
3
- function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
4
-
5
3
  Object.defineProperty(exports, "__esModule", {
6
4
  value: true
7
5
  });
@@ -25,7 +23,7 @@ var _dialog = _interopRequireDefault(require("./dialog"));
25
23
  var _utils2 = require("./utils");
26
24
 
27
25
  var _excluded = ["schema"],
28
- _excluded2 = ["schema", "useFieldValuesForRequest", "initialValues", "initialRequest", "formProps", "size", "onFinish"];
26
+ _excluded2 = ["schema", "useFieldValuesForRequest", "initialValues", "initialRequest", "formProps", "size", "onFinish", "beforeRequest"];
29
27
 
30
28
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
31
29
 
@@ -33,6 +31,12 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
33
31
 
34
32
  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; }
35
33
 
34
+ 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); }
35
+
36
+ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
37
+
38
+ function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
39
+
36
40
  function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
37
41
 
38
42
  function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
@@ -157,6 +161,7 @@ function useDialogFormAction(action, context) {
157
161
  _action$size = action.size,
158
162
  size = _action$size === void 0 ? 'small' : _action$size,
159
163
  _onFinish = action.onFinish,
164
+ propsBeforeRequest = action.beforeRequest,
160
165
  others = _objectWithoutProperties(action, _excluded2);
161
166
 
162
167
  var formRef = /*#__PURE__*/(0, _react.createRef)();
@@ -177,13 +182,55 @@ function useDialogFormAction(action, context) {
177
182
  }, dialogFormProps));
178
183
  },
179
184
  extendParams: useFieldValuesForRequest ? '{{fields}}' : undefined,
180
- beforeRequest: function beforeRequest() {
181
- return new Promise(function (resolve) {
182
- formRef.current.validate().then(function () {
183
- resolve({
184
- fields: formRef.current.values
185
- });
186
- }).catch(function () {
185
+ beforeRequest: function beforeRequest(context) {
186
+ return new Promise(function (resolve, reject) {
187
+ formRef.current.validate().then( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee() {
188
+ var beforeRequestContext, requestContext;
189
+ return regeneratorRuntime.wrap(function _callee$(_context) {
190
+ while (1) {
191
+ switch (_context.prev = _context.next) {
192
+ case 0:
193
+ if (!propsBeforeRequest) {
194
+ _context.next = 13;
195
+ break;
196
+ }
197
+
198
+ _context.prev = 1;
199
+ _context.next = 4;
200
+ return (0, _utils.resolveMaybePromiseMethod)(propsBeforeRequest, context);
201
+
202
+ case 4:
203
+ beforeRequestContext = _context.sent;
204
+ _context.next = 10;
205
+ break;
206
+
207
+ case 7:
208
+ _context.prev = 7;
209
+ _context.t0 = _context["catch"](1);
210
+ beforeRequestContext = false;
211
+
212
+ case 10:
213
+ if (!(beforeRequestContext === false)) {
214
+ _context.next = 13;
215
+ break;
216
+ }
217
+
218
+ reject(false);
219
+ return _context.abrupt("return");
220
+
221
+ case 13:
222
+ requestContext = Object.assign({
223
+ fields: formRef.current.values
224
+ }, _typeof(beforeRequestContext) === 'object' ? beforeRequestContext : {});
225
+ resolve(requestContext);
226
+
227
+ case 15:
228
+ case "end":
229
+ return _context.stop();
230
+ }
231
+ }
232
+ }, _callee, null, [[1, 7]]);
233
+ }))).catch(function () {
187
234
  resolve(false);
188
235
  });
189
236
  });
@@ -0,0 +1,22 @@
1
+ // 容器滚动条样式
2
+ @mixin hybridcloud-scrollbar {
3
+ &::-webkit-scrollbar {
4
+ width: 12px;
5
+ height: 12px;
6
+ }
7
+ &::-webkit-scrollbar-thumb {
8
+ border-color: transparent;
9
+ border-style: solid;
10
+ border-width: 4px;
11
+ background-clip: content-box;
12
+ border-radius: 6px;
13
+ background-color: var(--scrollbar-thumb-bg);
14
+ &:hover {
15
+ border-width: 3px;
16
+ background-color: var(--scrollbar-thumb-hover-bg);
17
+ }
18
+ }
19
+ &::-webkit-scrollbar-track {
20
+ background-color: transparent;
21
+ }
22
+ }
@@ -1,13 +1,9 @@
1
1
  import React from 'react';
2
- import type { IFilterProps } from '../typing';
2
+ import { QueryFilterLayout } from './Layout';
3
+ import type { QueryFilterProps } from '../typing';
3
4
  import './index.scss';
4
5
  /**
5
- * 简单筛选
6
+ * 查询筛选
6
7
  */
7
- declare const SimpleFilter: React.FC<IFilterProps>;
8
- /**
9
- * 高级筛选
10
- */
11
- declare const AdvancedFilter: React.FC<IFilterProps>;
12
- export { AdvancedFilter, SimpleFilter };
13
- export default AdvancedFilter;
8
+ declare const QueryFilter: React.FC<QueryFilterProps>;
9
+ export { QueryFilter, QueryFilterLayout };