@teamix/pro 1.1.34 → 1.1.38

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 (79) hide show
  1. package/dist/pro.css +1 -1
  2. package/dist/pro.js +1069 -334
  3. package/dist/pro.min.css +1 -1
  4. package/dist/pro.min.js +1 -1
  5. package/es/actions/dialog-form.d.ts +8 -1
  6. package/es/actions/dialog-form.js +32 -15
  7. package/es/actions/dialog-info.d.ts +9 -0
  8. package/es/actions/dialog-info.js +23 -0
  9. package/es/actions/dialog.d.ts +11 -0
  10. package/es/actions/dialog.js +105 -28
  11. package/es/actions/drawer-info.d.ts +6 -0
  12. package/es/actions/drawer-info.js +7 -0
  13. package/es/actions/index.d.ts +11 -5
  14. package/es/actions/index.js +28 -12
  15. package/es/actions/index.scss +39 -0
  16. package/es/actions/link.js +4 -12
  17. package/es/actions/request.d.ts +1 -1
  18. package/es/actions/request.js +2 -2
  19. package/es/form/Components/ProField/index.d.ts +1 -84
  20. package/es/form/SchemaForm/reactions.js +4 -2
  21. package/es/form/typing.d.ts +5 -5
  22. package/es/index.d.ts +1 -1
  23. package/es/index.js +1 -1
  24. package/es/info/components/{headerInfo → HeaderInfo}/index.d.ts +3 -1
  25. package/es/info/components/HeaderInfo/index.js +68 -0
  26. package/es/info/components/{headerInfo → HeaderInfo}/index.scss +0 -0
  27. package/es/info/components/InfoValueItem/index.js +111 -26
  28. package/es/info/components/{tableInfo → TableInfo}/index.d.ts +0 -0
  29. package/es/info/components/{tableInfo → TableInfo}/index.js +4 -21
  30. package/es/info/components/{tableInfo → TableInfo}/index.scss +0 -0
  31. package/es/info/components/baseInfo/index.d.ts +3 -1
  32. package/es/info/components/baseInfo/index.js +34 -42
  33. package/es/info/index.js +69 -26
  34. package/es/info/index.scss +0 -4
  35. package/es/info/typing.d.ts +17 -6
  36. package/es/page-header/index.d.ts +9 -5
  37. package/es/page-header/index.js +22 -7
  38. package/es/table/components/Filter/index.js +7 -2
  39. package/es/table/components/Filter/index.scss +1 -1
  40. package/es/table/typing.d.ts +2 -0
  41. package/lib/actions/dialog-form.d.ts +8 -1
  42. package/lib/actions/dialog-form.js +32 -15
  43. package/lib/actions/dialog-info.d.ts +9 -0
  44. package/lib/actions/dialog-info.js +37 -0
  45. package/lib/actions/dialog.d.ts +11 -0
  46. package/lib/actions/dialog.js +108 -27
  47. package/lib/actions/drawer-info.d.ts +6 -0
  48. package/lib/actions/drawer-info.js +18 -0
  49. package/lib/actions/index.d.ts +11 -5
  50. package/lib/actions/index.js +30 -12
  51. package/lib/actions/index.scss +39 -0
  52. package/lib/actions/link.js +5 -12
  53. package/lib/actions/request.d.ts +1 -1
  54. package/lib/actions/request.js +2 -2
  55. package/lib/form/Components/ProField/index.d.ts +1 -84
  56. package/lib/form/SchemaForm/reactions.js +4 -2
  57. package/lib/form/typing.d.ts +5 -5
  58. package/lib/index.d.ts +1 -1
  59. package/lib/index.js +1 -1
  60. package/lib/info/components/{headerInfo → HeaderInfo}/index.d.ts +3 -1
  61. package/lib/info/components/HeaderInfo/index.js +87 -0
  62. package/lib/info/components/{headerInfo → HeaderInfo}/index.scss +0 -0
  63. package/lib/info/components/InfoValueItem/index.js +110 -25
  64. package/lib/info/components/{tableInfo → TableInfo}/index.d.ts +0 -0
  65. package/lib/info/components/{tableInfo → TableInfo}/index.js +4 -22
  66. package/lib/info/components/{tableInfo → TableInfo}/index.scss +0 -0
  67. package/lib/info/components/baseInfo/index.d.ts +3 -1
  68. package/lib/info/components/baseInfo/index.js +33 -49
  69. package/lib/info/index.js +70 -25
  70. package/lib/info/index.scss +0 -4
  71. package/lib/info/typing.d.ts +17 -6
  72. package/lib/page-header/index.d.ts +9 -5
  73. package/lib/page-header/index.js +22 -7
  74. package/lib/table/components/Filter/index.js +7 -2
  75. package/lib/table/components/Filter/index.scss +1 -1
  76. package/lib/table/typing.d.ts +2 -0
  77. package/package.json +1 -1
  78. package/es/info/components/headerInfo/index.js +0 -99
  79. package/lib/info/components/headerInfo/index.js +0 -126
