@teamix/pro 1.2.9 → 1.2.13
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/212.js +1 -1
- package/dist/pro.css +1 -1
- package/dist/pro.js +2103 -993
- 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 +2 -2
- 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 +9 -5
- 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 +9 -5
- 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 -5
- 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 +11 -10
- 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/info/components/ProInfoItem/index.js +3 -1
- package/es/nocode/pages/renderer.d.ts +2 -2
- 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/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 +21 -11
- package/es/table/typing.d.ts +6 -0
- package/es/table/utils/columnRender.js +38 -1
- package/es/table/utils/index.js +15 -1
- package/es/utils/components/tags/index.d.ts +15 -0
- package/es/utils/components/tags/index.js +94 -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 +2 -2
- 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 +9 -5
- 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 +9 -5
- 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 -4
- 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 +11 -10
- 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/info/components/ProInfoItem/index.js +3 -1
- package/lib/nocode/pages/renderer.d.ts +2 -2
- 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/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 +20 -10
- package/lib/table/typing.d.ts +6 -0
- package/lib/table/utils/columnRender.js +38 -1
- package/lib/table/utils/index.js +15 -1
- package/lib/utils/components/tags/index.d.ts +15 -0
- package/lib/utils/components/tags/index.js +114 -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;
|
@@ -140,14 +140,14 @@ export function useDialogFormAction(action, context) {
|
|
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,5 +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"];
|
2
|
+
_excluded2 = ["title", "content", "component", "schema", "onFinish", "dialogType", "dialogQuickShowType", "messageType", "beforeRequest", "onTrigger", "link", "beforeContent", "afterContent", "message", "footerDescription", "footerAlign", "className"];
|
3
3
|
|
4
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; }
|
5
5
|
|
@@ -68,7 +68,7 @@ function getFooterAlignClass(isDrawer, align) {
|
|
68
68
|
} // 弹窗 -> 请求(点击确认,发送数据请求)
|
69
69
|
|
70
70
|
|
71
|
-
export function useDialogAction(action,
|
71
|
+
export function useDialogAction(action, actionContext) {
|
72
72
|
var _useState = useState(false),
|
73
73
|
_useState2 = _slicedToArray(_useState, 2),
|
74
74
|
loading = _useState2[0],
|
@@ -77,7 +77,7 @@ export function useDialogAction(action, context) {
|
|
77
77
|
var footerDescriptionRef = useRef();
|
78
78
|
var history = useHistory();
|
79
79
|
|
80
|
-
var onActionStart = function onActionStart() {
|
80
|
+
var onActionStart = function onActionStart(context) {
|
81
81
|
var url = action.url,
|
82
82
|
method = action.method,
|
83
83
|
params = action.params,
|
@@ -109,6 +109,7 @@ export function useDialogAction(action, context) {
|
|
109
109
|
message = _getTargetValue.message,
|
110
110
|
footerDescription = _getTargetValue.footerDescription,
|
111
111
|
footerAlign = _getTargetValue.footerAlign,
|
112
|
+
className = _getTargetValue.className,
|
112
113
|
containerProps = _objectWithoutProperties(_getTargetValue, _excluded2);
|
113
114
|
|
114
115
|
var isDrawer = dialogType === 'drawer';
|
@@ -231,13 +232,16 @@ export function useDialogAction(action, context) {
|
|
231
232
|
className: classnames('teamix-pro-dialog-footer-description', getFooterAlignClass(isDrawer, footerAlign))
|
232
233
|
}, renderDialogFooterDescription(footerDescription))),
|
233
234
|
closeable: !loading,
|
234
|
-
footerAlign: footerAlign
|
235
|
+
footerAlign: footerAlign,
|
236
|
+
className: classnames('teamix-pro-action-dialog', {
|
237
|
+
'has-footer-description': !!footerDescription
|
238
|
+
})
|
235
239
|
}, containerOtherProps), containerProps);
|
236
240
|
|
237
241
|
var ret = container.show(quickShowProps);
|
238
242
|
store.hide = ret.hide;
|
239
243
|
};
|
240
244
|
|
241
|
-
return _objectSpread({}, eventHandler(action, onActionStart));
|
245
|
+
return _objectSpread({}, eventHandler(action, actionContext, onActionStart));
|
242
246
|
}
|
243
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
@@ -198,18 +198,20 @@ var ProActionMenuButtonItem = function ProActionMenuButtonItem(props) {
|
|
198
198
|
}, buttonProps), buttonContent(children, icon, undefined, context));
|
199
199
|
};
|
200
200
|
|
201
|
-
function renderCommonActionButtonMenuItem(action, context) {
|
201
|
+
function renderCommonActionButtonMenuItem(action, key, context) {
|
202
202
|
var menuBtn = action;
|
203
203
|
|
204
204
|
if (menuBtn.actions && menuBtn.actions.length && menuBtn.disabled !== true) {
|
205
205
|
return /*#__PURE__*/React.createElement(Menu.SubMenu, {
|
206
|
+
key: key,
|
206
207
|
label: menuBtn.label || menuBtn.children
|
207
208
|
}, menuBtn.actions.map(function (a, j) {
|
208
|
-
return renderCommonActionButtonMenuItem(a, context);
|
209
|
+
return renderCommonActionButtonMenuItem(a, String(j), context);
|
209
210
|
}));
|
210
211
|
}
|
211
212
|
|
212
213
|
return /*#__PURE__*/React.createElement(ProActionMenuButtonItem, {
|
214
|
+
key: key,
|
213
215
|
action: action,
|
214
216
|
context: context
|
215
217
|
});
|
@@ -238,8 +240,8 @@ export var ProActionMenuButton = function ProActionMenuButton(props) {
|
|
238
240
|
},
|
239
241
|
type: type,
|
240
242
|
label: buttonContent(label || children, icon, iconSize, context)
|
241
|
-
}, others), actions.map(function (action) {
|
242
|
-
return renderCommonActionButtonMenuItem(action, context);
|
243
|
+
}, others), actions.map(function (action, i) {
|
244
|
+
return renderCommonActionButtonMenuItem(action, String(i), context);
|
243
245
|
}));
|
244
246
|
}; // 如果 actions 数量超过了 max,则把第 max 个和剩余超出部分折叠起来成为一个 menu
|
245
247
|
|
@@ -343,7 +345,9 @@ export function ProActionGroup(props) {
|
|
343
345
|
})
|
344
346
|
}, containerProps), formatedActions.map(function (actionBtn, i) {
|
345
347
|
var isLastOne = i === formatedActions.length - 1;
|
346
|
-
return /*#__PURE__*/React.createElement(React.Fragment,
|
348
|
+
return /*#__PURE__*/React.createElement(React.Fragment, {
|
349
|
+
key: i
|
350
|
+
}, renderCommonActionButton(actionBtn, context, isTypeText), isTypeText && divider && !isLastOne && /*#__PURE__*/React.createElement(Divider, {
|
347
351
|
direction: "ver"
|
348
352
|
}));
|
349
353
|
}));
|
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;
|
package/es/card/index.js
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
var _excluded = ["context"],
|
2
|
-
_excluded2 = ["children", "title", "subTitle", "tooltip", "tooltipIcon", "description", "extra", "actions", "style", "className", "image", "hoveredShadow", "divider", "bordered", "compacted", "centered", "loading", "borderColor", "backgroundColor", "contentClassName", "contentStyle", "direction", "wrap", "spacing", "split", "collapsible", "defaultCollapsed", "collapsed", "onCollapse", "context"];
|
2
|
+
_excluded2 = ["children", "title", "subTitle", "tooltip", "tooltipIcon", "tags", "description", "extra", "actions", "style", "className", "image", "hoveredShadow", "divider", "bordered", "compacted", "centered", "loading", "empty", "borderColor", "backgroundColor", "contentClassName", "contentStyle", "direction", "wrap", "spacing", "split", "collapsible", "defaultCollapsed", "collapsed", "onCollapse", "context"];
|
3
3
|
|
4
4
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
5
5
|
|
@@ -25,14 +25,17 @@ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) r
|
|
25
25
|
|
26
26
|
import React from 'react';
|
27
27
|
import classnames from 'classnames';
|
28
|
+
import Result from '@teamix/result';
|
28
29
|
import { Card as BasicCard, Balloon } from '@alicloudfe/components';
|
29
30
|
import TeamixIcon from '@teamix/icon';
|
30
|
-
import { baseClass } from '@teamix/utils';
|
31
|
+
import { baseClass, getMessage } from '@teamix/utils';
|
32
|
+
import { renderTags } from '../utils/components/tags';
|
31
33
|
import { ProSkeletonRaw } from '../skeleton';
|
32
34
|
import { ProActionGroup } from '../actions';
|
33
35
|
import { formatSpacing, getColClassAndStyle } from './utils';
|
34
36
|
import ProCardDivider from './divider';
|
35
37
|
import ProCardSelectable from './selectable';
|
38
|
+
import ProCardTab from './tab';
|
36
39
|
import './index.scss';
|
37
40
|
export * from './card-container';
|
38
41
|
var cls = baseClass('teamix-pro-card');
|
@@ -74,6 +77,7 @@ export var ProCard = function ProCard(props) {
|
|
74
77
|
subTitle = props.subTitle,
|
75
78
|
tooltip = props.tooltip,
|
76
79
|
tooltipIcon = props.tooltipIcon,
|
80
|
+
tags = props.tags,
|
77
81
|
description = props.description,
|
78
82
|
extra = props.extra,
|
79
83
|
actions = props.actions,
|
@@ -86,6 +90,7 @@ export var ProCard = function ProCard(props) {
|
|
86
90
|
compacted = props.compacted,
|
87
91
|
centered = props.centered,
|
88
92
|
loading = props.loading,
|
93
|
+
empty = props.empty,
|
89
94
|
borderColor = props.borderColor,
|
90
95
|
backgroundColor = props.backgroundColor,
|
91
96
|
contentClassName = props.contentClassName,
|
@@ -176,7 +181,7 @@ export var ProCard = function ProCard(props) {
|
|
176
181
|
}, _defineProperty(_classnames, "border-".concat(borderColor), borderColor), _defineProperty(_classnames, "compacted", compacted), _defineProperty(_classnames, "hoverable", hoveredShadow), _classnames));
|
177
182
|
var cardContentClassName = classnames(cls('content'), contentClassName, getFlexDirectionClassName(direction, split), (_classnames2 = {
|
178
183
|
'contain-pro-card': containProCard
|
179
|
-
}, _defineProperty(_classnames2, "split-".concat(split), split), _defineProperty(_classnames2, 'flex-wrap', wrap), _defineProperty(_classnames2, "centered", centered), _classnames2));
|
184
|
+
}, _defineProperty(_classnames2, "split-".concat(split), split), _defineProperty(_classnames2, 'flex-wrap', wrap), _defineProperty(_classnames2, "centered", centered || empty), _classnames2));
|
180
185
|
var cardContentMargin = containProCard && !split ? {
|
181
186
|
marginRight: -horizonal,
|
182
187
|
marginLeft: -horizonal,
|
@@ -211,7 +216,7 @@ export var ProCard = function ProCard(props) {
|
|
211
216
|
}, /*#__PURE__*/React.createElement(Balloon.Tooltip, {
|
212
217
|
align: "t",
|
213
218
|
trigger: tooltipTrigger
|
214
|
-
}, tooltip)), description && /*#__PURE__*/React.createElement("div", {
|
219
|
+
}, tooltip)), tags && renderTags(tags, 'small'), description && /*#__PURE__*/React.createElement("div", {
|
215
220
|
className: cls('title-description')
|
216
221
|
}, description));
|
217
222
|
};
|
@@ -236,7 +241,16 @@ export var ProCard = function ProCard(props) {
|
|
236
241
|
}, loading && /*#__PURE__*/React.createElement(ProSkeletonRaw.Card.Content, null), !loading && /*#__PURE__*/React.createElement("div", {
|
237
242
|
className: cardContentClassName,
|
238
243
|
style: cardContentStyle
|
239
|
-
},
|
244
|
+
}, empty && /*#__PURE__*/React.createElement("div", {
|
245
|
+
className: cls('empty')
|
246
|
+
}, childrenModified ? childrenModified : /*#__PURE__*/React.createElement(Result, {
|
247
|
+
theme: "hybridcloud-container",
|
248
|
+
img: "noData",
|
249
|
+
title: getMessage('noData'),
|
250
|
+
style: {
|
251
|
+
padding: '50px 0 60px'
|
252
|
+
}
|
253
|
+
})), !empty && childrenModified)));
|
240
254
|
};
|
241
255
|
ProCard.defaultProps = {
|
242
256
|
bordered: true,
|
@@ -245,5 +259,6 @@ ProCard.defaultProps = {
|
|
245
259
|
};
|
246
260
|
ProCard.Divider = ProCardDivider;
|
247
261
|
ProCard.Selectable = ProCardSelectable;
|
262
|
+
ProCard.Tab = ProCardTab;
|
248
263
|
ProCard.isProCard = true;
|
249
264
|
export default ProCard;
|
package/es/card/index.scss
CHANGED
@@ -153,6 +153,25 @@
|
|
153
153
|
}
|
154
154
|
}
|
155
155
|
|
156
|
+
&-tab {
|
157
|
+
margin-top: calc(0px - var(--s-2));
|
158
|
+
|
159
|
+
& > .next-tabs-bar {
|
160
|
+
border-bottom: none;
|
161
|
+
}
|
162
|
+
|
163
|
+
& > .next-tabs-content {
|
164
|
+
padding-top: var(--s-5, 20px);
|
165
|
+
}
|
166
|
+
}
|
167
|
+
|
168
|
+
&-empty {
|
169
|
+
display: flex;
|
170
|
+
flex-direction: column;
|
171
|
+
align-items: center;
|
172
|
+
color: var(--color-text1-8, #848484);
|
173
|
+
}
|
174
|
+
|
156
175
|
& > .next-card-actions {
|
157
176
|
& > .teamix-pro-actions {
|
158
177
|
& > .next-btn {
|