@teamix/pro 1.2.7 → 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 (121) hide show
  1. package/dist/pro.css +1 -1
  2. package/dist/pro.js +756 -368
  3. package/dist/pro.min.css +1 -1
  4. package/dist/pro.min.js +1 -1
  5. package/es/actions/base.d.ts +16 -6
  6. package/es/actions/base.js +66 -12
  7. package/es/actions/confirm.d.ts +1 -1
  8. package/es/actions/danger-confirm.d.ts +1 -1
  9. package/es/actions/dialog-component.d.ts +1 -1
  10. package/es/actions/dialog-form.d.ts +1 -1
  11. package/es/actions/dialog-form.js +4 -4
  12. package/es/actions/dialog-info.d.ts +1 -1
  13. package/es/actions/dialog-table.d.ts +1 -1
  14. package/es/actions/dialog.d.ts +6 -2
  15. package/es/actions/dialog.js +19 -24
  16. package/es/actions/drawer-form.d.ts +1 -1
  17. package/es/actions/drawer-info.d.ts +1 -1
  18. package/es/actions/drawer-table.d.ts +1 -1
  19. package/es/actions/drawer.d.ts +1 -1
  20. package/es/actions/error.d.ts +1 -1
  21. package/es/actions/index.js +25 -21
  22. package/es/actions/index.scss +14 -7
  23. package/es/actions/link.d.ts +2 -2
  24. package/es/actions/link.js +2 -2
  25. package/es/actions/notice.d.ts +1 -1
  26. package/es/actions/request.d.ts +1 -1
  27. package/es/actions/request.js +2 -2
  28. package/es/card/index.d.ts +21 -3
  29. package/es/card/index.js +29 -12
  30. package/es/card/index.scss +71 -2
  31. package/es/card/selectable.d.ts +13 -0
  32. package/es/card/selectable.js +45 -0
  33. package/es/card/tab.d.ts +6 -0
  34. package/es/card/tab.js +27 -0
  35. package/es/form/Filter/index.js +5 -5
  36. package/es/form/ProForm/index.js +3 -23
  37. package/es/form/ProForm/index.scss +9 -0
  38. package/es/form/SchemaForm/index.js +7 -6
  39. package/es/index.d.ts +1 -1
  40. package/es/index.js +7 -4
  41. package/es/info/components/tableInfo/index.js +10 -6
  42. package/es/nocode/configurators/Card.js +31 -8
  43. package/es/page-header/index.d.ts +20 -11
  44. package/es/page-header/index.js +23 -47
  45. package/es/page-header/index.scss +0 -11
  46. package/es/sidebar/components/sidebar-container/index.d.ts +5 -0
  47. package/es/sidebar/components/sidebar-container/index.js +77 -0
  48. package/es/sidebar/components/sidebar-container/index.scss +18 -0
  49. package/es/sidebar/components/tree/index.d.ts +4 -0
  50. package/es/sidebar/components/tree/index.js +162 -0
  51. package/es/sidebar/index.d.ts +5 -0
  52. package/es/sidebar/index.js +70 -0
  53. package/es/sidebar/index.scss +3 -0
  54. package/es/sidebar/typing.d.ts +64 -0
  55. package/es/sidebar/typing.js +1 -0
  56. package/es/table/components/Filter/index.js +3 -3
  57. package/es/table/index.js +12 -3
  58. package/es/table/index.scss +1 -0
  59. package/es/table/typing.d.ts +2 -0
  60. package/es/utils/components/tags/index.d.ts +11 -0
  61. package/es/utils/components/tags/index.js +50 -0
  62. package/es/utils/components/tags/index.scss +12 -0
  63. package/lib/actions/base.d.ts +16 -6
  64. package/lib/actions/base.js +67 -12
  65. package/lib/actions/confirm.d.ts +1 -1
  66. package/lib/actions/danger-confirm.d.ts +1 -1
  67. package/lib/actions/dialog-component.d.ts +1 -1
  68. package/lib/actions/dialog-form.d.ts +1 -1
  69. package/lib/actions/dialog-form.js +3 -3
  70. package/lib/actions/dialog-info.d.ts +1 -1
  71. package/lib/actions/dialog-table.d.ts +1 -1
  72. package/lib/actions/dialog.d.ts +6 -2
  73. package/lib/actions/dialog.js +18 -23
  74. package/lib/actions/drawer-form.d.ts +1 -1
  75. package/lib/actions/drawer-info.d.ts +1 -1
  76. package/lib/actions/drawer-table.d.ts +1 -1
  77. package/lib/actions/drawer.d.ts +1 -1
  78. package/lib/actions/error.d.ts +1 -1
  79. package/lib/actions/index.js +25 -21
  80. package/lib/actions/index.scss +14 -7
  81. package/lib/actions/link.d.ts +2 -2
  82. package/lib/actions/link.js +2 -2
  83. package/lib/actions/notice.d.ts +1 -1
  84. package/lib/actions/request.d.ts +1 -1
  85. package/lib/actions/request.js +2 -2
  86. package/lib/card/index.d.ts +21 -3
  87. package/lib/card/index.js +35 -14
  88. package/lib/card/index.scss +71 -2
  89. package/lib/card/selectable.d.ts +13 -0
  90. package/lib/card/selectable.js +60 -0
  91. package/lib/card/tab.d.ts +6 -0
  92. package/lib/card/tab.js +39 -0
  93. package/lib/form/Filter/index.js +5 -6
  94. package/lib/form/ProForm/index.js +3 -23
  95. package/lib/form/ProForm/index.scss +9 -0
  96. package/lib/form/SchemaForm/index.js +7 -6
  97. package/lib/index.d.ts +1 -1
  98. package/lib/index.js +3 -1
  99. package/lib/info/components/tableInfo/index.js +10 -6
  100. package/lib/nocode/configurators/Card.js +31 -8
  101. package/lib/page-header/index.d.ts +20 -11
  102. package/lib/page-header/index.js +22 -45
  103. package/lib/page-header/index.scss +0 -11
  104. package/lib/sidebar/components/sidebar-container/index.d.ts +5 -0
  105. package/lib/sidebar/components/sidebar-container/index.js +93 -0
  106. package/lib/sidebar/components/sidebar-container/index.scss +18 -0
  107. package/lib/sidebar/components/tree/index.d.ts +4 -0
  108. package/lib/sidebar/components/tree/index.js +179 -0
  109. package/lib/sidebar/index.d.ts +5 -0
  110. package/lib/sidebar/index.js +91 -0
  111. package/lib/sidebar/index.scss +3 -0
  112. package/lib/sidebar/typing.d.ts +64 -0
  113. package/lib/sidebar/typing.js +5 -0
  114. package/lib/table/components/Filter/index.js +2 -2
  115. package/lib/table/index.js +12 -3
  116. package/lib/table/index.scss +1 -0
  117. package/lib/table/typing.d.ts +2 -0
  118. package/lib/utils/components/tags/index.d.ts +11 -0
  119. package/lib/utils/components/tags/index.js +66 -0
  120. package/lib/utils/components/tags/index.scss +12 -0
  121. package/package.json +1 -1
