@teamix/pro 1.2.10 → 1.2.11

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 (82) hide show
  1. package/dist/212.js +1 -1
  2. package/dist/pro.css +1 -1
  3. package/dist/pro.js +454 -366
  4. package/dist/pro.min.css +1 -1
  5. package/dist/pro.min.js +1 -1
  6. package/es/actions/base.d.ts +16 -6
  7. package/es/actions/base.js +66 -12
  8. package/es/actions/confirm.d.ts +1 -1
  9. package/es/actions/danger-confirm.d.ts +1 -1
  10. package/es/actions/dialog-component.d.ts +1 -1
  11. package/es/actions/dialog-form.d.ts +1 -1
  12. package/es/actions/dialog-form.js +2 -2
  13. package/es/actions/dialog-info.d.ts +1 -1
  14. package/es/actions/dialog-table.d.ts +1 -1
  15. package/es/actions/dialog.d.ts +6 -2
  16. package/es/actions/dialog.js +3 -3
  17. package/es/actions/drawer-form.d.ts +1 -1
  18. package/es/actions/drawer-info.d.ts +1 -1
  19. package/es/actions/drawer-table.d.ts +1 -1
  20. package/es/actions/drawer.d.ts +1 -1
  21. package/es/actions/error.d.ts +1 -1
  22. package/es/actions/link.d.ts +2 -2
  23. package/es/actions/link.js +2 -2
  24. package/es/actions/notice.d.ts +1 -1
  25. package/es/actions/request.d.ts +1 -1
  26. package/es/actions/request.js +2 -2
  27. package/es/card/index.d.ts +10 -1
  28. package/es/card/index.js +20 -5
  29. package/es/card/index.scss +19 -0
  30. package/es/card/tab.d.ts +6 -0
  31. package/es/card/tab.js +27 -0
  32. package/es/form/ProForm/index.js +3 -23
  33. package/es/form/SchemaForm/index.js +7 -6
  34. package/es/index.d.ts +1 -1
  35. package/es/index.js +1 -1
  36. package/es/page-header/index.d.ts +20 -11
  37. package/es/page-header/index.js +23 -47
  38. package/es/page-header/index.scss +0 -11
  39. package/es/table/components/Filter/index.js +3 -3
  40. package/es/table/index.js +1 -1
  41. package/es/utils/components/tags/index.d.ts +11 -0
  42. package/es/utils/components/tags/index.js +50 -0
  43. package/es/utils/components/tags/index.scss +12 -0
  44. package/lib/actions/base.d.ts +16 -6
  45. package/lib/actions/base.js +67 -12
  46. package/lib/actions/confirm.d.ts +1 -1
  47. package/lib/actions/danger-confirm.d.ts +1 -1
  48. package/lib/actions/dialog-component.d.ts +1 -1
  49. package/lib/actions/dialog-form.d.ts +1 -1
  50. package/lib/actions/dialog-form.js +2 -2
  51. package/lib/actions/dialog-info.d.ts +1 -1
  52. package/lib/actions/dialog-table.d.ts +1 -1
  53. package/lib/actions/dialog.d.ts +6 -2
  54. package/lib/actions/dialog.js +3 -3
  55. package/lib/actions/drawer-form.d.ts +1 -1
  56. package/lib/actions/drawer-info.d.ts +1 -1
  57. package/lib/actions/drawer-table.d.ts +1 -1
  58. package/lib/actions/drawer.d.ts +1 -1
  59. package/lib/actions/error.d.ts +1 -1
  60. package/lib/actions/link.d.ts +2 -2
  61. package/lib/actions/link.js +2 -2
  62. package/lib/actions/notice.d.ts +1 -1
  63. package/lib/actions/request.d.ts +1 -1
  64. package/lib/actions/request.js +2 -2
  65. package/lib/card/index.d.ts +10 -1
  66. package/lib/card/index.js +22 -4
  67. package/lib/card/index.scss +19 -0
  68. package/lib/card/tab.d.ts +6 -0
  69. package/lib/card/tab.js +39 -0
  70. package/lib/form/ProForm/index.js +3 -23
  71. package/lib/form/SchemaForm/index.js +7 -6
  72. package/lib/index.d.ts +1 -1
  73. package/lib/index.js +1 -1
  74. package/lib/page-header/index.d.ts +20 -11
  75. package/lib/page-header/index.js +22 -45
  76. package/lib/page-header/index.scss +0 -11
  77. package/lib/table/components/Filter/index.js +2 -2
  78. package/lib/table/index.js +1 -1
  79. package/lib/utils/components/tags/index.d.ts +11 -0
  80. package/lib/utils/components/tags/index.js +66 -0
  81. package/lib/utils/components/tags/index.scss +12 -0
  82. package/package.json +1 -1
