react-hook-core 0.4.2 → 0.4.5
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/core.js +2 -2
- package/lib/search.js +13 -3
- package/lib/useSearch.js +1 -1
- package/package.json +1 -1
- package/src/core.ts +2 -2
- package/src/search.ts +11 -3
- package/src/useSearch.ts +1 -1
package/lib/core.js
CHANGED
|
@@ -59,10 +59,10 @@ function message(gv, msg, title, yes, no) {
|
|
|
59
59
|
}
|
|
60
60
|
exports.message = message;
|
|
61
61
|
function messageByHttpStatus(status, gv) {
|
|
62
|
-
var k = '
|
|
62
|
+
var k = 'error_' + status;
|
|
63
63
|
var msg = getString(k, gv);
|
|
64
64
|
if (!msg || msg.length === 0) {
|
|
65
|
-
msg = getString('
|
|
65
|
+
msg = getString('error_500', gv);
|
|
66
66
|
}
|
|
67
67
|
return msg;
|
|
68
68
|
}
|
package/lib/search.js
CHANGED
|
@@ -439,7 +439,12 @@ function addParametersIntoUrl(ft, isFirstLoad, page, fields, limit) {
|
|
|
439
439
|
}
|
|
440
440
|
}
|
|
441
441
|
else {
|
|
442
|
-
|
|
442
|
+
if (typeof objValue === "string") {
|
|
443
|
+
url += getPrefix(url) + (key + "=" + encodeURI(objValue));
|
|
444
|
+
}
|
|
445
|
+
else {
|
|
446
|
+
url += getPrefix(url) + (key + "=" + objValue);
|
|
447
|
+
}
|
|
443
448
|
}
|
|
444
449
|
}
|
|
445
450
|
else if (typeof objValue === "object") {
|
|
@@ -453,7 +458,7 @@ function addParametersIntoUrl(ft, isFirstLoad, page, fields, limit) {
|
|
|
453
458
|
for (var _a = 0, objValue_1 = objValue; _a < objValue_1.length; _a++) {
|
|
454
459
|
var subValue = objValue_1[_a];
|
|
455
460
|
if (typeof subValue === "string") {
|
|
456
|
-
strs.push(subValue);
|
|
461
|
+
strs.push(encodeURI(subValue));
|
|
457
462
|
}
|
|
458
463
|
else if (typeof subValue === "number") {
|
|
459
464
|
strs.push(subValue.toString());
|
|
@@ -472,7 +477,12 @@ function addParametersIntoUrl(ft, isFirstLoad, page, fields, limit) {
|
|
|
472
477
|
url += getPrefix(url) + (key + "." + key2 + "=" + objValueLvl2.toISOString());
|
|
473
478
|
}
|
|
474
479
|
else {
|
|
475
|
-
|
|
480
|
+
if (typeof objValueLvl2 === "string") {
|
|
481
|
+
url += getPrefix(url) + (key + "." + key2 + "=" + encodeURI(objValueLvl2));
|
|
482
|
+
}
|
|
483
|
+
else {
|
|
484
|
+
url += getPrefix(url) + (key + "." + key2 + "=" + objValueLvl2);
|
|
485
|
+
}
|
|
476
486
|
}
|
|
477
487
|
}
|
|
478
488
|
}
|
package/lib/useSearch.js
CHANGED
|
@@ -119,7 +119,7 @@ exports.useCoreSearch = function (refForm, initialState, service, p1, p2) {
|
|
|
119
119
|
setRerender(!rerender);
|
|
120
120
|
}, [state]);
|
|
121
121
|
var _getCurrencyCode = function () {
|
|
122
|
-
return refForm && refForm.current ? refForm.current.getAttribute('currency-code') :
|
|
122
|
+
return refForm && refForm.current ? refForm.current.getAttribute('currency-code') : 'USD';
|
|
123
123
|
};
|
|
124
124
|
var getCurrencyCode = p && p.getCurrencyCode ? p.getCurrencyCode : _getCurrencyCode;
|
|
125
125
|
var _c = merge_1.useMergeState(p), component = _c[0], setComponent = _c[1];
|
package/package.json
CHANGED
package/src/core.ts
CHANGED
|
@@ -209,10 +209,10 @@ export function message(gv: StringMap | ((key: string) => string), msg: string,
|
|
|
209
209
|
return m;
|
|
210
210
|
}
|
|
211
211
|
export function messageByHttpStatus(status: number, gv: StringMap | ((key: string) => string)): string {
|
|
212
|
-
const k = '
|
|
212
|
+
const k = 'error_' + status;
|
|
213
213
|
let msg = getString(k, gv);
|
|
214
214
|
if (!msg || msg.length === 0) {
|
|
215
|
-
msg = getString('
|
|
215
|
+
msg = getString('error_500', gv);
|
|
216
216
|
}
|
|
217
217
|
return msg;
|
|
218
218
|
}
|
package/src/search.ts
CHANGED
|
@@ -441,7 +441,11 @@ export function addParametersIntoUrl<S extends Filter>(ft: S, isFirstLoad?: bool
|
|
|
441
441
|
url += getPrefix(url) + `${key}=${objValue}`
|
|
442
442
|
}
|
|
443
443
|
} else {
|
|
444
|
-
|
|
444
|
+
if (typeof objValue === "string") {
|
|
445
|
+
url += getPrefix(url) + `${key}=${encodeURI(objValue)}`
|
|
446
|
+
} else {
|
|
447
|
+
url += getPrefix(url) + `${key}=${objValue}`
|
|
448
|
+
}
|
|
445
449
|
}
|
|
446
450
|
} else if (typeof objValue === "object") {
|
|
447
451
|
if (objValue instanceof Date) {
|
|
@@ -452,7 +456,7 @@ export function addParametersIntoUrl<S extends Filter>(ft: S, isFirstLoad?: bool
|
|
|
452
456
|
const strs: string[] = []
|
|
453
457
|
for (const subValue of objValue) {
|
|
454
458
|
if (typeof subValue === "string") {
|
|
455
|
-
strs.push(subValue)
|
|
459
|
+
strs.push(encodeURI(subValue))
|
|
456
460
|
} else if (typeof subValue === "number") {
|
|
457
461
|
strs.push(subValue.toString())
|
|
458
462
|
}
|
|
@@ -467,7 +471,11 @@ export function addParametersIntoUrl<S extends Filter>(ft: S, isFirstLoad?: bool
|
|
|
467
471
|
if (objValueLvl2 instanceof Date) {
|
|
468
472
|
url += getPrefix(url) + `${key}.${key2}=${objValueLvl2.toISOString()}`
|
|
469
473
|
} else {
|
|
470
|
-
|
|
474
|
+
if (typeof objValueLvl2 === "string") {
|
|
475
|
+
url += getPrefix(url) + `${key}.${key2}=${encodeURI(objValueLvl2)}`
|
|
476
|
+
} else {
|
|
477
|
+
url += getPrefix(url) + `${key}.${key2}=${objValueLvl2}`
|
|
478
|
+
}
|
|
471
479
|
}
|
|
472
480
|
}
|
|
473
481
|
}
|
package/src/useSearch.ts
CHANGED
|
@@ -235,7 +235,7 @@ export const useCoreSearch = <T, S extends Filter, ST>(
|
|
|
235
235
|
}, [state]);
|
|
236
236
|
|
|
237
237
|
const _getCurrencyCode = (): string => {
|
|
238
|
-
return refForm && refForm.current ? refForm.current.getAttribute('currency-code') :
|
|
238
|
+
return refForm && refForm.current ? refForm.current.getAttribute('currency-code') : 'USD';
|
|
239
239
|
};
|
|
240
240
|
const getCurrencyCode = p && p.getCurrencyCode ? p.getCurrencyCode : _getCurrencyCode;
|
|
241
241
|
|