@megha-ui/react 1.2.124 → 1.2.126

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.
@@ -29,6 +29,7 @@ interface GridFilterDropdownProps {
29
29
  searchInput: any;
30
30
  searchable: boolean;
31
31
  columnIndex: number;
32
+ columnType: string;
32
33
  }
33
34
  declare const GridFilterDropdown: React.FC<GridFilterDropdownProps>;
34
35
  export default GridFilterDropdown;
@@ -9,7 +9,8 @@ const fi_1 = require("react-icons/fi");
9
9
  const textFilterDropdown_1 = __importDefault(require("./textFilterDropdown"));
10
10
  const text_input_1 = __importDefault(require("../../text-input"));
11
11
  const checkbox_1 = __importDefault(require("../../checkbox"));
12
- const GridFilterDropdown = ({ headerDropdownIndex, searchOptions, position, columnKey, searchElement, activeSearchType, textFilterLabel, columnData, checkboxWrapper, onFilter, setUniqueSearch, uniqueSearch, sortingOps, searchable, searchInput, columnIndex, }) => {
12
+ const commonService_1 = require("../../../services/commonService");
13
+ const GridFilterDropdown = ({ headerDropdownIndex, searchOptions, position, columnKey, searchElement, activeSearchType, textFilterLabel, columnData, checkboxWrapper, onFilter, setUniqueSearch, uniqueSearch, sortingOps, searchable, searchInput, columnIndex, columnType }) => {
13
14
  var _a, _b, _c, _d;
14
15
  const [isOpen, setIsOpen] = (0, react_1.useState)(false);
15
16
  const [filterColumnData, setFilterColumnData] = (0, react_1.useState)([]);
@@ -81,7 +82,7 @@ const GridFilterDropdown = ({ headerDropdownIndex, searchOptions, position, colu
81
82
  cursor: "pointer",
82
83
  display: "flex",
83
84
  alignItems: "center",
84
- }, onClick: () => handleSelect(item, columnKey), children: [(0, jsx_runtime_1.jsx)(checkbox_1.default, { selected: (_a = uniqueSearch === null || uniqueSearch === void 0 ? void 0 : uniqueSearch[columnKey]) === null || _a === void 0 ? void 0 : _a.includes(item), onChange: () => { }, style: { pointerEvents: "none" }, noLabel: true, wrapperClass: checkboxWrapper }), (0, jsx_runtime_1.jsx)("span", { style: { marginLeft: "0.5rem" }, children: item })] }, item));
85
+ }, onClick: () => handleSelect(item, columnKey), children: [(0, jsx_runtime_1.jsx)(checkbox_1.default, { selected: (_a = uniqueSearch === null || uniqueSearch === void 0 ? void 0 : uniqueSearch[columnKey]) === null || _a === void 0 ? void 0 : _a.includes(item), onChange: () => { }, style: { pointerEvents: "none" }, noLabel: true, wrapperClass: checkboxWrapper }), (0, jsx_runtime_1.jsx)("span", { style: { marginLeft: "0.5rem" }, children: (0, commonService_1.formatValue)(item, columnType) })] }, item));
85
86
  })] }))] })), isOpen && ((0, jsx_runtime_1.jsx)(textFilterDropdown_1.default, { combined: true, columnIndex: columnIndex, headerDropdownIndex: headerDropdownIndex || 1001, searchOptions: searchOptions, position: position
86
87
  ? {
87
88
  top: position.top,
@@ -274,7 +274,7 @@ const GridHeader = ({ columns, onSearch, searchQueries, sortable, search, resiza
274
274
  .split(",")
275
275
  .filter((item) => item)
276
276
  .map((_groupBy) => {
277
- 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;
277
+ 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, _61, _62;
278
278
  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 &&
279
279
  ((_a = headerColumns.find((column) => column.key === _groupBy)) === null || _a === void 0 ? void 0 : _a.sortable)
280
280
  ? "sortable"
@@ -332,17 +332,17 @@ const GridHeader = ({ columns, onSearch, searchQueries, sortable, search, resiza
332
332
  : "#000",
333
333
  } }), dropdownVisible ===
334
334
  ((_r = headerColumns.find((column) => column.key === _groupBy)) === null || _r === void 0 ? void 0 : _r.key) &&
335
- (((_s = headerColumns.find((column) => column.key === _groupBy)) === null || _s === void 0 ? void 0 : _s.uniqueDrop) ? ((0, jsx_runtime_1.jsx)(gridFilterDropdown_1.default, { columnIndex: -1, searchable: ((_t = headerColumns.find((column) => column.key === _groupBy)) === null || _t === void 0 ? void 0 : _t.search) || false, headerDropdownIndex: headerDropdownIndex, searchInput: (search &&
336
- ((_u = headerColumns.find((column) => column.key === _groupBy)) === null || _u === void 0 ? void 0 : _u.search) && ((0, jsx_runtime_1.jsx)("div", { style: {
335
+ (((_s = headerColumns.find((column) => column.key === _groupBy)) === null || _s === void 0 ? void 0 : _s.uniqueDrop) ? ((0, jsx_runtime_1.jsx)(gridFilterDropdown_1.default, { columnType: (_u = (_t = headerColumns.find((column) => column.key === _groupBy)) === null || _t === void 0 ? void 0 : _t.dataType) !== null && _u !== void 0 ? _u : "string", columnIndex: -1, searchable: ((_v = headerColumns.find((column) => column.key === _groupBy)) === null || _v === void 0 ? void 0 : _v.search) || false, headerDropdownIndex: headerDropdownIndex, searchInput: (search &&
336
+ ((_w = headerColumns.find((column) => column.key === _groupBy)) === null || _w === void 0 ? void 0 : _w.search) && ((0, jsx_runtime_1.jsx)("div", { style: {
337
337
  marginTop: "0.5rem",
338
338
  padding: "0.5rem",
339
339
  width: "100%",
340
340
  pointerEvents: search &&
341
- ((_v = headerColumns.find((column) => column.key === _groupBy)) === null || _v === void 0 ? void 0 : _v.search)
341
+ ((_x = headerColumns.find((column) => column.key === _groupBy)) === null || _x === void 0 ? void 0 : _x.search)
342
342
  ? "auto"
343
343
  : "none",
344
344
  cursor: search &&
345
- ((_w = headerColumns.find((column) => column.key === _groupBy)) === null || _w === void 0 ? void 0 : _w.search)
345
+ ((_y = headerColumns.find((column) => column.key === _groupBy)) === null || _y === void 0 ? void 0 : _y.search)
346
346
  ? "default"
347
347
  : "not-allowed",
348
348
  }, children: (0, jsx_runtime_1.jsx)(text_input_1.default, { onChange: (e) => {
@@ -358,10 +358,10 @@ const GridHeader = ({ columns, onSearch, searchQueries, sortable, search, resiza
358
358
  }
359
359
  onSearch(((_c = headerColumns.find((column) => column.key === _groupBy)) === null || _c === void 0 ? void 0 : _c.key) || "", e.target.value, searchType);
360
360
  }, placeholder: "Search", extraWrapperStyle: {
361
- background: ((_x = headerColumns.find((column) => column.key === _groupBy)) === null || _x === void 0 ? void 0 : _x.search)
361
+ background: ((_z = headerColumns.find((column) => column.key === _groupBy)) === null || _z === void 0 ? void 0 : _z.search)
362
362
  ? "var(--background)"
363
363
  : "var(--disabled-bg)",
364
- }, value: ((_z = searchQueries[((_y = headerColumns.find((column) => column.key === _groupBy)) === null || _y === void 0 ? void 0 : _y.key) || ""]) === null || _z === void 0 ? void 0 : _z.text) || "", disabled: !((_0 = headerColumns.find((column) => column.key === _groupBy)) === null || _0 === void 0 ? void 0 : _0.search), height: 32, extraInputStyle: { minWidth: 10 }, className: "w-full", backgroundColor: "#fff" }) }))) ||
364
+ }, value: ((_1 = searchQueries[((_0 = headerColumns.find((column) => column.key === _groupBy)) === null || _0 === void 0 ? void 0 : _0.key) || ""]) === null || _1 === void 0 ? void 0 : _1.text) || "", disabled: !((_2 = headerColumns.find((column) => column.key === _groupBy)) === null || _2 === void 0 ? void 0 : _2.search), height: 32, extraInputStyle: { minWidth: 10 }, className: "w-full", backgroundColor: "#fff" }) }))) ||
365
365
  null, 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) => {
366
366
  var _a, _b;
367
367
  return ((_a = headerColumns.find((column) => column.key === _groupBy)) === null || _a === void 0 ? void 0 : _a.dataType) === "number"
@@ -369,7 +369,7 @@ const GridHeader = ({ columns, onSearch, searchQueries, sortable, search, resiza
369
369
  : ((_b = headerColumns.find((column) => column.key === _groupBy)) === null || _b === void 0 ? void 0 : _b.dataType) === "date"
370
370
  ? dateTypeSearch.includes(item.value)
371
371
  : textTypeSearch.includes(item.value);
372
- }), 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) => {
372
+ }), position: searchOpsPosition || { top: 0, left: 0 }, columnKey: ((_3 = headerColumns.find((column) => column.key === _groupBy)) === null || _3 === void 0 ? void 0 : _3.key) || "", columnData: (0, exports.getColumnData)(((_4 = headerColumns.find((column) => column.key === _groupBy)) === null || _4 === void 0 ? void 0 : _4.key) || "", gridData, (_6 = (_5 = headerColumns.find((column) => column.key === _groupBy)) === null || _5 === void 0 ? void 0 : _5.dataType) !== null && _6 !== void 0 ? _6 : "string"), searchElement: (0, jsx_runtime_1.jsx)("div", { id: "search-input", children: ((_7 = headerColumns.find((column) => column.key === _groupBy)) === null || _7 === void 0 ? void 0 : _7.dataType) === "date" ? (((_9 = searchQueries[((_8 = headerColumns.find((column) => column.key === _groupBy)) === null || _8 === void 0 ? void 0 : _8.key) || ""]) === null || _9 === void 0 ? void 0 : _9.type) === "between" ? ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(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: `From date`, onChange: (value) => {
373
373
  var _a, _b, _c, _d, _e;
374
374
  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) => {
375
375
  if (index === 0) {
@@ -379,7 +379,7 @@ const GridHeader = ({ columns, onSearch, searchQueries, sortable, search, resiza
379
379
  }).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) ||
380
380
  defaultSearchOperation ||
381
381
  "contains");
382
- } }), (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) => {
382
+ } }), (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")[1], placeholder: `To date`, onChange: (value) => {
383
383
  var _a, _b, _c, _d, _e;
384
384
  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) => {
385
385
  if (index === 1) {
@@ -389,12 +389,12 @@ const GridHeader = ({ columns, onSearch, searchQueries, sortable, search, resiza
389
389
  }).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) ||
390
390
  defaultSearchOperation ||
391
391
  "contains");
392
- } })] })) : ((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) => {
392
+ } })] })) : ((0, jsx_runtime_1.jsx)(date_input_1.default, { 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.split("to")[0], placeholder: `asd Filter ${(_16 = headerColumns.find((column) => column.key === _groupBy)) === null || _16 === void 0 ? void 0 : _16.label}`, onChange: (value) => {
393
393
  var _a, _b, _c;
394
394
  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) ||
395
395
  defaultSearchOperation ||
396
396
  "contains");
397
- } }))) : ((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) => {
397
+ } }))) : ((0, jsx_runtime_1.jsx)(text_input_1.default, { placeholder: `Filter ${(_17 = headerColumns.find((column) => column.key === _groupBy)) === null || _17 === void 0 ? void 0 : _17.label}`, onKeyDown: (e) => {
398
398
  var _a;
399
399
  if (e.key === "Enter") {
400
400
  toggleDropdown(((_a = headerColumns.find((column) => column.key === _groupBy)) === null || _a === void 0 ? void 0 : _a.key) || "");
@@ -404,11 +404,11 @@ const GridHeader = ({ columns, onSearch, searchQueries, sortable, search, resiza
404
404
  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) ||
405
405
  defaultSearchOperation ||
406
406
  "contains");
407
- }, 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: {
408
- visibility: ((_18 = headerColumns.find((column) => column.key === _groupBy)) === null || _18 === void 0 ? void 0 : _18.search)
407
+ }, value: ((_19 = searchQueries[((_18 = headerColumns.find((column) => column.key === _groupBy)) === null || _18 === void 0 ? void 0 : _18.key) || ""]) === null || _19 === void 0 ? void 0 : _19.text) || "", extraWrapperStyle: {
408
+ visibility: ((_20 = headerColumns.find((column) => column.key === _groupBy)) === null || _20 === void 0 ? void 0 : _20.search)
409
409
  ? "visible"
410
410
  : "hidden",
411
- }, 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) ||
411
+ }, height: 32, width: "100%", className: "w-full", backgroundColor: "#fff" })) }), onFilter: onFilter, setUniqueSearch: setUniqueSearch, uniqueSearch: uniqueSearch, textFilterLabel: textFilterLabel, activeSearchType: ((_22 = searchQueries[((_21 = headerColumns.find((column) => column.key === _groupBy)) === null || _21 === void 0 ? void 0 : _21.key) || ""]) === null || _22 === void 0 ? void 0 : _22.type) ||
412
412
  defaultSearchOperation ||
