@megha-ui/react 1.2.38 → 1.2.40

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.
@@ -17,14 +17,14 @@ const useSort = (data, columns, uniqueSearch, multiSorting, withAscii) => {
17
17
  : withAscii
18
18
  ? (_e = (_d = a[key]) === null || _d === void 0 ? void 0 : _d.value) === null || _e === void 0 ? void 0 : _e.toString()
19
19
  : (_g = (_f = a[key]) === null || _f === void 0 ? void 0 : _f.value) === null || _g === void 0 ? void 0 : _g.toString().toUpperCase()
20
- : "";
20
+ : (column === null || column === void 0 ? void 0 : column.dataType) === "number" ? 0 : "";
21
21
  const bValue = ((_h = b[key]) === null || _h === void 0 ? void 0 : _h.value)
22
22
  ? (column === null || column === void 0 ? void 0 : column.dataType) && (column === null || column === void 0 ? void 0 : column.dataType) === "number"
23
23
  ? parseFloat((_k = (_j = b[key]) === null || _j === void 0 ? void 0 : _j.value) === null || _k === void 0 ? void 0 : _k.toString())
24
24
  : withAscii
25
25
  ? (_m = (_l = b[key]) === null || _l === void 0 ? void 0 : _l.value) === null || _m === void 0 ? void 0 : _m.toString()
26
26
  : (_p = (_o = b[key]) === null || _o === void 0 ? void 0 : _o.value) === null || _p === void 0 ? void 0 : _p.toString().toUpperCase()
27
- : "";
27
+ : (column === null || column === void 0 ? void 0 : column.dataType) === "number" ? 0 : "";
28
28
  if (aValue < bValue)
29
29
  return -1 * order;
30
30
  if (aValue > bValue)
@@ -992,33 +992,33 @@ const Grid = ({ columns, wrapperClass, updateGridColumns, data, height, sortable
992
992
  };
993
993
  const filterDetails = (0, react_1.useMemo)(() => {
994
994
  const filterColumn = gridColumns.reduce((acc, column) => {
995
- var _a;
995
+ var _a, _b;
996
996
  const query = searchQueries[column.key];
997
- const uniqeValues = (0, gridHeader_1.getColumnData)(column.key, filteredData);
997
+ const uniqeValues = (0, gridHeader_1.getColumnData)(column.key, filteredData, (_a = column.dataType) !== null && _a !== void 0 ? _a : "string");
998
998
  console.log(uniqeValues, uniqueSearch, column.key);
999
999
  if (query &&
1000
1000
  (query.text !== "" || query.type !== defaultSearchOperation)) {
1001
1001
  acc[column.key] = query.text;
1002
1002
  }
1003
1003
  else if (uniqueSearch[column.key] &&
1004
- uniqeValues.join("") !== ((_a = uniqueSearch[column.key]) === null || _a === void 0 ? void 0 : _a.join(""))) {
1004
+ uniqeValues.join("") !== ((_b = uniqueSearch[column.key]) === null || _b === void 0 ? void 0 : _b.join(""))) {
1005
1005
  acc[column.key] = uniqueSearch[column.key].join(",");
1006
1006
  }
1007
1007
  return acc;
1008
1008
  }, {});
1009
1009
  const propFilterColumn = gridColumns.reduce((acc, column) => {
1010
- var _a;
1010
+ var _a, _b;
1011
1011
  if (filterData) {
1012
1012
  const { searchQueries, uniqueSearch } = filterData;
1013
1013
  const query = searchQueries[column.key];
1014
- const uniqeValues = (0, gridHeader_1.getColumnData)(column.key, filteredData);
1014
+ const uniqeValues = (0, gridHeader_1.getColumnData)(column.key, filteredData, (_a = column.dataType) !== null && _a !== void 0 ? _a : "string");
1015
1015
  if (query &&
1016
1016
  (query.text !== "" || query.type !== defaultSearchOperation)) {
1017
1017
  acc[column.key] = query.text;
1018
1018
  }
1019
1019
  else if (uniqueSearch[column.key] &&
1020
1020
  uniqeValues.join("") !==
1021
- ((_a = uniqueSearch[column.key]) === null || _a === void 0 ? void 0 : _a.join(""))) {
1021
+ ((_b = uniqueSearch[column.key]) === null || _b === void 0 ? void 0 : _b.join(""))) {
1022
1022
  acc[column.key] = uniqueSearch[column.key].join(",");
1023
1023
  }
1024
1024
  }
@@ -29,6 +29,7 @@ const GridFilterDropdown = ({ headerDropdownIndex, searchOptions, position, colu
29
29
  if (typeof uniqueSearch[columnKey] === "undefined") {
30
30
  setUniqueSearch((prev) => (Object.assign(Object.assign({}, prev), { [columnKey]: columnData })));
31
31
  }
32
+ console.log({ columnData });
32
33
  setFilterColumnData(columnData);
33
34
  }, [columnData]);
34
35
  (0, react_1.useEffect)(() => {
@@ -53,6 +53,6 @@ interface GridHeaderProps {
53
53
  actionsKey?: string;
54
54
  columnSearchOutside: boolean;
55
55
  }
56
- export declare const getColumnData: (columnKey: string, gridData: DataRow[]) => (string | number)[];
56
+ export declare const getColumnData: (columnKey: string, gridData: DataRow[], type: string) => (string | number)[];
57
57
  declare const _default: React.NamedExoticComponent<GridHeaderProps>;
58
58
  export default _default;
@@ -46,23 +46,39 @@ const textFilterDropdown_1 = __importDefault(require("./textFilterDropdown"));
46
46
  const date_input_1 = __importDefault(require("../../date-input"));
47
47
  const text_input_1 = __importDefault(require("../../text-input"));
48
48
  const checkbox_1 = __importDefault(require("../../checkbox"));
49
- const getColumnData = (columnKey, gridData) => {
49
+ const getColumnData = (columnKey, gridData, type) => {
50
50
  const returnedValue = [
51
51
  ...new Set(gridData
52
52
  .filter((item) => item[columnKey])
53
- .map((data) => data[columnKey] && data[columnKey].value && typeof data[columnKey].value === "string"
53
+ .map((data) => data[columnKey] &&
54
+ data[columnKey].value &&
55
+ typeof data[columnKey].value === "string"
54
56
  ? /^[-+]?\d*\.?\d+$/.test(data[columnKey].value.trim())
55
57
  ? parseInt(data[columnKey].value)
56
58
  : data[columnKey].value
57
59
  : data[columnKey].value)),
58
60
  ];
59
- if (returnedValue.every((item) => typeof item === "number")) {
60
- return returnedValue.sort((a, b) => a - b);
61
- }
62
- else if (returnedValue.every((item) => typeof item === "string")) {
63
- return returnedValue.sort((a, b) => a.toLowerCase() > b.toLowerCase() ? 1 : -1);
64
- }
65
- return returnedValue;
61
+ return returnedValue.sort((a, b) => {
62
+ const aValue = a
63
+ ? type === "number"
64
+ ? parseFloat(a === null || a === void 0 ? void 0 : a.toString())
65
+ : a === null || a === void 0 ? void 0 : a.toString().toUpperCase()
66
+ : type === "number"
67
+ ? 0
68
+ : "";
69
+ const bValue = b
70
+ ? type === "number"
71
+ ? parseFloat(b === null || b === void 0 ? void 0 : b.toString())
72
+ : b === null || b === void 0 ? void 0 : b.toString().toUpperCase()
73
+ : type === "number"
74
+ ? 0
75
+ : "";
76
+ if (aValue < bValue)
77
+ return -1;
78
+ if (aValue > bValue)
79
+ return 1;
80
+ return 0;
81
+ });
66
82
  };
67
83
  exports.getColumnData = getColumnData;
68
84
  const GridHeader = ({ columns, onSearch, searchQueries, sortable, search, resizable = false, defaultSearchOperation, sortQueries, onSort, bulkSelect, allRowsSelected, someRowsSelected, toggleSelectAll, cellStyle, widthMode, rowHeight, headerRef, showMenu, headerBackground, headerTopBorder, headerBottomBorder, groupBy, setGroupBy, updateGridColumns, setGridColumns, headerDropdownIndex, widthUnits, textFilterLabel = "Text Filter", gridData, checkboxWrapper, onFilter, setUniqueSearch, uniqueSearch, hugColumnWidths, menuVisible, setMenuVisible, dropdownVisible, setDropdownVisible, actionsKey = "actions", columnSearchOutside, }) => {
@@ -259,7 +275,7 @@ const GridHeader = ({ columns, onSearch, searchQueries, sortable, search, resiza
259
275
  .split(",")
260
276
  .filter((item) => item)
261
277
  .map((_groupBy) => {
262
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22, _23, _24, _25, _26, _27, _28, _29, _30, _31, _32, _33, _34, _35, _36, _37, _38, _39, _40, _41, _42, _43, _44, _45, _46, _47, _48, _49, _50, _51, _52, _53, _54, _55, _56, _57, _58;
278
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22, _23, _24, _25, _26, _27, _28, _29, _30, _31, _32, _33, _34, _35, _36, _37, _38, _39, _40, _41, _42, _43, _44, _45, _46, _47, _48, _49, _50, _51, _52, _53, _54, _55, _56, _57, _58, _59, _60;
263
279
  return ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: headerColumns.find((column) => column.key === _groupBy) && ((0, jsx_runtime_1.jsxs)("div", { className: `${sortable &&
264
280
  ((_a = headerColumns.find((column) => column.key === _groupBy)) === null || _a === void 0 ? void 0 : _a.sortable)
265
281
  ? "sortable"
@@ -354,7 +370,7 @@ const GridHeader = ({ columns, onSearch, searchQueries, sortable, search, resiza
354
370
  : ((_b = headerColumns.find((column) => column.key === _groupBy)) === null || _b === void 0 ? void 0 : _b.dataType) === "date"
355
371
  ? dateTypeSearch.includes(item.value)
356
372
  : textTypeSearch.includes(item.value);
357
- }), position: searchOpsPosition || { top: 0, left: 0 }, columnKey: ((_1 = headerColumns.find((column) => column.key === _groupBy)) === null || _1 === void 0 ? void 0 : _1.key) || "", columnData: (0, exports.getColumnData)(((_2 = headerColumns.find((column) => column.key === _groupBy)) === null || _2 === void 0 ? void 0 : _2.key) || "", gridData), searchElement: (0, jsx_runtime_1.jsx)("div", { id: "search-input", children: ((_3 = headerColumns.find((column) => column.key === _groupBy)) === null || _3 === void 0 ? void 0 : _3.dataType) === "date" ? (((_5 = searchQueries[((_4 = headerColumns.find((column) => column.key === _groupBy)) === null || _4 === void 0 ? void 0 : _4.key) || ""]) === null || _5 === void 0 ? void 0 : _5.type) === "between" ? ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(date_input_1.default, { value: (_7 = searchQueries[((_6 = headerColumns.find((column) => column.key === _groupBy)) === null || _6 === void 0 ? void 0 : _6.key) || ""]) === null || _7 === void 0 ? void 0 : _7.text.split("to")[0], placeholder: `From date`, onChange: (value) => {
373
+ }), position: searchOpsPosition || { top: 0, left: 0 }, columnKey: ((_1 = headerColumns.find((column) => column.key === _groupBy)) === null || _1 === void 0 ? void 0 : _1.key) || "", columnData: (0, exports.getColumnData)(((_2 = headerColumns.find((column) => column.key === _groupBy)) === null || _2 === void 0 ? void 0 : _2.key) || "", gridData, (_4 = (_3 = headerColumns.find((column) => column.key === _groupBy)) === null || _3 === void 0 ? void 0 : _3.dataType) !== null && _4 !== void 0 ? _4 : "string"), searchElement: (0, jsx_runtime_1.jsx)("div", { id: "search-input", children: ((_5 = headerColumns.find((column) => column.key === _groupBy)) === null || _5 === void 0 ? void 0 : _5.dataType) === "date" ? (((_7 = searchQueries[((_6 = headerColumns.find((column) => column.key === _groupBy)) === null || _6 === void 0 ? void 0 : _6.key) || ""]) === null || _7 === void 0 ? void 0 : _7.type) === "between" ? ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(date_input_1.default, { value: (_9 = searchQueries[((_8 = headerColumns.find((column) => column.key === _groupBy)) === null || _8 === void 0 ? void 0 : _8.key) || ""]) === null || _9 === void 0 ? void 0 : _9.text.split("to")[0], placeholder: `From date`, onChange: (value) => {
358
374
  var _a, _b, _c, _d, _e;
359
375
  return onSearch(((_a = headerColumns.find((column) => column.key === _groupBy)) === null || _a === void 0 ? void 0 : _a.key) || "", (_c = searchQueries[((_b = headerColumns.find((column) => column.key === _groupBy)) === null || _b === void 0 ? void 0 : _b.key) || ""]) === null || _c === void 0 ? void 0 : _c.text.split("to").map((item, index) => {
360
376
  if (index === 0) {
@@ -364,7 +380,7 @@ const GridHeader = ({ columns, onSearch, searchQueries, sortable, search, resiza
364
380
  }).join("to"), ((_e = searchQueries[((_d = headerColumns.find((column) => column.key === _groupBy)) === null || _d === void 0 ? void 0 : _d.key) || ""]) === null || _e === void 0 ? void 0 : _e.type) ||
365
381
  defaultSearchOperation ||
366
382
  "contains");
367
- } }), (0, jsx_runtime_1.jsx)(date_input_1.default, { value: (_9 = searchQueries[((_8 = headerColumns.find((column) => column.key === _groupBy)) === null || _8 === void 0 ? void 0 : _8.key) || ""]) === null || _9 === void 0 ? void 0 : _9.text.split("to")[1], placeholder: `To date`, onChange: (value) => {
383
+ } }), (0, jsx_runtime_1.jsx)(date_input_1.default, { value: (_11 = searchQueries[((_10 = headerColumns.find((column) => column.key === _groupBy)) === null || _10 === void 0 ? void 0 : _10.key) || ""]) === null || _11 === void 0 ? void 0 : _11.text.split("to")[1], placeholder: `To date`, onChange: (value) => {
368
384
  var _a, _b, _c, _d, _e;
369
385
  return onSearch(((_a = headerColumns.find((column) => column.key === _groupBy)) === null || _a === void 0 ? void 0 : _a.key) || "", (_c = searchQueries[((_b = headerColumns.find((column) => column.key === _groupBy)) === null || _b === void 0 ? void 0 : _b.key) || ""]) === null || _c === void 0 ? void 0 : _c.text.split("to").map((item, index) => {
370
386
  if (index === 1) {
@@ -374,12 +390,12 @@ const GridHeader = ({ columns, onSearch, searchQueries, sortable, search, resiza
374
390
  }).join("to"), ((_e = searchQueries[((_d = headerColumns.find((column) => column.key === _groupBy)) === null || _d === void 0 ? void 0 : _d.key) || ""]) === null || _e === void 0 ? void 0 : _e.type) ||
375
391
  defaultSearchOperation ||
376
392
  "contains");
377
- } })] })) : ((0, jsx_runtime_1.jsx)(date_input_1.default, { value: (_11 = searchQueries[((_10 = headerColumns.find((column) => column.key === _groupBy)) === null || _10 === void 0 ? void 0 : _10.key) || ""]) === null || _11 === void 0 ? void 0 : _11.text.split("to")[0], placeholder: `asd Filter ${(_12 = headerColumns.find((column) => column.key === _groupBy)) === null || _12 === void 0 ? void 0 : _12.label}`, onChange: (value) => {
393
+ } })] })) : ((0, jsx_runtime_1.jsx)(date_input_1.default, { value: (_13 = searchQueries[((_12 = headerColumns.find((column) => column.key === _groupBy)) === null || _12 === void 0 ? void 0 : _12.key) || ""]) === null || _13 === void 0 ? void 0 : _13.text.split("to")[0], placeholder: `asd Filter ${(_14 = headerColumns.find((column) => column.key === _groupBy)) === null || _14 === void 0 ? void 0 : _14.label}`, onChange: (value) => {
378
394
  var _a, _b, _c;
379
395
  return onSearch(((_a = headerColumns.find((column) => column.key === _groupBy)) === null || _a === void 0 ? void 0 : _a.key) || "", value, ((_c = searchQueries[((_b = headerColumns.find((column) => column.key === _groupBy)) === null || _b === void 0 ? void 0 : _b.key) || ""]) === null || _c === void 0 ? void 0 : _c.type) ||
380
396
  defaultSearchOperation ||
381
397
  "contains");
382
- } }))) : ((0, jsx_runtime_1.jsx)(text_input_1.default, { placeholder: `Filter ${(_13 = headerColumns.find((column) => column.key === _groupBy)) === null || _13 === void 0 ? void 0 : _13.label}`, onKeyDown: (e) => {
398
+ } }))) : ((0, jsx_runtime_1.jsx)(text_input_1.default, { placeholder: `Filter ${(_15 = headerColumns.find((column) => column.key === _groupBy)) === null || _15 === void 0 ? void 0 : _15.label}`, onKeyDown: (e) => {
383
399
  var _a;
384
400
  if (e.key === "Enter") {
385
401
  toggleDropdown(((_a = headerColumns.find((column) => column.key === _groupBy)) === null || _a === void 0 ? void 0 : _a.key) || "");
@@ -389,11 +405,11 @@ const GridHeader = ({ columns, onSearch, searchQueries, sortable, search, resiza
389
405
  return onSearch(((_a = headerColumns.find((column) => column.key === _groupBy)) === null || _a === void 0 ? void 0 : _a.key) || "", e.target.value, ((_c = searchQueries[((_b = headerColumns.find((column) => column.key === _groupBy)) === null || _b === void 0 ? void 0 : _b.key) || ""]) === null || _c === void 0 ? void 0 : _c.type) ||
390
406
  defaultSearchOperation ||
391
407
  "contains");
392
- }, value: ((_15 = searchQueries[((_14 = headerColumns.find((column) => column.key === _groupBy)) === null || _14 === void 0 ? void 0 : _14.key) || ""]) === null || _15 === void 0 ? void 0 : _15.text) || "", extraWrapperStyle: {
393
- visibility: ((_16 = headerColumns.find((column) => column.key === _groupBy)) === null || _16 === void 0 ? void 0 : _16.search)
408
+ }, value: ((_17 = searchQueries[((_16 = headerColumns.find((column) => column.key === _groupBy)) === null || _16 === void 0 ? void 0 : _16.key) || ""]) === null || _17 === void 0 ? void 0 : _17.text) || "", extraWrapperStyle: {
409
+ visibility: ((_18 = headerColumns.find((column) => column.key === _groupBy)) === null || _18 === void 0 ? void 0 : _18.search)
394
410
  ? "visible"
395
411
  : "hidden",
396
- }, height: 32, width: "100%", className: "w-full", backgroundColor: "#fff" })) }), onFilter: onFilter, setUniqueSearch: setUniqueSearch, uniqueSearch: uniqueSearch, textFilterLabel: textFilterLabel, activeSearchType: ((_18 = searchQueries[((_17 = headerColumns.find((column) => column.key === _groupBy)) === null || _17 === void 0 ? void 0 : _17.key) || ""]) === null || _18 === void 0 ? void 0 : _18.type) ||
412
+ }, height: 32, width: "100%", className: "w-full", backgroundColor: "#fff" })) }), onFilter: onFilter, setUniqueSearch: setUniqueSearch, uniqueSearch: uniqueSearch, textFilterLabel: textFilterLabel, activeSearchType: ((_20 = searchQueries[((_19 = headerColumns.find((column) => column.key === _groupBy)) === null || _19 === void 0 ? void 0 : _19.key) || ""]) === null || _20 === void 0 ? void 0 : _20.type) ||
397
413
  defaultSearchOperation ||
398
414
  "contains", checkboxWrapper: checkboxWrapper })) : ((0, jsx_runtime_1.jsx)(textFilterDropdown_1.default, { columnIndex: -1, headerDropdownIndex: headerDropdownIndex, sortingOps: (0, jsx_runtime_1.jsx)(gridHeaderDropdown_1.default, { options: menuOptions.filter((item) => item.label !== "Group by"), onClose: () => setDropdownVisible(null), column: headerColumns.find((column) => column.key === _groupBy) }), searchOptions: searchOptions.filter((item) => {
399
415
  var _a, _b;
@@ -402,7 +418,7 @@ const GridHeader = ({ columns, onSearch, searchQueries, sortable, search, resiza
402
418
  : ((_b = headerColumns.find((column) => column.key === _groupBy)) === null || _b === void 0 ? void 0 : _b.dataType) === "date"
403
419
  ? dateTypeSearch.includes(item.value)
404
420
  : textTypeSearch.includes(item.value);
405
- }), position: searchOpsPosition || { top: 0, left: 0 }, columnKey: ((_19 = headerColumns.find((column) => column.key === _groupBy)) === null || _19 === void 0 ? void 0 : _19.key) || "", searchable: ((_20 = headerColumns.find((column) => column.key === _groupBy)) === null || _20 === void 0 ? void 0 : _20.search) || false, searchElement: (0, jsx_runtime_1.jsx)("div", { id: "search-input", children: ((_21 = headerColumns.find((column) => column.key === _groupBy)) === null || _21 === void 0 ? void 0 : _21.dataType) === "date" ? (((_23 = searchQueries[((_22 = headerColumns.find((column) => column.key === _groupBy)) === null || _22 === void 0 ? void 0 : _22.key) || ""]) === null || _23 === void 0 ? void 0 : _23.type) === "between" ? ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(date_input_1.default, { value: (_25 = searchQueries[((_24 = headerColumns.find((column) => column.key === _groupBy)) === null || _24 === void 0 ? void 0 : _24.key) || ""]) === null || _25 === void 0 ? void 0 : _25.text.split("to")[0], placeholder: `From date`, onChange: (value) => {
421
+ }), position: searchOpsPosition || { top: 0, left: 0 }, columnKey: ((_21 = headerColumns.find((column) => column.key === _groupBy)) === null || _21 === void 0 ? void 0 : _21.key) || "", searchable: ((_22 = headerColumns.find((column) => column.key === _groupBy)) === null || _22 === void 0 ? void 0 : _22.search) || false, searchElement: (0, jsx_runtime_1.jsx)("div", { id: "search-input", children: ((_23 = headerColumns.find((column) => column.key === _groupBy)) === null || _23 === void 0 ? void 0 : _23.dataType) === "date" ? (((_25 = searchQueries[((_24 = headerColumns.find((column) => column.key === _groupBy)) === null || _24 === void 0 ? void 0 : _24.key) || ""]) === null || _25 === void 0 ? void 0 : _25.type) === "between" ? ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(date_input_1.default, { value: (_27 = searchQueries[((_26 = headerColumns.find((column) => column.key === _groupBy)) === null || _26 === void 0 ? void 0 : _26.key) || ""]) === null || _27 === void 0 ? void 0 : _27.text.split("to")[0], placeholder: `From date`, onChange: (value) => {
406
422
  var _a, _b, _c, _d, _e;
407
423
  return onSearch(((_a = headerColumns.find((column) => column.key === _groupBy)) === null || _a === void 0 ? void 0 : _a.key) || "", (_c = searchQueries[((_b = headerColumns.find((column) => column.key === _groupBy)) === null || _b === void 0 ? void 0 : _b.key) || ""]) === null || _c === void 0 ? void 0 : _c.text.split("to").map((item, index) => {
408
424
  if (index === 0) {
@@ -412,7 +428,7 @@ const GridHeader = ({ columns, onSearch, searchQueries, sortable, search, resiza
412
428
  }).join("to"), ((_e = searchQueries[((_d = headerColumns.find((column) => column.key === _groupBy)) === null || _d === void 0 ? void 0 : _d.key) || ""]) === null || _e === void 0 ? void 0 : _e.type) ||
413
429
  defaultSearchOperation ||
414
430
  "contains");
415
- } }), (0, jsx_runtime_1.jsx)("div", { style: { marginTop: "0.5rem" }, children: (0, jsx_runtime_1.jsx)(date_input_1.default, { value: (_27 = searchQueries[((_26 = headerColumns.find((column) => column.key === _groupBy)) === null || _26 === void 0 ? void 0 : _26.key) || ""]) === null || _27 === void 0 ? void 0 : _27.text.split("to")[1], placeholder: `To date`, onChange: (value) => {
431
+ } }), (0, jsx_runtime_1.jsx)("div", { style: { marginTop: "0.5rem" }, children: (0, jsx_runtime_1.jsx)(date_input_1.default, { value: (_29 = searchQueries[((_28 = headerColumns.find((column) => column.key === _groupBy)) === null || _28 === void 0 ? void 0 : _28.key) || ""]) === null || _29 === void 0 ? void 0 : _29.text.split("to")[1], placeholder: `To date`, onChange: (value) => {
416
432
  var _a, _b, _c, _d, _e;
417
433
  return onSearch(((_a = headerColumns.find((column) => column.key === _groupBy)) === null || _a === void 0 ? void 0 : _a.key) || "", (_c = searchQueries[((_b = headerColumns.find((column) => column.key === _groupBy)) === null || _b === void 0 ? void 0 : _b.key) || ""]) === null || _c === void 0 ? void 0 : _c.text.split("to").map((item, index) => {
418
434
  if (index === 1) {
@@ -427,9 +443,9 @@ const GridHeader = ({ columns, onSearch, searchQueries, sortable, search, resiza
427
443
  "doesNotContain",
428
444
  "blank",
429
445
  "notBlank",
430
- ].includes(((_29 = searchQueries[((_28 = headerColumns.find((column) => column.key === _groupBy)) === null || _28 === void 0 ? void 0 : _28.key) || ""]) === null || _29 === void 0 ? void 0 : _29.type) ||
446
+ ].includes(((_31 = searchQueries[((_30 = headerColumns.find((column) => column.key === _groupBy)) === null || _30 === void 0 ? void 0 : _30.key) || ""]) === null || _31 === void 0 ? void 0 : _31.type) ||
431
447
  defaultSearchOperation ||
432
- "contains") ? ((0, jsx_runtime_1.jsx)(text_input_1.default, { placeholder: `Filter ${(_30 = headerColumns.find((column) => column.key === _groupBy)) === null || _30 === void 0 ? void 0 : _30.label}`, onKeyDown: (e) => {
448
+ "contains") ? ((0, jsx_runtime_1.jsx)(text_input_1.default, { placeholder: `Filter ${(_32 = headerColumns.find((column) => column.key === _groupBy)) === null || _32 === void 0 ? void 0 : _32.label}`, onKeyDown: (e) => {
433
449
  var _a;
434
450
  if (e.key === "Enter") {
435
451
  toggleDropdown(((_a = headerColumns.find((column) => column.key === _groupBy)) === null || _a === void 0 ? void 0 : _a.key) || "");
@@ -439,16 +455,16 @@ const GridHeader = ({ columns, onSearch, searchQueries, sortable, search, resiza
439
455
  return onSearch(((_a = headerColumns.find((column) => column.key === _groupBy)) === null || _a === void 0 ? void 0 : _a.key) || "", e.target.value, ((_c = searchQueries[((_b = headerColumns.find((column) => column.key === _groupBy)) === null || _b === void 0 ? void 0 : _b.key) || ""]) === null || _c === void 0 ? void 0 : _c.type) ||
440
456
  defaultSearchOperation ||
441
457
  "contains");
442
- }, value: ((_32 = searchQueries[((_31 = headerColumns.find((column) => column.key === _groupBy)) === null || _31 === void 0 ? void 0 : _31.key) || ""]) === null || _32 === void 0 ? void 0 : _32.text) || "", extraWrapperStyle: {
443
- visibility: ((_33 = headerColumns.find((column) => column.key === _groupBy)) === null || _33 === void 0 ? void 0 : _33.search)
458
+ }, value: ((_34 = searchQueries[((_33 = headerColumns.find((column) => column.key === _groupBy)) === null || _33 === void 0 ? void 0 : _33.key) || ""]) === null || _34 === void 0 ? void 0 : _34.text) || "", extraWrapperStyle: {
459
+ visibility: ((_35 = headerColumns.find((column) => column.key === _groupBy)) === null || _35 === void 0 ? void 0 : _35.search)
444
460
  ? "visible"
445
461
  : "hidden",
446
- }, height: 32, width: "100%", className: "w-full", backgroundColor: "#fff" })) : ((0, jsx_runtime_1.jsx)(date_input_1.default, { value: (_35 = searchQueries[((_34 = headerColumns.find((column) => column.key === _groupBy)) === null || _34 === void 0 ? void 0 : _34.key) || ""]) === null || _35 === void 0 ? void 0 : _35.text.split("to")[0], placeholder: `asd Filter ${(_36 = headerColumns.find((column) => column.key === _groupBy)) === null || _36 === void 0 ? void 0 : _36.label}`, onChange: (value) => {
462
+ }, height: 32, width: "100%", className: "w-full", backgroundColor: "#fff" })) : ((0, jsx_runtime_1.jsx)(date_input_1.default, { value: (_37 = searchQueries[((_36 = headerColumns.find((column) => column.key === _groupBy)) === null || _36 === void 0 ? void 0 : _36.key) || ""]) === null || _37 === void 0 ? void 0 : _37.text.split("to")[0], placeholder: `asd Filter ${(_38 = headerColumns.find((column) => column.key === _groupBy)) === null || _38 === void 0 ? void 0 : _38.label}`, onChange: (value) => {
447
463
  var _a, _b, _c;
448
464
  return onSearch(((_a = headerColumns.find((column) => column.key === _groupBy)) === null || _a === void 0 ? void 0 : _a.key) || "", value, ((_c = searchQueries[((_b = headerColumns.find((column) => column.key === _groupBy)) === null || _b === void 0 ? void 0 : _b.key) || ""]) === null || _c === void 0 ? void 0 : _c.type) ||
449
465
  defaultSearchOperation ||
450
466
  "contains");
451
- } }))) : ((0, jsx_runtime_1.jsx)(text_input_1.default, { placeholder: `Filter ${(_37 = headerColumns.find((column) => column.key === _groupBy)) === null || _37 === void 0 ? void 0 : _37.label}`, onKeyDown: (e) => {
467
+ } }))) : ((0, jsx_runtime_1.jsx)(text_input_1.default, { placeholder: `Filter ${(_39 = headerColumns.find((column) => column.key === _groupBy)) === null || _39 === void 0 ? void 0 : _39.label}`, onKeyDown: (e) => {
452
468
  var _a;
453
469
  if (e.key === "Enter") {
454
470
  toggleDropdown(((_a = headerColumns.find((column) => column.key === _groupBy)) === null || _a === void 0 ? void 0 : _a.key) || "");
@@ -458,23 +474,23 @@ const GridHeader = ({ columns, onSearch, searchQueries, sortable, search, resiza
458
474
  return onSearch(((_a = headerColumns.find((column) => column.key === _groupBy)) === null || _a === void 0 ? void 0 : _a.key) || "", e.target.value, ((_c = searchQueries[((_b = headerColumns.find((column) => column.key === _groupBy)) === null || _b === void 0 ? void 0 : _b.key) || ""]) === null || _c === void 0 ? void 0 : _c.type) ||
459
475
  defaultSearchOperation ||
460
476
  "contains");
461
- }, value: ((_39 = searchQueries[((_38 = headerColumns.find((column) => column.key === _groupBy)) === null || _38 === void 0 ? void 0 : _38.key) || ""]) === null || _39 === void 0 ? void 0 : _39.text) || "", extraWrapperStyle: {
462
- visibility: ((_40 = headerColumns.find((column) => column.key === _groupBy)) === null || _40 === void 0 ? void 0 : _40.search)
477
+ }, value: ((_41 = searchQueries[((_40 = headerColumns.find((column) => column.key === _groupBy)) === null || _40 === void 0 ? void 0 : _40.key) || ""]) === null || _41 === void 0 ? void 0 : _41.text) || "", extraWrapperStyle: {
478
+ visibility: ((_42 = headerColumns.find((column) => column.key === _groupBy)) === null || _42 === void 0 ? void 0 : _42.search)
463
479
  ? "visible"
464
480
  : "hidden",
465
- }, height: 32, width: "100%", className: "w-full", backgroundColor: "#fff" })) }), activeSearchType: ((_42 = searchQueries[((_41 = headerColumns.find((column) => column.key === _groupBy)) === null || _41 === void 0 ? void 0 : _41.key) || ""]) === null || _42 === void 0 ? void 0 : _42.type) ||
481
+ }, height: 32, width: "100%", className: "w-full", backgroundColor: "#fff" })) }), activeSearchType: ((_44 = searchQueries[((_43 = headerColumns.find((column) => column.key === _groupBy)) === null || _43 === void 0 ? void 0 : _43.key) || ""]) === null || _44 === void 0 ? void 0 : _44.type) ||
466
482
  defaultSearchOperation ||
467
483
  "contains", searchInput: (search &&
468
- ((_43 = headerColumns.find((column) => column.key === _groupBy)) === null || _43 === void 0 ? void 0 : _43.search) && ((0, jsx_runtime_1.jsx)("div", { style: {
484
+ ((_45 = headerColumns.find((column) => column.key === _groupBy)) === null || _45 === void 0 ? void 0 : _45.search) && ((0, jsx_runtime_1.jsx)("div", { style: {
469
485
  marginTop: "0.5rem",
470
486
  padding: "0.5rem",
471
487
  width: "100%",
472
488
  pointerEvents: search &&
473
- ((_44 = headerColumns.find((column) => column.key === _groupBy)) === null || _44 === void 0 ? void 0 : _44.search)
489
+ ((_46 = headerColumns.find((column) => column.key === _groupBy)) === null || _46 === void 0 ? void 0 : _46.search)
474
490
  ? "auto"
475
491
  : "none",
476
492
  cursor: search &&
477
- ((_45 = headerColumns.find((column) => column.key === _groupBy)) === null || _45 === void 0 ? void 0 : _45.search)
493
+ ((_47 = headerColumns.find((column) => column.key === _groupBy)) === null || _47 === void 0 ? void 0 : _47.search)
478
494
  ? "default"
479
495
  : "not-allowed",
480
496
  }, children: (0, jsx_runtime_1.jsx)(text_input_1.default, { onChange: (e) => {
@@ -490,23 +506,23 @@ const GridHeader = ({ columns, onSearch, searchQueries, sortable, search, resiza
490
506
  }
491
507
  onSearch(((_c = headerColumns.find((column) => column.key === _groupBy)) === null || _c === void 0 ? void 0 : _c.key) || "", e.target.value, searchType);
492
508
  }, placeholder: "Search", extraWrapperStyle: {
493
- background: ((_46 = headerColumns.find((column) => column.key === _groupBy)) === null || _46 === void 0 ? void 0 : _46.search)
509
+ background: ((_48 = headerColumns.find((column) => column.key === _groupBy)) === null || _48 === void 0 ? void 0 : _48.search)
494
510
  ? "var(--background)"
495
511
  : "var(--disabled-bg)",
496
- }, value: ((_48 = searchQueries[((_47 = headerColumns.find((column) => column.key === _groupBy)) === null || _47 === void 0 ? void 0 : _47.key) || ""]) === null || _48 === void 0 ? void 0 : _48.text) || "", disabled: !((_49 = headerColumns.find((column) => column.key === _groupBy)) === null || _49 === void 0 ? void 0 : _49.search), height: 32, extraInputStyle: { minWidth: 10 }, className: "w-full", backgroundColor: "#fff" }) }))) ||
512
+ }, value: ((_50 = searchQueries[((_49 = headerColumns.find((column) => column.key === _groupBy)) === null || _49 === void 0 ? void 0 : _49.key) || ""]) === null || _50 === void 0 ? void 0 : _50.text) || "", disabled: !((_51 = headerColumns.find((column) => column.key === _groupBy)) === null || _51 === void 0 ? void 0 : _51.search), height: 32, extraInputStyle: { minWidth: 10 }, className: "w-full", backgroundColor: "#fff" }) }))) ||
497
513
  null })))] })) })] }), search && columnSearchOutside && ((0, jsx_runtime_1.jsx)("div", { style: {
498
514
  marginTop: "0.5rem",
499
- width: (hugColumnWidths === null || hugColumnWidths === void 0 ? void 0 : hugColumnWidths[`column-${(_50 = headerColumns.find((column) => column.key === _groupBy)) === null || _50 === void 0 ? void 0 : _50.key}`]) ||
515
+ width: (hugColumnWidths === null || hugColumnWidths === void 0 ? void 0 : hugColumnWidths[`column-${(_52 = headerColumns.find((column) => column.key === _groupBy)) === null || _52 === void 0 ? void 0 : _52.key}`]) ||
500
516
  widthMode === "auto" ||
501
- ((_51 = headerColumns.find((column) => column.key === _groupBy)) === null || _51 === void 0 ? void 0 : _51.width)
517
+ ((_53 = headerColumns.find((column) => column.key === _groupBy)) === null || _53 === void 0 ? void 0 : _53.width)
502
518
  ? "100%"
503
519
  : "100px",
504
520
  pointerEvents: search &&
505
- ((_52 = headerColumns.find((column) => column.key === _groupBy)) === null || _52 === void 0 ? void 0 : _52.search)
521
+ ((_54 = headerColumns.find((column) => column.key === _groupBy)) === null || _54 === void 0 ? void 0 : _54.search)
506
522
  ? "auto"
507
523
  : "none",
508
524
  cursor: search &&
509
- ((_53 = headerColumns.find((column) => column.key === _groupBy)) === null || _53 === void 0 ? void 0 : _53.search)
525
+ ((_55 = headerColumns.find((column) => column.key === _groupBy)) === null || _55 === void 0 ? void 0 : _55.search)
510
526
  ? "default"
511
527
  : "not-allowed",
512
528
  }, children: (0, jsx_runtime_1.jsx)(text_input_1.default, { onKeyDown: (e) => {
@@ -526,17 +542,18 @@ const GridHeader = ({ columns, onSearch, searchQueries, sortable, search, resiza
526
542
  searchType = "contains";
527
543
  }
528
544
  onSearch(((_c = headerColumns.find((column) => column.key === _groupBy)) === null || _c === void 0 ? void 0 : _c.key) || "", e.target.value, searchType);
529
- }, value: ((_55 = searchQueries[((_54 = headerColumns.find((column) => column.key === _groupBy)) === null || _54 === void 0 ? void 0 : _54.key) || ""]) === null || _55 === void 0 ? void 0 : _55.text) || "", disabled: !((_56 = headerColumns.find((column) => column.key === _groupBy)) === null || _56 === void 0 ? void 0 : _56.search), extraWrapperStyle: {
530
- background: ((_57 = headerColumns.find((column) => column.key === _groupBy)) === null || _57 === void 0 ? void 0 : _57.search)
545
+ }, value: ((_57 = searchQueries[((_56 = headerColumns.find((column) => column.key === _groupBy)) === null || _56 === void 0 ? void 0 : _56.key) || ""]) === null || _57 === void 0 ? void 0 : _57.text) || "", disabled: !((_58 = headerColumns.find((column) => column.key === _groupBy)) === null || _58 === void 0 ? void 0 : _58.search), extraWrapperStyle: {
546
+ background: ((_59 = headerColumns.find((column) => column.key === _groupBy)) === null || _59 === void 0 ? void 0 : _59.search)
531
547
  ? "#fff"
532
548
  : "#eee",
533
- }, height: 32, extraInputStyle: { minWidth: 10 }, className: "w-full", backgroundColor: "#fff" }) }))] }, (_58 = headerColumns.find((column) => column.key === _groupBy)) === null || _58 === void 0 ? void 0 : _58.key)) }));
549
+ }, height: 32, extraInputStyle: { minWidth: 10 }, className: "w-full", backgroundColor: "#fff" }) }))] }, (_60 = headerColumns.find((column) => column.key === _groupBy)) === null || _60 === void 0 ? void 0 : _60.key)) }));
534
550
  }), headerColumns
535
551
  .filter((column) => !groupBy.includes(column.key))
536
552
  .map((column, colIndex) => {
537
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s;
553
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t;
538
554
  if (!column.hidden) {
539
- const columnData = (0, exports.getColumnData)(column.key, gridData);
555
+ const columnData = (0, exports.getColumnData)(column.key, gridData, (_a = column.dataType) !== null && _a !== void 0 ? _a : "string");
556
+ console.log({ columnData });
540
557
  return ((0, jsx_runtime_1.jsx)("div", { className: `${sortable && column.sortable ? "sortable" : ""} ${column.showMenu ? "menu-true" : "menu-false"} column index-${column.key}`, style: Object.assign(Object.assign({}, cellStyle), { position: "relative", padding: "0.5rem", textAlign: "left", whiteSpace: "nowrap", textOverflow: "ellipsis", width: widthMode === "auto"
541
558
  ? "auto"
542
559
  : column.width
@@ -593,8 +610,8 @@ const GridHeader = ({ columns, onSearch, searchQueries, sortable, search, resiza
593
610
  ? numberTypeSearch.includes(item.value)
594
611
  : column.dataType === "date"
595
612
  ? dateTypeSearch.includes(item.value)
596
- : textTypeSearch.includes(item.value)), position: searchOpsPosition || { top: 0, left: 0 }, columnKey: column.key, columnData: columnData, sortingOps: (0, jsx_runtime_1.jsx)(gridHeaderDropdown_1.default, { options: menuOptions, onClose: () => setDropdownVisible(null), column: column }), searchElement: (0, jsx_runtime_1.jsx)("div", { id: "search-input", children: column.dataType === "date" ? (((_a = searchQueries[column.key]) === null || _a === void 0 ? void 0 : _a.type) ===
597
- "between" ? ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(date_input_1.default, { value: (_b = searchQueries[column.key]) === null || _b === void 0 ? void 0 : _b.text.split("to")[0], placeholder: `From date`, onChange: (value) => {
613
+ : textTypeSearch.includes(item.value)), position: searchOpsPosition || { top: 0, left: 0 }, columnKey: column.key, columnData: columnData, sortingOps: (0, jsx_runtime_1.jsx)(gridHeaderDropdown_1.default, { options: menuOptions, onClose: () => setDropdownVisible(null), column: column }), searchElement: (0, jsx_runtime_1.jsx)("div", { id: "search-input", children: column.dataType === "date" ? (((_b = searchQueries[column.key]) === null || _b === void 0 ? void 0 : _b.type) ===
614
+ "between" ? ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(date_input_1.default, { value: (_c = searchQueries[column.key]) === null || _c === void 0 ? void 0 : _c.text.split("to")[0], placeholder: `From date`, onChange: (value) => {
598
615
  var _a, _b;
599
616
  return onSearch(column.key, (_a = searchQueries[column.key]) === null || _a === void 0 ? void 0 : _a.text.split("to").map((item, index) => {
600
617
  if (index === 0) {
@@ -604,7 +621,7 @@ const GridHeader = ({ columns, onSearch, searchQueries, sortable, search, resiza
604
621
  }).join("to"), ((_b = searchQueries[column.key]) === null || _b === void 0 ? void 0 : _b.type) ||
605
622
  defaultSearchOperation ||
606
623
  "contains");
607
- } }), (0, jsx_runtime_1.jsx)(date_input_1.default, { value: (_c = searchQueries[column.key]) === null || _c === void 0 ? void 0 : _c.text.split("to")[1], placeholder: `To date`, onChange: (value) => {
624
+ } }), (0, jsx_runtime_1.jsx)(date_input_1.default, { value: (_d = searchQueries[column.key]) === null || _d === void 0 ? void 0 : _d.text.split("to")[1], placeholder: `To date`, onChange: (value) => {
608
625
  var _a, _b;
609
626
  return onSearch(column.key, (_a = searchQueries[column.key]) === null || _a === void 0 ? void 0 : _a.text.split("to").map((item, index) => {
610
627
  if (index === 1) {
@@ -614,7 +631,7 @@ const GridHeader = ({ columns, onSearch, searchQueries, sortable, search, resiza
614
631
  }).join("to"), ((_b = searchQueries[column.key]) === null || _b === void 0 ? void 0 : _b.type) ||
615
632
  defaultSearchOperation ||
616
633
  "contains");
617
- } })] })) : ((0, jsx_runtime_1.jsx)(date_input_1.default, { value: (_d = searchQueries[column.key]) === null || _d === void 0 ? void 0 : _d.text.split("to")[0], placeholder: `asd Filter ${column.label}`, onChange: (value) => {
634
+ } })] })) : ((0, jsx_runtime_1.jsx)(date_input_1.default, { value: (_e = searchQueries[column.key]) === null || _e === void 0 ? void 0 : _e.text.split("to")[0], placeholder: `asd Filter ${column.label}`, onChange: (value) => {
618
635
  var _a;
619
636
  return onSearch(column.key, value, ((_a = searchQueries[column.key]) === null || _a === void 0 ? void 0 : _a.type) ||
620
637
  defaultSearchOperation ||
@@ -628,12 +645,12 @@ const GridHeader = ({ columns, onSearch, searchQueries, sortable, search, resiza
628
645
  return onSearch(column.key, e.target.value, ((_a = searchQueries[column.key]) === null || _a === void 0 ? void 0 : _a.type) ||
629
646
  defaultSearchOperation ||
630
647
  "contains");
631
- }, value: ((_e = searchQueries[column.key]) === null || _e === void 0 ? void 0 : _e.text) ||
648
+ }, value: ((_f = searchQueries[column.key]) === null || _f === void 0 ? void 0 : _f.text) ||
632
649
  "", extraWrapperStyle: {
633
650
  visibility: column.search
634
651
  ? "visible"
635
652
  : "hidden",
636
- }, height: 32, width: "100%", className: "w-full", backgroundColor: "#fff" })) }), onFilter: onFilter, setUniqueSearch: setUniqueSearch, uniqueSearch: uniqueSearch, textFilterLabel: textFilterLabel, activeSearchType: ((_f = searchQueries[column.key]) === null || _f === void 0 ? void 0 : _f.type) ||
653
+ }, height: 32, width: "100%", className: "w-full", backgroundColor: "#fff" })) }), onFilter: onFilter, setUniqueSearch: setUniqueSearch, uniqueSearch: uniqueSearch, textFilterLabel: textFilterLabel, activeSearchType: ((_g = searchQueries[column.key]) === null || _g === void 0 ? void 0 : _g.type) ||
637
654
  defaultSearchOperation ||
638
655
  "contains", checkboxWrapper: checkboxWrapper, searchInput: search &&
639
656
  column.search && ((0, jsx_runtime_1.jsx)("div", { style: {
@@ -662,13 +679,13 @@ const GridHeader = ({ columns, onSearch, searchQueries, sortable, search, resiza
662
679
  background: column.search
663
680
  ? "var(--background)"
664
681
  : "var(--disabled-bg)",
665
- }, placeholder: "Search", value: ((_g = searchQueries[column.key]) === null || _g === void 0 ? void 0 : _g.text) ||
682
+ }, placeholder: "Search", value: ((_h = searchQueries[column.key]) === null || _h === void 0 ? void 0 : _h.text) ||
666
683
  "", disabled: !column.search, height: 32, extraInputStyle: { minWidth: 10 }, className: "w-full", backgroundColor: "#fff" }) })) })) : ((0, jsx_runtime_1.jsx)(textFilterDropdown_1.default, { columnIndex: colIndex, searchable: (column === null || column === void 0 ? void 0 : column.search) || false, sortingOps: (0, jsx_runtime_1.jsx)(gridHeaderDropdown_1.default, { options: menuOptions, onClose: () => setDropdownVisible(null), column: column }), headerDropdownIndex: headerDropdownIndex, searchOptions: searchOptions.filter((item) => column.dataType === "number"
667
684
  ? numberTypeSearch.includes(item.value)
668
685
  : column.dataType === "date"
669
686
  ? dateTypeSearch.includes(item.value)
670
- : textTypeSearch.includes(item.value)), position: searchOpsPosition || { top: 0, left: 0 }, columnKey: column.key, searchElement: (0, jsx_runtime_1.jsx)("div", { id: "search-input", children: column.dataType === "date" ? (((_h = searchQueries[column.key]) === null || _h === void 0 ? void 0 : _h.type) ===
671
- "between" ? ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(date_input_1.default, { value: (_j = searchQueries[column.key]) === null || _j === void 0 ? void 0 : _j.text.split("to")[0], placeholder: `From date`, onChange: (value) => {
687
+ : textTypeSearch.includes(item.value)), position: searchOpsPosition || { top: 0, left: 0 }, columnKey: column.key, searchElement: (0, jsx_runtime_1.jsx)("div", { id: "search-input", children: column.dataType === "date" ? (((_j = searchQueries[column.key]) === null || _j === void 0 ? void 0 : _j.type) ===
688
+ "between" ? ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(date_input_1.default, { value: (_k = searchQueries[column.key]) === null || _k === void 0 ? void 0 : _k.text.split("to")[0], placeholder: `From date`, onChange: (value) => {
672
689
  var _a, _b;
673
690
  return onSearch(column.key, (_a = searchQueries[column.key]) === null || _a === void 0 ? void 0 : _a.text.split("to").map((item, index) => {
674
691
  if (index === 0) {
@@ -678,7 +695,7 @@ const GridHeader = ({ columns, onSearch, searchQueries, sortable, search, resiza
678
695
  }).join("to"), ((_b = searchQueries[column.key]) === null || _b === void 0 ? void 0 : _b.type) ||
679
696
  defaultSearchOperation ||
680
697
  "contains");
681
- } }), (0, jsx_runtime_1.jsx)("div", { style: { marginTop: "0.5rem" }, children: (0, jsx_runtime_1.jsx)(date_input_1.default, { value: (_k = searchQueries[column.key]) === null || _k === void 0 ? void 0 : _k.text.split("to")[1], placeholder: `To date`, onChange: (value) => {
698
+ } }), (0, jsx_runtime_1.jsx)("div", { style: { marginTop: "0.5rem" }, children: (0, jsx_runtime_1.jsx)(date_input_1.default, { value: (_l = searchQueries[column.key]) === null || _l === void 0 ? void 0 : _l.text.split("to")[1], placeholder: `To date`, onChange: (value) => {
682
699
  var _a, _b;
683
700
  return onSearch(column.key, (_a = searchQueries[column.key]) === null || _a === void 0 ? void 0 : _a.text.split("to").map((item, index) => {
684
701
  if (index === 1) {
@@ -693,7 +710,7 @@ const GridHeader = ({ columns, onSearch, searchQueries, sortable, search, resiza
693
710
  "doesNotContain",
694
711
  "blank",
695
712
  "notBlank",
696
- ].includes(((_l = searchQueries[column.key]) === null || _l === void 0 ? void 0 : _l.type) ||
713
+ ].includes(((_m = searchQueries[column.key]) === null || _m === void 0 ? void 0 : _m.type) ||
697
714
  defaultSearchOperation ||
698
715
  "contains") ? ((0, jsx_runtime_1.jsx)(text_input_1.default, { placeholder: `Filter ${column.label}`, onKeyDown: (e) => {
699
716
  if (e.key === "Enter") {
@@ -704,12 +721,12 @@ const GridHeader = ({ columns, onSearch, searchQueries, sortable, search, resiza
704
721
  return onSearch(column.key, e.target.value, ((_a = searchQueries[column.key]) === null || _a === void 0 ? void 0 : _a.type) ||
705
722
  defaultSearchOperation ||
706
723
  "contains");
707
- }, value: ((_m = searchQueries[column.key]) === null || _m === void 0 ? void 0 : _m.text) ||
724
+ }, value: ((_o = searchQueries[column.key]) === null || _o === void 0 ? void 0 : _o.text) ||
708
725
  "", extraWrapperStyle: {
709
726
  visibility: column.search
710
727
  ? "visible"
711
728
  : "hidden",
712
- }, height: 32, width: "100%", className: "w-full", backgroundColor: "#fff" })) : ((0, jsx_runtime_1.jsx)(date_input_1.default, { value: (_o = searchQueries[column.key]) === null || _o === void 0 ? void 0 : _o.text.split("to")[0], placeholder: `asd Filter ${column.label}`, onChange: (value) => {
729
+ }, height: 32, width: "100%", className: "w-full", backgroundColor: "#fff" })) : ((0, jsx_runtime_1.jsx)(date_input_1.default, { value: (_p = searchQueries[column.key]) === null || _p === void 0 ? void 0 : _p.text.split("to")[0], placeholder: `asd Filter ${column.label}`, onChange: (value) => {
713
730
  var _a;
714
731
  return onSearch(column.key, value, ((_a = searchQueries[column.key]) === null || _a === void 0 ? void 0 : _a.type) ||
715
732
  defaultSearchOperation ||
@@ -723,12 +740,12 @@ const GridHeader = ({ columns, onSearch, searchQueries, sortable, search, resiza
723
740
  return onSearch(column.key, e.target.value, ((_a = searchQueries[column.key]) === null || _a === void 0 ? void 0 : _a.type) ||
724
741
  defaultSearchOperation ||
725
742
  "contains");
726
- }, value: ((_p = searchQueries[column.key]) === null || _p === void 0 ? void 0 : _p.text) ||
743
+ }, value: ((_q = searchQueries[column.key]) === null || _q === void 0 ? void 0 : _q.text) ||
727
744
  "", extraWrapperStyle: {
728
745
  visibility: column.search
729
746
  ? "visible"
730
747
  : "hidden",
731
- }, height: 32, width: "100%", className: "w-full", backgroundColor: "#fff" })) }), activeSearchType: ((_q = searchQueries[column.key]) === null || _q === void 0 ? void 0 : _q.type) ||
748
+ }, height: 32, width: "100%", className: "w-full", backgroundColor: "#fff" })) }), activeSearchType: ((_r = searchQueries[column.key]) === null || _r === void 0 ? void 0 : _r.type) ||
732
749
  defaultSearchOperation ||
733
750
  "contains", searchInput: (search && column.search && ((0, jsx_runtime_1.jsx)("div", { style: {
734
751
  padding: "0.5rem",
@@ -755,7 +772,7 @@ const GridHeader = ({ columns, onSearch, searchQueries, sortable, search, resiza
755
772
  background: column.search
756
773
  ? "var(--background)"
757
774
  : "var(--disabled-bg)",
758
- }, value: ((_r = searchQueries[column.key]) === null || _r === void 0 ? void 0 : _r.text) ||
775
+ }, value: ((_s = searchQueries[column.key]) === null || _s === void 0 ? void 0 : _s.text) ||
759
776
  "", disabled: !column.search, height: 32, extraInputStyle: { minWidth: 10 }, className: "w-full", backgroundColor: "#fff" }) }))) ||
760
777
  null })))] })) })] }), search && columnSearchOutside && ((0, jsx_runtime_1.jsx)("div", { style: {
761
778
  marginTop: "0.5rem",
@@ -782,7 +799,7 @@ const GridHeader = ({ columns, onSearch, searchQueries, sortable, search, resiza
782
799
  background: column.search
783
800
  ? "var(--background)"
784
801
  : "var(--disabled-bg)",
785
- }, value: ((_s = searchQueries[column.key]) === null || _s === void 0 ? void 0 : _s.text) || "", disabled: !column.search, height: 32, extraInputStyle: { minWidth: 10 }, className: "w-full", backgroundColor: "#fff" }) }))] })) }, column.key));
802
+ }, value: ((_t = searchQueries[column.key]) === null || _t === void 0 ? void 0 : _t.text) || "", disabled: !column.search, height: 32, extraInputStyle: { minWidth: 10 }, className: "w-full", backgroundColor: "#fff" }) }))] })) }, column.key));
786
803
  }
787
804
  return null;
788
805
  })] }));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@megha-ui/react",
3
- "version": "1.2.38",
3
+ "version": "1.2.40",
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.mjs",