@@ -1,6 +1,7 @@
1
1
  import React from 'react';
2
- import { TagProps, CloseableProps } from '@alicloudfe/components/types/tag';
3
2
  import { ItemProps } from '@alicloudfe/components/types/breadcrumb';
3
+ import { LinkPath } from '@teamix/utils';
4
+ import { ProTagItem } from '../utils/components/tags';
4
5
  import { ProActionGroupProps } from '../actions';
5
6
  import { ProInfoProps } from '../info';
6
7
  import './index.scss';
@@ -10,14 +11,7 @@ export interface ProPageHeaderBreadcrumbItem extends ItemProps {
10
11
  */
11
12
  text?: string;
12
13
  }
13
- export declare type ProPageHeaderTagItem = (TagProps | (CloseableProps & {
14
- closable: true;
15
- })) & {
16
- /**
17
- * @deprecated 建议使用 children 代替
18
- */
19
- text?: string;
20
- };
14
+ export declare type ProPageHeaderTagItem = ProTagItem;
21
15
  declare type Color = 'blue' | 'green' | 'orange' | 'red' | 'yellow' | string;
22
16
  export declare type ProPageHeaderDataItem = {
23
17
  title: string;
@@ -25,20 +19,35 @@ export declare type ProPageHeaderDataItem = {
25
19
  color?: Color;
26
20
  } & React.HTMLAttributes<HTMLElement>;
27
21
  export declare type ProPageHeaderProps = {
22
+ /** 标题 */
28
23
  title?: React.ReactNode;
24
+ /** 描述 */
29
25
  description?: React.ReactNode;
30
- icon?: string;
26
+ /** 图标 */
27
+ icon?: React.ReactNode;
28
+ /** 图标颜色 */
31
29
  iconColor?: Color;
30
+ /** 图标背景类型 */
32
31
  iconBackgroundType?: 'circle' | 'square';
32
+ /** 图标背景色 */
33
33
  iconBackgroundColor?: Color;
34
- goback?: string | boolean;
34
+ /** 返回按钮配置 */
35
+ goback?: boolean | LinkPath | ((e: React.MouseEvent) => void);
36
+ /** 背景图 */
35
37
  image?: string;
38
+ /** 加载中 */
36
39
  loading?: boolean;
40
+ /** 面包屑配置 */
37
41
  breadcrumb?: ProPageHeaderBreadcrumbItem[];
42
+ /** 额外信息区配置 */
38
43
  extra?: ProActionGroupProps | React.ReactNode;
44
+ /** 操作区配置 */
39
45
  operation?: ProActionGroupProps | React.ReactNode;
46
+ /** 标签组 */
40
47
  tags?: ProPageHeaderTagItem[];
48
+ /** 数据概览项 */
41
49
  data?: ProPageHeaderDataItem[];
50
+ /** 底部详情 */
42
51
  info?: ProInfoProps | React.ReactNode;
43
52
  } & Omit<React.HTMLAttributes<HTMLElement>, 'title'>;
44
53
  declare const ProPageHeader: React.FC<ProPageHeaderProps>;
@@ -1,7 +1,6 @@
1
1
  var _excluded = ["text", "children"],
2
- _excluded2 = ["text", "children", "closable"],
3
- _excluded3 = ["color", "title", "num", "className"],
4
- _excluded4 = ["title", "description", "icon", "iconColor", "iconBackgroundType", "iconBackgroundColor", "goback", "operation", "extra", "image", "loading", "breadcrumb", "tags", "data", "info", "children", "className", "style"];
2
+ _excluded2 = ["color", "title", "num", "className"],
3
+ _excluded3 = ["title", "description", "icon", "iconColor", "iconBackgroundType", "iconBackgroundColor", "goback", "operation", "extra", "image", "loading", "breadcrumb", "tags", "data", "info", "children", "className", "style"];
5
4
 
6
5
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
7
6
 
@@ -17,8 +16,9 @@ import React from 'react';
17
16
  import { useHistory } from 'react-router-dom';
18
17
  import classnames from 'classnames';
19
18
  import TeamixIcon from '@teamix/icon';
20
- import { Breadcrumb, Tag } from '@alicloudfe/components';
21
- import { baseClass } from '@teamix/utils';
19
+ import { Breadcrumb } from '@alicloudfe/components';
20
+ import { baseClass, goToLink } from '@teamix/utils';
21
+ import { renderTags } from '../utils/components/tags';
22
22
  import { ProActionGroup } from '../actions';
23
23
  import { ProSkeletonRaw } from '../skeleton';
24
24
  import ProInfo from '../info';
@@ -64,40 +64,6 @@ var renderActionGroup = function renderActionGroup(group, defaultProps) {
64
64
  return group;
65
65
  };
66
66
 
67
- var renderTags = function renderTags(tags) {
68
- if (!tags) {
69
- return null;
70
- }
71
-
72
- return /*#__PURE__*/React.createElement(Tag.Group, {
73
- className: cls('tags')
74
- }, tags.map(function (tag, i) {
75
- // @ts-ignore
76
- var text = tag.text,
77
- children = tag.children,
78
- closable = tag.closable,
79
- others = _objectWithoutProperties(tag, _excluded2);
80
-
81
- if (closable) {
82
- return /*#__PURE__*/React.createElement(Tag.Closeable, _objectSpread({
83
- key: i,
84
- size: "large",
85
- style: {
86
- marginBottom: 0
87
- }
88
- }, others), text || children);
89
- }
90
-
91
- return /*#__PURE__*/React.createElement(Tag, _objectSpread({
92
- key: i,
93
- size: "large",
94
- style: {
95
- marginBottom: 0
96
- }
97
- }, others), text || children);
98
- }));
99
- };
100
-
101
67
  var isPresetColor = function isPresetColor(color) {
102
68
  if (!color) {
103
69
  return false;
@@ -135,7 +101,7 @@ var renderData = function renderData(data) {
135
101
  title = item.title,
136
102
  num = item.num,
137
103
  customClassName = item.className,
138
- others = _objectWithoutProperties(item, _excluded3);
104
+ others = _objectWithoutProperties(item, _excluded2);
139
105
 
140
106
  var _getColorAndStyle = getColorAndStyle(color),
141
107
  className = _getColorAndStyle.className,
@@ -183,7 +149,7 @@ var ProPageHeader = function ProPageHeader(props) {
183
149
  children = props.children,
184
150
  className = props.className,
185
151
  style = props.style,
186
- others = _objectWithoutProperties(props, _excluded4);
152
+ others = _objectWithoutProperties(props, _excluded3);
187
153
 
188
154
  var history = useHistory();
189
155
  var backgroundImage = image ? "url('".concat(image, "')") : undefined;
@@ -201,12 +167,22 @@ var ProPageHeader = function ProPageHeader(props) {
201
167
  iconClass = _getColorAndStyle2.className,
202
168
  iconStyle = _getColorAndStyle2.style;
203
169
 
204
- var onBack = function onBack() {
170
+ var onBack = function onBack(e) {
171
+ if (!goback) {
172
+ return;
173
+ }
174
+
175
+ if (typeof goback === 'function') {
176
+ goback(e);
177
+ return;
178
+ }
179
+
205
180
  if (goback === true) {
206
181
  history.go(-1);
207
- } else if (typeof goback === 'string') {
208
- history.push && history.push(goback);
182
+ return;
209
183
  }
184
+
185
+ goToLink(goback, history);
210
186
  };
211
187
 
212
188
  return /*#__PURE__*/React.createElement(React.Fragment, null, goback && /*#__PURE__*/React.createElement(TeamixIcon, {
@@ -214,14 +190,14 @@ var ProPageHeader = function ProPageHeader(props) {
214
190
  onClick: onBack,
215
191
  type: "return-line",
216
192
  size: "large"
217
- }), icon && /*#__PURE__*/React.createElement(TeamixIcon, {
193
+ }), icon && (typeof icon === 'string' ? /*#__PURE__*/React.createElement(TeamixIcon, {
218
194
  className: classnames(iconClass, cls('title-icon')),
219
195
  style: iconStyle,
220
196
  type: icon,
221
197
  size: "large"
222
- }), /*#__PURE__*/React.createElement("span", {
198
+ }) : /*#__PURE__*/React.createElement(React.Fragment, null, icon)), /*#__PURE__*/React.createElement("span", {
223
199
  className: cls('title-name')
224
- }, title), renderTags(tags));
200
+ }, title), renderTags(tags, 'large'));
225
201
  };
226
202
 
227
203
  return /*#__PURE__*/React.createElement("header", _objectSpread({
@@ -124,17 +124,6 @@ $prefix: 'teamix-pro-page-header';
124
124
  cursor: pointer;
125
125
  }
126
126
 
127
- .#{$prefix}-tags {
128
- display: inline-flex;
129
- align-items: center;
130
-
131
- & > div {
132
- &:last-child {
133
- margin-right: 0;
134
- }
135
- }
136
- }
137
-
138
127
  .#{$prefix}-color {
139
128
  &-blue {
140
129
  color: var(--color-notice-5);
@@ -27,7 +27,7 @@ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
27
27
  import React, { useEffect, useMemo, useState } from 'react';
28
28
  import TeamixIcon from '@teamix/icon';
29
29
  import { Button, Dropdown, Menu } from '@alicloudfe/components';
30
- import { baseClass } from '@teamix/utils';
30
+ import { baseClass, getMessage } from '@teamix/utils';
31
31
  import './index.scss';
32
32
  var CheckboxItem = Menu.CheckboxItem;
33
33
  var cls = baseClass('teamix-pro-table-toolbar-filter');
@@ -217,7 +217,7 @@ var Filter = function Filter(props) {
217
217
  (_actionRef$current7 = actionRef.current) === null || _actionRef$current7 === void 0 ? void 0 : (_actionRef$current7$r = _actionRef$current7.resetPage) === null || _actionRef$current7$r === void 0 ? void 0 : _actionRef$current7$r.call(_actionRef$current7);
218
218
  setVisible(false);
219
219
  }
220
- }, "\u786E\u5B9A"), /*#__PURE__*/React.createElement(Button, {
220
+ }, getMessage('ok')), /*#__PURE__*/React.createElement(Button, {
221
221
  type: "normal",
222
222
  size: "small",
223
223
  className: cls({
@@ -234,7 +234,7 @@ var Filter = function Filter(props) {
234
234
  })));
235
235
  (_actionRef$current10 = actionRef.current) === null || _actionRef$current10 === void 0 ? void 0 : (_actionRef$current10$ = _actionRef$current10.filterDataSource) === null || _actionRef$current10$ === void 0 ? void 0 : _actionRef$current10$.call(_actionRef$current10, column.dataIndex); // setVisible(!visible);
236
236
  }
237
- }, "\u91CD\u7F6E")))));
237
+ }, getMessage('reset'))))));
238
238
  };