@@ -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;
@@ -1,23 +1,77 @@
1
1
  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; }
2
2
 
3
- export function eventHandler(action, onTrigger) {
3
+ 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); } }
4
+
5
+ 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); }); }; }
6
+
7
+ import { resolveMaybePromiseMethod } from '@teamix/utils';
8
+ export function eventHandler(action, actionContext, onTrigger) {
4
9
  var _action$trigger = action.trigger,
5
10
  trigger = _action$trigger === void 0 ? 'onClick' : _action$trigger,
6
11
  preventDefault = action.preventDefault,
7
- stopPropagation = action.stopPropagation;
8
- return _defineProperty({}, "".concat(trigger), function _(e) {
9
- var _action$onTrigger;
12
+ stopPropagation = action.stopPropagation,
13
+ beforeAction = action.beforeAction;
14
+ return _defineProperty({}, "".concat(trigger), function () {
15
+ var _2 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee(e) {
16
+ var _action$onTrigger;
10
17
 
11
- if (preventDefault) {
12
- e.preventDefault();
13
- }
18
+ var beforeActionContext;
19
+ return regeneratorRuntime.wrap(function _callee$(_context) {
20
+ while (1) {
21
+ switch (_context.prev = _context.next) {
22
+ case 0:
23
+ if (preventDefault) {
24
+ e.preventDefault();
25
+ }
26
+
27
+ if (stopPropagation) {
28
+ e.stopPropagation();
29
+ }
30
+
31
+ if (!beforeAction) {
32
+ _context.next = 14;
33
+ break;
34
+ }
35
+
36
+ _context.prev = 3;
37
+ _context.next = 6;
38
+ return resolveMaybePromiseMethod(beforeAction, actionContext);
39
+
40
+ case 6:
41
+ beforeActionContext = _context.sent;
42
+ _context.next = 12;
43
+ break;
44
+
45
+ case 9:
46
+ _context.prev = 9;
47
+ _context.t0 = _context["catch"](3);
48
+ beforeActionContext = false;
49
+
50
+ case 12:
51
+ if (!(beforeActionContext === false)) {
52
+ _context.next = 14;
53
+ break;
54
+ }
55
+
56
+ return _context.abrupt("return");
57
+
58
+ case 14:
59
+ onTrigger(Object.assign({}, beforeActionContext, actionContext));
60
+ (_action$onTrigger = action.onTrigger) === null || _action$onTrigger === void 0 ? void 0 : _action$onTrigger.call(action);
61
+
62
+ case 16:
63
+ case "end":
64
+ return _context.stop();
65
+ }
66
+ }
67
+ }, _callee, null, [[3, 9]]);
68
+ }));
14
69
 
15
- if (stopPropagation) {
16
- e.stopPropagation();
70
+ function _(_x) {
71
+ return _2.apply(this, arguments);
17
72
  }
18
73
 
19
- onTrigger();
20
- (_action$onTrigger = action.onTrigger) === null || _action$onTrigger === void 0 ? void 0 : _action$onTrigger.call(action);
21
- });
74
+ return _;
75
+ }());
22
76
  }
