@megha-ui/react 1.2.415 → 1.2.417
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.
|
@@ -227,6 +227,7 @@ const Grid = ({ columns, wrapperClass, updateGridColumns, data, height, sortable
|
|
|
227
227
|
const regex = createRegexFromWildcard(query);
|
|
228
228
|
return regex.test(value);
|
|
229
229
|
}
|
|
230
|
+
console.log({ query, value, column, searchQueries });
|
|
230
231
|
switch ((_c = searchQueries[column.key]) === null || _c === void 0 ? void 0 : _c.type) {
|
|
231
232
|
case "contains":
|
|
232
233
|
return value.toLowerCase().includes(query.toLowerCase());
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { memo, useCallback, useEffect, useMemo, useState } from "react";
|
|
2
|
+
import { memo, useCallback, useEffect, useMemo, useState, } from "react";
|
|
3
3
|
import Shimmer from "./shimmer";
|
|
4
4
|
import Checkbox from "../../checkbox";
|
|
5
5
|
import { formatValue } from "../../../services/commonService";
|
|
@@ -19,7 +19,7 @@ const isUrl = (value) => {
|
|
|
19
19
|
return false;
|
|
20
20
|
};
|
|
21
21
|
const GridRow = ({ item, rowStyle, cellStyle, rowHeight, bulkSelect, selectedRows, toggleRowSelection, columns, widthMode, index, rowKey, hasVerticalScroll, onRowClick, loading, groupBy, rowIndex, columnIndex, hlBorderColor, handleDragStart, handleDragOver, handleDrop, draggable, checkboxWrapper, hugColumnWidths, hugColumnHeights, alternateRowColor, isExpandable, expandedRow, ignoreRowSelect, locale, formatOptions, }) => {
|
|
22
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
|
|
22
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r;
|
|
23
23
|
const [itemsAlign, setItemsAlign] = useState("stretch");
|
|
24
24
|
const [draggableIndex, setDraggableIndex] = useState(0);
|
|
25
25
|
const groupByKeys = useMemo(() => (groupBy || "")
|
|
@@ -51,16 +51,17 @@ const GridRow = ({ item, rowStyle, cellStyle, rowHeight, bulkSelect, selectedRow
|
|
|
51
51
|
}
|
|
52
52
|
setDraggableIndex(_dragIndex);
|
|
53
53
|
}, [columns]);
|
|
54
|
-
return isExpandable &&
|
|
54
|
+
return isExpandable &&
|
|
55
|
+
((_a = item === null || item === void 0 ? void 0 : item.id) === null || _a === void 0 ? void 0 : _a.value) &&
|
|
55
56
|
expandedRow === ((_b = item === null || item === void 0 ? void 0 : item.id) === null || _b === void 0 ? void 0 : _b.value) &&
|
|
56
|
-
item.expandedDetails ? (_jsxs("div", { children: [_jsxs("div", { id:
|
|
57
|
+
item.expandedDetails ? (_jsxs("div", { children: [_jsxs("div", { id: String((_d = (_c = item.id) === null || _c === void 0 ? void 0 : _c.value) !== null && _d !== void 0 ? _d : index), draggable: draggable, onDragStart: (e) => handleDragStart && handleDragStart(e, index), onDragOver: (e) => handleDragOver && handleDragOver(e), onDrop: (e) => handleDrop && handleDrop(e, index), className: getRowClassNames(), style: Object.assign(Object.assign({}, rowStyle), { position: "relative", display: "flex", alignItems: itemsAlign, fontSize: "inherit", minHeight: rowHeight, height: "max-content", boxSizing: "border-box", backgroundColor: alternateRowColor && (index + 1) % 2 === 0
|
|
57
58
|
? "var(--row-bg)"
|
|
58
59
|
: "var(--row-bg-even)" }), onClick: handleRowClick, children: [bulkSelect && (_jsx("div", { style: Object.assign(Object.assign({}, cellStyle), { textTransform: "uppercase", padding: "0.5rem", textAlign: "left", whiteSpace: "nowrap", textOverflow: "ellipsis" }), children: _jsx(Checkbox, { noLabel: true, disabled: ignoreRowSelect &&
|
|
59
|
-
ignoreRowSelect.has((
|
|
60
|
+
ignoreRowSelect.has((_e = item["id"].value) === null || _e === void 0 ? void 0 : _e.toString()), onChange: () => { var _a; return toggleRowSelection((_a = item["id"].value) === null || _a === void 0 ? void 0 : _a.toString()); }, selected: item["id"] && selectedRows.has(item["id"].value), wrapperClass: checkboxWrapper }) })), item[groupBy] && (_jsx("div", { style: {
|
|
60
61
|
width: widthMode === "auto"
|
|
61
62
|
? "auto"
|
|
62
|
-
: ((
|
|
63
|
-
? (
|
|
63
|
+
: ((_f = columns.find((column) => column.key === groupBy)) === null || _f === void 0 ? void 0 : _f.width)
|
|
64
|
+
? (_g = columns.find((column) => column.key === groupBy)) === null || _g === void 0 ? void 0 : _g.width
|
|
64
65
|
: (hugColumnWidths === null || hugColumnWidths === void 0 ? void 0 : hugColumnWidths[`column-${groupBy}`])
|
|
65
66
|
? hugColumnWidths === null || hugColumnWidths === void 0 ? void 0 : hugColumnWidths[`column-${groupBy}`]
|
|
66
67
|
: "fit-content",
|
|
@@ -69,7 +70,7 @@ const GridRow = ({ item, rowStyle, cellStyle, rowHeight, bulkSelect, selectedRow
|
|
|
69
70
|
backgroundColor: alternateRowColor && (index + 1) % 2 === 0
|
|
70
71
|
? "var(--row-bg)"
|
|
71
72
|
: "var(--row-bg-even)",
|
|
72
|
-
}, className: `column index-${groupBy}`, children: _jsx("div", { children: ((
|
|
73
|
+
}, className: `column index-${groupBy}`, children: _jsx("div", { children: ((_h = item[groupBy]) === null || _h === void 0 ? void 0 : _h.html) || ((_j = item[groupBy]) === null || _j === void 0 ? void 0 : _j.value) }) })), columns.map((column, colIndex) => {
|
|
73
74
|
var _a, _b, _c, _d;
|
|
74
75
|
const cellData = item[column.key];
|
|
75
76
|
const cellValue = cellData && Object.keys(cellData).includes("html")
|
|
@@ -113,13 +114,14 @@ const GridRow = ({ item, rowStyle, cellStyle, rowHeight, bulkSelect, selectedRow
|
|
|
113
114
|
}, children: isUrl(cellUrl) ? (_jsx("a", { href: cellUrl, target: "_blank", rel: "noopener noreferrer", children: cellValue })) : column.render ? (column.render(cellValue)) : (cellValue) }))] }, `${column.key}-${(_d = (_c = item.id) === null || _c === void 0 ? void 0 : _c.value) !== null && _d !== void 0 ? _d : index}`));
|
|
114
115
|
}
|
|
115
116
|
return null;
|
|
116
|
-
})] }), isExpandable &&
|
|
117
|
-
|
|
117
|
+
})] }), isExpandable &&
|
|
118
|
+
((_k = item === null || item === void 0 ? void 0 : item.id) === null || _k === void 0 ? void 0 : _k.value) &&
|
|
119
|
+
expandedRow === ((_l = item === null || item === void 0 ? void 0 : item.id) === null || _l === void 0 ? void 0 : _l.value) &&
|
|
118
120
|
item.expandedDetails &&
|
|
119
|
-
item.expandedDetails.html] }, String((
|
|
121
|
+
item.expandedDetails.html] }, String((_o = (_m = item.id) === null || _m === void 0 ? void 0 : _m.value) !== null && _o !== void 0 ? _o : index))) : (_jsxs("div", { id: `${index}`, draggable: draggable, onDragStart: (e) => handleDragStart && handleDragStart(e, index), onDragOver: (e) => handleDragOver && handleDragOver(e), onDrop: (e) => handleDrop && handleDrop(e, index), className: getRowClassNames(), style: Object.assign(Object.assign({}, rowStyle), { position: "relative", display: "flex", alignItems: itemsAlign, fontSize: "inherit", minHeight: rowHeight, height: "max-content", boxSizing: "border-box", backgroundColor: alternateRowColor && (index + 1) % 2 === 0
|
|
120
122
|
? "var(--row-bg)"
|
|
121
123
|
: "var(--row-bg-even)" }), onClick: handleRowClick, children: [bulkSelect && (_jsx("div", { style: Object.assign(Object.assign({}, cellStyle), { textTransform: "uppercase", padding: "0.5rem", textAlign: "left", whiteSpace: "nowrap", textOverflow: "ellipsis" }), children: _jsx(Checkbox, { noLabel: true, disabled: ignoreRowSelect &&
|
|
122
|
-
ignoreRowSelect.has((
|
|
124
|
+
ignoreRowSelect.has((_p = item["id"].value) === null || _p === void 0 ? void 0 : _p.toString()), onChange: () => { var _a; return toggleRowSelection((_a = item["id"].value) === null || _a === void 0 ? void 0 : _a.toString()); }, selected: item["id"] && selectedRows.has(item["id"].value), wrapperClass: checkboxWrapper }) })), columns.map((column, colIndex) => {
|
|
123
125
|
var _a, _b, _c;
|
|
124
126
|
const cellData = item[column.key];
|
|
125
127
|
const cellValue = cellData && Object.keys(cellData).includes("html")
|
|
@@ -162,6 +164,6 @@ const GridRow = ({ item, rowStyle, cellStyle, rowHeight, bulkSelect, selectedRow
|
|
|
162
164
|
}, children: isUrl(cellUrl) ? (_jsx("a", { href: cellUrl, target: "_blank", rel: "noopener noreferrer", children: cellValue })) : column.render ? (column.render(cellValue)) : (cellValue) }))] }, `${column.key}-${(_c = (_b = item.id) === null || _b === void 0 ? void 0 : _b.value) !== null && _c !== void 0 ? _c : index}`));
|
|
163
165
|
}
|
|
164
166
|
return null;
|
|
165
|
-
})] }, String((
|
|
167
|
+
})] }, String((_r = (_q = item.id) === null || _q === void 0 ? void 0 : _q.value) !== null && _r !== void 0 ? _r : index)));
|
|
166
168
|
};
|
|
167
169
|
export default memo(GridRow);
|
package/package.json
CHANGED