239
239
 
240
240
  export default Filter;
package/es/table/index.js CHANGED
@@ -773,7 +773,7 @@ var ProTable = function ProTable(props) {
773
773
 
774
774
  }),
775
775
  ref: tableRef
776
- }, renderTable(), footerSuctionState && footerSuction && /*#__PURE__*/React.createElement(ProPageContainer.FixedFooter, null, renderFooter()), !(footerSuctionState && footerSuction) && renderFooter()));
776
+ }, renderTable(), footerSuctionState && footerSuction && !fullscreenState && /*#__PURE__*/React.createElement(ProPageContainer.FixedFooter, null, renderFooter()), !(footerSuctionState && footerSuction) && !fullscreenState && renderFooter(), fullscreenState && renderFooter()));
777
777
  };
778
778
 
779
779
  export default ProTable;
@@ -0,0 +1,11 @@
1
+ import { TagProps, CloseableProps } from '@alicloudfe/components/types/tag';
2
+ import './index.scss';
3
+ export declare type ProTagItem = (TagProps | (CloseableProps & {
4
+ closable: true;
5
+ })) & {
6
+ /**
7
+ * @deprecated 建议使用 children 代替
8
+ */
9
+ text?: string;
10
+ };
11
+ export declare const renderTags: (tags?: ProTagItem[] | undefined, size?: "small" | "large" | "medium" | undefined) => JSX.Element | null;
@@ -0,0 +1,50 @@
1
+ var _excluded = ["text", "children", "closable"];
2
+
3
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
4
+
5
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
6
+
7
+ function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
8
+
9
+ function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
10
+
11
+ 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; }
12
+
13
+ import React from 'react';
14
+ import { Tag } from '@alicloudfe/components';
15
+ import { baseClass } from '@teamix/utils';
16
+ import './index.scss';
17
+ var cls = baseClass('teamix-pro-tags');
18
+ export var renderTags = function renderTags(tags, size) {
19
+ if (!tags || !tags.length) {
20
+ return null;
21
+ }
22
+
23
+ return /*#__PURE__*/React.createElement(Tag.Group, {
24
+ className: cls('')
25
+ }, tags.map(function (tag, i) {
26
+ // @ts-ignore
27
+ var text = tag.text,
28
+ children = tag.children,
29
+ closable = tag.closable,
30
+ others = _objectWithoutProperties(tag, _excluded);
31
+
32
+ if (closable) {
33
+ return /*#__PURE__*/React.createElement(Tag.Closeable, _objectSpread({
34
+ key: i,
35
+ size: size,
36
+ style: {
37
+ marginBottom: 0
38
+ }
39
+ }, others), text || children);
40
+ }
41
+
42
+ return /*#__PURE__*/React.createElement(Tag, _objectSpread({
43
+ key: i,
44
+ size: size,
45
+ style: {
46
+ marginBottom: 0
47
+ }
48
+ }, others), text || children);
49
+ }));
50
+ };
@@ -0,0 +1,12 @@
1
+ .teamix-pro-tags {
2
+ display: inline-flex;
3
+ align-items: center;
4
+
5
+ & > div.next-tag {
6
+ margin-right: var(--s-2, 8px);
7
+
8
+ &:last-child {
9
+ margin-right: 0;
10
+ }
11
+ }
12
+ }
@@ -1,13 +1,23 @@
1
+ import { MaybePromise } from '@teamix/utils';
1
2
  export interface BaseAction {
3
+ /** 事件触发方式,默认是 onClick */
2
4
  trigger?: string;
3
- onTrigger?: () => void;
4
- onFinish?: (prams?: any) => any;
5
+ /** 事件发生时,是否执行 e.preventDefault() 方法 */
5
6
  preventDefault?: boolean;
7
+ /** 事件发生时,是否执行 e.stopPropagation() 方法 */
6
8
  stopPropagation?: boolean;
7
- schema?: any;
8
- component?: any;
9
+ /** 事件执行前的处理函数
10
+ * 如果返回 false 或者 Promise<false>,则停止 Action 执行。
11
+ * 如果返回 true 或者 Promise<true>,则正常执行 Action。
12
+ * 如果返回其他对象,则正常执行 Action,并把返回的对象放到接下来 Action 的上下文中。
13
+ */
14
+ beforeAction?: () => MaybePromise<any>;
15
+ /** 事件开始执行后的回调函数 */
16
+ onTrigger?: () => void;
17
+ /** 事件开始执行完毕的回调函数 */
18
+ onFinish?: (params?: any) => any;
9
19
  }