23
77
  export 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;
@@ -23,7 +23,7 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
23
23
 
24
24
  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; }
25
25
 
26
- import React, { useState, useRef, useEffect } from 'react';
26
+ import React, { useState, useEffect, createRef } from 'react';
27
27
  import { useHistory } from 'react-router-dom';
28
28
  import { Loading } from '@alicloudfe/components';
29
29
  import ProForm, { createForm } from '../form';
@@ -136,18 +136,18 @@ export function useDialogFormAction(action, context) {
136
136
  _onFinish = action.onFinish,
137
137
  others = _objectWithoutProperties(action, _excluded2);
138
138
 
139
- var formRef = useRef();
139
+ var formRef = /*#__PURE__*/createRef();
140
140
  return useDialogAction(Object.assign({
141
141
  size: size,
142
142
  closeable: true,
143
- content: function content() {
143
+ content: function content(contentContext) {
144
144
  var dialogFormProps = {
145
145
  initialValues: initialValues,
146
146
  initialRequest: initialRequest,
147
147
  schema: schema,
148
148
  size: size,
149
149
  formProps: formProps,
150
- context: context
150
+ context: contentContext
151
151
  };
152
152
  return /*#__PURE__*/React.createElement(DialogForm, _objectSpread({
153
153
  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;
@@ -1,10 +1,5 @@
1
1
  var _excluded = ["url", "method", "params", "data", "extendParams", "successMsg", "errorMsg", "formatParams", "formatResult", "onSuccess", "onError"],
2
- _excluded2 = ["title", "content", "component", "schema", "onFinish", "dialogType", "dialogQuickShowType", "messageType", "beforeRequest", "onTrigger", "link", "beforeContent", "afterContent", "message", "footerDescription", "footerAlign", "overlayProps"],
3
- _excluded3 = ["className"];
4
-
5
- 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); } }
6
-
7
- 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); }); }; }
2
+ _excluded2 = ["title", "content", "component", "schema", "onFinish", "dialogType", "dialogQuickShowType", "messageType", "beforeRequest", "onTrigger", "link", "beforeContent", "afterContent", "message", "footerDescription", "footerAlign", "className"];
8
3
 
9
4
  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; }
