@zat-design/sisyphus-react 3.11.9 → 3.11.11-beta.1
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/es/ProEditTable/index.js +9 -7
- package/es/ProEditTable/utils/config.js +39 -19
- package/es/ProForm/components/combination/ProModalSelect/index.js +4 -3
- 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/ProEditTable/index.js +9 -7
- package/lib/ProEditTable/utils/config.js +39 -19
- package/lib/ProForm/components/combination/ProModalSelect/index.js +22 -21
- 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/.vscode/extensions.json +0 -5
package/README.md
CHANGED
@@ -104,4 +104,12 @@ npm publish --registry https://registry.npmjs.org --access=public
|
|
104
104
|
"registry": "https://npm.zhonganinfo.com"
|
105
105
|
},
|
106
106
|
```
|
107
|
-
2. 之后使用 `npm publish` 发布, 如果提示登录使用域账号登录
|
107
|
+
2. 之后使用 `npm publish` 发布, 如果提示登录使用域账号登录
|
108
|
+
|
109
|
+
|
110
|
+
### 聚合 docs 下所有 Markdown 文件内容
|
111
|
+
|
112
|
+
```
|
113
|
+
node scripts/aggregateDocs.ts
|
114
|
+
```
|
115
|
+
|
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,
|
@@ -661,8 +661,9 @@ var ProModalSelect = function ProModalSelect(props, ref) {
|
|
661
661
|
if (value && !visible && readOnly && (!isEqual(value, preValue.current) || (options === null || options === void 0 ? void 0 : options.length) === 0)) {
|
662
662
|
var _options$some;
|
663
663
|
preValue.current = value;
|
664
|
+
var _data3 = labelInValue ? value[valueKey] : value;
|
664
665
|
var isHasValue = options === null || options === void 0 ? void 0 : (_options$some = options.some) === null || _options$some === void 0 ? void 0 : _options$some.call(options, function (item) {
|
665
|
-
return item[valueKey] ===
|
666
|
+
return item[valueKey] === _data3;
|
666
667
|
});
|
667
668
|
if (isHasValue) {
|
668
669
|
return;
|
@@ -673,8 +674,8 @@ var ProModalSelect = function ProModalSelect(props, ref) {
|
|
673
674
|
var params = withPagination ? {
|
674
675
|
pageNum: 1,
|
675
676
|
pageSize: 50,
|
676
|
-
queryBean: _objectSpread(_objectSpread({}, defaultParams), initParams)
|
677
|
-
} : _objectSpread(_objectSpread({}, defaultParams), initParams);
|
677
|
+
queryBean: _objectSpread(_objectSpread(_objectSpread({}, defaultParams), initParams), {}, _defineProperty({}, searchKey !== null && searchKey !== void 0 ? searchKey : valueKey, _data3))
|
678
|
+
} : _objectSpread(_objectSpread(_objectSpread({}, defaultParams), initParams), {}, _defineProperty({}, searchKey !== null && searchKey !== void 0 ? searchKey : valueKey, _data3));
|
678
679
|
var nextParams = transformParams ? transformParams(params) : params;
|
679
680
|
run(nextParams);
|
680
681
|
}, 300);
|
@@ -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 {
|
@@ -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,
|
@@ -10,7 +10,7 @@ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/de
|
|
10
10
|
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
11
11
|
var _regeneratorRuntime2 = _interopRequireDefault(require("@babel/runtime/helpers/regeneratorRuntime"));
|
12
12
|
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
13
|
-
var
|
13
|
+
var _objectSpread5 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
|
14
14
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
15
15
|
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
16
16
|
var _jsxRuntime = require("react/jsx-runtime");
|
@@ -134,7 +134,7 @@ var ProModalSelect = function ProModalSelect(props, ref) {
|
|
134
134
|
withPagination: withPagination,
|
135
135
|
transformParams: transformParams,
|
136
136
|
transformResponse: transformResponse
|
137
|
-
}, (0,
|
137
|
+
}, (0, _objectSpread5.default)((0, _objectSpread5.default)({}, useRequest === null || useRequest === void 0 ? void 0 : useRequest.options), {}, {
|
138
138
|
manual: true,
|
139
139
|
onSuccess: function onSuccess(res) {
|
140
140
|
var _res$data, _ref5;
|
@@ -158,7 +158,7 @@ var ProModalSelect = function ProModalSelect(props, ref) {
|
|
158
158
|
withPagination: withPagination,
|
159
159
|
transformParams: transformParams,
|
160
160
|
transformResponse: transformResponse
|
161
|
-
}, (0,
|
161
|
+
}, (0, _objectSpread5.default)({
|
162
162
|
manual: true,
|
163
163
|
ready: (initParams || defaultOne) && !readOnly || visible
|
164
164
|
}, useRequest === null || useRequest === void 0 ? void 0 : useRequest.options)),
|
@@ -192,13 +192,13 @@ var ProModalSelect = function ProModalSelect(props, ref) {
|
|
192
192
|
return data;
|
193
193
|
}
|
194
194
|
if (Object.prototype.toString.call(data) === '[object Object]') {
|
195
|
-
return handleFormat((0,
|
195
|
+
return handleFormat((0, _objectSpread5.default)((0, _objectSpread5.default)({}, data), {}, {
|
196
196
|
value: data[valueKey],
|
197
197
|
label: data[labelKey]
|
198
198
|
}));
|
199
199
|
}
|
200
200
|
return (0, _lodash.isArray)(data) ? data === null || data === void 0 ? void 0 : (_data$map = data.map(function (item) {
|
201
|
-
return handleFormat((0,
|
201
|
+
return handleFormat((0, _objectSpread5.default)((0, _objectSpread5.default)({}, item), {}, {
|
202
202
|
value: item[valueKey],
|
203
203
|
label: item[labelKey]
|
204
204
|
}));
|
@@ -403,7 +403,7 @@ var ProModalSelect = function ProModalSelect(props, ref) {
|
|
403
403
|
return form.validateFields();
|
404
404
|
case 2:
|
405
405
|
values = _context3.sent;
|
406
|
-
onSearch((0,
|
406
|
+
onSearch((0, _objectSpread5.default)((0, _objectSpread5.default)({}, values), {}, {
|
407
407
|
d: Date.now()
|
408
408
|
}));
|
409
409
|
case 4:
|
@@ -416,7 +416,7 @@ var ProModalSelect = function ProModalSelect(props, ref) {
|
|
416
416
|
return _ref9.apply(this, arguments);
|
417
417
|
};
|
418
418
|
}();
|
419
|
-
var _rowSelection = (0,
|
419
|
+
var _rowSelection = (0, _objectSpread5.default)({
|
420
420
|
type: type,
|
421
421
|
onChange: function onChange(rowKeys, rows) {
|
422
422
|
setState({
|
@@ -476,12 +476,12 @@ var ProModalSelect = function ProModalSelect(props, ref) {
|
|
476
476
|
_context4.next = 9;
|
477
477
|
break;
|
478
478
|
}
|
479
|
-
queryBean = (0,
|
480
|
-
page = (0,
|
479
|
+
queryBean = (0, _objectSpread5.default)((0, _objectSpread5.default)({}, defaultParams), initParams || {});
|
480
|
+
page = (0, _objectSpread5.default)({
|
481
481
|
pageNum: 1,
|
482
482
|
pageSize: 10
|
483
483
|
}, useRequest === null || useRequest === void 0 ? void 0 : (_useRequest$options5 = useRequest.options) === null || _useRequest$options5 === void 0 ? void 0 : _useRequest$options5.page);
|
484
|
-
params = withPagination ? (0,
|
484
|
+
params = withPagination ? (0, _objectSpread5.default)((0, _objectSpread5.default)({}, page), {}, {
|
485
485
|
queryBean: queryBean !== null && queryBean !== void 0 ? queryBean : {}
|
486
486
|
}) : queryBean;
|
487
487
|
params = transformParams ? transformParams(params) : params;
|
@@ -534,12 +534,12 @@ var ProModalSelect = function ProModalSelect(props, ref) {
|
|
534
534
|
return (0, _regeneratorRuntime2.default)().wrap(function _callee5$(_context5) {
|
535
535
|
while (1) switch (_context5.prev = _context5.next) {
|
536
536
|
case 0:
|
537
|
-
queryBean = (0,
|
538
|
-
page = (0,
|
537
|
+
queryBean = (0, _objectSpread5.default)({}, defaultParams);
|
538
|
+
page = (0, _objectSpread5.default)({
|
539
539
|
pageNum: 1,
|
540
540
|
pageSize: 10
|
541
541
|
}, useRequest === null || useRequest === void 0 ? void 0 : (_useRequest$options6 = useRequest.options) === null || _useRequest$options6 === void 0 ? void 0 : _useRequest$options6.page);
|
542
|
-
params = withPagination ? (0,
|
542
|
+
params = withPagination ? (0, _objectSpread5.default)((0, _objectSpread5.default)({}, page), {}, {
|
543
543
|
queryBean: queryBean !== null && queryBean !== void 0 ? queryBean : {}
|
544
544
|
}) : queryBean;
|
545
545
|
params = transformParams ? transformParams(params) : params;
|
@@ -656,8 +656,9 @@ var ProModalSelect = function ProModalSelect(props, ref) {
|
|
656
656
|
if (value && !visible && readOnly && (!(0, _lodash.isEqual)(value, preValue.current) || (options === null || options === void 0 ? void 0 : options.length) === 0)) {
|
657
657
|
var _options$some;
|
658
658
|
preValue.current = value;
|
659
|
+
var _data3 = labelInValue ? value[valueKey] : value;
|
659
660
|
var isHasValue = options === null || options === void 0 ? void 0 : (_options$some = options.some) === null || _options$some === void 0 ? void 0 : _options$some.call(options, function (item) {
|
660
|
-
return item[valueKey] ===
|
661
|
+
return item[valueKey] === _data3;
|
661
662
|
});
|
662
663
|
if (isHasValue) {
|
663
664
|
return;
|
@@ -668,8 +669,8 @@ var ProModalSelect = function ProModalSelect(props, ref) {
|
|
668
669
|
var params = withPagination ? {
|
669
670
|
pageNum: 1,
|
670
671
|
pageSize: 50,
|
671
|
-
queryBean: (0,
|
672
|
-
} : (0,
|
672
|
+
queryBean: (0, _objectSpread5.default)((0, _objectSpread5.default)((0, _objectSpread5.default)({}, defaultParams), initParams), {}, (0, _defineProperty2.default)({}, searchKey !== null && searchKey !== void 0 ? searchKey : valueKey, _data3))
|
673
|
+
} : (0, _objectSpread5.default)((0, _objectSpread5.default)((0, _objectSpread5.default)({}, defaultParams), initParams), {}, (0, _defineProperty2.default)({}, searchKey !== null && searchKey !== void 0 ? searchKey : valueKey, _data3));
|
673
674
|
var nextParams = transformParams ? transformParams(params) : params;
|
674
675
|
run(nextParams);
|
675
676
|
}, 300);
|
@@ -697,7 +698,7 @@ var ProModalSelect = function ProModalSelect(props, ref) {
|
|
697
698
|
};
|
698
699
|
var handleSelectSearch = (0, _lodash.debounce)(function (val) {
|
699
700
|
if (useRequest) {
|
700
|
-
var queryBean = (0,
|
701
|
+
var queryBean = (0, _objectSpread5.default)((0, _objectSpread5.default)({}, defaultParams), {}, (0, _defineProperty2.default)({}, searchKey !== null && searchKey !== void 0 ? searchKey : labelKey, val));
|
701
702
|
var params = withPagination ? {
|
702
703
|
pageNum: 1,
|
703
704
|
pageSize: 50,
|
@@ -742,7 +743,7 @@ var ProModalSelect = function ProModalSelect(props, ref) {
|
|
742
743
|
width: '100%'
|
743
744
|
},
|
744
745
|
block: true,
|
745
|
-
children: [readOnly ? (0, _jsxRuntime.jsx)(_index.ProSelect, (0,
|
746
|
+
children: [readOnly ? (0, _jsxRuntime.jsx)(_index.ProSelect, (0, _objectSpread5.default)({
|
746
747
|
value: value,
|
747
748
|
onChange: handleSelectValue,
|
748
749
|
disabled: disabled,
|
@@ -761,7 +762,7 @@ var ProModalSelect = function ProModalSelect(props, ref) {
|
|
761
762
|
style: {
|
762
763
|
width: isView || disabled ? '100%' : 'calc(100% - 30px)'
|
763
764
|
}
|
764
|
-
}, restProps)) : (0, _jsxRuntime.jsx)(_antd.Input, (0,
|
765
|
+
}, restProps)) : (0, _jsxRuntime.jsx)(_antd.Input, (0, _objectSpread5.default)({
|
765
766
|
value: viewText,
|
766
767
|
onChange: handleChangeValue,
|
767
768
|
disabled: disabled,
|
@@ -856,7 +857,7 @@ var ProModalSelect = function ProModalSelect(props, ref) {
|
|
856
857
|
title: viewText,
|
857
858
|
children: initRender
|
858
859
|
}) : initRender
|
859
|
-
}), (0, _jsxRuntime.jsxs)(_index.ProDrawerForm, (0,
|
860
|
+
}), (0, _jsxRuntime.jsxs)(_index.ProDrawerForm, (0, _objectSpread5.default)((0, _objectSpread5.default)({
|
860
861
|
showType: "Modal",
|
861
862
|
title: title,
|
862
863
|
onOk: handleFinish,
|
@@ -871,7 +872,7 @@ var ProModalSelect = function ProModalSelect(props, ref) {
|
|
871
872
|
onFinish: handleSearch,
|
872
873
|
confirmLoading: loading,
|
873
874
|
footer: (formColumns === null || formColumns === void 0 ? void 0 : formColumns.length) > 1
|
874
|
-
}), (0, _jsxRuntime.jsx)(_index.ProTable, (0,
|
875
|
+
}), (0, _jsxRuntime.jsx)(_index.ProTable, (0, _objectSpread5.default)({
|
875
876
|
onRow: function onRow(record) {
|
876
877
|
return {
|
877
878
|
onClick: function onClick() {
|
@@ -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 {
|
package/package.json
CHANGED