@megha-ui/react 1.3.108 → 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,11 +404,10 @@ 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";
411
- console.log({ input });
412
411
  if (input.includes("to")) {
413
412
  searchType = "between";
414
413
  }
@@ -432,7 +431,21 @@ const GridHeader = ({ columns, onSearch, searchQueries, sortable, search, resiza
432
431
  searchType = "endsWith";
433
432
  }
434
433
  }
435
- 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);
436
449
  }, placeholder: "Search", extraWrapperStyle: {
437
450
  background: ((_r = headerColumns.find((column) => column.key === _groupBy)) === null || _r === void 0 ? void 0 : _r.search)
438
451
  ? "var(--background)"
@@ -550,7 +563,7 @@ const GridHeader = ({ columns, onSearch, searchQueries, sortable, search, resiza
550
563
  }, onChange: (e) => {
551
564
  var _a, _b;
552
565
  const currentKey = ((_a = headerColumns.find((column) => column.key === _groupBy)) === null || _a === void 0 ? void 0 : _a.key) || "";
553
- const input = e.target.value;
566
+ const input = e.target.value.replace(/\?/g, "%");
554
567
  let searchType = ((_b = searchQueries[currentKey]) === null || _b === void 0 ? void 0 : _b.type) ||
555
568
  defaultSearchOperation ||
556
569
  "contains";
@@ -577,7 +590,21 @@ const GridHeader = ({ columns, onSearch, searchQueries, sortable, search, resiza
577
590
  searchType = "endsWith";
578
591
  }
579
592
  }
580
- 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);
581
608
  }, placeholder: "Search", extraWrapperStyle: {
582
609
  background: ((_24 = headerColumns.find((column) => column.key === _groupBy)) === null || _24 === void 0 ? void 0 : _24.search)
583
610
  ? "var(--background)"
@@ -889,7 +916,7 @@ const GridHeader = ({ columns, onSearch, searchQueries, sortable, search, resiza
889
916
  alignItems: "center",
890
917
  }, children: [_jsx(TextInput, { onFocus: () => setActiveSearchColumn(column.key), onChange: (e) => {
891
918
  var _a;
892
- const input = e.target.value;
919
+ const input = e.target.value.replace(/\?/g, "%");
893
920
  let searchType = ((_a = searchQueries[column.key]) === null || _a === void 0 ? void 0 : _a.type) ||
894
921
  defaultSearchOperation ||
895
922
  "contains";
@@ -916,7 +943,21 @@ const GridHeader = ({ columns, onSearch, searchQueries, sortable, search, resiza
916
943
  searchType = "endsWith";
917
944
  }
918
945
  }
919
- 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);
920
961
  }, placeholder: "Search", extraWrapperStyle: {
921
962
  background: column.search
922
963
  ? "var(--background)"
@@ -995,7 +1036,7 @@ const GridHeader = ({ columns, onSearch, searchQueries, sortable, search, resiza
995
1036
  alignItems: "center",
996
1037
  }, children: [_jsx(TextInput, { onFocus: () => setActiveSearchColumn(column.key), onChange: (e) => {
997
1038
  var _a;
998
- const input = e.target.value;
1039
+ const input = e.target.value.replace(/\?/g, "%");
999
1040
  let searchType = ((_a = searchQueries[column.key]) === null || _a === void 0 ? void 0 : _a.type) ||
1000
1041
  defaultSearchOperation ||
1001
1042
  "contains";
@@ -1022,7 +1063,21 @@ const GridHeader = ({ columns, onSearch, searchQueries, sortable, search, resiza
1022
1063
  searchType = "endsWith";
1023
1064
  }
1024
1065
  }
1025
- 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);
1026
1081
  }, placeholder: "Search", extraWrapperStyle: {
1027
1082
  background: column.search
1028
1083
  ? "var(--background)"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@megha-ui/react",
3
- "version": "1.3.108",
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",