@@ -3,11 +3,18 @@ import { IFormProps, IFormSchema } from '../form';
3
3
  import { RequestAction } from './request';
4
4
  import { DialogAction } from './dialog';
5
5
  export interface DialogFormAction extends DialogAction {
6
+ /** 表单初始值 */
6
7
  initialValues?: any;
8
+ /** 表单初始化数据请求 */
7
9
  initialRequest?: RequestAction;
10
+ /** 表单提交发送数据请求时,是否携带全部表单数据。默认携带 */
8
11
  useFieldValuesForRequest?: boolean;
12
+ /**
13
+ * @deprecated 建议使用 schema 配置 IFormProps 代替
14
+ */
9
15
  formProps?: Omit<IFormProps, 'schema'>;
10
- schema: IFormSchema;
16
+ /** 同时支持两种配置方式,如果想完整定制表单,可使用完整的表单配置项 IFormProps,否则可以只配置 IFormSchema */
17
+ schema: IFormSchema | IFormProps;
11
18
  }
12
19
  export declare function useDialogFormAction(action: DialogFormAction, context?: any): {
13
20
  [x: string]: (e: React.MouseEvent<HTMLElement, MouseEvent>) => void;
@@ -1,14 +1,5 @@
1
- var _excluded = ["schema", "useFieldValuesForRequest", "initialValues", "initialRequest", "formProps", "size", "onFinish", "onCancel"];
2
-
3
- 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; }
4
-
5
- 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; }
6
-
7
- 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; }
8
-
9
- 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; }
10
-
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; }
1
+ var _excluded = ["schema"],
2
+ _excluded2 = ["schema", "useFieldValuesForRequest", "initialValues", "initialRequest", "formProps", "size", "onFinish", "onCancel"];
12
3
 
13
4
  function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
14
5
 
@@ -22,6 +13,16 @@ function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Sy
22
13
 
23
14
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
24
15
 
16
+ 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; }
17
+
18
+ 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; }
19
+
20
+ 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; }
21
+
22
+ 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; }
23
+
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
27
  import { useHistory } from 'react-router-dom';
27
28
  import { Loading } from '@alicloudfe/components';
@@ -62,15 +63,31 @@ function getDefaultFormPropsByDialogSize(size) {
62
63
  };
63
64
  }
64
65
 