413
413
  "contains", checkboxWrapper: checkboxWrapper })) : ((0, jsx_runtime_1.jsx)(textFilterDropdown_1.default, { columnIndex: -1, combined: false, 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) => {
414
414
  var _a, _b;
@@ -417,7 +417,7 @@ const GridHeader = ({ columns, onSearch, searchQueries, sortable, search, resiza
417
417
  : ((_b = headerColumns.find((column) => column.key === _groupBy)) === null || _b === void 0 ? void 0 : _b.dataType) === "date"
418
418
  ? dateTypeSearch.includes(item.value)
419
419
  : textTypeSearch.includes(item.value);
420
- }), 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) => {
420
+ }), position: searchOpsPosition || { top: 0, left: 0 }, columnKey: ((_23 = headerColumns.find((column) => column.key === _groupBy)) === null || _23 === void 0 ? void 0 : _23.key) || "", searchable: ((_24 = headerColumns.find((column) => column.key === _groupBy)) === null || _24 === void 0 ? void 0 : _24.search) || false, searchElement: (0, jsx_runtime_1.jsx)("div", { id: "search-input", children: ((_25 = headerColumns.find((column) => column.key === _groupBy)) === null || _25 === void 0 ? void 0 : _25.dataType) === "date" ? (((_27 = searchQueries[((_26 = headerColumns.find((column) => column.key === _groupBy)) === null || _26 === void 0 ? void 0 : _26.key) || ""]) === null || _27 === void 0 ? void 0 : _27.type) === "between" ? ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { 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")[0], placeholder: `From date`, onChange: (value) => {
421
421
  var _a, _b, _c, _d, _e;
422
422
  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) => {
423
423
  if (index === 0) {
@@ -427,7 +427,7 @@ const GridHeader = ({ columns, onSearch, searchQueries, sortable, search, resiza
427
427
  }).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) ||
428
428
  defaultSearchOperation ||
429
429
  "contains");
430
- } }), (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) => {
430
+ } }), (0, jsx_runtime_1.jsx)("div", { style: { marginTop: "0.5rem" }, children: (0, jsx_runtime_1.jsx)(date_input_1.default, { value: (_31 = searchQueries[((_30 = headerColumns.find((column) => column.key === _groupBy)) === null || _30 === void 0 ? void 0 : _30.key) || ""]) === null || _31 === void 0 ? void 0 : _31.text.split("to")[1], placeholder: `To date`, onChange: (value) => {
431
431
  var _a, _b, _c, _d, _e;
432
432
  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) => {
433
433
  if (index === 1) {
@@ -442,9 +442,9 @@ const GridHeader = ({ columns, onSearch, searchQueries, sortable, search, resiza
442
442
  "doesNotContain",
443
443
  "blank",
444
444
  "notBlank",
445
- ].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) ||
445
+ ].includes(((_33 = searchQueries[((_32 = headerColumns.find((column) => column.key === _groupBy)) === null || _32 === void 0 ? void 0 : _32.key) || ""]) === null || _33 === void 0 ? void 0 : _33.type) ||
446
446
  defaultSearchOperation ||
447
- "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) => {
447
+ "contains") ? ((0, jsx_runtime_1.jsx)(text_input_1.default, { placeholder: `Filter ${(_34 = headerColumns.find((column) => column.key === _groupBy)) === null || _34 === void 0 ? void 0 : _34.label}`, onKeyDown: (e) => {
448
448
  var _a;
449
449
  if (e.key === "Enter") {
450
450
  toggleDropdown(((_a = headerColumns.find((column) => column.key === _groupBy)) === null || _a === void 0 ? void 0 : _a.key) || "");
@@ -454,16 +454,16 @@ const GridHeader = ({ columns, onSearch, searchQueries, sortable, search, resiza
454
454
  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) ||
455
455
  defaultSearchOperation ||
456
456
  "contains");
457
- }, 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: {
458
- visibility: ((_35 = headerColumns.find((column) => column.key === _groupBy)) === null || _35 === void 0 ? void 0 : _35.search)
457
+ }, value: ((_36 = searchQueries[((_35 = headerColumns.find((column) => column.key === _groupBy)) === null || _35 === void 0 ? void 0 : _35.key) || ""]) === null || _36 === void 0 ? void 0 : _36.text) || "", extraWrapperStyle: {
458
+ visibility: ((_37 = headerColumns.find((column) => column.key === _groupBy)) === null || _37 === void 0 ? void 0 : _37.search)
459
459
  ? "visible"
460
460
  : "hidden",
461
- }, 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) => {
461
+ }, height: 32, width: "100%", className: "w-full", backgroundColor: "#fff" })) : ((0, jsx_runtime_1.jsx)(date_input_1.default, { 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.split("to")[0], placeholder: `asd Filter ${(_40 = headerColumns.find((column) => column.key === _groupBy)) === null || _40 === void 0 ? void 0 : _40.label}`, onChange: (value) => {
462
462
  var _a, _b, _c;
463
463
  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) ||
464
464
  defaultSearchOperation ||
465
465
  "contains");
466
- } }))) : ((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) => {
466
+ } }))) : ((0, jsx_runtime_1.jsx)(text_input_1.default, { placeholder: `Filter ${(_41 = headerColumns.find((column) => column.key === _groupBy)) === null || _41 === void 0 ? void 0 : _41.label}`, onKeyDown: (e) => {
467
467
  var _a;
468
468
  if (e.key === "Enter") {
469
469
  toggleDropdown(((_a = headerColumns.find((column) => column.key === _groupBy)) === null || _a === void 0 ? void 0 : _a.key) || "");
@@ -473,23 +473,23 @@ const GridHeader = ({ columns, onSearch, searchQueries, sortable, search, resiza
473
473
  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) ||
474
474
  defaultSearchOperation ||
475
475
  "contains");
476
- }, 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: {
477
- visibility: ((_42 = headerColumns.find((column) => column.key === _groupBy)) === null || _42 === void 0 ? void 0 : _42.search)
476
+ }, value: ((_43 = searchQueries[((_42 = headerColumns.find((column) => column.key === _groupBy)) === null || _42 === void 0 ? void 0 : _42.key) || ""]) === null || _43 === void 0 ? void 0 : _43.text) || "", extraWrapperStyle: {
477
+ visibility: ((_44 = headerColumns.find((column) => column.key === _groupBy)) === null || _44 === void 0 ? void 0 : _44.search)
478
478
  ? "visible"
479
479
  : "hidden",
480
- }, 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) ||
480
+ }, height: 32, width: "100%", className: "w-full", backgroundColor: "#fff" })) }), activeSearchType: ((_46 = searchQueries[((_45 = headerColumns.find((column) => column.key === _groupBy)) === null || _45 === void 0 ? void 0 : _45.key) || ""]) === null || _46 === void 0 ? void 0 : _46.type) ||
481
481
  defaultSearchOperation ||
