@teamix/pro 1.2.7 → 1.2.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/pro.css +1 -1
- package/dist/pro.js +756 -368
- 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 -21
- package/es/actions/index.scss +14 -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 +21 -3
- package/es/card/index.js +29 -12
- package/es/card/index.scss +71 -2
- package/es/card/selectable.d.ts +13 -0
- package/es/card/selectable.js +45 -0
- package/es/card/tab.d.ts +6 -0
- package/es/card/tab.js +27 -0
- package/es/form/Filter/index.js +5 -5
- package/es/form/ProForm/index.js +3 -23
- package/es/form/ProForm/index.scss +9 -0
- package/es/form/SchemaForm/index.js +7 -6
- package/es/index.d.ts +1 -1
- package/es/index.js +7 -4
- package/es/info/components/tableInfo/index.js +10 -6
- package/es/nocode/configurators/Card.js +31 -8
- 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/sidebar-container/index.d.ts +5 -0
- package/es/sidebar/components/sidebar-container/index.js +77 -0
- package/es/sidebar/components/sidebar-container/index.scss +18 -0
- package/es/sidebar/components/tree/index.d.ts +4 -0
- package/es/sidebar/components/tree/index.js +162 -0
- package/es/sidebar/index.d.ts +5 -0
- package/es/sidebar/index.js +70 -0
- package/es/sidebar/index.scss +3 -0
- package/es/sidebar/typing.d.ts +64 -0
- package/es/sidebar/typing.js +1 -0
- package/es/table/components/Filter/index.js +3 -3
- package/es/table/index.js +12 -3
- package/es/table/index.scss +1 -0
- package/es/table/typing.d.ts +2 -0
- 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 -21
- package/lib/actions/index.scss +14 -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 +21 -3
- package/lib/card/index.js +35 -14
- package/lib/card/index.scss +71 -2
- package/lib/card/selectable.d.ts +13 -0
- package/lib/card/selectable.js +60 -0
- package/lib/card/tab.d.ts +6 -0
- package/lib/card/tab.js +39 -0
- package/lib/form/Filter/index.js +5 -6
- package/lib/form/ProForm/index.js +3 -23
- package/lib/form/ProForm/index.scss +9 -0
- package/lib/form/SchemaForm/index.js +7 -6
- package/lib/index.d.ts +1 -1
- package/lib/index.js +3 -1
- package/lib/info/components/tableInfo/index.js +10 -6
- package/lib/nocode/configurators/Card.js +31 -8
- 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/sidebar-container/index.d.ts +5 -0
- package/lib/sidebar/components/sidebar-container/index.js +93 -0
- package/lib/sidebar/components/sidebar-container/index.scss +18 -0
- package/lib/sidebar/components/tree/index.d.ts +4 -0
- package/lib/sidebar/components/tree/index.js +179 -0
- package/lib/sidebar/index.d.ts +5 -0
- package/lib/sidebar/index.js +91 -0
- package/lib/sidebar/index.scss +3 -0
- package/lib/sidebar/typing.d.ts +64 -0
- package/lib/sidebar/typing.js +5 -0
- package/lib/table/components/Filter/index.js +2 -2
- package/lib/table/index.js +12 -3
- package/lib/table/index.scss +1 -0
- package/lib/table/typing.d.ts +2 -0
- 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
@@ -0,0 +1,11 @@
|
|
1
|
+
import { TagProps, CloseableProps } from '@alicloudfe/components/types/tag';
|
2
|
+
import './index.scss';
|
3
|
+
export declare type ProTagItem = (TagProps | (CloseableProps & {
|
4
|
+
closable: true;
|
5
|
+
})) & {
|
6
|
+
/**
|
7
|
+
* @deprecated 建议使用 children 代替
|
8
|
+
*/
|
9
|
+
text?: string;
|
10
|
+
};
|
11
|
+
export declare const renderTags: (tags?: ProTagItem[] | undefined, size?: "small" | "large" | "medium" | undefined) => JSX.Element | null;
|
@@ -0,0 +1,50 @@
|
|
1
|
+
var _excluded = ["text", "children", "closable"];
|
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 { Tag } from '@alicloudfe/components';
|
15
|
+
import { baseClass } from '@teamix/utils';
|
16
|
+
import './index.scss';
|
17
|
+
var cls = baseClass('teamix-pro-tags');
|
18
|
+
export var renderTags = function renderTags(tags, size) {
|
19
|
+
if (!tags || !tags.length) {
|
20
|
+
return null;
|
21
|
+
}
|
22
|
+
|
23
|
+
return /*#__PURE__*/React.createElement(Tag.Group, {
|
24
|
+
className: cls('')
|
25
|
+
}, tags.map(function (tag, i) {
|
26
|
+
// @ts-ignore
|
27
|
+
var text = tag.text,
|
28
|
+
children = tag.children,
|
29
|
+
closable = tag.closable,
|
30
|
+
others = _objectWithoutProperties(tag, _excluded);
|
31
|
+
|
32
|
+
if (closable) {
|
33
|
+
return /*#__PURE__*/React.createElement(Tag.Closeable, _objectSpread({
|
34
|
+
key: i,
|
35
|
+
size: size,
|
36
|
+
style: {
|
37
|
+
marginBottom: 0
|
38
|
+
}
|
39
|
+
}, others), text || children);
|
40
|
+
}
|
41
|
+
|
42
|
+
return /*#__PURE__*/React.createElement(Tag, _objectSpread({
|
43
|
+
key: i,
|
44
|
+
size: size,
|
45
|
+
style: {
|
46
|
+
marginBottom: 0
|
47
|
+
}
|
48
|
+
}, others), text || children);
|
49
|
+
}));
|
50
|
+
};
|
package/lib/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/lib/actions/base.js
CHANGED
@@ -6,27 +6,82 @@ Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
exports.default = void 0;
|
7
7
|
exports.eventHandler = eventHandler;
|
8
8
|
|
9
|
+
var _utils = require("@teamix/utils");
|
10
|
+
|
9
11
|
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
10
12
|
|
11
|
-
function
|
13
|
+
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); } }
|
14
|
+
|
15
|
+
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); }); }; }
|
16
|
+
|
17
|
+
function eventHandler(action, actionContext, onTrigger) {
|
12
18
|
var _action$trigger = action.trigger,
|
13
19
|
trigger = _action$trigger === void 0 ? 'onClick' : _action$trigger,
|
14
20
|
preventDefault = action.preventDefault,
|
15
|
-
stopPropagation = action.stopPropagation
|
16
|
-
|
17
|
-
|
21
|
+
stopPropagation = action.stopPropagation,
|
22
|
+
beforeAction = action.beforeAction;
|
23
|
+
return _defineProperty({}, "".concat(trigger), function () {
|
24
|
+
var _2 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee(e) {
|
25
|
+
var _action$onTrigger;
|
18
26
|
|
19
|
-
|
20
|
-
|
21
|
-
|
27
|
+
var beforeActionContext;
|
28
|
+
return regeneratorRuntime.wrap(function _callee$(_context) {
|
29
|
+
while (1) {
|
30
|
+
switch (_context.prev = _context.next) {
|
31
|
+
case 0:
|
32
|
+
if (preventDefault) {
|
33
|
+
e.preventDefault();
|
34
|
+
}
|
35
|
+
|
36
|
+
if (stopPropagation) {
|
37
|
+
e.stopPropagation();
|
38
|
+
}
|
39
|
+
|
40
|
+
if (!beforeAction) {
|
41
|
+
_context.next = 14;
|
42
|
+
break;
|
43
|
+
}
|
44
|
+
|
45
|
+
_context.prev = 3;
|
46
|
+
_context.next = 6;
|
47
|
+
return (0, _utils.resolveMaybePromiseMethod)(beforeAction, actionContext);
|
48
|
+
|
49
|
+
case 6:
|
50
|
+
beforeActionContext = _context.sent;
|
51
|
+
_context.next = 12;
|
52
|
+
break;
|
53
|
+
|
54
|
+
case 9:
|
55
|
+
_context.prev = 9;
|
56
|
+
_context.t0 = _context["catch"](3);
|
57
|
+
beforeActionContext = false;
|
58
|
+
|
59
|
+
case 12:
|
60
|
+
if (!(beforeActionContext === false)) {
|
61
|
+
_context.next = 14;
|
62
|
+
break;
|
63
|
+
}
|
64
|
+
|
65
|
+
return _context.abrupt("return");
|
66
|
+
|
67
|
+
case 14:
|
68
|
+
onTrigger(Object.assign({}, beforeActionContext, actionContext));
|
69
|
+
(_action$onTrigger = action.onTrigger) === null || _action$onTrigger === void 0 ? void 0 : _action$onTrigger.call(action);
|
70
|
+
|
71
|
+
case 16:
|
72
|
+
case "end":
|
73
|
+
return _context.stop();
|
74
|
+
}
|
75
|
+
}
|
76
|
+
}, _callee, null, [[3, 9]]);
|
77
|
+
}));
|
22
78
|
|
23
|
-
|
24
|
-
|
79
|
+
function _(_x) {
|
80
|
+
return _2.apply(this, arguments);
|
25
81
|
}
|
26
82
|
|
27
|
-
|
28
|
-
|
29
|
-
});
|
83
|
+
return _;
|
84
|
+
}());
|
30
85
|
}
|
31
86
|
|
32
87
|
var _default = eventHandler;
|
package/lib/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;
|
@@ -159,18 +159,18 @@ function useDialogFormAction(action, context) {
|
|
159
159
|
_onFinish = action.onFinish,
|
160
160
|
others = _objectWithoutProperties(action, _excluded2);
|
161
161
|
|
162
|
-
var formRef = (0, _react.
|
162
|
+
var formRef = /*#__PURE__*/(0, _react.createRef)();
|
163
163
|
return (0, _dialog.default)(Object.assign({
|
164
164
|
size: size,
|
165
165
|
closeable: true,
|
166
|
-
content: function content() {
|
166
|
+
content: function content(contentContext) {
|
167
167
|
var dialogFormProps = {
|
168
168
|
initialValues: initialValues,
|
169
169
|
initialRequest: initialRequest,
|
170
170
|
schema: schema,
|
171
171
|
size: size,
|
172
172
|
formProps: formProps,
|
173
|
-
context:
|
173
|
+
context: contentContext
|
174
174
|
};
|
175
175
|
return /*#__PURE__*/_react.default.createElement(DialogForm, _objectSpread({
|
176
176
|
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/lib/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/lib/actions/dialog.js
CHANGED
@@ -29,8 +29,7 @@ var _request = require("./request");
|
|
29
29
|
var _utils2 = require("./utils");
|
30
30
|
|
31
31
|
var _excluded = ["url", "method", "params", "data", "extendParams", "successMsg", "errorMsg", "formatParams", "formatResult", "onSuccess", "onError"],
|
32
|
-
_excluded2 = ["title", "content", "component", "schema", "onFinish", "dialogType", "dialogQuickShowType", "messageType", "beforeRequest", "onTrigger", "link", "beforeContent", "afterContent", "message", "footerDescription", "footerAlign", "
|
33
|
-
_excluded3 = ["className"];
|
32
|
+
_excluded2 = ["title", "content", "component", "schema", "onFinish", "dialogType", "dialogQuickShowType", "messageType", "beforeRequest", "onTrigger", "link", "beforeContent", "afterContent", "message", "footerDescription", "footerAlign", "className"];
|
34
33
|
|
35
34
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
36
35
|
|
@@ -38,16 +37,16 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
|
|
38
37
|
|
39
38
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
40
39
|
|
41
|
-
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); } }
|
42
|
-
|
43
|
-
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); }); }; }
|
44
|
-
|
45
40
|
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; }
|
46
41
|
|
47
42
|
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; }
|
48
43
|
|
49
44
|
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; }
|
50
45
|
|
46
|
+
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); } }
|
47
|
+
|
48
|
+
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); }); }; }
|
49
|
+
|
51
50
|
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; }
|
52
51
|
|
53
52
|
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; }
|
@@ -94,7 +93,7 @@ function getFooterAlignClass(isDrawer, align) {
|
|
94
93
|
} // 弹窗 -> 请求(点击确认,发送数据请求)
|
95
94
|
|
96
95
|
|
97
|
-
function useDialogAction(action,
|
96
|
+
function useDialogAction(action, actionContext) {
|
98
97
|
var _useState = (0, _react.useState)(false),
|
99
98
|
_useState2 = _slicedToArray(_useState, 2),
|
100
99
|
loading = _useState2[0],
|
@@ -103,7 +102,7 @@ function useDialogAction(action, context) {
|
|
103
102
|
var footerDescriptionRef = (0, _react.useRef)();
|
104
103
|
var history = (0, _reactRouterDom.useHistory)();
|
105
104
|
|
106
|
-
var onActionStart = function onActionStart() {
|
105
|
+
var onActionStart = function onActionStart(context) {
|
107
106
|
var url = action.url,
|
108
107
|
method = action.method,
|
109
108
|
params = action.params,
|
@@ -135,28 +134,21 @@ function useDialogAction(action, context) {
|
|
135
134
|
message = _getTargetValue.message,
|
136
135
|
footerDescription = _getTargetValue.footerDescription,
|
137
136
|
footerAlign = _getTargetValue.footerAlign,
|
138
|
-
|
139
|
-
overlayProps = _getTargetValue$overl === void 0 ? {} : _getTargetValue$overl,
|
137
|
+
className = _getTargetValue.className,
|
140
138
|
containerProps = _objectWithoutProperties(_getTargetValue, _excluded2);
|
141
139
|
|
142
140
|
var isDrawer = dialogType === 'drawer';
|
143
141
|
var container = isDrawer ? _components.Drawer : _components.Dialog;
|
144
|
-
|
145
|
-
var overlayClassName = overlayProps.className,
|
146
|
-
overlayOtherProps = _objectWithoutProperties(overlayProps, _excluded3);
|
147
|
-
|
148
142
|
var dialogOnlyProps = {
|
149
143
|
type: dialogQuickShowType,
|
150
144
|
messageProps: {
|
151
145
|
type: messageType
|
152
|
-
}
|
153
|
-
overlayProps: _objectSpread({
|
154
|
-
className: (0, _classnames.default)('teamix-pro-action-dialog', overlayClassName, {
|
155
|
-
'has-footer-description': !!footerDescription
|
156
|
-
})
|
157
|
-
}, overlayOtherProps)
|
146
|
+
}
|
158
147
|
};
|
159
|
-
var containerOtherProps = isDrawer ? {
|
148
|
+
var containerOtherProps = isDrawer ? {
|
149
|
+
okText: (0, _utils.getMessage)('ok'),
|
150
|
+
cancelText: (0, _utils.getMessage)('cancel')
|
151
|
+
} : dialogOnlyProps;
|
160
152
|
|
161
153
|
var renderDialogFooterDescription = function renderDialogFooterDescription(footer) {
|
162
154
|
if (footer instanceof Array || footer.component) {
|
@@ -265,14 +257,17 @@ function useDialogAction(action, context) {
|
|
265
257
|
className: (0, _classnames.default)('teamix-pro-dialog-footer-description', getFooterAlignClass(isDrawer, footerAlign))
|
266
258
|
}, renderDialogFooterDescription(footerDescription))),
|
267
259
|
closeable: !loading,
|
268
|
-
footerAlign: footerAlign
|
260
|
+
footerAlign: footerAlign,
|
261
|
+
className: (0, _classnames.default)('teamix-pro-action-dialog', {
|
262
|
+
'has-footer-description': !!footerDescription
|
263
|
+
})
|
269
264
|
}, containerOtherProps), containerProps);
|
270
265
|
|
271
266
|
var ret = container.show(quickShowProps);
|
272
267
|
store.hide = ret.hide;
|
273
268
|
};
|
274
269
|
|
275
|
-
return _objectSpread({}, (0, _base.eventHandler)(action, onActionStart));
|
270
|
+
return _objectSpread({}, (0, _base.eventHandler)(action, actionContext, onActionStart));
|
276
271
|
}
|
277
272
|
|
278
273
|
var _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/lib/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/lib/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/lib/actions/index.js
CHANGED
@@ -206,13 +206,15 @@ var ProActionButton = function ProActionButton(props) {
|
|
206
206
|
|
207
207
|
exports.ProActionButton = ProActionButton;
|
208
208
|
|
209
|
-
function
|
210
|
-
var
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
209
|
+
var ProActionMenuButtonItem = function ProActionMenuButtonItem(props) {
|
210
|
+
var action = props.action,
|
211
|
+
context = props.context;
|
212
|
+
var config = action.config,
|
213
|
+
btnContext = action.context,
|
214
|
+
_onClick2 = action.onClick,
|
215
|
+
children = action.children,
|
216
|
+
icon = action.icon,
|
217
|
+
disabled = action.disabled;
|
216
218
|
var menuItemActionConfig = Object.assign({}, config, {
|
217
219
|
trigger: 'onClick'
|
218
220
|
});
|
@@ -221,30 +223,33 @@ function renderMenuButtonItem(item, key, context) {
|
|
221
223
|
loading = _useAction.loading,
|
222
224
|
menuItemProps = _objectWithoutProperties(_useAction, _excluded3);
|
223
225
|
|
224
|
-
var buttonProps = _onClick2 ? _objectSpread(_objectSpread({}, menuItemProps), {}, {
|
226
|
+
var buttonProps = disabled ? {} : _onClick2 ? _objectSpread(_objectSpread({}, menuItemProps), {}, {
|
225
227
|
onClick: function onClick(e) {
|
226
228
|
return _onClick2(e, context);
|
227
229
|
}
|
228
230
|
}) : _objectSpread({}, menuItemProps);
|
229
|
-
return /*#__PURE__*/_react.default.createElement(
|
230
|
-
|
231
|
-
|
231
|
+
return /*#__PURE__*/_react.default.createElement("div", _objectSpread({
|
232
|
+
className: (0, _classnames.default)('teamix-pro-action-menu-item', 'next-menu-item', {
|
233
|
+
'next-disabled': disabled
|
234
|
+
})
|
232
235
|
}, buttonProps), buttonContent(children, icon, undefined, context));
|
233
|
-
}
|
236
|
+
};
|
234
237
|
|
235
|
-
function renderCommonActionButtonMenuItem(action,
|
238
|
+
function renderCommonActionButtonMenuItem(action, context) {
|
236
239
|
var menuBtn = action;
|
237
240
|
|
238
241
|
if (menuBtn.actions && menuBtn.actions.length && menuBtn.disabled !== true) {
|
239
242
|
return /*#__PURE__*/_react.default.createElement(_components.Menu.SubMenu, {
|
240
|
-
key: key,
|
241
243
|
label: menuBtn.label || menuBtn.children
|
242
244
|
}, menuBtn.actions.map(function (a, j) {
|
243
|
-
return renderCommonActionButtonMenuItem(a,
|
245
|
+
return renderCommonActionButtonMenuItem(a, context);
|
244
246
|
}));
|
245
247
|
}
|
246
248
|
|
247
|
-
return
|
249
|
+
return /*#__PURE__*/_react.default.createElement(ProActionMenuButtonItem, {
|
250
|
+
action: action,
|
251
|
+
context: context
|
252
|
+
});
|
248
253
|
}
|
249
254
|
|
250
255
|
var ProActionMenuButton = function ProActionMenuButton(props) {
|
@@ -260,6 +265,7 @@ var ProActionMenuButton = function ProActionMenuButton(props) {
|
|
260
265
|
|
261
266
|
return /*#__PURE__*/_react.default.createElement(_components.MenuButton, _objectSpread({
|
262
267
|
popupTriggerType: "hover",
|
268
|
+
autoWidth: false,
|
263
269
|
menuProps: {
|
264
270
|
mode: 'popup',
|
265
271
|
triggerType: 'hover'
|
@@ -269,8 +275,8 @@ var ProActionMenuButton = function ProActionMenuButton(props) {
|
|
269
275
|
},
|
270
276
|
type: type,
|
271
277
|
label: buttonContent(label || children, icon, iconSize, context)
|
272
|
-
}, others), actions.map(function (action
|
273
|
-
return renderCommonActionButtonMenuItem(action,
|
278
|
+
}, others), actions.map(function (action) {
|
279
|
+
return renderCommonActionButtonMenuItem(action, context);
|
274
280
|
}));
|
275
281
|
}; // 如果 actions 数量超过了 max,则把第 max 个和剩余超出部分折叠起来成为一个 menu
|
276
282
|
|
@@ -377,9 +383,7 @@ function ProActionGroup(props) {
|
|
377
383
|
})
|
378
384
|
}, containerProps), formatedActions.map(function (actionBtn, i) {
|
379
385
|
var isLastOne = i === formatedActions.length - 1;
|
380
|
-
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, {
|
381
|
-
key: i
|
382
|
-
}, renderCommonActionButton(actionBtn, context, isTypeText), isTypeText && divider && !isLastOne && /*#__PURE__*/_react.default.createElement(_components.Divider, {
|
386
|
+
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, renderCommonActionButton(actionBtn, context, isTypeText), isTypeText && divider && !isLastOne && /*#__PURE__*/_react.default.createElement(_components.Divider, {
|
383
387
|
direction: "ver"
|
384
388
|
}));
|
385
389
|
}));
|
package/lib/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
|
}
|
package/lib/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/lib/actions/link.js
CHANGED
@@ -18,9 +18,9 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
|
|
18
18
|
|
19
19
|
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; }
|
20
20
|
|
21
|
-
function useLinkAction(action,
|
21
|
+
function useLinkAction(action, actionContext) {
|
22
22
|
var history = (0, _reactRouterDom.useHistory)();
|
23
|
-
return _objectSpread({}, (0, _base.eventHandler)(action, function () {
|
23
|
+
return _objectSpread({}, (0, _base.eventHandler)(action, actionContext, function (context) {
|
24
24
|
var linkAction = (0, _utils.getTargetValue)(action, context);
|
25
25
|
(0, _utils.goToLink)(linkAction, history);
|
26
26
|
}));
|
package/lib/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/lib/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;
|