10
- export declare function eventHandler(action: BaseAction, onTrigger: () => void): {
11
- [x: string]: (e: React.MouseEvent<HTMLElement>) => void;
20
+ export declare function eventHandler(action: BaseAction, actionContext: any, onTrigger: (context: any) => void): {
21
+ [x: string]: (e: React.MouseEvent<HTMLElement>) => Promise<void>;
12
22
  };
13
23
  export default eventHandler;
@@ -6,27 +6,82 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.default = void 0;
7
7
  exports.eventHandler = eventHandler;
8
8
 
9
+ var _utils = require("@teamix/utils");
10
+
9
11
  function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
10
12
 
11
- function eventHandler(action, onTrigger) {
13
+ 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); } }
14
+
15
+ 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); }); }; }
16
+
17
+ function eventHandler(action, actionContext, onTrigger) {
12
18
  var _action$trigger = action.trigger,
13
19
  trigger = _action$trigger === void 0 ? 'onClick' : _action$trigger,
14
20
  preventDefault = action.preventDefault,
15
- stopPropagation = action.stopPropagation;
16
- return _defineProperty({}, "".concat(trigger), function _(e) {
17
- var _action$onTrigger;
21
+ stopPropagation = action.stopPropagation,
22
+ beforeAction = action.beforeAction;
23
+ return _defineProperty({}, "".concat(trigger), function () {
24
+ var _2 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee(e) {
25
+ var _action$onTrigger;
18
26
 
19
- if (preventDefault) {
20
- e.preventDefault();
21
- }
27
+ var beforeActionContext;
28
+ return regeneratorRuntime.wrap(function _callee$(_context) {
29
+ while (1) {
30
+ switch (_context.prev = _context.next) {
31
+ case 0:
32
+ if (preventDefault) {
33
+ e.preventDefault();
34
+ }
35
+
36
+ if (stopPropagation) {
37
+ e.stopPropagation();
38
+ }
39
+
40
+ if (!beforeAction) {
41
+ _context.next = 14;
42
+ break;
43
+ }
44
+
45
+ _context.prev = 3;
46
+ _context.next = 6;
47
+ return (0, _utils.resolveMaybePromiseMethod)(beforeAction, actionContext);
48
+
49
+ case 6:
50
+ beforeActionContext = _context.sent;
51
+ _context.next = 12;
52
+ break;
53
+
54
+ case 9:
55
+ _context.prev = 9;
56
+ _context.t0 = _context["catch"](3);
57
+ beforeActionContext = false;
58
+
59
+ case 12:
60
+ if (!(beforeActionContext === false)) {
61
+ _context.next = 14;
62
+ break;
63
+ }
64
+
65
+ return _context.abrupt("return");
66
+
67
+ case 14:
68
+ onTrigger(Object.assign({}, beforeActionContext, actionContext));
69
+ (_action$onTrigger = action.onTrigger) === null || _action$onTrigger === void 0 ? void 0 : _action$onTrigger.call(action);
70
+
71
+ case 16:
72
+ case "end":
73
+ return _context.stop();
74
+ }
75
+ }
76
+ }, _callee, null, [[3, 9]]);
77
+ }));
22
78
 
23
- if (stopPropagation) {
24
- e.stopPropagation();
79
+ function _(_x) {
80
+ return _2.apply(this, arguments);
25
81
  }
26
82
 
27
- onTrigger();
28
- (_action$onTrigger = action.onTrigger) === null || _action$onTrigger === void 0 ? void 0 : _action$onTrigger.call(action);
29
- });
83
+ return _;
84
+ }());
30
85
  }