66
+ function getSchemaAndFormProps(schema, formProps) {
67
+ if (schema instanceof Array) {
68
+ return _objectSpread({
69
+ schema: schema
70
+ }, formProps);
71
+ }
72
+
73
+ var formSchema = schema;
74
+ return formSchema;
75
+ }
76
+
65
77
  var DialogForm = function DialogForm(props) {
66
78
  var initialValues = props.initialValues,
67
79
  initialRequest = props.initialRequest,
68
- schema = props.schema,
69
80
  _props$size = props.size,
70
81
  size = _props$size === void 0 ? 'small' : _props$size,
82
+ schema = props.schema,
71
83
  formProps = props.formProps,
72
84
  context = props.context,
73
85
  formRef = props.formRef;
86
+
87
+ var _getSchemaAndFormProp = getSchemaAndFormProps(schema, formProps),
88
+ formSchema = _getSchemaAndFormProp.schema,
89
+ others = _objectWithoutProperties(_getSchemaAndFormProp, _excluded);
90
+
74
91
  var form = createForm({
75
92
  initialValues: getTargetValue(initialValues, context)
76
93
  });
@@ -101,8 +118,8 @@ var DialogForm = function DialogForm(props) {
101
118
  }
102
119
  }, /*#__PURE__*/React.createElement(ProForm, _objectSpread(_objectSpread({
103
120
  form: form,
104
- schema: getTargetValue(schema, context)
105
- }, getDefaultFormPropsByDialogSize(size)), getTargetValue(formProps, context))));
121
+ schema: getTargetValue(formSchema, context)
122
+ }, getDefaultFormPropsByDialogSize(size)), getTargetValue(others, context))));
106
123
  };
107
124
 
108
125
  export function useDialogFormAction(action, context) {
@@ -117,7 +134,7 @@ export function useDialogFormAction(action, context) {
117
134
  size = _action$size === void 0 ? 'small' : _action$size,
118
135
  _onFinish = action.onFinish,
119
136
  _onCancel = action.onCancel,
120
- others = _objectWithoutProperties(action, _excluded);
137
+ others = _objectWithoutProperties(action, _excluded2);
121
138
 
122
139
  var formRef = useRef();
123
140
  return useDialogAction(Object.assign({
@@ -0,0 +1,9 @@
1
+ import { DialogAction } from './dialog';
2
+ import { ProInfoProps } from '..';
3
+ export interface DialogInfoAction extends DialogAction {
4
+ schema: ProInfoProps;
5
+ }
6
+ export declare function useDialogInfoAction(action: DialogInfoAction, context?: any): {
7
+ [x: string]: (e: import("react").MouseEvent<HTMLElement, MouseEvent>) => void;
8
+ };
9
+ export default useDialogInfoAction;
@@ -0,0 +1,23 @@
1
+ var _excluded = ["schema"];
2
+
3
+ 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; }
4
+
5
+ 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; }
6
+
7
+ import useDialogAction from './dialog';
8
+ import { ProInfo } from '..';
9
+ export function useDialogInfoAction(action, context) {
10
+ var schema = action.schema,
11
+ others = _objectWithoutProperties(action, _excluded);
12
+
13
+ return useDialogAction(Object.assign({
14
+ component: ProInfo,
15
+ closeable: true,
16
+ size: 'mini',
17
+ schema: Object.assign({
18
+ backgroundColor: 'grey',
19
+ compacted: false
20
+ }, schema)
21
+ }, others), context);
22
+ }
23
+ export default useDialogInfoAction;
@@ -1,12 +1,23 @@
1
1
  import React from 'react';
2
2
  import { QuickShowConfig } from '@alicloudfe/components/types/dialog';
3
3
  import { quickShowDrawerProps } from '@alicloudfe/components/types/drawer';
4
+ import { IFormSchema, IFormSchemaItem } from '../form';
4
5
  import { RequestAction } from './request';
5
6
  export interface DialogAction extends Omit<RequestAction, 'url'>, Omit<QuickShowConfig, 'onError' | 'type'>, Omit<quickShowDrawerProps, 'trigger' | 'animation' | 'height' | 'locale' | 'onOk' | 'onCancel' | 'onError'> {
7
+ /** 点击「确认按钮」后的数据请求地址,非必填,不填就不发请求 */
6
8
  url?: string;
9
+ /** 弹窗类型,支持普通弹窗和抽屉两种模式,默认为普通弹窗 */
7
10
  dialogType?: 'dialog' | 'drawer';
11
+ /** 弹窗快捷调用类型 */
8
12
  dialogQuickShowType?: 'alert' | 'confirm';
13
+ /** 弹窗消息类型 */
9
14
  messageType?: 'success' | 'warning' | 'error' | 'notice' | 'help' | 'loading';
15
+ /** 位于弹窗内容上方的自定义内容区 */
16
+ beforeContent?: React.ReactNode;
17
+ /** 位于弹窗内容下方的自定义内容区 */
18
+ afterContent?: React.ReactNode;
19
+ /** 弹窗页脚描述区,位于按钮组的对面 */
20
+ footerDescription?: React.ReactNode | IFormSchema | IFormSchemaItem;
10
21
  }
11
22
  export declare function useDialogAction(action: DialogAction, context?: any): {
12
23
  [x: string]: (e: React.MouseEvent<HTMLElement, MouseEvent>) => void;
@@ -1,20 +1,21 @@
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"];
2
+ _excluded2 = ["title", "content", "component", "schema", "onFinish", "dialogType", "dialogQuickShowType", "messageType", "beforeRequest", "onTrigger", "link", "beforeContent", "afterContent", "footerDescription", "footerAlign", "overlayProps"],
3
+ _excluded3 = ["className"];
3
4
 
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); } }
5
6
 
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); }); }; }
7
8
 
