react-hook-core 0.2.3 → 0.2.4
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/lib/route.js +5 -1
- package/lib/useEdit.js +9 -9
- package/package.json +1 -1
- package/src/route.ts +5 -2
- package/src/useEdit.ts +9 -9
package/lib/route.js
CHANGED
|
@@ -50,7 +50,6 @@ function parseToModel(dest, src) {
|
|
|
50
50
|
if (typeof dest !== 'object' || typeof src !== 'object') {
|
|
51
51
|
return dest;
|
|
52
52
|
}
|
|
53
|
-
dest = convertToObject(dest);
|
|
54
53
|
for (var key in src) {
|
|
55
54
|
if (!Object.hasOwn(dest, key))
|
|
56
55
|
continue;
|
|
@@ -77,6 +76,11 @@ function parseToModel(dest, src) {
|
|
|
77
76
|
dest[key] = parseInt(dest[key], 10);
|
|
78
77
|
}
|
|
79
78
|
}
|
|
79
|
+
else if (typeof src[key] === 'string') {
|
|
80
|
+
if (dest[key]) {
|
|
81
|
+
dest[key] = dest[key].toString();
|
|
82
|
+
}
|
|
83
|
+
}
|
|
80
84
|
}
|
|
81
85
|
}
|
|
82
86
|
return dest;
|
package/lib/useEdit.js
CHANGED
|
@@ -193,15 +193,15 @@ exports.useCoreEdit = function (refForm, initialState, service, p1, p, props) {
|
|
|
193
193
|
}
|
|
194
194
|
};
|
|
195
195
|
var _onSave = function (isBack) {
|
|
196
|
-
if (
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
196
|
+
if (p && p.readOnly) {
|
|
197
|
+
if (flag.newMode === true) {
|
|
198
|
+
var m = core_1.message(p1.resource.value, 'error_permission_add', 'error_permission');
|
|
199
|
+
p1.showError(m.message, m.title);
|
|
200
|
+
}
|
|
201
|
+
else {
|
|
202
|
+
var msg = core_1.message(p1.resource.value, 'error_permission_edit', 'error_permission');
|
|
203
|
+
p1.showError(msg.message, msg.title);
|
|
204
|
+
}
|
|
205
205
|
}
|
|
206
206
|
else {
|
|
207
207
|
if (running === true) {
|
package/package.json
CHANGED
package/src/route.ts
CHANGED
|
@@ -51,7 +51,6 @@ function parseToModel(dest: any, src: any) {
|
|
|
51
51
|
if (typeof dest !== 'object' || typeof src !== 'object') {
|
|
52
52
|
return dest;
|
|
53
53
|
}
|
|
54
|
-
dest = convertToObject(dest)
|
|
55
54
|
for (let key in src) {
|
|
56
55
|
if (!Object.hasOwn(dest, key)) continue;
|
|
57
56
|
if (src.hasOwnProperty(key)) {
|
|
@@ -69,9 +68,13 @@ function parseToModel(dest: any, src: any) {
|
|
|
69
68
|
} else if (typeof src[key] === 'number') {
|
|
70
69
|
if ( typeof dest[key] === 'string' && dest[key].indexOf(".") !== -1){
|
|
71
70
|
dest[key] = parseFloat(dest[key]);
|
|
72
|
-
}else{
|
|
71
|
+
} else{
|
|
73
72
|
dest[key] = parseInt(dest[key], 10);
|
|
74
73
|
}
|
|
74
|
+
} else if (typeof src[key] === 'string') {
|
|
75
|
+
if (dest[key]) {
|
|
76
|
+
dest[key] = dest[key].toString();
|
|
77
|
+
}
|
|
75
78
|
}
|
|
76
79
|
}
|
|
77
80
|
}
|
package/src/useEdit.ts
CHANGED
|
@@ -272,16 +272,16 @@ export const useCoreEdit = <T, ID, S, P>(
|
|
|
272
272
|
};
|
|
273
273
|
|
|
274
274
|
const _onSave = (isBack?: boolean) => {
|
|
275
|
-
if (
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
275
|
+
if (p && p.readOnly) {
|
|
276
|
+
if (flag.newMode === true) {
|
|
277
|
+
const m = message(p1.resource.value, 'error_permission_add', 'error_permission');
|
|
278
|
+
p1.showError(m.message, m.title);
|
|
279
|
+
} else {
|
|
280
|
+
const msg = message(p1.resource.value, 'error_permission_edit', 'error_permission');
|
|
281
|
+
p1.showError(msg.message, msg.title);
|
|
282
|
+
}
|
|
283
283
|
} else {
|
|
284
|
-
|
|
284
|
+
if (running === true) {
|
|
285
285
|
return;
|
|
286
286
|
}
|
|
287
287
|
const obj = getModel();
|