@megha-ui/react 1.3.59 → 1.3.61

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.
@@ -7,6 +7,7 @@ import TextFilterDropdown from "./textFilterDropdown";
7
7
  import DateInput from "../../date-input";
8
8
  import TextInput from "../../text-input";
9
9
  import Checkbox from "../../checkbox";
10
+ import Dropdown from "../../dropdown";
10
11
  import { Tooltip } from "react-tooltip";
11
12
  export const getColumnData = (columnKey, gridData, type, combinedColumns) => {
12
13
  const returnedValue = [
@@ -519,7 +520,7 @@ const GridHeader = ({ columns, onSearch, searchQueries, sortable, search, resiza
519
520
  }), headerColumns
520
521
  .filter((column) => !groupByKeys.includes(column.key))
521
522
  .map((column, colIndex) => {
522
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u;
523
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v;
523
524
  if (!column.hidden) {
524
525
  const columnData = getColumnData(column.key, gridData, (_a = column.dataType) !== null && _a !== void 0 ? _a : "string", combinedColumns !== null && combinedColumns !== void 0 ? combinedColumns : []);
525
526
  return (_jsx("div", { className: `${sortable && column.sortable ? "sortable" : ""} ${column.showMenu ? "menu-true" : "menu-false"} column index-${column.key}`, style: Object.assign(Object.assign({}, cellStyle), { padding: "0.5rem", textAlign: "left", whiteSpace: "nowrap", textOverflow: "ellipsis", wordBreak: widthMode === "auto" ? "break-all" : "unset", backgroundColor: "var(--row-header-bg)", borderTop: headerTopBorder, borderBottom: headerBottomBorder, flex: widthMode === "auto" ? 1 : undefined, flexGrow: widthMode === "auto" ? 1 : 0, flexShrink: widthMode === "auto" ? 1 : 0, position: "sticky", top: 0, zIndex: 1 }), onMouseMove: (e) => handleMouseMove(e), onMouseUp: handleMouseUp, onMouseLeave: handleMouseUp, children: !actionsKey.split(",").includes(column.key) && (_jsxs(_Fragment, { children: [resizable && (_jsx("div", { style: {
@@ -749,20 +750,40 @@ const GridHeader = ({ columns, onSearch, searchQueries, sortable, search, resiza
749
750
  : "100px",
750
751
  pointerEvents: search && column.search ? "auto" : "none",
751
752
  cursor: search && column.search ? "default" : "not-allowed",
752
- }, children: _jsx(TextInput, { onChange: (e) => {
753
- let searchType = "contains";
754
- if (e.target.value.includes("to")) {
755
- searchType = "between";
756
- }
757
- else if (searchType === "between") {
758
- searchType = "contains";
759
- }
760
- onSearch(column.key, e.target.value, searchType);
761
- }, placeholder: "Search", extraWrapperStyle: {
762
- background: column.search
763
- ? "var(--background)"
764
- : "var(--disabled-bg)",
765
- }, value: ((_u = searchQueries[column.key]) === null || _u === void 0 ? void 0 : _u.text) || "", disabled: !column.search, height: 32, extraInputStyle: { minWidth: 10 }, className: "w-full", backgroundColor: "#fff" }) }))] })) }, column.key));
753
+ }, children: _jsxs("div", { style: {
754
+ display: "flex",
755
+ alignItems: "center",
756
+ gap: "0.5rem",
757
+ }, children: [_jsx(TextInput, { onChange: (e) => {
758
+ var _a;
759
+ let searchType = ((_a = searchQueries[column.key]) === null || _a === void 0 ? void 0 : _a.type) ||
760
+ defaultSearchOperation ||
761
+ "contains";
762
+ if (e.target.value.includes("to")) {
763
+ searchType = "between";
764
+ }
765
+ else if (searchType === "between") {
766
+ searchType = "contains";
767
+ }
768
+ onSearch(column.key, e.target.value, searchType);
769
+ }, placeholder: "Search", extraWrapperStyle: {
770
+ background: column.search
771
+ ? "var(--background)"
772
+ : "var(--disabled-bg)",
773
+ }, value: ((_u = searchQueries[column.key]) === null || _u === void 0 ? void 0 : _u.text) || "", disabled: !column.search, height: 32, extraInputStyle: { minWidth: 10 }, className: "w-full", backgroundColor: "#fff" }), _jsx(Dropdown, { options: searchOptions.filter((item) => column.dataType === "number" ||
774
+ column.dataType === "currency"
775
+ ? numberTypeSearch.includes(item.value)
776
+ : column.dataType === "date"
777
+ ? dateTypeSearch.includes(item.value)
778
+ : textTypeSearch.includes(item.value)), selectedValues: [
779
+ ((_v = searchQueries[column.key]) === null || _v === void 0 ? void 0 : _v.type) ||
780
+ defaultSearchOperation ||
781
+ "contains",
782
+ ], onChange: (selected) => {
783
+ var _a;
784
+ const value = ((_a = selected[0]) === null || _a === void 0 ? void 0 : _a.toString()) || "";
785
+ handleSearchOptionSelect(column.key, value);
786
+ }, searchEnabled: false, width: 130 })] }) }))] })) }, column.key));
766
787
  }
767
788
  return null;
768
789
  })] }));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@megha-ui/react",
3
- "version": "1.3.59",
3
+ "version": "1.3.61",
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",