10
5
 
@@ -12,6 +7,10 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
12
7
 
13
8
  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; }
14
9
 
10
+ 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); } }
11
+
12
+ 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); }); }; }
13
+
15
14
  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; }
16
15
 
17
16
  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; }
@@ -32,7 +31,7 @@ import React, { useState, useEffect, useRef } from 'react';
32
31
  import classnames from 'classnames';
33
32
  import { useHistory } from 'react-router-dom';
34
33
  import { Dialog, Drawer } from '@alicloudfe/components';
35
- import { getTargetValue, uuid, goToLink } from '@teamix/utils';
34
+ import { getTargetValue, uuid, goToLink, getMessage } from '@teamix/utils';
36
35
  import ProForm, { createForm } from '../form';
37
36
  import { renderProMessage } from '../utils/message';
38
37
  import { eventHandler } from './base';
@@ -69,7 +68,7 @@ function getFooterAlignClass(isDrawer, align) {
69
68
  } // 弹窗 -> 请求(点击确认,发送数据请求)
70
69
 
71
70
 
72
- export function useDialogAction(action, context) {
71
+ export function useDialogAction(action, actionContext) {
73
72
  var _useState = useState(false),
74
73
  _useState2 = _slicedToArray(_useState, 2),
75
74
  loading = _useState2[0],
@@ -78,7 +77,7 @@ export function useDialogAction(action, context) {
78
77
  var footerDescriptionRef = useRef();
79
78
  var history = useHistory();
80
79
 
81
- var onActionStart = function onActionStart() {
80
+ var onActionStart = function onActionStart(context) {
82
81
  var url = action.url,
83
82
  method = action.method,
84
83
  params = action.params,
@@ -110,28 +109,21 @@ export function useDialogAction(action, context) {
110
109
  message = _getTargetValue.message,
111
110
  footerDescription = _getTargetValue.footerDescription,
112
111
  footerAlign = _getTargetValue.footerAlign,
113
- _getTargetValue$overl = _getTargetValue.overlayProps,
114
- overlayProps = _getTargetValue$overl === void 0 ? {} : _getTargetValue$overl,
112
+ className = _getTargetValue.className,
115
113
  containerProps = _objectWithoutProperties(_getTargetValue, _excluded2);
116
114
 
117
115
  var isDrawer = dialogType === 'drawer';
118
116
  var container = isDrawer ? Drawer : Dialog;
119
-
120
- var overlayClassName = overlayProps.className,
121
- overlayOtherProps = _objectWithoutProperties(overlayProps, _excluded3);
122
-
123
117
  var dialogOnlyProps = {
124
118
  type: dialogQuickShowType,
125
119
  messageProps: {
126
120
  type: messageType
127
- },
128
- overlayProps: _objectSpread({
129
- className: classnames('teamix-pro-action-dialog', overlayClassName, {
130
- 'has-footer-description': !!footerDescription
131
- })
132
- }, overlayOtherProps)
121
+ }
133
122
  };
134
- var containerOtherProps = isDrawer ? {} : dialogOnlyProps;
123
+ var containerOtherProps = isDrawer ? {
124
+ okText: getMessage('ok'),
125
+ cancelText: getMessage('cancel')
126
+ } : dialogOnlyProps;
135
127
 
136
128
  var renderDialogFooterDescription = function renderDialogFooterDescription(footer) {
137
129
  if (footer instanceof Array || footer.component) {
@@ -240,13 +232,16 @@ export function useDialogAction(action, context) {
240
232
  className: classnames('teamix-pro-dialog-footer-description', getFooterAlignClass(isDrawer, footerAlign))
241
233
  }, renderDialogFooterDescription(footerDescription))),
242
234
  closeable: !loading,
243
- footerAlign: footerAlign
235
+ footerAlign: footerAlign,
236
+ className: classnames('teamix-pro-action-dialog', {
237
+ 'has-footer-description': !!footerDescription
238
+ })
244
239
  }, containerOtherProps), containerProps);
245
240
 
246
241
  var ret = container.show(quickShowProps);
247
242
  store.hide = ret.hide;
248
243
  };
249
244
 
250
- return _objectSpread({}, eventHandler(action, onActionStart));
245
+ return _objectSpread({}, eventHandler(action, actionContext, onActionStart));
251
246
  }