8
- 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; }
9
-
10
- 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; }
11
-
12
9
  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; }
13
10
 
14
11
  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; }
15
12
 
16
13
  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; }
17
14
 
15
+ 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
+
17
+ 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; }
18
+
18
19
  function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
19
20
 
20
21
  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."); }
@@ -27,10 +28,12 @@ function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Sy
27
28
 
28
29
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
29
30
 
30
- import React, { useState } from 'react';
31
+ import React, { useState, useEffect, useRef } from 'react';
32
+ import classnames from 'classnames';
31
33
  import { useHistory } from 'react-router-dom';
32
34
  import { Dialog, Drawer } from '@alicloudfe/components';
33
35
  import { getTargetValue, uuid, goToLink } from '@teamix/utils';
36
+ import ProForm, { createForm } from '../form';
34
37
  import { eventHandler } from './base';
35
38
  import { doRequest } from './request';
36
39
 
@@ -40,6 +43,27 @@ function addContextForReactNode(content, context) {
40
43
  }
41
44
 
42
45
  return content;
46
+ }
47
+
48
+ var FooterForm = function FooterForm(props) {
49
+ var schema = props.schema,
50
+ context = props.context,
51
+ formRef = props.formRef;
52
+ var form = createForm();
53
+ useEffect(function () {
54
+ formRef.current = form;
55
+ }, []);
56
+ return /*#__PURE__*/React.createElement(ProForm, {
57
+ layout: "inline",
58
+ feedbackLayout: "none",
59
+ form: form,
60
+ schema: getTargetValue(schema, context)
61
+ });
62
+ };
63
+
64
+ function getFooterAlignClass(isDrawer, align) {
65
+ var footerAlign = align ? align : isDrawer ? 'left' : 'right';
66
+ return "footer-align-".concat(footerAlign);
43
67
  } // 弹窗 -> 请求(点击确认,发送数据请求)
44
68
 
45
69
 
