@hzab/utils 1.0.19 → 1.1.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/changelog.md +8 -0
- package/package.json +4 -3
- package/src/formily/schema-merge.ts +4 -4
- package/src/options.ts +1 -1
- package/src/upload/uploadUtils.ts +1 -1
package/changelog.md
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hzab/utils",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.1.1",
|
|
4
4
|
"description": "utils",
|
|
5
5
|
"main": "src",
|
|
6
6
|
"scripts": {
|
|
@@ -35,6 +35,7 @@
|
|
|
35
35
|
"axios": "^1.4.0",
|
|
36
36
|
"eslint": "^8.30.0",
|
|
37
37
|
"less": "^4.1.3",
|
|
38
|
+
"lodash-es": "^4.18.1",
|
|
38
39
|
"mobx": "^6.7.0",
|
|
39
40
|
"mobx-react": "^7.6.0",
|
|
40
41
|
"nanoid": "^3.3.7",
|
|
@@ -49,7 +50,6 @@
|
|
|
49
50
|
},
|
|
50
51
|
"peerDependencies": {
|
|
51
52
|
"@hzab/data-model": ">=1.2.0",
|
|
52
|
-
"antd": "4.x",
|
|
53
53
|
"axios": ">=1.6.2",
|
|
54
54
|
"react": ">=16.8.0",
|
|
55
55
|
"react-dom": ">=16.8.0"
|
|
@@ -58,5 +58,6 @@
|
|
|
58
58
|
"**.{js,jsx,ts,tsx,css,scss,less,json,html}": [
|
|
59
59
|
"prettier --write"
|
|
60
60
|
]
|
|
61
|
-
}
|
|
61
|
+
},
|
|
62
|
+
"dependencies": {}
|
|
62
63
|
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { cloneDeep, uniqueId } from "lodash-es";
|
|
2
2
|
|
|
3
3
|
export function mergeSchema(BaseSchema, InsideSchema, title = "") {
|
|
4
4
|
const _schema = {
|
|
5
5
|
form: BaseSchema.form,
|
|
6
|
-
schema:
|
|
6
|
+
schema: cloneDeep(BaseSchema.schema),
|
|
7
7
|
};
|
|
8
8
|
let idx = Object.keys(_schema.schema.properties).length;
|
|
9
9
|
|
|
@@ -33,13 +33,13 @@ export function mergeSchemas(schemas) {
|
|
|
33
33
|
console.error("请传入 schema");
|
|
34
34
|
return;
|
|
35
35
|
}
|
|
36
|
-
const _schemaList =
|
|
36
|
+
const _schemaList = cloneDeep(schemas);
|
|
37
37
|
const _schema = {
|
|
38
38
|
form: _schemaList[0].json.form,
|
|
39
39
|
schema: {
|
|
40
40
|
type: "object",
|
|
41
41
|
properties: {},
|
|
42
|
-
"x-designable-id":
|
|
42
|
+
"x-designable-id": uniqueId("schema-merge-"),
|
|
43
43
|
},
|
|
44
44
|
};
|
|
45
45
|
|
package/src/options.ts
CHANGED
|
@@ -78,7 +78,7 @@ export const getFileNameByFileObj = (file, opt: any) => {
|
|
|
78
78
|
|
|
79
79
|
|
|
80
80
|
const hashStr = useHashName ? nanoidNumALetters() : "";
|
|
81
|
-
const nm = mergeFileName(_fileName + "." + _ext, (_fileName.indexOf("~kid-")
|
|
81
|
+
const nm = mergeFileName(_fileName + "." + _ext, (_fileName.indexOf("~kid-") < 0 ? `~kid-${hashStr}-${file.createTime || dayjs().valueOf()}-${ext}` : ""));
|
|
82
82
|
|
|
83
83
|
return nm;
|
|
84
84
|
};
|