@megha-ui/react 1.3.89 → 1.3.92
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.
- package/dist/components/grid/index.js +1 -1
- package/dist/components/grid/types/grid.d.ts +1 -1
- package/dist/components/grid/utils/gridFilterDropdown.js +15 -3
- package/dist/components/grid/utils/newGroupedGridDetails.js +5 -1
- package/dist/components/grid/utils/textFilterDropdown.js +13 -2
- package/package.json +1 -1
|
@@ -1581,7 +1581,7 @@ withCard = false, cardClassName, cardHeader, title, headerLeft, headerRight, sub
|
|
|
1581
1581
|
: [..._gridGroupBy.split(",").filter((item) => item), value].join(",");
|
|
1582
1582
|
setGridGroupBy(_gridGroupBy);
|
|
1583
1583
|
updateGroupBy && updateGroupBy(_gridGroupBy);
|
|
1584
|
-
}, headerDropdownIndex: headerDropdownIndex, updateGridColumns: updateGridColumns, setGridColumns: setGridColumns, widthUnits: widthUnits, gridData: filteredData, checkboxWrapper: checkboxWrapper, onFilter: onFilter, setUniqueSearch: setUniqueSearch, uniqueSearch: uniqueSearch, hugColumnWidths: columnWidths, menuVisible: menuVisible, setMenuVisible: setMenuVisible, dropdownVisible: dropdownVisible, actionsKey: actionsKey, setDropdownVisible: setDropdownVisible, columnSearchOutside: columnSearchOutside, locale: locale, formatOptions: formatOptions }), gridGroupBy !== "" ? (_jsx(NewGroupedGridDetails, { locale: locale, formatOptions: formatOptions, groupedData: groupedData, rowOpened: rowOpened, startIndex: startIndex, endIndex: endIndex, alternateRowColor: alternateRowColor, updateRowOpened: updateRowOpened, columnWidths: columnWidths, columnHeights: columnHeights, groupBy: groupBy, widthMode: widthMode, rowKey: rowKey, rowHeight: rowHeight, headerBackground: headerBackground, isSummarise: summariseAvailable, gridGroupBy: gridGroupBy, rowStyle: rowStyle, sortable: sortable, cellStyle: cellStyle, summariseKeys: summariseKeys, summariseDetails: summariseDetails, activeCalculateColor: activeCalculateColor, gridRef: gridRef, setCalculatePosition: setCalculatePosition, calculatePosition: calculatePosition, calculatetextColor: calculatetextColor, setCalculateVisible: setCalculateVisible, calculateVisible: calculateVisible, summariseDisplay: summariseDisplay, recalculate: recalculate, selectedRowStyle: selectedRowStyle, isLoading: isLoading, selectedRow: selectedRow, onRowClick: onRowClick, gridColumns: gridColumns, bulkSelect: bulkSelect, selectedRows: selectedRows, toggleRowSelection: toggleRowSelection, hasVerticalScroll: hasVerticalScroll, setColumnWidths: setColumnWidths, setColumnHeights: setColumnHeights, ignoreClickKeys: ignoreClickKeys, actionsKey: actionsKey })) : (tableData.map((item, index) => {
|
|
1584
|
+
}, headerDropdownIndex: headerDropdownIndex, updateGridColumns: updateGridColumns, setGridColumns: setGridColumns, widthUnits: widthUnits, gridData: filteredData, checkboxWrapper: checkboxWrapper, onFilter: onFilter, setUniqueSearch: setUniqueSearch, uniqueSearch: uniqueSearch, hugColumnWidths: columnWidths, menuVisible: menuVisible, setMenuVisible: setMenuVisible, dropdownVisible: dropdownVisible, actionsKey: actionsKey, setDropdownVisible: setDropdownVisible, columnSearchOutside: columnSearchOutside, locale: locale, formatOptions: formatOptions }), gridGroupBy !== "" ? (_jsx(NewGroupedGridDetails, { locale: locale, formatOptions: formatOptions, groupedData: groupedData, rowOpened: rowOpened, startIndex: startIndex, endIndex: endIndex, alternateRowColor: alternateRowColor, updateRowOpened: updateRowOpened, columnWidths: columnWidths, columnHeights: columnHeights, groupBy: groupBy !== null && groupBy !== void 0 ? groupBy : "", widthMode: widthMode, rowKey: rowKey, rowHeight: rowHeight, headerBackground: headerBackground, isSummarise: summariseAvailable, gridGroupBy: gridGroupBy, rowStyle: rowStyle, sortable: sortable, cellStyle: cellStyle, summariseKeys: summariseKeys, summariseDetails: summariseDetails, activeCalculateColor: activeCalculateColor, gridRef: gridRef, setCalculatePosition: setCalculatePosition, calculatePosition: calculatePosition, calculatetextColor: calculatetextColor, setCalculateVisible: setCalculateVisible, calculateVisible: calculateVisible, summariseDisplay: summariseDisplay, recalculate: recalculate, selectedRowStyle: selectedRowStyle, isLoading: isLoading, selectedRow: selectedRow, onRowClick: onRowClick, gridColumns: gridColumns, bulkSelect: bulkSelect, selectedRows: selectedRows, toggleRowSelection: toggleRowSelection, hasVerticalScroll: hasVerticalScroll, setColumnWidths: setColumnWidths, setColumnHeights: setColumnHeights, ignoreClickKeys: ignoreClickKeys, actionsKey: actionsKey })) : (tableData.map((item, index) => {
|
|
1585
1585
|
var _a, _b, _c, _d;
|
|
1586
1586
|
if (paginate) {
|
|
1587
1587
|
return (_jsx(NewGridRow, { item: item, index: index, rowStyle: Object.assign({}, rowStyle), selectedRow: selectedRow !== null && selectedRow !== void 0 ? selectedRow : "", selectedRowStyle: 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, locale: locale, formatOptions: formatOptions, ignoreClickKeys: ignoreClickKeys, actionsKey: actionsKey }, String((_b = (_a = item.id) === null || _a === void 0 ? void 0 : _a.value) !== null && _b !== void 0 ? _b : index)));
|
|
@@ -1,12 +1,24 @@
|
|
|
1
|
-
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import ReactDOM from "react-dom";
|
|
3
3
|
const GridFilterDropdown = ({ headerDropdownIndex, position, sortingOps, searchOps, columnIndex, portalTarget, }) => {
|
|
4
|
-
const dropdownContent = (
|
|
4
|
+
const dropdownContent = (_jsx("div", { style: Object.assign(Object.assign({ position: position ? "absolute" : "absolute" }, (position
|
|
5
5
|
? {
|
|
6
6
|
top: position.top,
|
|
7
7
|
left: position.left,
|
|
8
8
|
}
|
|
9
|
-
: Object.assign({ top: "calc(100% + 5px)" }, (columnIndex > 1 ? { right: 0 } : { left: 0 })))), { zIndex: headerDropdownIndex ? headerDropdownIndex : 1000, backgroundColor: "var(--background)", color: "var(--foreground)", boxShadow: "0px 0.5rem 1rem 0px rgba(0,0,0,0.2)", listStyleType: "none", padding: "0.35rem 0", width: "max-content", maxWidth: "500px", borderRadius: "0.5rem", margin: 0 }), onClick: (e) => e.stopPropagation(), children:
|
|
9
|
+
: Object.assign({ top: "calc(100% + 5px)" }, (columnIndex > 1 ? { right: 0 } : { left: 0 })))), { zIndex: headerDropdownIndex ? headerDropdownIndex : 1000, backgroundColor: "var(--card-bg, var(--background))", color: "var(--foreground)", boxShadow: "0px 0.5rem 1rem 0px rgba(0,0,0,0.2)", border: "1px solid var(--divider, #eceff4)", listStyleType: "none", padding: "0.35rem 0.35rem", width: "max-content", maxWidth: "500px", borderRadius: "0.5rem", margin: 0 }), onClick: (e) => e.stopPropagation(), children: _jsxs("div", { style: {
|
|
10
|
+
display: "flex",
|
|
11
|
+
flexDirection: "column",
|
|
12
|
+
gap: "0.25rem",
|
|
13
|
+
minWidth: "12rem",
|
|
14
|
+
}, children: [sortingOps && (_jsx("div", { style: {
|
|
15
|
+
padding: "0.35rem 0.5rem 0.25rem",
|
|
16
|
+
borderBottom: searchOps
|
|
17
|
+
? "1px solid var(--divider, #eceff4)"
|
|
18
|
+
: "none",
|
|
19
|
+
}, children: sortingOps })), searchOps && (_jsx("div", { style: {
|
|
20
|
+
padding: "0.25rem 0.5rem 0.35rem",
|
|
21
|
+
}, children: searchOps }))] }) }));
|
|
10
22
|
// Render in a portal so the dropdown is not occluded
|
|
11
23
|
// by sticky header cells or other stacking contexts.
|
|
12
24
|
return ReactDOM.createPortal(dropdownContent, portalTarget || document.body);
|
|
@@ -3,6 +3,10 @@ import React, { memo } from "react";
|
|
|
3
3
|
import NewSummariseDetails from "./newSummariseDetails";
|
|
4
4
|
import NewGroupedRow from "./newGroupedRow";
|
|
5
5
|
const GroupedGrid = ({ groupedData, rowOpened, startIndex, endIndex, alternateRowColor, updateRowOpened, columnWidths, groupBy, widthMode, rowKey, rowHeight, headerBackground, isSummarise, gridGroupBy, rowStyle, sortable, cellStyle, summariseKeys, summariseDetails, activeCalculateColor, gridRef, setCalculatePosition, calculatePosition, calculatetextColor, setCalculateVisible, calculateVisible, summariseDisplay, recalculate, selectedRowStyle, isLoading, selectedRow, onRowClick, gridColumns, bulkSelect, selectedRows, toggleRowSelection, hasVerticalScroll, setColumnWidths, actionsKey, ignoreClickKeys, locale, formatOptions, }) => {
|
|
6
|
+
const groupByKeys = React.useMemo(() => (groupBy || "")
|
|
7
|
+
.split(",")
|
|
8
|
+
.filter((g) => g)
|
|
9
|
+
.flatMap((g) => g.split("+").filter((k) => k)), [groupBy]);
|
|
6
10
|
return (_jsx(_Fragment, { children: groupedData
|
|
7
11
|
.filter((item) => {
|
|
8
12
|
return item.type === "main" && item.level === 1
|
|
@@ -53,7 +57,7 @@ const GroupedGrid = ({ groupedData, rowOpened, startIndex, endIndex, alternateRo
|
|
|
53
57
|
flexWrap: "wrap",
|
|
54
58
|
}, children: [_jsx("span", { style: { marginRight: "0.5rem" }, children: item.html ? _jsx(_Fragment, { children: item.html }) : item.value }), _jsx("span", { children: `(${item === null || item === void 0 ? void 0 : item.count})` })] })] }), isSummarise &&
|
|
55
59
|
parseInt(((_b = item === null || item === void 0 ? void 0 : item.count) === null || _b === void 0 ? void 0 : _b.toString()) || "0") > 0 && (_jsx(NewSummariseDetails, { rowIndex: gIndex, removedKeys: item.groupedKey.split(">"), columns: gridColumns, groupBy: gridGroupBy, sortable: sortable, cellStyle: cellStyle, columnWidths: columnWidths, widthMode: widthMode, summariseKeys: summariseKeys, summariseDetails: summariseDetails, activeCalculateColor: activeCalculateColor, gridRef: gridRef, setCalculatePosition: setCalculatePosition, calculatePosition: calculatePosition, calculatetextColor: calculatetextColor, setCalculateVisible: setCalculateVisible, calculateVisible: calculateVisible, summariseDisplay: summariseDisplay, recalculate: recalculate, groupedData: item.groupedValue, actionsKey: actionsKey })), !isSummarise && (_jsx("div", { className: "column group-summary-placeholder", style: {
|
|
56
|
-
gridColumn:
|
|
60
|
+
gridColumn: `span ${gridColumns.filter((column) => !groupByKeys.includes(column.key)).length - 1} / span ${gridColumns.filter((column) => !groupByKeys.includes(column.key)).length - 1}`,
|
|
57
61
|
padding: "0.5rem",
|
|
58
62
|
backgroundColor: "var(--summary-bg)",
|
|
59
63
|
} }))] }, String((_c = item.groupedValue) !== null && _c !== void 0 ? _c : gIndex))) : (_jsx(NewGroupedRow, { item: item.rowData, index: gIndex, rowStyle: Object.assign(Object.assign({}, rowStyle), (selectedRow === ((_e = (_d = item.rowData) === null || _d === void 0 ? void 0 : _d.id) === null || _e === void 0 ? void 0 : _e.value)
|
|
@@ -1,5 +1,16 @@
|
|
|
1
|
-
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
const TextFilterDropdown = ({ headerDropdownIndex, sortingOps, searchOps, columnIndex, }) => {
|
|
3
|
-
return (
|
|
3
|
+
return (_jsx("div", { style: Object.assign(Object.assign({ position: "absolute", top: "calc(100% + 5px)" }, (columnIndex > 1 ? { right: 0 } : { left: 0 })), { zIndex: headerDropdownIndex ? headerDropdownIndex : 1000, backgroundColor: "var(--card-bg, var(--background))", color: "var(--foreground)", boxShadow: "0px 0.5rem 1rem 0px rgba(0,0,0,0.2)", border: "1px solid var(--divider, #eceff4)", listStyleType: "none", padding: "0.25rem 0.35rem", width: 230, borderRadius: "0.5rem", margin: 0 }), id: "grid-dropdown", onClick: (e) => e.stopPropagation(), children: _jsxs("div", { style: {
|
|
4
|
+
display: "flex",
|
|
5
|
+
flexDirection: "column",
|
|
6
|
+
gap: "0.25rem",
|
|
7
|
+
}, children: [sortingOps && (_jsx("div", { style: {
|
|
8
|
+
padding: "0.35rem 0.5rem 0.25rem",
|
|
9
|
+
borderBottom: searchOps
|
|
10
|
+
? "1px solid var(--divider, #eceff4)"
|
|
11
|
+
: "none",
|
|
12
|
+
}, children: sortingOps })), searchOps && (_jsx("div", { style: {
|
|
13
|
+
padding: "0.25rem 0.5rem 0.35rem",
|
|
14
|
+
}, children: searchOps }))] }) }));
|
|
4
15
|
};
|
|
5
16
|
export default TextFilterDropdown;
|
package/package.json
CHANGED