@megha-ui/react 1.3.110 → 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.
@@ -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.replace(/\?/g, "%");
407
+ const input = e.target.value;
408
408
  let searchType = ((_b = searchQueries[currentKey]) === null || _b === void 0 ? void 0 : _b.type) ||
409
409
  defaultSearchOperation ||
410
410
  "contains";
@@ -446,6 +446,28 @@ const GridHeader = ({ columns, onSearch, searchQueries, sortable, search, resiza
446
446
  }
447
447
  }
448
448
  onSearch(currentKey, query, searchType);
449
+ }, onBlur: (e) => {
450
+ var _a, _b;
451
+ const currentKey = ((_a = headerColumns.find((column) => column.key === _groupBy)) === null || _a === void 0 ? void 0 : _a.key) || "";
452
+ const input = e.target.value.replace(/\?/g, "%");
453
+ const searchType = ((_b = searchQueries[currentKey]) === null || _b === void 0 ? void 0 : _b.type) ||
454
+ defaultSearchOperation ||
455
+ "contains";
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);
449
471
  }, placeholder: "Search", extraWrapperStyle: {
450
472
  background: ((_r = headerColumns.find((column) => column.key === _groupBy)) === null || _r === void 0 ? void 0 : _r.search)
451
473
  ? "var(--background)"
@@ -458,7 +480,7 @@ const GridHeader = ({ columns, onSearch, searchQueries, sortable, search, resiza
458
480
  : ((_c = headerColumns.find((column) => column.key === _groupBy)) === null || _c === void 0 ? void 0 : _c.dataType) === "date"
459
481
  ? dateTypeSearch.includes(item.value)
460
482
  : textTypeSearch.includes(item.value);
461
- }), selectedValues: [
483
+ }), isSort: false, selectedValues: [
462
484
  ((_x = searchQueries[(_w = (_v = headerColumns.find((column) => column.key === _groupBy)) === null || _v === void 0 ? void 0 : _v.key) !== null && _w !== void 0 ? _w : ""]) === null || _x === void 0 ? void 0 : _x.type) ||
463
485
  defaultSearchOperation ||
464
486
  "contains",
@@ -563,7 +585,7 @@ const GridHeader = ({ columns, onSearch, searchQueries, sortable, search, resiza
563
585
  }, onChange: (e) => {
564
586
  var _a, _b;
565
587
  const currentKey = ((_a = headerColumns.find((column) => column.key === _groupBy)) === null || _a === void 0 ? void 0 : _a.key) || "";
566
- const input = e.target.value.replace(/\?/g, "%");
588
+ const input = e.target.value;
567
589
  let searchType = ((_b = searchQueries[currentKey]) === null || _b === void 0 ? void 0 : _b.type) ||
568
590
  defaultSearchOperation ||
569
591
  "contains";
@@ -605,6 +627,28 @@ const GridHeader = ({ columns, onSearch, searchQueries, sortable, search, resiza
605
627
  }
606
628
  }
607
629
  onSearch(currentKey, query, searchType);
630
+ }, onBlur: (e) => {
631
+ var _a, _b;
632
+ const currentKey = ((_a = headerColumns.find((column) => column.key === _groupBy)) === null || _a === void 0 ? void 0 : _a.key) || "";
633
+ const input = e.target.value.replace(/\?/g, "%");
634
+ const searchType = ((_b = searchQueries[currentKey]) === null || _b === void 0 ? void 0 : _b.type) ||
635
+ defaultSearchOperation ||
636
+ "contains";
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);
608
652
  }, placeholder: "Search", extraWrapperStyle: {
609
653
  background: ((_24 = headerColumns.find((column) => column.key === _groupBy)) === null || _24 === void 0 ? void 0 : _24.search)
610
654
  ? "var(--background)"
@@ -617,7 +661,7 @@ const GridHeader = ({ columns, onSearch, searchQueries, sortable, search, resiza
617
661
  : ((_c = headerColumns.find((column) => column.key === _groupBy)) === null || _c === void 0 ? void 0 : _c.dataType) === "date"
618
662
  ? dateTypeSearch.includes(item.value)
619
663
  : textTypeSearch.includes(item.value);
620
- }), selectedValues: [
664
+ }), isSort: false, selectedValues: [
621
665
  ((_30 = searchQueries[(_29 = (_28 = headerColumns.find((column) => column.key === _groupBy)) === null || _28 === void 0 ? void 0 : _28.key) !== null && _29 !== void 0 ? _29 : ""]) === null || _30 === void 0 ? void 0 : _30.type) ||
622
666
  defaultSearchOperation ||
623
667
  "contains",
@@ -722,7 +766,7 @@ const GridHeader = ({ columns, onSearch, searchQueries, sortable, search, resiza
722
766
  }, onChange: (e) => {
723
767
  var _a, _b;
724
768
  const currentKey = ((_a = headerColumns.find((column) => column.key === _groupBy)) === null || _a === void 0 ? void 0 : _a.key) || "";
725
- const input = e.target.value.replace(/\?/g, "%");
769
+ const input = e.target.value;
726
770
  let searchType = ((_b = searchQueries[currentKey]) === null || _b === void 0 ? void 0 : _b.type) ||
727
771
  defaultSearchOperation ||
728
772
  "contains";
@@ -762,6 +806,28 @@ const GridHeader = ({ columns, onSearch, searchQueries, sortable, search, resiza
762
806
  }
763
807
  }
764
808
  onSearch(currentKey, query, searchType);
809
+ }, onBlur: (e) => {
810
+ var _a, _b;
811
+ const currentKey = ((_a = headerColumns.find((column) => column.key === _groupBy)) === null || _a === void 0 ? void 0 : _a.key) || "";
812
+ const input = e.target.value.replace(/\?/g, "%");
813
+ const searchType = ((_b = searchQueries[currentKey]) === null || _b === void 0 ? void 0 : _b.type) ||
814
+ defaultSearchOperation ||
815
+ "contains";
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);
765
831
  }, placeholder: "Search", extraWrapperStyle: {
766
832
  background: ((_57 = headerColumns.find((column) => column.key === _groupBy)) === null || _57 === void 0 ? void 0 : _57.search)
767
833
  ? "var(--background)"
@@ -774,7 +840,7 @@ const GridHeader = ({ columns, onSearch, searchQueries, sortable, search, resiza
774
840
  : ((_c = headerColumns.find((column) => column.key === _groupBy)) === null || _c === void 0 ? void 0 : _c.dataType) === "date"
775
841
  ? dateTypeSearch.includes(item.value)
776
842
  : textTypeSearch.includes(item.value);
777
- }), selectedValues: [
843
+ }), isSort: false, selectedValues: [
778
844
  ((_63 = searchQueries[(_62 = (_61 = headerColumns.find((column) => column.key === _groupBy)) === null || _61 === void 0 ? void 0 : _61.key) !== null && _62 !== void 0 ? _62 : ""]) === null || _63 === void 0 ? void 0 : _63.type) ||
779
845
  defaultSearchOperation ||
780
846
  "contains",
@@ -916,7 +982,7 @@ const GridHeader = ({ columns, onSearch, searchQueries, sortable, search, resiza
916
982
  alignItems: "center",
917
983
  }, children: [_jsx(TextInput, { onFocus: () => setActiveSearchColumn(column.key), onChange: (e) => {
918
984
  var _a;
919
- const input = e.target.value.replace(/\?/g, "%");
985
+ const input = e.target.value;
920
986
  let searchType = ((_a = searchQueries[column.key]) === null || _a === void 0 ? void 0 : _a.type) ||
921
987
  defaultSearchOperation ||
922
988
  "contains";
@@ -958,6 +1024,28 @@ const GridHeader = ({ columns, onSearch, searchQueries, sortable, search, resiza
958
1024
  }
959
1025
  }
960
1026
  onSearch(column.key, query, searchType);
1027
+ }, onBlur: (e) => {
1028
+ var _a;
1029
+ const currentKey = (column === null || column === void 0 ? void 0 : column.key) || "";
1030
+ const input = e.target.value.replace(/\?/g, "%");
1031
+ const searchType = ((_a = searchQueries[currentKey]) === null || _a === void 0 ? void 0 : _a.type) ||
1032
+ defaultSearchOperation ||
1033
+ "contains";
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);
961
1049
  }, placeholder: "Search", extraWrapperStyle: {
962
1050
  background: column.search
963
1051
  ? "var(--background)"
@@ -968,7 +1056,7 @@ const GridHeader = ({ columns, onSearch, searchQueries, sortable, search, resiza
968
1056
  ? numberTypeSearch.includes(item.value)
969
1057
  : column.dataType === "date"
970
1058
  ? dateTypeSearch.includes(item.value)
971
- : textTypeSearch.includes(item.value)), selectedValues: [
1059
+ : textTypeSearch.includes(item.value)), isSort: false, selectedValues: [
972
1060
  ((_c = searchQueries[column.key]) === null || _c === void 0 ? void 0 : _c.type) ||
973
1061
  defaultSearchOperation ||
974
1062
  "contains",
@@ -1036,7 +1124,7 @@ const GridHeader = ({ columns, onSearch, searchQueries, sortable, search, resiza
1036
1124
  alignItems: "center",
1037
1125
  }, children: [_jsx(TextInput, { onFocus: () => setActiveSearchColumn(column.key), onChange: (e) => {
1038
1126
  var _a;
1039
- const input = e.target.value.replace(/\?/g, "%");
1127
+ const input = e.target.value;
1040
1128
  let searchType = ((_a = searchQueries[column.key]) === null || _a === void 0 ? void 0 : _a.type) ||
1041
1129
  defaultSearchOperation ||
1042
1130
  "contains";
@@ -1078,6 +1166,28 @@ const GridHeader = ({ columns, onSearch, searchQueries, sortable, search, resiza
1078
1166
  }
1079
1167
  }
1080
1168
  onSearch(column.key, query, searchType);
1169
+ }, onBlur: (e) => {
1170
+ var _a;
1171
+ const currentKey = (column === null || column === void 0 ? void 0 : column.key) || "";
1172
+ const input = e.target.value.replace(/\?/g, "%");
1173
+ const searchType = ((_a = searchQueries[currentKey]) === null || _a === void 0 ? void 0 : _a.type) ||
1174
+ defaultSearchOperation ||
1175
+ "contains";
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);
1081
1191
  }, placeholder: "Search", extraWrapperStyle: {
1082
1192
  background: column.search
1083
1193
  ? "var(--background)"
@@ -1088,7 +1198,7 @@ const GridHeader = ({ columns, onSearch, searchQueries, sortable, search, resiza
1088
1198
  ? numberTypeSearch.includes(item.value)
1089
1199
  : column.dataType === "date"
1090
1200
  ? dateTypeSearch.includes(item.value)
1091
- : textTypeSearch.includes(item.value)), selectedValues: [
1201
+ : textTypeSearch.includes(item.value)), isSort: false, selectedValues: [
1092
1202
  ((_j = searchQueries[column.key]) === null || _j === void 0 ? void 0 : _j.type) ||
1093
1203
  defaultSearchOperation ||
1094
1204
  "contains",
@@ -1154,7 +1264,7 @@ const GridHeader = ({ columns, onSearch, searchQueries, sortable, search, resiza
1154
1264
  alignItems: "center",
1155
1265
  }, children: [_jsx(TextInput, { onFocus: () => setActiveSearchColumn(column.key), onChange: (e) => {
1156
1266
  var _a;
1157
- const input = e.target.value.replace(/\?/g, "%");
1267
+ const input = e.target.value;
1158
1268
  let searchType = ((_a = searchQueries[column.key]) === null || _a === void 0 ? void 0 : _a.type) ||
1159
1269
  defaultSearchOperation ||
1160
1270
  "contains";
@@ -1181,6 +1291,14 @@ const GridHeader = ({ columns, onSearch, searchQueries, sortable, search, resiza
1181
1291
  searchType = "endsWith";
1182
1292
  }
1183
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";
1184
1302
  let query = input;
1185
1303
  if (query &&
1186
1304
  !query.includes("%") &&
@@ -1195,7 +1313,7 @@ const GridHeader = ({ columns, onSearch, searchQueries, sortable, search, resiza
1195
1313
  query = `%${query}`;
1196
1314
  }
1197
1315
  }
1198
- onSearch(column.key, query, searchType);
1316
+ onSearch(currentKey, query, searchType);
1199
1317
  }, placeholder: "Search", extraWrapperStyle: {
1200
1318
  background: column.search
1201
1319
  ? "var(--background)"
@@ -1205,7 +1323,7 @@ const GridHeader = ({ columns, onSearch, searchQueries, sortable, search, resiza
1205
1323
  ? numberTypeSearch.includes(item.value)
1206
1324
  : column.dataType === "date"
1207
1325
  ? dateTypeSearch.includes(item.value)
1208
- : textTypeSearch.includes(item.value)), selectedValues: [
1326
+ : textTypeSearch.includes(item.value)), isSort: false, selectedValues: [
1209
1327
  ((_q = searchQueries[column.key]) === null || _q === void 0 ? void 0 : _q.type) ||
1210
1328
  defaultSearchOperation ||
1211
1329
  "contains",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@megha-ui/react",
3
- "version": "1.3.110",
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",