@teamix/pro 1.2.10 → 1.2.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/212.js +1 -1
- package/dist/pro.css +1 -1
- package/dist/pro.js +454 -366
- 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 +3 -3
- 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/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/ProForm/index.js +3 -23
- package/es/form/SchemaForm/index.js +7 -6
- 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/table/components/Filter/index.js +3 -3
- package/es/table/index.js +1 -1
- 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 +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 +3 -3
- 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/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/ProForm/index.js +3 -23
- package/lib/form/SchemaForm/index.js +7 -6
- 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/table/components/Filter/index.js +2 -2
- package/lib/table/index.js +1 -1
- 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 +1 -1
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
@@ -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,
|
@@ -242,6 +242,6 @@ export function useDialogAction(action, context) {
|
|
242
242
|
store.hide = ret.hide;
|
243
243
|
};
|
244
244
|
|
245
|
-
return _objectSpread({}, eventHandler(action, onActionStart));
|
245
|
+
return _objectSpread({}, eventHandler(action, actionContext, onActionStart));
|
246
246
|
}
|
247
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/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 {
|
package/es/card/tab.d.ts
ADDED
package/es/card/tab.js
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
var _excluded = ["className"];
|
2
|
+
|
3
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
4
|
+
|
5
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
6
|
+
|
7
|
+
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
8
|
+
|
9
|
+
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
10
|
+
|
11
|
+
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
12
|
+
|
13
|
+
import React from 'react';
|
14
|
+
import classnames from 'classnames';
|
15
|
+
import { Tab } from '@alicloudfe/components';
|
16
|
+
|
17
|
+
var ProCardTab = function ProCardTab(props) {
|
18
|
+
var className = props.className,
|
19
|
+
others = _objectWithoutProperties(props, _excluded);
|
20
|
+
|
21
|
+
return /*#__PURE__*/React.createElement(Tab, _objectSpread({
|
22
|
+
className: classnames('teamix-pro-card-tab', className)
|
23
|
+
}, others));
|
24
|
+
};
|
25
|
+
|
26
|
+
ProCardTab.Item = Tab.Item;
|
27
|
+
export default ProCardTab;
|
package/es/form/ProForm/index.js
CHANGED
@@ -57,7 +57,8 @@ var ProForm = /*#__PURE__*/memo(function (_ref) {
|
|
57
57
|
context: context
|
58
58
|
});
|
59
59
|
}, [scope, context]);
|
60
|
-
var onAutoSubmit = useAutoSubmit(onSubmit);
|
60
|
+
var onAutoSubmit = useAutoSubmit(onSubmit); // todo 需要formily支持断点下的属性更新
|
61
|
+
|
61
62
|
var getTeamixLayout = useMemo(function () {
|
62
63
|
return breakpoints ? {
|
63
64
|
breakpoints: breakpoints,
|
@@ -109,28 +110,7 @@ var ProForm = /*#__PURE__*/memo(function (_ref) {
|
|
109
110
|
schema: schema,
|
110
111
|
scope: mergedScope,
|
111
112
|
components: components
|
112
|
-
}), children);
|
113
|
-
// <FormLayout
|
114
|
-
// className={cls(prefixCls, className)}
|
115
|
-
// {...otherProps}
|
116
|
-
// {...getTeamixLayout}
|
117
|
-
// >
|
118
|
-
// <SchemaForm schema={schema} scope={scope} components={components} />
|
119
|
-
// {children}
|
120
|
-
// </FormLayout>
|
121
|
-
// ) : (
|
122
|
-
// <Form
|
123
|
-
// className={cls(prefixCls, className)}
|
124
|
-
// {...otherProps}
|
125
|
-
// {...getTeamixLayout}
|
126
|
-
// form={form}
|
127
|
-
// onAutoSubmit={onAutoSubmit}
|
128
|
-
// onAutoSubmitFailed={onSubmitFailed}
|
129
|
-
// >
|
130
|
-
// <SchemaForm schema={schema} scope={scope} components={components} />
|
131
|
-
// {children}
|
132
|
-
// </Form>
|
133
|
-
// );
|
113
|
+
}), children);
|
134
114
|
});
|
135
115
|
ProForm.defaultProps = {
|
136
116
|
colon: false,
|
@@ -62,6 +62,7 @@ export default /*#__PURE__*/memo(function (_ref) {
|
|
62
62
|
var schema = _ref.schema,
|
63
63
|
scope = _ref.scope,
|
64
64
|
components = _ref.components;
|
65
|
+
// 创建 SchemaField
|
65
66
|
var SchemaField = useMemo(function () {
|
66
67
|
return createSchemaField({
|
67
68
|
components: _objectSpread(_objectSpread({}, ProFieldComponents), {}, {
|
@@ -92,15 +93,15 @@ export default /*#__PURE__*/memo(function (_ref) {
|
|
92
93
|
Text: Text
|
93
94
|
})
|
94
95
|
});
|
95
|
-
}, []); // 合并schema中request的scope
|
96
|
+
}, []); // 合并 schema 中 request 的 scope
|
96
97
|
|
97
98
|
var mergedScope = useMemo(function () {
|
98
99
|
return _objectSpread({}, scope);
|
99
|
-
}, [scope]); // 格式化schema
|
100
|
+
}, [scope]); // 格式化 schema
|
100
101
|
|
101
102
|
var formatSchema = useCallback(function (schema) {
|
102
103
|
var schemaProperties = {};
|
103
|
-
schema.forEach(function (item) {
|
104
|
+
schema === null || schema === void 0 ? void 0 : schema.forEach(function (item) {
|
104
105
|
var newItem = warning(item);
|
105
106
|
var _newItem = newItem,
|
106
107
|
originalComponent = _newItem.component; // 根据component的不同,初始化为内置的item
|
@@ -236,15 +237,15 @@ export default /*#__PURE__*/memo(function (_ref) {
|
|
236
237
|
});
|
237
238
|
return schemaProperties;
|
238
239
|
}, [mergedScope]);
|
239
|
-
var
|
240
|
+
var proFormSchema = useMemo(function () {
|
240
241
|
return {
|
241
242
|
type: 'object',
|
242
243
|
properties: formatSchema(schema)
|
243
244
|
};
|
244
|
-
}, []); // console.log(
|
245
|
+
}, []); // console.log(proFormSchema);
|
245
246
|
|
246
247
|
return /*#__PURE__*/React.createElement(SchemaField, {
|
247
|
-
schema:
|
248
|
+
schema: proFormSchema,
|
248
249
|
components: components,
|
249
250
|
scope: mergedScope
|
250
251
|
});
|
package/es/index.d.ts
CHANGED
@@ -21,5 +21,5 @@ export * from './page-container';
|
|
21
21
|
export * from './page-header';
|
22
22
|
export * from './skeleton';
|
23
23
|
export * from './table';
|
24
|
-
declare const version = "1.2.
|
24
|
+
declare const version = "1.2.10";
|
25
25
|
export { version, ProAction, ProCard, ProField, ProForm, ProInfo, ProPageContainer, ProPageHeader, ProSkeleton, ProTable, hooks, nocode, templates, utils, };
|
package/es/index.js
CHANGED
@@ -27,7 +27,7 @@ export * from './page-header';
|
|
27
27
|
export * from './skeleton';
|
28
28
|
export * from './table'; // export * from './sidebar';
|
29
29
|
|
30
|
-
var version = '1.2.
|
30
|
+
var version = '1.2.10';
|
31
31
|
export { version, ProAction, ProCard, ProField, ProForm, ProInfo, // ProLayout,
|
32
32
|
ProPageContainer, ProPageHeader, ProSkeleton, ProTable, // ProSidebar,
|
33
33
|
hooks, nocode, templates, utils };
|