@teamix/pro 1.2.8 → 1.2.12
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.
- package/dist/pro.css +1 -1
- package/dist/pro.js +1787 -812
- package/dist/pro.min.css +1 -1
- package/dist/pro.min.js +1 -1
- package/es/actions/base.d.ts +16 -6
- package/es/actions/base.js +66 -12
- package/es/actions/confirm.d.ts +1 -1
- package/es/actions/danger-confirm.d.ts +1 -1
- package/es/actions/dialog-component.d.ts +1 -1
- package/es/actions/dialog-form.d.ts +1 -1
- package/es/actions/dialog-form.js +4 -4
- package/es/actions/dialog-info.d.ts +1 -1
- package/es/actions/dialog-table.d.ts +1 -1
- package/es/actions/dialog.d.ts +6 -2
- package/es/actions/dialog.js +19 -24
- package/es/actions/drawer-form.d.ts +1 -1
- package/es/actions/drawer-info.d.ts +1 -1
- package/es/actions/drawer-table.d.ts +1 -1
- package/es/actions/drawer.d.ts +1 -1
- package/es/actions/error.d.ts +1 -1
- package/es/actions/index.js +25 -22
- package/es/actions/index.scss +28 -7
- package/es/actions/link.d.ts +2 -2
- package/es/actions/link.js +2 -2
- package/es/actions/notice.d.ts +1 -1
- package/es/actions/request.d.ts +1 -1
- package/es/actions/request.js +2 -2
- package/es/card/index.d.ts +10 -1
- package/es/card/index.js +20 -6
- package/es/card/index.scss +19 -0
- package/es/card/tab.d.ts +6 -0
- package/es/card/tab.js +27 -0
- package/es/form/Filter/index.d.ts +2 -5
- package/es/form/Filter/index.js +3 -44
- package/es/form/Filter/index.scss +71 -0
- package/es/form/Filter/index2.d.ts +8 -0
- package/es/form/Filter/index2.js +318 -0
- package/es/form/ProForm/index.js +3 -23
- package/es/form/ProForm/index.scss +10 -19
- package/es/form/ProForm/useFormDisplayValues.d.ts +3 -5
- package/es/form/ProForm/useFormDisplayValues.js +44 -38
- package/es/form/SchemaForm/index.js +7 -6
- package/es/form/index.d.ts +2 -1
- package/es/form/index.js +3 -2
- package/es/form/typing.d.ts +3 -0
- package/es/index.d.ts +1 -1
- package/es/index.js +1 -1
- package/es/page-header/index.d.ts +20 -11
- package/es/page-header/index.js +23 -47
- package/es/page-header/index.scss +0 -11
- package/es/sidebar/components/tree/index.js +85 -18
- package/es/sidebar/index.js +9 -5
- package/es/sidebar/typing.d.ts +14 -1
- package/es/table/components/Filter/index.js +11 -9
- package/es/table/components/Filter/index.scss +7 -3
- package/es/table/components/Layout/index.js +10 -1
- package/es/table/index.js +3 -4
- package/es/utils/components/tags/index.d.ts +11 -0
- package/es/utils/components/tags/index.js +50 -0
- package/es/utils/components/tags/index.scss +12 -0
- package/lib/actions/base.d.ts +16 -6
- package/lib/actions/base.js +67 -12
- package/lib/actions/confirm.d.ts +1 -1
- package/lib/actions/danger-confirm.d.ts +1 -1
- package/lib/actions/dialog-component.d.ts +1 -1
- package/lib/actions/dialog-form.d.ts +1 -1
- package/lib/actions/dialog-form.js +3 -3
- package/lib/actions/dialog-info.d.ts +1 -1
- package/lib/actions/dialog-table.d.ts +1 -1
- package/lib/actions/dialog.d.ts +6 -2
- package/lib/actions/dialog.js +18 -23
- package/lib/actions/drawer-form.d.ts +1 -1
- package/lib/actions/drawer-info.d.ts +1 -1
- package/lib/actions/drawer-table.d.ts +1 -1
- package/lib/actions/drawer.d.ts +1 -1
- package/lib/actions/error.d.ts +1 -1
- package/lib/actions/index.js +25 -22
- package/lib/actions/index.scss +28 -7
- package/lib/actions/link.d.ts +2 -2
- package/lib/actions/link.js +2 -2
- package/lib/actions/notice.d.ts +1 -1
- package/lib/actions/request.d.ts +1 -1
- package/lib/actions/request.js +2 -2
- package/lib/card/index.d.ts +10 -1
- package/lib/card/index.js +22 -5
- package/lib/card/index.scss +19 -0
- package/lib/card/tab.d.ts +6 -0
- package/lib/card/tab.js +39 -0
- package/lib/form/Filter/index.d.ts +2 -5
- package/lib/form/Filter/index.js +4 -45
- package/lib/form/Filter/index.scss +71 -0
- package/lib/form/Filter/index2.d.ts +8 -0
- package/lib/form/Filter/index2.js +342 -0
- package/lib/form/ProForm/index.js +3 -23
- package/lib/form/ProForm/index.scss +10 -19
- package/lib/form/ProForm/useFormDisplayValues.d.ts +3 -5
- package/lib/form/ProForm/useFormDisplayValues.js +51 -44
- package/lib/form/SchemaForm/index.js +7 -6
- package/lib/form/index.d.ts +2 -1
- package/lib/form/index.js +5 -3
- package/lib/form/typing.d.ts +3 -0
- package/lib/index.d.ts +1 -1
- package/lib/index.js +1 -1
- package/lib/page-header/index.d.ts +20 -11
- package/lib/page-header/index.js +22 -45
- package/lib/page-header/index.scss +0 -11
- package/lib/sidebar/components/tree/index.js +83 -16
- package/lib/sidebar/index.js +9 -5
- package/lib/sidebar/typing.d.ts +14 -1
- package/lib/table/components/Filter/index.js +10 -8
- package/lib/table/components/Filter/index.scss +7 -3
- package/lib/table/components/Layout/index.js +10 -1
- package/lib/table/index.js +2 -3
- package/lib/utils/components/tags/index.d.ts +11 -0
- package/lib/utils/components/tags/index.js +66 -0
- package/lib/utils/components/tags/index.scss +12 -0
- package/package.json +4 -4
package/es/actions/base.d.ts
CHANGED
@@ -1,13 +1,23 @@
|
|
1
|
+
import { MaybePromise } from '@teamix/utils';
|
1
2
|
export interface BaseAction {
|
3
|
+
/** 事件触发方式,默认是 onClick */
|
2
4
|
trigger?: string;
|
3
|
-
|
4
|
-
onFinish?: (prams?: any) => any;
|
5
|
+
/** 事件发生时,是否执行 e.preventDefault() 方法 */
|
5
6
|
preventDefault?: boolean;
|
7
|
+
/** 事件发生时,是否执行 e.stopPropagation() 方法 */
|
6
8
|
stopPropagation?: boolean;
|
7
|
-
|
8
|
-
|
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;
|
package/es/actions/base.js
CHANGED
@@ -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
|
-
|
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
|
-
|
9
|
-
|
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
|
-
|
12
|
-
|
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
|
-
|
16
|
-
|
70
|
+
function _(_x) {
|
71
|
+
return _2.apply(this, arguments);
|
17
72
|
}
|
18
73
|
|
19
|
-
|
20
|
-
|
21
|
-
});
|
74
|
+
return _;
|
75
|
+
}());
|
22
76
|
}
|
23
77
|
export default eventHandler;
|
package/es/actions/confirm.d.ts
CHANGED
@@ -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,
|
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 =
|
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:
|
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;
|
package/es/actions/dialog.d.ts
CHANGED
@@ -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,
|
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;
|
package/es/actions/dialog.js
CHANGED
@@ -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", "
|
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,
|
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
|
-
|
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 ? {
|
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;
|
package/es/actions/drawer.d.ts
CHANGED
@@ -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;
|
package/es/actions/error.d.ts
CHANGED
@@ -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;
|
package/es/actions/index.js
CHANGED
@@ -169,13 +169,15 @@ export var ProActionButton = function ProActionButton(props) {
|
|
169
169
|
}, buttonProps), buttonContent(children, icon, iconSize, context));
|
170
170
|
};
|
171
171
|
|
172
|
-
function
|
173
|
-
var
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
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(
|
193
|
-
|
194
|
-
|
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,
|
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,
|
208
|
+
return renderCommonActionButtonMenuItem(a, context);
|
207
209
|
}));
|
208
210
|
}
|
209
211
|
|
210
|
-
return
|
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) {
|
@@ -222,7 +227,7 @@ export var ProActionMenuButton = function ProActionMenuButton(props) {
|
|
222
227
|
others = _objectWithoutProperties(props, _excluded4);
|
223
228
|
|
224
229
|
return /*#__PURE__*/React.createElement(MenuButton, _objectSpread({
|
225
|
-
popupTriggerType: "
|
230
|
+
popupTriggerType: "hover",
|
226
231
|
autoWidth: false,
|
227
232
|
menuProps: {
|
228
233
|
mode: 'popup',
|
@@ -233,8 +238,8 @@ export var ProActionMenuButton = function ProActionMenuButton(props) {
|
|
233
238
|
},
|
234
239
|
type: type,
|
235
240
|
label: buttonContent(label || children, icon, iconSize, context)
|
236
|
-
}, others), actions.map(function (action
|
237
|
-
return renderCommonActionButtonMenuItem(action,
|
241
|
+
}, others), actions.map(function (action) {
|
242
|
+
return renderCommonActionButtonMenuItem(action, context);
|
238
243
|
}));
|
239
244
|
}; // 如果 actions 数量超过了 max,则把第 max 个和剩余超出部分折叠起来成为一个 menu
|
240
245
|
|
@@ -338,9 +343,7 @@ export function ProActionGroup(props) {
|
|
338
343
|
})
|
339
344
|
}, containerProps), formatedActions.map(function (actionBtn, i) {
|
340
345
|
var isLastOne = i === formatedActions.length - 1;
|
341
|
-
return /*#__PURE__*/React.createElement(React.Fragment, {
|
342
|
-
key: i
|
343
|
-
}, 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, {
|
344
347
|
direction: "ver"
|
345
348
|
}));
|
346
349
|
}));
|
package/es/actions/index.scss
CHANGED
@@ -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
|
-
|
71
|
+
& + .next-loading {
|
65
72
|
.teamix-pro-form {
|
66
73
|
margin-top: 20px;
|
67
74
|
}
|
@@ -89,3 +96,17 @@
|
|
89
96
|
margin-bottom: 0px;
|
90
97
|
}
|
91
98
|
}
|
99
|
+
|
100
|
+
.next-dialog-body {
|
101
|
+
.teamix-pro-info {
|
102
|
+
.next-card-content-container {
|
103
|
+
margin-top: 10px;
|
104
|
+
padding-bottom: 10px;
|
105
|
+
.next-col.next-col-24:last-child {
|
106
|
+
.teamix-pro-field-info-form-item:last-child {
|
107
|
+
padding-bottom: 0px;
|
108
|
+
}
|
109
|
+
}
|
110
|
+
}
|
111
|
+
}
|
112
|
+
}
|
package/es/actions/link.d.ts
CHANGED
@@ -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,
|
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;
|
package/es/actions/link.js
CHANGED
@@ -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,
|
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
|
}));
|
package/es/actions/notice.d.ts
CHANGED
@@ -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;
|
package/es/actions/request.d.ts
CHANGED
@@ -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,
|
6
|
+
export declare function useRequestAction(action: RequestAction, actionContext?: any): {
|
7
7
|
loading: boolean;
|
8
8
|
};
|
9
9
|
export default useRequestAction;
|
package/es/actions/request.js
CHANGED
@@ -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,
|
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);
|
package/es/card/index.d.ts
CHANGED
@@ -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
|
/** 额外信息区域,位于卡片右上角,可以配置一些常用轻量操作 */
|
@@ -35,6 +38,8 @@ export interface ProCardProps extends Omit<React.HTMLAttributes<HTMLElement>, 't
|
|
35
38
|
centered?: boolean;
|
36
39
|
/** 加载中状态 */
|
37
40
|
loading?: boolean;
|
41
|
+
/** 空状态 */
|
42
|
+
empty?: boolean;
|
38
43
|
/** 边框颜色 */
|
39
44
|
borderColor?: 'blue' | 'green' | 'red' | 'orange' | 'yellow' | 'grey' | 'transparent' | 'none';
|
40
45
|
/** 背景色 */
|
@@ -83,9 +88,13 @@ export declare const ProCard: {
|
|
83
88
|
(props: import("./selectable").ProCardSelectableProps): JSX.Element;
|
84
89
|
defaultProps: {
|
85
90
|
hoveredShadow: boolean;
|
86
|
-
};
|
91
|
+
}; /** 标签组 */
|
87
92
|
isProCard: boolean;
|
88
93
|
};
|
94
|
+
Tab: {
|
95
|
+
(props: import("@alifd/next/types/tab").TabProps): JSX.Element;
|
96
|
+
Item: typeof import("@alifd/next/types/tab").Item;
|
97
|
+
};
|
89
98
|
isProCard: boolean;
|
90
99
|
};
|
91
100
|
export default ProCard;
|