31
86
 
32
87
  var _default = eventHandler;
@@ -2,6 +2,6 @@ import { DialogAction } from './dialog';
2
2
  export interface ConfirmAction extends DialogAction {
3
3
  }
4
4
  export declare function useConfirmAction(action: DialogAction, context?: any): {
5
- [x: string]: (e: import("react").MouseEvent<HTMLElement, MouseEvent>) => void;
5
+ [x: string]: (e: import("react").MouseEvent<HTMLElement, MouseEvent>) => Promise<void>;
6
6
  };
7
7
  export default useConfirmAction;
@@ -2,6 +2,6 @@ import { DialogAction } from './dialog';
2
2
  export interface DangerConfirmAction extends DialogAction {
3
3
  }
4
4
  export declare function useDangerConfirmAction(action: DialogAction, context?: any): {
5
- [x: string]: (e: import("react").MouseEvent<HTMLElement, MouseEvent>) => void;
5
+ [x: string]: (e: import("react").MouseEvent<HTMLElement, MouseEvent>) => Promise<void>;
6
6
  };
7
7
  export default useDangerConfirmAction;
@@ -5,6 +5,6 @@ export interface DialogComponentAction extends DialogAction {
5
5
  component: React.FC<any>;
6
6
  }
7
7
  export declare function useDialogComponentAction(action: DialogComponentAction, context?: any): {
8
- [x: string]: (e: React.MouseEvent<HTMLElement, MouseEvent>) => void;
8
+ [x: string]: (e: React.MouseEvent<HTMLElement, MouseEvent>) => Promise<void>;
9
9
  };