252
247
  export 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;
@@ -169,13 +169,15 @@ export var ProActionButton = function ProActionButton(props) {
169
169
  }, buttonProps), buttonContent(children, icon, iconSize, context));
170
170
  };
171
171
 
172
- function renderMenuButtonItem(item, key, context) {
173
- var config = item.config,
174
- btnContext = item.context,
175
- _onClick2 = item.onClick,
176
- children = item.children,
177
- icon = item.icon,
178
- disabled = item.disabled;
172
+ var ProActionMenuButtonItem = function ProActionMenuButtonItem(props) {
173
+ var action = props.action,
174
+ context = props.context;
175
+ var config = action.config,
176
+ btnContext = action.context,
177
+ _onClick2 = action.onClick,
178
+ children = action.children,
179
+ icon = action.icon,
180
+ disabled = action.disabled;
179
181
  var menuItemActionConfig = Object.assign({}, config, {
180
182
  trigger: 'onClick'
181
183
  });
@@ -184,30 +186,33 @@ function renderMenuButtonItem(item, key, context) {
184
186
  loading = _useAction.loading,
185
187
  menuItemProps = _objectWithoutProperties(_useAction, _excluded3);
186
188
 
187
- var buttonProps = _onClick2 ? _objectSpread(_objectSpread({}, menuItemProps), {}, {
189
+ var buttonProps = disabled ? {} : _onClick2 ? _objectSpread(_objectSpread({}, menuItemProps), {}, {
188
190
  onClick: function onClick(e) {
189
191
  return _onClick2(e, context);
190
192
  }
191
193
  }) : _objectSpread({}, menuItemProps);
192
- return /*#__PURE__*/React.createElement(MenuButton.Item, _objectSpread({
193
- key: key,
194
- disabled: disabled
194
+ return /*#__PURE__*/React.createElement("div", _objectSpread({
195
+ className: cls('teamix-pro-action-menu-item', 'next-menu-item', {
196
+ 'next-disabled': disabled
197
+ })
195
198
  }, buttonProps), buttonContent(children, icon, undefined, context));
196
- }
199
+ };
197
200
 
198
- function renderCommonActionButtonMenuItem(action, key, context) {
201
+ function renderCommonActionButtonMenuItem(action, context) {
199
202
  var menuBtn = action;
200
203
 
201
204
  if (menuBtn.actions && menuBtn.actions.length && menuBtn.disabled !== true) {
202
205
  return /*#__PURE__*/React.createElement(Menu.SubMenu, {
203
- key: key,
204
206
  label: menuBtn.label || menuBtn.children
205
207
  }, menuBtn.actions.map(function (a, j) {
206
- return renderCommonActionButtonMenuItem(a, j, context);
208
+ return renderCommonActionButtonMenuItem(a, context);
207
209
  }));
208
210
  }
209
211
 
210
- return renderMenuButtonItem(action, key, context);
212
+ return /*#__PURE__*/React.createElement(ProActionMenuButtonItem, {
213
+ action: action,
214
+ context: context
215
+ });
211
216
  }
212
217
 
213
218
  export var ProActionMenuButton = function ProActionMenuButton(props) {
@@ -223,6 +228,7 @@ export var ProActionMenuButton = function ProActionMenuButton(props) {
223
228
 
224
229
  return /*#__PURE__*/React.createElement(MenuButton, _objectSpread({
225
230
  popupTriggerType: "hover",
231
+ autoWidth: false,
226
232
  menuProps: {
227
233
  mode: 'popup',
228
234
  triggerType: 'hover'
@@ -232,8 +238,8 @@ export var ProActionMenuButton = function ProActionMenuButton(props) {
232
238
  },
233
239
  type: type,
234
240
  label: buttonContent(label || children, icon, iconSize, context)
235
- }, others), actions.map(function (action, i) {
236
- return renderCommonActionButtonMenuItem(action, i, context);
241
+ }, others), actions.map(function (action) {
242
+ return renderCommonActionButtonMenuItem(action, context);
237
243
  }));
238
244
  }; // 如果 actions 数量超过了 max,则把第 max 个和剩余超出部分折叠起来成为一个 menu
239
245
 
@@ -337,9 +343,7 @@ export function ProActionGroup(props) {
337
343
  })
338
344
  }, containerProps), formatedActions.map(function (actionBtn, i) {
339
345
  var isLastOne = i === formatedActions.length - 1;
340
- return /*#__PURE__*/React.createElement(React.Fragment, {
341
- key: i
342
- }, renderCommonActionButton(actionBtn, context, isTypeText), isTypeText && divider && !isLastOne && /*#__PURE__*/React.createElement(Divider, {
346
+ return /*#__PURE__*/React.createElement(React.Fragment, null, renderCommonActionButton(actionBtn, context, isTypeText), isTypeText && divider && !isLastOne && /*#__PURE__*/React.createElement(Divider, {
343
347
  direction: "ver"
344
348
  }));
345
349
  }));
@@ -28,6 +28,19 @@
28
28
  flex-shrink: 0;
29
29
  }
30
30
  }
31
+ .next-dialog.teamix-pro-action-dialog {
32
+ &.has-footer-description {
33
+ .next-message {
34
+ position: static;
35
+ }
36
+ }
37
+
38
+ &.quick-show-confirm-or-alert {
39
+ .teamix-pro-dialog-footer-description {
40
+ bottom: var(--dialog-footer-padding-bottom, 20px);
41
+ }
42
+ }
43
+ }
31
44
 
32
45
  .teamix-pro-dialog-footer-description {
33
46
  position: absolute;
@@ -48,12 +61,6 @@
48
61
  }
49
62
  }
50
63
 
51
- .teamix-pro-action-dialog.has-footer-description {
52
- .next-message {
53
- position: static;
54
- }
55
- }
56
-
57
64
  .teamix-pro-dialog-before-content {
58
65
  margin-bottom: var(--s-2);
59
66
  }
@@ -61,7 +68,7 @@
61
68
  .teamix-pro-dialog-message {
62
69
  margin-bottom: var(--s-2);
63
70
 
64
- &+.next-loading {
71
+ & + .next-loading {
65
72
  .teamix-pro-form {
66
73
  margin-top: 20px;
67
74
  }
@@ -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;
@@ -7,9 +7,9 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.definePrope
7
7
  import { getTargetValue, goToLink } from '@teamix/utils';
8
8
  import { useHistory } from 'react-router-dom';
9
9
  import { eventHandler } from './base';
10
- export function useLinkAction(action, context) {
10
+ export function useLinkAction(action, actionContext) {
11
11
  var history = useHistory();
12
- return _objectSpread({}, eventHandler(action, function () {
12
+ return _objectSpread({}, eventHandler(action, actionContext, function (context) {
13
13
  var linkAction = getTargetValue(action, context);
14
14
  goToLink(linkAction, history);
15
15
  }));
@@ -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;
@@ -3,7 +3,7 @@ import { BaseAction } from './base';
3
3
  export interface RequestAction extends CommonRequestConfig, BaseAction {
4
4
  }
5
5
  export declare function doRequest(action: RequestAction, context?: any, history?: any, extraParams?: any): Promise<unknown>;
6
- export declare function useRequestAction(action: RequestAction, context?: any): {
6
+ export declare function useRequestAction(action: RequestAction, actionContext?: any): {
7
7
  loading: boolean;
8
8
  };
9
9
  export default useRequestAction;
@@ -37,7 +37,7 @@ export function doRequest(action, context, history, extraParams) {
37
37
  method: method
38
38
  }, others), context, history, extraParams);
39
39
  }
40
- export function useRequestAction(action, context) {
40
+ export function useRequestAction(action, actionContext) {
41
41
  var _useState = useState(false),
42
42
  _useState2 = _slicedToArray(_useState, 2),
43
43
  loading = _useState2[0],
@@ -48,7 +48,7 @@ export function useRequestAction(action, context) {
48
48
  var onFinish = action.onFinish,
49
49
  others = _objectWithoutProperties(action, _excluded2);
50
50
 
51
- return _objectSpread(_objectSpread({}, eventHandler(action, function () {
51
+ return _objectSpread(_objectSpread({}, eventHandler(action, actionContext, function (context) {
52
52
  setLoading(true);
53
53
  doRequest(_objectSpread({}, others), context, history).then(function () {
54
54
  setLoading(false);
@@ -1,4 +1,5 @@
1
1
  import React from 'react';
2
+ import { ProTagItem } from '../utils/components/tags';
2
3
  import { ProActionGroupProps } from '../actions';
3
4
  import './index.scss';
4
5
  export * from './card-container';
@@ -13,6 +14,8 @@ export interface ProCardProps extends Omit<React.HTMLAttributes<HTMLElement>, 't
13
14
  tooltip?: React.ReactNode;
14
15
  /** 标题右侧图标 */
15
16
  tooltipIcon?: React.ReactNode;
17
+ /** 标签组 */
18
+ tags?: ProTagItem[];
16
19
  /** 标题右侧描述 */
17
20
  description?: React.ReactNode;
18
21
  /** 额外信息区域,位于卡片右上角,可以配置一些常用轻量操作 */
@@ -23,11 +26,11 @@ export interface ProCardProps extends Omit<React.HTMLAttributes<HTMLElement>, 't
23
26
  image?: string;
24
27
  /** 卡片标题下方是否有分割线 */
25
28
  divider?: boolean;
26
- /** 卡片是否有边框 */
27
- bordered?: boolean;
28
29
  /**
29
- * @deprecated 已经没有这个效果了,将在下一个 minor 版本移除
30
+ * @deprecated 建议使用 borderColor = 'none' 代替
30
31
  */
32
+ bordered?: boolean;
33
+ /** 卡片在 hover 时拥有阴影效果 */
31
34
  hoveredShadow?: boolean;
32
35
  /** 卡片是否为紧凑模式,紧凑模式下卡片没有内边距和边框 */
33
36
  compacted?: boolean;
@@ -35,6 +38,10 @@ export interface ProCardProps extends Omit<React.HTMLAttributes<HTMLElement>, 't
35
38
  centered?: boolean;
36
39
  /** 加载中状态 */
37
40
  loading?: boolean;
41
+ /** 空状态 */
42
+ empty?: boolean;
43
+ /** 边框颜色 */
44
+ borderColor?: 'blue' | 'green' | 'red' | 'orange' | 'yellow' | 'grey' | 'transparent' | 'none';
38
45
  /** 背景色 */
39
46
  backgroundColor?: 'blue' | 'green' | 'red' | 'orange' | 'yellow' | 'grey' | 'transparent';
40
47
  /** 内容区栅格排列 flex 方向,仅仅在卡片嵌套模式下生效 */
@@ -77,6 +84,17 @@ export declare const ProCard: {
77
84
  (props: React.HTMLAttributes<HTMLElement>): JSX.Element;
78
85
  isProCardDivider: boolean;
79
86
  };
87
+ Selectable: {
88
+ (props: import("./selectable").ProCardSelectableProps): JSX.Element;
89
+ defaultProps: {
90
+ hoveredShadow: boolean;
91
+ }; /** 标签组 */
92
+ isProCard: boolean;
93
+ };
94
+ Tab: {
95
+ (props: import("@alifd/next/types/tab").TabProps): JSX.Element;
96
+ Item: typeof import("@alifd/next/types/tab").Item;
97
+ };
80
98
  isProCard: boolean;
81
99
  };
82
100
  export default ProCard;