@ethlete/query 5.41.1 → 5.41.2
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 +6 -0
- package/fesm2022/ethlete-query.mjs +13 -2
- package/fesm2022/ethlete-query.mjs.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# @ethlete/query
|
|
2
2
|
|
|
3
|
+
## 5.41.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`22c97df`](https://github.com/ethlete-io/ethdk/commit/22c97df87907136adf06686347d7161085e3b33a) Thanks [@TomTomB](https://github.com/TomTomB)! - Fix handling of objects as query form values
|
|
8
|
+
|
|
3
9
|
## 5.41.1
|
|
4
10
|
|
|
5
11
|
### Patch Changes
|
|
@@ -5926,6 +5926,7 @@ const transformToSortQueryParam = (value) => {
|
|
|
5926
5926
|
};
|
|
5927
5927
|
|
|
5928
5928
|
const ET_ARR_PREFIX = 'ET_ARR__';
|
|
5929
|
+
const ET_OBJ_PREFIX = 'ET_OBJ__';
|
|
5929
5930
|
class QueryField {
|
|
5930
5931
|
get control() {
|
|
5931
5932
|
return this.data.control;
|
|
@@ -6320,6 +6321,9 @@ class QueryForm {
|
|
|
6320
6321
|
if (typeof val === 'string' && val.startsWith(ET_ARR_PREFIX)) {
|
|
6321
6322
|
return JSON.parse(val.slice(ET_ARR_PREFIX.length));
|
|
6322
6323
|
}
|
|
6324
|
+
else if (typeof val === 'string' && val.startsWith(ET_OBJ_PREFIX)) {
|
|
6325
|
+
return JSON.parse(val.slice(ET_OBJ_PREFIX.length));
|
|
6326
|
+
}
|
|
6323
6327
|
else if (typeof val === 'function') {
|
|
6324
6328
|
return val();
|
|
6325
6329
|
}
|
|
@@ -6334,8 +6338,12 @@ class QueryForm {
|
|
|
6334
6338
|
return `${prefix}-${key}`;
|
|
6335
6339
|
}
|
|
6336
6340
|
_isDefaultValue(key, value) {
|
|
6337
|
-
const normalizedValue = Array.isArray(value)
|
|
6338
|
-
|
|
6341
|
+
const normalizedValue = Array.isArray(value)
|
|
6342
|
+
? `${ET_ARR_PREFIX}${JSON.stringify(value)}`
|
|
6343
|
+
: typeof value === 'object' && value !== null
|
|
6344
|
+
? `${ET_OBJ_PREFIX}${JSON.stringify(value)}`
|
|
6345
|
+
: value;
|
|
6346
|
+
return this._defaultValues[key] === normalizedValue;
|
|
6339
6347
|
}
|
|
6340
6348
|
_setupFormGroup() {
|
|
6341
6349
|
const group = new FormGroup({});
|
|
@@ -6355,6 +6363,9 @@ class QueryForm {
|
|
|
6355
6363
|
if (Array.isArray(value)) {
|
|
6356
6364
|
defaultValues[key] = `${ET_ARR_PREFIX}${JSON.stringify(value)}`;
|
|
6357
6365
|
}
|
|
6366
|
+
else if (typeof value === 'object' && value !== null) {
|
|
6367
|
+
defaultValues[key] = `${ET_OBJ_PREFIX}${JSON.stringify(value)}`;
|
|
6368
|
+
}
|
|
6358
6369
|
else {
|
|
6359
6370
|
defaultValues[key] = value;
|
|
6360
6371
|
}
|