@teamix/pro 1.1.36 → 1.1.40
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/README.md +14 -10
- package/dist/pro.css +1 -1
- package/dist/pro.js +2555 -3791
- package/dist/pro.min.css +1 -1
- package/dist/pro.min.js +1 -1
- package/es/actions/dialog-form.d.ts +5 -5
- package/es/actions/dialog-form.js +1 -5
- package/es/actions/dialog.d.ts +12 -0
- package/es/actions/dialog.js +104 -27
- package/es/actions/index.d.ts +54 -47
- package/es/actions/index.js +28 -22
- package/es/actions/index.scss +48 -2
- package/es/actions/link.js +4 -2
- package/es/actions/request.d.ts +1 -1
- package/es/actions/request.js +2 -2
- package/es/card/index.d.ts +17 -5
- package/es/card/index.js +16 -11
- package/es/form/Components/ProField/index.d.ts +1 -161
- package/es/form/Components/ProField/index.js +34 -40
- package/es/form/Filter/index.js +2 -2
- package/es/form/ProForm/index.d.ts +2 -2
- package/es/form/ProForm/index.js +1 -6
- package/es/form/ProForm/index.scss +19 -1
- package/es/form/ProForm/useFieldRequest.d.ts +5 -0
- package/es/form/ProForm/useFieldRequest.js +26 -0
- package/es/form/SchemaForm/adapterDecorator.js +2 -2
- package/es/form/SchemaForm/index.d.ts +2 -2
- package/es/form/SchemaForm/index.js +12 -21
- package/es/form/SchemaForm/initializeArrayCards.d.ts +2 -2
- package/es/form/SchemaForm/initializeArrayCollapse.d.ts +2 -2
- package/es/form/SchemaForm/initializeArrayItems.d.ts +2 -2
- package/es/form/SchemaForm/initializeArrayTable.d.ts +2 -2
- package/es/form/SchemaForm/initializeDataSource.d.ts +2 -2
- package/es/form/SchemaForm/initializeDataSource.js +2 -2
- package/es/form/SchemaForm/initializeFormButton.d.ts +2 -2
- package/es/form/SchemaForm/initializeFormCollapse.d.ts +2 -2
- package/es/form/SchemaForm/initializeFormGroup.d.ts +2 -2
- package/es/form/SchemaForm/initializeFormStep.d.ts +3 -3
- package/es/form/SchemaForm/initializeFormTab.d.ts +2 -2
- package/es/form/SchemaForm/initializeRequest.d.ts +2 -2
- package/es/form/SchemaForm/initializeRequest.js +2 -2
- package/es/form/SchemaForm/initializeRules.js +44 -16
- package/es/form/SchemaForm/reactions.d.ts +5 -5
- package/es/form/SchemaForm/reactions.js +20 -18
- package/es/form/fieldTypeMap.d.ts +4 -0
- package/es/form/fieldTypeMap.js +41 -0
- package/es/form/index.d.ts +92 -4
- package/es/form/index.js +18 -5
- package/es/form/schemaNameMap.js +3 -0
- package/es/form/typing.d.ts +49 -26
- package/es/form/utils.d.ts +3 -1
- package/es/form/utils.js +38 -1
- package/es/form/warning.d.ts +2 -2
- package/es/index.d.ts +1 -1
- package/es/index.js +1 -1
- package/es/info/components/InfoGroup/index.js +73 -15
- package/es/info/components/InfoGroup/index.scss +45 -3
- package/es/info/components/InfoValueItem/index.js +9 -4
- package/es/info/components/InfoValueItem/index.scss +5 -1
- package/es/info/components/ProInfoItem/index.js +3 -3
- package/es/info/components/ProInfoItem/index.scss +1 -0
- package/es/info/components/baseInfo/index.d.ts +2 -3
- package/es/info/components/baseInfo/index.js +29 -10
- package/es/info/components/headerInfo/index.d.ts +2 -3
- package/es/info/components/tableInfo/index.d.ts +2 -3
- package/es/info/components/tableInfo/index.js +2 -2
- package/es/info/index.js +75 -51
- package/es/info/typing.d.ts +54 -36
- package/es/info/utils/index.d.ts +2 -2
- package/es/info/utils/utils.d.ts +1 -1
- package/es/nocode/pages/renderer.js +2 -2
- package/es/page-header/index.d.ts +42 -25
- package/es/page-header/index.js +56 -32
- package/es/page-header/index.scss +2 -1
- package/es/table/components/EmptyContent/index.d.ts +2 -0
- package/es/table/components/EmptyContent/index.js +11 -0
- package/es/table/components/Filter/index.d.ts +2 -2
- package/es/table/components/Filter/index.js +23 -10
- package/es/table/components/Filter/index.scss +1 -1
- package/es/table/components/Layout/index.js +2 -2
- package/es/table/components/QuickAction/index.d.ts +2 -2
- package/es/table/components/QuickAction/index.js +3 -3
- package/es/table/components/ToolBar/Fullscreen.js +1 -0
- package/es/table/index.js +76 -14
- package/es/table/index.scss +4 -0
- package/es/table/typing.d.ts +29 -14
- package/es/table/utils/columnRender.d.ts +3 -3
- package/es/table/utils/columnRender.js +2 -2
- package/es/table/utils/genProColumnToColumn.d.ts +2 -2
- package/es/table/utils/genProColumnToColumn.js +1 -1
- package/es/table/utils/index.js +33 -11
- package/es/templates/List/index.d.ts +2 -2
- package/es/utils/message.d.ts +3 -0
- package/es/utils/message.js +19 -0
- package/lib/actions/dialog-form.d.ts +5 -5
- package/lib/actions/dialog-form.js +1 -5
- package/lib/actions/dialog.d.ts +12 -0
- package/lib/actions/dialog.js +108 -26
- package/lib/actions/index.d.ts +54 -47
- package/lib/actions/index.js +37 -30
- package/lib/actions/index.scss +48 -2
- package/lib/actions/link.js +5 -2
- package/lib/actions/request.d.ts +1 -1
- package/lib/actions/request.js +2 -2
- package/lib/card/index.d.ts +17 -5
- package/lib/card/index.js +18 -12
- package/lib/form/Components/ProField/index.d.ts +1 -161
- package/lib/form/Components/ProField/index.js +32 -38
- package/lib/form/Filter/index.js +2 -2
- package/lib/form/ProForm/index.d.ts +2 -2
- package/lib/form/ProForm/index.js +1 -7
- package/lib/form/ProForm/index.scss +19 -1
- package/lib/form/ProForm/useFieldRequest.d.ts +5 -0
- package/lib/form/ProForm/useFieldRequest.js +37 -0
- package/lib/form/SchemaForm/adapterDecorator.js +4 -2
- package/lib/form/SchemaForm/index.d.ts +2 -2
- package/lib/form/SchemaForm/index.js +11 -22
- package/lib/form/SchemaForm/initializeArrayCards.d.ts +2 -2
- package/lib/form/SchemaForm/initializeArrayCollapse.d.ts +2 -2
- package/lib/form/SchemaForm/initializeArrayItems.d.ts +2 -2
- package/lib/form/SchemaForm/initializeArrayTable.d.ts +2 -2
- package/lib/form/SchemaForm/initializeDataSource.d.ts +2 -2
- package/lib/form/SchemaForm/initializeDataSource.js +2 -2
- package/lib/form/SchemaForm/initializeFormButton.d.ts +2 -2
- package/lib/form/SchemaForm/initializeFormCollapse.d.ts +2 -2
- package/lib/form/SchemaForm/initializeFormGroup.d.ts +2 -2
- package/lib/form/SchemaForm/initializeFormStep.d.ts +3 -3
- package/lib/form/SchemaForm/initializeFormTab.d.ts +2 -2
- package/lib/form/SchemaForm/initializeRequest.d.ts +2 -2
- package/lib/form/SchemaForm/initializeRequest.js +1 -1
- package/lib/form/SchemaForm/initializeRules.js +41 -13
- package/lib/form/SchemaForm/reactions.d.ts +5 -5
- package/lib/form/SchemaForm/reactions.js +22 -20
- package/lib/form/fieldTypeMap.d.ts +4 -0
- package/lib/form/fieldTypeMap.js +48 -0
- package/lib/form/index.d.ts +92 -4
- package/lib/form/index.js +17 -31
- package/lib/form/schemaNameMap.js +3 -0
- package/lib/form/typing.d.ts +49 -26
- package/lib/form/utils.d.ts +3 -1
- package/lib/form/utils.js +43 -1
- package/lib/form/warning.d.ts +2 -2
- package/lib/index.d.ts +1 -1
- package/lib/index.js +1 -1
- package/lib/info/components/InfoGroup/index.js +76 -14
- package/lib/info/components/InfoGroup/index.scss +45 -3
- package/lib/info/components/InfoValueItem/index.js +8 -3
- package/lib/info/components/InfoValueItem/index.scss +5 -1
- package/lib/info/components/ProInfoItem/index.js +2 -2
- package/lib/info/components/ProInfoItem/index.scss +1 -0
- package/lib/info/components/baseInfo/index.d.ts +2 -3
- package/lib/info/components/baseInfo/index.js +29 -10
- package/lib/info/components/headerInfo/index.d.ts +2 -3
- package/lib/info/components/tableInfo/index.d.ts +2 -3
- package/lib/info/components/tableInfo/index.js +1 -1
- package/lib/info/index.js +73 -49
- package/lib/info/typing.d.ts +54 -36
- package/lib/info/utils/index.d.ts +2 -2
- package/lib/info/utils/utils.d.ts +1 -1
- package/lib/nocode/pages/renderer.js +1 -1
- package/lib/page-header/index.d.ts +42 -25
- package/lib/page-header/index.js +54 -30
- package/lib/page-header/index.scss +2 -1
- package/lib/table/components/EmptyContent/index.d.ts +2 -0
- package/lib/table/components/EmptyContent/index.js +25 -0
- package/lib/table/components/Filter/index.d.ts +2 -2
- package/lib/table/components/Filter/index.js +23 -10
- package/lib/table/components/Filter/index.scss +1 -1
- package/lib/table/components/Layout/index.js +1 -1
- package/lib/table/components/QuickAction/index.d.ts +2 -2
- package/lib/table/components/QuickAction/index.js +1 -1
- package/lib/table/components/ToolBar/Fullscreen.js +1 -0
- package/lib/table/index.js +77 -14
- package/lib/table/index.scss +4 -0
- package/lib/table/typing.d.ts +29 -14
- package/lib/table/utils/columnRender.d.ts +3 -3
- package/lib/table/utils/columnRender.js +1 -1
- package/lib/table/utils/genProColumnToColumn.d.ts +2 -2
- package/lib/table/utils/genProColumnToColumn.js +2 -2
- package/lib/table/utils/index.js +33 -11
- package/lib/templates/List/index.d.ts +2 -2
- package/lib/utils/message.d.ts +3 -0
- package/lib/utils/message.js +32 -0
- package/package.json +4 -4
- package/es/form/Components/Search/index.d.ts +0 -11
- package/es/form/Components/Search/index.js +0 -89
- package/es/form/SchemaForm/initializeArrayIcon.d.ts +0 -3
- package/es/form/SchemaForm/initializeArrayIcon.js +0 -62
- package/es/form/SchemaForm/initializeProField.d.ts +0 -5
- package/es/form/SchemaForm/initializeProField.js +0 -70
- package/es/info/utils/useInfoRequest.d.ts +0 -14
- package/es/info/utils/useInfoRequest.js +0 -76
- package/lib/form/Components/Search/index.d.ts +0 -11
- package/lib/form/Components/Search/index.js +0 -103
- package/lib/form/SchemaForm/initializeArrayIcon.d.ts +0 -3
- package/lib/form/SchemaForm/initializeArrayIcon.js +0 -73
- package/lib/form/SchemaForm/initializeProField.d.ts +0 -5
- package/lib/form/SchemaForm/initializeProField.js +0 -77
- package/lib/info/utils/useInfoRequest.d.ts +0 -14
- package/lib/info/utils/useInfoRequest.js +0 -85
@@ -1,5 +1,5 @@
|
|
1
1
|
import React from 'react';
|
2
|
-
import {
|
2
|
+
import { ProFormProps, ProFormSchema } from '../form';
|
3
3
|
import { RequestAction } from './request';
|
4
4
|
import { DialogAction } from './dialog';
|
5
5
|
export interface DialogFormAction extends DialogAction {
|
@@ -10,11 +10,11 @@ export interface DialogFormAction extends DialogAction {
|
|
10
10
|
/** 表单提交发送数据请求时,是否携带全部表单数据。默认携带 */
|
11
11
|
useFieldValuesForRequest?: boolean;
|
12
12
|
/**
|
13
|
-
* @deprecated 建议使用 schema 配置
|
13
|
+
* @deprecated 建议使用 schema 配置 ProFormProps 代替
|
14
14
|
*/
|
15
|
-
formProps?: Omit<
|
16
|
-
/** 同时支持两种配置方式,如果想完整定制表单,可使用完整的表单配置项
|
17
|
-
schema:
|
15
|
+
formProps?: Omit<ProFormProps, 'schema'>;
|
16
|
+
/** 同时支持两种配置方式,如果想完整定制表单,可使用完整的表单配置项 ProFormProps,否则可以只配置 ProFormSchema */
|
17
|
+
schema: ProFormSchema | ProFormProps;
|
18
18
|
}
|
19
19
|
export declare function useDialogFormAction(action: DialogFormAction, context?: any): {
|
20
20
|
[x: string]: (e: React.MouseEvent<HTMLElement, MouseEvent>) => void;
|
@@ -1,5 +1,5 @@
|
|
1
1
|
var _excluded = ["schema"],
|
2
|
-
_excluded2 = ["schema", "useFieldValuesForRequest", "initialValues", "initialRequest", "formProps", "size", "onFinish"
|
2
|
+
_excluded2 = ["schema", "useFieldValuesForRequest", "initialValues", "initialRequest", "formProps", "size", "onFinish"];
|
3
3
|
|
4
4
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
5
5
|
|
@@ -133,7 +133,6 @@ export function useDialogFormAction(action, context) {
|
|
133
133
|
_action$size = action.size,
|
134
134
|
size = _action$size === void 0 ? 'small' : _action$size,
|
135
135
|
_onFinish = action.onFinish,
|
136
|
-
_onCancel = action.onCancel,
|
137
136
|
others = _objectWithoutProperties(action, _excluded2);
|
138
137
|
|
139
138
|
var formRef = useRef();
|
@@ -169,9 +168,6 @@ export function useDialogFormAction(action, context) {
|
|
169
168
|
var _formRef$current;
|
170
169
|
|
171
170
|
_onFinish && _onFinish((_formRef$current = formRef.current) === null || _formRef$current === void 0 ? void 0 : _formRef$current.values);
|
172
|
-
},
|
173
|
-
onCancel: function onCancel() {
|
174
|
-
_onCancel && _onCancel();
|
175
171
|
}
|
176
172
|
}, others), context);
|
177
173
|
}
|
package/es/actions/dialog.d.ts
CHANGED
@@ -1,14 +1,26 @@
|
|
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 { ProFormSchema, ProFormSchemaItem } from '../form';
|
5
|
+
import { ProMessageProps } from '../utils/message';
|
4
6
|
import { RequestAction } from './request';
|
5
7
|
export interface DialogAction extends Omit<RequestAction, 'url'>, Omit<QuickShowConfig, 'onError' | 'type'>, Omit<quickShowDrawerProps, 'trigger' | 'animation' | 'height' | 'locale' | 'onOk' | 'onCancel' | 'onError'> {
|
8
|
+
/** 点击「确认按钮」后的数据请求地址,非必填,不填就不发请求 */
|
6
9
|
url?: string;
|
10
|
+
/** 弹窗类型,支持普通弹窗和抽屉两种模式,默认为普通弹窗 */
|
7
11
|
dialogType?: 'dialog' | 'drawer';
|
12
|
+
/** 弹窗快捷调用类型 */
|
8
13
|
dialogQuickShowType?: 'alert' | 'confirm';
|
14
|
+
/** 弹窗消息类型 */
|
9
15
|
messageType?: 'success' | 'warning' | 'error' | 'notice' | 'help' | 'loading';
|
16
|
+
/** 位于弹窗内容最上方的自定义内容区 */
|
10
17
|
beforeContent?: React.ReactNode;
|
18
|
+
/** 位于弹窗内容上方的消息提示区 */
|
19
|
+
message?: ProMessageProps;
|
20
|
+
/** 位于弹窗内容下方的自定义内容区 */
|
11
21
|
afterContent?: React.ReactNode;
|
22
|
+
/** 弹窗页脚描述区,位于按钮组的对面 */
|
23
|
+
footerDescription?: React.ReactNode | ProFormSchema | ProFormSchemaItem;
|
12
24
|
}
|
13
25
|
export declare function useDialogAction(action: DialogAction, context?: any): {
|
14
26
|
[x: string]: (e: React.MouseEvent<HTMLElement, MouseEvent>) => void;
|
package/es/actions/dialog.js
CHANGED
@@ -1,20 +1,21 @@
|
|
1
1
|
var _excluded = ["url", "method", "params", "data", "extendParams", "successMsg", "errorMsg", "formatParams", "formatResult", "onSuccess", "onError"],
|
2
|
-
_excluded2 = ["title", "content", "component", "schema", "onFinish", "dialogType", "dialogQuickShowType", "messageType", "beforeRequest", "onTrigger", "link", "beforeContent", "afterContent"]
|
2
|
+
_excluded2 = ["title", "content", "component", "schema", "onFinish", "dialogType", "dialogQuickShowType", "messageType", "beforeRequest", "onTrigger", "link", "beforeContent", "afterContent", "message", "footerDescription", "footerAlign", "overlayProps"],
|
3
|
+
_excluded3 = ["className"];
|
3
4
|
|
4
5
|
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
5
6
|
|
6
7
|
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
7
8
|
|
8
|
-
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; }
|
9
|
-
|
10
|
-
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; }
|
11
|
-
|
12
9
|
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; }
|
13
10
|
|
14
11
|
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; }
|
15
12
|
|
16
13
|
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; }
|
17
14
|
|
15
|
+
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
16
|
+
|
17
|
+
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; }
|
18
|
+
|
18
19
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
19
20
|
|
20
21
|
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."); }
|
@@ -27,10 +28,13 @@ function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Sy
|
|
27
28
|
|
28
29
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
29
30
|
|
30
|
-
import React, { useState } from 'react';
|
31
|
+
import React, { useState, useEffect, useRef } from 'react';
|
32
|
+
import classnames from 'classnames';
|
31
33
|
import { useHistory } from 'react-router-dom';
|
32
34
|
import { Dialog, Drawer } from '@alicloudfe/components';
|
33
35
|
import { getTargetValue, uuid, goToLink } from '@teamix/utils';
|
36
|
+
import ProForm, { createForm } from '../form';
|
37
|
+
import { renderProMessage } from '../utils/message';
|
34
38
|
import { eventHandler } from './base';
|
35
39
|
import { doRequest } from './request';
|
36
40
|
|
@@ -40,6 +44,27 @@ function addContextForReactNode(content, context) {
|
|
40
44
|
}
|
41
45
|
|
42
46
|
return content;
|
47
|
+
}
|
48
|
+
|
49
|
+
var FooterForm = function FooterForm(props) {
|
50
|
+
var schema = props.schema,
|
51
|
+
context = props.context,
|
52
|
+
formRef = props.formRef;
|
53
|
+
var form = createForm();
|
54
|
+
useEffect(function () {
|
55
|
+
formRef.current = form;
|
56
|
+
}, []);
|
57
|
+
return /*#__PURE__*/React.createElement(ProForm, {
|
58
|
+
layout: "inline",
|
59
|
+
feedbackLayout: "none",
|
60
|
+
form: form,
|
61
|
+
schema: getTargetValue(schema, context)
|
62
|
+
});
|
63
|
+
};
|
64
|
+
|
65
|
+
function getFooterAlignClass(isDrawer, align) {
|
66
|
+
var footerAlign = align ? align : isDrawer ? 'left' : 'right';
|
67
|
+
return "footer-align-".concat(footerAlign);
|
43
68
|
} // 弹窗 -> 请求(点击确认,发送数据请求)
|
44
69
|
|
45
70
|
|
@@ -49,8 +74,10 @@ export function useDialogAction(action, context) {
|
|
49
74
|
loading = _useState2[0],
|
50
75
|
setLoading = _useState2[1];
|
51
76
|
|
77
|
+
var footerDescriptionRef = useRef();
|
52
78
|
var history = useHistory();
|
53
|
-
|
79
|
+
|
80
|
+
var onActionStart = function onActionStart() {
|
54
81
|
var url = action.url,
|
55
82
|
method = action.method,
|
56
83
|
params = action.params,
|
@@ -79,19 +106,55 @@ export function useDialogAction(action, context) {
|
|
79
106
|
link = _getTargetValue.link,
|
80
107
|
beforeContent = _getTargetValue.beforeContent,
|
81
108
|
afterContent = _getTargetValue.afterContent,
|
82
|
-
|
109
|
+
message = _getTargetValue.message,
|
110
|
+
footerDescription = _getTargetValue.footerDescription,
|
111
|
+
footerAlign = _getTargetValue.footerAlign,
|
112
|
+
_getTargetValue$overl = _getTargetValue.overlayProps,
|
113
|
+
overlayProps = _getTargetValue$overl === void 0 ? {} : _getTargetValue$overl,
|
114
|
+
containerProps = _objectWithoutProperties(_getTargetValue, _excluded2);
|
115
|
+
|
116
|
+
var isDrawer = dialogType === 'drawer';
|
117
|
+
var container = isDrawer ? Drawer : Dialog;
|
118
|
+
|
119
|
+
var overlayClassName = overlayProps.className,
|
120
|
+
overlayOtherProps = _objectWithoutProperties(overlayProps, _excluded3);
|
83
121
|
|
84
|
-
var
|
85
|
-
var dialogProps = dialogType === 'drawer' ? {} : {
|
122
|
+
var dialogOnlyProps = {
|
86
123
|
type: dialogQuickShowType,
|
87
124
|
messageProps: {
|
88
125
|
type: messageType
|
126
|
+
},
|
127
|
+
overlayProps: _objectSpread({
|
128
|
+
className: classnames('teamix-pro-action-dialog', overlayClassName, {
|
129
|
+
'has-footer-description': !!footerDescription
|
130
|
+
})
|
131
|
+
}, overlayOtherProps)
|
132
|
+
};
|
133
|
+
var containerOtherProps = isDrawer ? {} : dialogOnlyProps;
|
134
|
+
|
135
|
+
var renderDialogFooterDescription = function renderDialogFooterDescription(footer) {
|
136
|
+
if (footer instanceof Array || footer.component) {
|
137
|
+
var _schema = footer instanceof Array ? footer : [footer];
|
138
|
+
|
139
|
+
return /*#__PURE__*/React.createElement(FooterForm, {
|
140
|
+
formRef: footerDescriptionRef,
|
141
|
+
context: context,
|
142
|
+
schema: [{
|
143
|
+
component: 'FormFlex',
|
144
|
+
children: _schema
|
145
|
+
}]
|
146
|
+
});
|
89
147
|
}
|
148
|
+
|
149
|
+
return footer;
|
90
150
|
};
|
91
151
|
|
92
152
|
var onOk = function onOk() {
|
93
153
|
return new Promise( /*#__PURE__*/function () {
|
94
154
|
var _ref = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee(resolve) {
|
155
|
+
var _footerDescriptionRef;
|
156
|
+
|
157
|
+
var footerDescriptionValues, requestContext;
|
95
158
|
return regeneratorRuntime.wrap(function _callee$(_context) {
|
96
159
|
while (1) {
|
97
160
|
switch (_context.prev = _context.next) {
|
@@ -111,29 +174,33 @@ export function useDialogAction(action, context) {
|
|
111
174
|
|
112
175
|
case 5:
|
113
176
|
setLoading(true);
|
114
|
-
|
115
|
-
_context.
|
116
|
-
|
117
|
-
|
118
|
-
|
177
|
+
footerDescriptionValues = Object.assign({}, footerDescriptionRef === null || footerDescriptionRef === void 0 ? void 0 : (_footerDescriptionRef = footerDescriptionRef.current) === null || _footerDescriptionRef === void 0 ? void 0 : _footerDescriptionRef.values);
|
178
|
+
_context.prev = 7;
|
179
|
+
requestContext = Object.assign({
|
180
|
+
footer: footerDescriptionValues
|
181
|
+
}, context);
|
182
|
+
_context.next = 11;
|
183
|
+
return doRequest(action, requestContext, history, footerDescriptionValues);
|
184
|
+
|
185
|
+
case 11:
|
119
186
|
onFinish && onFinish();
|
120
187
|
resolve(true);
|
121
|
-
_context.next =
|
188
|
+
_context.next = 20;
|
122
189
|
break;
|
123
190
|
|
124
|
-
case
|
125
|
-
_context.prev =
|
126
|
-
_context.t0 = _context["catch"](
|
191
|
+
case 15:
|
192
|
+
_context.prev = 15;
|
193
|
+
_context.t0 = _context["catch"](7);
|
127
194
|
setLoading(false);
|
128
195
|
resolve(false);
|
129
196
|
return _context.abrupt("return");
|
130
197
|
|
131
|
-
case
|
198
|
+
case 20:
|
132
199
|
case "end":
|
133
200
|
return _context.stop();
|
134
201
|
}
|
135
202
|
}
|
136
|
-
}, _callee, null, [[
|
203
|
+
}, _callee, null, [[7, 15]]);
|
137
204
|
}));
|
138
205
|
|
139
206
|
return function (_x) {
|
@@ -157,18 +224,28 @@ export function useDialogAction(action, context) {
|
|
157
224
|
var dialogContent = Component ? /*#__PURE__*/React.createElement(Component, _objectSpread({
|
158
225
|
key: uuid()
|
159
226
|
}, componentProps)) : addContextForReactNode(content, dialogContext);
|
160
|
-
|
227
|
+
|
228
|
+
var quickShowProps = _objectSpread(_objectSpread({
|
161
229
|
// @ts-ignore
|
162
230
|
onOk: onOk,
|
163
231
|
title: addContextForReactNode(title, dialogContext),
|
164
232
|
content: /*#__PURE__*/React.createElement(React.Fragment, null, beforeContent && /*#__PURE__*/React.createElement("div", {
|
165
233
|
className: "teamix-pro-dialog-before-content"
|
166
|
-
}, beforeContent
|
234
|
+
}, addContextForReactNode(beforeContent, dialogContext)), message && /*#__PURE__*/React.createElement("div", {
|
235
|
+
className: "teamix-pro-dialog-message"
|
236
|
+
}, renderProMessage(message)), dialogContent, afterContent && /*#__PURE__*/React.createElement("div", {
|
167
237
|
className: "teamix-pro-dialog-after-content"
|
168
|
-
}, afterContent)),
|
169
|
-
|
170
|
-
|
238
|
+
}, addContextForReactNode(afterContent, dialogContext)), footerDescription && /*#__PURE__*/React.createElement("div", {
|
239
|
+
className: classnames('teamix-pro-dialog-footer-description', getFooterAlignClass(isDrawer, footerAlign))
|
240
|
+
}, renderDialogFooterDescription(footerDescription))),
|
241
|
+
closeable: !loading,
|
242
|
+
footerAlign: footerAlign
|
243
|
+
}, containerOtherProps), containerProps);
|
244
|
+
|
245
|
+
var ret = container.show(quickShowProps);
|
171
246
|
store.hide = ret.hide;
|
172
|
-
}
|
247
|
+
};
|
248
|
+
|
249
|
+
return _objectSpread({}, eventHandler(action, onActionStart));
|
173
250
|
}
|
174
251
|
export default useDialogAction;
|
package/es/actions/index.d.ts
CHANGED
@@ -4,75 +4,82 @@ import { MenuButtonProps } from '@alicloudfe/components/types/menu-button';
|
|
4
4
|
import { LinkAction } from './link';
|
5
5
|
import { RequestAction } from './request';
|
6
6
|
import { DialogAction } from './dialog';
|
7
|
-
import { ConfirmAction } from './confirm';
|
8
|
-
import { DangerConfirmAction } from './danger-confirm';
|
9
|
-
import { NoticeAction } from './notice';
|
10
|
-
import { ErrorAction } from './error';
|
11
7
|
import { DialogFormAction } from './dialog-form';
|
12
8
|
import { DialogTableAction } from './dialog-table';
|
13
9
|
import { DialogInfoAction } from './dialog-info';
|
14
|
-
import { DrawerAction } from './drawer';
|
15
|
-
import { DrawerFormAction } from './drawer-form';
|
16
|
-
import { DrawerTableAction } from './drawer-table';
|
17
|
-
import { DrawerInfoAction } from './drawer-info';
|
18
10
|
import './index.scss';
|
19
|
-
export declare type
|
20
|
-
type: '
|
21
|
-
} & LinkAction) | ({
|
22
|
-
type: 'request';
|
23
|
-
} & RequestAction) | ({
|
24
|
-
type: 'confirm';
|
25
|
-
} & ConfirmAction) | ({
|
26
|
-
type: 'danger-confirm';
|
27
|
-
} & DangerConfirmAction) | ({
|
28
|
-
type: 'notice';
|
29
|
-
} & NoticeAction) | ({
|
30
|
-
type: 'error';
|
31
|
-
} & ErrorAction) | ({
|
32
|
-
type: 'dialog';
|
33
|
-
} & DialogAction) | ({
|
34
|
-
type: 'dialog-form';
|
11
|
+
export declare type ProActionConfig = ({
|
12
|
+
type: 'dialog-form' | 'drawer-form';
|
35
13
|
} & DialogFormAction) | ({
|
36
|
-
type: 'dialog-table';
|
14
|
+
type: 'dialog-table' | 'drawer-table';
|
37
15
|
} & DialogTableAction) | ({
|
38
|
-
type: 'dialog-info';
|
16
|
+
type: 'dialog-info' | 'drawer-info';
|
39
17
|
} & DialogInfoAction) | ({
|
40
|
-
type: 'drawer';
|
41
|
-
} &
|
42
|
-
type: '
|
43
|
-
} &
|
44
|
-
type: '
|
45
|
-
} &
|
46
|
-
type: 'drawer-info';
|
47
|
-
} & DrawerInfoAction);
|
18
|
+
type: 'dialog' | 'drawer' | 'confirm' | 'danger-confirm' | 'notice' | 'error';
|
19
|
+
} & DialogAction) | ({
|
20
|
+
type: 'request';
|
21
|
+
} & RequestAction) | ({
|
22
|
+
type: 'link';
|
23
|
+
} & LinkAction);
|
48
24
|
export declare function registerActionHandler(id: string, extendActionId: string, defaultConfig: any): void;
|
49
|
-
export declare
|
50
|
-
export interface
|
51
|
-
config?:
|
25
|
+
export declare function useAction(config?: ProActionConfig, context?: any): any;
|
26
|
+
export interface ProActionButtonProps extends ButtonProps {
|
27
|
+
config?: ProActionConfig;
|
52
28
|
visible?: any;
|
53
29
|
disabled?: any;
|
54
30
|
icon?: string;
|
55
31
|
context?: any;
|
56
32
|
onClick?: (event: React.MouseEvent<Element, MouseEvent>, context?: any) => void;
|
57
33
|
}
|
58
|
-
export declare const
|
59
|
-
export interface
|
60
|
-
actions:
|
34
|
+
export declare const ProActionButton: (props: ProActionButtonProps) => JSX.Element;
|
35
|
+
export interface ProActionMenuButtonProps extends MenuButtonProps {
|
36
|
+
actions: ProActionProps[];
|
61
37
|
visible?: any;
|
62
38
|
icon?: string;
|
63
39
|
context?: any;
|
64
40
|
}
|
65
|
-
export declare const
|
66
|
-
export declare type
|
67
|
-
export declare type
|
41
|
+
export declare const ProActionMenuButton: (props: ProActionMenuButtonProps) => JSX.Element;
|
42
|
+
export declare type ProActionProps = ProActionButtonProps | ProActionMenuButtonProps;
|
43
|
+
export declare type ProActionGroupProps = {
|
68
44
|
type?: 'button' | 'text';
|
69
45
|
context?: any;
|
70
|
-
actions:
|
46
|
+
actions: ProActionProps[];
|
71
47
|
max?: number;
|
72
48
|
moreText?: string;
|
73
49
|
divider?: boolean;
|
74
50
|
} & React.HTMLAttributes<HTMLElement>;
|
75
|
-
export declare function
|
76
|
-
|
77
|
-
declare const ProAction: (props: IProAction) => JSX.Element;
|
51
|
+
export declare function ProActionGroup(props: ProActionGroupProps): JSX.Element;
|
52
|
+
declare const ProAction: (props: ProActionProps) => JSX.Element;
|
78
53
|
export default ProAction;
|
54
|
+
/**
|
55
|
+
* @deprecated 建议使用 ProActionGroup 代替
|
56
|
+
*/
|
57
|
+
export declare const ActionGroup: typeof ProActionGroup;
|
58
|
+
/**
|
59
|
+
* @deprecated 建议使用 ProActionButton 代替
|
60
|
+
*/
|
61
|
+
export declare const ActionButton: (props: ProActionButtonProps) => JSX.Element;
|
62
|
+
/**
|
63
|
+
* @deprecated 建议使用 ProActionMenuButton 代替
|
64
|
+
*/
|
65
|
+
export declare const ActionMenuButton: (props: ProActionMenuButtonProps) => JSX.Element;
|
66
|
+
/**
|
67
|
+
* @deprecated 建议使用 ProActionConfig 代替
|
68
|
+
*/
|
69
|
+
export declare type ActionConfig = ProActionConfig;
|
70
|
+
/**
|
71
|
+
* @deprecated 建议使用 ProActionButtonProps 代替
|
72
|
+
*/
|
73
|
+
export declare type IActionButton = ProActionButtonProps;
|
74
|
+
/**
|
75
|
+
* @deprecated 建议使用 ProActionMenuButtonProps 代替
|
76
|
+
*/
|
77
|
+
export declare type IActionMenuButton = ProActionMenuButtonProps;
|
78
|
+
/**
|
79
|
+
* @deprecated 建议使用 ProActionGroupProps 代替
|
80
|
+
*/
|
81
|
+
export declare type ActionGroupProps = ProActionGroupProps;
|
82
|
+
/**
|
83
|
+
* @deprecated 建议使用 ProActionProps 代替
|
84
|
+
*/
|
85
|
+
export declare type ICommonActionButton = ProActionProps;
|
package/es/actions/index.js
CHANGED
@@ -56,7 +56,7 @@ export function registerActionHandler(id, extendActionId, defaultConfig) {
|
|
56
56
|
defaultConfig: defaultConfig
|
57
57
|
});
|
58
58
|
}
|
59
|
-
export
|
59
|
+
export function useAction(config, context) {
|
60
60
|
if (!config) {
|
61
61
|
return {};
|
62
62
|
}
|
@@ -129,7 +129,7 @@ export var useAction = function useAction(config, context) {
|
|
129
129
|
return useAction(_objectSpread(_objectSpread({
|
130
130
|
type: registedAction.extendActionId
|
131
131
|
}, registedAction.defaultConfig), others), context);
|
132
|
-
}
|
132
|
+
}
|
133
133
|
|
134
134
|
var buttonContent = function buttonContent(content, iconType, iconSize, context) {
|
135
135
|
var renderedContent = typeof content === 'function' ? content(context) : content;
|
@@ -145,7 +145,7 @@ var buttonContent = function buttonContent(content, iconType, iconSize, context)
|
|
145
145
|
}), renderedContent];
|
146
146
|
};
|
147
147
|
|
148
|
-
export var
|
148
|
+
export var ProActionButton = function ProActionButton(props) {
|
149
149
|
var config = props.config,
|
150
150
|
icon = props.icon,
|
151
151
|
_props$iconSize = props.iconSize,
|
@@ -210,7 +210,7 @@ function renderCommonActionButtonMenuItem(action, key, context) {
|
|
210
210
|
return renderMenuButtonItem(action, key, context);
|
211
211
|
}
|
212
212
|
|
213
|
-
export var
|
213
|
+
export var ProActionMenuButton = function ProActionMenuButton(props) {
|
214
214
|
var icon = props.icon,
|
215
215
|
iconSize = props.iconSize,
|
216
216
|
label = props.label,
|
@@ -258,19 +258,13 @@ function renderCommonActionButton(button, context, isTypeText) {
|
|
258
258
|
var buttonProps = _objectSpread({
|
259
259
|
context: Object.assign({}, context, buttonContext),
|
260
260
|
text: text || isTypeText
|
261
|
-
}, others);
|
262
|
-
|
261
|
+
}, others);
|
263
262
|
|
264
263
|
if (!button.actions) {
|
265
|
-
return (
|
266
|
-
|
267
|
-
// @ts-ignore
|
268
|
-
React.createElement(ActionButton, _objectSpread({}, buttonProps))
|
269
|
-
);
|
270
|
-
} // @ts-ignore
|
271
|
-
|
264
|
+
return /*#__PURE__*/React.createElement(ProActionButton, _objectSpread({}, buttonProps));
|
265
|
+
}
|
272
266
|
|
273
|
-
return /*#__PURE__*/React.createElement(
|
267
|
+
return /*#__PURE__*/React.createElement(ProActionMenuButton, _objectSpread({}, buttonProps));
|
274
268
|
}
|
275
269
|
|
276
270
|
function getDefaultMoreButton(type, moreText) {
|
@@ -297,9 +291,7 @@ function getDefaultMoreButton(type, moreText) {
|
|
297
291
|
var MAX_ACTTIONS = 4;
|
298
292
|
|
299
293
|
function getActionConfig(action, context) {
|
300
|
-
// @ts-ignore
|
301
294
|
if (action.actions) {
|
302
|
-
// @ts-ignore
|
303
295
|
var actions = action.actions,
|
304
296
|
_others = _objectWithoutProperties(action, _excluded6);
|
305
297
|
|
@@ -308,8 +300,7 @@ function getActionConfig(action, context) {
|
|
308
300
|
return getActionConfig(a, context);
|
309
301
|
})
|
310
302
|
}, getTargetValue(_others, context));
|
311
|
-
}
|
312
|
-
|
303
|
+
}
|
313
304
|
|
314
305
|
var config = action.config,
|
315
306
|
others = _objectWithoutProperties(action, _excluded7);
|
@@ -319,7 +310,7 @@ function getActionConfig(action, context) {
|
|
319
310
|
}, getTargetValue(others, context));
|
320
311
|
}
|
321
312
|
|
322
|
-
export function
|
313
|
+
export function ProActionGroup(props) {
|
323
314
|
var _props$type3 = props.type,
|
324
315
|
type = _props$type3 === void 0 ? 'button' : _props$type3,
|
325
316
|
_props$divider = props.divider,
|
@@ -341,8 +332,8 @@ export function ActionGroup(props) {
|
|
341
332
|
});
|
342
333
|
var formatedActions = formatGroupActions(filteredActions, max, getDefaultMoreButton(type, moreText));
|
343
334
|
return /*#__PURE__*/React.createElement("div", _objectSpread({
|
344
|
-
className: cls('teamix-pro-actions', type, className, {
|
345
|
-
divider: divider
|
335
|
+
className: cls('teamix-pro-actions', "teamix-pro-actions-type-".concat(type), className, {
|
336
|
+
'teamix-pro-actions-divider': type === 'button' ? false : divider
|
346
337
|
})
|
347
338
|
}, containerProps), formatedActions.map(function (actionBtn, i) {
|
348
339
|
var isLastOne = i === formatedActions.length - 1;
|
@@ -358,4 +349,19 @@ var ProAction = function ProAction(props) {
|
|
358
349
|
return renderCommonActionButton(props);
|
359
350
|
};
|
360
351
|
|
361
|
-
export default ProAction;
|
352
|
+
export default ProAction;
|
353
|
+
/**
|
354
|
+
* @deprecated 建议使用 ProActionGroup 代替
|
355
|
+
*/
|
356
|
+
|
357
|
+
export var ActionGroup = ProActionGroup;
|
358
|
+
/**
|
359
|
+
* @deprecated 建议使用 ProActionButton 代替
|
360
|
+
*/
|
361
|
+
|
362
|
+
export var ActionButton = ProActionButton;
|
363
|
+
/**
|
364
|
+
* @deprecated 建议使用 ProActionMenuButton 代替
|
365
|
+
*/
|
366
|
+
|
367
|
+
export var ActionMenuButton = ProActionMenuButton;
|
package/es/actions/index.scss
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
display: flex;
|
3
3
|
align-items: center;
|
4
4
|
flex-wrap: wrap;
|
5
|
-
&.button {
|
5
|
+
&.teamix-pro-actions-type-button {
|
6
6
|
& > button {
|
7
7
|
&:not(:last-child) {
|
8
8
|
margin-right: var(--s-2);
|
@@ -10,7 +10,7 @@
|
|
10
10
|
}
|
11
11
|
}
|
12
12
|
|
13
|
-
&.text:not(.divider) {
|
13
|
+
&.teamix-pro-actions-type-text:not(.teamix-pro-actions-divider) {
|
14
14
|
& > button {
|
15
15
|
&:not(:last-child) {
|
16
16
|
margin-right: var(--s-4);
|
@@ -29,10 +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
|
+
|
32
57
|
.teamix-pro-dialog-before-content {
|
33
58
|
margin-bottom: var(--s-2);
|
34
59
|
}
|
35
60
|
|
61
|
+
.teamix-pro-dialog-message {
|
62
|
+
margin-bottom: var(--s-2);
|
63
|
+
|
64
|
+
&+.next-loading {
|
65
|
+
.teamix-pro-form {
|
66
|
+
margin-top: 20px;
|
67
|
+
}
|
68
|
+
}
|
69
|
+
}
|
70
|
+
|
36
71
|
.teamix-pro-dialog-after-content {
|
37
72
|
margin-top: var(--s-2);
|
38
73
|
}
|
@@ -40,3 +75,14 @@
|
|
40
75
|
.next-menu-divider + .next-menu-divider {
|
41
76
|
display: none;
|
42
77
|
}
|
78
|
+
|
79
|
+
.next-dialog-body {
|
80
|
+
.teamix-pro-dialog-footer-description {
|
81
|
+
.teamix-pro-form {
|
82
|
+
margin-bottom: 0;
|
83
|
+
}
|
84
|
+
}
|
85
|
+
.teamix-pro-form {
|
86
|
+
margin-bottom: -20px;
|
87
|
+
}
|
88
|
+
}
|
package/es/actions/link.js
CHANGED
@@ -5,11 +5,13 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
|
|
5
5
|
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; }
|
6
6
|
|
7
7
|
import { getTargetValue, goToLink } from '@teamix/utils';
|
8
|
+
import { useHistory } from 'react-router-dom';
|
8
9
|
import { eventHandler } from './base';
|
9
10
|
export function useLinkAction(action, context) {
|
10
|
-
var
|
11
|
+
var history = useHistory();
|
11
12
|
return _objectSpread({}, eventHandler(action, function () {
|
12
|
-
|
13
|
+
var linkAction = getTargetValue(action, context);
|
14
|
+
goToLink(linkAction, history);
|
13
15
|
}));
|
14
16
|
}
|
15
17
|
export default useLinkAction;
|
package/es/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/es/actions/request.js
CHANGED
@@ -28,14 +28,14 @@ import { useHistory } from 'react-router-dom';
|
|
28
28
|
import { doCommonRequest } from '@teamix/utils';
|
29
29
|
import { eventHandler } from './base'; // action 里的数据请求都默认是 post 类型
|
30
30
|
|
31
|
-
export function doRequest(action, context, history) {
|
31
|
+
export function doRequest(action, context, history, extraParams) {
|
32
32
|
var _action$method = action.method,
|
33
33
|
method = _action$method === void 0 ? 'post' : _action$method,
|
34
34
|
others = _objectWithoutProperties(action, _excluded);
|
35
35
|
|
36
36
|
return doCommonRequest(_objectSpread({
|
37
37
|
method: method
|
38
|
-
}, others), context, history);
|
38
|
+
}, others), context, history, extraParams);
|
39
39
|
}
|
40
40
|
export function useRequestAction(action, context) {
|
41
41
|
var _useState = useState(false),
|