@teamix/pro 1.1.34 → 1.1.38
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/pro.css +1 -1
- package/dist/pro.js +1069 -334
- package/dist/pro.min.css +1 -1
- package/dist/pro.min.js +1 -1
- package/es/actions/dialog-form.d.ts +8 -1
- package/es/actions/dialog-form.js +32 -15
- package/es/actions/dialog-info.d.ts +9 -0
- package/es/actions/dialog-info.js +23 -0
- package/es/actions/dialog.d.ts +11 -0
- package/es/actions/dialog.js +105 -28
- package/es/actions/drawer-info.d.ts +6 -0
- package/es/actions/drawer-info.js +7 -0
- package/es/actions/index.d.ts +11 -5
- package/es/actions/index.js +28 -12
- package/es/actions/index.scss +39 -0
- package/es/actions/link.js +4 -12
- package/es/actions/request.d.ts +1 -1
- package/es/actions/request.js +2 -2
- package/es/form/Components/ProField/index.d.ts +1 -84
- package/es/form/SchemaForm/reactions.js +4 -2
- package/es/form/typing.d.ts +5 -5
- package/es/index.d.ts +1 -1
- package/es/index.js +1 -1
- package/es/info/components/{headerInfo → HeaderInfo}/index.d.ts +3 -1
- package/es/info/components/HeaderInfo/index.js +68 -0
- package/es/info/components/{headerInfo → HeaderInfo}/index.scss +0 -0
- package/es/info/components/InfoValueItem/index.js +111 -26
- package/es/info/components/{tableInfo → TableInfo}/index.d.ts +0 -0
- package/es/info/components/{tableInfo → TableInfo}/index.js +4 -21
- package/es/info/components/{tableInfo → TableInfo}/index.scss +0 -0
- package/es/info/components/baseInfo/index.d.ts +3 -1
- package/es/info/components/baseInfo/index.js +34 -42
- package/es/info/index.js +69 -26
- package/es/info/index.scss +0 -4
- package/es/info/typing.d.ts +17 -6
- package/es/page-header/index.d.ts +9 -5
- package/es/page-header/index.js +22 -7
- package/es/table/components/Filter/index.js +7 -2
- package/es/table/components/Filter/index.scss +1 -1
- package/es/table/typing.d.ts +2 -0
- package/lib/actions/dialog-form.d.ts +8 -1
- package/lib/actions/dialog-form.js +32 -15
- package/lib/actions/dialog-info.d.ts +9 -0
- package/lib/actions/dialog-info.js +37 -0
- package/lib/actions/dialog.d.ts +11 -0
- package/lib/actions/dialog.js +108 -27
- package/lib/actions/drawer-info.d.ts +6 -0
- package/lib/actions/drawer-info.js +18 -0
- package/lib/actions/index.d.ts +11 -5
- package/lib/actions/index.js +30 -12
- package/lib/actions/index.scss +39 -0
- package/lib/actions/link.js +5 -12
- package/lib/actions/request.d.ts +1 -1
- package/lib/actions/request.js +2 -2
- package/lib/form/Components/ProField/index.d.ts +1 -84
- package/lib/form/SchemaForm/reactions.js +4 -2
- package/lib/form/typing.d.ts +5 -5
- package/lib/index.d.ts +1 -1
- package/lib/index.js +1 -1
- package/lib/info/components/{headerInfo → HeaderInfo}/index.d.ts +3 -1
- package/lib/info/components/HeaderInfo/index.js +87 -0
- package/lib/info/components/{headerInfo → HeaderInfo}/index.scss +0 -0
- package/lib/info/components/InfoValueItem/index.js +110 -25
- package/lib/info/components/{tableInfo → TableInfo}/index.d.ts +0 -0
- package/lib/info/components/{tableInfo → TableInfo}/index.js +4 -22
- package/lib/info/components/{tableInfo → TableInfo}/index.scss +0 -0
- package/lib/info/components/baseInfo/index.d.ts +3 -1
- package/lib/info/components/baseInfo/index.js +33 -49
- package/lib/info/index.js +70 -25
- package/lib/info/index.scss +0 -4
- package/lib/info/typing.d.ts +17 -6
- package/lib/page-header/index.d.ts +9 -5
- package/lib/page-header/index.js +22 -7
- package/lib/table/components/Filter/index.js +7 -2
- package/lib/table/components/Filter/index.scss +1 -1
- package/lib/table/typing.d.ts +2 -0
- package/package.json +1 -1
- package/es/info/components/headerInfo/index.js +0 -99
- package/lib/info/components/headerInfo/index.js +0 -126
package/lib/actions/dialog.d.ts
CHANGED
@@ -1,12 +1,23 @@
|
|
1
1
|
import React from 'react';
|
2
2
|
import { QuickShowConfig } from '@alicloudfe/components/types/dialog';
|
3
3
|
import { quickShowDrawerProps } from '@alicloudfe/components/types/drawer';
|
4
|
+
import { IFormSchema, IFormSchemaItem } from '../form';
|
4
5
|
import { RequestAction } from './request';
|
5
6
|
export interface DialogAction extends Omit<RequestAction, 'url'>, Omit<QuickShowConfig, 'onError' | 'type'>, Omit<quickShowDrawerProps, 'trigger' | 'animation' | 'height' | 'locale' | 'onOk' | 'onCancel' | 'onError'> {
|
7
|
+
/** 点击「确认按钮」后的数据请求地址,非必填,不填就不发请求 */
|
6
8
|
url?: string;
|
9
|
+
/** 弹窗类型,支持普通弹窗和抽屉两种模式,默认为普通弹窗 */
|
7
10
|
dialogType?: 'dialog' | 'drawer';
|
11
|
+
/** 弹窗快捷调用类型 */
|
8
12
|
dialogQuickShowType?: 'alert' | 'confirm';
|
13
|
+
/** 弹窗消息类型 */
|
9
14
|
messageType?: 'success' | 'warning' | 'error' | 'notice' | 'help' | 'loading';
|
15
|
+
/** 位于弹窗内容上方的自定义内容区 */
|
16
|
+
beforeContent?: React.ReactNode;
|
17
|
+
/** 位于弹窗内容下方的自定义内容区 */
|
18
|
+
afterContent?: React.ReactNode;
|
19
|
+
/** 弹窗页脚描述区,位于按钮组的对面 */
|
20
|
+
footerDescription?: React.ReactNode | IFormSchema | IFormSchemaItem;
|
10
21
|
}
|
11
22
|
export declare function useDialogAction(action: DialogAction, context?: any): {
|
12
23
|
[x: string]: (e: React.MouseEvent<HTMLElement, MouseEvent>) => void;
|
package/lib/actions/dialog.js
CHANGED
@@ -10,18 +10,25 @@ exports.useDialogAction = useDialogAction;
|
|
10
10
|
|
11
11
|
var _react = _interopRequireWildcard(require("react"));
|
12
12
|
|
13
|
+
var _classnames = _interopRequireDefault(require("classnames"));
|
14
|
+
|
13
15
|
var _reactRouterDom = require("react-router-dom");
|
14
16
|
|
15
17
|
var _components = require("@alicloudfe/components");
|
16
18
|
|
17
19
|
var _utils = require("@teamix/utils");
|
18
20
|
|
21
|
+
var _form = _interopRequireWildcard(require("../form"));
|
22
|
+
|
19
23
|
var _base = require("./base");
|
20
24
|
|
21
25
|
var _request = require("./request");
|
22
26
|
|
23
27
|
var _excluded = ["url", "method", "params", "data", "extendParams", "successMsg", "errorMsg", "formatParams", "formatResult", "onSuccess", "onError"],
|
24
|
-
_excluded2 = ["title", "content", "component", "schema", "onFinish", "dialogType", "dialogQuickShowType", "messageType", "beforeRequest", "onTrigger", "link"]
|
28
|
+
_excluded2 = ["title", "content", "component", "schema", "onFinish", "dialogType", "dialogQuickShowType", "messageType", "beforeRequest", "onTrigger", "link", "beforeContent", "afterContent", "footerDescription", "footerAlign", "overlayProps"],
|
29
|
+
_excluded3 = ["className"];
|
30
|
+
|
31
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
25
32
|
|
26
33
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
27
34
|
|
@@ -31,16 +38,16 @@ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try
|
|
31
38
|
|
32
39
|
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); }); }; }
|
33
40
|
|
34
|
-
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; }
|
35
|
-
|
36
|
-
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; }
|
37
|
-
|
38
41
|
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; }
|
39
42
|
|
40
43
|
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; }
|
41
44
|
|
42
45
|
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; }
|
43
46
|
|
47
|
+
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; }
|
48
|
+
|
49
|
+
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; }
|
50
|
+
|
44
51
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
45
52
|
|
46
53
|
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
@@ -59,6 +66,27 @@ function addContextForReactNode(content, context) {
|
|
59
66
|
}
|
60
67
|
|
61
68
|
return content;
|
69
|
+
}
|
70
|
+
|
71
|
+
var FooterForm = function FooterForm(props) {
|
72
|
+
var schema = props.schema,
|
73
|
+
context = props.context,
|
74
|
+
formRef = props.formRef;
|
75
|
+
var form = (0, _form.createForm)();
|
76
|
+
(0, _react.useEffect)(function () {
|
77
|
+
formRef.current = form;
|
78
|
+
}, []);
|
79
|
+
return /*#__PURE__*/_react.default.createElement(_form.default, {
|
80
|
+
layout: "inline",
|
81
|
+
feedbackLayout: "none",
|
82
|
+
form: form,
|
83
|
+
schema: (0, _utils.getTargetValue)(schema, context)
|
84
|
+
});
|
85
|
+
};
|
86
|
+
|
87
|
+
function getFooterAlignClass(isDrawer, align) {
|
88
|
+
var footerAlign = align ? align : isDrawer ? 'left' : 'right';
|
89
|
+
return "footer-align-".concat(footerAlign);
|
62
90
|
} // 弹窗 -> 请求(点击确认,发送数据请求)
|
63
91
|
|
64
92
|
|
@@ -68,8 +96,10 @@ function useDialogAction(action, context) {
|
|
68
96
|
loading = _useState2[0],
|
69
97
|
setLoading = _useState2[1];
|
70
98
|
|
99
|
+
var footerDescriptionRef = (0, _react.useRef)();
|
71
100
|
var history = (0, _reactRouterDom.useHistory)();
|
72
|
-
|
101
|
+
|
102
|
+
var onActionStart = function onActionStart() {
|
73
103
|
var url = action.url,
|
74
104
|
method = action.method,
|
75
105
|
params = action.params,
|
@@ -96,19 +126,56 @@ function useDialogAction(action, context) {
|
|
96
126
|
beforeRequest = _getTargetValue.beforeRequest,
|
97
127
|
onTrigger = _getTargetValue.onTrigger,
|
98
128
|
link = _getTargetValue.link,
|
99
|
-
|
129
|
+
beforeContent = _getTargetValue.beforeContent,
|
130
|
+
afterContent = _getTargetValue.afterContent,
|
131
|
+
footerDescription = _getTargetValue.footerDescription,
|
132
|
+
footerAlign = _getTargetValue.footerAlign,
|
133
|
+
_getTargetValue$overl = _getTargetValue.overlayProps,
|
134
|
+
overlayProps = _getTargetValue$overl === void 0 ? {} : _getTargetValue$overl,
|
135
|
+
containerProps = _objectWithoutProperties(_getTargetValue, _excluded2);
|
136
|
+
|
137
|
+
var isDrawer = dialogType === 'drawer';
|
138
|
+
var container = isDrawer ? _components.Drawer : _components.Dialog;
|
139
|
+
|
140
|
+
var overlayClassName = overlayProps.className,
|
141
|
+
overlayOtherProps = _objectWithoutProperties(overlayProps, _excluded3);
|
100
142
|
|
101
|
-
var
|
102
|
-
var dialogProps = dialogType === 'drawer' ? {} : {
|
143
|
+
var dialogOnlyProps = {
|
103
144
|
type: dialogQuickShowType,
|
104
145
|
messageProps: {
|
105
146
|
type: messageType
|
147
|
+
},
|
148
|
+
overlayProps: _objectSpread({
|
149
|
+
className: (0, _classnames.default)('teamix-pro-action-dialog', overlayClassName, {
|
150
|
+
'has-footer-description': !!footerDescription
|
151
|
+
})
|
152
|
+
}, overlayOtherProps)
|
153
|
+
};
|
154
|
+
var containerOtherProps = isDrawer ? {} : dialogOnlyProps;
|
155
|
+
|
156
|
+
var renderDialogFooterDescription = function renderDialogFooterDescription(footer) {
|
157
|
+
if (footer instanceof Array || footer.component) {
|
158
|
+
var _schema = footer instanceof Array ? footer : [footer];
|
159
|
+
|
160
|
+
return /*#__PURE__*/_react.default.createElement(FooterForm, {
|
161
|
+
formRef: footerDescriptionRef,
|
162
|
+
context: context,
|
163
|
+
schema: [{
|
164
|
+
component: 'FormFlex',
|
165
|
+
children: _schema
|
166
|
+
}]
|
167
|
+
});
|
106
168
|
}
|
169
|
+
|
170
|
+
return footer;
|
107
171
|
};
|
108
172
|
|
109
173
|
var onOk = function onOk() {
|
110
174
|
return new Promise( /*#__PURE__*/function () {
|
111
175
|
var _ref = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee(resolve) {
|
176
|
+
var _footerDescriptionRef;
|
177
|
+
|
178
|
+
var footerDescriptionValues, requestContext;
|
112
179
|
return regeneratorRuntime.wrap(function _callee$(_context) {
|
113
180
|
while (1) {
|
114
181
|
switch (_context.prev = _context.next) {
|
@@ -128,29 +195,33 @@ function useDialogAction(action, context) {
|
|
128
195
|
|
129
196
|
case 5:
|
130
197
|
setLoading(true);
|
131
|
-
|
132
|
-
_context.
|
133
|
-
|
134
|
-
|
135
|
-
|
198
|
+
footerDescriptionValues = Object.assign({}, footerDescriptionRef === null || footerDescriptionRef === void 0 ? void 0 : (_footerDescriptionRef = footerDescriptionRef.current) === null || _footerDescriptionRef === void 0 ? void 0 : _footerDescriptionRef.values);
|
199
|
+
_context.prev = 7;
|
200
|
+
requestContext = Object.assign({
|
201
|
+
footer: footerDescriptionValues
|
202
|
+
}, context);
|
203
|
+
_context.next = 11;
|
204
|
+
return (0, _request.doRequest)(action, requestContext, history, footerDescriptionValues);
|
205
|
+
|
206
|
+
case 11:
|
136
207
|
onFinish && onFinish();
|
137
208
|
resolve(true);
|
138
|
-
_context.next =
|
209
|
+
_context.next = 20;
|
139
210
|
break;
|
140
211
|
|
141
|
-
case
|
142
|
-
_context.prev =
|
143
|
-
_context.t0 = _context["catch"](
|
212
|
+
case 15:
|
213
|
+
_context.prev = 15;
|
214
|
+
_context.t0 = _context["catch"](7);
|
144
215
|
setLoading(false);
|
145
216
|
resolve(false);
|
146
217
|
return _context.abrupt("return");
|
147
218
|
|
148
|
-
case
|
219
|
+
case 20:
|
149
220
|
case "end":
|
150
221
|
return _context.stop();
|
151
222
|
}
|
152
223
|
}
|
153
|
-
}, _callee, null, [[
|
224
|
+
}, _callee, null, [[7, 15]]);
|
154
225
|
}));
|
155
226
|
|
156
227
|
return function (_x) {
|
@@ -171,17 +242,27 @@ function useDialogAction(action, context) {
|
|
171
242
|
var dialogContext = Object.assign({}, context, {
|
172
243
|
hide: hide
|
173
244
|
});
|
174
|
-
var
|
245
|
+
var dialogContent = Component ? /*#__PURE__*/_react.default.createElement(Component, _objectSpread({
|
246
|
+
key: (0, _utils.uuid)()
|
247
|
+
}, componentProps)) : addContextForReactNode(content, dialogContext);
|
248
|
+
var ret = container.show(_objectSpread(_objectSpread({
|
175
249
|
// @ts-ignore
|
176
250
|
onOk: onOk,
|
177
251
|
title: addContextForReactNode(title, dialogContext),
|
178
|
-
content:
|
179
|
-
|
180
|
-
},
|
181
|
-
|
182
|
-
|
252
|
+
content: /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, beforeContent && /*#__PURE__*/_react.default.createElement("div", {
|
253
|
+
className: "teamix-pro-dialog-before-content"
|
254
|
+
}, beforeContent), dialogContent, afterContent && /*#__PURE__*/_react.default.createElement("div", {
|
255
|
+
className: "teamix-pro-dialog-after-content"
|
256
|
+
}, afterContent), footerDescription && /*#__PURE__*/_react.default.createElement("div", {
|
257
|
+
className: (0, _classnames.default)('teamix-pro-dialog-footer-description', getFooterAlignClass(isDrawer, footerAlign))
|
258
|
+
}, renderDialogFooterDescription(footerDescription))),
|
259
|
+
closeable: !loading,
|
260
|
+
footerAlign: footerAlign
|
261
|
+
}, containerOtherProps), containerProps));
|
183
262
|
store.hide = ret.hide;
|
184
|
-
}
|
263
|
+
};
|
264
|
+
|
265
|
+
return _objectSpread({}, (0, _base.eventHandler)(action, onActionStart));
|
185
266
|
}
|
186
267
|
|
187
268
|
var _default = useDialogAction;
|
@@ -0,0 +1,6 @@
|
|
1
|
+
import { DialogInfoAction } from './dialog-info';
|
2
|
+
export declare type DrawerInfoAction = DialogInfoAction;
|
3
|
+
export declare function useDrawerInfoAction(action: DrawerInfoAction, context?: any): {
|
4
|
+
[x: string]: (e: import("react").MouseEvent<HTMLElement, MouseEvent>) => void;
|
5
|
+
};
|
6
|
+
export default useDrawerInfoAction;
|
@@ -0,0 +1,18 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.default = void 0;
|
7
|
+
exports.useDrawerInfoAction = useDrawerInfoAction;
|
8
|
+
|
9
|
+
var _dialogInfo = require("./dialog-info");
|
10
|
+
|
11
|
+
function useDrawerInfoAction(action, context) {
|
12
|
+
return (0, _dialogInfo.useDialogInfoAction)(Object.assign({
|
13
|
+
dialogType: 'drawer'
|
14
|
+
}, action), context);
|
15
|
+
}
|
16
|
+
|
17
|
+
var _default = useDrawerInfoAction;
|
18
|
+
exports.default = _default;
|
package/lib/actions/index.d.ts
CHANGED
@@ -10,17 +10,17 @@ import { NoticeAction } from './notice';
|
|
10
10
|
import { ErrorAction } from './error';
|
11
11
|
import { DialogFormAction } from './dialog-form';
|
12
12
|
import { DialogTableAction } from './dialog-table';
|
13
|
+
import { DialogInfoAction } from './dialog-info';
|
13
14
|
import { DrawerAction } from './drawer';
|
14
15
|
import { DrawerFormAction } from './drawer-form';
|
15
16
|
import { DrawerTableAction } from './drawer-table';
|
17
|
+
import { DrawerInfoAction } from './drawer-info';
|
16
18
|
import './index.scss';
|
17
19
|
export declare type ActionConfig = ({
|
18
20
|
type: 'link';
|
19
21
|
} & LinkAction) | ({
|
20
22
|
type: 'request';
|
21
23
|
} & RequestAction) | ({
|
22
|
-
type: 'dialog';
|
23
|
-
} & DialogAction) | ({
|
24
24
|
type: 'confirm';
|
25
25
|
} & ConfirmAction) | ({
|
26
26
|
type: 'danger-confirm';
|
@@ -29,16 +29,22 @@ export declare type ActionConfig = ({
|
|
29
29
|
} & NoticeAction) | ({
|
30
30
|
type: 'error';
|
31
31
|
} & ErrorAction) | ({
|
32
|
+
type: 'dialog';
|
33
|
+
} & DialogAction) | ({
|
32
34
|
type: 'dialog-form';
|
33
35
|
} & DialogFormAction) | ({
|
36
|
+
type: 'dialog-table';
|
37
|
+
} & DialogTableAction) | ({
|
38
|
+
type: 'dialog-info';
|
39
|
+
} & DialogInfoAction) | ({
|
34
40
|
type: 'drawer';
|
35
41
|
} & DrawerAction) | ({
|
36
42
|
type: 'drawer-form';
|
37
43
|
} & DrawerFormAction) | ({
|
38
|
-
type: 'dialog-table';
|
39
|
-
} & DialogTableAction) | ({
|
40
44
|
type: 'drawer-table';
|
41
|
-
} & DrawerTableAction)
|
45
|
+
} & DrawerTableAction) | ({
|
46
|
+
type: 'drawer-info';
|
47
|
+
} & DrawerInfoAction);
|
42
48
|
export declare function registerActionHandler(id: string, extendActionId: string, defaultConfig: any): void;
|
43
49
|
export declare const useAction: any;
|
44
50
|
export interface IActionButton extends ButtonProps {
|
package/lib/actions/index.js
CHANGED
@@ -37,12 +37,16 @@ var _dialogForm = require("./dialog-form");
|
|
37
37
|
|
38
38
|
var _dialogTable = require("./dialog-table");
|
39
39
|
|
40
|
+
var _dialogInfo = require("./dialog-info");
|
41
|
+
|
40
42
|
var _drawer = require("./drawer");
|
41
43
|
|
42
44
|
var _drawerForm = require("./drawer-form");
|
43
45
|
|
44
46
|
var _drawerTable = require("./drawer-table");
|
45
47
|
|
48
|
+
var _drawerInfo = require("./drawer-info");
|
49
|
+
|
46
50
|
require("./index.scss");
|
47
51
|
|
48
52
|
var _excluded = ["type"],
|
@@ -131,6 +135,10 @@ var useAction = function useAction(config, context) {
|
|
131
135
|
return (0, _dialogTable.useDialogTableAction)(others, context);
|
132
136
|
}
|
133
137
|
|
138
|
+
if (type === 'dialog-info') {
|
139
|
+
return (0, _dialogInfo.useDialogInfoAction)(others, context);
|
140
|
+
}
|
141
|
+
|
134
142
|
if (type === 'drawer') {
|
135
143
|
return (0, _drawer.useDrawerAction)(others, context);
|
136
144
|
}
|
@@ -143,6 +151,10 @@ var useAction = function useAction(config, context) {
|
|
143
151
|
return (0, _drawerTable.useDrawerTableAction)(others, context);
|
144
152
|
}
|
145
153
|
|
154
|
+
if (type === 'drawer-info') {
|
155
|
+
return (0, _drawerInfo.useDrawerInfoAction)(others, context);
|
156
|
+
}
|
157
|
+
|
146
158
|
var registedAction = RegistedActions.get(type);
|
147
159
|
|
148
160
|
if (!registedAction) {
|
@@ -197,33 +209,39 @@ var ActionButton = function ActionButton(props) {
|
|
197
209
|
exports.ActionButton = ActionButton;
|
198
210
|
|
199
211
|
function renderMenuButtonItem(item, key, context) {
|
200
|
-
var
|
212
|
+
var config = item.config,
|
213
|
+
btnContext = item.context,
|
214
|
+
_onClick2 = item.onClick,
|
215
|
+
children = item.children,
|
216
|
+
icon = item.icon,
|
217
|
+
disabled = item.disabled;
|
218
|
+
var menuItemActionConfig = Object.assign({}, config, {
|
201
219
|
trigger: 'onClick'
|
202
220
|
});
|
203
221
|
|
204
|
-
var _useAction = useAction(menuItemActionConfig,
|
222
|
+
var _useAction = useAction(menuItemActionConfig, btnContext || context),
|
205
223
|
loading = _useAction.loading,
|
206
224
|
menuItemProps = _objectWithoutProperties(_useAction, _excluded3);
|
207
225
|
|
208
|
-
var buttonProps =
|
226
|
+
var buttonProps = _onClick2 ? _objectSpread(_objectSpread({}, menuItemProps), {}, {
|
209
227
|
onClick: function onClick(e) {
|
210
|
-
return
|
228
|
+
return _onClick2(e, context);
|
211
229
|
}
|
212
230
|
}) : _objectSpread({}, menuItemProps);
|
213
231
|
return /*#__PURE__*/_react.default.createElement(_components.MenuButton.Item, _objectSpread({
|
214
|
-
key: key
|
215
|
-
|
232
|
+
key: key,
|
233
|
+
disabled: disabled
|
234
|
+
}, buttonProps), buttonContent(children, icon, undefined, context));
|
216
235
|
}
|
217
236
|
|
218
237
|
function renderCommonActionButtonMenuItem(action, key, context) {
|
219
|
-
|
220
|
-
|
238
|
+
var menuBtn = action;
|
239
|
+
|
240
|
+
if (menuBtn.actions && menuBtn.actions.length && menuBtn.disabled !== true) {
|
221
241
|
return /*#__PURE__*/_react.default.createElement(_components.Menu.SubMenu, {
|
222
242
|
key: key,
|
223
|
-
label:
|
224
|
-
|
225
|
-
}, //@ts-ignore
|
226
|
-
action.actions.map(function (a, j) {
|
243
|
+
label: menuBtn.label || menuBtn.children
|
244
|
+
}, menuBtn.actions.map(function (a, j) {
|
227
245
|
return renderCommonActionButtonMenuItem(a, j, context);
|
228
246
|
}));
|
229
247
|
}
|
package/lib/actions/index.scss
CHANGED
@@ -29,6 +29,45 @@
|
|
29
29
|
}
|
30
30
|
}
|
31
31
|
|
32
|
+
.teamix-pro-dialog-footer-description {
|
33
|
+
position: absolute;
|
34
|
+
z-index: 5;
|
35
|
+
display: flex;
|
36
|
+
align-items: center;
|
37
|
+
bottom: var(--dialog-footer-padding-top, 16px);
|
38
|
+
height: var(--btn-size-m-height, 32px);
|
39
|
+
|
40
|
+
&.footer-align-right {
|
41
|
+
left: var(--dialog-footer-padding-left-right, 20px);
|
42
|
+
}
|
43
|
+
&.footer-align-center {
|
44
|
+
left: var(--dialog-footer-padding-left-right, 20px);
|
45
|
+
}
|
46
|
+
&.footer-align-left {
|
47
|
+
right: var(--dialog-footer-padding-left-right, 20px);
|
48
|
+
}
|
49
|
+
}
|
50
|
+
|
51
|
+
.teamix-pro-action-dialog.has-footer-description {
|
52
|
+
.next-message {
|
53
|
+
position: static;
|
54
|
+
}
|
55
|
+
}
|
56
|
+
|
57
|
+
.teamix-pro-dialog-before-content {
|
58
|
+
margin-bottom: var(--s-2);
|
59
|
+
}
|
60
|
+
|
61
|
+
.teamix-pro-dialog-after-content {
|
62
|
+
margin-top: var(--s-2);
|
63
|
+
}
|
64
|
+
|
32
65
|
.next-menu-divider + .next-menu-divider {
|
33
66
|
display: none;
|
34
67
|
}
|
68
|
+
|
69
|
+
.next-dialog-body {
|
70
|
+
.teamix-pro-form {
|
71
|
+
margin-bottom: -20px;
|
72
|
+
}
|
73
|
+
}
|
package/lib/actions/link.js
CHANGED
@@ -8,6 +8,8 @@ exports.useLinkAction = useLinkAction;
|
|
8
8
|
|
9
9
|
var _utils = require("@teamix/utils");
|
10
10
|
|
11
|
+
var _reactRouterDom = require("react-router-dom");
|
12
|
+
|
11
13
|
var _base = require("./base");
|
12
14
|
|
13
15
|
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; }
|
@@ -17,19 +19,10 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
|
|
17
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; }
|
18
20
|
|
19
21
|
function useLinkAction(action, context) {
|
20
|
-
var
|
21
|
-
to = _getTargetValue.to,
|
22
|
-
search = _getTargetValue.search,
|
23
|
-
hash = _getTargetValue.hash,
|
24
|
-
blank = _getTargetValue.blank;
|
25
|
-
|
22
|
+
var history = (0, _reactRouterDom.useHistory)();
|
26
23
|
return _objectSpread({}, (0, _base.eventHandler)(action, function () {
|
27
|
-
(0, _utils.
|
28
|
-
|
29
|
-
search: search,
|
30
|
-
hash: hash,
|
31
|
-
blank: blank
|
32
|
-
});
|
24
|
+
var linkAction = (0, _utils.getTargetValue)(action, context);
|
25
|
+
(0, _utils.goToLink)(linkAction, history);
|
33
26
|
}));
|
34
27
|
}
|
35
28
|
|
package/lib/actions/request.d.ts
CHANGED
@@ -2,7 +2,7 @@ import { CommonRequestConfig } from '@teamix/utils';
|
|
2
2
|
import { BaseAction } from './base';
|
3
3
|
export interface RequestAction extends CommonRequestConfig, BaseAction {
|
4
4
|
}
|
5
|
-
export declare function doRequest(action: RequestAction, context?: any, history?: any): Promise<unknown>;
|
5
|
+
export declare function doRequest(action: RequestAction, context?: any, history?: any, extraParams?: any): Promise<unknown>;
|
6
6
|
export declare function useRequestAction(action: RequestAction, context?: any): {
|
7
7
|
loading: boolean;
|
8
8
|
};
|
package/lib/actions/request.js
CHANGED
@@ -41,14 +41,14 @@ function _objectWithoutProperties(source, excluded) { if (source == null) return
|
|
41
41
|
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; }
|
42
42
|
|
43
43
|
// action 里的数据请求都默认是 post 类型
|
44
|
-
function doRequest(action, context, history) {
|
44
|
+
function doRequest(action, context, history, extraParams) {
|
45
45
|
var _action$method = action.method,
|
46
46
|
method = _action$method === void 0 ? 'post' : _action$method,
|
47
47
|
others = _objectWithoutProperties(action, _excluded);
|
48
48
|
|
49
49
|
return (0, _utils.doCommonRequest)(_objectSpread({
|
50
50
|
method: method
|
51
|
-
}, others), context, history);
|
51
|
+
}, others), context, history, extraParams);
|
52
52
|
}
|
53
53
|
|
54
54
|
function useRequestAction(action, context) {
|