@hzab/list-render 1.10.16 → 1.10.18
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/CHANGELOG.md +8 -0
- package/package.json +9 -6
- package/src/list-render.jsx +10 -5
package/CHANGELOG.md
CHANGED
package/package.json
CHANGED
|
@@ -1,16 +1,19 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hzab/list-render",
|
|
3
|
-
"version": "1.10.
|
|
3
|
+
"version": "1.10.18",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "src",
|
|
6
6
|
"scripts": {
|
|
7
7
|
"dev": "webpack serve -c ./config/webpack.config.js --env local",
|
|
8
8
|
"build": "webpack -c ./config/webpack.config.js --env production",
|
|
9
|
-
"
|
|
10
|
-
"
|
|
11
|
-
"
|
|
12
|
-
"publish
|
|
13
|
-
"
|
|
9
|
+
"version:alpha": "npm version prerelease --preid=alpha",
|
|
10
|
+
"publish:alpha": "npm publish --tag alpha",
|
|
11
|
+
"version:beta": "npm version prerelease --preid=beta",
|
|
12
|
+
"publish:beta": "npm publish --tag beta",
|
|
13
|
+
"version:patch": "npm version patch",
|
|
14
|
+
"version:minior": "npm version minor",
|
|
15
|
+
"version:major": "npm version major",
|
|
16
|
+
"publish:stable": "npm publish --access public"
|
|
14
17
|
},
|
|
15
18
|
"files": [
|
|
16
19
|
"src",
|
package/src/list-render.jsx
CHANGED
|
@@ -5,7 +5,7 @@ model 不要定义在组件外部,避免出现 query 异常的情况。
|
|
|
5
5
|
import { forwardRef, useEffect, useImperativeHandle, useRef, useState } from "react";
|
|
6
6
|
import { Button, message } from "antd";
|
|
7
7
|
import _, { cloneDeep } from "lodash";
|
|
8
|
-
import
|
|
8
|
+
import axiosI, { isCancel, getCancelTokenSource } from "@hzab/data-model/src/axios";
|
|
9
9
|
|
|
10
10
|
import QueryRender from "./query-render";
|
|
11
11
|
import Pagination from "./pagination-render";
|
|
@@ -195,7 +195,9 @@ const ListRender = forwardRef(function (props, parentRef) {
|
|
|
195
195
|
setListLoading(false);
|
|
196
196
|
})
|
|
197
197
|
.catch((err) => {
|
|
198
|
-
|
|
198
|
+
// 兼容新老版本 data-model isCancel 取法
|
|
199
|
+
const _isCancel = isCancel || axiosI.isCancel;
|
|
200
|
+
if (typeof _isCancel === "function" && _isCancel(err)) {
|
|
199
201
|
console.info(`请求已取消:`, "", err.message);
|
|
200
202
|
return Promise.reject(err);
|
|
201
203
|
}
|
|
@@ -294,7 +296,10 @@ const ListRender = forwardRef(function (props, parentRef) {
|
|
|
294
296
|
}
|
|
295
297
|
|
|
296
298
|
async function onCreateSubmit(data) {
|
|
297
|
-
let _data =
|
|
299
|
+
let _data = data;
|
|
300
|
+
if (typeof model?.createMap === "function") {
|
|
301
|
+
_data = await model.createMap(data);
|
|
302
|
+
}
|
|
298
303
|
if (useFormData) {
|
|
299
304
|
_data = objToFormData(_data);
|
|
300
305
|
}
|
|
@@ -385,10 +390,10 @@ const ListRender = forwardRef(function (props, parentRef) {
|
|
|
385
390
|
let _data = data;
|
|
386
391
|
if (isPatchUpdate) {
|
|
387
392
|
if (typeof model?.patchMap === "function") {
|
|
388
|
-
_data = model.patchMap(data, opt);
|
|
393
|
+
_data = await model.patchMap(data, opt);
|
|
389
394
|
}
|
|
390
395
|
} else if (typeof model?.updateMap === "function") {
|
|
391
|
-
_data = model.updateMap(data, opt);
|
|
396
|
+
_data = await model.updateMap(data, opt);
|
|
392
397
|
}
|
|
393
398
|
|
|
394
399
|
// 行内编辑确认前的校验
|