@zat-design/sisyphus-react 3.11.8 → 3.11.9-beta.3
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 +9 -1
- package/aggregated_context.md +31670 -0
- package/es/ProDownload/utils.d.ts +15 -15
- package/es/ProDownload/utils.js +3 -1
- package/es/ProEditTable/index.js +9 -7
- package/es/ProEditTable/utils/config.js +39 -19
- package/es/ProForm/utils/useForm.js +13 -9
- package/es/ProLayout/components/Layout/Menu/OpenMenu/index.js +13 -7
- package/es/ProLayout/index.d.ts +1 -0
- package/es/ProLayout/index.js +2 -0
- package/es/ProLayout/propTypes.d.ts +7 -0
- package/lib/ProDownload/utils.d.ts +15 -15
- package/lib/ProDownload/utils.js +3 -1
- package/lib/ProEditTable/index.js +9 -7
- package/lib/ProEditTable/utils/config.js +39 -19
- package/lib/ProForm/utils/useForm.js +13 -9
- package/lib/ProLayout/components/Layout/Menu/OpenMenu/index.js +13 -7
- package/lib/ProLayout/index.d.ts +1 -0
- package/lib/ProLayout/index.js +2 -0
- package/lib/ProLayout/propTypes.d.ts +7 -0
- package/package.json +1 -1
- package/scripts/aggregateDocs.ts +94 -0
@@ -5,32 +5,32 @@ export interface PropsWithMakeFilePropsType {
|
|
5
5
|
}
|
6
6
|
export interface IDownloadRequestPropsType {
|
7
7
|
/**
|
8
|
-
|
9
|
-
|
10
|
-
|
8
|
+
* @description 下载请求的地址
|
9
|
+
* @default (必选)
|
10
|
+
*/
|
11
11
|
url: string;
|
12
12
|
/**
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
* @description 下载请求的类型
|
14
|
+
* @default post
|
15
|
+
*/
|
16
16
|
method?: 'post' | 'get';
|
17
17
|
/**
|
18
|
-
|
19
|
-
|
20
|
-
|
18
|
+
* @description 下载所需额外参数或返回上传额外参数的方法
|
19
|
+
* @default -
|
20
|
+
*/
|
21
21
|
params?: any;
|
22
22
|
headers?: any;
|
23
23
|
/** 格式化数据 */
|
24
24
|
transformResponse?: (data: any) => any;
|
25
25
|
/**
|
26
|
-
|
27
|
-
|
28
|
-
|
26
|
+
* @description service 执行完成时触发
|
27
|
+
* @default -
|
28
|
+
*/
|
29
29
|
onFinish?: (response: object, params: object) => void;
|
30
30
|
/**
|
31
|
-
|
32
|
-
|
33
|
-
|
31
|
+
* @description 下载保存的文件名
|
32
|
+
* @default (必选)
|
33
|
+
*/
|
34
34
|
fileName?: string;
|
35
35
|
/**
|
36
36
|
* @description 下载出错的回调
|
package/es/ProDownload/utils.js
CHANGED
@@ -64,7 +64,9 @@ export function getFilenameFromContentDisposition(contentDisposition) {
|
|
64
64
|
var matches = pattern.exec(contentDisposition);
|
65
65
|
if (matches && matches[1]) {
|
66
66
|
// remove double quotes if filename is quoted
|
67
|
-
|
67
|
+
// 解码
|
68
|
+
var decodeFilename = decodeURIComponent(matches[1]);
|
69
|
+
return decodeFilename.replace(/^"?(.+?)"?$/, '$1');
|
68
70
|
}
|
69
71
|
return null;
|
70
72
|
}
|
package/es/ProEditTable/index.js
CHANGED
@@ -189,12 +189,14 @@ var ProEditTable = function ProEditTable(_ref, ref) {
|
|
189
189
|
recursive: true
|
190
190
|
});
|
191
191
|
case 7:
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
192
|
+
if (current !== page.pageNum) {
|
193
|
+
setState({
|
194
|
+
page: {
|
195
|
+
pageNum: current,
|
196
|
+
pageSize: pageSize !== null && pageSize !== void 0 ? pageSize : page.pageSize
|
197
|
+
}
|
198
|
+
});
|
199
|
+
}
|
198
200
|
case 8:
|
199
201
|
_context.next = 13;
|
200
202
|
break;
|
@@ -439,7 +441,7 @@ var ProEditTable = function ProEditTable(_ref, ref) {
|
|
439
441
|
className: "pro-edit-table-footer",
|
440
442
|
children: footerRender
|
441
443
|
}) : null, pagination ? _jsx("div", {
|
442
|
-
id: "pro-edit-table-pagination",
|
444
|
+
id: "pro-edit-table-pagination-".concat(config.name.join('-')),
|
443
445
|
onClick: function onClick() {
|
444
446
|
onPageCheck({
|
445
447
|
form: form,
|
@@ -167,20 +167,20 @@ export var actions = {
|
|
167
167
|
}
|
168
168
|
},
|
169
169
|
add: function () {
|
170
|
-
var _add = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function
|
170
|
+
var _add = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee4(_ref5) {
|
171
171
|
var _tableRef$current$que, _tableRef$current$que2;
|
172
172
|
var result, insertType, editingKeys, setState, form, name, virtualName, virtualKey, onlyOneLineMsg, tableRef, _ref5$prefixCls, prefixCls, page, handlePageChange, nextData, rowKey, addData, nextPageNum, nextEditingKeys;
|
173
|
-
return _regeneratorRuntime().wrap(function
|
174
|
-
while (1) switch (
|
173
|
+
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
174
|
+
while (1) switch (_context4.prev = _context4.next) {
|
175
175
|
case 0:
|
176
176
|
result = _ref5.result, insertType = _ref5.insertType, editingKeys = _ref5.editingKeys, setState = _ref5.setState, form = _ref5.form, name = _ref5.name, virtualName = _ref5.virtualName, virtualKey = _ref5.virtualKey, onlyOneLineMsg = _ref5.onlyOneLineMsg, tableRef = _ref5.tableRef, _ref5$prefixCls = _ref5.prefixCls, prefixCls = _ref5$prefixCls === void 0 ? 'ant' : _ref5$prefixCls, page = _ref5.page, handlePageChange = _ref5.handlePageChange;
|
177
177
|
nextData = _toConsumableArray(form.getFieldValue(name) || []); // 单行编辑时,需要先保存,才能进行下面的编辑
|
178
178
|
if (!(virtualKey && editingKeys.length >= 1)) {
|
179
|
-
|
179
|
+
_context4.next = 5;
|
180
180
|
break;
|
181
181
|
}
|
182
182
|
_message.warning(onlyOneLineMsg);
|
183
|
-
return
|
183
|
+
return _context4.abrupt("return", false);
|
184
184
|
case 5:
|
185
185
|
rowKey = getRandom(); // 添加新增对象数据
|
186
186
|
addData = _objectSpread(_objectSpread({}, _typeof(result) === 'object' ? result : {}), {}, {
|
@@ -192,11 +192,31 @@ export var actions = {
|
|
192
192
|
}
|
193
193
|
if (insertType === 'before') {
|
194
194
|
nextData.unshift(addData);
|
195
|
-
|
195
|
+
setTimeout(/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
|
196
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
197
|
+
while (1) switch (_context2.prev = _context2.next) {
|
198
|
+
case 0:
|
199
|
+
handlePageChange(1, page.pageSize);
|
200
|
+
case 1:
|
201
|
+
case "end":
|
202
|
+
return _context2.stop();
|
203
|
+
}
|
204
|
+
}, _callee2);
|
205
|
+
})), 0);
|
196
206
|
} else {
|
197
207
|
nextData.push(addData);
|
198
208
|
nextPageNum = Math.ceil(tools.calc(nextData.length, '/', page.pageSize));
|
199
|
-
|
209
|
+
setTimeout(/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
|
210
|
+
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
211
|
+
while (1) switch (_context3.prev = _context3.next) {
|
212
|
+
case 0:
|
213
|
+
handlePageChange(nextPageNum, page.pageSize);
|
214
|
+
case 1:
|
215
|
+
case "end":
|
216
|
+
return _context3.stop();
|
217
|
+
}
|
218
|
+
}, _callee3);
|
219
|
+
})), 0);
|
200
220
|
}
|
201
221
|
// 当单选情况下,存储正在编辑值
|
202
222
|
if (virtualKey) {
|
@@ -213,30 +233,30 @@ export var actions = {
|
|
213
233
|
behavior: 'smooth'
|
214
234
|
});
|
215
235
|
if (!virtualKey) {
|
216
|
-
|
236
|
+
_context4.next = 15;
|
217
237
|
break;
|
218
238
|
}
|
219
|
-
|
239
|
+
_context4.next = 15;
|
220
240
|
return form.validateFields([name]);
|
221
241
|
case 15:
|
222
242
|
case "end":
|
223
|
-
return
|
243
|
+
return _context4.stop();
|
224
244
|
}
|
225
|
-
},
|
245
|
+
}, _callee4);
|
226
246
|
}));
|
227
247
|
function add(_x2) {
|
228
248
|
return _add.apply(this, arguments);
|
229
249
|
}
|
230
250
|
return add;
|
231
251
|
}(),
|
232
|
-
mulDelete: function mulDelete(
|
233
|
-
var form =
|
234
|
-
name =
|
235
|
-
virtualKey =
|
236
|
-
setState =
|
237
|
-
selectedRowKeys =
|
238
|
-
|
239
|
-
editingKeys =
|
252
|
+
mulDelete: function mulDelete(_ref8) {
|
253
|
+
var form = _ref8.form,
|
254
|
+
name = _ref8.name,
|
255
|
+
virtualKey = _ref8.virtualKey,
|
256
|
+
setState = _ref8.setState,
|
257
|
+
selectedRowKeys = _ref8.selectedRowKeys,
|
258
|
+
_ref8$editingKeys = _ref8.editingKeys,
|
259
|
+
editingKeys = _ref8$editingKeys === void 0 ? [] : _ref8$editingKeys;
|
240
260
|
// 删除选中数据
|
241
261
|
onDelete({
|
242
262
|
name: name,
|
@@ -57,6 +57,7 @@ export var useForm = function useForm(originForm, options) {
|
|
57
57
|
_form$getInternalHook,
|
58
58
|
getFields,
|
59
59
|
fieldsList,
|
60
|
+
_document,
|
60
61
|
tablePagination,
|
61
62
|
_tablePagination$clic,
|
62
63
|
_error$errorFields,
|
@@ -97,18 +98,21 @@ export var useForm = function useForm(originForm, options) {
|
|
97
98
|
case 11:
|
98
99
|
return _context.abrupt("return", _context.sent);
|
99
100
|
case 12:
|
100
|
-
|
101
|
-
if (
|
102
|
-
tablePagination
|
101
|
+
// 解决,单个pro-edit-table的表单校验
|
102
|
+
if ((nameList === null || nameList === void 0 ? void 0 : nameList.length) && !nameList.join('-').includes(',')) {
|
103
|
+
tablePagination = document && ((_document = document) === null || _document === void 0 ? void 0 : _document.querySelector("#pro-edit-table-pagination-".concat(nameList.join('-'))));
|
104
|
+
if (tablePagination) {
|
105
|
+
tablePagination === null || tablePagination === void 0 ? void 0 : (_tablePagination$clic = tablePagination.click) === null || _tablePagination$clic === void 0 ? void 0 : _tablePagination$clic.call(tablePagination);
|
106
|
+
}
|
103
107
|
}
|
104
|
-
_context.next =
|
108
|
+
_context.next = 15;
|
105
109
|
return validateFields.apply(void 0, [nameList].concat(rest)).then(function (values) {
|
106
110
|
return nameList ? values : _getFieldsValue();
|
107
111
|
});
|
108
|
-
case
|
112
|
+
case 15:
|
109
113
|
return _context.abrupt("return", _context.sent);
|
110
|
-
case
|
111
|
-
_context.prev =
|
114
|
+
case 18:
|
115
|
+
_context.prev = 18;
|
112
116
|
_context.t0 = _context["catch"](0);
|
113
117
|
if (scrollToError && (_context.t0 === null || _context.t0 === void 0 ? void 0 : (_error$errorFields = _context.t0.errorFields) === null || _error$errorFields === void 0 ? void 0 : _error$errorFields.length)) {
|
114
118
|
form.scrollToField((_error$errorFields$ = _context.t0.errorFields[0]) === null || _error$errorFields$ === void 0 ? void 0 : _error$errorFields$.name, {
|
@@ -118,11 +122,11 @@ export var useForm = function useForm(originForm, options) {
|
|
118
122
|
}
|
119
123
|
handleScrollToError();
|
120
124
|
throw _context.t0;
|
121
|
-
case
|
125
|
+
case 23:
|
122
126
|
case "end":
|
123
127
|
return _context.stop();
|
124
128
|
}
|
125
|
-
}, _callee, null, [[0,
|
129
|
+
}, _callee, null, [[0, 18]]);
|
126
130
|
}));
|
127
131
|
return function _validateFields(_x) {
|
128
132
|
return _ref2.apply(this, arguments);
|
@@ -37,7 +37,8 @@ var OpenMenu = function OpenMenu(props) {
|
|
37
37
|
setState = _useSetState2[1];
|
38
38
|
var query = new URLSearchParams(window.location.search);
|
39
39
|
var _useContext = useContext(LayoutContext),
|
40
|
-
onSelected = _useContext.onSelected
|
40
|
+
onSelected = _useContext.onSelected,
|
41
|
+
target = _useContext.target;
|
41
42
|
var cls = classnames(_defineProperty({
|
42
43
|
'pro-layout-open-menu': true
|
43
44
|
}, "".concat(className), className));
|
@@ -149,12 +150,17 @@ var OpenMenu = function OpenMenu(props) {
|
|
149
150
|
onSelected({
|
150
151
|
selectedPath: item === null || item === void 0 ? void 0 : (_item$props2 = item.props) === null || _item$props2 === void 0 ? void 0 : _item$props2.router
|
151
152
|
});
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
153
|
+
if (target) {
|
154
|
+
var _item$props3;
|
155
|
+
window.open(item === null || item === void 0 ? void 0 : (_item$props3 = item.props) === null || _item$props3 === void 0 ? void 0 : _item$props3.router, target);
|
156
|
+
} else {
|
157
|
+
setTimeout(function () {
|
158
|
+
// 路由变更,且不再demo文档中
|
159
|
+
if (!window.location.href.includes('~demos/prolayout')) {
|
160
|
+
linkRef.current.click();
|
161
|
+
}
|
162
|
+
}, 100);
|
163
|
+
}
|
158
164
|
},
|
159
165
|
style: {
|
160
166
|
height: dataSource.sideMenu ? 'auto' : "calc(100vh - ".concat((dataSource === null || dataSource === void 0 ? void 0 : dataSource.height) || 0, "px)"),
|
package/es/ProLayout/index.d.ts
CHANGED
@@ -3,6 +3,7 @@ import type { ProLayoutProps } from './propTypes';
|
|
3
3
|
export declare const LayoutContext: import("react").Context<{
|
4
4
|
selectedPath: string;
|
5
5
|
onSelected: (params: any) => void;
|
6
|
+
target: '_blank' | '_parent' | '_self' | '_top';
|
6
7
|
}>;
|
7
8
|
declare const ProLayout: {
|
8
9
|
(props: ProLayoutProps): import("react/jsx-runtime").JSX.Element;
|
package/es/ProLayout/index.js
CHANGED
@@ -29,6 +29,7 @@ var ProLayout = function ProLayout(props) {
|
|
29
29
|
_props$pathPrefix = props.pathPrefix,
|
30
30
|
pathPrefix = _props$pathPrefix === void 0 ? '' : _props$pathPrefix,
|
31
31
|
theme = props.theme,
|
32
|
+
target = props.target,
|
32
33
|
onCollapsedChange = props.onCollapsedChange;
|
33
34
|
var _useSetState = useSetState({
|
34
35
|
notice: headerNotice || noticeIn,
|
@@ -108,6 +109,7 @@ var ProLayout = function ProLayout(props) {
|
|
108
109
|
return _jsx(LayoutContext.Provider, {
|
109
110
|
value: {
|
110
111
|
selectedPath: selectedPath,
|
112
|
+
target: target,
|
111
113
|
onSelected: setState
|
112
114
|
},
|
113
115
|
children: !((_Object$keys = Object.keys(waterMarkProps)) === null || _Object$keys === void 0 ? void 0 : _Object$keys.length) ? layoutDom : _jsx(ProWaterMark, _objectSpread(_objectSpread({}, waterMarkProps), {}, {
|
@@ -59,6 +59,13 @@ export interface ProLayoutProps {
|
|
59
59
|
* 折叠回调事件
|
60
60
|
*/
|
61
61
|
onCollapsedChange?: (collapsed: any) => void;
|
62
|
+
/** 规定在何处打开被链接文档
|
63
|
+
* _blank
|
64
|
+
* _parent
|
65
|
+
* _self
|
66
|
+
* _top
|
67
|
+
*/
|
68
|
+
target?: '_blank' | '_parent' | '_self' | '_top';
|
62
69
|
[key: string]: any;
|
63
70
|
}
|
64
71
|
export interface ProLayoutStates {
|
@@ -5,32 +5,32 @@ export interface PropsWithMakeFilePropsType {
|
|
5
5
|
}
|
6
6
|
export interface IDownloadRequestPropsType {
|
7
7
|
/**
|
8
|
-
|
9
|
-
|
10
|
-
|
8
|
+
* @description 下载请求的地址
|
9
|
+
* @default (必选)
|
10
|
+
*/
|
11
11
|
url: string;
|
12
12
|
/**
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
* @description 下载请求的类型
|
14
|
+
* @default post
|
15
|
+
*/
|
16
16
|
method?: 'post' | 'get';
|
17
17
|
/**
|
18
|
-
|
19
|
-
|
20
|
-
|
18
|
+
* @description 下载所需额外参数或返回上传额外参数的方法
|
19
|
+
* @default -
|
20
|
+
*/
|
21
21
|
params?: any;
|
22
22
|
headers?: any;
|
23
23
|
/** 格式化数据 */
|
24
24
|
transformResponse?: (data: any) => any;
|
25
25
|
/**
|
26
|
-
|
27
|
-
|
28
|
-
|
26
|
+
* @description service 执行完成时触发
|
27
|
+
* @default -
|
28
|
+
*/
|
29
29
|
onFinish?: (response: object, params: object) => void;
|
30
30
|
/**
|
31
|
-
|
32
|
-
|
33
|
-
|
31
|
+
* @description 下载保存的文件名
|
32
|
+
* @default (必选)
|
33
|
+
*/
|
34
34
|
fileName?: string;
|
35
35
|
/**
|
36
36
|
* @description 下载出错的回调
|
package/lib/ProDownload/utils.js
CHANGED
@@ -73,7 +73,9 @@ function getFilenameFromContentDisposition(contentDisposition) {
|
|
73
73
|
var matches = pattern.exec(contentDisposition);
|
74
74
|
if (matches && matches[1]) {
|
75
75
|
// remove double quotes if filename is quoted
|
76
|
-
|
76
|
+
// 解码
|
77
|
+
var decodeFilename = decodeURIComponent(matches[1]);
|
78
|
+
return decodeFilename.replace(/^"?(.+?)"?$/, '$1');
|
77
79
|
}
|
78
80
|
return null;
|
79
81
|
}
|
@@ -192,12 +192,14 @@ var ProEditTable = function ProEditTable(_ref, ref) {
|
|
192
192
|
recursive: true
|
193
193
|
});
|
194
194
|
case 7:
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
195
|
+
if (current !== page.pageNum) {
|
196
|
+
setState({
|
197
|
+
page: {
|
198
|
+
pageNum: current,
|
199
|
+
pageSize: pageSize !== null && pageSize !== void 0 ? pageSize : page.pageSize
|
200
|
+
}
|
201
|
+
});
|
202
|
+
}
|
201
203
|
case 8:
|
202
204
|
_context.next = 13;
|
203
205
|
break;
|
@@ -442,7 +444,7 @@ var ProEditTable = function ProEditTable(_ref, ref) {
|
|
442
444
|
className: "pro-edit-table-footer",
|
443
445
|
children: footerRender
|
444
446
|
}) : null, pagination ? (0, _jsxRuntime.jsx)("div", {
|
445
|
-
id: "pro-edit-table-pagination",
|
447
|
+
id: "pro-edit-table-pagination-".concat(config.name.join('-')),
|
446
448
|
onClick: function onClick() {
|
447
449
|
(0, _tools.onPageCheck)({
|
448
450
|
form: form,
|
@@ -173,20 +173,20 @@ var actions = exports.actions = {
|
|
173
173
|
}
|
174
174
|
},
|
175
175
|
add: function () {
|
176
|
-
var _add = (0, _asyncToGenerator2.default)(/*#__PURE__*/(0, _regeneratorRuntime2.default)().mark(function
|
176
|
+
var _add = (0, _asyncToGenerator2.default)(/*#__PURE__*/(0, _regeneratorRuntime2.default)().mark(function _callee4(_ref5) {
|
177
177
|
var _tableRef$current$que, _tableRef$current$que2;
|
178
178
|
var result, insertType, editingKeys, setState, form, name, virtualName, virtualKey, onlyOneLineMsg, tableRef, _ref5$prefixCls, prefixCls, page, handlePageChange, nextData, rowKey, addData, nextPageNum, nextEditingKeys;
|
179
|
-
return (0, _regeneratorRuntime2.default)().wrap(function
|
180
|
-
while (1) switch (
|
179
|
+
return (0, _regeneratorRuntime2.default)().wrap(function _callee4$(_context4) {
|
180
|
+
while (1) switch (_context4.prev = _context4.next) {
|
181
181
|
case 0:
|
182
182
|
result = _ref5.result, insertType = _ref5.insertType, editingKeys = _ref5.editingKeys, setState = _ref5.setState, form = _ref5.form, name = _ref5.name, virtualName = _ref5.virtualName, virtualKey = _ref5.virtualKey, onlyOneLineMsg = _ref5.onlyOneLineMsg, tableRef = _ref5.tableRef, _ref5$prefixCls = _ref5.prefixCls, prefixCls = _ref5$prefixCls === void 0 ? 'ant' : _ref5$prefixCls, page = _ref5.page, handlePageChange = _ref5.handlePageChange;
|
183
183
|
nextData = (0, _toConsumableArray2.default)(form.getFieldValue(name) || []); // 单行编辑时,需要先保存,才能进行下面的编辑
|
184
184
|
if (!(virtualKey && editingKeys.length >= 1)) {
|
185
|
-
|
185
|
+
_context4.next = 5;
|
186
186
|
break;
|
187
187
|
}
|
188
188
|
_antd.message.warning(onlyOneLineMsg);
|
189
|
-
return
|
189
|
+
return _context4.abrupt("return", false);
|
190
190
|
case 5:
|
191
191
|
rowKey = (0, _tools.getRandom)(); // 添加新增对象数据
|
192
192
|
addData = (0, _objectSpread2.default)((0, _objectSpread2.default)({}, (0, _typeof2.default)(result) === 'object' ? result : {}), {}, {
|
@@ -198,11 +198,31 @@ var actions = exports.actions = {
|
|
198
198
|
}
|
199
199
|
if (insertType === 'before') {
|
200
200
|
nextData.unshift(addData);
|
201
|
-
|
201
|
+
setTimeout(/*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/(0, _regeneratorRuntime2.default)().mark(function _callee2() {
|
202
|
+
return (0, _regeneratorRuntime2.default)().wrap(function _callee2$(_context2) {
|
203
|
+
while (1) switch (_context2.prev = _context2.next) {
|
204
|
+
case 0:
|
205
|
+
handlePageChange(1, page.pageSize);
|
206
|
+
case 1:
|
207
|
+
case "end":
|
208
|
+
return _context2.stop();
|
209
|
+
}
|
210
|
+
}, _callee2);
|
211
|
+
})), 0);
|
202
212
|
} else {
|
203
213
|
nextData.push(addData);
|
204
214
|
nextPageNum = Math.ceil(_utils.tools.calc(nextData.length, '/', page.pageSize));
|
205
|
-
|
215
|
+
setTimeout(/*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/(0, _regeneratorRuntime2.default)().mark(function _callee3() {
|
216
|
+
return (0, _regeneratorRuntime2.default)().wrap(function _callee3$(_context3) {
|
217
|
+
while (1) switch (_context3.prev = _context3.next) {
|
218
|
+
case 0:
|
219
|
+
handlePageChange(nextPageNum, page.pageSize);
|
220
|
+
case 1:
|
221
|
+
case "end":
|
222
|
+
return _context3.stop();
|
223
|
+
}
|
224
|
+
}, _callee3);
|
225
|
+
})), 0);
|
206
226
|
}
|
207
227
|
// 当单选情况下,存储正在编辑值
|
208
228
|
if (virtualKey) {
|
@@ -219,30 +239,30 @@ var actions = exports.actions = {
|
|
219
239
|
behavior: 'smooth'
|
220
240
|
});
|
221
241
|
if (!virtualKey) {
|
222
|
-
|
242
|
+
_context4.next = 15;
|
223
243
|
break;
|
224
244
|
}
|
225
|
-
|
245
|
+
_context4.next = 15;
|
226
246
|
return form.validateFields([name]);
|
227
247
|
case 15:
|
228
248
|
case "end":
|
229
|
-
return
|
249
|
+
return _context4.stop();
|
230
250
|
}
|
231
|
-
},
|
251
|
+
}, _callee4);
|
232
252
|
}));
|
233
253
|
function add(_x2) {
|
234
254
|
return _add.apply(this, arguments);
|
235
255
|
}
|
236
256
|
return add;
|
237
257
|
}(),
|
238
|
-
mulDelete: function mulDelete(
|
239
|
-
var form =
|
240
|
-
name =
|
241
|
-
virtualKey =
|
242
|
-
setState =
|
243
|
-
selectedRowKeys =
|
244
|
-
|
245
|
-
editingKeys =
|
258
|
+
mulDelete: function mulDelete(_ref8) {
|
259
|
+
var form = _ref8.form,
|
260
|
+
name = _ref8.name,
|
261
|
+
virtualKey = _ref8.virtualKey,
|
262
|
+
setState = _ref8.setState,
|
263
|
+
selectedRowKeys = _ref8.selectedRowKeys,
|
264
|
+
_ref8$editingKeys = _ref8.editingKeys,
|
265
|
+
editingKeys = _ref8$editingKeys === void 0 ? [] : _ref8$editingKeys;
|
246
266
|
// 删除选中数据
|
247
267
|
(0, _tools.onDelete)({
|
248
268
|
name: name,
|
@@ -63,6 +63,7 @@ var useForm = exports.useForm = function useForm(originForm, options) {
|
|
63
63
|
_form$getInternalHook,
|
64
64
|
getFields,
|
65
65
|
fieldsList,
|
66
|
+
_document,
|
66
67
|
tablePagination,
|
67
68
|
_tablePagination$clic,
|
68
69
|
_error$errorFields,
|
@@ -103,18 +104,21 @@ var useForm = exports.useForm = function useForm(originForm, options) {
|
|
103
104
|
case 11:
|
104
105
|
return _context.abrupt("return", _context.sent);
|
105
106
|
case 12:
|
106
|
-
|
107
|
-
if (
|
108
|
-
tablePagination
|
107
|
+
// 解决,单个pro-edit-table的表单校验
|
108
|
+
if ((nameList === null || nameList === void 0 ? void 0 : nameList.length) && !nameList.join('-').includes(',')) {
|
109
|
+
tablePagination = document && ((_document = document) === null || _document === void 0 ? void 0 : _document.querySelector("#pro-edit-table-pagination-".concat(nameList.join('-'))));
|
110
|
+
if (tablePagination) {
|
111
|
+
tablePagination === null || tablePagination === void 0 ? void 0 : (_tablePagination$clic = tablePagination.click) === null || _tablePagination$clic === void 0 ? void 0 : _tablePagination$clic.call(tablePagination);
|
112
|
+
}
|
109
113
|
}
|
110
|
-
_context.next =
|
114
|
+
_context.next = 15;
|
111
115
|
return validateFields.apply(void 0, [nameList].concat(rest)).then(function (values) {
|
112
116
|
return nameList ? values : _getFieldsValue();
|
113
117
|
});
|
114
|
-
case
|
118
|
+
case 15:
|
115
119
|
return _context.abrupt("return", _context.sent);
|
116
|
-
case
|
117
|
-
_context.prev =
|
120
|
+
case 18:
|
121
|
+
_context.prev = 18;
|
118
122
|
_context.t0 = _context["catch"](0);
|
119
123
|
if (scrollToError && (_context.t0 === null || _context.t0 === void 0 ? void 0 : (_error$errorFields = _context.t0.errorFields) === null || _error$errorFields === void 0 ? void 0 : _error$errorFields.length)) {
|
120
124
|
form.scrollToField((_error$errorFields$ = _context.t0.errorFields[0]) === null || _error$errorFields$ === void 0 ? void 0 : _error$errorFields$.name, {
|
@@ -124,11 +128,11 @@ var useForm = exports.useForm = function useForm(originForm, options) {
|
|
124
128
|
}
|
125
129
|
(0, _tools.handleScrollToError)();
|
126
130
|
throw _context.t0;
|
127
|
-
case
|
131
|
+
case 23:
|
128
132
|
case "end":
|
129
133
|
return _context.stop();
|
130
134
|
}
|
131
|
-
}, _callee, null, [[0,
|
135
|
+
}, _callee, null, [[0, 18]]);
|
132
136
|
}));
|
133
137
|
return function _validateFields(_x) {
|
134
138
|
return _ref2.apply(this, arguments);
|
@@ -43,7 +43,8 @@ var OpenMenu = function OpenMenu(props) {
|
|
43
43
|
setState = _useSetState2[1];
|
44
44
|
var query = new URLSearchParams(window.location.search);
|
45
45
|
var _useContext = (0, _react.useContext)(_index.LayoutContext),
|
46
|
-
onSelected = _useContext.onSelected
|
46
|
+
onSelected = _useContext.onSelected,
|
47
|
+
target = _useContext.target;
|
47
48
|
var cls = (0, _classnames2.default)((0, _defineProperty2.default)({
|
48
49
|
'pro-layout-open-menu': true
|
49
50
|
}, "".concat(className), className));
|
@@ -155,12 +156,17 @@ var OpenMenu = function OpenMenu(props) {
|
|
155
156
|
onSelected({
|
156
157
|
selectedPath: item === null || item === void 0 ? void 0 : (_item$props2 = item.props) === null || _item$props2 === void 0 ? void 0 : _item$props2.router
|
157
158
|
});
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
159
|
+
if (target) {
|
160
|
+
var _item$props3;
|
161
|
+
window.open(item === null || item === void 0 ? void 0 : (_item$props3 = item.props) === null || _item$props3 === void 0 ? void 0 : _item$props3.router, target);
|
162
|
+
} else {
|
163
|
+
setTimeout(function () {
|
164
|
+
// 路由变更,且不再demo文档中
|
165
|
+
if (!window.location.href.includes('~demos/prolayout')) {
|
166
|
+
linkRef.current.click();
|
167
|
+
}
|
168
|
+
}, 100);
|
169
|
+
}
|
164
170
|
},
|
165
171
|
style: {
|
166
172
|
height: dataSource.sideMenu ? 'auto' : "calc(100vh - ".concat((dataSource === null || dataSource === void 0 ? void 0 : dataSource.height) || 0, "px)"),
|
package/lib/ProLayout/index.d.ts
CHANGED
@@ -3,6 +3,7 @@ import type { ProLayoutProps } from './propTypes';
|
|
3
3
|
export declare const LayoutContext: import("react").Context<{
|
4
4
|
selectedPath: string;
|
5
5
|
onSelected: (params: any) => void;
|
6
|
+
target: '_blank' | '_parent' | '_self' | '_top';
|
6
7
|
}>;
|
7
8
|
declare const ProLayout: {
|
8
9
|
(props: ProLayoutProps): import("react/jsx-runtime").JSX.Element;
|
package/lib/ProLayout/index.js
CHANGED
@@ -35,6 +35,7 @@ var ProLayout = function ProLayout(props) {
|
|
35
35
|
_props$pathPrefix = props.pathPrefix,
|
36
36
|
pathPrefix = _props$pathPrefix === void 0 ? '' : _props$pathPrefix,
|
37
37
|
theme = props.theme,
|
38
|
+
target = props.target,
|
38
39
|
onCollapsedChange = props.onCollapsedChange;
|
39
40
|
var _useSetState = (0, _ahooks.useSetState)({
|
40
41
|
notice: headerNotice || noticeIn,
|
@@ -114,6 +115,7 @@ var ProLayout = function ProLayout(props) {
|
|
114
115
|
return (0, _jsxRuntime.jsx)(LayoutContext.Provider, {
|
115
116
|
value: {
|
116
117
|
selectedPath: selectedPath,
|
118
|
+
target: target,
|
117
119
|
onSelected: setState
|
118
120
|
},
|
119
121
|
children: !((_Object$keys = Object.keys(waterMarkProps)) === null || _Object$keys === void 0 ? void 0 : _Object$keys.length) ? layoutDom : (0, _jsxRuntime.jsx)(_index.ProWaterMark, (0, _objectSpread2.default)((0, _objectSpread2.default)({}, waterMarkProps), {}, {
|
@@ -59,6 +59,13 @@ export interface ProLayoutProps {
|
|
59
59
|
* 折叠回调事件
|
60
60
|
*/
|
61
61
|
onCollapsedChange?: (collapsed: any) => void;
|
62
|
+
/** 规定在何处打开被链接文档
|
63
|
+
* _blank
|
64
|
+
* _parent
|
65
|
+
* _self
|
66
|
+
* _top
|
67
|
+
*/
|
68
|
+
target?: '_blank' | '_parent' | '_self' | '_top';
|
62
69
|
[key: string]: any;
|
63
70
|
}
|
64
71
|
export interface ProLayoutStates {
|