@megha-ui/react 1.3.104 → 1.3.106
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.
|
@@ -695,6 +695,15 @@ const GridHeader = ({ columns, onSearch, searchQueries, sortable, search, resiza
|
|
|
695
695
|
var _a, _b;
|
|
696
696
|
const currentKey = ((_a = headerColumns.find((column) => column.key === _groupBy)) === null || _a === void 0 ? void 0 : _a.key) || "";
|
|
697
697
|
const input = e.target.value;
|
|
698
|
+
const searchType = ((_b = searchQueries[currentKey]) === null || _b === void 0 ? void 0 : _b.type) ||
|
|
699
|
+
defaultSearchOperation ||
|
|
700
|
+
"contains";
|
|
701
|
+
onSearch(currentKey, input, searchType);
|
|
702
|
+
}, onBlur: (e) => {
|
|
703
|
+
var _a, _b;
|
|
704
|
+
const currentKey = ((_a = headerColumns.find((column) => column.key === _groupBy)) === null || _a === void 0 ? void 0 : _a.key) || "";
|
|
705
|
+
const raw = e.target.value;
|
|
706
|
+
const input = raw.replace(/\?/g, "%");
|
|
698
707
|
let searchType = ((_b = searchQueries[currentKey]) === null || _b === void 0 ? void 0 : _b.type) ||
|
|
699
708
|
defaultSearchOperation ||
|
|
700
709
|
"contains";
|
|
@@ -720,7 +729,21 @@ const GridHeader = ({ columns, onSearch, searchQueries, sortable, search, resiza
|
|
|
720
729
|
searchType = "endsWith";
|
|
721
730
|
}
|
|
722
731
|
}
|
|
723
|
-
|
|
732
|
+
let query = input;
|
|
733
|
+
if (query &&
|
|
734
|
+
!query.includes("%") &&
|
|
735
|
+
!query.includes("_")) {
|
|
736
|
+
if (searchType === "contains") {
|
|
737
|
+
query = `%${query}%`;
|
|
738
|
+
}
|
|
739
|
+
else if (searchType === "startsWith") {
|
|
740
|
+
query = `${query}%`;
|
|
741
|
+
}
|
|
742
|
+
else if (searchType === "endsWith") {
|
|
743
|
+
query = `%${query}`;
|
|
744
|
+
}
|
|
745
|
+
}
|
|
746
|
+
onSearch(currentKey, query, searchType);
|
|
724
747
|
}, placeholder: "Search", extraWrapperStyle: {
|
|
725
748
|
background: ((_57 = headerColumns.find((column) => column.key === _groupBy)) === null || _57 === void 0 ? void 0 : _57.search)
|
|
726
749
|
? "var(--background)"
|
|
@@ -1093,9 +1116,18 @@ const GridHeader = ({ columns, onSearch, searchQueries, sortable, search, resiza
|
|
|
1093
1116
|
}, children: [_jsx(TextInput, { onFocus: () => setActiveSearchColumn(column.key), onChange: (e) => {
|
|
1094
1117
|
var _a;
|
|
1095
1118
|
const input = e.target.value;
|
|
1119
|
+
const searchType = ((_a = searchQueries[column.key]) === null || _a === void 0 ? void 0 : _a.type) ||
|
|
1120
|
+
defaultSearchOperation ||
|
|
1121
|
+
"contains";
|
|
1122
|
+
onSearch(column.key, input, searchType);
|
|
1123
|
+
}, onBlur: (e) => {
|
|
1124
|
+
var _a;
|
|
1125
|
+
const raw = e.target.value;
|
|
1126
|
+
const input = raw.replace(/\?/g, "%");
|
|
1096
1127
|
let searchType = ((_a = searchQueries[column.key]) === null || _a === void 0 ? void 0 : _a.type) ||
|
|
1097
1128
|
defaultSearchOperation ||
|
|
1098
1129
|
"contains";
|
|
1130
|
+
console.log({ input });
|
|
1099
1131
|
if (input.includes("to")) {
|
|
1100
1132
|
searchType = "between";
|
|
1101
1133
|
}
|
|
@@ -1119,7 +1151,21 @@ const GridHeader = ({ columns, onSearch, searchQueries, sortable, search, resiza
|
|
|
1119
1151
|
searchType = "endsWith";
|
|
1120
1152
|
}
|
|
1121
1153
|
}
|
|
1122
|
-
|
|
1154
|
+
let query = input;
|
|
1155
|
+
if (query &&
|
|
1156
|
+
!query.includes("%") &&
|
|
1157
|
+
!query.includes("_")) {
|
|
1158
|
+
if (searchType === "contains") {
|
|
1159
|
+
query = `%${query}%`;
|
|
1160
|
+
}
|
|
1161
|
+
else if (searchType === "startsWith") {
|
|
1162
|
+
query = `${query}%`;
|
|
1163
|
+
}
|
|
1164
|
+
else if (searchType === "endsWith") {
|
|
1165
|
+
query = `%${query}`;
|
|
1166
|
+
}
|
|
1167
|
+
}
|
|
1168
|
+
onSearch(column.key, query, searchType);
|
|
1123
1169
|
}, placeholder: "Search", extraWrapperStyle: {
|
|
1124
1170
|
background: column.search
|
|
1125
1171
|
? "var(--background)"
|
package/package.json
CHANGED