@zat-design/sisyphus-react 3.13.7 → 3.13.8
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/es/ProAction/components/CheckModalContent/index.css +22 -0
- package/es/ProAction/components/CheckModalContent/index.d.ts +8 -0
- package/es/ProAction/components/CheckModalContent/index.js +38 -0
- package/es/ProAction/components/CheckModalContent/index.less +28 -0
- package/es/ProAction/index.js +37 -39
- package/es/ProAction/index.less +5 -6
- package/es/ProAction/propsType.d.ts +8 -6
- package/lib/ProAction/components/CheckModalContent/index.css +22 -0
- package/lib/ProAction/components/CheckModalContent/index.d.ts +8 -0
- package/lib/ProAction/components/CheckModalContent/index.js +45 -0
- package/lib/ProAction/components/CheckModalContent/index.less +28 -0
- package/lib/ProAction/index.js +37 -39
- package/lib/ProAction/index.less +5 -6
- package/lib/ProAction/propsType.d.ts +8 -6
- package/package.json +1 -1
@@ -0,0 +1,22 @@
|
|
1
|
+
.pro-action-check-modal-box .res-err-list .err-tip {
|
2
|
+
color: #666;
|
3
|
+
}
|
4
|
+
.pro-action-check-modal-box .res-err-list .err-item {
|
5
|
+
box-sizing: border-box;
|
6
|
+
padding-left: 6px;
|
7
|
+
color: #333;
|
8
|
+
border-radius: 4px;
|
9
|
+
}
|
10
|
+
.pro-action-check-modal-box .res-err-list .err-item:hover {
|
11
|
+
background-color: #f0f0f0;
|
12
|
+
}
|
13
|
+
.pro-action-check-modal-box .res-err-list .list-wrap {
|
14
|
+
box-sizing: border-box;
|
15
|
+
max-height: 50vh;
|
16
|
+
margin: 12px 0;
|
17
|
+
padding: 4px;
|
18
|
+
overflow-y: auto;
|
19
|
+
line-height: 1.8;
|
20
|
+
border: 1px solid #ccc;
|
21
|
+
border-radius: 6px;
|
22
|
+
}
|
@@ -0,0 +1,8 @@
|
|
1
|
+
import './index.less';
|
2
|
+
interface propsWithCheckModal {
|
3
|
+
errorTitle?: string;
|
4
|
+
list?: string[];
|
5
|
+
[key: string]: any;
|
6
|
+
}
|
7
|
+
declare const CheckModalContent: (props: propsWithCheckModal) => import("react/jsx-runtime").JSX.Element;
|
8
|
+
export default CheckModalContent;
|
@@ -0,0 +1,38 @@
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
2
|
+
/*
|
3
|
+
* @Author: za-xuwenli xuwenli@zhongan.io
|
4
|
+
* @Date: 2025-02-17 11:49:02
|
5
|
+
* @LastEditors: za-xuwenli xuwenli@zhongan.io
|
6
|
+
* @LastEditTime: 2025-05-29 13:55:34
|
7
|
+
* @FilePath: /zat-wjs-pro-product-web/src/components/CheckModalContent/index.tsx
|
8
|
+
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
|
9
|
+
*/
|
10
|
+
import './index.less';
|
11
|
+
var CheckModalContent = function CheckModalContent(props) {
|
12
|
+
var _ref = props !== null && props !== void 0 ? props : {},
|
13
|
+
errorTitle = _ref.errorTitle,
|
14
|
+
_ref$list = _ref.list,
|
15
|
+
list = _ref$list === void 0 ? [] : _ref$list;
|
16
|
+
return _jsx("div", {
|
17
|
+
className: "pro-action-check-modal-box",
|
18
|
+
children: _jsxs("div", {
|
19
|
+
className: "res-err-list",
|
20
|
+
children: [_jsx("span", {
|
21
|
+
className: "err-tip",
|
22
|
+
children: errorTitle
|
23
|
+
}), Array.isArray(list) && list.length === 1 ? _jsx("span", {
|
24
|
+
className: "err-item",
|
25
|
+
children: list[0]
|
26
|
+
}) : null, Array.isArray(list) && list.length > 1 ? _jsx("div", {
|
27
|
+
className: "list-wrap",
|
28
|
+
children: list.map(function (item) {
|
29
|
+
return _jsx("div", {
|
30
|
+
className: "err-item",
|
31
|
+
children: item
|
32
|
+
});
|
33
|
+
})
|
34
|
+
}) : null]
|
35
|
+
})
|
36
|
+
});
|
37
|
+
};
|
38
|
+
export default CheckModalContent;
|
@@ -0,0 +1,28 @@
|
|
1
|
+
.pro-action-check-modal-box {
|
2
|
+
.res-err-list {
|
3
|
+
.err-tip {
|
4
|
+
color: #666;
|
5
|
+
}
|
6
|
+
|
7
|
+
.err-item {
|
8
|
+
box-sizing: border-box;
|
9
|
+
padding-left: 6px;
|
10
|
+
color: #333;
|
11
|
+
border-radius: 4px;
|
12
|
+
&:hover {
|
13
|
+
background-color: #f0f0f0;
|
14
|
+
}
|
15
|
+
}
|
16
|
+
|
17
|
+
.list-wrap {
|
18
|
+
box-sizing: border-box;
|
19
|
+
max-height: 50vh;
|
20
|
+
margin: 12px 0;
|
21
|
+
padding: 4px;
|
22
|
+
overflow-y: auto;
|
23
|
+
line-height: 1.8;
|
24
|
+
border: 1px solid #ccc;
|
25
|
+
border-radius: 6px;
|
26
|
+
}
|
27
|
+
}
|
28
|
+
}
|
package/es/ProAction/index.js
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
1
2
|
import "antd/es/popconfirm/style";
|
2
3
|
import _Popconfirm from "antd/es/popconfirm";
|
3
4
|
import _regeneratorRuntime from "@babel/runtime/helpers/esm/regeneratorRuntime";
|
@@ -10,6 +11,7 @@ import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-run
|
|
10
11
|
import React from 'react';
|
11
12
|
import { useSetState } from 'ahooks';
|
12
13
|
import { isFunction } from 'lodash';
|
14
|
+
import CheckModalContent from './components/CheckModalContent';
|
13
15
|
import { ProDrawerForm } from '../index';
|
14
16
|
import locale from '../locale';
|
15
17
|
import './index.less';
|
@@ -24,7 +26,8 @@ var ProAction = function ProAction(props) {
|
|
24
26
|
index: 0,
|
25
27
|
open: false,
|
26
28
|
servicesArray: [],
|
27
|
-
loading: false
|
29
|
+
loading: false,
|
30
|
+
errorModalData: null
|
28
31
|
}),
|
29
32
|
_useSetState2 = _slicedToArray(_useSetState, 2),
|
30
33
|
state = _useSetState2[0],
|
@@ -37,12 +40,12 @@ var ProAction = function ProAction(props) {
|
|
37
40
|
});
|
38
41
|
}
|
39
42
|
var index = state.index,
|
40
|
-
|
43
|
+
errorModalData = state.errorModalData;
|
41
44
|
var length = config.length;
|
42
45
|
var _onActionRun = /*#__PURE__*/function () {
|
43
46
|
var _ref = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(currentIndex, array) {
|
44
47
|
var _actionProps$useReque, _options$defaultParam, _options$onSuccess, _newServicesArray$cur, _newServicesArray$cur2, _newServicesArray$cur3, _actionProps$onAction, _actionProps$continue;
|
45
|
-
var actionProps, newServicesArray, _ref2, service, options, transformResponse, params, res, data, open, _newServicesArray$cur4, _newServicesArray$cur5,
|
48
|
+
var actionProps, newServicesArray, _ref2, service, options, transformResponse, params, res, data, open, _newServicesArray$cur4, _newServicesArray$cur5, list, errorTitle, isContinue;
|
46
49
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
47
50
|
while (1) switch (_context.prev = _context.next) {
|
48
51
|
case 0:
|
@@ -99,7 +102,7 @@ var ProAction = function ProAction(props) {
|
|
99
102
|
if (!service) {
|
100
103
|
newServicesArray[currentIndex] = null;
|
101
104
|
}
|
102
|
-
open = (actionProps === null || actionProps === void 0 ? void 0 : actionProps.mode) === 'check' && ((_newServicesArray$cur = newServicesArray[currentIndex]) === null || _newServicesArray$cur === void 0 ? void 0 : _newServicesArray$cur.errorTitle)
|
105
|
+
open = (actionProps === null || actionProps === void 0 ? void 0 : actionProps.mode) === 'check' && (((_newServicesArray$cur = newServicesArray[currentIndex]) === null || _newServicesArray$cur === void 0 ? void 0 : _newServicesArray$cur.errorTitle) || ((_newServicesArray$cur2 = newServicesArray[currentIndex]) === null || _newServicesArray$cur2 === void 0 ? void 0 : (_newServicesArray$cur3 = _newServicesArray$cur2.list) === null || _newServicesArray$cur3 === void 0 ? void 0 : _newServicesArray$cur3.length));
|
103
106
|
setState({
|
104
107
|
servicesArray: newServicesArray,
|
105
108
|
index: currentIndex,
|
@@ -109,14 +112,15 @@ var ProAction = function ProAction(props) {
|
|
109
112
|
_context.next = 37;
|
110
113
|
break;
|
111
114
|
}
|
112
|
-
list = ((_newServicesArray$cur4 = newServicesArray[currentIndex]) === null || _newServicesArray$cur4 === void 0 ? void 0 :
|
113
|
-
errorTitle = (_newServicesArray$
|
115
|
+
list = ((_newServicesArray$cur4 = newServicesArray[currentIndex]) === null || _newServicesArray$cur4 === void 0 ? void 0 : _newServicesArray$cur4.list) || [];
|
116
|
+
errorTitle = (_newServicesArray$cur5 = newServicesArray[currentIndex]) === null || _newServicesArray$cur5 === void 0 ? void 0 : _newServicesArray$cur5.errorTitle;
|
114
117
|
form.setFieldsValue({
|
115
118
|
errorTitle: errorTitle,
|
116
119
|
list: list
|
117
120
|
});
|
118
121
|
setState({
|
119
|
-
loading: false
|
122
|
+
loading: false,
|
123
|
+
errorModalData: newServicesArray[currentIndex]
|
120
124
|
});
|
121
125
|
return _context.abrupt("return");
|
122
126
|
case 37:
|
@@ -164,6 +168,27 @@ var ProAction = function ProAction(props) {
|
|
164
168
|
open: false
|
165
169
|
});
|
166
170
|
};
|
171
|
+
var errorModalConfig = config === null || config === void 0 ? void 0 : config[index];
|
172
|
+
var _ref3 = errorModalConfig || {},
|
173
|
+
contextRender = _ref3.contextRender;
|
174
|
+
var renderContent = function renderContent() {
|
175
|
+
var TargetComponent = _jsx(_Fragment, {});
|
176
|
+
if (typeof contextRender === 'function') {
|
177
|
+
var View = contextRender(errorModalData);
|
178
|
+
TargetComponent = _jsx(_Fragment, {
|
179
|
+
children: View
|
180
|
+
});
|
181
|
+
} else if (typeof contextRender === 'string' || typeof contextRender === 'number') {
|
182
|
+
TargetComponent = _jsx(_Fragment, {
|
183
|
+
children: contextRender
|
184
|
+
});
|
185
|
+
} else if (/*#__PURE__*/React.isValidElement(contextRender)) {
|
186
|
+
TargetComponent = _jsx(_Fragment, {
|
187
|
+
children: contextRender
|
188
|
+
});
|
189
|
+
}
|
190
|
+
return TargetComponent;
|
191
|
+
};
|
167
192
|
return _jsxs(_Fragment, {
|
168
193
|
children: [((_config$ = config[0]) === null || _config$ === void 0 ? void 0 : _config$.mode) === 'confirm' ? _jsx(_Popconfirm, {
|
169
194
|
onConfirm: function onConfirm() {
|
@@ -176,8 +201,10 @@ var ProAction = function ProAction(props) {
|
|
176
201
|
mode: "Modal",
|
177
202
|
title: config === null || config === void 0 ? void 0 : (_config$index = config[index]) === null || _config$index === void 0 ? void 0 : _config$index.title,
|
178
203
|
onCancel: function onCancel() {
|
204
|
+
form.resetFields();
|
179
205
|
setState({
|
180
|
-
open: false
|
206
|
+
open: false,
|
207
|
+
errorModalData: null
|
181
208
|
});
|
182
209
|
},
|
183
210
|
modalProps: {
|
@@ -186,37 +213,8 @@ var ProAction = function ProAction(props) {
|
|
186
213
|
size: "small",
|
187
214
|
onOk: onOk,
|
188
215
|
form: form,
|
189
|
-
|
190
|
-
|
191
|
-
isView: true,
|
192
|
-
columns: [{
|
193
|
-
type: 'Input',
|
194
|
-
name: 'errorTitle',
|
195
|
-
viewRender: function viewRender(value) {
|
196
|
-
var _servicesArray$index;
|
197
|
-
var list = ((_servicesArray$index = servicesArray[index]) === null || _servicesArray$index === void 0 ? void 0 : _servicesArray$index.list) || [];
|
198
|
-
return _jsxs("div", {
|
199
|
-
className: "pro-action-view-tile",
|
200
|
-
children: [value, list.length === 1 ? _jsxs("span", {
|
201
|
-
children: [" ", list[0]]
|
202
|
-
}) : '']
|
203
|
-
});
|
204
|
-
}
|
205
|
-
}, {
|
206
|
-
type: 'TextArea',
|
207
|
-
name: 'list',
|
208
|
-
fieldProps: {
|
209
|
-
autoSize: {
|
210
|
-
minRows: 4,
|
211
|
-
maxRows: 7
|
212
|
-
}
|
213
|
-
},
|
214
|
-
show: function show() {
|
215
|
-
var _servicesArray$index2, _servicesArray$index3;
|
216
|
-
return ((_servicesArray$index2 = servicesArray[index]) === null || _servicesArray$index2 === void 0 ? void 0 : (_servicesArray$index3 = _servicesArray$index2.list) === null || _servicesArray$index3 === void 0 ? void 0 : _servicesArray$index3.length) > 1;
|
217
|
-
}
|
218
|
-
}]
|
219
|
-
}
|
216
|
+
className: "pro-action-error-modal",
|
217
|
+
children: !contextRender ? _jsx(CheckModalContent, _objectSpread({}, errorModalData !== null && errorModalData !== void 0 ? errorModalData : {})) : renderContent()
|
220
218
|
}) : null]
|
221
219
|
});
|
222
220
|
};
|
package/es/ProAction/index.less
CHANGED
@@ -1,11 +1,10 @@
|
|
1
1
|
@root-entry-name: 'default';
|
2
2
|
@import (reference) '~antd/es/style/themes/index.less';
|
3
3
|
|
4
|
-
.pro-action-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
color: #000;
|
4
|
+
.pro-action-error-modal {
|
5
|
+
.ant-modal-content {
|
6
|
+
> div.ant-modal-body {
|
7
|
+
max-height: none;
|
8
|
+
}
|
10
9
|
}
|
11
10
|
}
|
@@ -13,32 +13,34 @@ export interface ProActionType {
|
|
13
13
|
title?: string | ReactNode;
|
14
14
|
/**
|
15
15
|
* @description 操作回调函数
|
16
|
-
* @param
|
16
|
+
* @param previousData 接上一个 useRequest 返回的值
|
17
17
|
* @param args 接所有链式 useRequest 返回的值
|
18
18
|
* @param index 当前操作的索引
|
19
19
|
* @returns void或Promise<void>
|
20
20
|
* @default -
|
21
21
|
*/
|
22
|
-
onAction?: (
|
22
|
+
onAction?: (previousData?: any, args?: any[], index?: number) => void | Promise<void>;
|
23
23
|
/**
|
24
24
|
* @description 自定义请求
|
25
|
-
* @param
|
25
|
+
* @param previousData 接上一个 useRequest 返回的值
|
26
26
|
* @param args 接所有链式 useRequest 返回的值
|
27
27
|
* @returns 包含service、options和transformResponse的对象
|
28
28
|
* @default -
|
29
29
|
*/
|
30
|
-
useRequest?: (
|
30
|
+
useRequest?: (previousData: any, args: any) => {
|
31
31
|
service?: Service<any, any>;
|
32
32
|
options?: Options<any, any>;
|
33
33
|
transformResponse?: (data: any) => any;
|
34
34
|
};
|
35
35
|
/**
|
36
36
|
* @description 是否中断链式操作
|
37
|
-
* @param
|
37
|
+
* @param previousData 上一个操作的返回数据
|
38
38
|
* @param args 所有链式的数据合集
|
39
39
|
* @returns 布尔值,返回true继续执行,返回false中断操作
|
40
40
|
* @default -
|
41
41
|
*/
|
42
|
-
continue?: (
|
42
|
+
continue?: (previousData: any, args: any[]) => boolean;
|
43
|
+
/** 自定义错误弹窗内容视图渲染 */
|
44
|
+
contextRender?: (data: any) => string | ReactNode;
|
43
45
|
}
|
44
46
|
export type ProActionProps = ProActionType;
|
@@ -0,0 +1,22 @@
|
|
1
|
+
.pro-action-check-modal-box .res-err-list .err-tip {
|
2
|
+
color: #666;
|
3
|
+
}
|
4
|
+
.pro-action-check-modal-box .res-err-list .err-item {
|
5
|
+
box-sizing: border-box;
|
6
|
+
padding-left: 6px;
|
7
|
+
color: #333;
|
8
|
+
border-radius: 4px;
|
9
|
+
}
|
10
|
+
.pro-action-check-modal-box .res-err-list .err-item:hover {
|
11
|
+
background-color: #f0f0f0;
|
12
|
+
}
|
13
|
+
.pro-action-check-modal-box .res-err-list .list-wrap {
|
14
|
+
box-sizing: border-box;
|
15
|
+
max-height: 50vh;
|
16
|
+
margin: 12px 0;
|
17
|
+
padding: 4px;
|
18
|
+
overflow-y: auto;
|
19
|
+
line-height: 1.8;
|
20
|
+
border: 1px solid #ccc;
|
21
|
+
border-radius: 6px;
|
22
|
+
}
|
@@ -0,0 +1,8 @@
|
|
1
|
+
import './index.less';
|
2
|
+
interface propsWithCheckModal {
|
3
|
+
errorTitle?: string;
|
4
|
+
list?: string[];
|
5
|
+
[key: string]: any;
|
6
|
+
}
|
7
|
+
declare const CheckModalContent: (props: propsWithCheckModal) => import("react/jsx-runtime").JSX.Element;
|
8
|
+
export default CheckModalContent;
|
@@ -0,0 +1,45 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.default = void 0;
|
7
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
8
|
+
require("./index.less");
|
9
|
+
/*
|
10
|
+
* @Author: za-xuwenli xuwenli@zhongan.io
|
11
|
+
* @Date: 2025-02-17 11:49:02
|
12
|
+
* @LastEditors: za-xuwenli xuwenli@zhongan.io
|
13
|
+
* @LastEditTime: 2025-05-29 13:55:34
|
14
|
+
* @FilePath: /zat-wjs-pro-product-web/src/components/CheckModalContent/index.tsx
|
15
|
+
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
|
16
|
+
*/
|
17
|
+
|
18
|
+
var CheckModalContent = function CheckModalContent(props) {
|
19
|
+
var _ref = props !== null && props !== void 0 ? props : {},
|
20
|
+
errorTitle = _ref.errorTitle,
|
21
|
+
_ref$list = _ref.list,
|
22
|
+
list = _ref$list === void 0 ? [] : _ref$list;
|
23
|
+
return (0, _jsxRuntime.jsx)("div", {
|
24
|
+
className: "pro-action-check-modal-box",
|
25
|
+
children: (0, _jsxRuntime.jsxs)("div", {
|
26
|
+
className: "res-err-list",
|
27
|
+
children: [(0, _jsxRuntime.jsx)("span", {
|
28
|
+
className: "err-tip",
|
29
|
+
children: errorTitle
|
30
|
+
}), Array.isArray(list) && list.length === 1 ? (0, _jsxRuntime.jsx)("span", {
|
31
|
+
className: "err-item",
|
32
|
+
children: list[0]
|
33
|
+
}) : null, Array.isArray(list) && list.length > 1 ? (0, _jsxRuntime.jsx)("div", {
|
34
|
+
className: "list-wrap",
|
35
|
+
children: list.map(function (item) {
|
36
|
+
return (0, _jsxRuntime.jsx)("div", {
|
37
|
+
className: "err-item",
|
38
|
+
children: item
|
39
|
+
});
|
40
|
+
})
|
41
|
+
}) : null]
|
42
|
+
})
|
43
|
+
});
|
44
|
+
};
|
45
|
+
var _default = exports.default = CheckModalContent;
|
@@ -0,0 +1,28 @@
|
|
1
|
+
.pro-action-check-modal-box {
|
2
|
+
.res-err-list {
|
3
|
+
.err-tip {
|
4
|
+
color: #666;
|
5
|
+
}
|
6
|
+
|
7
|
+
.err-item {
|
8
|
+
box-sizing: border-box;
|
9
|
+
padding-left: 6px;
|
10
|
+
color: #333;
|
11
|
+
border-radius: 4px;
|
12
|
+
&:hover {
|
13
|
+
background-color: #f0f0f0;
|
14
|
+
}
|
15
|
+
}
|
16
|
+
|
17
|
+
.list-wrap {
|
18
|
+
box-sizing: border-box;
|
19
|
+
max-height: 50vh;
|
20
|
+
margin: 12px 0;
|
21
|
+
padding: 4px;
|
22
|
+
overflow-y: auto;
|
23
|
+
line-height: 1.8;
|
24
|
+
border: 1px solid #ccc;
|
25
|
+
border-radius: 6px;
|
26
|
+
}
|
27
|
+
}
|
28
|
+
}
|
package/lib/ProAction/index.js
CHANGED
@@ -5,6 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
6
6
|
});
|
7
7
|
exports.default = void 0;
|
8
|
+
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
|
8
9
|
var _regeneratorRuntime2 = _interopRequireDefault(require("@babel/runtime/helpers/regeneratorRuntime"));
|
9
10
|
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
10
11
|
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
@@ -14,6 +15,7 @@ var _react = _interopRequireDefault(require("react"));
|
|
14
15
|
var _ahooks = require("ahooks");
|
15
16
|
var _antd = require("antd");
|
16
17
|
var _lodash = require("lodash");
|
18
|
+
var _CheckModalContent = _interopRequireDefault(require("./components/CheckModalContent"));
|
17
19
|
var _index = require("../index");
|
18
20
|
var _locale = _interopRequireDefault(require("../locale"));
|
19
21
|
require("./index.less");
|
@@ -28,7 +30,8 @@ var ProAction = function ProAction(props) {
|
|
28
30
|
index: 0,
|
29
31
|
open: false,
|
30
32
|
servicesArray: [],
|
31
|
-
loading: false
|
33
|
+
loading: false,
|
34
|
+
errorModalData: null
|
32
35
|
}),
|
33
36
|
_useSetState2 = (0, _slicedToArray2.default)(_useSetState, 2),
|
34
37
|
state = _useSetState2[0],
|
@@ -41,12 +44,12 @@ var ProAction = function ProAction(props) {
|
|
41
44
|
});
|
42
45
|
}
|
43
46
|
var index = state.index,
|
44
|
-
|
47
|
+
errorModalData = state.errorModalData;
|
45
48
|
var length = config.length;
|
46
49
|
var _onActionRun = /*#__PURE__*/function () {
|
47
50
|
var _ref = (0, _asyncToGenerator2.default)(/*#__PURE__*/(0, _regeneratorRuntime2.default)().mark(function _callee(currentIndex, array) {
|
48
51
|
var _actionProps$useReque, _options$defaultParam, _options$onSuccess, _newServicesArray$cur, _newServicesArray$cur2, _newServicesArray$cur3, _actionProps$onAction, _actionProps$continue;
|
49
|
-
var actionProps, newServicesArray, _ref2, service, options, transformResponse, params, res, data, open, _newServicesArray$cur4, _newServicesArray$cur5,
|
52
|
+
var actionProps, newServicesArray, _ref2, service, options, transformResponse, params, res, data, open, _newServicesArray$cur4, _newServicesArray$cur5, list, errorTitle, isContinue;
|
50
53
|
return (0, _regeneratorRuntime2.default)().wrap(function _callee$(_context) {
|
51
54
|
while (1) switch (_context.prev = _context.next) {
|
52
55
|
case 0:
|
@@ -103,7 +106,7 @@ var ProAction = function ProAction(props) {
|
|
103
106
|
if (!service) {
|
104
107
|
newServicesArray[currentIndex] = null;
|
105
108
|
}
|
106
|
-
open = (actionProps === null || actionProps === void 0 ? void 0 : actionProps.mode) === 'check' && ((_newServicesArray$cur = newServicesArray[currentIndex]) === null || _newServicesArray$cur === void 0 ? void 0 : _newServicesArray$cur.errorTitle)
|
109
|
+
open = (actionProps === null || actionProps === void 0 ? void 0 : actionProps.mode) === 'check' && (((_newServicesArray$cur = newServicesArray[currentIndex]) === null || _newServicesArray$cur === void 0 ? void 0 : _newServicesArray$cur.errorTitle) || ((_newServicesArray$cur2 = newServicesArray[currentIndex]) === null || _newServicesArray$cur2 === void 0 ? void 0 : (_newServicesArray$cur3 = _newServicesArray$cur2.list) === null || _newServicesArray$cur3 === void 0 ? void 0 : _newServicesArray$cur3.length));
|
107
110
|
setState({
|
108
111
|
servicesArray: newServicesArray,
|
109
112
|
index: currentIndex,
|
@@ -113,14 +116,15 @@ var ProAction = function ProAction(props) {
|
|
113
116
|
_context.next = 37;
|
114
117
|
break;
|
115
118
|
}
|
116
|
-
list = ((_newServicesArray$cur4 = newServicesArray[currentIndex]) === null || _newServicesArray$cur4 === void 0 ? void 0 :
|
117
|
-
errorTitle = (_newServicesArray$
|
119
|
+
list = ((_newServicesArray$cur4 = newServicesArray[currentIndex]) === null || _newServicesArray$cur4 === void 0 ? void 0 : _newServicesArray$cur4.list) || [];
|
120
|
+
errorTitle = (_newServicesArray$cur5 = newServicesArray[currentIndex]) === null || _newServicesArray$cur5 === void 0 ? void 0 : _newServicesArray$cur5.errorTitle;
|
118
121
|
form.setFieldsValue({
|
119
122
|
errorTitle: errorTitle,
|
120
123
|
list: list
|
121
124
|
});
|
122
125
|
setState({
|
123
|
-
loading: false
|
126
|
+
loading: false,
|
127
|
+
errorModalData: newServicesArray[currentIndex]
|
124
128
|
});
|
125
129
|
return _context.abrupt("return");
|
126
130
|
case 37:
|
@@ -168,6 +172,27 @@ var ProAction = function ProAction(props) {
|
|
168
172
|
open: false
|
169
173
|
});
|
170
174
|
};
|
175
|
+
var errorModalConfig = config === null || config === void 0 ? void 0 : config[index];
|
176
|
+
var _ref3 = errorModalConfig || {},
|
177
|
+
contextRender = _ref3.contextRender;
|
178
|
+
var renderContent = function renderContent() {
|
179
|
+
var TargetComponent = (0, _jsxRuntime.jsx)(_jsxRuntime.Fragment, {});
|
180
|
+
if (typeof contextRender === 'function') {
|
181
|
+
var View = contextRender(errorModalData);
|
182
|
+
TargetComponent = (0, _jsxRuntime.jsx)(_jsxRuntime.Fragment, {
|
183
|
+
children: View
|
184
|
+
});
|
185
|
+
} else if (typeof contextRender === 'string' || typeof contextRender === 'number') {
|
186
|
+
TargetComponent = (0, _jsxRuntime.jsx)(_jsxRuntime.Fragment, {
|
187
|
+
children: contextRender
|
188
|
+
});
|
189
|
+
} else if (/*#__PURE__*/_react.default.isValidElement(contextRender)) {
|
190
|
+
TargetComponent = (0, _jsxRuntime.jsx)(_jsxRuntime.Fragment, {
|
191
|
+
children: contextRender
|
192
|
+
});
|
193
|
+
}
|
194
|
+
return TargetComponent;
|
195
|
+
};
|
171
196
|
return (0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
172
197
|
children: [((_config$ = config[0]) === null || _config$ === void 0 ? void 0 : _config$.mode) === 'confirm' ? (0, _jsxRuntime.jsx)(_antd.Popconfirm, {
|
173
198
|
onConfirm: function onConfirm() {
|
@@ -180,8 +205,10 @@ var ProAction = function ProAction(props) {
|
|
180
205
|
mode: "Modal",
|
181
206
|
title: config === null || config === void 0 ? void 0 : (_config$index = config[index]) === null || _config$index === void 0 ? void 0 : _config$index.title,
|
182
207
|
onCancel: function onCancel() {
|
208
|
+
form.resetFields();
|
183
209
|
setState({
|
184
|
-
open: false
|
210
|
+
open: false,
|
211
|
+
errorModalData: null
|
185
212
|
});
|
186
213
|
},
|
187
214
|
modalProps: {
|
@@ -190,37 +217,8 @@ var ProAction = function ProAction(props) {
|
|
190
217
|
size: "small",
|
191
218
|
onOk: onOk,
|
192
219
|
form: form,
|
193
|
-
|
194
|
-
|
195
|
-
isView: true,
|
196
|
-
columns: [{
|
197
|
-
type: 'Input',
|
198
|
-
name: 'errorTitle',
|
199
|
-
viewRender: function viewRender(value) {
|
200
|
-
var _servicesArray$index;
|
201
|
-
var list = ((_servicesArray$index = servicesArray[index]) === null || _servicesArray$index === void 0 ? void 0 : _servicesArray$index.list) || [];
|
202
|
-
return (0, _jsxRuntime.jsxs)("div", {
|
203
|
-
className: "pro-action-view-tile",
|
204
|
-
children: [value, list.length === 1 ? (0, _jsxRuntime.jsxs)("span", {
|
205
|
-
children: [" ", list[0]]
|
206
|
-
}) : '']
|
207
|
-
});
|
208
|
-
}
|
209
|
-
}, {
|
210
|
-
type: 'TextArea',
|
211
|
-
name: 'list',
|
212
|
-
fieldProps: {
|
213
|
-
autoSize: {
|
214
|
-
minRows: 4,
|
215
|
-
maxRows: 7
|
216
|
-
}
|
217
|
-
},
|
218
|
-
show: function show() {
|
219
|
-
var _servicesArray$index2, _servicesArray$index3;
|
220
|
-
return ((_servicesArray$index2 = servicesArray[index]) === null || _servicesArray$index2 === void 0 ? void 0 : (_servicesArray$index3 = _servicesArray$index2.list) === null || _servicesArray$index3 === void 0 ? void 0 : _servicesArray$index3.length) > 1;
|
221
|
-
}
|
222
|
-
}]
|
223
|
-
}
|
220
|
+
className: "pro-action-error-modal",
|
221
|
+
children: !contextRender ? (0, _jsxRuntime.jsx)(_CheckModalContent.default, (0, _objectSpread2.default)({}, errorModalData !== null && errorModalData !== void 0 ? errorModalData : {})) : renderContent()
|
224
222
|
}) : null]
|
225
223
|
});
|
226
224
|
};
|
package/lib/ProAction/index.less
CHANGED
@@ -1,11 +1,10 @@
|
|
1
1
|
@root-entry-name: 'default';
|
2
2
|
@import (reference) '~antd/es/style/themes/index.less';
|
3
3
|
|
4
|
-
.pro-action-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
color: #000;
|
4
|
+
.pro-action-error-modal {
|
5
|
+
.ant-modal-content {
|
6
|
+
> div.ant-modal-body {
|
7
|
+
max-height: none;
|
8
|
+
}
|
10
9
|
}
|
11
10
|
}
|
@@ -13,32 +13,34 @@ export interface ProActionType {
|
|
13
13
|
title?: string | ReactNode;
|
14
14
|
/**
|
15
15
|
* @description 操作回调函数
|
16
|
-
* @param
|
16
|
+
* @param previousData 接上一个 useRequest 返回的值
|
17
17
|
* @param args 接所有链式 useRequest 返回的值
|
18
18
|
* @param index 当前操作的索引
|
19
19
|
* @returns void或Promise<void>
|
20
20
|
* @default -
|
21
21
|
*/
|
22
|
-
onAction?: (
|
22
|
+
onAction?: (previousData?: any, args?: any[], index?: number) => void | Promise<void>;
|
23
23
|
/**
|
24
24
|
* @description 自定义请求
|
25
|
-
* @param
|
25
|
+
* @param previousData 接上一个 useRequest 返回的值
|
26
26
|
* @param args 接所有链式 useRequest 返回的值
|
27
27
|
* @returns 包含service、options和transformResponse的对象
|
28
28
|
* @default -
|
29
29
|
*/
|
30
|
-
useRequest?: (
|
30
|
+
useRequest?: (previousData: any, args: any) => {
|
31
31
|
service?: Service<any, any>;
|
32
32
|
options?: Options<any, any>;
|
33
33
|
transformResponse?: (data: any) => any;
|
34
34
|
};
|
35
35
|
/**
|
36
36
|
* @description 是否中断链式操作
|
37
|
-
* @param
|
37
|
+
* @param previousData 上一个操作的返回数据
|
38
38
|
* @param args 所有链式的数据合集
|
39
39
|
* @returns 布尔值,返回true继续执行,返回false中断操作
|
40
40
|
* @default -
|
41
41
|
*/
|
42
|
-
continue?: (
|
42
|
+
continue?: (previousData: any, args: any[]) => boolean;
|
43
|
+
/** 自定义错误弹窗内容视图渲染 */
|
44
|
+
contextRender?: (data: any) => string | ReactNode;
|
43
45
|
}
|
44
46
|
export type ProActionProps = ProActionType;
|