@megha-ui/react 1.3.112 → 1.3.113

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.
@@ -453,7 +453,21 @@ const GridHeader = ({ columns, onSearch, searchQueries, sortable, search, resiza
453
453
  const searchType = ((_b = searchQueries[currentKey]) === null || _b === void 0 ? void 0 : _b.type) ||
454
454
  defaultSearchOperation ||
455
455
  "contains";
456
- onSearch(currentKey, input, searchType);
456
+ let query = input;
457
+ if (query &&
458
+ !query.includes("%") &&
459
+ !query.includes("_")) {
460
+ if (searchType === "contains") {
461
+ query = `%${query}%`;
462
+ }
463
+ else if (searchType === "startsWith") {
464
+ query = `${query}%`;
465
+ }
466
+ else if (searchType === "endsWith") {
467
+ query = `%${query}`;
468
+ }
469
+ }
470
+ onSearch(currentKey, query, searchType);
457
471
  }, placeholder: "Search", extraWrapperStyle: {
458
472
  background: ((_r = headerColumns.find((column) => column.key === _groupBy)) === null || _r === void 0 ? void 0 : _r.search)
459
473
  ? "var(--background)"
@@ -620,7 +634,21 @@ const GridHeader = ({ columns, onSearch, searchQueries, sortable, search, resiza
620
634
  const searchType = ((_b = searchQueries[currentKey]) === null || _b === void 0 ? void 0 : _b.type) ||
621
635
  defaultSearchOperation ||
622
636
  "contains";
623
- onSearch(currentKey, input, searchType);
637
+ let query = input;
638
+ if (query &&
639
+ !query.includes("%") &&
640
+ !query.includes("_")) {
641
+ if (searchType === "contains") {
642
+ query = `%${query}%`;
643
+ }
644
+ else if (searchType === "startsWith") {
645
+ query = `${query}%`;
646
+ }
647
+ else if (searchType === "endsWith") {
648
+ query = `%${query}`;
649
+ }
650
+ }
651
+ onSearch(currentKey, query, searchType);
624
652
  }, placeholder: "Search", extraWrapperStyle: {
625
653
  background: ((_24 = headerColumns.find((column) => column.key === _groupBy)) === null || _24 === void 0 ? void 0 : _24.search)
626
654
  ? "var(--background)"
@@ -785,7 +813,21 @@ const GridHeader = ({ columns, onSearch, searchQueries, sortable, search, resiza
785
813
  const searchType = ((_b = searchQueries[currentKey]) === null || _b === void 0 ? void 0 : _b.type) ||
786
814
  defaultSearchOperation ||
787
815
  "contains";
788
- onSearch(currentKey, input, searchType);
816
+ let query = input;
817
+ if (query &&
818
+ !query.includes("%") &&
819
+ !query.includes("_")) {
820
+ if (searchType === "contains") {
821
+ query = `%${query}%`;
822
+ }
823
+ else if (searchType === "startsWith") {
824
+ query = `${query}%`;
825
+ }
826
+ else if (searchType === "endsWith") {
827
+ query = `%${query}`;
828
+ }
829
+ }
830
+ onSearch(currentKey, query, searchType);
789
831
  }, placeholder: "Search", extraWrapperStyle: {
790
832
  background: ((_57 = headerColumns.find((column) => column.key === _groupBy)) === null || _57 === void 0 ? void 0 : _57.search)
791
833
  ? "var(--background)"
@@ -989,7 +1031,21 @@ const GridHeader = ({ columns, onSearch, searchQueries, sortable, search, resiza
989
1031
  const searchType = ((_a = searchQueries[currentKey]) === null || _a === void 0 ? void 0 : _a.type) ||
990
1032
  defaultSearchOperation ||
991
1033
  "contains";
992
- onSearch(currentKey, input, searchType);
1034
+ let query = input;
1035
+ if (query &&
1036
+ !query.includes("%") &&
1037
+ !query.includes("_")) {
1038
+ if (searchType === "contains") {
1039
+ query = `%${query}%`;
1040
+ }
1041
+ else if (searchType === "startsWith") {
1042
+ query = `${query}%`;
1043
+ }
1044
+ else if (searchType === "endsWith") {
1045
+ query = `%${query}`;
1046
+ }
1047
+ }
1048
+ onSearch(currentKey, query, searchType);
993
1049
  }, placeholder: "Search", extraWrapperStyle: {
994
1050
  background: column.search
995
1051
  ? "var(--background)"
@@ -1117,7 +1173,21 @@ const GridHeader = ({ columns, onSearch, searchQueries, sortable, search, resiza
1117
1173
  const searchType = ((_a = searchQueries[currentKey]) === null || _a === void 0 ? void 0 : _a.type) ||
1118
1174
  defaultSearchOperation ||
1119
1175
  "contains";
1120
- onSearch(currentKey, input, searchType);
1176
+ let query = input;
1177
+ if (query &&
1178
+ !query.includes("%") &&
1179
+ !query.includes("_")) {
1180
+ if (searchType === "contains") {
1181
+ query = `%${query}%`;
1182
+ }
1183
+ else if (searchType === "startsWith") {
1184
+ query = `${query}%`;
1185
+ }
1186
+ else if (searchType === "endsWith") {
1187
+ query = `%${query}`;
1188
+ }
1189
+ }
1190
+ onSearch(currentKey, query, searchType);
1121
1191
  }, placeholder: "Search", extraWrapperStyle: {
1122
1192
  background: column.search
1123
1193
  ? "var(--background)"
@@ -1221,6 +1291,14 @@ const GridHeader = ({ columns, onSearch, searchQueries, sortable, search, resiza
1221
1291
  searchType = "endsWith";
1222
1292
  }
1223
1293
  }
1294
+ onSearch(column.key, input, searchType);
1295
+ }, onBlur: (e) => {
1296
+ var _a;
1297
+ const currentKey = (column === null || column === void 0 ? void 0 : column.key) || "";
1298
+ const input = e.target.value.replace(/\?/g, "%");
1299
+ const searchType = ((_a = searchQueries[currentKey]) === null || _a === void 0 ? void 0 : _a.type) ||
1300
+ defaultSearchOperation ||
1301
+ "contains";
1224
1302
  let query = input;
1225
1303
  if (query &&
1226
1304
  !query.includes("%") &&
@@ -1235,15 +1313,7 @@ const GridHeader = ({ columns, onSearch, searchQueries, sortable, search, resiza
1235
1313
  query = `%${query}`;
1236
1314
  }
1237
1315
  }
1238
- onSearch(column.key, query, searchType);
1239
- }, onBlur: (e) => {
1240
- var _a;
1241
- const currentKey = (column === null || column === void 0 ? void 0 : column.key) || "";
1242
- const input = e.target.value.replace(/\?/g, "%");
1243
- const searchType = ((_a = searchQueries[currentKey]) === null || _a === void 0 ? void 0 : _a.type) ||
1244
- defaultSearchOperation ||
1245
- "contains";
1246
- onSearch(currentKey, input, searchType);
1316
+ onSearch(currentKey, query, searchType);
1247
1317
  }, placeholder: "Search", extraWrapperStyle: {
1248
1318
  background: column.search
1249
1319
  ? "var(--background)"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@megha-ui/react",
3
- "version": "1.3.112",
3
+ "version": "1.3.113",
4
4
  "description": "A collection of reusable UI components for React applications, built with TypeScript.",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.js",