@@ -49,8 +73,10 @@ export function useDialogAction(action, context) {
49
73
  loading = _useState2[0],
50
74
  setLoading = _useState2[1];
51
75
 
76
+ var footerDescriptionRef = useRef();
52
77
  var history = useHistory();
53
- return _objectSpread({}, eventHandler(action, function () {
78
+
79
+ var onActionStart = function onActionStart() {
54
80
  var url = action.url,
55
81
  method = action.method,
56
82
  params = action.params,
@@ -77,19 +103,56 @@ export function useDialogAction(action, context) {
77
103
  beforeRequest = _getTargetValue.beforeRequest,
78
104
  onTrigger = _getTargetValue.onTrigger,
79
105
  link = _getTargetValue.link,
80
- dialogOtherProps = _objectWithoutProperties(_getTargetValue, _excluded2);
106
+ beforeContent = _getTargetValue.beforeContent,
107
+ afterContent = _getTargetValue.afterContent,
108
+ footerDescription = _getTargetValue.footerDescription,
109
+ footerAlign = _getTargetValue.footerAlign,
110
+ _getTargetValue$overl = _getTargetValue.overlayProps,
111
+ overlayProps = _getTargetValue$overl === void 0 ? {} : _getTargetValue$overl,
112
+ containerProps = _objectWithoutProperties(_getTargetValue, _excluded2);
113
+
114
+ var isDrawer = dialogType === 'drawer';
115
+ var container = isDrawer ? Drawer : Dialog;
81
116
 
82
- var dialogMethod = dialogType === 'drawer' ? Drawer : Dialog;
83
- var dialogProps = dialogType === 'drawer' ? {} : {
117
+ var overlayClassName = overlayProps.className,
118
+ overlayOtherProps = _objectWithoutProperties(overlayProps, _excluded3);
119
+
120
+ var dialogOnlyProps = {
84
121
  type: dialogQuickShowType,
85
122
  messageProps: {
86
123
  type: messageType
124
+ },
125
+ overlayProps: _objectSpread({
126
+ className: classnames('teamix-pro-action-dialog', overlayClassName, {
127
+ 'has-footer-description': !!footerDescription
128
+ })
129
+ }, overlayOtherProps)
130
+ };
131
+ var containerOtherProps = isDrawer ? {} : dialogOnlyProps;
132
+
133
+ var renderDialogFooterDescription = function renderDialogFooterDescription(footer) {
134
+ if (footer instanceof Array || footer.component) {
135
+ var _schema = footer instanceof Array ? footer : [footer];
136
+
137
+ return /*#__PURE__*/React.createElement(FooterForm, {
138
+ formRef: footerDescriptionRef,
139
+ context: context,
140
+ schema: [{
141
+ component: 'FormFlex',
142
+ children: _schema
143
+ }]
144
+ });
87
145
  }
146
+
147
+ return footer;
88
148
  };
89
149
 
90
150
  var onOk = function onOk() {
91
151
  return new Promise( /*#__PURE__*/function () {
92
152
  var _ref = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee(resolve) {
153
+ var _footerDescriptionRef;
154
+
155
+ var footerDescriptionValues, requestContext;
93
156
  return regeneratorRuntime.wrap(function _callee$(_context) {
94
157
  while (1) {
95
158
  switch (_context.prev = _context.next) {
@@ -109,29 +172,33 @@ export function useDialogAction(action, context) {
109
172
 
110
173
  case 5:
111
174
  setLoading(true);
112
- _context.prev = 6;
113
- _context.next = 9;
114
- return doRequest(action, context, history);
115
-
116
- case 9:
175
+ footerDescriptionValues = Object.assign({}, footerDescriptionRef === null || footerDescriptionRef === void 0 ? void 0 : (_footerDescriptionRef = footerDescriptionRef.current) === null || _footerDescriptionRef === void 0 ? void 0 : _footerDescriptionRef.values);
176
+ _context.prev = 7;
177
+ requestContext = Object.assign({
178
+ footer: footerDescriptionValues
179
+ }, context);
180
+ _context.next = 11;
181
+ return doRequest(action, requestContext, history, footerDescriptionValues);
182
+
183
+ case 11:
117
184
  onFinish && onFinish();
118
185
  resolve(true);
119
- _context.next = 18;
186
+ _context.next = 20;
120
187
  break;
121
188
 
122
- case 13:
123
- _context.prev = 13;
124
- _context.t0 = _context["catch"](6);
189
+ case 15:
190
+ _context.prev = 15;
191
+ _context.t0 = _context["catch"](7);
125
192
  setLoading(false);
126
193
  resolve(false);
127
194
  return _context.abrupt("return");
128
195
 
129
- case 18:
196
+ case 20:
130
197
  case "end":
131
198
  return _context.stop();
132
199
  }
133
200
  }
134
- }, _callee, null, [[6, 13]]);
201
+ }, _callee, null, [[7, 15]]);
135
202
  }));
136
203
 
137
204
  return function (_x) {
@@ -152,16 +219,26 @@ export function useDialogAction(action, context) {
152
219
  var dialogContext = Object.assign({}, context, {
153
220
  hide: hide
154
221
  });
155
- var ret = dialogMethod.show(_objectSpread(_objectSpread({
222
+ var dialogContent = Component ? /*#__PURE__*/React.createElement(Component, _objectSpread({
223
+ key: uuid()
224
+ }, componentProps)) : addContextForReactNode(content, dialogContext);
225
+ var ret = container.show(_objectSpread(_objectSpread({
156
226
  // @ts-ignore
157
227
  onOk: onOk,
158
228
  title: addContextForReactNode(title, dialogContext),
159
- content: Component ? /*#__PURE__*/React.createElement(Component, _objectSpread({
160
- key: uuid()
161
- }, componentProps)) : addContextForReactNode(content, dialogContext),
162
- closeable: !loading
163
- }, dialogProps), dialogOtherProps));
229
+ content: /*#__PURE__*/React.createElement(React.Fragment, null, beforeContent && /*#__PURE__*/React.createElement("div", {
230
+ className: "teamix-pro-dialog-before-content"
231
+ }, beforeContent), dialogContent, afterContent && /*#__PURE__*/React.createElement("div", {
232
+ className: "teamix-pro-dialog-after-content"
233
+ }, afterContent), footerDescription && /*#__PURE__*/React.createElement("div", {
234
+ className: classnames('teamix-pro-dialog-footer-description', getFooterAlignClass(isDrawer, footerAlign))
235
+ }, renderDialogFooterDescription(footerDescription))),
236
+ closeable: !loading,
237
+ footerAlign: footerAlign
238
+ }, containerOtherProps), containerProps));
164
239
  store.hide = ret.hide;
165
- }));
240
+ };
241
+
242
+ return _objectSpread({}, eventHandler(action, onActionStart));
166
243
  }
167
244
  export default useDialogAction;
@@ -0,0 +1,6 @@
1
+ import { DialogInfoAction } from './dialog-info';
2
+ export declare type DrawerInfoAction = DialogInfoAction;
3
+ export declare function useDrawerInfoAction(action: DrawerInfoAction, context?: any): {
4
+ [x: string]: (e: import("react").MouseEvent<HTMLElement, MouseEvent>) => void;
5
+ };
6
+ export default useDrawerInfoAction;
@@ -0,0 +1,7 @@
1
+ import { useDialogInfoAction } from './dialog-info';
2
+ export function useDrawerInfoAction(action, context) {
3
+ return useDialogInfoAction(Object.assign({
4
+ dialogType: 'drawer'
5
+ }, action), context);
6
+ }
7
+ export default useDrawerInfoAction;
@@ -10,17 +10,17 @@ import { NoticeAction } from './notice';
10
10
  import { ErrorAction } from './error';
11
11
  import { DialogFormAction } from './dialog-form';
12
12
  import { DialogTableAction } from './dialog-table';
13
+ import { DialogInfoAction } from './dialog-info';
13
14
  import { DrawerAction } from './drawer';
14
15
  import { DrawerFormAction } from './drawer-form';
15
16
  import { DrawerTableAction } from './drawer-table';
17
+ import { DrawerInfoAction } from './drawer-info';
16
18
  import './index.scss';
17
19
  export declare type ActionConfig = ({
18
20
  type: 'link';
19
21
  } & LinkAction) | ({
20
22
  type: 'request';
21
23
  } & RequestAction) | ({
22
- type: 'dialog';
23
- } & DialogAction) | ({
24
24
  type: 'confirm';
25
25
  } & ConfirmAction) | ({
26
26
  type: 'danger-confirm';
@@ -29,16 +29,22 @@ export declare type ActionConfig = ({
29
29
  } & NoticeAction) | ({
30
30
  type: 'error';
31
31
  } & ErrorAction) | ({
32
+ type: 'dialog';
33
+ } & DialogAction) | ({
32
34
  type: 'dialog-form';
33
35
  } & DialogFormAction) | ({
36
+ type: 'dialog-table';
37
+ } & DialogTableAction) | ({
38
+ type: 'dialog-info';
39
+ } & DialogInfoAction) | ({
34
40
  type: 'drawer';
35
41
  } & DrawerAction) | ({
36
42
  type: 'drawer-form';
37
43
  } & DrawerFormAction) | ({
38
- type: 'dialog-table';
39
- } & DialogTableAction) | ({
40
44
  type: 'drawer-table';
41
- } & DrawerTableAction);
45
+ } & DrawerTableAction) | ({
46
+ type: 'drawer-info';
47
+ } & DrawerInfoAction);
42
48
  export declare function registerActionHandler(id: string, extendActionId: string, defaultConfig: any): void;
43
49
  export declare const useAction: any;
44
50
  export interface IActionButton extends ButtonProps {
@@ -43,9 +43,11 @@ import { useNoticeAction } from './notice';
43
43
  import { useErrorAction } from './error';
44
44
  import { useDialogFormAction } from './dialog-form';
45
45
  import { useDialogTableAction } from './dialog-table';
46
+ import { useDialogInfoAction } from './dialog-info';
46
47
  import { useDrawerAction } from './drawer';
47
48
  import { useDrawerFormAction } from './drawer-form';
48
49
  import { useDrawerTableAction } from './drawer-table';
50
+ import { useDrawerInfoAction } from './drawer-info';
49
51
  import './index.scss';
50
52
  var RegistedActions = new Map();
51
53
  export function registerActionHandler(id, extendActionId, defaultConfig) {
@@ -98,6 +100,10 @@ export var useAction = function useAction(config, context) {
98
100
  return useDialogTableAction(others, context);
99
101
  }
100
102
 
103
+ if (type === 'dialog-info') {
104
+ return useDialogInfoAction(others, context);
105
+ }
106
+
101
107
  if (type === 'drawer') {
102
108
  return useDrawerAction(others, context);
103
109
  }
@@ -110,6 +116,10 @@ export var useAction = function useAction(config, context) {
110
116
  return useDrawerTableAction(others, context);
111
117
  }
112
118
 
119
+ if (type === 'drawer-info') {
120
+ return useDrawerInfoAction(others, context);
121
+ }
122
+
113
123
  var registedAction = RegistedActions.get(type);
114
124
 
115
125
  if (!registedAction) {
@@ -160,33 +170,39 @@ export var ActionButton = function ActionButton(props) {
160
170
  };
161
171
 
162
172
  function renderMenuButtonItem(item, key, context) {
163
- var menuItemActionConfig = Object.assign({}, item.config, {
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;
179
+ var menuItemActionConfig = Object.assign({}, config, {
164
180
  trigger: 'onClick'
165
181
  });
166
182
 
167
- var _useAction = useAction(menuItemActionConfig, item.context || context),
183
+ var _useAction = useAction(menuItemActionConfig, btnContext || context),
168
184
  loading = _useAction.loading,
169
185
  menuItemProps = _objectWithoutProperties(_useAction, _excluded3);
170
186
 
171
- var buttonProps = item.onClick ? _objectSpread(_objectSpread({}, menuItemProps), {}, {
187
+ var buttonProps = _onClick2 ? _objectSpread(_objectSpread({}, menuItemProps), {}, {
172
188
  onClick: function onClick(e) {
173
- return item.onClick(e, context);
189
+ return _onClick2(e, context);
174
190
  }
175
191
  }) : _objectSpread({}, menuItemProps);
176
192
  return /*#__PURE__*/React.createElement(MenuButton.Item, _objectSpread({
177
- key: key
178
- }, buttonProps), buttonContent(item.children, item.icon, undefined, context));
193
+ key: key,
194
+ disabled: disabled
195
+ }, buttonProps), buttonContent(children, icon, undefined, context));
179
196
  }
180
197
 
181
198
  function renderCommonActionButtonMenuItem(action, key, context) {
182
- // @ts-ignore
183
- if (action.actions && action.actions.length) {
199
+ var menuBtn = action;
200
+
201
+ if (menuBtn.actions && menuBtn.actions.length && menuBtn.disabled !== true) {
184
202
  return /*#__PURE__*/React.createElement(Menu.SubMenu, {
185
203
  key: key,
186
- label: // @ts-ignore
187
- action.label || action.children
188
- }, //@ts-ignore
189
- action.actions.map(function (a, j) {
204
+ label: menuBtn.label || menuBtn.children
205
+ }, menuBtn.actions.map(function (a, j) {
190
206
  return renderCommonActionButtonMenuItem(a, j, context);
191
207
  }));
192
208
  }
@@ -29,6 +29,45 @@
29
29
  }
30
30
  }
31
31
 
32
+ .teamix-pro-dialog-footer-description {
33
+ position: absolute;
34
+ z-index: 5;
35
+ display: flex;
36
+ align-items: center;
37
+ bottom: var(--dialog-footer-padding-top, 16px);
38
+ height: var(--btn-size-m-height, 32px);
39
+
40
+ &.footer-align-right {
41
+ left: var(--dialog-footer-padding-left-right, 20px);
42
+ }
43
+ &.footer-align-center {
44
+ left: var(--dialog-footer-padding-left-right, 20px);
45
+ }
46
+ &.footer-align-left {
47
+ right: var(--dialog-footer-padding-left-right, 20px);
48
+ }
49
+ }
50
+
51
+ .teamix-pro-action-dialog.has-footer-description {
52
+ .next-message {
53
+ position: static;
54
+ }
55
+ }
56
+
57
+ .teamix-pro-dialog-before-content {
58
+ margin-bottom: var(--s-2);
59
+ }
60
+
61
+ .teamix-pro-dialog-after-content {
62
+ margin-top: var(--s-2);
63
+ }
64
+
32
65
  .next-menu-divider + .next-menu-divider {
33
66
  display: none;
34
67
  }
68
+
69
+ .next-dialog-body {
70
+ .teamix-pro-form {
71
+ margin-bottom: -20px;
72
+ }
73
+ }
@@ -5,21 +5,13 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
5
5
  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; }
6
6
 
7
7
  import { getTargetValue, goToLink } from '@teamix/utils';
8
+ import { useHistory } from 'react-router-dom';
8
9
  import { eventHandler } from './base';
9
10
  export function useLinkAction(action, context) {
10
- var _getTargetValue = getTargetValue(action, context),
11
- to = _getTargetValue.to,
12
- search = _getTargetValue.search,
13
- hash = _getTargetValue.hash,
14
- blank = _getTargetValue.blank;
15
-
11
+ var history = useHistory();
16
12
  return _objectSpread({}, eventHandler(action, function () {
17
- goToLink({
18
- to: to,
19
- search: search,
20
- hash: hash,
21
- blank: blank
22
- });
13
+ var linkAction = getTargetValue(action, context);
14
+ goToLink(linkAction, history);
23
15
  }));
24
16
  }
25
17
  export default useLinkAction;
@@ -2,7 +2,7 @@ import { CommonRequestConfig } from '@teamix/utils';
2
2
  import { BaseAction } from './base';
3
3
  export interface RequestAction extends CommonRequestConfig, BaseAction {
4
4
  }
5
- export declare function doRequest(action: RequestAction, context?: any, history?: any): Promise<unknown>;
5
+ export declare function doRequest(action: RequestAction, context?: any, history?: any, extraParams?: any): Promise<unknown>;
6
6
  export declare function useRequestAction(action: RequestAction, context?: any): {
7
7
  loading: boolean;
8
8
  };
@@ -28,14 +28,14 @@ import { useHistory } from 'react-router-dom';
28
28
  import { doCommonRequest } from '@teamix/utils';
29
29
  import { eventHandler } from './base'; // action 里的数据请求都默认是 post 类型
30
30
 
31
- export function doRequest(action, context, history) {
31
+ export function doRequest(action, context, history, extraParams) {
32
32
  var _action$method = action.method,
33
33
  method = _action$method === void 0 ? 'post' : _action$method,
34
34
  others = _objectWithoutProperties(action, _excluded);
35
35
 
36
36
  return doCommonRequest(_objectSpread({
37
37
  method: method
38
- }, others), context, history);
38
+ }, others), context, history, extraParams);
39
39
  }
40
40
  export function useRequestAction(action, context) {
41
41
  var _useState = useState(false),