@megha-ui/react 1.3.107 → 1.3.109

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.
@@ -404,7 +404,7 @@ const GridHeader = ({ columns, onSearch, searchQueries, sortable, search, resiza
404
404
  }, onChange: (e) => {
405
405
  var _a, _b;
406
406
  const currentKey = ((_a = headerColumns.find((column) => column.key === _groupBy)) === null || _a === void 0 ? void 0 : _a.key) || "";
407
- const input = e.target.value;
407
+ const input = e.target.value.replace(/\?/g, "%");
408
408
  let searchType = ((_b = searchQueries[currentKey]) === null || _b === void 0 ? void 0 : _b.type) ||
409
409
  defaultSearchOperation ||
410
410
  "contains";
@@ -431,7 +431,21 @@ const GridHeader = ({ columns, onSearch, searchQueries, sortable, search, resiza
431
431
  searchType = "endsWith";
432
432
  }
433
433
  }
434
- onSearch(currentKey, input, searchType);
434
+ let query = input;
435
+ if (query &&
436
+ !query.includes("%") &&
437
+ !query.includes("_")) {
438
+ if (searchType === "contains") {
439
+ query = `%${query}%`;
440
+ }
441
+ else if (searchType === "startsWith") {
442
+ query = `${query}%`;
443
+ }
444
+ else if (searchType === "endsWith") {
445
+ query = `%${query}`;
446
+ }
447
+ }
448
+ onSearch(currentKey, query, searchType);
435
449
  }, placeholder: "Search", extraWrapperStyle: {
436
450
  background: ((_r = headerColumns.find((column) => column.key === _groupBy)) === null || _r === void 0 ? void 0 : _r.search)
437
451
  ? "var(--background)"
@@ -549,7 +563,7 @@ const GridHeader = ({ columns, onSearch, searchQueries, sortable, search, resiza
549
563
  }, onChange: (e) => {
550
564
  var _a, _b;
551
565
  const currentKey = ((_a = headerColumns.find((column) => column.key === _groupBy)) === null || _a === void 0 ? void 0 : _a.key) || "";
552
- const input = e.target.value;
566
+ const input = e.target.value.replace(/\?/g, "%");
553
567
  let searchType = ((_b = searchQueries[currentKey]) === null || _b === void 0 ? void 0 : _b.type) ||
554
568
  defaultSearchOperation ||
555
569
  "contains";
@@ -576,7 +590,21 @@ const GridHeader = ({ columns, onSearch, searchQueries, sortable, search, resiza
576
590
  searchType = "endsWith";
577
591
  }
578
592
  }
579
- onSearch(currentKey, input, searchType);
593
+ let query = input;
594
+ if (query &&
595
+ !query.includes("%") &&
596
+ !query.includes("_")) {
597
+ if (searchType === "contains") {
598
+ query = `%${query}%`;
599
+ }
600
+ else if (searchType === "startsWith") {
601
+ query = `${query}%`;
602
+ }
603
+ else if (searchType === "endsWith") {
604
+ query = `%${query}`;
605
+ }
606
+ }
607
+ onSearch(currentKey, query, searchType);
580
608
  }, placeholder: "Search", extraWrapperStyle: {
581
609
  background: ((_24 = headerColumns.find((column) => column.key === _groupBy)) === null || _24 === void 0 ? void 0 : _24.search)
582
610
  ? "var(--background)"
@@ -888,7 +916,7 @@ const GridHeader = ({ columns, onSearch, searchQueries, sortable, search, resiza
888
916
  alignItems: "center",
889
917
  }, children: [_jsx(TextInput, { onFocus: () => setActiveSearchColumn(column.key), onChange: (e) => {
890
918
  var _a;
891
- const input = e.target.value;
919
+ const input = e.target.value.replace(/\?/g, "%");
892
920
  let searchType = ((_a = searchQueries[column.key]) === null || _a === void 0 ? void 0 : _a.type) ||
893
921
  defaultSearchOperation ||
894
922
  "contains";
@@ -915,7 +943,21 @@ const GridHeader = ({ columns, onSearch, searchQueries, sortable, search, resiza
915
943
  searchType = "endsWith";
916
944
  }
917
945
  }
918
- onSearch(column.key, input, searchType);
946
+ let query = input;
947
+ if (query &&
948
+ !query.includes("%") &&
949
+ !query.includes("_")) {
950
+ if (searchType === "contains") {
951
+ query = `%${query}%`;
952
+ }
953
+ else if (searchType === "startsWith") {
954
+ query = `${query}%`;
955
+ }
956
+ else if (searchType === "endsWith") {
957
+ query = `%${query}`;
958
+ }
959
+ }
960
+ onSearch(column.key, query, searchType);
919
961
  }, placeholder: "Search", extraWrapperStyle: {
920
962
  background: column.search
921
963
  ? "var(--background)"
@@ -994,7 +1036,7 @@ const GridHeader = ({ columns, onSearch, searchQueries, sortable, search, resiza
994
1036
  alignItems: "center",
995
1037
  }, children: [_jsx(TextInput, { onFocus: () => setActiveSearchColumn(column.key), onChange: (e) => {
996
1038
  var _a;
997
- const input = e.target.value;
1039
+ const input = e.target.value.replace(/\?/g, "%");
998
1040
  let searchType = ((_a = searchQueries[column.key]) === null || _a === void 0 ? void 0 : _a.type) ||
999
1041
  defaultSearchOperation ||
1000
1042
  "contains";
@@ -1021,7 +1063,21 @@ const GridHeader = ({ columns, onSearch, searchQueries, sortable, search, resiza
1021
1063
  searchType = "endsWith";
1022
1064
  }
1023
1065
  }
1024
- onSearch(column.key, input, searchType);
1066
+ let query = input;
1067
+ if (query &&
1068
+ !query.includes("%") &&
1069
+ !query.includes("_")) {
1070
+ if (searchType === "contains") {
1071
+ query = `%${query}%`;
1072
+ }
1073
+ else if (searchType === "startsWith") {
1074
+ query = `${query}%`;
1075
+ }
1076
+ else if (searchType === "endsWith") {
1077
+ query = `%${query}`;
1078
+ }
1079
+ }
1080
+ onSearch(column.key, query, searchType);
1025
1081
  }, placeholder: "Search", extraWrapperStyle: {
1026
1082
  background: column.search
1027
1083
  ? "var(--background)"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@megha-ui/react",
3
- "version": "1.3.107",
3
+ "version": "1.3.109",
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",