10
10
  export default useDialogComponentAction;
@@ -17,6 +17,6 @@ export interface DialogFormAction extends DialogAction {
17
17
  schema: ProFormSchema | ProFormProps;
18
18
  }
19
19
  export declare function useDialogFormAction(action: DialogFormAction, context?: any): {
20
- [x: string]: (e: React.MouseEvent<HTMLElement, MouseEvent>) => void;
20
+ [x: string]: (e: React.MouseEvent<HTMLElement, MouseEvent>) => Promise<void>;
21
21
  };
22
22
  export default useDialogFormAction;
@@ -163,14 +163,14 @@ function useDialogFormAction(action, context) {
163
163
  return (0, _dialog.default)(Object.assign({
164
164
  size: size,
165
165
  closeable: true,
166
- content: function content() {
166
+ content: function content(contentContext) {
167
167
  var dialogFormProps = {
168
168
  initialValues: initialValues,
169
169
  initialRequest: initialRequest,
170
170
  schema: schema,
171
171
  size: size,
172
172
  formProps: formProps,
173
- context: context
173
+ context: contentContext
174
174
  };
175
175
  return /*#__PURE__*/_react.default.createElement(DialogForm, _objectSpread({
176
176
  formRef: formRef
@@ -4,6 +4,6 @@ export interface DialogInfoAction extends DialogAction {
4
4
  schema: ProInfoProps;
5
5
  }
6
6
  export declare function useDialogInfoAction(action: DialogInfoAction, context?: any): {
7
- [x: string]: (e: import("react").MouseEvent<HTMLElement, MouseEvent>) => void;
7
+ [x: string]: (e: import("react").MouseEvent<HTMLElement, MouseEvent>) => Promise<void>;
8
8
  };
9
9
  export default useDialogInfoAction;
@@ -4,6 +4,6 @@ export interface DialogTableAction extends DialogAction {
4
4
  schema: ProTableProps;
5
5
  }
6
6
  export declare function useDialogTableAction(action: DialogTableAction, context?: any): {
7
- [x: string]: (e: import("react").MouseEvent<HTMLElement, MouseEvent>) => void;
7
+ [x: string]: (e: import("react").MouseEvent<HTMLElement, MouseEvent>) => Promise<void>;
8
8
  };
9
9
  export default useDialogTableAction;
@@ -21,8 +21,12 @@ export interface DialogAction extends Omit<RequestAction, 'url'>, Omit<QuickShow
21
21
  afterContent?: React.ReactNode;
22
22
  /** 弹窗页脚描述区,位于按钮组的对面 */
23
23
  footerDescription?: React.ReactNode | ProFormSchema | ProFormSchemaItem;
24
+ /** 弹窗内容组件的 schema */
25
+ schema?: any;
26
+ /** 弹窗内容区的组件 */
27
+ component?: any;
24
28
  }
25
- export declare function useDialogAction(action: DialogAction, context?: any): {
26
- [x: string]: (e: React.MouseEvent<HTMLElement, MouseEvent>) => void;
29
+ export declare function useDialogAction(action: DialogAction, actionContext?: any): {
30
+ [x: string]: (e: React.MouseEvent<HTMLElement, MouseEvent>) => Promise<void>;
27
31
  };
28
32
  export default useDialogAction;
@@ -93,7 +93,7 @@ function getFooterAlignClass(isDrawer, align) {
93
93
  } // 弹窗 -> 请求(点击确认,发送数据请求)
94
94
 
95
95
 
96
- function useDialogAction(action, context) {
96
+ function useDialogAction(action, actionContext) {
97
97
  var _useState = (0, _react.useState)(false),
98
98
  _useState2 = _slicedToArray(_useState, 2),
99
99
  loading = _useState2[0],
@@ -102,7 +102,7 @@ function useDialogAction(action, context) {
102
102
  var footerDescriptionRef = (0, _react.useRef)();
103
103
  var history = (0, _reactRouterDom.useHistory)();
104
104
 
105
- var onActionStart = function onActionStart() {
105
+ var onActionStart = function onActionStart(context) {
106
106
  var url = action.url,
107
107
  method = action.method,
108
108
  params = action.params,
@@ -267,7 +267,7 @@ function useDialogAction(action, context) {
267
267
  store.hide = ret.hide;
268
268
  };
269
269
 
270
- return _objectSpread({}, (0, _base.eventHandler)(action, onActionStart));
270
+ return _objectSpread({}, (0, _base.eventHandler)(action, actionContext, onActionStart));
271
271
  }
272
272
 
273
273
  var _default = useDialogAction;
@@ -1,6 +1,6 @@
1
1
  import { DialogFormAction } from './dialog-form';
2
2
  export declare type DrawerFormAction = DialogFormAction;
3
3
  export declare function useDrawerFormAction(action: DrawerFormAction, context?: any): {
4
- [x: string]: (e: import("react").MouseEvent<HTMLElement, MouseEvent>) => void;
4
+ [x: string]: (e: import("react").MouseEvent<HTMLElement, MouseEvent>) => Promise<void>;
5
5
  };
6
6
  export default useDrawerFormAction;
@@ -1,6 +1,6 @@
1
1
  import { DialogInfoAction } from './dialog-info';
2
2
  export declare type DrawerInfoAction = DialogInfoAction;
3
3
  export declare function useDrawerInfoAction(action: DrawerInfoAction, context?: any): {
4
- [x: string]: (e: import("react").MouseEvent<HTMLElement, MouseEvent>) => void;
4
+ [x: string]: (e: import("react").MouseEvent<HTMLElement, MouseEvent>) => Promise<void>;
5
5
  };
6
6
  export default useDrawerInfoAction;
@@ -1,6 +1,6 @@
1
1
  import { DialogTableAction } from './dialog-table';
2
2
  export declare type DrawerTableAction = DialogTableAction;
3
3
  export declare function useDrawerTableAction(action: DrawerTableAction, context?: any): {
4
- [x: string]: (e: import("react").MouseEvent<HTMLElement, MouseEvent>) => void;
4
+ [x: string]: (e: import("react").MouseEvent<HTMLElement, MouseEvent>) => Promise<void>;
5
5
  };
6
6
  export default useDrawerTableAction;
@@ -1,6 +1,6 @@
1
1
  import { DialogAction } from './dialog';
2
2
  export declare type DrawerAction = Omit<DialogAction, 'dialogQuickShowType' | 'messageType'>;
3
3
  export declare function useDrawerAction(action: DrawerAction, context?: any): {
4
- [x: string]: (e: import("react").MouseEvent<HTMLElement, MouseEvent>) => void;
4
+ [x: string]: (e: import("react").MouseEvent<HTMLElement, MouseEvent>) => Promise<void>;
5
5
  };
6
6
  export default useDrawerAction;
@@ -2,6 +2,6 @@ import { DialogAction } from './dialog';
2
2
  export interface ErrorAction extends DialogAction {
3
3
  }
4
4
  export declare function useErrorAction(action: DialogAction, context?: any): {
5
- [x: string]: (e: import("react").MouseEvent<HTMLElement, MouseEvent>) => void;
5
+ [x: string]: (e: import("react").MouseEvent<HTMLElement, MouseEvent>) => Promise<void>;
6
6
  };
7
7
  export default useErrorAction;
@@ -2,7 +2,7 @@ import { LocationHistory } from '@teamix/utils';
2
2
  import { BaseAction } from './base';
3
3
  export interface LinkAction extends BaseAction, LocationHistory {
4
4
  }
5
- export declare function useLinkAction(action: LinkAction, context?: any): {
6
- [x: string]: (e: import("react").MouseEvent<HTMLElement, MouseEvent>) => void;
5
+ export declare function useLinkAction(action: LinkAction, actionContext?: any): {
6
+ [x: string]: (e: import("react").MouseEvent<HTMLElement, MouseEvent>) => Promise<void>;
7
7
  };
8
8
  export default useLinkAction;
@@ -18,9 +18,9 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
18
18
 
19
19
  function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
20
20
 
21
- function useLinkAction(action, context) {
21
+ function useLinkAction(action, actionContext) {
22
22
  var history = (0, _reactRouterDom.useHistory)();
23
- return _objectSpread({}, (0, _base.eventHandler)(action, function () {
23
+ return _objectSpread({}, (0, _base.eventHandler)(action, actionContext, function (context) {
24
24
  var linkAction = (0, _utils.getTargetValue)(action, context);
25
25
  (0, _utils.goToLink)(linkAction, history);
26
26
  }));
@@ -2,6 +2,6 @@ import { DialogAction } from './dialog';
2
2
  export interface NoticeAction extends DialogAction {
3
3
  }
4
4
  export declare function useNoticeAction(action: DialogAction, context?: any): {
5
- [x: string]: (e: import("react").MouseEvent<HTMLElement, MouseEvent>) => void;
5
+ [x: string]: (e: import("react").MouseEvent<HTMLElement, MouseEvent>) => Promise<void>;
6
6
  };
7
7
  export default useNoticeAction;