@infrab4a/connect 4.3.10-beta.0 → 4.3.10-beta.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/index.cjs.js
CHANGED
|
@@ -3559,17 +3559,20 @@ FilterOptionHelper.GetValueFromFilter = (filter, fieldOption) => {
|
|
|
3559
3559
|
return false;
|
|
3560
3560
|
const converter = fieldOption.to
|
|
3561
3561
|
? fieldOption.to
|
|
3562
|
-
: (value) =>
|
|
3563
|
-
|
|
3564
|
-
|
|
3565
|
-
|
|
3566
|
-
: newValue;
|
|
3567
|
-
};
|
|
3568
|
-
return Array.isArray(filter.value) && !fieldOption.fields && [exports.Where.IN, exports.Where.NOTIN].includes(filter.operator)
|
|
3562
|
+
: (value) => filter.operator === exports.Where.LIKE && !Array.isArray(filter.value) && value.indexOf('%') < 0
|
|
3563
|
+
? `%${value}%`
|
|
3564
|
+
: value;
|
|
3565
|
+
const converterResult = Array.isArray(filter.value) && !fieldOption.fields && [exports.Where.IN, exports.Where.NOTIN].includes(filter.operator)
|
|
3569
3566
|
? filter.value.map((fieldValue) => converter(fieldValue))
|
|
3570
3567
|
: converter(filter.value);
|
|
3568
|
+
const newValue = filter.ignoreCase && !filter.ignoreAccent && !Array.isArray(filter.value) && converterResult.indexOf('%') < 0
|
|
3569
|
+
? `%${converterResult}%`
|
|
3570
|
+
: converterResult;
|
|
3571
|
+
return filter.ignoreAccent && !Array.isArray(filter.value)
|
|
3572
|
+
? FilterOptionHelper.buildInsensitiveSentence(newValue)
|
|
3573
|
+
: newValue;
|
|
3571
3574
|
};
|
|
3572
|
-
FilterOptionHelper.
|
|
3575
|
+
FilterOptionHelper.buildInsensitiveSentence = (value) => {
|
|
3573
3576
|
const valueWithoutAccents = FilterOptionHelper.removeAccents(value);
|
|
3574
3577
|
let result = '';
|
|
3575
3578
|
for (const char of valueWithoutAccents) {
|
package/index.esm.js
CHANGED
|
@@ -3553,17 +3553,20 @@ FilterOptionHelper.GetValueFromFilter = (filter, fieldOption) => {
|
|
|
3553
3553
|
return false;
|
|
3554
3554
|
const converter = fieldOption.to
|
|
3555
3555
|
? fieldOption.to
|
|
3556
|
-
: (value) =>
|
|
3557
|
-
|
|
3558
|
-
|
|
3559
|
-
|
|
3560
|
-
: newValue;
|
|
3561
|
-
};
|
|
3562
|
-
return Array.isArray(filter.value) && !fieldOption.fields && [Where.IN, Where.NOTIN].includes(filter.operator)
|
|
3556
|
+
: (value) => filter.operator === Where.LIKE && !Array.isArray(filter.value) && value.indexOf('%') < 0
|
|
3557
|
+
? `%${value}%`
|
|
3558
|
+
: value;
|
|
3559
|
+
const converterResult = Array.isArray(filter.value) && !fieldOption.fields && [Where.IN, Where.NOTIN].includes(filter.operator)
|
|
3563
3560
|
? filter.value.map((fieldValue) => converter(fieldValue))
|
|
3564
3561
|
: converter(filter.value);
|
|
3562
|
+
const newValue = filter.ignoreCase && !filter.ignoreAccent && !Array.isArray(filter.value) && converterResult.indexOf('%') < 0
|
|
3563
|
+
? `%${converterResult}%`
|
|
3564
|
+
: converterResult;
|
|
3565
|
+
return filter.ignoreAccent && !Array.isArray(filter.value)
|
|
3566
|
+
? FilterOptionHelper.buildInsensitiveSentence(newValue)
|
|
3567
|
+
: newValue;
|
|
3565
3568
|
};
|
|
3566
|
-
FilterOptionHelper.
|
|
3569
|
+
FilterOptionHelper.buildInsensitiveSentence = (value) => {
|
|
3567
3570
|
const valueWithoutAccents = FilterOptionHelper.removeAccents(value);
|
|
3568
3571
|
let result = '';
|
|
3569
3572
|
for (const char of valueWithoutAccents) {
|
package/package.json
CHANGED
|
@@ -3,6 +3,6 @@ import { ColumnOptions } from '../../types';
|
|
|
3
3
|
export declare class FilterOptionHelper {
|
|
4
4
|
static CheckIfIsFilterOption: <Model extends ModelBaseStructure>(filter: any) => filter is RepositoryFindFieltersOptions<Model, any>;
|
|
5
5
|
static GetValueFromFilter: <Model extends ModelBaseStructure<Model>>(filter: RepositoryFindFieltersOptions<Model, any>, fieldOption: ColumnOptions<any, any>) => any;
|
|
6
|
-
private static
|
|
6
|
+
private static buildInsensitiveSentence;
|
|
7
7
|
private static removeAccents;
|
|
8
8
|
}
|