@megha-ui/react 1.2.19 → 1.2.21
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.
|
@@ -127,17 +127,16 @@ const Grid = ({ columns, wrapperClass, updateGridColumns, data, height, sortable
|
|
|
127
127
|
if (_columns.length > 0 && data.length > 0) {
|
|
128
128
|
const columnData = _columns.reduce((acc, item) => {
|
|
129
129
|
let type = "string";
|
|
130
|
-
const values = data
|
|
131
|
-
|
|
132
|
-
const hasValues = values.some(item => item !== "");
|
|
130
|
+
const values = data.map((row) => { var _a, _b; return (_b = (_a = row === null || row === void 0 ? void 0 : row[item === null || item === void 0 ? void 0 : item.key]) === null || _a === void 0 ? void 0 : _a.value) !== null && _b !== void 0 ? _b : ""; });
|
|
131
|
+
const hasValues = values.some((item) => item !== "");
|
|
133
132
|
if (hasValues) {
|
|
134
|
-
if (values.some(item => typeof item === "string" && (0, regexUtils_1.isValidDateFormat)(item))) {
|
|
133
|
+
if (values.some((item) => typeof item === "string" && (0, regexUtils_1.isValidDateFormat)(item))) {
|
|
135
134
|
type = "date";
|
|
136
135
|
}
|
|
137
|
-
else if (values.some(item => typeof item === "number")) {
|
|
136
|
+
else if (values.some((item) => typeof item === "number")) {
|
|
138
137
|
type = "number";
|
|
139
138
|
}
|
|
140
|
-
else if (values.some(item => typeof item === "string" && /^\d+$/.test(item.toString().trim()))) {
|
|
139
|
+
else if (values.some((item) => typeof item === "string" && /^\d+$/.test(item.toString().trim()))) {
|
|
141
140
|
type = "number";
|
|
142
141
|
}
|
|
143
142
|
}
|
|
@@ -994,9 +993,7 @@ const Grid = ({ columns, wrapperClass, updateGridColumns, data, height, sortable
|
|
|
994
993
|
const filterDetails = (0, react_1.useMemo)(() => {
|
|
995
994
|
const filterColumn = gridColumns.reduce((acc, column) => {
|
|
996
995
|
const query = searchQueries[column.key];
|
|
997
|
-
const uniqeValues =
|
|
998
|
-
...new Set(filteredData.map((data) => { var _a; return data[column.key] && ((_a = data[column.key].value) === null || _a === void 0 ? void 0 : _a.toString()); })),
|
|
999
|
-
].sort();
|
|
996
|
+
const uniqeValues = (0, gridHeader_1.getColumnData)(column.key, filteredData);
|
|
1000
997
|
if (query &&
|
|
1001
998
|
(query.text !== "" || query.type !== defaultSearchOperation)) {
|
|
1002
999
|
acc[column.key] = query.text;
|
|
@@ -1024,6 +1021,7 @@ const Grid = ({ columns, wrapperClass, updateGridColumns, data, height, sortable
|
|
|
1024
1021
|
}
|
|
1025
1022
|
return acc;
|
|
1026
1023
|
}, {});
|
|
1024
|
+
console.log(propFilterColumn, filterColumn);
|
|
1027
1025
|
const sortColumn = gridColumns.reduce((acc, column) => {
|
|
1028
1026
|
const query = sortQueries === null || sortQueries === void 0 ? void 0 : sortQueries[column.key];
|
|
1029
1027
|
if (query) {
|
|
@@ -1390,7 +1388,8 @@ const Grid = ({ columns, wrapperClass, updateGridColumns, data, height, sortable
|
|
|
1390
1388
|
else if (index >= startIndex && index <= endIndex) {
|
|
1391
1389
|
return ((0, jsx_runtime_1.jsx)(gridRow_1.default, { item: item, index: index, rowStyle: Object.assign(Object.assign({}, rowStyle), (selectedRow === index ? selectedRowStyle : {})), handleDragStart: handleDragStart, handleDragOver: handleDragOver, handleDrop: handleDrop, draggable: draggable, cellStyle: cellStyle, rowHeight: rowHeight, alternateRowColor: alternateRowColor, bulkSelect: bulkSelect, selectedRows: selectedRows ? selectedRows : new Set([""]), ignoreRowSelect: ignoreRowSelect ? ignoreRowSelect : new Set([""]), toggleRowSelection: toggleRowSelection, columns: gridColumns, widthMode: widthMode, hasVerticalScroll: hasVerticalScroll, onRowClick: onRowClick, loading: isLoading, groupBy: gridGroupBy, rowKey: rowKey, rowIndex: rowIndex, columnIndex: columnIndex, hlBorderColor: hlBorderColor, hugColumnWidths: columnWidths, hugColumnHeights: columnHeights, expandedRow: expandedRow, isExpandable: isExpandable, checkboxWrapper: checkboxWrapper }, String((_d = (_c = item.id) === null || _c === void 0 ? void 0 : _c.value) !== null && _d !== void 0 ? _d : index)));
|
|
1392
1390
|
}
|
|
1393
|
-
}), extraRow && extraRow, (paginate ? paginatedData : sortedData).length === 0 &&
|
|
1391
|
+
}), extraRow && extraRow, (paginate ? paginatedData : sortedData).length === 0 &&
|
|
1392
|
+
typeof extraRow === "undefined" && ((0, jsx_runtime_1.jsx)("div", { style: {
|
|
1394
1393
|
width: "100%",
|
|
1395
1394
|
height: `calc(100% - ${(_d = headerRef === null || headerRef === void 0 ? void 0 : headerRef.current) === null || _d === void 0 ? void 0 : _d.clientHeight}px)`,
|
|
1396
1395
|
display: "flex",
|
package/package.json
CHANGED