482
482
  "contains", searchInput: (search &&
483
- ((_45 = headerColumns.find((column) => column.key === _groupBy)) === null || _45 === void 0 ? void 0 : _45.search) && ((0, jsx_runtime_1.jsx)("div", { style: {
483
+ ((_47 = headerColumns.find((column) => column.key === _groupBy)) === null || _47 === void 0 ? void 0 : _47.search) && ((0, jsx_runtime_1.jsx)("div", { style: {
484
484
  marginTop: "0.5rem",
485
485
  padding: "0.5rem",
486
486
  width: "100%",
487
487
  pointerEvents: search &&
488
- ((_46 = headerColumns.find((column) => column.key === _groupBy)) === null || _46 === void 0 ? void 0 : _46.search)
488
+ ((_48 = headerColumns.find((column) => column.key === _groupBy)) === null || _48 === void 0 ? void 0 : _48.search)
489
489
  ? "auto"
490
490
  : "none",
491
491
  cursor: search &&
492
- ((_47 = headerColumns.find((column) => column.key === _groupBy)) === null || _47 === void 0 ? void 0 : _47.search)
492
+ ((_49 = headerColumns.find((column) => column.key === _groupBy)) === null || _49 === void 0 ? void 0 : _49.search)
493
493
  ? "default"
494
494
  : "not-allowed",
495
495
  }, children: (0, jsx_runtime_1.jsx)(text_input_1.default, { onChange: (e) => {
@@ -505,23 +505,23 @@ const GridHeader = ({ columns, onSearch, searchQueries, sortable, search, resiza
505
505
  }
506
506
  onSearch(((_c = headerColumns.find((column) => column.key === _groupBy)) === null || _c === void 0 ? void 0 : _c.key) || "", e.target.value, searchType);
507
507
  }, placeholder: "Search", extraWrapperStyle: {
508
- background: ((_48 = headerColumns.find((column) => column.key === _groupBy)) === null || _48 === void 0 ? void 0 : _48.search)
508
+ background: ((_50 = headerColumns.find((column) => column.key === _groupBy)) === null || _50 === void 0 ? void 0 : _50.search)
509
509
  ? "var(--background)"
510
510
  : "var(--disabled-bg)",
511
- }, 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" }) }))) ||
511
+ }, value: ((_52 = searchQueries[((_51 = headerColumns.find((column) => column.key === _groupBy)) === null || _51 === void 0 ? void 0 : _51.key) || ""]) === null || _52 === void 0 ? void 0 : _52.text) || "", disabled: !((_53 = headerColumns.find((column) => column.key === _groupBy)) === null || _53 === void 0 ? void 0 : _53.search), height: 32, extraInputStyle: { minWidth: 10 }, className: "w-full", backgroundColor: "#fff" }) }))) ||
512
512
  null })))] })) })] }), search && columnSearchOutside && ((0, jsx_runtime_1.jsx)("div", { style: {
513
513
  marginTop: "0.5rem",
514
- 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}`]) ||
514
+ width: (hugColumnWidths === null || hugColumnWidths === void 0 ? void 0 : hugColumnWidths[`column-${(_54 = headerColumns.find((column) => column.key === _groupBy)) === null || _54 === void 0 ? void 0 : _54.key}`]) ||
515
515
  widthMode === "auto" ||
516
- ((_53 = headerColumns.find((column) => column.key === _groupBy)) === null || _53 === void 0 ? void 0 : _53.width)
516
+ ((_55 = headerColumns.find((column) => column.key === _groupBy)) === null || _55 === void 0 ? void 0 : _55.width)
517
517
  ? "100%"
518
518
  : "100px",
519
519
  pointerEvents: search &&
520
- ((_54 = headerColumns.find((column) => column.key === _groupBy)) === null || _54 === void 0 ? void 0 : _54.search)
520
+ ((_56 = headerColumns.find((column) => column.key === _groupBy)) === null || _56 === void 0 ? void 0 : _56.search)
521
521
  ? "auto"
522
522
  : "none",
523
523
  cursor: search &&
524
- ((_55 = headerColumns.find((column) => column.key === _groupBy)) === null || _55 === void 0 ? void 0 : _55.search)
524
+ ((_57 = headerColumns.find((column) => column.key === _groupBy)) === null || _57 === void 0 ? void 0 : _57.search)
525
525
  ? "default"
526
526
  : "not-allowed",
527
527
  }, children: (0, jsx_runtime_1.jsx)(text_input_1.default, { onKeyDown: (e) => {
@@ -541,15 +541,15 @@ const GridHeader = ({ columns, onSearch, searchQueries, sortable, search, resiza
541
541
  searchType = "contains";
542
542
  }
543
543
  onSearch(((_c = headerColumns.find((column) => column.key === _groupBy)) === null || _c === void 0 ? void 0 : _c.key) || "", e.target.value, searchType);
544
- }, 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: {
545
- background: ((_59 = headerColumns.find((column) => column.key === _groupBy)) === null || _59 === void 0 ? void 0 : _59.search)
544
+ }, value: ((_59 = searchQueries[((_58 = headerColumns.find((column) => column.key === _groupBy)) === null || _58 === void 0 ? void 0 : _58.key) || ""]) === null || _59 === void 0 ? void 0 : _59.text) || "", disabled: !((_60 = headerColumns.find((column) => column.key === _groupBy)) === null || _60 === void 0 ? void 0 : _60.search), extraWrapperStyle: {
545
+ background: ((_61 = headerColumns.find((column) => column.key === _groupBy)) === null || _61 === void 0 ? void 0 : _61.search)
546
546
  ? "#fff"
547
547
  : "#eee",
548
- }, 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)) }));
548
+ }, height: 32, extraInputStyle: { minWidth: 10 }, className: "w-full", backgroundColor: "#fff" }) }))] }, (_62 = headerColumns.find((column) => column.key === _groupBy)) === null || _62 === void 0 ? void 0 : _62.key)) }));
549
549
  }), headerColumns
550
550
  .filter((column) => !groupBy.includes(column.key))
551
551
  .map((column, colIndex) => {
552
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t;
552
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u;
553
553
  if (!column.hidden) {
554
554
  const columnData = (0, exports.getColumnData)(column.key, gridData, (_a = column.dataType) !== null && _a !== void 0 ? _a : "string");
555
555
  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"
@@ -604,12 +604,12 @@ const GridHeader = ({ columns, onSearch, searchQueries, sortable, search, resiza
604
604
  ? "#2377ba"
605
605
  : "#000",
606
606
  } }), dropdownVisible === column.key &&
607
- (column.uniqueDrop ? ((0, jsx_runtime_1.jsx)(gridFilterDropdown_1.default, { columnIndex: colIndex, searchable: (column === null || column === void 0 ? void 0 : column.search) || false, headerDropdownIndex: headerDropdownIndex, searchOptions: searchOptions.filter((item) => column.dataType === "number"
607
+ (column.uniqueDrop ? ((0, jsx_runtime_1.jsx)(gridFilterDropdown_1.default, { columnType: (_b = column.dataType) !== null && _b !== void 0 ? _b : "string", columnIndex: colIndex, searchable: (column === null || column === void 0 ? void 0 : column.search) || false, headerDropdownIndex: headerDropdownIndex, searchOptions: searchOptions.filter((item) => column.dataType === "number"
608
608
  ? numberTypeSearch.includes(item.value)
609
609
  : column.dataType === "date"
610
610
  ? dateTypeSearch.includes(item.value)
611
- : 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) ===
612
- "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) => {
611
+ : 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" ? (((_c = searchQueries[column.key]) === null || _c === void 0 ? void 0 : _c.type) ===
612
+ "between" ? ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(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: `From date`, onChange: (value) => {
613
613
  var _a, _b;
614
614
  return onSearch(column.key, (_a = searchQueries[column.key]) === null || _a === void 0 ? void 0 : _a.text.split("to").map((item, index) => {
615
615
  if (index === 0) {
@@ -619,7 +619,7 @@ const GridHeader = ({ columns, onSearch, searchQueries, sortable, search, resiza
619
619
  }).join("to"), ((_b = searchQueries[column.key]) === null || _b === void 0 ? void 0 : _b.type) ||
620
620
  defaultSearchOperation ||
621
621
  "contains");
622
- } }), (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) => {
622
+ } }), (0, jsx_runtime_1.jsx)(date_input_1.default, { value: (_e = searchQueries[column.key]) === null || _e === void 0 ? void 0 : _e.text.split("to")[1], placeholder: `To date`, onChange: (value) => {
623
623
  var _a, _b;
624
624
  return onSearch(column.key, (_a = searchQueries[column.key]) === null || _a === void 0 ? void 0 : _a.text.split("to").map((item, index) => {
625
625
  if (index === 1) {
@@ -629,7 +629,7 @@ const GridHeader = ({ columns, onSearch, searchQueries, sortable, search, resiza
629
629
  }).join("to"), ((_b = searchQueries[column.key]) === null || _b === void 0 ? void 0 : _b.type) ||
630
630
  defaultSearchOperation ||
631
631
  "contains");
632
- } })] })) : ((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) => {
632
+ } })] })) : ((0, jsx_runtime_1.jsx)(date_input_1.default, { value: (_f = searchQueries[column.key]) === null || _f === void 0 ? void 0 : _f.text.split("to")[0], placeholder: `asd Filter ${column.label}`, onChange: (value) => {
633
633
  var _a;
634
634
  return onSearch(column.key, value, ((_a = searchQueries[column.key]) === null || _a === void 0 ? void 0 : _a.type) ||
635
635
  defaultSearchOperation ||
@@ -643,12 +643,12 @@ const GridHeader = ({ columns, onSearch, searchQueries, sortable, search, resiza
643
643
  return onSearch(column.key, e.target.value, ((_a = searchQueries[column.key]) === null || _a === void 0 ? void 0 : _a.type) ||
644
644
  defaultSearchOperation ||
645
645
  "contains");
646
- }, value: ((_f = searchQueries[column.key]) === null || _f === void 0 ? void 0 : _f.text) ||
646
+ }, value: ((_g = searchQueries[column.key]) === null || _g === void 0 ? void 0 : _g.text) ||
647
647
  "", extraWrapperStyle: {
648
648
  visibility: column.search
649
649
  ? "visible"
650
650
  : "hidden",
651
- }, 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) ||
651
+ }, height: 32, width: "100%", className: "w-full", backgroundColor: "#fff" })) }), onFilter: onFilter, setUniqueSearch: setUniqueSearch, uniqueSearch: uniqueSearch, textFilterLabel: textFilterLabel, activeSearchType: ((_h = searchQueries[column.key]) === null || _h === void 0 ? void 0 : _h.type) ||
652
652
  defaultSearchOperation ||
653
653
  "contains", checkboxWrapper: checkboxWrapper, searchInput: search &&
654
654
  column.search && ((0, jsx_runtime_1.jsx)("div", { style: {
@@ -677,13 +677,13 @@ const GridHeader = ({ columns, onSearch, searchQueries, sortable, search, resiza
677
677
  background: column.search
678
678
  ? "var(--background)"
679
679
  : "var(--disabled-bg)",
680
- }, placeholder: "Search", value: ((_h = searchQueries[column.key]) === null || _h === void 0 ? void 0 : _h.text) ||
680
+ }, placeholder: "Search", value: ((_j = searchQueries[column.key]) === null || _j === void 0 ? void 0 : _j.text) ||
681
681
  "", disabled: !column.search, height: 32, extraInputStyle: { minWidth: 10 }, className: "w-full", backgroundColor: "#fff" }) })) })) : ((0, jsx_runtime_1.jsx)(textFilterDropdown_1.default, { combined: false, 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"
682
682
  ? numberTypeSearch.includes(item.value)
683
683
  : column.dataType === "date"
684
684
  ? dateTypeSearch.includes(item.value)
685
- : 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) ===
686
- "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) => {
685
+ : 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" ? (((_k = searchQueries[column.key]) === null || _k === void 0 ? void 0 : _k.type) ===
686
+ "between" ? ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { 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")[0], placeholder: `From date`, onChange: (value) => {
687
687
  var _a, _b;
688
688
  return onSearch(column.key, (_a = searchQueries[column.key]) === null || _a === void 0 ? void 0 : _a.text.split("to").map((item, index) => {
689
689
  if (index === 0) {
@@ -693,7 +693,7 @@ const GridHeader = ({ columns, onSearch, searchQueries, sortable, search, resiza
693
693
  }).join("to"), ((_b = searchQueries[column.key]) === null || _b === void 0 ? void 0 : _b.type) ||
694
694
  defaultSearchOperation ||
695
695
  "contains");
696
- } }), (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) => {
696
+ } }), (0, jsx_runtime_1.jsx)("div", { style: { marginTop: "0.5rem" }, children: (0, jsx_runtime_1.jsx)(date_input_1.default, { value: (_m = searchQueries[column.key]) === null || _m === void 0 ? void 0 : _m.text.split("to")[1], placeholder: `To date`, onChange: (value) => {
697
697
  var _a, _b;
698
698
  return onSearch(column.key, (_a = searchQueries[column.key]) === null || _a === void 0 ? void 0 : _a.text.split("to").map((item, index) => {
699
699
  if (index === 1) {
@@ -708,7 +708,7 @@ const GridHeader = ({ columns, onSearch, searchQueries, sortable, search, resiza
708
708
  "doesNotContain",
709
709
  "blank",
710
710
  "notBlank",
711
- ].includes(((_m = searchQueries[column.key]) === null || _m === void 0 ? void 0 : _m.type) ||
711
+ ].includes(((_o = searchQueries[column.key]) === null || _o === void 0 ? void 0 : _o.type) ||
712
712
  defaultSearchOperation ||
713
713
  "contains") ? ((0, jsx_runtime_1.jsx)(text_input_1.default, { placeholder: `Filter ${column.label}`, onKeyDown: (e) => {
714
714
  if (e.key === "Enter") {
@@ -719,12 +719,12 @@ const GridHeader = ({ columns, onSearch, searchQueries, sortable, search, resiza
719
719
  return onSearch(column.key, e.target.value, ((_a = searchQueries[column.key]) === null || _a === void 0 ? void 0 : _a.type) ||
720
720
  defaultSearchOperation ||
721
721
  "contains");
722
- }, value: ((_o = searchQueries[column.key]) === null || _o === void 0 ? void 0 : _o.text) ||
722
+ }, value: ((_p = searchQueries[column.key]) === null || _p === void 0 ? void 0 : _p.text) ||
723
723
  "", extraWrapperStyle: {
724
724
  visibility: column.search
725
725
  ? "visible"
726
726
  : "hidden",
727
- }, 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) => {
727
+ }, height: 32, width: "100%", className: "w-full", backgroundColor: "#fff" })) : ((0, jsx_runtime_1.jsx)(date_input_1.default, { value: (_q = searchQueries[column.key]) === null || _q === void 0 ? void 0 : _q.text.split("to")[0], placeholder: `asd Filter ${column.label}`, onChange: (value) => {
728
728
  var _a;
729
729
  return onSearch(column.key, value, ((_a = searchQueries[column.key]) === null || _a === void 0 ? void 0 : _a.type) ||
730
730
  defaultSearchOperation ||
@@ -738,12 +738,12 @@ const GridHeader = ({ columns, onSearch, searchQueries, sortable, search, resiza
738
738
  return onSearch(column.key, e.target.value, ((_a = searchQueries[column.key]) === null || _a === void 0 ? void 0 : _a.type) ||
739
739
  defaultSearchOperation ||
740
740
  "contains");
741
- }, value: ((_q = searchQueries[column.key]) === null || _q === void 0 ? void 0 : _q.text) ||
741
+ }, value: ((_r = searchQueries[column.key]) === null || _r === void 0 ? void 0 : _r.text) ||
742
742
  "", extraWrapperStyle: {
743
743
  visibility: column.search
744
744
  ? "visible"
745
745
  : "hidden",
746
- }, height: 32, width: "100%", className: "w-full", backgroundColor: "#fff" })) }), activeSearchType: ((_r = searchQueries[column.key]) === null || _r === void 0 ? void 0 : _r.type) ||
746
+ }, height: 32, width: "100%", className: "w-full", backgroundColor: "#fff" })) }), activeSearchType: ((_s = searchQueries[column.key]) === null || _s === void 0 ? void 0 : _s.type) ||
747
747
  defaultSearchOperation ||
748
748
  "contains", searchInput: (search && column.search && ((0, jsx_runtime_1.jsx)("div", { style: {
749
749
  padding: "0.5rem",
@@ -770,7 +770,7 @@ const GridHeader = ({ columns, onSearch, searchQueries, sortable, search, resiza
770
770
  background: column.search
771
771
  ? "var(--background)"
772
772
  : "var(--disabled-bg)",
773
- }, value: ((_s = searchQueries[column.key]) === null || _s === void 0 ? void 0 : _s.text) ||
773
+ }, value: ((_t = searchQueries[column.key]) === null || _t === void 0 ? void 0 : _t.text) ||
774
774
  "", disabled: !column.search, height: 32, extraInputStyle: { minWidth: 10 }, className: "w-full", backgroundColor: "#fff" }) }))) ||
775
775
  null })))] })) })] }), search && columnSearchOutside && ((0, jsx_runtime_1.jsx)("div", { style: {
776
776
  marginTop: "0.5rem",
@@ -797,7 +797,7 @@ const GridHeader = ({ columns, onSearch, searchQueries, sortable, search, resiza
797
797
  background: column.search
798
798
  ? "var(--background)"
799
799
  : "var(--disabled-bg)",
800
- }, 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));
800
+ }, 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));
801
801
  }
802
802
  return null;
803
803
  })] }));
@@ -1 +1 @@
1
- export declare const formatValue: (value: string | number | Date, type: string, locale?: string, options?: Intl.NumberFormatOptions) => string | number;
1
+ export declare const formatValue: (value: string | number | Date, type: string, locale?: string, options?: any) => string | number;
@@ -3,11 +3,20 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.formatValue = void 0;
4
4
  const regexUtils_1 = require("../components/grid/utils/regexUtils");
5
5
  // Function to format numbers
6
- const formatNumber = (value, locale = "sv-SE", options = {}) => {
7
- const formatter = new Intl.NumberFormat(locale, options);
6
+ const formatNumber = (value, locale = "sv-SE") => {
7
+ const formatter = new Intl.NumberFormat(locale);
8
8
  return formatter.format(value);
9
9
  };
10
- const toISODate = (d) => d.toISOString().slice(0, 10);
10
+ // ISO-like string including local time (no timezone)
11
+ const toISODateTime = (d) => {
12
+ const y = d.getFullYear();
13
+ const m = String(d.getMonth() + 1).padStart(2, "0");
14
+ const day = String(d.getDate()).padStart(2, "0");
15
+ const hh = String(d.getHours()).padStart(2, "0");
16
+ const mm = String(d.getMinutes()).padStart(2, "0");
17
+ const ss = String(d.getSeconds()).padStart(2, "0");
18
+ return `${y}-${m}-${day}T${hh}:${mm}:${ss}`;
19
+ };
11
20
  const parseSupportedDate = (input) => {
12
21
  if (input instanceof Date) {
13
22
  return isNaN(input.getTime()) ? null : input;
@@ -21,6 +30,28 @@ const parseSupportedDate = (input) => {
21
30
  const str = input.trim();
22
31
  if (!str)
23
32
  return null;
33
+ // DD-MM-YYYY HH:mm[:ss] or DD/MM/YYYY HH:mm[:ss]
34
+ if (/^\d{2}[-\/]\d{2}[-\/]\d{4} \d{2}:\d{2}(:\d{2})?$/.test(str)) {
35
+ const [datePart, timePart] = str.split(" ");
36
+ const sep = datePart.includes("-") ? "-" : "/";
37
+ const [p1s, p2s, ys] = datePart.split(sep);
38
+ const [hs, mins, ss = "0"] = timePart.split(":");
39
+ const part1 = Number(p1s);
40
+ const part2 = Number(p2s);
41
+ const year = Number(ys);
42
+ const day = part1 > 12 ? part1 : part2;
43
+ const month = part1 > 12 ? part2 : part1;
44
+ const hour = Number(hs);
45
+ const minute = Number(mins);
46
+ const second = Number(ss);
47
+ const d = new Date(year, month - 1, day, hour, minute, second);
48
+ return d.getFullYear() === year &&
49
+ d.getMonth() + 1 === month &&
50
+ d.getDate() === day
51
+ ? d
52
+ : null;
53
+ }
54
+ // DD-MM-YYYY or DD/MM/YYYY
24
55
  if (/^\d{2}[-\/]\d{2}[-\/]\d{4}$/.test(str)) {
25
56
  const sep = str.includes("-") ? "-" : "/";
26
57
  const [p1s, p2s, ys] = str.split(sep);
@@ -36,6 +67,26 @@ const parseSupportedDate = (input) => {
36
67
  ? d
37
68
  : null;
38
69
  }
70
+ // YYYY-MM-DD HH:mm[:ss] or YYYY/MM/DD HH:mm[:ss]
71
+ if (/^\d{4}[-\/]\d{2}[-\/]\d{2} \d{2}:\d{2}(:\d{2})?$/.test(str)) {
72
+ const [datePart, timePart] = str.split(" ");
73
+ const sep = datePart.includes("-") ? "-" : "/";
74
+ const [ys, ms, ds] = datePart.split(sep);
75
+ const [hs, mins, ss = "0"] = timePart.split(":");
76
+ const year = Number(ys);
77
+ const month = Number(ms);
78
+ const day = Number(ds);
79
+ const hour = Number(hs);
80
+ const minute = Number(mins);
81
+ const second = Number(ss);
82
+ const d = new Date(year, month - 1, day, hour, minute, second);
83
+ return d.getFullYear() === year &&
84
+ d.getMonth() + 1 === month &&
85
+ d.getDate() === day
86
+ ? d
87
+ : null;
88
+ }
89
+ // YYYY-MM-DD or YYYY/MM/DD or YYYY.MM.DD
39
90
  if (/^\d{4}[-\/.]\d{2}[-\/.]\d{2}$/.test(str)) {
40
91
  const sep = str.includes("-") ? "-" : str.includes("/") ? "/" : ".";
41
92
  const [ys, ms, ds] = str.split(sep);
@@ -52,7 +103,7 @@ const parseSupportedDate = (input) => {
52
103
  const d = new Date(str);
53
104
  return isNaN(d.getTime()) ? null : d;
54
105
  };
55
- const formatDate = (date, locale = "sv-SE", options = {}) => {
106
+ const formatDate = (date, locale = "sv-SE", options) => {
56
107
  const formatter = new Intl.DateTimeFormat(locale, options);
57
108
  return formatter.format(date);
58
109
  };
@@ -62,36 +113,64 @@ const formatCurrency = (value, locale = "sv-SE", currency = "SEK", options = {})
62
113
  return formatter.format(value);
63
114
  };
64
115
  // Dynamic formatter function
65
- const formatValue = (value, type = "number", locale = "sv-SE", options = {
66
- currency: "SEK",
67
- }) => {
116
+ const formatValue = (value, type = "number", locale = "sv-SE", options) => {
68
117
  if (type === "number") {
69
118
  const num = parseFloat(value.toString());
70
- return formatNumber(num, locale, options);
119
+ return formatNumber(num, locale);
71
120
  }
72
121
  else if (type === "date") {
73
122
  let date = "";
74
123
  if (value instanceof Date) {
75
- date = isNaN(value.getTime()) ? "" : toISODate(value);
124
+ date = isNaN(value.getTime()) ? "" : toISODateTime(value);
76
125
  }
77
126
  if (typeof value === "number") {
78
127
  const d = parseSupportedDate(value);
79
- date = d ? toISODate(d) : "";
128
+ date = d ? toISODateTime(d) : "";
80
129
  }
81
130
  if (typeof value === "string") {
82
131
  if (!(0, regexUtils_1.isValidDateFormat)(value))
83
132
  return value;
84
133
  const d = parseSupportedDate(value);
85
- date = d ? toISODate(d) : "";
134
+ date = d ? toISODateTime(d) : "";
86
135
  }
87
136
  if (date) {
88
- return formatDate(new Date(date).getTime(), locale, options);
137
+ const { dateStyle, timeStyle, weekday, era, year, month, day, hour, minute, second, hour12, hourCycle, timeZone, timeZoneName, fractionalSecondDigits, } = options;
138
+ return formatDate(new Date(date).getTime(), locale, {
139
+ dateStyle,
140
+ timeStyle,
141
+ weekday,
142
+ era,
143
+ year,
144
+ month,
145
+ day,
146
+ hour,
147
+ minute,
148
+ second,
149
+ hour12,
150
+ hourCycle,
151
+ timeZone,
152
+ timeZoneName,
153
+ fractionalSecondDigits,
154
+ });
89
155
  }
90
156
  return value.toString();
91
157
  }
92
158
  else if (type === "currency") {
93
159
  const num = parseFloat(value.toString());
94
- return formatCurrency(num, locale, options.currency, options);
160
+ const { currency, currencyDisplay, currencySign, notation, compactDisplay, minimumFractionDigits, maximumFractionDigits, minimumSignificantDigits, maximumSignificantDigits, useGrouping, roundingMode, roundingIncrement, } = options;
161
+ return formatCurrency(num, locale, currency, {
162
+ currencyDisplay,
163
+ currencySign,
164
+ notation,
165
+ compactDisplay,
166
+ minimumFractionDigits,
167
+ maximumFractionDigits,
168
+ minimumSignificantDigits,
169
+ maximumSignificantDigits,
170
+ useGrouping,
171
+ roundingMode,
172
+ roundingIncrement,
173
+ });
95
174
  }
96
175
  else {
97
176
  return value.toString();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@megha-ui/react",
3
- "version": "1.2.124",
3
+ "version": "1.2.126",
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",