@megha-ui/react 1.3.104 → 1.3.105

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
- onSearch(currentKey, input, searchType);
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,6 +1116,14 @@ 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";
@@ -1119,7 +1150,21 @@ const GridHeader = ({ columns, onSearch, searchQueries, sortable, search, resiza
1119
1150
  searchType = "endsWith";
1120
1151
  }
1121
1152
  }
1122
- onSearch(column.key, input, searchType);
1153
+ let query = input;
1154
+ if (query &&
1155
+ !query.includes("%") &&
1156
+ !query.includes("_")) {
1157
+ if (searchType === "contains") {
1158
+ query = `%${query}%`;
1159
+ }
1160
+ else if (searchType === "startsWith") {
1161
+ query = `${query}%`;
1162
+ }
1163
+ else if (searchType === "endsWith") {
1164
+ query = `%${query}`;
1165
+ }
1166
+ }
1167
+ onSearch(column.key, query, searchType);
1123
1168
  }, placeholder: "Search", extraWrapperStyle: {
1124
1169
  background: column.search
1125
1170
  ? "var(--background)"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@megha-ui/react",
3
- "version": "1.3.104",
3
+ "version": "1.3.105",
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",